@rimelight/cms 0.0.3 → 0.0.5

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/bylines-Csggkl-g.d.mts +405 -0
  2. package/dist/index.d.mts +724 -0
  3. package/dist/index.mjs +2382 -0
  4. package/dist/integration.d.mts +33 -0
  5. package/dist/integration.mjs +161 -0
  6. package/dist/schema/index.d.mts +2063 -0
  7. package/dist/schema/index.mjs +176 -0
  8. package/dist/schema/sqlite.d.mts +2132 -0
  9. package/dist/schema/sqlite.mjs +137 -0
  10. package/dist/storage/index.d.mts +59 -0
  11. package/dist/storage/index.mjs +133 -0
  12. package/package.json +35 -14
  13. package/src/admin/api/media-file.ts +1 -1
  14. package/src/admin/api/media.ts +28 -3
  15. package/src/admin/layouts/CMSDashboardLayout.astro +16 -3
  16. package/src/admin/pages/assets.astro +11 -11
  17. package/src/admin/pages/pages-edit.astro +3 -3
  18. package/src/admin/pages/pages-index.astro +2 -2
  19. package/src/admin/pages/pages-preview.astro +3 -3
  20. package/src/admin/pages/pages-review.astro +2 -2
  21. package/src/admin/pages/templates-edit.astro +1 -1
  22. package/src/admin/pages/templates-index.astro +1 -1
  23. package/src/astro/BlockRenderer.astro +1 -1
  24. package/src/astro/PageRenderer.astro +4 -4
  25. package/src/astro/blocks/CalloutBlock.astro +1 -1
  26. package/src/astro/blocks/OrderedListBlock.astro +2 -2
  27. package/src/astro/blocks/ParagraphBlock.astro +1 -1
  28. package/src/astro/blocks/TabsBlock.astro +5 -5
  29. package/src/astro/blocks/UnorderedListBlock.astro +2 -2
  30. package/src/auth/editor-guards.ts +1 -1
  31. package/src/cache/purge.ts +2 -2
  32. package/src/client/components/RimelightBlock.tsx +1 -1
  33. package/src/client/components/RimelightBlockPicker.tsx +1 -1
  34. package/src/client/components/RimelightPreview.tsx +27 -27
  35. package/src/client/components/RimelightPropertiesPanel.tsx +4 -4
  36. package/src/client/components/RimelightTemplateEditor.tsx +9 -5
  37. package/src/client/components/editors/CalloutEditor.tsx +10 -10
  38. package/src/client/components/editors/CardEditor.tsx +5 -5
  39. package/src/client/components/editors/CardsEditor.tsx +2 -2
  40. package/src/client/components/editors/CodeEditor.tsx +5 -5
  41. package/src/client/components/editors/DialogueEditor.tsx +6 -6
  42. package/src/client/components/editors/FileTreeEditor.tsx +1 -1
  43. package/src/client/components/editors/ImageEditor.tsx +9 -9
  44. package/src/client/components/editors/ParagraphEditor.tsx +1 -1
  45. package/src/client/components/editors/SceneEditor.tsx +9 -9
  46. package/src/client/components/editors/ScriptEditor.tsx +8 -8
  47. package/src/client/components/editors/SectionEditor.tsx +3 -3
  48. package/src/client/components/editors/StepItemEditor.tsx +6 -5
  49. package/src/client/components/editors/StepsEditor.tsx +1 -1
  50. package/src/client/components/editors/TabItemEditor.tsx +3 -3
  51. package/src/client/components/editors/TableEditor.tsx +4 -4
  52. package/src/client/components/editors/TabsEditor.tsx +1 -1
  53. package/src/client/state/editor-store.ts +23 -23
  54. package/src/client/utils/sortable.ts +13 -12
  55. package/src/client/utils/tree-sanitizer.ts +1 -1
  56. package/src/core/excerpt.ts +16 -16
  57. package/src/core/page-definitions.ts +2 -2
  58. package/src/docs/agent.ts +1 -1
  59. package/src/docs/routing.ts +2 -2
  60. package/src/env.d.ts +6 -0
  61. package/src/index.ts +17 -4
  62. package/src/integration.ts +54 -0
  63. package/src/loader/live.ts +1 -1
  64. package/src/markdown/serializer.ts +26 -26
  65. package/src/schema/sqlite.ts +344 -0
  66. package/src/storage/index.ts +4 -1
@@ -0,0 +1,724 @@
1
+ import { $ as StepItemBlock, A as ComponentShowcaseBlockProps, B as LivePreviewBlockProps, C as CardBlock, D as CodeBlock, E as CardsBlockProps, F as FileTreeNode, G as ParagraphBlockProps, H as MAX_SECTION_HEADING_LEVEL, I as HeadingLevel, J as ScriptBlock, K as SceneBlock, L as ImageBlock, M as DialogueBlockProps, N as FileTreeBlock, O as CodeBlockProps, P as FileTreeBlockProps, Q as Setting, R as ImageBlockProps, S as CalloutVariant, T as CardsBlock, U as MIN_SECTION_HEADING_LEVEL, V as MAX_SECTION_DEPTH, W as ParagraphBlock, X as SectionBlock, Y as ScriptBlockProps, Z as SectionBlockProps, _ as ApiDocumentationBlockProps, _t as InlineNode, a as PageVersionComment, at as TableBlock, b as CalloutBlock, bt as PageMentionNode, c as TemplateApprovalRules, ct as TabsBlock, d as PageContent, dt as Transition, et as StepItemBlockProps, f as PageMetadata, ft as TypedBlock, g as ApiDocumentationBlock, gt as MediaValue, h as ALLOWED_CHILDREN_MAP, ht as calculateHeadingLevel, i as PageVersionApproval, it as TabItemBlockProps, j as DialogueBlock, k as ComponentShowcaseBlock, l as TemplateRolePermissions, lt as TabsBlockProps, m as RegisterPageTypes, mt as TypedScriptBlockProps, n as BylineRole, nt as StepsBlockProps, o as PageVersionStatus, ot as TableBlockProps, p as PageType, pt as TypedSceneBlockProps, q as SceneBlockProps, r as PageVersion, rt as TabItemBlock, s as PageTemplate, st as TableColumnDef, t as BylineCredit, tt as StepsBlock, u as Localized, ut as TimeOfDay, v as BaseBlock, vt as InlineNodeType, w as CardBlockProps, x as CalloutBlockProps, xt as TextInlineNode, y as BlockType, yt as LinkInlineNode, z as LivePreviewBlock } from "./bylines-Csggkl-g.mjs";
2
+ import { Byline, InsertSiteSettings, NewByline, SiteSettings, SiteSettingsBranding, SiteSettingsSeo, bylines, contentSearchIndex, pageDraftLocks, pageDrafts, pageTaxonomyTerms, pageTemplates, pageVersionApprovals, pageVersionComments, pageVersions, pages, siteSettings, taxonomyTerms } from "./schema/index.mjs";
3
+ import { R2StorageOptions, StorageConfig, StorageFile, StorageListOptions, StorageListResult, StorageUploadOptions, deleteR2File, getR2Bucket, listR2Files, r2, uploadR2File } from "./storage/index.mjs";
4
+ import { RimelightCmsOptions, rimelightCms } from "./integration.mjs";
5
+ import { AuthAdapter, AuthAdapter as CmsAuthAdapter, UserSessionContext, UserType, auth0Auth, cfAccessAuth, evaluateAccess, hasPermission, hasRole, mockAuth } from "@rimelight/auth";
6
+ import { SQL } from "drizzle-orm";
7
+ import { Toast, ToastInput, ToastItem, addToast, clearToasts, removeToast, showErrorToast, showSuccessToast, toast, toasts } from "@rimelight/ui/components/toast/store.ts";
8
+ import { SidebarItem, SidebarScope } from "@rimelight/ui/components/sidebar/sidebar.ts";
9
+ import { BadgeProps } from "@rimelight/ui/components/badge/badge.ts";
10
+ //#region src/core/page-definitions.d.ts
11
+ type FieldType = "text" | "number" | "enum" | "text-array" | "page" | "page-array";
12
+ interface FieldDefinition {
13
+ type: FieldType;
14
+ label: {
15
+ en: string;
16
+ };
17
+ defaultValue: any;
18
+ options?: {
19
+ en: string;
20
+ }[];
21
+ allowedPageTypes?: string[];
22
+ }
23
+ interface PropertyGroup {
24
+ label: {
25
+ en: string;
26
+ };
27
+ defaultOpen: boolean;
28
+ fields: Record<string, FieldDefinition>;
29
+ }
30
+ interface PageDefinition {
31
+ typeLabelKey: string;
32
+ properties: Record<string, PropertyGroup>;
33
+ /**
34
+ * Factory that returns the initial blocks seeded when a page of this type is created
35
+ */
36
+ initialBlocks?: () => BaseBlock[];
37
+ }
38
+ declare function definePageDefinition(def: PageDefinition): PageDefinition;
39
+ declare const DOCUMENT_DEFINITION: PageDefinition;
40
+ declare const BLOG_POST_DEFINITION: PageDefinition;
41
+ declare const PATCH_NOTE_DEFINITION: PageDefinition;
42
+ declare const LOCATION_DEFINITION: PageDefinition;
43
+ declare const SPECIES_DEFINITION: PageDefinition;
44
+ declare const CHARACTER_DEFINITION: PageDefinition;
45
+ declare const SKILL_DEFINITION: PageDefinition;
46
+ declare const ITEM_DEFINITION: PageDefinition;
47
+ declare const OBJECT_DEFINITION: PageDefinition;
48
+ declare const GROUP_DEFINITION: PageDefinition;
49
+ declare const HERO_DEFINITION: PageDefinition;
50
+ declare const CARD_DEFINITION: PageDefinition;
51
+ declare const SERIES_DEFINITION: PageDefinition;
52
+ declare const PAGE_MAP: Record<string, PageDefinition>;
53
+ declare function getPageDefinition(type: string): PageDefinition;
54
+ //#endregion
55
+ //#region src/markdown/serializer.d.ts
56
+ declare function inlinesToMarkdown(inlines: InlineNode[] | {
57
+ en?: string;
58
+ } | string | undefined): string;
59
+ declare function blocksToMarkdown(blocks?: BaseBlock[], options?: {
60
+ sectionLevel?: number;
61
+ }): string;
62
+ //#endregion
63
+ //#region src/core/registry.d.ts
64
+ interface BlockDefinition {
65
+ type: string;
66
+ label: string;
67
+ description?: string;
68
+ defaultProps: Record<string, any>;
69
+ allowChildren?: boolean;
70
+ }
71
+ declare const BlockRegistry: {
72
+ register(def: BlockDefinition): void;
73
+ get(type: string): BlockDefinition | undefined;
74
+ getAll(): BlockDefinition[];
75
+ };
76
+ //#endregion
77
+ //#region src/core/validator.d.ts
78
+ declare function isValidUUID(uuid: string): boolean;
79
+ declare function validateBlockAST(blocks: BaseBlock[]): {
80
+ valid: boolean;
81
+ errors: string[];
82
+ };
83
+ //#endregion
84
+ //#region src/auth/permissions.d.ts
85
+ declare const cmsStatements: {
86
+ readonly page: readonly ["create", "read", "update", "delete", "publish", "approve"];
87
+ readonly template: readonly ["create", "read", "update", "delete", "instantiate"];
88
+ readonly draft: readonly ["checkout", "edit", "release", "force_unlock"];
89
+ readonly version: readonly ["create", "review", "approve", "publish"];
90
+ };
91
+ declare const cmsAc: {
92
+ readonly page: {
93
+ readonly read: readonly ["admin", "editor"];
94
+ readonly update: readonly ["admin", "editor"];
95
+ readonly delete: readonly ["admin"];
96
+ readonly publish: readonly ["admin"];
97
+ readonly approve: readonly ["admin"];
98
+ };
99
+ readonly template: {
100
+ readonly read: readonly ["admin", "editor"];
101
+ readonly update: readonly ["admin"];
102
+ readonly delete: readonly ["admin"];
103
+ readonly instantiate: readonly ["admin", "editor"];
104
+ };
105
+ readonly draft: {
106
+ readonly checkout: readonly ["admin", "editor"];
107
+ readonly edit: readonly ["admin", "editor"];
108
+ readonly release: readonly ["admin", "editor"];
109
+ readonly force_unlock: readonly ["admin"];
110
+ };
111
+ readonly version: {
112
+ readonly create: readonly ["admin", "editor"];
113
+ readonly review: readonly ["admin", "editor"];
114
+ readonly approve: readonly ["admin"];
115
+ readonly publish: readonly ["admin"];
116
+ };
117
+ };
118
+ interface UserSessionContext$1 {
119
+ userId: string;
120
+ roles: string[];
121
+ permissions: string[];
122
+ }
123
+ //#endregion
124
+ //#region src/auth/filter-blocks.d.ts
125
+ /**
126
+ * Pure immutable function for Astro SSR Reader. Returns new array; never mutates input AST
127
+ */
128
+ declare function filterBlocksForReader(blocks: BaseBlock[], session?: UserSessionContext$1): BaseBlock[];
129
+ //#endregion
130
+ //#region src/auth/editor-guards.d.ts
131
+ /**
132
+ * Checks if a user has edit rights over a specific block
133
+ */
134
+ declare function canUserEditBlock(block: BaseBlock, session?: UserSessionContext$1): boolean;
135
+ /**
136
+ * Recursively checks if a block or ANY of its descendants are locked or un-editable
137
+ */
138
+ declare function hasLockedDescendants(block: BaseBlock, session?: UserSessionContext$1): boolean;
139
+ /**
140
+ * Server-Side Guard: Validates that an incoming edited block tree obeys templated & authorization
141
+ * invariants
142
+ */
143
+ declare function validateServerBlockPayload(existingTree: BaseBlock[], incomingTree: BaseBlock[], session?: UserSessionContext$1): {
144
+ valid: boolean;
145
+ reason?: string;
146
+ };
147
+ //#endregion
148
+ //#region src/auth/filter-templates.d.ts
149
+ declare function canUserCreateFromTemplate(template: PageTemplate, session?: UserSessionContext$1): boolean;
150
+ declare function canUserEditFromTemplate(template: PageTemplate, session?: UserSessionContext$1): boolean;
151
+ declare function canUserReviewFromTemplate(template: PageTemplate, session?: UserSessionContext$1): boolean;
152
+ declare function canUserViewFromTemplate(template: PageTemplate, session?: UserSessionContext$1): boolean;
153
+ declare function canUserInstantiateTemplate(template: PageTemplate, session?: UserSessionContext$1): boolean;
154
+ declare function filterTemplatesForUser(templates: PageTemplate[], session?: UserSessionContext$1): PageTemplate[];
155
+ //#endregion
156
+ //#region src/cache/purge.d.ts
157
+ interface CachePurgeOptions {
158
+ slug: string;
159
+ locales: string[];
160
+ domain?: string;
161
+ basePath?: string;
162
+ isEnterpriseCloudflare?: boolean;
163
+ }
164
+ declare function invalidatePageCache(options: CachePurgeOptions): Promise<boolean>;
165
+ //#endregion
166
+ //#region src/search/query.d.ts
167
+ declare const POSTGRES_SEARCH_CONFIGS: Record<string, string>;
168
+ declare function getPostgresSearchConfig(locale: string): string;
169
+ //#endregion
170
+ //#region src/core/excerpt.d.ts
171
+ /**
172
+ * Recursively extracts plain text from an array of CMS blocks.
173
+ */
174
+ declare function extractTextFromBlocks(blocks: BaseBlock[] | undefined | null, locale?: string): string;
175
+ interface ExcerptOptions {
176
+ maxLength?: number;
177
+ locale?: string;
178
+ fallback?: string;
179
+ }
180
+ /**
181
+ * Generates an SEO / RSS safe plain text excerpt from a CMS page or block payload.
182
+ */
183
+ declare function createPageExcerpt(page: {
184
+ description?: unknown;
185
+ content?: unknown;
186
+ title?: unknown;
187
+ } | null | undefined, options?: ExcerptOptions): string;
188
+ //#endregion
189
+ //#region src/services/site-settings.d.ts
190
+ declare const DEFAULT_SITE_SETTINGS: InsertSiteSettings;
191
+ /**
192
+ * Retrieves the dynamic site settings from the database. If no settings are found, seeds the
193
+ * default record and returns it.
194
+ */
195
+ declare function getSiteSettings(db: any, fallbackDefaults?: Partial<InsertSiteSettings>): Promise<SiteSettings>;
196
+ /**
197
+ * Updates dynamic site settings in the database.
198
+ */
199
+ declare function updateSiteSettings(db: any, updates: Partial<InsertSiteSettings>, id?: string): Promise<SiteSettings>;
200
+ //#endregion
201
+ //#region src/loader/live.d.ts
202
+ interface CmsLoaderOptions {
203
+ type?: PageType | undefined;
204
+ db?: any;
205
+ locale?: string | undefined;
206
+ includeDrafts?: boolean | undefined;
207
+ includeScheduled?: boolean | undefined;
208
+ taxonomy?: {
209
+ category?: string | undefined;
210
+ tag?: string | undefined;
211
+ [key: string]: string | undefined;
212
+ } | undefined;
213
+ }
214
+ interface CmsPageData {
215
+ id: string;
216
+ slug: string;
217
+ type: PageType;
218
+ title: Localized;
219
+ resolvedTitle: string;
220
+ description?: Localized;
221
+ resolvedDescription: string;
222
+ excerpt: string;
223
+ tags: Localized[];
224
+ authorIds: string[];
225
+ blocks: BaseBlock[];
226
+ properties: Record<string, any>;
227
+ publishedVersionId: string | null;
228
+ postedAt: Date | null;
229
+ createdAt: Date;
230
+ updatedAt: Date | null;
231
+ }
232
+ interface CmsEntry {
233
+ id: string;
234
+ data: CmsPageData;
235
+ }
236
+ interface CacheHint {
237
+ tags?: string[];
238
+ lastModified?: Date;
239
+ maxAge?: number;
240
+ }
241
+ /**
242
+ * Direct querying helper for CMS collections.
243
+ */
244
+ declare function getCmsCollection(db: any, options?: CmsLoaderOptions & {
245
+ limit?: number | undefined;
246
+ offset?: number | undefined;
247
+ where?: SQL | undefined;
248
+ }): Promise<{
249
+ entries: CmsEntry[];
250
+ cacheHint: CacheHint;
251
+ }>;
252
+ /**
253
+ * Direct querying helper for a single CMS entry by slug or id.
254
+ */
255
+ declare function getCmsEntry(db: any, slugOrId: string, options?: CmsLoaderOptions): Promise<{
256
+ entry: CmsEntry | null;
257
+ cacheHint: CacheHint;
258
+ }>;
259
+ /**
260
+ * Astro Live Loader for CMS collections. Use inside src/live.config.ts with defineLiveCollection({
261
+ * loader: rimelightCmsLoader({ type: 'blog' }) })
262
+ */
263
+ declare function rimelightCmsLoader(loaderOptions?: CmsLoaderOptions): {
264
+ name: string;
265
+ loadCollection: (context: {
266
+ filter?: {
267
+ limit?: number;
268
+ offset?: number;
269
+ };
270
+ collection?: string;
271
+ }) => Promise<{
272
+ entries: CmsEntry[];
273
+ cacheHint: CacheHint;
274
+ }>;
275
+ loadEntry: (context: {
276
+ filter: {
277
+ id: string;
278
+ };
279
+ collection?: string;
280
+ }) => Promise<{
281
+ id: string;
282
+ data: CmsPageData;
283
+ cacheHint: CacheHint;
284
+ } | undefined>;
285
+ };
286
+ //#endregion
287
+ //#region src/cron/scheduled.d.ts
288
+ interface CmsCronResult {
289
+ expiredLocksCleaned: number;
290
+ scheduledPagesActive: number;
291
+ timestamp: string;
292
+ }
293
+ /**
294
+ * Handles the periodic Cloudflare Worker cron trigger (e.g. "* * * * *").
295
+ *
296
+ * - Cleans up expired page draft locks
297
+ * - Checks for active scheduled pages
298
+ */
299
+ declare function handleCmsCron(_event: any, _env: any, _ctx: any, db: any): Promise<CmsCronResult>;
300
+ //#endregion
301
+ //#region src/mcp/index.d.ts
302
+ declare const CMS_MCP_TOOLS: ({
303
+ name: string;
304
+ description: string;
305
+ inputSchema: {
306
+ type: string;
307
+ properties: {
308
+ type: {
309
+ type: string;
310
+ description: string;
311
+ };
312
+ includeDrafts: {
313
+ type: string;
314
+ description: string;
315
+ };
316
+ limit: {
317
+ type: string;
318
+ description: string;
319
+ };
320
+ slugOrId?: never;
321
+ pageId?: never;
322
+ userId?: never;
323
+ blocks?: never;
324
+ properties?: never;
325
+ name?: never;
326
+ description?: never;
327
+ author?: never;
328
+ email?: never;
329
+ branding?: never;
330
+ seo?: never;
331
+ };
332
+ required?: never;
333
+ };
334
+ } | {
335
+ name: string;
336
+ description: string;
337
+ inputSchema: {
338
+ type: string;
339
+ properties: {
340
+ slugOrId: {
341
+ type: string;
342
+ description: string;
343
+ };
344
+ type?: never;
345
+ includeDrafts?: never;
346
+ limit?: never;
347
+ pageId?: never;
348
+ userId?: never;
349
+ blocks?: never;
350
+ properties?: never;
351
+ name?: never;
352
+ description?: never;
353
+ author?: never;
354
+ email?: never;
355
+ branding?: never;
356
+ seo?: never;
357
+ };
358
+ required: string[];
359
+ };
360
+ } | {
361
+ name: string;
362
+ description: string;
363
+ inputSchema: {
364
+ type: string;
365
+ properties: {
366
+ pageId: {
367
+ type: string;
368
+ description: string;
369
+ };
370
+ userId: {
371
+ type: string;
372
+ description: string;
373
+ };
374
+ blocks: {
375
+ type: string;
376
+ description: string;
377
+ };
378
+ properties: {
379
+ type: string;
380
+ description: string;
381
+ };
382
+ type?: never;
383
+ includeDrafts?: never;
384
+ limit?: never;
385
+ slugOrId?: never;
386
+ name?: never;
387
+ description?: never;
388
+ author?: never;
389
+ email?: never;
390
+ branding?: never;
391
+ seo?: never;
392
+ };
393
+ required: string[];
394
+ };
395
+ } | {
396
+ name: string;
397
+ description: string;
398
+ inputSchema: {
399
+ type: string;
400
+ properties: {
401
+ type?: never;
402
+ includeDrafts?: never;
403
+ limit?: never;
404
+ slugOrId?: never;
405
+ pageId?: never;
406
+ userId?: never;
407
+ blocks?: never;
408
+ properties?: never;
409
+ name?: never;
410
+ description?: never;
411
+ author?: never;
412
+ email?: never;
413
+ branding?: never;
414
+ seo?: never;
415
+ };
416
+ required?: never;
417
+ };
418
+ } | {
419
+ name: string;
420
+ description: string;
421
+ inputSchema: {
422
+ type: string;
423
+ properties: {
424
+ name: {
425
+ type: string;
426
+ };
427
+ description: {
428
+ type: string;
429
+ };
430
+ author: {
431
+ type: string;
432
+ };
433
+ email: {
434
+ type: string;
435
+ };
436
+ branding: {
437
+ type: string;
438
+ };
439
+ seo: {
440
+ type: string;
441
+ };
442
+ type?: never;
443
+ includeDrafts?: never;
444
+ limit?: never;
445
+ slugOrId?: never;
446
+ pageId?: never;
447
+ userId?: never;
448
+ blocks?: never;
449
+ properties?: never;
450
+ };
451
+ required?: never;
452
+ };
453
+ })[];
454
+ /**
455
+ * Handles Model Context Protocol (MCP) JSON-RPC requests for CMS tools.
456
+ */
457
+ declare function handleCmsMcpRequest(body: {
458
+ jsonrpc?: string;
459
+ id?: string | number;
460
+ method: string;
461
+ params?: any;
462
+ }, db: any): Promise<any>;
463
+ //#endregion
464
+ //#region src/services/bylines.d.ts
465
+ /**
466
+ * Returns all active (non-deleted) bylines.
467
+ */
468
+ declare function getBylines(db: any): Promise<Byline[]>;
469
+ /**
470
+ * Retrieves a single byline by ID or slug.
471
+ */
472
+ declare function getByline(db: any, idOrSlug: string): Promise<Byline | null>;
473
+ /**
474
+ * Creates a new byline.
475
+ */
476
+ declare function createByline(db: any, data: NewByline): Promise<Byline>;
477
+ /**
478
+ * Updates an existing byline.
479
+ */
480
+ declare function updateByline(db: any, id: string, data: Partial<NewByline>): Promise<Byline | null>;
481
+ /**
482
+ * Soft deletes a byline.
483
+ */
484
+ declare function deleteByline(db: any, id: string): Promise<boolean>;
485
+ //#endregion
486
+ //#region src/core/preview.d.ts
487
+ /**
488
+ * Generates and verifies HMAC-signed stateless preview tokens for draft pages.
489
+ */
490
+ /**
491
+ * Generates a signed token for a page ID valid for ttlSeconds (default 24h).
492
+ */
493
+ declare function generatePreviewToken(pageId: string, secret: string, ttlSeconds?: number): Promise<{
494
+ token: string;
495
+ expiresAt: number;
496
+ }>;
497
+ /**
498
+ * Verifies a signed preview token against a pageId and secret.
499
+ */
500
+ declare function verifyPreviewToken(pageId: string, token: string, secret: string): Promise<boolean>;
501
+ //#endregion
502
+ //#region src/core/diff.d.ts
503
+ type DiffChangeType = "added" | "removed" | "modified" | "unchanged";
504
+ interface BlockDiff {
505
+ blockId: string;
506
+ type: string;
507
+ status: DiffChangeType;
508
+ oldBlock?: BaseBlock;
509
+ newBlock?: BaseBlock;
510
+ fieldChanges?: {
511
+ field: string;
512
+ oldValue: any;
513
+ newValue: any;
514
+ }[];
515
+ }
516
+ interface PageVersionDiff {
517
+ blocks: BlockDiff[];
518
+ metaChanges: {
519
+ field: string;
520
+ oldValue: any;
521
+ newValue: any;
522
+ }[];
523
+ summary: {
524
+ addedCount: number;
525
+ removedCount: number;
526
+ modifiedCount: number;
527
+ unchangedCount: number;
528
+ };
529
+ }
530
+ /**
531
+ * Calculates a detailed diff between an old list of blocks and a new list of blocks.
532
+ */
533
+ declare function diffBlocks(oldBlocks?: BaseBlock[], newBlocks?: BaseBlock[]): BlockDiff[];
534
+ /**
535
+ * Compares two page snapshots (metadata + content blocks).
536
+ */
537
+ declare function diffPageSnapshots(oldSnapshot: any, newSnapshot: any): PageVersionDiff;
538
+ //#endregion
539
+ //#region src/services/search-indexer.d.ts
540
+ declare function indexPageForSearch(db: any, page: {
541
+ id: string;
542
+ title: any;
543
+ content: any;
544
+ }, locales?: string[]): Promise<void>;
545
+ //#endregion
546
+ //#region src/core/types/taxonomies.d.ts
547
+ interface TaxonomyTerm {
548
+ id: string;
549
+ taxonomy: string;
550
+ slug: string;
551
+ label: Localized | string;
552
+ description?: Localized | string | null;
553
+ parentId?: string | null;
554
+ displayOrder?: number;
555
+ children?: TaxonomyTerm[];
556
+ count?: number;
557
+ createdAt?: Date;
558
+ updatedAt?: Date;
559
+ }
560
+ interface TaxonomyQueryOptions {
561
+ includeCounts?: boolean;
562
+ locale?: string;
563
+ }
564
+ //#endregion
565
+ //#region src/services/taxonomies.d.ts
566
+ /**
567
+ * Retrieves all terms for a given taxonomy. If hierarchical, returns a tree structure with
568
+ * `children: TaxonomyTerm[]`.
569
+ */
570
+ declare function getTaxonomyTerms(db: any, taxonomy: string, options?: TaxonomyQueryOptions): Promise<TaxonomyTerm[]>;
571
+ /**
572
+ * Retrieves a single term by taxonomy and slug.
573
+ */
574
+ declare function getTerm(db: any, taxonomy: string, slug: string): Promise<TaxonomyTerm | null>;
575
+ /**
576
+ * Retrieves all terms assigned to a specific page entry.
577
+ */
578
+ declare function getEntryTerms(db: any, pageId: string, taxonomy?: string): Promise<TaxonomyTerm[]>;
579
+ /**
580
+ * Retrieves pages tagged with a given taxonomy term.
581
+ */
582
+ declare function getEntriesByTerm(db: any, taxonomy: string, slug: string, options?: {
583
+ limit?: number;
584
+ offset?: number;
585
+ type?: string;
586
+ }): Promise<{
587
+ entries: never[];
588
+ total: number;
589
+ term?: never;
590
+ } | {
591
+ entries: any;
592
+ total: any;
593
+ term: TaxonomyTerm;
594
+ }>;
595
+ /**
596
+ * Sets/syncs the assigned terms for a page within a specific taxonomy.
597
+ */
598
+ declare function assignEntryTerms(db: any, pageId: string, taxonomy: string, termIds: string[]): Promise<void>;
599
+ /**
600
+ * Creates a new taxonomy term.
601
+ */
602
+ declare function createTerm(db: any, data: {
603
+ taxonomy: string;
604
+ slug: string;
605
+ label: any;
606
+ description?: any;
607
+ parentId?: string | null;
608
+ displayOrder?: number;
609
+ }): Promise<any>;
610
+ /**
611
+ * Updates an existing taxonomy term.
612
+ */
613
+ declare function updateTerm(db: any, id: string, updates: Partial<{
614
+ slug: string;
615
+ label: any;
616
+ description: any;
617
+ parentId: string | null;
618
+ displayOrder: number;
619
+ }>): Promise<any>;
620
+ /**
621
+ * Deletes a taxonomy term.
622
+ */
623
+ declare function deleteTerm(db: any, id: string): Promise<{
624
+ success: boolean;
625
+ }>;
626
+ //#endregion
627
+ //#region src/docs/config.d.ts
628
+ interface EditLinkConfig {
629
+ baseUrl: string;
630
+ }
631
+ interface TableOfContentsConfig {
632
+ minHeadingLevel?: number;
633
+ maxHeadingLevel?: number;
634
+ }
635
+ interface DocsConfig {
636
+ basePath?: string;
637
+ sidebar: (SidebarItem | SidebarScope)[] | {
638
+ scopes: SidebarScope[];
639
+ };
640
+ editLink?: EditLinkConfig;
641
+ tableOfContents?: false | TableOfContentsConfig;
642
+ }
643
+ declare const defineDocsConfig: <const T extends DocsConfig>(config: T) => T;
644
+ //#endregion
645
+ //#region src/docs/sidebar.d.ts
646
+ interface ResolvedSidebarItem {
647
+ label: string;
648
+ href?: string | undefined;
649
+ icon?: string | undefined;
650
+ badge?: string | BadgeProps | undefined;
651
+ active?: boolean | undefined;
652
+ children?: ResolvedSidebarItem[] | undefined;
653
+ collapsed?: boolean | undefined;
654
+ }
655
+ interface ResolvedScope {
656
+ id: string;
657
+ label: string;
658
+ href: string;
659
+ icon?: string | undefined;
660
+ active?: boolean | undefined;
661
+ }
662
+ declare function getDocsSidebar(config: DocsConfig, locale: string, currentPath: string, activeVersion?: string, includeVersionInUrl?: boolean): Promise<{
663
+ items: ResolvedSidebarItem[];
664
+ scopes: ResolvedScope[];
665
+ activeScope?: ResolvedScope | undefined;
666
+ }>;
667
+ declare function getSurroundItems(sidebar: ResolvedSidebarItem[], currentPath: string): {
668
+ prev: {
669
+ label: string;
670
+ href: string;
671
+ } | null | undefined;
672
+ next: {
673
+ label: string;
674
+ href: string;
675
+ } | null | undefined;
676
+ };
677
+ //#endregion
678
+ //#region src/docs/routing.d.ts
679
+ interface DocEntry {
680
+ id?: string;
681
+ slug?: string;
682
+ version?: string;
683
+ properties?: Record<string, any>;
684
+ [key: string]: any;
685
+ }
686
+ declare function getDocsVersions(entries: (DocEntry | string)[], locale?: string): string[];
687
+ declare function parseDocsSlug(slug: string | undefined, versions: string[]): {
688
+ activeVersion: string | undefined;
689
+ contentPath: string;
690
+ includeVersionInUrl: boolean;
691
+ };
692
+ declare function formatDocsUrl(href: string, locale: string, activeVersion?: string, includeVersionInUrl?: boolean): string;
693
+ //#endregion
694
+ //#region src/docs/toc.d.ts
695
+ interface TableOfContentsHeading {
696
+ depth: number;
697
+ slug: string;
698
+ text: string;
699
+ }
700
+ declare function slugifyHeading(text: string): string;
701
+ declare function extractHeadingsFromBlocks(blocks?: any[], currentDepth?: number): TableOfContentsHeading[];
702
+ //#endregion
703
+ //#region src/docs/agent.d.ts
704
+ interface AgentMarkdownOptions {
705
+ siteUrl?: string;
706
+ llmsUrl?: string;
707
+ sourceUrl?: string;
708
+ }
709
+ /**
710
+ * Renders a CMS page record into clean, agent-ready Markdown with YAML frontmatter.
711
+ */
712
+ declare function renderPageAsMarkdown(page: any, locale?: string, options?: AgentMarkdownOptions): string;
713
+ /**
714
+ * Collate all published pages of a given type into a single corpus markdown document.
715
+ */
716
+ declare function renderCorpusMarkdown(db: any, options?: {
717
+ type?: string;
718
+ locale?: string;
719
+ siteUrl?: string;
720
+ title?: string;
721
+ description?: string;
722
+ }): Promise<string>;
723
+ //#endregion
724
+ export { ALLOWED_CHILDREN_MAP, AgentMarkdownOptions, ApiDocumentationBlock, ApiDocumentationBlockProps, type AuthAdapter, BLOG_POST_DEFINITION, type BadgeProps, BaseBlock, BlockDefinition, BlockDiff, BlockRegistry, BlockType, Byline, BylineCredit, BylineRole, CARD_DEFINITION, CHARACTER_DEFINITION, CMS_MCP_TOOLS, CacheHint, CachePurgeOptions, CalloutBlock, CalloutBlockProps, CalloutVariant, CardBlock, CardBlockProps, CardsBlock, CardsBlockProps, type CmsAuthAdapter, CmsCronResult, CmsEntry, CmsLoaderOptions, CmsPageData, CodeBlock, CodeBlockProps, ComponentShowcaseBlock, ComponentShowcaseBlockProps, DEFAULT_SITE_SETTINGS, DOCUMENT_DEFINITION, DialogueBlock, DialogueBlockProps, DiffChangeType, DocEntry, DocsConfig, EditLinkConfig, ExcerptOptions, FieldDefinition, FieldType, FileTreeBlock, FileTreeBlockProps, FileTreeNode, GROUP_DEFINITION, HERO_DEFINITION, HeadingLevel, ITEM_DEFINITION, ImageBlock, ImageBlockProps, InlineNode, InlineNodeType, InsertSiteSettings, LOCATION_DEFINITION, LinkInlineNode, LivePreviewBlock, LivePreviewBlockProps, Localized, MAX_SECTION_DEPTH, MAX_SECTION_HEADING_LEVEL, MIN_SECTION_HEADING_LEVEL, MediaValue, NewByline, OBJECT_DEFINITION, PAGE_MAP, PATCH_NOTE_DEFINITION, POSTGRES_SEARCH_CONFIGS, PageContent, PageDefinition, PageMentionNode, PageMetadata, PageTemplate, PageType, PageVersion, PageVersionApproval, PageVersionComment, PageVersionDiff, PageVersionStatus, ParagraphBlock, ParagraphBlockProps, PropertyGroup, R2StorageOptions, RegisterPageTypes, ResolvedScope, ResolvedSidebarItem, type RimelightCmsOptions, SERIES_DEFINITION, SKILL_DEFINITION, SPECIES_DEFINITION, SceneBlock, SceneBlockProps, ScriptBlock, ScriptBlockProps, SectionBlock, SectionBlockProps, Setting, type SidebarItem, type SidebarScope, SiteSettings, SiteSettingsBranding, SiteSettingsSeo, StepItemBlock, StepItemBlockProps, StepsBlock, StepsBlockProps, StorageConfig, StorageFile, StorageListOptions, StorageListResult, StorageUploadOptions, TabItemBlock, TabItemBlockProps, TableBlock, TableBlockProps, TableColumnDef, TableOfContentsConfig, TableOfContentsHeading, TabsBlock, TabsBlockProps, TaxonomyQueryOptions, TaxonomyTerm, TemplateApprovalRules, TemplateRolePermissions, TextInlineNode, TimeOfDay, type Toast, type ToastInput, type ToastItem, Transition, TypedBlock, TypedSceneBlockProps, TypedScriptBlockProps, UserSessionContext, type UserType, addToast, assignEntryTerms, auth0Auth, blocksToMarkdown, bylines, calculateHeadingLevel, canUserCreateFromTemplate, canUserEditBlock, canUserEditFromTemplate, canUserInstantiateTemplate, canUserReviewFromTemplate, canUserViewFromTemplate, cfAccessAuth, clearToasts, cmsAc, cmsStatements, contentSearchIndex, createByline, createPageExcerpt, createTerm, defineDocsConfig, definePageDefinition, deleteByline, deleteR2File, deleteTerm, diffBlocks, diffPageSnapshots, evaluateAccess, extractHeadingsFromBlocks, extractTextFromBlocks, filterBlocksForReader, filterTemplatesForUser, formatDocsUrl, generatePreviewToken, getByline, getBylines, getCmsCollection, getCmsEntry, getDocsSidebar, getDocsVersions, getEntriesByTerm, getEntryTerms, getPageDefinition, getPostgresSearchConfig, getR2Bucket, getSiteSettings, getSurroundItems, getTaxonomyTerms, getTerm, handleCmsCron, handleCmsMcpRequest, hasLockedDescendants, hasPermission, hasRole, indexPageForSearch, inlinesToMarkdown, invalidatePageCache, isValidUUID, listR2Files, mockAuth, pageDraftLocks, pageDrafts, pageTaxonomyTerms, pageTemplates, pageVersionApprovals, pageVersionComments, pageVersions, pages, parseDocsSlug, r2, removeToast, renderCorpusMarkdown, renderPageAsMarkdown, rimelightCms, rimelightCmsLoader, showErrorToast, showSuccessToast, siteSettings, slugifyHeading, taxonomyTerms, toast, toasts, updateByline, updateSiteSettings, updateTerm, uploadR2File, validateBlockAST, validateServerBlockPayload, verifyPreviewToken };