@caelo-cms/shared 0.11.4 → 0.11.6

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.
Files changed (66) hide show
  1. package/dist/ai-tools.d.ts +206 -2
  2. package/dist/ai-tools.d.ts.map +1 -1
  3. package/dist/ai-tools.js +23 -9
  4. package/dist/ai-tools.js.map +1 -1
  5. package/dist/change-journal.d.ts +71 -0
  6. package/dist/change-journal.d.ts.map +1 -0
  7. package/dist/change-journal.js +251 -0
  8. package/dist/change-journal.js.map +1 -0
  9. package/dist/content.d.ts +214 -0
  10. package/dist/content.d.ts.map +1 -1
  11. package/dist/content.js +29 -11
  12. package/dist/content.js.map +1 -1
  13. package/dist/index.d.ts +2 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/lists/fields.d.ts +5 -0
  18. package/dist/lists/fields.d.ts.map +1 -1
  19. package/dist/lists/fields.js +6 -1
  20. package/dist/lists/fields.js.map +1 -1
  21. package/dist/lists/list-type.d.ts.map +1 -1
  22. package/dist/lists/list-type.js +6 -3
  23. package/dist/lists/list-type.js.map +1 -1
  24. package/dist/lists/page-type.d.ts +1 -0
  25. package/dist/lists/page-type.d.ts.map +1 -1
  26. package/dist/lists/page-type.js +7 -0
  27. package/dist/lists/page-type.js.map +1 -1
  28. package/dist/live-events.d.ts +8 -4
  29. package/dist/live-events.d.ts.map +1 -1
  30. package/dist/live-events.js +18 -3
  31. package/dist/live-events.js.map +1 -1
  32. package/dist/media.d.ts +19 -0
  33. package/dist/media.d.ts.map +1 -1
  34. package/dist/media.js +16 -0
  35. package/dist/media.js.map +1 -1
  36. package/dist/phase-timer.d.ts +43 -2
  37. package/dist/phase-timer.d.ts.map +1 -1
  38. package/dist/phase-timer.js +170 -4
  39. package/dist/phase-timer.js.map +1 -1
  40. package/dist/pool-budget.d.ts +152 -0
  41. package/dist/pool-budget.d.ts.map +1 -0
  42. package/dist/pool-budget.js +151 -0
  43. package/dist/pool-budget.js.map +1 -0
  44. package/dist/themes-errors.js +1 -1
  45. package/dist/themes-errors.js.map +1 -1
  46. package/dist/version.d.ts +2 -2
  47. package/dist/version.js +1 -1
  48. package/package.json +1 -1
  49. package/src/ai-tools.ts +23 -8
  50. package/src/change-journal.ts +323 -0
  51. package/src/content.ts +32 -11
  52. package/src/index.ts +2 -0
  53. package/src/lists/fields.ts +7 -1
  54. package/src/lists/list-fixtures.test.ts +1 -0
  55. package/src/lists/list-type.ts +6 -2
  56. package/src/lists/lists.test.ts +1 -0
  57. package/src/lists/page-type.ts +7 -0
  58. package/src/live-events.ts +18 -3
  59. package/src/media.test.ts +31 -0
  60. package/src/media.ts +17 -0
  61. package/src/phase-timer.test.ts +37 -0
  62. package/src/phase-timer.ts +182 -4
  63. package/src/pool-budget.test.ts +111 -0
  64. package/src/pool-budget.ts +234 -0
  65. package/src/themes-errors.ts +1 -1
  66. package/src/version.ts +1 -1
@@ -0,0 +1,251 @@
1
+ // SPDX-License-Identifier: MPL-2.0
2
+ /**
3
+ * Issue #1267 — the change journal's registry: which `cms_admin` tables
4
+ * write journal rows, under which kind, and why every other table does not.
5
+ * The contract is `docs/dev/state-and-changes.md`.
6
+ *
7
+ * The journal (`entity_changes`, migration 0430) is written by generic row
8
+ * triggers that migrations attach with `caelo_journal_attach(...)`. This
9
+ * file is the readable copy of that set, and the CI test
10
+ * `change-journal-registry.integration.test.ts` holds both in step: every
11
+ * `cms_admin` table must be either journaled here with the exact trigger
12
+ * arguments the database carries, or exempt here with a written reason. A
13
+ * new table that is neither fails CI, so no table can silently fall
14
+ * outside the journal.
15
+ *
16
+ * Plugin storage tables (`plugin_<slug>.*`) are not listed: the host
17
+ * attaches the trigger when it provisions a plugin's schema, under the kind
18
+ * `plugin_storage` keyed on the plugin's id (never on its reusable slug), so
19
+ * a new plugin or domain needs no journal migration.
20
+ */
21
+ /** Every kind a journal row can carry. A consumer names the kinds it reads. */
22
+ export const JOURNAL_KINDS = [
23
+ "page",
24
+ "page_terms",
25
+ "page_seo",
26
+ "page_layout",
27
+ "page_module_content",
28
+ "module",
29
+ "template",
30
+ "template_blocks",
31
+ "layout",
32
+ "layout_blocks",
33
+ "layout_module",
34
+ "content_instance",
35
+ "list",
36
+ "list_type",
37
+ "page_type",
38
+ "theme",
39
+ "media",
40
+ "media_variant",
41
+ "media_crop",
42
+ "font",
43
+ "redirect",
44
+ "domain",
45
+ "site_defaults",
46
+ "site_settings",
47
+ "site_memory",
48
+ "skill",
49
+ "plugin",
50
+ "plugin_installation",
51
+ "plugin_grant",
52
+ "plugin_file",
53
+ "plugin_row",
54
+ "plugin_storage",
55
+ "snapshot",
56
+ ];
57
+ const KIND_SET = new Set(JOURNAL_KINDS);
58
+ /** Is `value` a journal kind? */
59
+ export function isJournalKind(value) {
60
+ return KIND_SET.has(value);
61
+ }
62
+ const row = (kind, key, pair, extra = {}) => ({ kind, mode: "row", key, pair, ...extra });
63
+ const snapshot = (kind, key, extra = {}) => ({ kind, mode: "snapshot", key, pair: ["id"], ...extra });
64
+ /**
65
+ * The journaled `cms_admin` tables. Everything an editor, a render, a
66
+ * build or a plugin derives from: content and its snapshots, media,
67
+ * settings that render into pages, redirects, plugins and their grants.
68
+ */
69
+ export const JOURNALED_TABLES = {
70
+ pages: row("page", "id", ["id"], { branch: "chat_branch_id" }),
71
+ page_terms: row("page_terms", "page_id", ["page_id", "list_id", "item_id"]),
72
+ pages_seo: row("page_seo", "page_id", ["page_id"]),
73
+ page_modules: row("page_layout", "page_id", ["page_id", "block_name", "position"]),
74
+ page_module_content: row("page_module_content", "id", ["id"], { parent: "page_id" }),
75
+ modules: row("module", "id", ["id"], { branch: "chat_branch_id" }),
76
+ templates: row("template", "id", ["id"], { branch: "chat_branch_id" }),
77
+ template_blocks: row("template_blocks", "template_id", ["template_id", "name"]),
78
+ layouts: row("layout", "id", ["id"], { branch: "chat_branch_id" }),
79
+ layout_blocks: row("layout_blocks", "layout_id", ["layout_id", "name"]),
80
+ layout_modules: row("layout_module", "layout_id", ["layout_id", "block_name", "position"]),
81
+ content_instances: row("content_instance", "id", ["id"], {
82
+ branch: "chat_branch_id",
83
+ parent: "module_id",
84
+ }),
85
+ lists: row("list", "id", ["id"], { branch: "chat_branch_id" }),
86
+ list_types: row("list_type", "id", ["id"], { branch: "chat_branch_id" }),
87
+ page_types: row("page_type", "id", ["id"], { branch: "chat_branch_id" }),
88
+ themes: row("theme", "id", ["id"]),
89
+ media_assets: row("media", "id", ["id"]),
90
+ media_variants: row("media_variant", "asset_id", ["asset_id", "variant"]),
91
+ media_crops: row("media_crop", "id", ["id"], { parent: "asset_id" }),
92
+ font_assets: row("font", "id", ["id"]),
93
+ redirects: row("redirect", "id", ["id"]),
94
+ domains: row("domain", "id", ["id"]),
95
+ site_defaults: row("site_defaults", "id", ["id"]),
96
+ site_settings: row("site_settings", "id", ["id"]),
97
+ site_ai_memory: row("site_memory", "id", ["id"]),
98
+ skills: row("skill", "id", ["id"]),
99
+ plugins: row("plugin", "id", ["id"]),
100
+ plugin_installation_versions: row("plugin_installation", "id", ["id"], { parent: "plugin_id" }),
101
+ plugin_capability_grants: row("plugin_grant", "id", ["id"], { parent: "plugin_id" }),
102
+ plugin_private_files: row("plugin_file", "id", ["plugin_id", "id"], { plugin: "plugin_id" }),
103
+ site_snapshots: { kind: "snapshot", mode: "header", key: "id", pair: ["id"] },
104
+ page_snapshots: snapshot("page", "page_id"),
105
+ page_layout_snapshots: snapshot("page_layout", "page_id"),
106
+ page_module_content_snapshots: snapshot("page_module_content", "page_module_content_id", {
107
+ parent: "page_id",
108
+ }),
109
+ module_snapshots: snapshot("module", "module_id"),
110
+ template_snapshots: snapshot("template", "template_id"),
111
+ layout_module_snapshots: snapshot("layout_module", "layout_id"),
112
+ content_instance_snapshots: snapshot("content_instance", "content_instance_id"),
113
+ list_snapshots: snapshot("list", "list_id"),
114
+ list_type_snapshots: snapshot("list_type", "list_type_id"),
115
+ page_type_snapshots: snapshot("page_type", "page_type_id"),
116
+ theme_snapshots: snapshot("theme", "theme_id"),
117
+ plugin_row_snapshots: snapshot("plugin_row", "row_id", {
118
+ parent: "table_name",
119
+ plugin: "plugin_id",
120
+ }),
121
+ };
122
+ const QUEUE = "a proposal queue; its changes reach editors as the op-classified `pending` topic";
123
+ const LOG = "an append-only log or history; nothing is derived from it";
124
+ const LEASE = "a lease or lock that coordinates processes; nothing is derived from it";
125
+ const SECURITY = "identity and permission rows, read per request by the auth layer";
126
+ const RUNTIME = "runtime bookkeeping of a process (health, progress, cache)";
127
+ const RETIRED = "retired by #1267; nothing reads it any more, migration 0442 drops it";
128
+ const RETIRED_SIGNAL = "retired by #1267; nothing reads it, its writer triggers stay one release for the previous image (roll, rollback), migration 0442 drops both";
129
+ /**
130
+ * Every `cms_admin` table that writes no journal rows, with the reason.
131
+ * Adding a table here is a decision a reviewer reads, not a default.
132
+ */
133
+ export const JOURNAL_EXEMPT_TABLES = {
134
+ __drizzle_migrations: "the migration runner's own bookkeeping",
135
+ entity_changes: "the journal itself",
136
+ entity_change_horizons: "the journal's garbage-collection horizons",
137
+ change_consumers: "the journal's consumer cursors",
138
+ domain_events: RETIRED,
139
+ font_usage_changes: RETIRED_SIGNAL,
140
+ site_view_generation: RETIRED_SIGNAL,
141
+ plugin_event_cursors: RETIRED,
142
+ actors: SECURITY,
143
+ users: SECURITY,
144
+ roles: SECURITY,
145
+ permissions: SECURITY,
146
+ role_permissions: SECURITY,
147
+ user_roles: SECURITY,
148
+ sessions: SECURITY,
149
+ password_reset_tokens: SECURITY,
150
+ owner_bootstrap_tokens: SECURITY,
151
+ mcp_tokens: SECURITY,
152
+ mcp_remote_connections: SECURITY,
153
+ mcp_remote_access_blocks: SECURITY,
154
+ mcp_transport_sessions: SECURITY,
155
+ operator_oauth_client: SECURITY,
156
+ credential_handoffs: "one-time credentials an approval left; delivered as the `credentials` topic",
157
+ user_preferences: "one person's editor preferences, read only by that person's own requests",
158
+ skill_pin_defaults: "one person's skill pins, read only by that person's own chats",
159
+ audit_events: LOG,
160
+ ai_calls: LOG,
161
+ ai_bug_reports: LOG,
162
+ ai_moduleize_attempts: LOG,
163
+ page_edit_log: LOG,
164
+ import_run_events: LOG,
165
+ platform_update_events: LOG,
166
+ plugin_errors: LOG,
167
+ redirect_syncs: LOG,
168
+ operator_access_sync_runs: LOG,
169
+ link_migration_runs: LOG,
170
+ comment_archive: "visitor comments copied from cms_public: untrusted visitor data, nothing is derived from it",
171
+ chat_sessions: "conversation metadata; what a chat changed is journaled through its snapshots, its run state reaches editors as the `agents` topic",
172
+ chat_messages: "conversation history (the provider's message log)",
173
+ chat_tool_results: "conversation history (tool results)",
174
+ chat_agent_runs: "running agents; reach editors as the op-classified `agents` topic",
175
+ chat_turn_approvals: "paused approval cards; reach editors as the `pending` topic",
176
+ chat_turn_leases: LEASE,
177
+ chat_entity_locks: "cross-branch entity locks; a takeover re-points the snapshots, which are journaled",
178
+ chat_lock_takeovers: LOG,
179
+ chat_branch_publish_marks: "which branch states reached main; the Stage that writes it also updates the journaled site_snapshots",
180
+ draft_entity_observations: "which draft entity states a chat has read (conflict detection)",
181
+ subagent_runs: "subagent bookkeeping of a chat turn",
182
+ mcp_approval_handoffs: "approval hand-offs to an MCP client",
183
+ tool_approval_actions: "approval decisions of chat tool calls",
184
+ plugin_tool_approval_bindings: "the binding of an approved plugin tool call to its arguments",
185
+ site_draft: "the shared draft branch's registry row; branch changes are journaled as snapshots",
186
+ genesis_drafts: "design drafts before a site exists; no page renders from them",
187
+ image_requests: "image generation requests; the resulting media asset is journaled",
188
+ media_alt_proposals: "alt-text suggestions awaiting review; the accepted alt is journaled on media_assets",
189
+ entity_leases: LEASE,
190
+ deploy_leases: LEASE,
191
+ plugin_activation_leases: LEASE,
192
+ rate_limit_buckets: "visitor and login rate-limit counters",
193
+ rate_limit_profiles: "gateway rate-limit profiles, published to the gateway's projection",
194
+ plugin_rate_limit_overrides: "gateway rate-limit overrides, published to the gateway's projection",
195
+ plugin_rate_limit_proposals: QUEUE,
196
+ ai_providers: "Owner AI configuration; read per call, nothing is derived from it",
197
+ ai_budgets: "Owner AI budgets; read per call, nothing is derived from it",
198
+ ai_pricing: "Owner AI pricing; read per call, nothing is derived from it",
199
+ email_config: "Owner email configuration; read per send",
200
+ telemetry_settings: "the install's telemetry consent",
201
+ staging_access: "staging access settings, synced to the hosting provider on save (docs/dev/redirects-and-settings-sync.md)",
202
+ provisioning_outputs: "what the provisioner recorded about the install",
203
+ release_check_cache: RUNTIME,
204
+ deploy_targets: "deploy target configuration; read by the deploy ops",
205
+ deploy_runs: "deploy runs; reach editors as the op-classified `deploys` topic",
206
+ redirect_sync_state: RUNTIME,
207
+ redirect_changes: "which transactions changed redirects, folded by the redirect sync; the journaled redirects table is the source",
208
+ static_bakes: "derived build output of plugin-baked regions",
209
+ plugin_data_build_state: RUNTIME,
210
+ plugin_data_stale_pages: "derived: which pages' baked plugin regions are stale",
211
+ plugin_runtime: RUNTIME,
212
+ plugin_schema_migrations: "plugin DDL bookkeeping",
213
+ plugin_schema_provisions: "plugin DDL bookkeeping",
214
+ plugin_private_file_chunks: "the bytes of plugin_private_files rows, journaled through the file row",
215
+ public_projection_outbox: "the outbox of the cms_public projection, drained by its publisher",
216
+ platform_update_agent: RUNTIME,
217
+ platform_update_notifications: RUNTIME,
218
+ platform_update_policy: "the Owner's update policy, read by the update scheduler",
219
+ platform_update_requests: "update requests, run by the upgrader job",
220
+ platform_update_scheduler: RUNTIME,
221
+ import_runs: "site-import runs; reach editors as the op-classified `crawl` topic",
222
+ import_pages: "crawled pages of a site import, before they become pages",
223
+ import_run_links: "links found by a site import",
224
+ quality_audit_runs: "quality audits; reach editors as the op-classified `quality` topic",
225
+ quality_audit_pages: "quality audit results per page",
226
+ quality_baselines: "quality baselines per page, written by the audit worker",
227
+ quality_acceptances: "accepted quality findings; reach editors as the `quality` topic",
228
+ site_memory_proposals: QUEUE,
229
+ skill_proposals: QUEUE,
230
+ ai_providers_pending_actions: QUEUE,
231
+ deploy_pending_actions: QUEUE,
232
+ domain_pending_actions: QUEUE,
233
+ email_config_pending_actions: QUEUE,
234
+ layout_pending_actions: QUEUE,
235
+ mcp_token_pending_actions: QUEUE,
236
+ owner_settings_pending_actions: QUEUE,
237
+ plugin_pending_actions: QUEUE,
238
+ quality_pending_actions: QUEUE,
239
+ role_pending_actions: QUEUE,
240
+ site_defaults_pending_actions: QUEUE,
241
+ snapshot_revert_pending_actions: QUEUE,
242
+ template_pending_actions: QUEUE,
243
+ theme_pending_actions: QUEUE,
244
+ url_migration_pending_actions: QUEUE,
245
+ user_pending_actions: QUEUE,
246
+ };
247
+ /** NOTIFY channel the journal trigger wakes consumers on (payload empty). */
248
+ export const JOURNAL_CHANNEL = "caelo_entity_changes";
249
+ /** NOTIFY channel carrying operation-classified live topics across instances. */
250
+ export const LIVE_TOPICS_CHANNEL = "caelo_live_topics";
251
+ //# sourceMappingURL=change-journal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-journal.js","sourceRoot":"","sources":["../src/change-journal.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,MAAM;IACN,YAAY;IACZ,UAAU;IACV,aAAa;IACb,qBAAqB;IACrB,QAAQ;IACR,UAAU;IACV,iBAAiB;IACjB,QAAQ;IACR,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,MAAM;IACN,WAAW;IACX,WAAW;IACX,OAAO;IACP,OAAO;IACP,eAAe;IACf,YAAY;IACZ,MAAM;IACN,UAAU;IACV,QAAQ;IACR,eAAe;IACf,eAAe;IACf,aAAa;IACb,OAAO;IACP,QAAQ;IACR,qBAAqB;IACrB,cAAc;IACd,aAAa;IACb,YAAY;IACZ,gBAAgB;IAChB,UAAU;CACF,CAAC;AAKX,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,aAAa,CAAC,CAAC;AAE7D,iCAAiC;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AE,yDAAyD;IAC5E,mBAAmB,EAAE,iEAAiE;IACtF,qBAAqB,EAAE,KAAK;IAC5B,eAAe,EAAE,KAAK;IAEtB,4BAA4B,EAAE,KAAK;IACnC,sBAAsB,EAAE,KAAK;IAC7B,sBAAsB,EAAE,KAAK;IAC7B,4BAA4B,EAAE,KAAK;IACnC,sBAAsB,EAAE,KAAK;IAC7B,yBAAyB,EAAE,KAAK;IAChC,8BAA8B,EAAE,KAAK;IACrC,sBAAsB,EAAE,KAAK;IAC7B,uBAAuB,EAAE,KAAK;IAC9B,oBAAoB,EAAE,KAAK;IAC3B,6BAA6B,EAAE,KAAK;IACpC,+BAA+B,EAAE,KAAK;IACtC,wBAAwB,EAAE,KAAK;IAC/B,qBAAqB,EAAE,KAAK;IAC5B,6BAA6B,EAAE,KAAK;IACpC,oBAAoB,EAAE,KAAK;CAC5B,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAEtD,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC"}
package/dist/content.d.ts CHANGED
@@ -459,10 +459,224 @@ export declare const moduleUpdateSchema: z.ZodObject<{
459
459
  }, z.core.$strict>;
460
460
  /** A page type slug (epic #1107, docs/lists.md §5). */
461
461
  export declare const pageTypeSlugSchema: z.ZodString;
462
+ /**
463
+ * #1276 — slugs a new page type is deliberately distinct from: the
464
+ * duplicate guard refuses a new type whose slug normalises to an existing
465
+ * one (`blogs` next to `blog`) unless the caller names it here.
466
+ */
467
+ export declare const pageTypeDistinctFromSchema: z.ZodArray<z.ZodString>;
468
+ /**
469
+ * #1276 — a page type created together with its first template
470
+ * (`templates.create` `newPageType`): the definition without `templates`
471
+ * and `defaultTemplate`, which are the new template.
472
+ */
473
+ export declare const newPageTypeSchema: z.ZodObject<{
474
+ name: z.ZodString;
475
+ slug: z.ZodString;
476
+ purpose: z.ZodString;
477
+ collection: z.ZodBoolean;
478
+ properties: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
479
+ type: z.ZodLiteral<"text">;
480
+ maxLength: z.ZodOptional<z.ZodNumber>;
481
+ name: z.ZodString;
482
+ label: z.ZodString;
483
+ required: z.ZodOptional<z.ZodBoolean>;
484
+ default: z.ZodOptional<z.ZodUnknown>;
485
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
486
+ }, z.core.$strict>, z.ZodObject<{
487
+ type: z.ZodLiteral<"richtext">;
488
+ maxLength: z.ZodOptional<z.ZodNumber>;
489
+ name: z.ZodString;
490
+ label: z.ZodString;
491
+ required: z.ZodOptional<z.ZodBoolean>;
492
+ default: z.ZodOptional<z.ZodUnknown>;
493
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
494
+ }, z.core.$strict>, z.ZodObject<{
495
+ type: z.ZodLiteral<"link">;
496
+ name: z.ZodString;
497
+ label: z.ZodString;
498
+ required: z.ZodOptional<z.ZodBoolean>;
499
+ default: z.ZodOptional<z.ZodUnknown>;
500
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
501
+ }, z.core.$strict>, z.ZodObject<{
502
+ type: z.ZodLiteral<"media">;
503
+ name: z.ZodString;
504
+ label: z.ZodString;
505
+ required: z.ZodOptional<z.ZodBoolean>;
506
+ default: z.ZodOptional<z.ZodUnknown>;
507
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
508
+ }, z.core.$strict>, z.ZodObject<{
509
+ type: z.ZodLiteral<"select">;
510
+ options: z.ZodArray<z.ZodString>;
511
+ name: z.ZodString;
512
+ label: z.ZodString;
513
+ required: z.ZodOptional<z.ZodBoolean>;
514
+ default: z.ZodOptional<z.ZodUnknown>;
515
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
516
+ }, z.core.$strict>, z.ZodObject<{
517
+ type: z.ZodLiteral<"boolean">;
518
+ name: z.ZodString;
519
+ label: z.ZodString;
520
+ required: z.ZodOptional<z.ZodBoolean>;
521
+ default: z.ZodOptional<z.ZodUnknown>;
522
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
523
+ }, z.core.$strict>, z.ZodObject<{
524
+ type: z.ZodLiteral<"number">;
525
+ min: z.ZodOptional<z.ZodNumber>;
526
+ max: z.ZodOptional<z.ZodNumber>;
527
+ name: z.ZodString;
528
+ label: z.ZodString;
529
+ required: z.ZodOptional<z.ZodBoolean>;
530
+ default: z.ZodOptional<z.ZodUnknown>;
531
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
532
+ }, z.core.$strict>, z.ZodObject<{
533
+ type: z.ZodLiteral<"date">;
534
+ name: z.ZodString;
535
+ label: z.ZodString;
536
+ required: z.ZodOptional<z.ZodBoolean>;
537
+ default: z.ZodOptional<z.ZodUnknown>;
538
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
539
+ }, z.core.$strict>, z.ZodObject<{
540
+ type: z.ZodLiteral<"icon">;
541
+ name: z.ZodString;
542
+ label: z.ZodString;
543
+ required: z.ZodOptional<z.ZodBoolean>;
544
+ default: z.ZodOptional<z.ZodUnknown>;
545
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
546
+ }, z.core.$strict>, z.ZodObject<{
547
+ type: z.ZodLiteral<"module">;
548
+ accepts: z.ZodOptional<z.ZodArray<z.ZodString>>;
549
+ name: z.ZodString;
550
+ label: z.ZodString;
551
+ required: z.ZodOptional<z.ZodBoolean>;
552
+ default: z.ZodOptional<z.ZodUnknown>;
553
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
554
+ }, z.core.$strict>, z.ZodObject<{
555
+ type: z.ZodLiteral<"term">;
556
+ list: z.ZodString;
557
+ multiple: z.ZodOptional<z.ZodBoolean>;
558
+ name: z.ZodString;
559
+ label: z.ZodString;
560
+ required: z.ZodOptional<z.ZodBoolean>;
561
+ default: z.ZodOptional<z.ZodUnknown>;
562
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
563
+ }, z.core.$strict>], "type">>>;
564
+ vocabularies: z.ZodDefault<z.ZodArray<z.ZodObject<{
565
+ list: z.ZodString;
566
+ cardinality: z.ZodEnum<{
567
+ one: "one";
568
+ many: "many";
569
+ }>;
570
+ required: z.ZodOptional<z.ZodBoolean>;
571
+ }, z.core.$strict>>>;
572
+ distinctFrom: z.ZodOptional<z.ZodArray<z.ZodString>>;
573
+ }, z.core.$strict>;
574
+ export type NewPageTypeInput = z.infer<typeof newPageTypeSchema>;
462
575
  export declare const templateCreateSchema: z.ZodObject<{
463
576
  slug: z.ZodString;
464
577
  displayName: z.ZodString;
465
578
  pageType: z.ZodOptional<z.ZodString>;
579
+ newPageType: z.ZodOptional<z.ZodObject<{
580
+ name: z.ZodString;
581
+ slug: z.ZodString;
582
+ purpose: z.ZodString;
583
+ collection: z.ZodBoolean;
584
+ properties: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
585
+ type: z.ZodLiteral<"text">;
586
+ maxLength: z.ZodOptional<z.ZodNumber>;
587
+ name: z.ZodString;
588
+ label: z.ZodString;
589
+ required: z.ZodOptional<z.ZodBoolean>;
590
+ default: z.ZodOptional<z.ZodUnknown>;
591
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
592
+ }, z.core.$strict>, z.ZodObject<{
593
+ type: z.ZodLiteral<"richtext">;
594
+ maxLength: z.ZodOptional<z.ZodNumber>;
595
+ name: z.ZodString;
596
+ label: z.ZodString;
597
+ required: z.ZodOptional<z.ZodBoolean>;
598
+ default: z.ZodOptional<z.ZodUnknown>;
599
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
600
+ }, z.core.$strict>, z.ZodObject<{
601
+ type: z.ZodLiteral<"link">;
602
+ name: z.ZodString;
603
+ label: z.ZodString;
604
+ required: z.ZodOptional<z.ZodBoolean>;
605
+ default: z.ZodOptional<z.ZodUnknown>;
606
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
607
+ }, z.core.$strict>, z.ZodObject<{
608
+ type: z.ZodLiteral<"media">;
609
+ name: z.ZodString;
610
+ label: z.ZodString;
611
+ required: z.ZodOptional<z.ZodBoolean>;
612
+ default: z.ZodOptional<z.ZodUnknown>;
613
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
614
+ }, z.core.$strict>, z.ZodObject<{
615
+ type: z.ZodLiteral<"select">;
616
+ options: z.ZodArray<z.ZodString>;
617
+ name: z.ZodString;
618
+ label: z.ZodString;
619
+ required: z.ZodOptional<z.ZodBoolean>;
620
+ default: z.ZodOptional<z.ZodUnknown>;
621
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
622
+ }, z.core.$strict>, z.ZodObject<{
623
+ type: z.ZodLiteral<"boolean">;
624
+ name: z.ZodString;
625
+ label: z.ZodString;
626
+ required: z.ZodOptional<z.ZodBoolean>;
627
+ default: z.ZodOptional<z.ZodUnknown>;
628
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
629
+ }, z.core.$strict>, z.ZodObject<{
630
+ type: z.ZodLiteral<"number">;
631
+ min: z.ZodOptional<z.ZodNumber>;
632
+ max: z.ZodOptional<z.ZodNumber>;
633
+ name: z.ZodString;
634
+ label: z.ZodString;
635
+ required: z.ZodOptional<z.ZodBoolean>;
636
+ default: z.ZodOptional<z.ZodUnknown>;
637
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
638
+ }, z.core.$strict>, z.ZodObject<{
639
+ type: z.ZodLiteral<"date">;
640
+ name: z.ZodString;
641
+ label: z.ZodString;
642
+ required: z.ZodOptional<z.ZodBoolean>;
643
+ default: z.ZodOptional<z.ZodUnknown>;
644
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
645
+ }, z.core.$strict>, z.ZodObject<{
646
+ type: z.ZodLiteral<"icon">;
647
+ name: z.ZodString;
648
+ label: z.ZodString;
649
+ required: z.ZodOptional<z.ZodBoolean>;
650
+ default: z.ZodOptional<z.ZodUnknown>;
651
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
652
+ }, z.core.$strict>, z.ZodObject<{
653
+ type: z.ZodLiteral<"module">;
654
+ accepts: z.ZodOptional<z.ZodArray<z.ZodString>>;
655
+ name: z.ZodString;
656
+ label: z.ZodString;
657
+ required: z.ZodOptional<z.ZodBoolean>;
658
+ default: z.ZodOptional<z.ZodUnknown>;
659
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
660
+ }, z.core.$strict>, z.ZodObject<{
661
+ type: z.ZodLiteral<"term">;
662
+ list: z.ZodString;
663
+ multiple: z.ZodOptional<z.ZodBoolean>;
664
+ name: z.ZodString;
665
+ label: z.ZodString;
666
+ required: z.ZodOptional<z.ZodBoolean>;
667
+ default: z.ZodOptional<z.ZodUnknown>;
668
+ ext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
669
+ }, z.core.$strict>], "type">>>;
670
+ vocabularies: z.ZodDefault<z.ZodArray<z.ZodObject<{
671
+ list: z.ZodString;
672
+ cardinality: z.ZodEnum<{
673
+ one: "one";
674
+ many: "many";
675
+ }>;
676
+ required: z.ZodOptional<z.ZodBoolean>;
677
+ }, z.core.$strict>>>;
678
+ distinctFrom: z.ZodOptional<z.ZodArray<z.ZodString>>;
679
+ }, z.core.$strict>>;
466
680
  html: z.ZodString;
467
681
  css: z.ZodDefault<z.ZodString>;
468
682
  layoutId: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../src/content.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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,CAAC;AAqBtD,eAAO,MAAM,2BAA2B;;;;;;kBAQ7B,CAAC;AAEZ,eAAO,MAAM,2BAA2B;;;;;;;kBAa7B,CAAC;AAEZ,eAAO,MAAM,2BAA2B;;kBAI7B,CAAC;AAEZ,eAAO,MAAM,yBAAyB;;;;;;;;;kBAQ3B,CAAC;AAEZ,eAAO,MAAM,0BAA0B;;;;kBAM5B,CAAC;AAEZ,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACjF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
package/dist/content.js CHANGED
@@ -13,6 +13,7 @@ import { hasEscapedLineBreaks } from "./escaped-line-breaks.js";
13
13
  import { DEFAULT_LIST_TYPES, SITE_TEXTS_LIST_TYPE } from "./lists/default-types.js";
14
14
  import { listItemInputSchema } from "./lists/items.js";
15
15
  import { LIST_MAX_ITEMS, sourceDefSchema } from "./lists/list-type.js";
16
+ import { pageTypeDefSchema } from "./lists/page-type.js";
16
17
  import { listPaginationSchema } from "./lists/pagination.js";
17
18
  import { LIST_REF_RE } from "./lists/refs.js";
18
19
  /** Lowercase slug, hyphenated, 1–64 chars, no leading/trailing hyphen. */
@@ -167,7 +168,7 @@ const CDATA_OPEN = "<![CDATA[";
167
168
  const noCdata = (value) => !value.includes(CDATA_OPEN);
168
169
  const cdataMessage = (field) => `${field} contains an XML CDATA marker (${CDATA_OPEN}) — module ${field} is stored and served ` +
169
170
  `verbatim, so CDATA wrappers reach the browser unparsed and break rendering. ` +
170
- `Remove the wrapper and resend plain ${field === "css" ? "CSS" : "JavaScript"}.`;
171
+ `Remove the wrapper: pass plain ${field === "css" ? "CSS" : "JavaScript"}.`;
171
172
  const moduleCss = z
172
173
  .string()
173
174
  .max(MODULE_CSS_MAX, `css exceeds ${MODULE_CSS_MAX} bytes`)
@@ -552,17 +553,34 @@ export const moduleUpdateSchema = z
552
553
  export const pageTypeSlugSchema = z
553
554
  .string()
554
555
  .regex(/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/, "page type slug: lowercase letters, digits, hyphens");
556
+ /**
557
+ * #1276 — slugs a new page type is deliberately distinct from: the
558
+ * duplicate guard refuses a new type whose slug normalises to an existing
559
+ * one (`blogs` next to `blog`) unless the caller names it here.
560
+ */
561
+ export const pageTypeDistinctFromSchema = z.array(pageTypeSlugSchema).max(16);
562
+ /**
563
+ * #1276 — a page type created together with its first template
564
+ * (`templates.create` `newPageType`): the definition without `templates`
565
+ * and `defaultTemplate`, which are the new template.
566
+ */
567
+ export const newPageTypeSchema = pageTypeDefSchema
568
+ .omit({ templates: true, defaultTemplate: true })
569
+ .extend({ distinctFrom: pageTypeDistinctFromSchema.optional() })
570
+ .strict();
555
571
  export const templateCreateSchema = z
556
572
  .object({
557
573
  slug: slugSchema,
558
574
  displayName: displayNameSchema,
559
575
  /**
560
- * Epic #1107 — the page type (slug) this template serves; the template
561
- * is appended to that type's `templates`. Omit for the site's default
562
- * page type (`site_defaults.default_page_type_id`, stored data — not a
563
- * render-time fallback).
576
+ * Epic #1107 / #1276 — the page type this template serves. Exactly one
577
+ * of `pageType` (an existing type's slug: the template is appended to
578
+ * its `templates`) and `newPageType` (a new type created in the same
579
+ * transaction with this template as its `defaultTemplate`) is
580
+ * required; `templates.create` refuses neither or both.
564
581
  */
565
582
  pageType: pageTypeSlugSchema.optional(),
583
+ newPageType: newPageTypeSchema.optional(),
566
584
  html: z
567
585
  .string()
568
586
  .max(TEMPLATE_HTML_MAX, `html exceeds ${TEMPLATE_HTML_MAX} bytes`)
@@ -656,9 +674,9 @@ export const pageCreateSchema = z
656
674
  */
657
675
  shortTitle: pageShortTitleSchema.optional(),
658
676
  /**
659
- * P6.7.6 — optional. When omitted, the handler resolves to
660
- * `site_defaults.default_template_id` at create time. Stored data,
661
- * not a render-time fallback (CLAUDE.md §2 no-fallbacks).
677
+ * Optional: one of the page type's templates; omitted = the type's
678
+ * `defaultTemplate`. Without `pageType` it must belong to exactly one
679
+ * page type, which the page then gets (#1276).
662
680
  */
663
681
  templateId: z.string().uuid().optional(),
664
682
  /**
@@ -676,9 +694,9 @@ export const pageCreateSchema = z
676
694
  */
677
695
  parentPageId: z.string().uuid().nullable().optional(),
678
696
  /**
679
- * Epic #1107 — what the page IS (page type slug). Omit to take the type
680
- * whose `templates` contain the template; with neither `pageType` nor
681
- * `templateId`, the site's default page type and its default template.
697
+ * Epic #1107 — what the page IS (page type slug). Required unless
698
+ * `templateId` belongs to exactly one page type; there is no stored
699
+ * default type (#1276), so a create with neither is refused.
682
700
  */
683
701
  pageType: pageTypeSlugSchema.optional(),
684
702
  /** Property values, validated against the page type. */