/*! Upstart.gg - Copyright (C) 2024 Flippable - https://github.com/upstart-gg/upstart/blob/main/LICENSE */
function o(e) {
  return { ...e, provider: "internal", schema: a(e.schema) };
}
function a(e) {
  let { items: t, ...r } = e;
  return { ...r, items: { ...t, type: "object", properties: { ...t.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", ...t.required])) } };
}
function s(e) {
  if (!("indexes" in e)) return console.error("no datasource or indexes found", e), [];
  let t = e.schema?.items?.properties || {};
  return Array.from(new Set(e.indexes?.map((i) => i.fields[0]) ?? [])).map((i) => ({ value: i, title: t[i]?.title || i }));
}
export {
  o as defineDatasource,
  s as getDatasourceIndexedFieldsWithTitles,
  a as mapDatasourceSchemaWithInternalProperties
};
//# sourceMappingURL=datasources.js.map
