@rimelight/cms 0.0.2 → 0.0.4

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 (124) hide show
  1. package/LICENSE +21 -0
  2. package/dist/bylines-Csggkl-g.d.mts +405 -0
  3. package/dist/index.d.mts +724 -0
  4. package/dist/index.mjs +2382 -0
  5. package/dist/integration.d.mts +33 -0
  6. package/dist/integration.mjs +161 -0
  7. package/dist/schema/index.d.mts +2063 -0
  8. package/dist/schema/index.mjs +176 -0
  9. package/dist/schema/sqlite.d.mts +2132 -0
  10. package/dist/schema/sqlite.mjs +137 -0
  11. package/dist/storage/index.d.mts +59 -0
  12. package/dist/storage/index.mjs +133 -0
  13. package/package.json +36 -18
  14. package/src/admin/api/media-file.ts +39 -0
  15. package/src/admin/api/media.ts +224 -0
  16. package/src/admin/layouts/CMSDashboardLayout.astro +191 -0
  17. package/src/admin/layouts/DefaultParentLayout.astro +50 -0
  18. package/src/admin/pages/assets.astro +424 -0
  19. package/src/admin/pages/byline-schema.astro +62 -0
  20. package/src/admin/pages/bylines.astro +16 -0
  21. package/src/admin/pages/categories.astro +21 -0
  22. package/src/admin/pages/content-types.astro +55 -0
  23. package/src/admin/pages/dashboard.astro +61 -0
  24. package/src/admin/pages/pages-edit.astro +595 -0
  25. package/src/admin/pages/pages-index.astro +146 -0
  26. package/src/admin/pages/pages-new.astro +130 -0
  27. package/src/admin/pages/pages-preview.astro +111 -0
  28. package/src/admin/pages/pages-review.astro +236 -0
  29. package/src/admin/pages/settings.astro +203 -0
  30. package/src/admin/pages/tags.astro +21 -0
  31. package/src/admin/pages/templates-edit.astro +234 -0
  32. package/src/admin/pages/templates-index.astro +95 -0
  33. package/src/admin/pages/templates-new.astro +193 -0
  34. package/src/admin/pages/users.astro +74 -0
  35. package/src/admin/pages/versions.astro +74 -0
  36. package/src/astro/BlockRenderer.astro +44 -102
  37. package/src/astro/PageRenderer.astro +12 -5
  38. package/src/astro/blocks/CalloutBlock.astro +7 -7
  39. package/src/astro/blocks/CardBlock.astro +5 -5
  40. package/src/astro/blocks/CodeBlock.astro +2 -2
  41. package/src/astro/blocks/FileTreeBlock.astro +7 -7
  42. package/src/astro/blocks/ImageBlock.astro +2 -2
  43. package/src/astro/blocks/OrderedListBlock.astro +2 -2
  44. package/src/astro/blocks/ParagraphBlock.astro +3 -3
  45. package/src/astro/blocks/SectionBlock.astro +6 -6
  46. package/src/astro/blocks/StepItemBlock.astro +3 -3
  47. package/src/astro/blocks/StepsBlock.astro +1 -1
  48. package/src/astro/blocks/TableBlock.astro +6 -6
  49. package/src/astro/blocks/TabsBlock.astro +9 -9
  50. package/src/astro/blocks/UnorderedListBlock.astro +2 -2
  51. package/src/astro/blocks/index.ts +35 -0
  52. package/src/client/components/RimelightBlock.tsx +19 -19
  53. package/src/client/components/RimelightBlockPicker.tsx +9 -13
  54. package/src/client/components/RimelightBylinesManager.tsx +438 -0
  55. package/src/client/components/RimelightEditor.tsx +3 -3
  56. package/src/client/components/RimelightPreview.tsx +37 -45
  57. package/src/client/components/RimelightPropertiesPanel.tsx +368 -26
  58. package/src/client/components/RimelightTaxonomyManager.tsx +369 -0
  59. package/src/client/components/RimelightTaxonomyMasterDetail.tsx +412 -0
  60. package/src/client/components/RimelightTemplateEditor.tsx +6 -8
  61. package/src/client/components/editors/CalloutEditor.tsx +2 -4
  62. package/src/client/components/editors/CardsEditor.tsx +2 -4
  63. package/src/client/components/editors/CodeEditor.tsx +1 -3
  64. package/src/client/components/editors/FileTreeEditor.tsx +2 -4
  65. package/src/client/components/editors/ImageEditor.tsx +3 -3
  66. package/src/client/components/editors/ParagraphEditor.tsx +2 -2
  67. package/src/client/components/editors/SceneEditor.tsx +6 -12
  68. package/src/client/components/editors/ScriptEditor.tsx +8 -16
  69. package/src/client/components/editors/SectionEditor.tsx +4 -4
  70. package/src/client/components/editors/StepItemEditor.tsx +2 -2
  71. package/src/client/components/editors/StepsEditor.tsx +2 -4
  72. package/src/client/components/editors/TabItemEditor.tsx +3 -3
  73. package/src/client/components/editors/TableEditor.tsx +5 -5
  74. package/src/client/components/editors/TabsEditor.tsx +2 -4
  75. package/src/client/components/index.ts +3 -0
  76. package/src/client/loader.ts +3 -0
  77. package/src/core/diff.ts +145 -0
  78. package/src/core/excerpt.ts +159 -0
  79. package/src/core/preview.ts +87 -0
  80. package/src/core/registry.ts +0 -86
  81. package/src/core/types/blocks.ts +6 -1
  82. package/src/core/types/bylines.ts +14 -0
  83. package/src/core/types/media.ts +13 -0
  84. package/src/core/types/taxonomies.ts +20 -0
  85. package/src/cron/scheduled.ts +57 -0
  86. package/src/docs/agent.ts +116 -0
  87. package/src/docs/config.ts +25 -0
  88. package/src/docs/index.ts +5 -0
  89. package/src/docs/routing.ts +104 -0
  90. package/src/docs/sidebar.ts +251 -0
  91. package/src/docs/toc.ts +47 -0
  92. package/src/env.d.ts +19 -0
  93. package/src/index.ts +57 -12
  94. package/src/integration.ts +250 -0
  95. package/src/loader/live.ts +254 -0
  96. package/src/markdown/index.ts +0 -1
  97. package/src/mcp/index.ts +228 -0
  98. package/src/schema/bylines.ts +23 -0
  99. package/src/schema/index.ts +3 -4
  100. package/src/schema/page_versions.ts +2 -0
  101. package/src/schema/pages.ts +2 -0
  102. package/src/schema/site_settings.ts +41 -0
  103. package/src/schema/sqlite.ts +344 -0
  104. package/src/schema/taxonomies.ts +49 -0
  105. package/src/services/bylines.ts +74 -0
  106. package/src/services/search-indexer.ts +61 -0
  107. package/src/services/site-settings.ts +108 -0
  108. package/src/services/taxonomies.ts +276 -0
  109. package/src/storage/index.ts +256 -0
  110. package/src/astro/blocks/ApiDocumentationBlock.astro +0 -350
  111. package/src/astro/blocks/DialogueBlock.astro +0 -23
  112. package/src/astro/blocks/LivePreviewBlock.astro +0 -27
  113. package/src/astro/blocks/SceneBlock.astro +0 -65
  114. package/src/astro/blocks/ScriptBlock.astro +0 -59
  115. package/src/core/template-sync.ts +0 -75
  116. package/src/markdown/parser.ts +0 -347
  117. package/src/migration-tools.ts +0 -334
  118. package/src/migration.ts +0 -155
  119. package/src/schema/component_dependencies.ts +0 -21
  120. package/src/schema/component_metadata.ts +0 -31
  121. package/src/schema/component_metadata_cache.ts +0 -15
  122. package/src/schema/component_versions.ts +0 -19
  123. package/src/search/sync.ts +0 -32
  124. package/src/services/component-metadata.ts +0 -134
@@ -0,0 +1,176 @@
1
+ import { sql } from "drizzle-orm";
2
+ import { customType, foreignKey, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
3
+ //#region src/schema/page_versions.ts
4
+ const pageVersions = pgTable("page_versions", {
5
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
6
+ pageId: uuid("page_id").notNull(),
7
+ versionNumber: integer("version_number").notNull(),
8
+ status: text("status").$type().default("pending").notNull(),
9
+ slug: text("slug").notNull(),
10
+ type: text("type").$type().notNull(),
11
+ title: jsonb("title").$type().notNull(),
12
+ description: jsonb("description").$type(),
13
+ tags: jsonb("tags").$type().default([]).notNull(),
14
+ authorIds: jsonb("author_ids").$type().default([]),
15
+ bylines: jsonb("bylines").$type().default([]),
16
+ content: jsonb("content").$type().notNull(),
17
+ createdBy: text("created_by").notNull(),
18
+ approvedBy: jsonb("approved_by").$type().default([]).notNull(),
19
+ approvedAt: timestamp("approved_at", { withTimezone: true }),
20
+ changeSummary: text("change_summary"),
21
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull()
22
+ }, (table) => [uniqueIndex("page_versions_page_id_version_idx").on(table.pageId, table.versionNumber)]);
23
+ //#endregion
24
+ //#region src/schema/page_templates.ts
25
+ const pageTemplates = pgTable("page_templates", {
26
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
27
+ slug: text("slug").notNull().unique(),
28
+ title: jsonb("title").$type().notNull(),
29
+ description: jsonb("description").$type(),
30
+ pageType: text("page_type").$type().notNull(),
31
+ version: integer("version").default(1).notNull(),
32
+ allowedRoles: jsonb("allowed_roles").$type().default([]).notNull(),
33
+ rolePermissions: jsonb("role_permissions").$type().default({
34
+ whoCanCreate: [],
35
+ whoCanEdit: [],
36
+ whoCanReview: [],
37
+ whoCanView: []
38
+ }).notNull(),
39
+ requiredPermission: text("required_permission"),
40
+ approvalRules: jsonb("approval_rules").$type().default({
41
+ allowSelfApproval: true,
42
+ minApprovals: 1
43
+ }).notNull(),
44
+ defaultProperties: jsonb("default_properties").default({}).notNull(),
45
+ initialBlocks: jsonb("initial_blocks").$type().default([]).notNull(),
46
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
47
+ updatedAt: timestamp("updated_at", { withTimezone: true }).$onUpdate(() => /* @__PURE__ */ new Date())
48
+ });
49
+ //#endregion
50
+ //#region src/schema/pages.ts
51
+ const pages = pgTable("pages", {
52
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
53
+ slug: text("slug").notNull(),
54
+ type: text("type").$type().notNull(),
55
+ templateId: uuid("template_id").references(() => pageTemplates.id, { onDelete: "set null" }),
56
+ templateVersion: integer("template_version").default(1).notNull(),
57
+ title: jsonb("title").$type().notNull(),
58
+ description: jsonb("description").$type(),
59
+ tags: jsonb("tags").$type().default([]).notNull(),
60
+ authorIds: jsonb("author_ids").$type().default([]),
61
+ bylines: jsonb("bylines").$type().default([]),
62
+ /**
63
+ * Denormalized read-cache of the active published version content (NULL if unpublished draft)
64
+ */
65
+ content: jsonb("content").$type().notNull(),
66
+ publishedVersionId: uuid("published_version_id").references(() => pageVersions.id, { onDelete: "set null" }),
67
+ postedAt: timestamp("posted_at", { withTimezone: true }),
68
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
69
+ updatedAt: timestamp("updated_at", { withTimezone: true }).$onUpdate(() => /* @__PURE__ */ new Date()),
70
+ deletedAt: timestamp("deleted_at", { withTimezone: true })
71
+ }, (table) => [uniqueIndex("pages_slug_active_unique_idx").on(table.slug).where(sql`deleted_at IS NULL`)]);
72
+ //#endregion
73
+ //#region src/schema/page_drafts.ts
74
+ const pageDrafts = pgTable("page_drafts", {
75
+ pageId: uuid("page_id").notNull().primaryKey().references(() => pages.id, { onDelete: "cascade" }),
76
+ content: jsonb("content").$type().notNull(),
77
+ updatedBy: text("updated_by").notNull(),
78
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull()
79
+ });
80
+ //#endregion
81
+ //#region src/schema/page_draft_locks.ts
82
+ const pageDraftLocks = pgTable("page_draft_locks", {
83
+ pageId: uuid("page_id").notNull().primaryKey().references(() => pages.id, { onDelete: "cascade" }),
84
+ lockedByUserId: text("locked_by_user_id").notNull(),
85
+ lockedByUserName: text("locked_by_user_name").notNull(),
86
+ acquiredAt: timestamp("acquired_at", { withTimezone: true }).defaultNow().notNull(),
87
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull()
88
+ });
89
+ //#endregion
90
+ //#region src/schema/page_version_comments.ts
91
+ const pageVersionComments = pgTable("page_version_comments", {
92
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
93
+ versionId: uuid("version_id").notNull().references(() => pageVersions.id, { onDelete: "cascade" }),
94
+ userId: text("user_id").notNull(),
95
+ userRole: text("user_role").notNull(),
96
+ content: text("content").notNull(),
97
+ blockId: text("block_id"),
98
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull()
99
+ });
100
+ //#endregion
101
+ //#region src/schema/page_version_approvals.ts
102
+ const pageVersionApprovals = pgTable("page_version_approvals", {
103
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
104
+ versionId: uuid("version_id").notNull().references(() => pageVersions.id, { onDelete: "cascade" }),
105
+ userId: text("user_id").notNull(),
106
+ userRole: text("user_role").notNull(),
107
+ approvedAt: timestamp("approved_at", { withTimezone: true }).defaultNow().notNull()
108
+ });
109
+ //#endregion
110
+ //#region src/schema/search.ts
111
+ const tsvector = customType({ dataType() {
112
+ return "tsvector";
113
+ } });
114
+ const contentSearchIndex = pgTable("content_search_index", {
115
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
116
+ pageId: uuid("page_id").notNull().references(() => pages.id, { onDelete: "cascade" }),
117
+ locale: text("locale").notNull(),
118
+ titleText: text("title_text").notNull(),
119
+ contentText: text("content_text").notNull(),
120
+ searchVector: tsvector("search_vector")
121
+ }, (table) => [index("search_vector_gin_idx").using("gin", table.searchVector)]);
122
+ //#endregion
123
+ //#region src/schema/site_settings.ts
124
+ const siteSettings = pgTable("site_settings", {
125
+ id: text("id").primaryKey().default("default"),
126
+ name: text("name").notNull(),
127
+ description: text("description").notNull(),
128
+ url: text("url").notNull(),
129
+ ogImage: text("og_image").notNull(),
130
+ author: text("author").notNull(),
131
+ email: text("email").notNull().default(""),
132
+ branding: jsonb("branding").$type().notNull(),
133
+ seo: jsonb("seo").$type().notNull(),
134
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
135
+ updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()).notNull()
136
+ });
137
+ //#endregion
138
+ //#region src/schema/taxonomies.ts
139
+ const taxonomyTerms = pgTable("taxonomy_terms", {
140
+ id: uuid("id").defaultRandom().notNull().primaryKey(),
141
+ taxonomy: text("taxonomy").notNull(),
142
+ slug: text("slug").notNull(),
143
+ label: jsonb("label").$type().notNull(),
144
+ description: jsonb("description").$type(),
145
+ parentId: uuid("parent_id"),
146
+ displayOrder: integer("display_order").default(0).notNull(),
147
+ createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
148
+ updatedAt: timestamp("updated_at", { withTimezone: true }).$onUpdate(() => /* @__PURE__ */ new Date())
149
+ }, (table) => [uniqueIndex("taxonomy_terms_tax_slug_idx").on(table.taxonomy, table.slug), foreignKey({
150
+ columns: [table.parentId],
151
+ foreignColumns: [table.id],
152
+ name: "taxonomy_terms_parent_id_fk"
153
+ }).onDelete("cascade")]);
154
+ const pageTaxonomyTerms = pgTable("page_taxonomy_terms", {
155
+ pageId: uuid("page_id").notNull().references(() => pages.id, { onDelete: "cascade" }),
156
+ termId: uuid("term_id").notNull().references(() => taxonomyTerms.id, { onDelete: "cascade" }),
157
+ assignedAt: timestamp("assigned_at", { withTimezone: true }).defaultNow().notNull()
158
+ }, (table) => [uniqueIndex("page_taxonomy_terms_page_term_idx").on(table.pageId, table.termId)]);
159
+ //#endregion
160
+ //#region src/schema/bylines.ts
161
+ const bylines = pgTable("bylines", {
162
+ id: uuid("id").primaryKey().defaultRandom(),
163
+ name: text("name").notNull(),
164
+ slug: text("slug").notNull(),
165
+ websiteUrl: text("website_url"),
166
+ bio: text("bio"),
167
+ avatar: text("avatar"),
168
+ userId: text("user_id"),
169
+ socials: jsonb("socials").$type().default({}),
170
+ metadata: jsonb("metadata").$type().default({}),
171
+ createdAt: timestamp("created_at").defaultNow().notNull(),
172
+ updatedAt: timestamp("updated_at").defaultNow().notNull(),
173
+ deletedAt: timestamp("deleted_at")
174
+ }, (table) => [uniqueIndex("bylines_slug_idx").on(table.slug)]);
175
+ //#endregion
176
+ export { bylines, contentSearchIndex, pageDraftLocks, pageDrafts, pageTaxonomyTerms, pageTemplates, pageVersionApprovals, pageVersionComments, pageVersions, pages, siteSettings, taxonomyTerms };