@kidecms/core 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,6 +85,8 @@ type DocumentsDataTableProps = {
85
85
  collectionSlug: string;
86
86
  draftsEnabled?: boolean;
87
87
  duplicateEnabled?: boolean;
88
+ /** Offer Delete on rows and selections; false when the collection's delete rule denies it. */
89
+ deleteEnabled?: boolean;
88
90
  /** Show the Locales column. Defaults to true for callers (e.g. Recent) that mix collections. */
89
91
  showLocalesColumn?: boolean;
90
92
  defaultLocale?: string;
@@ -156,6 +158,7 @@ export default function DocumentsDataTable({
156
158
  collectionSlug,
157
159
  draftsEnabled = false,
158
160
  duplicateEnabled = true,
161
+ deleteEnabled = true,
159
162
  showLocalesColumn = true,
160
163
  defaultLocale,
161
164
  labelField = "title",
@@ -627,21 +630,35 @@ export default function DocumentsDataTable({
627
630
  </DropdownMenuItem>
628
631
  </>
629
632
  )}
630
- <DropdownMenuSeparator />
631
- <DropdownMenuItem
632
- variant="destructive"
633
- disabled={isPending}
634
- onClick={() => setDeleteConfirm([row.original])}
635
- >
636
- Delete
637
- </DropdownMenuItem>
633
+ {deleteEnabled && (
634
+ <>
635
+ <DropdownMenuSeparator />
636
+ <DropdownMenuItem
637
+ variant="destructive"
638
+ disabled={isPending}
639
+ onClick={() => setDeleteConfirm([row.original])}
640
+ >
641
+ Delete
642
+ </DropdownMenuItem>
643
+ </>
644
+ )}
638
645
  </DropdownMenuContent>
639
646
  </DropdownMenu>
640
647
  </div>
641
648
  ),
642
649
  },
643
650
  ],
644
- [columns, draftsEnabled, duplicateEnabled, showLocalesColumn, isPending, primaryColumnKey, isServerMode, runAction],
651
+ [
652
+ columns,
653
+ draftsEnabled,
654
+ duplicateEnabled,
655
+ deleteEnabled,
656
+ showLocalesColumn,
657
+ isPending,
658
+ primaryColumnKey,
659
+ isServerMode,
660
+ runAction,
661
+ ],
645
662
  );
646
663
 
647
664
  const table = useReactTable({
@@ -796,14 +813,18 @@ export default function DocumentsDataTable({
796
813
  ))}
797
814
  </>
798
815
  )}
799
- <DropdownMenuSeparator />
800
- <DropdownMenuItem
801
- variant="destructive"
802
- disabled={isPending}
803
- onClick={() => setDeleteConfirm(selectedRows)}
804
- >
805
- Delete selected
806
- </DropdownMenuItem>
816
+ {deleteEnabled && (
817
+ <>
818
+ <DropdownMenuSeparator />
819
+ <DropdownMenuItem
820
+ variant="destructive"
821
+ disabled={isPending}
822
+ onClick={() => setDeleteConfirm(selectedRows)}
823
+ >
824
+ Delete selected
825
+ </DropdownMenuItem>
826
+ </>
827
+ )}
807
828
  </DropdownMenuContent>
808
829
  </DropdownMenu>
809
830
  )}
@@ -17,6 +17,7 @@ import SharedSectionBlockField from "./SharedSectionBlockField";
17
17
  import ColorField from "./ColorField";
18
18
  import LinkField from "./LinkField";
19
19
  import RepeaterInput from "./RepeaterInput";
20
+ import ReadOnlyRepeater from "./ReadOnlyRepeater.astro";
20
21
  import type { SubFieldMeta } from "./block-fields";
21
22
  import { Input } from "./ui/input";
22
23
  import { Label } from "./ui/label";
@@ -141,6 +142,12 @@ const toBlockTypesMeta = (source: Record<string, Record<string, FieldConfig>> |
141
142
  )
142
143
  : {};
143
144
 
145
+ const repeaterItemFields =
146
+ "itemFields" in field && field.itemFields
147
+ ? Object.fromEntries(
148
+ Object.entries(field.itemFields).map(([subName, subField]) => [subName, toSubFieldMeta(subField)]),
149
+ )
150
+ : undefined;
144
151
  const blockTypesSource = field.type === "blocks" ? field.types : field.type === "content" ? field.blocks : null;
145
152
  const blockTypesMeta = toBlockTypesMeta(blockTypesSource);
146
153
  const sharedBlockTypesMeta = toBlockTypesMeta(sharedBlockTypes);
@@ -412,21 +419,18 @@ const sharedBlockTypesMeta = toBlockTypesMeta(sharedBlockTypes);
412
419
  client:load
413
420
  name={name}
414
421
  value={serializedValue}
415
- itemFields={
416
- "itemFields" in field && field.itemFields
417
- ? Object.fromEntries(
418
- Object.entries(field.itemFields).map(([subName, subField]) => [subName, toSubFieldMeta(subField)]),
419
- )
420
- : undefined
421
- }
422
+ itemFields={repeaterItemFields}
422
423
  linkOptions={linkableCollections}
423
424
  />
424
425
  )}
425
426
 
427
+ {field.type === "json" && field.admin?.component === "repeater" && readOnly && (
428
+ <ReadOnlyRepeater name={name} value={serializedValue} itemFields={repeaterItemFields} />
429
+ )}
430
+
426
431
  {field.type === "json" &&
427
432
  (field.admin?.component === "menu-items" ||
428
433
  field.admin?.component === "taxonomy-terms" ||
429
- field.admin?.component === "repeater" ||
430
434
  field.admin?.component === "shared-section-block") &&
431
435
  readOnly && (
432
436
  <Textarea
@@ -0,0 +1,41 @@
1
+ ---
2
+ import { repeaterTable } from "./block-values";
3
+ import type { SubFieldMeta } from "./block-fields";
4
+
5
+ const { name, value, itemFields } = Astro.props as {
6
+ name: string;
7
+ value?: string;
8
+ itemFields?: Record<string, SubFieldMeta>;
9
+ };
10
+ const { columns, rows } = repeaterTable(value, itemFields);
11
+ ---
12
+
13
+ <input type="hidden" name={name} value={value ?? "[]"} />
14
+ {
15
+ rows.length === 0 ? (
16
+ <p class="text-muted-foreground text-sm">No items</p>
17
+ ) : (
18
+ <div class="bg-muted/40 overflow-x-auto rounded-md border">
19
+ <table class="w-full text-sm">
20
+ <thead>
21
+ <tr class="border-b">
22
+ {columns.map((column) => (
23
+ <th scope="col" class="text-muted-foreground px-3 py-2 text-left font-medium whitespace-nowrap">
24
+ {column.label}
25
+ </th>
26
+ ))}
27
+ </tr>
28
+ </thead>
29
+ <tbody class="divide-y">
30
+ {rows.map((row) => (
31
+ <tr>
32
+ {row.map((cell) => (
33
+ <td class="text-muted-foreground px-3 py-2 align-top">{cell}</td>
34
+ ))}
35
+ </tr>
36
+ ))}
37
+ </tbody>
38
+ </table>
39
+ </div>
40
+ )
41
+ }
@@ -71,18 +71,9 @@ export function generateKey() {
71
71
  return "blk_" + Math.random().toString(36).slice(2, 9);
72
72
  }
73
73
 
74
- export function humanize(value: string) {
75
- return value
76
- .replace(/^_+/, "")
77
- .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
78
- .replace(/[-_]/g, " ")
79
- .replace(/\s+/g, " ")
80
- .trim()
81
- .replace(/^\w/, (char) => char.toUpperCase());
82
- }
83
-
84
74
  // Pure value helpers live in a React-free module so they can be unit-tested.
85
- export { blankBlockFields, getPreviewText } from "./block-values";
75
+ export { blankBlockFields, getPreviewText, humanize } from "./block-values";
76
+ import { humanize } from "./block-values";
86
77
 
87
78
  // -----------------------------------------------
88
79
  // Sub-field label + control wrapper
@@ -2,6 +2,16 @@
2
2
  // from block-fields.tsx) and unit-tested directly.
3
3
  import type { SubFieldMeta } from "./block-fields";
4
4
 
5
+ export function humanize(value: string) {
6
+ return value
7
+ .replace(/^_+/, "")
8
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
9
+ .replace(/[-_]/g, " ")
10
+ .replace(/\s+/g, " ")
11
+ .trim()
12
+ .replace(/^\w/, (char) => char.toUpperCase());
13
+ }
14
+
5
15
  /** Build a blank value object for a freshly inserted block of the given type. */
6
16
  export function blankBlockFields(fieldsMeta: Record<string, SubFieldMeta>): Record<string, unknown> {
7
17
  const out: Record<string, unknown> = {};
@@ -27,7 +37,11 @@ const richTextPreview = (value: unknown): string => {
27
37
  }
28
38
  const collect = (node: PreviewNode): string =>
29
39
  typeof node.value === "string" ? node.value : (node.children ?? []).map(collect).join(" ");
30
- return doc && typeof doc === "object" ? collect(doc as PreviewNode).replace(/\s+/g, " ").trim() : "";
40
+ return doc && typeof doc === "object"
41
+ ? collect(doc as PreviewNode)
42
+ .replace(/\s+/g, " ")
43
+ .trim()
44
+ : "";
31
45
  };
32
46
 
33
47
  /**
@@ -50,3 +64,35 @@ export function getPreviewText(values: Record<string, unknown>, fieldsMeta: Reco
50
64
  }
51
65
  return "";
52
66
  }
67
+
68
+ /**
69
+ * Rows of a repeater value as display text, for read-only rendering. Columns
70
+ * follow `itemFields` when declared, otherwise every key seen in the rows.
71
+ */
72
+ export function repeaterTable(
73
+ value: unknown,
74
+ itemFields?: Record<string, SubFieldMeta>,
75
+ ): { columns: { key: string; label: string }[]; rows: string[][] } {
76
+ let items: unknown = value;
77
+ if (typeof items === "string") {
78
+ try {
79
+ items = JSON.parse(items || "[]");
80
+ } catch {
81
+ items = [];
82
+ }
83
+ }
84
+ const rows = (Array.isArray(items) ? items : []).filter(
85
+ (row): row is Record<string, unknown> => !!row && typeof row === "object" && !Array.isArray(row),
86
+ );
87
+ const keys = itemFields ? Object.keys(itemFields) : [...new Set(rows.flatMap((row) => Object.keys(row)))];
88
+ const text = (cell: unknown) => {
89
+ if (cell === null || cell === undefined || cell === "") return "–";
90
+ if (typeof cell === "boolean") return cell ? "Yes" : "No";
91
+ if (typeof cell === "object") return JSON.stringify(cell);
92
+ return String(cell);
93
+ };
94
+ return {
95
+ columns: keys.map((key) => ({ key, label: itemFields?.[key]?.label ?? humanize(key) })),
96
+ rows: rows.map((row) => keys.map((key) => text(row[key]))),
97
+ };
98
+ }
@@ -19,6 +19,22 @@ export function canWrite(config: CMSConfig, user: User, slug: string): boolean {
19
19
  return rule({ user: user ?? null, doc: null, operation: "create", collection: slug }) as boolean;
20
20
  }
21
21
 
22
+ /** Whether the collection's update rule lets this user edit the document. */
23
+ export function canUpdate(config: CMSConfig, user: User, slug: string, doc?: Record<string, unknown> | null): boolean {
24
+ const c = config.collections.find((col) => col.slug === slug);
25
+ const rule = c?.access?.update;
26
+ if (!rule) return c?.auth ? user?.role === "admin" || (!!doc && doc._id === user?.id) : true;
27
+ return rule({ user: user ?? null, doc: doc ?? null, operation: "update", collection: slug }) as boolean;
28
+ }
29
+
30
+ /** Whether the collection's delete rule lets this user delete (the document, when given). */
31
+ export function canDelete(config: CMSConfig, user: User, slug: string, doc?: Record<string, unknown> | null): boolean {
32
+ const c = config.collections.find((col) => col.slug === slug);
33
+ const rule = c?.access?.delete;
34
+ if (!rule) return c?.auth ? user?.role === "admin" : true;
35
+ return rule({ user: user ?? null, doc: doc ?? null, operation: "delete", collection: slug }) as boolean;
36
+ }
37
+
22
38
  export function isFieldHidden(
23
39
  collection: { slug: string; fields: Record<string, any> } | null,
24
40
  user: User,
@@ -26,6 +26,9 @@ import {
26
26
  resolveCollaboration,
27
27
  } from "../../core";
28
28
  import {
29
+ canDelete,
30
+ canUpdate,
31
+ canWrite,
29
32
  getFormAction,
30
33
  getVisualStatus,
31
34
  isFieldHidden as isFieldHiddenFn,
@@ -80,7 +83,8 @@ const collectionApi = cmsRuntime[collection.slug];
80
83
  const isSingleton = collection.singleton === true;
81
84
 
82
85
  const isFieldHidden = (fieldName: string) => isFieldHiddenFn(collection, user, fieldName);
83
- const isFieldReadOnly = (fieldName: string) => isFieldReadOnlyFn(collection, user, fieldName);
86
+ // A document the collection rules won't let this user change renders every field read-only
87
+ const isFieldReadOnly = (fieldName: string) => !docEditable || isFieldReadOnlyFn(collection, user, fieldName);
84
88
 
85
89
  // --- Data loading ---
86
90
  let doc: Record<string, unknown> | null = null;
@@ -104,6 +108,16 @@ if (mode === "edit" && documentId) {
104
108
  }
105
109
  }
106
110
 
111
+ // Hide actions the access rules would refuse anyway: a document nobody may
112
+ // edit (an ERP mirror, say) gets no Save, and Delete/Duplicate follow their rules
113
+ const docEditable =
114
+ mode === "new" ? canWrite(config, user, collection.slug) : canUpdate(config, user, collection.slug, doc);
115
+ const canSave = Object.keys(collection.fields).some(
116
+ (fieldName) => !isFieldHidden(fieldName) && !isFieldReadOnly(fieldName),
117
+ );
118
+ const canDeleteDoc = canDelete(config, user, collection.slug, doc);
119
+ const canDuplicate = canWrite(config, user, collection.slug);
120
+
107
121
  const relationMetaByField = loadRelationMeta(collection, config, user);
108
122
  // Seed labels for the ids this document already points at, so relation fields
109
123
  // render named selections immediately instead of resolving them client-side.
@@ -330,20 +344,22 @@ const publishBlocked =
330
344
  </form>
331
345
  ) : (
332
346
  <>
333
- <button
334
- class={buttonVariants({ variant: "outline" })}
335
- type="submit"
336
- form="document-form"
337
- name="_intent"
338
- value="save"
339
- disabled={mode === "edit"}
340
- >
341
- {collection.slug === "users" && mode === "new"
342
- ? "Send invite"
343
- : collection.drafts
344
- ? "Save draft"
345
- : "Save"}
346
- </button>
347
+ {canSave && (
348
+ <button
349
+ class={buttonVariants({ variant: "outline" })}
350
+ type="submit"
351
+ form="document-form"
352
+ name="_intent"
353
+ value="save"
354
+ disabled={mode === "edit"}
355
+ >
356
+ {collection.slug === "users" && mode === "new"
357
+ ? "Send invite"
358
+ : collection.drafts
359
+ ? "Save draft"
360
+ : "Save"}
361
+ </button>
362
+ )}
347
363
  {collection.drafts &&
348
364
  (publishBlocked ? (
349
365
  <button
@@ -384,8 +400,8 @@ const publishBlocked =
384
400
  documentId={documentId}
385
401
  showUnpublish={collection.drafts && doc?._status === "published"}
386
402
  showDiscardDraft={Boolean(collection.drafts && doc?._status === "published" && doc?._published)}
387
- showDelete={!isSingleton}
388
- showDuplicate={!isSingleton && !collection.auth}
403
+ showDelete={!isSingleton && canDeleteDoc}
404
+ showDuplicate={!isSingleton && !collection.auth && canDuplicate}
389
405
  showSchedule={!!collection.drafts}
390
406
  showCancelSchedule={collection.drafts && doc?._status === "scheduled"}
391
407
  currentPublishAt={doc?._publishAt ? String(doc._publishAt) : undefined}
@@ -18,7 +18,7 @@ import {
18
18
  humanize,
19
19
  resolveCollaboration,
20
20
  } from "../../core";
21
- import { canWrite, getVisualStatus } from "../lib/access";
21
+ import { canDelete, canWrite, getVisualStatus } from "../lib/access";
22
22
  import { loadRelationOptionList, loadSharedSectionUsageCounts } from "../lib/edit-data";
23
23
 
24
24
  type CollectionLike = {
@@ -238,7 +238,8 @@ const tableRows = docs.map((entry: Record<string, unknown>) => {
238
238
  client:load
239
239
  collectionSlug={collection.slug}
240
240
  draftsEnabled={collection.drafts}
241
- duplicateEnabled={!collection.auth}
241
+ duplicateEnabled={!collection.auth && canWrite(config, user, collection.slug)}
242
+ deleteEnabled={canDelete(config, user, collection.slug)}
242
243
  showLocalesColumn={showLocalesColumn}
243
244
  defaultLocale={locales.length > 1 ? defaultLocale : undefined}
244
245
  labelField={getLabelField(collection)}
package/core/api.ts CHANGED
@@ -1341,11 +1341,15 @@ export const createCms = (config: CMSConfig) => {
1341
1341
  }
1342
1342
 
1343
1343
  const timestamp = now();
1344
+ // A pending end date survives publishing, whether the publish comes from
1345
+ // the schedule cron or an editor publishing new edits
1346
+ const unpublishAt =
1347
+ typeof existing._unpublishAt === "string" && existing._unpublishAt > timestamp ? existing._unpublishAt : null;
1344
1348
  const updateValues: Record<string, unknown> = {
1345
1349
  _status: "published",
1346
1350
  _publishedAt: timestamp,
1347
1351
  _publishAt: null,
1348
- _unpublishAt: null,
1352
+ _unpublishAt: unpublishAt,
1349
1353
  _published: null,
1350
1354
  };
1351
1355
  if (collection.timestamps !== false) updateValues._updatedAt = timestamp;
package/core/generator.ts CHANGED
@@ -201,12 +201,10 @@ const generateVersionsTable = (collection: CollectionConfig): string | null => {
201
201
  });`;
202
202
  };
203
203
 
204
+ const SCHEMA_IMPORT_PLACEHOLDER = "/* kide:schema-imports */";
205
+
204
206
  const generateSchemaFile = (config: CMSConfig): string => {
205
- const parts: string[] = [
206
- `// auto-generated — do not edit`,
207
- `import { sqliteTable, text, integer, real, unique, index, primaryKey } from "drizzle-orm/sqlite-core";`,
208
- ``,
209
- ];
207
+ const parts: string[] = [`// auto-generated — do not edit`, SCHEMA_IMPORT_PLACEHOLDER, ``];
210
208
 
211
209
  const authSpecs = getAuthSpecs(config);
212
210
 
@@ -390,7 +388,12 @@ const generateSchemaFile = (config: CMSConfig): string => {
390
388
  }
391
389
  parts.push(`export const cmsTables = {\n${tableExports.join("\n")}\n};`);
392
390
 
393
- return parts.join("\n");
391
+ // Import only the builders the schema calls, so generated code lints clean
392
+ const body = parts.join("\n");
393
+ const builders = ["sqliteTable", "text", "integer", "real", "unique", "index", "primaryKey"].filter((name) =>
394
+ new RegExp(`(?<![.\\w])${name}\\(`).test(body),
395
+ );
396
+ return body.replace(SCHEMA_IMPORT_PLACEHOLDER, `import { ${builders.join(", ")} } from "drizzle-orm/sqlite-core";`);
394
397
  };
395
398
 
396
399
  const zodTypeForField = (field: FieldConfig): string => {
@@ -498,10 +501,12 @@ const typeForField = (field: FieldConfig): string => {
498
501
  return "unknown";
499
502
  };
500
503
 
504
+ const TYPES_IMPORT_PLACEHOLDER = "/* kide:types-imports */";
505
+
501
506
  const generateTypesFile = (config: CMSConfig, coreImportPath: string): string => {
502
507
  const parts: string[] = [
503
508
  `// auto-generated — do not edit`,
504
- `import type { RichTextDocument, ContentDocument } from "${coreImportPath}";`,
509
+ TYPES_IMPORT_PLACEHOLDER,
505
510
  ``,
506
511
  `export type CMSCollectionSlug = ${config.collections.map((collection) => JSON.stringify(collection.slug)).join(" | ")};`,
507
512
  ``,
@@ -551,7 +556,11 @@ const generateTypesFile = (config: CMSConfig, coreImportPath: string): string =>
551
556
  snapshot: Record<string, unknown>;
552
557
  };`);
553
558
 
554
- return parts.join("\n");
559
+ const body = parts.join("\n");
560
+ const used = ["RichTextDocument", "ContentDocument"].filter((name) => new RegExp(`\\b${name}\\b`).test(body));
561
+ return used.length > 0
562
+ ? body.replace(TYPES_IMPORT_PLACEHOLDER, `import type { ${used.join(", ")} } from "${coreImportPath}";`)
563
+ : body.replace(`${TYPES_IMPORT_PLACEHOLDER}\n`, "");
555
564
  };
556
565
 
557
566
  const generateApiFile = (
@@ -570,7 +579,7 @@ const generateApiFile = (
570
579
  const apiTypes = config.collections
571
580
  .map((collection) => {
572
581
  const baseName = pascalCase(collection.slug);
573
- const ctx = `context?: { user?: { id: string; role?: string; email?: string; [key: string]: unknown } | null; _system?: boolean }`;
582
+ const ctx = `context?: CmsContext`;
574
583
  const apiKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(collection.slug) ? collection.slug : `"${collection.slug}"`;
575
584
  return ` ${apiKey}: {
576
585
  find(options?: import("${coreImportPath}").FindOptions, ${ctx}): Promise<${baseName}Document[]>;
@@ -581,6 +590,7 @@ const generateApiFile = (
581
590
  upsert(data: ${baseName}Input & { _id?: string }, ${ctx}): Promise<${baseName}Document>;
582
591
  update(id: string, data: Partial<${baseName}Input>, ${ctx}): Promise<${baseName}Document>;
583
592
  delete(id: string, ${ctx}): Promise<void>;
593
+ deleteMany(where?: import("${coreImportPath}").FindOptions["where"], ${ctx}): Promise<number>;
584
594
  count(filter?: Omit<import("${coreImportPath}").FindOptions, "limit" | "offset" | "sort">, ${ctx}): Promise<number>;
585
595
  versions(id: string, ${ctx}): Promise<import("./types").StoredVersion[]>;
586
596
  restore(id: string, versionNumber: number, ${ctx}): Promise<${baseName}Document>;
@@ -600,10 +610,20 @@ import type {
600
610
  ${imports.map((entry) => `${entry},`).join("\n ")}
601
611
  } from "./types";
602
612
 
613
+ export type CmsContext = {
614
+ user?: { id: string; role?: string; email?: string; [key: string]: unknown } | null;
615
+ cache?: { invalidate: (opts: { tags: string[] }) => void | Promise<void> };
616
+ /** Bypass access rules (server-side / system operations). */
617
+ _system?: boolean;
618
+ /** Skip search indexing for bulk writes; reindex once afterwards. */
619
+ _skipSearch?: boolean;
620
+ };
621
+
603
622
  export const cms = createCms(config) as {
604
623
  ${apiTypes}
605
624
  meta: ReturnType<typeof createCms>["meta"];
606
625
  scheduled: ReturnType<typeof createCms>["scheduled"];
626
+ tasks: ReturnType<typeof createCms>["tasks"];
607
627
  };
608
628
  `;
609
629
  };
@@ -32,10 +32,15 @@ import {
32
32
  } from "../core";
33
33
  import { loadProjectConfig, loadProjectRuntime } from "./project";
34
34
 
35
- export const createCmsContext = async () => {
35
+ /**
36
+ * Pass the generated API type to get typed collections in scripts:
37
+ *
38
+ * const { cms } = await createCmsContext<typeof import("@/cms/.generated/api").cms>();
39
+ */
40
+ export const createCmsContext = async <TCms = ReturnType<typeof createCms>>() => {
36
41
  await loadProjectRuntime(); // side effect: configureCmsRuntime()
37
42
  const config = await loadProjectConfig();
38
- const cms = createCms(config);
43
+ const cms = createCms(config) as TCms;
39
44
  const db = await getDb();
40
45
  return {
41
46
  /** Typed local API: `cms.posts.create(...)`, `cms.pages.deleteMany(...)`, … */
@@ -51,7 +56,7 @@ export const createCmsContext = async () => {
51
56
  load: (
52
57
  items: ImportItem[],
53
58
  options?: { dryRun?: boolean; throwOnFailed?: boolean; context?: Record<string, unknown> },
54
- ) => importDocuments(cms as Record<string, any>, config, items, options),
59
+ ) => importDocuments(cms as unknown as Record<string, any>, config, items, options),
55
60
  /** The machine-readable content model (same as `.kide/model.json`). */
56
61
  model: () => describeModel(config),
57
62
  /** Rebuild the search index for all searchable collections (uses this config's locales). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kidecms/core",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Kide CMS runtime — core library, admin UI, routes, and middleware for Astro. Shipped as TypeScript source.",
5
5
  "keywords": [
6
6
  "cms",