@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,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 };