@elytracms/studio 0.0.14 → 0.0.15

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 (93) hide show
  1. package/convex/cms.ts +8 -31
  2. package/convex/content.ts +3 -44
  3. package/convex/delivery.ts +8 -42
  4. package/convex/functions.ts +17 -2
  5. package/convex/members.ts +2 -2
  6. package/convex/referenceMaintenance.ts +4 -73
  7. package/convex/references.ts +4 -2
  8. package/convex/schema.ts +17 -37
  9. package/convex/sync.ts +10 -42
  10. package/convex/triggers.ts +57 -0
  11. package/convex/webhooks.ts +3 -2
  12. package/dist/components/builder/builder-store.d.ts +85 -39
  13. package/dist/components/builder/builder-store.js +29 -125
  14. package/dist/components/builder/builder-store.js.map +1 -1
  15. package/dist/components/builder/canvas.js +23 -55
  16. package/dist/components/builder/canvas.js.map +1 -1
  17. package/dist/components/builder/clipboard-actions.js +3 -3
  18. package/dist/components/builder/clipboard-actions.js.map +1 -1
  19. package/dist/components/builder/composition-field-editor.js +13 -23
  20. package/dist/components/builder/composition-field-editor.js.map +1 -1
  21. package/dist/components/builder/insert-context.js +1 -1
  22. package/dist/components/builder/insert-context.js.map +1 -1
  23. package/dist/components/builder/page-tree.js +3 -4
  24. package/dist/components/builder/page-tree.js.map +1 -1
  25. package/dist/components/builder/property-inspector.js +4 -64
  26. package/dist/components/builder/property-inspector.js.map +1 -1
  27. package/dist/components/cms/cell.d.ts +0 -4
  28. package/dist/components/cms/cell.js +1 -5
  29. package/dist/components/cms/cell.js.map +1 -1
  30. package/dist/components/cms/cms-store.d.ts +1 -1
  31. package/dist/components/cms/cms-store.js +4 -9
  32. package/dist/components/cms/cms-store.js.map +1 -1
  33. package/dist/components/cms/collection-table.js +1 -1
  34. package/dist/components/cms/collection-table.js.map +1 -1
  35. package/dist/components/cms/detail-editor.js +2 -2
  36. package/dist/components/cms/detail-editor.js.map +1 -1
  37. package/dist/components/cms/doc-state.d.ts +0 -5
  38. package/dist/components/cms/doc-state.js +1 -7
  39. package/dist/components/cms/doc-state.js.map +1 -1
  40. package/dist/components/cms/editable-cell.js +1 -1
  41. package/dist/components/cms/editable-cell.js.map +1 -1
  42. package/dist/components/collab/collab-context.d.ts +6 -14
  43. package/dist/components/collab/collab-context.js +3 -12
  44. package/dist/components/collab/collab-context.js.map +1 -1
  45. package/dist/components/collab/collab-seed.d.ts +7 -19
  46. package/dist/components/collab/collab-seed.js +9 -31
  47. package/dist/components/collab/collab-seed.js.map +1 -1
  48. package/dist/components/components/registry-browser.js +6 -12
  49. package/dist/components/components/registry-browser.js.map +1 -1
  50. package/dist/components/guards.d.ts +0 -9
  51. package/dist/components/guards.js +0 -12
  52. package/dist/components/guards.js.map +1 -1
  53. package/dist/components/section-state.d.ts +0 -2
  54. package/dist/components/section-state.js +0 -9
  55. package/dist/components/section-state.js.map +1 -1
  56. package/dist/components/section-surface.d.ts +3 -7
  57. package/dist/components/section-surface.js +5 -12
  58. package/dist/components/section-surface.js.map +1 -1
  59. package/dist/components/sections.d.ts +0 -1
  60. package/dist/components/sections.js +0 -10
  61. package/dist/components/sections.js.map +1 -1
  62. package/dist/components/studio-project-screen.js +13 -14
  63. package/dist/components/studio-project-screen.js.map +1 -1
  64. package/dist/components/studio-shell.d.ts +0 -4
  65. package/dist/components/studio-shell.js +1 -5
  66. package/dist/components/studio-shell.js.map +1 -1
  67. package/dist/lib/operations/graph-commands.d.ts +2 -6
  68. package/dist/lib/operations/graph-commands.js +1 -2
  69. package/dist/lib/operations/graph-commands.js.map +1 -1
  70. package/dist/lib/operations/index.d.ts +0 -2
  71. package/dist/lib/operations/index.js +0 -2
  72. package/dist/lib/operations/index.js.map +1 -1
  73. package/dist/lib/operations/session-hydration.d.ts +14 -24
  74. package/dist/lib/operations/session-hydration.js +15 -34
  75. package/dist/lib/operations/session-hydration.js.map +1 -1
  76. package/dist/lib/persistence/convex-adapter.d.ts +1 -3
  77. package/dist/lib/persistence/convex-adapter.js +1 -154
  78. package/dist/lib/persistence/convex-adapter.js.map +1 -1
  79. package/dist/lib/persona/labels.js +0 -2
  80. package/dist/lib/persona/labels.js.map +1 -1
  81. package/dist/lib/references/reference-model.d.ts +0 -16
  82. package/dist/lib/references/reference-model.js +2 -54
  83. package/dist/lib/references/reference-model.js.map +1 -1
  84. package/dist/lib/references/references-store.js +3 -4
  85. package/dist/lib/references/references-store.js.map +1 -1
  86. package/dist/lib/registry/index.d.ts +0 -16
  87. package/dist/lib/registry/index.js +0 -15
  88. package/dist/lib/registry/index.js.map +1 -1
  89. package/dist/lib/webhooks/tags.js +2 -16
  90. package/dist/lib/webhooks/tags.js.map +1 -1
  91. package/package.json +3 -2
  92. package/convex/graphs.ts +0 -55
  93. package/convex/publishing.ts +0 -76
@@ -1,76 +0,0 @@
1
- import { v } from 'convex/values'
2
- import { mutation, query } from './functions'
3
- import { requireRole } from './guard'
4
- import { maintainGraphPublishedReferences } from './referenceMaintenance'
5
- import { scheduleRevalidate } from './revalidate'
6
-
7
- /**
8
- * Publishing state (EC-045). Single-environment (EC-179, vision AD-8): a
9
- * deployment IS one environment, so there is exactly ONE publishingState row —
10
- * see `env-is-deployment-boundary`.
11
- *
12
- * EC-180 / EC-146: a graph publish/unpublish fires the host revalidation webhook
13
- * via `scheduleRevalidate` (`./revalidate`) — the SAME helper CMS document
14
- * publish uses, so content-only sites invalidate too (see `cms.ts`).
15
- */
16
-
17
- export const publish = mutation({
18
- args: {
19
- revisionId: v.string(),
20
- revision: v.number(),
21
- publishedAt: v.string(),
22
- },
23
- handler: async (ctx, args) => {
24
- await requireRole(ctx, 'editor') // EC-150
25
- const existing = await ctx.db.query('publishingState').first()
26
- const record = {
27
- status: 'published' as const,
28
- publishedRevisionId: args.revisionId,
29
- publishedRevision: args.revision,
30
- publishedAt: args.publishedAt,
31
- createdAt: existing?.createdAt ?? args.publishedAt,
32
- updatedAt: args.publishedAt,
33
- }
34
- // EC-153 parity: republish preserves `createdAt`; return the stored record.
35
- const id = existing ? existing._id : await ctx.db.insert('publishingState', record)
36
- if (existing) await ctx.db.patch(existing._id, record)
37
- // EC-277: the newly pinned revision becomes the published graph — reindex its
38
- // published reference rows in-transaction (AD-6 "at the source").
39
- await maintainGraphPublishedReferences(ctx)
40
- // EC-180: drop the host's cached pages for this project (fire-and-forget).
41
- await scheduleRevalidate(ctx, 'publishing.publish')
42
- return ctx.db.get(id)
43
- },
44
- })
45
-
46
- export const unpublish = mutation({
47
- args: { updatedAt: v.string() },
48
- handler: async (ctx, args) => {
49
- await requireRole(ctx, 'editor') // EC-150
50
- const existing = await ctx.db.query('publishingState').first()
51
- if (!existing || existing.status !== 'published') {
52
- throw new Error('invalid-transition: nothing is currently published')
53
- }
54
- await ctx.db.patch(existing._id, {
55
- status: 'draft',
56
- publishedRevisionId: undefined,
57
- publishedRevision: undefined,
58
- publishedAt: undefined,
59
- updatedAt: args.updatedAt,
60
- })
61
- // EC-277: a graph going dark drops every published graph reference row.
62
- await maintainGraphPublishedReferences(ctx)
63
- // EC-180: a graph going dark must also drop the host's cached pages.
64
- await scheduleRevalidate(ctx, 'publishing.unpublish')
65
- // EC-153 parity: return the stored record (createdAt preserved).
66
- return ctx.db.get(existing._id)
67
- },
68
- })
69
-
70
- export const getState = query({
71
- args: {},
72
- handler: async (ctx) => {
73
- await requireRole(ctx, 'viewer') // EC-150
74
- return ctx.db.query('publishingState').first()
75
- },
76
- })