/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
function a(t) {
  return { ...t, provider: "internal", schema: r(t.schema) };
}
function r(t) {
  let { items: i, ...e } = t;
  return { ...e, items: { ...i, type: "object", properties: { ...i.properties, $id: { type: "string", title: "Id" }, $slug: { type: "string", format: "slug", title: "Slug" }, $publicationDate: { type: "string", format: "date-time", title: "Publication Date" }, $lastModificationDate: { type: "string", format: "date-time", title: "Last Modification Date" } }, required: Array.from(/* @__PURE__ */ new Set(["$id", "$slug", "$publicationDate", "$lastModificationDate", ...i.required])) } };
}
function n(t) {
  if (!("indexes" in t)) return console.error("no datasource or indexes found", t), [];
  let i = t.schema?.items?.properties || {};
  return Array.from(new Set(t.indexes?.map((e) => e.fields[0]) ?? [])).map((e) => ({ value: e, title: i[e]?.title || e }));
}
export {
  a as defineDatasource,
  n as getDatasourceIndexedFieldsWithTitles,
  r as mapDatasourceSchemaWithInternalProperties
};
//# sourceMappingURL=datasources.js.map
