@elytracms/studio 0.0.4 → 0.0.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.
- package/convex/cliTokens.ts +1 -1
- package/convex/cms.ts +23 -1
- package/convex/content.ts +9 -9
- package/convex/delivery.ts +2 -2
- package/convex/graphs.ts +4 -0
- package/convex/guard.ts +1 -1
- package/convex/members.ts +1 -1
- package/convex/publishing.ts +6 -0
- package/convex/referenceMaintenance.ts +163 -0
- package/convex/schema.ts +2 -2
- package/convex/sync.ts +7 -7
- package/dist/components/assets/asset-metadata.d.ts +1 -1
- package/dist/components/assets/asset-search.d.ts +1 -1
- package/dist/components/assets/asset-selection.d.ts +1 -7
- package/dist/components/assets/asset-selection.js +15 -10
- package/dist/components/assets/asset-selection.js.map +1 -1
- package/dist/components/assets/assets-store.d.ts +1 -1
- package/dist/components/auth-context.d.ts +1 -1
- package/dist/components/builder/blocks-model.d.ts +2 -2
- package/dist/components/builder/blocks-model.js +2 -2
- package/dist/components/builder/blocks-model.js.map +1 -1
- package/dist/components/builder/blocks-panel.d.ts +2 -2
- package/dist/components/builder/blocks-panel.js +1 -1
- package/dist/components/builder/blocks-panel.js.map +1 -1
- package/dist/components/builder/builder-store.d.ts +1 -1
- package/dist/components/builder/builder-store.js +1 -1
- package/dist/components/builder/builder-store.js.map +1 -1
- package/dist/components/builder/canvas.js +3 -3
- package/dist/components/builder/canvas.js.map +1 -1
- package/dist/components/builder/clipboard-actions.d.ts +1 -1
- package/dist/components/builder/clipboard-actions.js +2 -2
- package/dist/components/builder/clipboard-actions.js.map +1 -1
- package/dist/components/builder/composition-field-editor.d.ts +1 -1
- package/dist/components/builder/composition-field-editor.js +1 -1
- package/dist/components/builder/composition-field-editor.js.map +1 -1
- package/dist/components/builder/drag-session.d.ts +1 -1
- package/dist/components/builder/fixture-thumbnail.d.ts +1 -1
- package/dist/components/builder/fixture-thumbnail.js +1 -1
- package/dist/components/builder/fixture-thumbnail.js.map +1 -1
- package/dist/components/builder/inline-edit.d.ts +3 -3
- package/dist/components/builder/inline-edit.js +2 -2
- package/dist/components/builder/inline-edit.js.map +1 -1
- package/dist/components/builder/insert-context.js +1 -1
- package/dist/components/builder/insert-context.js.map +1 -1
- package/dist/components/builder/layout-inspector.d.ts +1 -1
- package/dist/components/builder/layout-inspector.js +1 -1
- package/dist/components/builder/layout-inspector.js.map +1 -1
- package/dist/components/builder/node-factory.d.ts +2 -2
- package/dist/components/builder/node-factory.js +1 -1
- package/dist/components/builder/node-factory.js.map +1 -1
- package/dist/components/builder/page-tree.js +1 -1
- package/dist/components/builder/page-tree.js.map +1 -1
- package/dist/components/builder/property-inspector.js +4 -4
- package/dist/components/builder/property-inspector.js.map +1 -1
- package/dist/components/builder/spacing-handles.d.ts +1 -1
- package/dist/components/builder/spacing-handles.js +1 -1
- package/dist/components/builder/spacing-handles.js.map +1 -1
- package/dist/components/cms/bulk-actions.d.ts +1 -1
- package/dist/components/cms/cell-edit.d.ts +1 -1
- package/dist/components/cms/cell-edit.js +1 -1
- package/dist/components/cms/cell-edit.js.map +1 -1
- package/dist/components/cms/cell.d.ts +6 -2
- package/dist/components/cms/cell.js +13 -12
- package/dist/components/cms/cell.js.map +1 -1
- package/dist/components/cms/cms-index.js +1 -1
- package/dist/components/cms/cms-index.js.map +1 -1
- package/dist/components/cms/cms-store.d.ts +2 -2
- package/dist/components/cms/cms-store.js +10 -6
- package/dist/components/cms/cms-store.js.map +1 -1
- package/dist/components/cms/collection-table.d.ts +1 -1
- package/dist/components/cms/collection-table.js +1 -1
- package/dist/components/cms/collection-table.js.map +1 -1
- package/dist/components/cms/collections-sidebar.js +1 -1
- package/dist/components/cms/collections-sidebar.js.map +1 -1
- package/dist/components/cms/detail-editor.js +1 -1
- package/dist/components/cms/detail-editor.js.map +1 -1
- package/dist/components/cms/doc-state.d.ts +1 -1
- package/dist/components/cms/document-editor-context.d.ts +1 -1
- package/dist/components/cms/editable-cell.d.ts +1 -1
- package/dist/components/cms/editable-cell.js +1 -1
- package/dist/components/cms/editable-cell.js.map +1 -1
- package/dist/components/cms/field-control.d.ts +1 -1
- package/dist/components/cms/field-control.js +1 -1
- package/dist/components/cms/field-control.js.map +1 -1
- package/dist/components/cms/filter-builder.d.ts +1 -1
- package/dist/components/cms/reference-confirm.d.ts +1 -1
- package/dist/components/cms/reference-confirm.js +1 -1
- package/dist/components/cms/reference-confirm.js.map +1 -1
- package/dist/components/cms/relation-picker.d.ts +1 -1
- package/dist/components/cms/use-cell-edit.d.ts +1 -1
- package/dist/components/cms/use-cell-edit.js +1 -1
- package/dist/components/cms/use-cell-edit.js.map +1 -1
- package/dist/components/cms/versions-model.d.ts +1 -1
- package/dist/components/cms/versions-model.js +1 -1
- package/dist/components/cms/versions-model.js.map +1 -1
- package/dist/components/cms/view-bar.d.ts +1 -1
- package/dist/components/collab/collab-context.d.ts +3 -3
- package/dist/components/collab/collab-context.js +2 -2
- package/dist/components/collab/collab-context.js.map +1 -1
- package/dist/components/collab/collab-seed.d.ts +1 -1
- package/dist/components/components/component-detail.js +1 -1
- package/dist/components/components/component-detail.js.map +1 -1
- package/dist/components/components/components-index.js +1 -1
- package/dist/components/components/field-inspector.d.ts +1 -1
- package/dist/components/components/field-inspector.js +1 -1
- package/dist/components/components/field-inspector.js.map +1 -1
- package/dist/components/components/fixture-runner.d.ts +1 -1
- package/dist/components/components/fixture-runner.js +1 -1
- package/dist/components/components/fixture-runner.js.map +1 -1
- package/dist/components/components/registry-browser.js +1 -1
- package/dist/components/components/registry-browser.js.map +1 -1
- package/dist/components/current-user-menu.d.ts +1 -1
- package/dist/components/extensions/extensions-view.d.ts +1 -1
- package/dist/components/extensions/extensions-view.js +2 -2
- package/dist/components/extensions/extensions-view.js.map +1 -1
- package/dist/components/project-list.d.ts +1 -1
- package/dist/components/project-session.d.ts +1 -1
- package/dist/components/project-switcher.d.ts +1 -1
- package/dist/components/references/builder-deep-link.js +1 -1
- package/dist/components/references/builder-deep-link.js.map +1 -1
- package/dist/components/references/references-panel.d.ts +2 -2
- package/dist/components/references/references-panel.js +1 -1
- package/dist/components/routes/redirect-chain.d.ts +1 -1
- package/dist/components/routes/redirect-manager.d.ts +1 -1
- package/dist/components/routes/route-list.d.ts +1 -1
- package/dist/components/routes/routes-shell.d.ts +2 -2
- package/dist/components/routes/routes-shell.js +2 -2
- package/dist/components/routes/routes-shell.js.map +1 -1
- package/dist/components/section-nav.d.ts +1 -1
- package/dist/components/section-state.d.ts +1 -1
- package/dist/components/section-surface.d.ts +1 -1
- package/dist/components/section-surface.js +1 -1
- package/dist/components/section-surface.js.map +1 -1
- package/dist/components/sections.d.ts +2 -2
- package/dist/components/sections.js +1 -1
- package/dist/components/sections.js.map +1 -1
- package/dist/components/settings-form.d.ts +1 -1
- package/dist/components/studio-context.d.ts +1 -1
- package/dist/components/studio-context.js +1 -1
- package/dist/components/studio-context.js.map +1 -1
- package/dist/components/studio-project-screen.js +2 -2
- package/dist/components/studio-project-screen.js.map +1 -1
- package/dist/components/studio-shell.d.ts +1 -1
- package/dist/lib/assets/delete-asset.d.ts +1 -1
- package/dist/lib/assets/delete-asset.js +1 -1
- package/dist/lib/assets/delete-asset.js.map +1 -1
- package/dist/lib/assets/upload.d.ts +1 -1
- package/dist/lib/auth/local-auth-adapter.d.ts +1 -1
- package/dist/lib/auth/local-auth-adapter.js +2 -2
- package/dist/lib/auth/local-auth-adapter.js.map +1 -1
- package/dist/lib/auth/route-guard.d.ts +1 -1
- package/dist/lib/bindings/section-bindings.d.ts +4 -4
- package/dist/lib/clipboard/os-clipboard.d.ts +1 -1
- package/dist/lib/clipboard/os-clipboard.js +1 -1
- package/dist/lib/clipboard/os-clipboard.js.map +1 -1
- package/dist/lib/clipboard/paste-issues.d.ts +1 -1
- package/dist/lib/clipboard/paste-target.d.ts +2 -2
- package/dist/lib/clipboard/paste-target.js +1 -1
- package/dist/lib/clipboard/paste-target.js.map +1 -1
- package/dist/lib/cms/published-documents.d.ts +1 -1
- package/dist/lib/cms-views/index.d.ts +1 -1
- package/dist/lib/cms-views/index.js +1 -1
- package/dist/lib/cms-views/view-model.d.ts +3 -3
- package/dist/lib/cms-views/view-model.js +3 -3
- package/dist/lib/cms-views/view-model.js.map +1 -1
- package/dist/lib/cms-views/views-store.d.ts +2 -2
- package/dist/lib/cms-views/views-store.js +1 -1
- package/dist/lib/data/collection-content.d.ts +5 -5
- package/dist/lib/data/collection-content.js +2 -2
- package/dist/lib/data/collection-content.js.map +1 -1
- package/dist/lib/data/data-store.d.ts +5 -5
- package/dist/lib/data/data-store.js +1 -1
- package/dist/lib/data/data-store.js.map +1 -1
- package/dist/lib/data/providers.d.ts +3 -3
- package/dist/lib/data/sample-capture.d.ts +3 -3
- package/dist/lib/data/sample-capture.js +1 -1
- package/dist/lib/data/sample-capture.js.map +1 -1
- package/dist/lib/data/sources-store.d.ts +4 -4
- package/dist/lib/data/sources-store.js +3 -3
- package/dist/lib/data/sources-store.js.map +1 -1
- package/dist/lib/dnd/drop-rules.d.ts +1 -1
- package/dist/lib/dnd/drop-rules.js +1 -1
- package/dist/lib/dnd/drop-rules.js.map +1 -1
- package/dist/lib/dnd/gap-drag.d.ts +1 -1
- package/dist/lib/dnd/gap-drag.js +1 -1
- package/dist/lib/dnd/gap-drag.js.map +1 -1
- package/dist/lib/locale/binding-fallback.d.ts +4 -4
- package/dist/lib/locale/fallback.d.ts +1 -1
- package/dist/lib/locale/fallback.js +1 -1
- package/dist/lib/locale/fallback.js.map +1 -1
- package/dist/lib/locale/locale-store.d.ts +1 -1
- package/dist/lib/locale/locale-store.js +1 -1
- package/dist/lib/locale/locale-store.js.map +1 -1
- package/dist/lib/locale/route-variant.d.ts +1 -1
- package/dist/lib/locale/use-studio-locale.d.ts +1 -1
- package/dist/lib/operations/asset-repository.d.ts +1 -1
- package/dist/lib/operations/cms-persistence.d.ts +8 -1
- package/dist/lib/operations/cms-persistence.js +16 -2
- package/dist/lib/operations/cms-persistence.js.map +1 -1
- package/dist/lib/operations/graph-commands.d.ts +1 -1
- package/dist/lib/operations/operations-package.d.ts +2 -2
- package/dist/lib/operations/operations-package.js +2 -2
- package/dist/lib/operations/operations-package.js.map +1 -1
- package/dist/lib/operations/session-hydration.d.ts +4 -4
- package/dist/lib/operations/session-hydration.js +3 -3
- package/dist/lib/operations/session-hydration.js.map +1 -1
- package/dist/lib/operations/studio-operations.d.ts +1 -1
- package/dist/lib/operations/studio-operations.js +17 -7
- package/dist/lib/operations/studio-operations.js.map +1 -1
- package/dist/lib/persistence/convex-adapter.d.ts +9 -2
- package/dist/lib/persistence/convex-adapter.js +11 -4
- package/dist/lib/persistence/convex-adapter.js.map +1 -1
- package/dist/lib/persistence/convex-blob-storage.d.ts +1 -1
- package/dist/lib/persistence/index.d.ts +1 -1
- package/dist/lib/persistence/index.js +1 -1
- package/dist/lib/persistence/index.js.map +1 -1
- package/dist/lib/persona/labels.d.ts +4 -4
- package/dist/lib/persona/labels.js +2 -1
- package/dist/lib/persona/labels.js.map +1 -1
- package/dist/lib/references/impact.d.ts +1 -1
- package/dist/lib/references/impact.js +1 -1
- package/dist/lib/references/impact.js.map +1 -1
- package/dist/lib/references/reference-model.d.ts +3 -3
- package/dist/lib/references/references-store.d.ts +3 -3
- package/dist/lib/references/references-store.js +1 -1
- package/dist/lib/references/references-store.js.map +1 -1
- package/dist/lib/registry/index.d.ts +10 -9
- package/dist/lib/registry/index.js +9 -9
- package/dist/lib/registry/index.js.map +1 -1
- package/dist/lib/registry/preview.d.ts +2 -2
- package/dist/lib/registry/preview.js +1 -1
- package/dist/lib/registry/preview.js.map +1 -1
- package/dist/lib/registry/project-components.d.ts +1 -1
- package/dist/lib/registry/project-components.js +1 -1
- package/dist/lib/registry/project-components.js.map +1 -1
- package/dist/lib/routing/index.d.ts +1 -1
- package/dist/lib/routing/index.js +1 -1
- package/dist/lib/routing/routing-analysis.d.ts +2 -2
- package/dist/lib/routing/routing-store.d.ts +2 -2
- package/dist/lib/routing/routing-store.js +2 -2
- package/dist/lib/routing/routing-store.js.map +1 -1
- package/dist/lib/starters/kit-session.d.ts +1 -1
- package/dist/lib/webhooks/config.d.ts +1 -1
- package/dist/lib/webhooks/dispatcher.d.ts +1 -1
- package/dist/lib/webhooks/tags.d.ts +1 -1
- package/dist/lib/working-graph.d.ts +2 -2
- package/dist/lib/working-graph.js +1 -1
- package/dist/lib/working-graph.js.map +1 -1
- package/dist/lib/workspace/index.d.ts +3 -3
- package/dist/lib/workspace/index.js +1 -1
- package/dist/lib/workspace/index.js.map +1 -1
- package/dist/lib/workspace/switcher-source.d.ts +2 -2
- package/dist/lib/workspace/workspace-source.d.ts +1 -1
- package/dist/lib/workspace/workspace-source.js +1 -1
- package/dist/lib/workspace/workspace-source.js.map +1 -1
- package/dist/router/search.d.ts +1 -1
- package/dist/router/search.js +1 -1
- package/dist/router/search.js.map +1 -1
- package/package.json +2 -15
package/convex/cliTokens.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { requireRole } from './guard'
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* CLI token persistence (EC-150). Only SHA-256 hashes are stored — hashing and
|
|
7
|
-
* plaintext generation happen in `@elytracms/operations` (`tokens.issue`), and
|
|
7
|
+
* plaintext generation happen in `@elytracms/core/operations` (`tokens.issue`), and
|
|
8
8
|
* verification goes through `verifyCliToken`, which calls `byHash` below via
|
|
9
9
|
* the `ConvexCliTokenRepository`. All user-facing access is admin-only.
|
|
10
10
|
*/
|
package/convex/cms.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import type { CmsDocument } from '@elytracms/core/cms-core'
|
|
1
2
|
import { v } from 'convex/values'
|
|
2
3
|
import { mutation, query } from './functions'
|
|
3
4
|
import { requireRole } from './guard'
|
|
5
|
+
import { maintainDocumentReferences, removeDocumentReferences } from './referenceMaintenance'
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* CMS document persistence (EC-043). The backend stores **documents only**
|
|
7
9
|
* (AD-11, EC-183): CMS collection schemas are config-owned — they live in
|
|
8
10
|
* `elytra.config.ts`, read by the studio + host — so there is no `cmsSchemas`
|
|
9
11
|
* table and no schema read/write function here. Collection-membership
|
|
10
|
-
* validation lives in `@elytracms/cms-core` `validateDocument` (the studio runs it
|
|
12
|
+
* validation lives in `@elytracms/core/cms-core` `validateDocument` (the studio runs it
|
|
11
13
|
* pre-dispatch); this layer is a pure document store.
|
|
12
14
|
*/
|
|
13
15
|
|
|
@@ -28,9 +30,21 @@ export const upsertDocument = mutation({
|
|
|
28
30
|
if (existing) {
|
|
29
31
|
// EC-153 parity: updates preserve `createdAt`, exactly like in-memory.
|
|
30
32
|
await ctx.db.patch(existing._id, { ...args, createdAt: existing.createdAt })
|
|
33
|
+
// EC-277: maintain the reference index in-transaction (AD-6). The live pin
|
|
34
|
+
// (`publishedVersion`) is preserved across an upsert, so a published doc keeps
|
|
35
|
+
// its published index rows in sync with its edited draft.
|
|
36
|
+
await maintainDocumentReferences(
|
|
37
|
+
ctx,
|
|
38
|
+
args.collection,
|
|
39
|
+
args.docId,
|
|
40
|
+
args.document as CmsDocument,
|
|
41
|
+
existing.publishedVersion !== undefined,
|
|
42
|
+
)
|
|
31
43
|
return ctx.db.get(existing._id)
|
|
32
44
|
}
|
|
33
45
|
const id = await ctx.db.insert('cmsDocuments', args)
|
|
46
|
+
// EC-277: a freshly inserted document is draft-only (no live pin yet).
|
|
47
|
+
await maintainDocumentReferences(ctx, args.collection, args.docId, args.document as CmsDocument, false)
|
|
34
48
|
return ctx.db.get(id)
|
|
35
49
|
},
|
|
36
50
|
})
|
|
@@ -76,6 +90,8 @@ export const deleteDocument = mutation({
|
|
|
76
90
|
.withIndex('by_doc', (q) => q.eq('collection', args.collection).eq('docId', args.docId))
|
|
77
91
|
.collect()
|
|
78
92
|
for (const row of versions) await ctx.db.delete(row._id)
|
|
93
|
+
// EC-277: drop the deleted document's reference index rows in-transaction.
|
|
94
|
+
await removeDocumentReferences(ctx, args.collection, args.docId)
|
|
79
95
|
},
|
|
80
96
|
})
|
|
81
97
|
|
|
@@ -154,6 +170,10 @@ export const publishDocumentVersion = mutation({
|
|
|
154
170
|
.first()
|
|
155
171
|
if (!doc) return null
|
|
156
172
|
await ctx.db.patch(doc._id, { publishedVersion: args.version, updatedAt: args.updatedAt })
|
|
173
|
+
// EC-277: the doc now has a live pin — add its published index rows. Published
|
|
174
|
+
// entries are extracted from the live draft content (matching the EC-173 guard
|
|
175
|
+
// and `reindexDocumentReferences`), not the pinned snapshot.
|
|
176
|
+
await maintainDocumentReferences(ctx, args.collection, args.docId, doc.document as CmsDocument, true)
|
|
157
177
|
return ctx.db.get(doc._id)
|
|
158
178
|
},
|
|
159
179
|
})
|
|
@@ -169,6 +189,8 @@ export const unpublishDocument = mutation({
|
|
|
169
189
|
if (!doc) return null
|
|
170
190
|
// Convex patch removes a field set to `undefined` — clears the live pin.
|
|
171
191
|
await ctx.db.patch(doc._id, { publishedVersion: undefined, updatedAt: args.updatedAt })
|
|
192
|
+
// EC-277: the live pin is cleared — drop this doc's published index rows.
|
|
193
|
+
await maintainDocumentReferences(ctx, args.collection, args.docId, doc.document as CmsDocument, false)
|
|
172
194
|
return ctx.db.get(doc._id)
|
|
173
195
|
},
|
|
174
196
|
})
|
package/convex/content.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { documentKey, documentSchema } from '@elytracms/cms-core'
|
|
1
|
+
import { documentKey, documentSchema } from '@elytracms/core/cms-core'
|
|
2
2
|
import type {
|
|
3
3
|
CmsDocument,
|
|
4
4
|
CmsValidationIssue,
|
|
@@ -7,18 +7,18 @@ import type {
|
|
|
7
7
|
LocaleConfig,
|
|
8
8
|
RedirectRecord,
|
|
9
9
|
RouteRecord,
|
|
10
|
-
} from '@elytracms/cms-core'
|
|
11
|
-
import { createContentClient, createContentContext, isDocumentHistory, rawDocument } from '@elytracms/content'
|
|
10
|
+
} from '@elytracms/core/cms-core'
|
|
11
|
+
import { createContentClient, createContentContext, isDocumentHistory, rawDocument } from '@elytracms/core/content'
|
|
12
12
|
import type {
|
|
13
13
|
ContentClient,
|
|
14
14
|
ContentContext,
|
|
15
15
|
ContentDocumentSource,
|
|
16
16
|
ContentLookup,
|
|
17
17
|
Perspective,
|
|
18
|
-
} from '@elytracms/content'
|
|
19
|
-
import type { AssetRecord } from '@elytracms/persistence'
|
|
20
|
-
import { parseProjectGraph } from '@elytracms/project-graph'
|
|
21
|
-
import type { ProjectGraph } from '@elytracms/project-graph'
|
|
18
|
+
} from '@elytracms/core/content'
|
|
19
|
+
import type { AssetRecord } from '@elytracms/core/persistence'
|
|
20
|
+
import { parseProjectGraph } from '@elytracms/core/project-graph'
|
|
21
|
+
import type { ProjectGraph } from '@elytracms/core/project-graph'
|
|
22
22
|
import type { QueryCtx } from './functions'
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -33,7 +33,7 @@ import type { QueryCtx } from './functions'
|
|
|
33
33
|
* Byte-equivalence with the Next side is guaranteed by construction: the kit
|
|
34
34
|
* loads rows through `ctx.db`, builds the same synchronous `ContentLookup`
|
|
35
35
|
* that `@elytracms/next`'s snapshot builds from a `PersistenceAdapter`, and then
|
|
36
|
-
* runs the EXACT pure functions from `@elytracms/content`
|
|
36
|
+
* runs the EXACT pure functions from `@elytracms/core/content`
|
|
37
37
|
* (`createContentClient` → `resolveDocument`, `query.ts` validation, cache
|
|
38
38
|
* tags). Nothing about resolution semantics is reimplemented here.
|
|
39
39
|
*
|
|
@@ -46,7 +46,7 @@ import type { QueryCtx } from './functions'
|
|
|
46
46
|
* implies and the documented field-level-index upgrade path.
|
|
47
47
|
*
|
|
48
48
|
* Perspective isolation: the lookup holds the raw stored rows (draft state and
|
|
49
|
-
* all), and EVERY read path through `@elytracms/content` — `resolveDocument`,
|
|
49
|
+
* all), and EVERY read path through `@elytracms/core/content` — `resolveDocument`,
|
|
50
50
|
* relation population, `listDocuments` filtering, slug fallback, and the `raw`
|
|
51
51
|
* escape hatch — applies the EC-142 perspective gate (`selectPerspective`)
|
|
52
52
|
* before any value is exposed. The kit never reads field values around that
|
package/convex/delivery.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { v } from 'convex/values'
|
|
2
|
-
import { dataSourceSchema } from '@elytracms/data-binding'
|
|
2
|
+
import { dataSourceSchema } from '@elytracms/core/data-binding'
|
|
3
3
|
import { query } from './functions'
|
|
4
4
|
import type { QueryCtx } from './functions'
|
|
5
5
|
|
|
@@ -85,7 +85,7 @@ const PROVIDER_FUNCTION_PREFIX = 'provider:'
|
|
|
85
85
|
/**
|
|
86
86
|
* Map the persisted `cms-data-sources` documents to the delivery `sources`
|
|
87
87
|
* array. Each record's `config` field carries the FULL canonical
|
|
88
|
-
* `@elytracms/data-binding` source, JSON-serialized; it is validated against
|
|
88
|
+
* `@elytracms/core/data-binding` source, JSON-serialized; it is validated against
|
|
89
89
|
* `dataSourceSchema` (malformed records drop out, never crash the snapshot)
|
|
90
90
|
* and then deliberately projected to the structural delivery envelope:
|
|
91
91
|
*
|
package/convex/graphs.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { v } from 'convex/values'
|
|
2
2
|
import { mutation, query } from './functions'
|
|
3
3
|
import { requireRole } from './guard'
|
|
4
|
+
import { maintainGraphDraftReferences } from './referenceMaintenance'
|
|
4
5
|
|
|
5
6
|
/** Project graph + revision persistence (EC-041). Revisions are append-only. */
|
|
6
7
|
|
|
@@ -19,6 +20,9 @@ export const saveRevision = mutation({
|
|
|
19
20
|
const revision = (last?.revision ?? 0) + 1
|
|
20
21
|
const id = await ctx.db.insert('graphRevisions', { ...args, revision })
|
|
21
22
|
const record = await ctx.db.get(id)
|
|
23
|
+
// EC-277: the latest revision IS the draft graph — reindex its component-usage
|
|
24
|
+
// and self-typed static-prop references in-transaction (AD-6 "at the source").
|
|
25
|
+
await maintainGraphDraftReferences(ctx, args.serializedGraph)
|
|
22
26
|
return record
|
|
23
27
|
},
|
|
24
28
|
})
|
package/convex/guard.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { QueryCtx } from './functions'
|
|
|
11
11
|
* deployment-scoped — a `members` row grants a user a role on this deployment.
|
|
12
12
|
* No `projectId` is threaded.
|
|
13
13
|
*
|
|
14
|
-
* Role ranks mirror `@elytracms/persistence`'s `roleAtLeast`:
|
|
14
|
+
* Role ranks mirror `@elytracms/core/persistence`'s `roleAtLeast`:
|
|
15
15
|
* viewer (0) < editor (1) < admin (2).
|
|
16
16
|
*
|
|
17
17
|
* Failures throw plain `Error('unauthorized: …')` — Convex transports the
|
package/convex/members.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { requireRole, requireUserId } from './guard'
|
|
|
5
5
|
/**
|
|
6
6
|
* Deployment membership persistence (EC-150, single-tenant per EC-179). The
|
|
7
7
|
* Convex side of the `MembersRepository` contract; the app's
|
|
8
|
-
* `ConvexMembersRepository` maps these onto `@elytracms/persistence` records.
|
|
8
|
+
* `ConvexMembersRepository` maps these onto `@elytracms/core/persistence` records.
|
|
9
9
|
* Member *management* is admin-only, server-side — UI gating alone is never
|
|
10
10
|
* trusted. One row per user grants their role on this deployment's one project.
|
|
11
11
|
*/
|
package/convex/publishing.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { v } from 'convex/values'
|
|
|
3
3
|
import { mutation, query } from './functions'
|
|
4
4
|
import type { MutationCtx } from './functions'
|
|
5
5
|
import { requireRole } from './guard'
|
|
6
|
+
import { maintainGraphPublishedReferences } from './referenceMaintenance'
|
|
6
7
|
|
|
7
8
|
// EC-223: the studio's convex functions are package-shipped and deployment-agnostic
|
|
8
9
|
// — they address each other by STRING ref (resolved against the consumer's deployment),
|
|
@@ -65,6 +66,9 @@ export const publish = mutation({
|
|
|
65
66
|
// EC-153 parity: republish preserves `createdAt`; return the stored record.
|
|
66
67
|
const id = existing ? existing._id : await ctx.db.insert('publishingState', record)
|
|
67
68
|
if (existing) await ctx.db.patch(existing._id, record)
|
|
69
|
+
// EC-277: the newly pinned revision becomes the published graph — reindex its
|
|
70
|
+
// published reference rows in-transaction (AD-6 "at the source").
|
|
71
|
+
await maintainGraphPublishedReferences(ctx)
|
|
68
72
|
// EC-180: drop the host's cached pages for this project (fire-and-forget).
|
|
69
73
|
await scheduleRevalidate(ctx, 'publishing.publish')
|
|
70
74
|
return ctx.db.get(id)
|
|
@@ -86,6 +90,8 @@ export const unpublish = mutation({
|
|
|
86
90
|
publishedAt: undefined,
|
|
87
91
|
updatedAt: args.updatedAt,
|
|
88
92
|
})
|
|
93
|
+
// EC-277: a graph going dark drops every published graph reference row.
|
|
94
|
+
await maintainGraphPublishedReferences(ctx)
|
|
89
95
|
// EC-180: a graph going dark must also drop the host's cached pages.
|
|
90
96
|
await scheduleRevalidate(ctx, 'publishing.unpublish')
|
|
91
97
|
// EC-153 parity: return the stored record (createdAt preserved).
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { documentKey } from '@elytracms/core/cms-core'
|
|
2
|
+
import type { CmsDocument } from '@elytracms/core/cms-core'
|
|
3
|
+
import { extractReferences, extractSelfTypedGraphReferences } from '@elytracms/core/persistence'
|
|
4
|
+
import type { OutboundReference } from '@elytracms/core/persistence'
|
|
5
|
+
import { parseProjectGraph } from '@elytracms/core/project-graph'
|
|
6
|
+
import type { MutationCtx } from './functions'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* In-transaction reference-index maintenance (EC-277, vision AD-6).
|
|
10
|
+
*
|
|
11
|
+
* The reference index is **maintained at the source** — inside the same Convex
|
|
12
|
+
* mutation that writes the content. A write recomputes the affected source's
|
|
13
|
+
* outbound references and replaces its index rows before the transaction commits,
|
|
14
|
+
* so EVERY writer is caught by construction: the studio, the CLI, a webhook, a
|
|
15
|
+
* one-off `convex run`, a migration mutation. There is no client-side subscriber to
|
|
16
|
+
* bypass (the studio bootstrap stands `attachReferenceIndex` down for this provider
|
|
17
|
+
* via `PersistenceAdapter.maintainsReferenceIndex`).
|
|
18
|
+
*
|
|
19
|
+
* Extraction is schema-free and manifest-free (self-describing content, AD-15):
|
|
20
|
+
* `extractReferences` walks the stored value dispatching on each node's `type`
|
|
21
|
+
* discriminator, needing neither the collection schema nor the component manifest —
|
|
22
|
+
* which is exactly what lets the identical walk run here, in the Convex isolate,
|
|
23
|
+
* that runs in the studio and the in-memory adapter.
|
|
24
|
+
*
|
|
25
|
+
* Mirrors `reindexDocumentReferences` / `reindexGraph*References`
|
|
26
|
+
* (`@elytracms/core/persistence`), but writes through `ctx.db` rather than the adapter.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type Variant = 'draft' | 'published'
|
|
30
|
+
type GraphSourceType = 'page' | 'layout'
|
|
31
|
+
|
|
32
|
+
/** The graph (EC-187) is layouts-only; pages live in the `page` collection's body. */
|
|
33
|
+
const GRAPH_SOURCE_TYPES: readonly GraphSourceType[] = ['page', 'layout']
|
|
34
|
+
|
|
35
|
+
interface ReferenceRow {
|
|
36
|
+
path: string
|
|
37
|
+
targetType: 'document' | 'component' | 'asset'
|
|
38
|
+
targetId: string
|
|
39
|
+
kind: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function toRow(ref: OutboundReference): ReferenceRow {
|
|
43
|
+
return { path: ref.path, targetType: ref.target.type, targetId: ref.target.id, kind: ref.kind }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Delete every index row a document source holds in one variant. */
|
|
47
|
+
async function deleteDocumentSource(ctx: MutationCtx, variant: Variant, sourceId: string): Promise<void> {
|
|
48
|
+
const existing = await ctx.db
|
|
49
|
+
.query('referenceEntries')
|
|
50
|
+
.withIndex('by_source', (q) =>
|
|
51
|
+
q.eq('variant', variant).eq('sourceType', 'document').eq('sourceId', sourceId),
|
|
52
|
+
)
|
|
53
|
+
.collect()
|
|
54
|
+
for (const row of existing) await ctx.db.delete(row._id)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Delete every index row held by the given source types in one variant (graph recompute). */
|
|
58
|
+
async function deleteSourceTypes(
|
|
59
|
+
ctx: MutationCtx,
|
|
60
|
+
variant: Variant,
|
|
61
|
+
sourceTypes: readonly GraphSourceType[],
|
|
62
|
+
): Promise<void> {
|
|
63
|
+
for (const sourceType of sourceTypes) {
|
|
64
|
+
const existing = await ctx.db
|
|
65
|
+
.query('referenceEntries')
|
|
66
|
+
.withIndex('by_source', (q) => q.eq('variant', variant).eq('sourceType', sourceType))
|
|
67
|
+
.collect()
|
|
68
|
+
for (const row of existing) await ctx.db.delete(row._id)
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Recompute a document's index rows in-transaction (replace-all-for-source). The
|
|
74
|
+
* editable content IS the draft, so a document always (re)indexes its draft rows;
|
|
75
|
+
* its published rows exist only while a live version is pinned (`published`),
|
|
76
|
+
* matching `reindexDocumentReferences` and the EC-173 integrity guard.
|
|
77
|
+
*/
|
|
78
|
+
export async function maintainDocumentReferences(
|
|
79
|
+
ctx: MutationCtx,
|
|
80
|
+
collection: string,
|
|
81
|
+
docId: string,
|
|
82
|
+
document: CmsDocument,
|
|
83
|
+
published: boolean,
|
|
84
|
+
): Promise<void> {
|
|
85
|
+
const sourceId = documentKey({ collection, id: docId })
|
|
86
|
+
const rows = extractReferences(document).map(toRow)
|
|
87
|
+
await deleteDocumentSource(ctx, 'draft', sourceId)
|
|
88
|
+
await deleteDocumentSource(ctx, 'published', sourceId)
|
|
89
|
+
for (const row of rows) {
|
|
90
|
+
await ctx.db.insert('referenceEntries', { variant: 'draft', sourceType: 'document', sourceId, ...row })
|
|
91
|
+
}
|
|
92
|
+
if (published) {
|
|
93
|
+
for (const row of rows) {
|
|
94
|
+
await ctx.db.insert('referenceEntries', {
|
|
95
|
+
variant: 'published',
|
|
96
|
+
sourceType: 'document',
|
|
97
|
+
sourceId,
|
|
98
|
+
...row,
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** Drop every index row a (now-deleted) document held, in both variants. */
|
|
105
|
+
export async function removeDocumentReferences(
|
|
106
|
+
ctx: MutationCtx,
|
|
107
|
+
collection: string,
|
|
108
|
+
docId: string,
|
|
109
|
+
): Promise<void> {
|
|
110
|
+
const sourceId = documentKey({ collection, id: docId })
|
|
111
|
+
await deleteDocumentSource(ctx, 'draft', sourceId)
|
|
112
|
+
await deleteDocumentSource(ctx, 'published', sourceId)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Recompute the draft graph rows from a just-saved revision's serialized graph. */
|
|
116
|
+
export async function maintainGraphDraftReferences(
|
|
117
|
+
ctx: MutationCtx,
|
|
118
|
+
serializedGraph: string,
|
|
119
|
+
): Promise<void> {
|
|
120
|
+
const parsed = parseProjectGraph(serializedGraph)
|
|
121
|
+
await deleteSourceTypes(ctx, 'draft', GRAPH_SOURCE_TYPES)
|
|
122
|
+
if (!parsed.ok) return // a malformed stored graph contributes no entries (it can't render either)
|
|
123
|
+
for (const entry of extractSelfTypedGraphReferences(parsed.graph)) {
|
|
124
|
+
await ctx.db.insert('referenceEntries', {
|
|
125
|
+
variant: 'draft',
|
|
126
|
+
sourceType: entry.source.type as GraphSourceType,
|
|
127
|
+
sourceId: entry.source.id,
|
|
128
|
+
path: entry.path,
|
|
129
|
+
targetType: entry.target.type,
|
|
130
|
+
targetId: entry.target.id,
|
|
131
|
+
kind: entry.kind,
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Recompute the published graph rows from the revision currently pinned live by the
|
|
138
|
+
* publishing state (single-environment, EC-179). Unpublishing drops them all.
|
|
139
|
+
*/
|
|
140
|
+
export async function maintainGraphPublishedReferences(ctx: MutationCtx): Promise<void> {
|
|
141
|
+
await deleteSourceTypes(ctx, 'published', GRAPH_SOURCE_TYPES)
|
|
142
|
+
const state = await ctx.db.query('publishingState').first()
|
|
143
|
+
if (!state || state.status !== 'published' || state.publishedRevision === undefined) return
|
|
144
|
+
const publishedRevision = state.publishedRevision
|
|
145
|
+
const revision = await ctx.db
|
|
146
|
+
.query('graphRevisions')
|
|
147
|
+
.withIndex('by_revision', (q) => q.eq('revision', publishedRevision))
|
|
148
|
+
.first()
|
|
149
|
+
if (!revision) return
|
|
150
|
+
const parsed = parseProjectGraph(revision.serializedGraph)
|
|
151
|
+
if (!parsed.ok) return
|
|
152
|
+
for (const entry of extractSelfTypedGraphReferences(parsed.graph)) {
|
|
153
|
+
await ctx.db.insert('referenceEntries', {
|
|
154
|
+
variant: 'published',
|
|
155
|
+
sourceType: entry.source.type as GraphSourceType,
|
|
156
|
+
sourceId: entry.source.id,
|
|
157
|
+
path: entry.path,
|
|
158
|
+
targetType: entry.target.type,
|
|
159
|
+
targetId: entry.target.id,
|
|
160
|
+
kind: entry.kind,
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
}
|
package/convex/schema.ts
CHANGED
|
@@ -14,7 +14,7 @@ import { authTables } from '@convex-dev/auth/server'
|
|
|
14
14
|
* Multiple projects = multiple config entries + multiple deployments.
|
|
15
15
|
*
|
|
16
16
|
* Tables mirror the persisted record shapes defined (and Zod-validated) in
|
|
17
|
-
* `@elytracms/persistence`; nested structures (graph JSON, documents) are stored
|
|
17
|
+
* `@elytracms/core/persistence`; nested structures (graph JSON, documents) are stored
|
|
18
18
|
* as validated blobs (`v.any()`) since the Zod schemas in the packages are the
|
|
19
19
|
* canonical source of truth for their shape.
|
|
20
20
|
*
|
|
@@ -44,7 +44,7 @@ export default defineSchema({
|
|
|
44
44
|
* Deployment membership roles (EC-150, vision AD-7). Single-tenant: one row
|
|
45
45
|
* per user grants their role on THIS deployment's one project. `userId` is the
|
|
46
46
|
* Convex Auth `users` id (stored as a string so the table shape matches the
|
|
47
|
-
* provider-neutral `@elytracms/persistence` record). Server-side enforcement
|
|
47
|
+
* provider-neutral `@elytracms/core/persistence` record). Server-side enforcement
|
|
48
48
|
* happens in `guard.ts`; the operations chokepoint enforces the same rules
|
|
49
49
|
* client-side.
|
|
50
50
|
*/
|
package/convex/sync.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { makeFunctionReference } from 'convex/server'
|
|
2
2
|
import type { GenericActionCtx, GenericDataModel } from 'convex/server'
|
|
3
3
|
import { v } from 'convex/values'
|
|
4
|
-
import { verifyCliToken } from '@elytracms/operations'
|
|
5
|
-
import type { VerifiedCliToken } from '@elytracms/operations'
|
|
6
|
-
import type { CliTokenRepository, PersistenceAdapter } from '@elytracms/persistence'
|
|
4
|
+
import { verifyCliToken } from '@elytracms/core/operations'
|
|
5
|
+
import type { VerifiedCliToken } from '@elytracms/core/operations'
|
|
6
|
+
import type { CliTokenRepository, PersistenceAdapter } from '@elytracms/core/persistence'
|
|
7
7
|
import { httpAction, internalQuery } from './functions'
|
|
8
8
|
import type { QueryCtx } from './functions'
|
|
9
9
|
import type { ProjectRole } from './guard'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* EC-157 — the builder-sync HTTP endpoint. Serves the contract fixed in
|
|
13
|
-
* `@elytracms/export-sync`'s `registrySyncEndpoints` from this deployment's
|
|
13
|
+
* `@elytracms/core/export-sync`'s `registrySyncEndpoints` from this deployment's
|
|
14
14
|
* `.convex.site` origin, so a host repo's `builder check` / `typegen` run against
|
|
15
15
|
* the real builder instead of a `fetchImpl` double:
|
|
16
16
|
*
|
|
@@ -33,7 +33,7 @@ import type { ProjectRole } from './guard'
|
|
|
33
33
|
* ## Auth (EC-150 CLI tokens)
|
|
34
34
|
*
|
|
35
35
|
* The endpoint requires `Authorization: Bearer <ect_…>`. Tokens are verified by
|
|
36
|
-
* `verifyCliToken` (`@elytracms/operations`): the presented plaintext is SHA-256-hashed
|
|
36
|
+
* `verifyCliToken` (`@elytracms/core/operations`): the presented plaintext is SHA-256-hashed
|
|
37
37
|
* and looked up via `cliTokens.byHash`; unknown and revoked tokens are rejected with
|
|
38
38
|
* a 401. Single-tenant (EC-182): a deployment hosts one project, so a token carries
|
|
39
39
|
* no per-project scope — it just needs at least the `viewer` capability the snapshot
|
|
@@ -42,7 +42,7 @@ import type { ProjectRole } from './guard'
|
|
|
42
42
|
* ## Error contract
|
|
43
43
|
*
|
|
44
44
|
* Failures are structured JSON bodies — `{ error: { code, message, issues? } }` —
|
|
45
|
-
* matching `RegistrySyncErrorBody` in `@elytracms/export-sync`; even unexpected
|
|
45
|
+
* matching `RegistrySyncErrorBody` in `@elytracms/core/export-sync`; even unexpected
|
|
46
46
|
* exceptions return a structured body, never an opaque crash page. The CLI surfaces
|
|
47
47
|
* them as `transport` issues.
|
|
48
48
|
*/
|
|
@@ -286,7 +286,7 @@ async function loadLatestGraph(ctx: QueryCtx): Promise<GraphRevisionPayload | nu
|
|
|
286
286
|
|
|
287
287
|
/**
|
|
288
288
|
* Everything `builder typegen`/`builder check` need from live builder state, in the
|
|
289
|
-
* `BuilderSnapshot` wire shape of `@elytracms/export-sync`'s `createHttpBuilderSource`.
|
|
289
|
+
* `BuilderSnapshot` wire shape of `@elytracms/core/export-sync`'s `createHttpBuilderSource`.
|
|
290
290
|
* Unlike `delivery:snapshot` this is token-gated and serves exactly one graph per
|
|
291
291
|
* request: published = the pinned revision for `environment`, draft = latest.
|
|
292
292
|
* Component manifests are code-owned, so the snapshot no longer carries them.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetRecord, AssetRepository, NewAssetInput } from '@elytracms/persistence';
|
|
1
|
+
import type { AssetRecord, AssetRepository, NewAssetInput } from '@elytracms/core/persistence';
|
|
2
2
|
/**
|
|
3
3
|
* Asset metadata editing (EC-152). A patch is applied through the
|
|
4
4
|
* {@link AssetRepository} interface — in the studio that is the EC-141
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssetRecord } from '@elytracms/persistence';
|
|
1
|
+
import type { AssetRecord } from '@elytracms/core/persistence';
|
|
2
2
|
/**
|
|
3
3
|
* Client-side asset search (EC-152): case-insensitive substring match over
|
|
4
4
|
* filename, alt text, and title. Pure and deterministic — input order is
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure value logic for CMS `asset` fields (EC-075 → EC-152): a field stores
|
|
3
|
-
* the asset *id* (cardinality `one`) or an array of ids (`many`). These
|
|
4
|
-
* helpers normalize stored values and apply a picker selection without the
|
|
5
|
-
* UI owning the rules.
|
|
6
|
-
*/
|
|
7
|
-
/** The id list a `many` asset field currently holds (non-strings dropped). */
|
|
1
|
+
/** The id list a `many` asset field currently holds (unreadable entries dropped). */
|
|
8
2
|
export declare function assetIdsOf(value: unknown): string[];
|
|
9
3
|
/** The single id a `one` asset field currently holds, if any. */
|
|
10
4
|
export declare function singleAssetIdOf(value: unknown): string | null;
|
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pure value logic for CMS `asset` fields (EC-075 → EC-152): a field stores
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Pure value logic for CMS `asset` fields (EC-075 → EC-152): a field stores the
|
|
3
|
+
* asset *id* (cardinality `one`) or an array of ids (`many`). These helpers
|
|
4
|
+
* normalize stored values and apply a picker selection without the UI owning the
|
|
5
|
+
* rules. EC-277: reads tolerate self-typed `{ type:'asset', id }` envelopes AND
|
|
6
|
+
* legacy bare ids (the field is self-typed on save by the operations write lens).
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
import { readAssetId } from '@elytracms/core/cms-core';
|
|
9
|
+
/** The id list a `many` asset field currently holds (unreadable entries dropped). */
|
|
8
10
|
export function assetIdsOf(value) {
|
|
9
|
-
|
|
11
|
+
if (!Array.isArray(value))
|
|
12
|
+
return [];
|
|
13
|
+
return value.map(readAssetId).filter((id) => id !== undefined);
|
|
10
14
|
}
|
|
11
15
|
/** The single id a `one` asset field currently holds, if any. */
|
|
12
16
|
export function singleAssetIdOf(value) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const direct = readAssetId(value);
|
|
18
|
+
if (direct !== undefined)
|
|
19
|
+
return direct;
|
|
20
|
+
if (Array.isArray(value))
|
|
21
|
+
return readAssetId(value[0]) ?? null;
|
|
17
22
|
return null;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-selection.js","sourceRoot":"","sources":["../../../src/components/assets/asset-selection.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"asset-selection.js","sourceRoot":"","sources":["../../../src/components/assets/asset-selection.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACpC,OAAO,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,SAAS,CAAC,CAAA;AAC9E,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;IACjC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAA;IACvC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAC9D,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAgB,EAChB,MAAqB,EACrB,WAA2B;IAE3B,IAAI,WAAW,KAAK,KAAK;QAAE,OAAO,MAAM,IAAI,SAAS,CAAA;IACrD,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,GAAG,CAAA;IACvD,OAAO,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { AssetRecord } from '@elytracms/persistence';
|
|
2
|
+
import type { AssetRecord } from '@elytracms/core/persistence';
|
|
3
3
|
import type { DeleteAssetResult, UploadState, UploadableFile } from '@elytracms/studio/lib/assets';
|
|
4
4
|
import type { ReferenceEntryView } from '@elytracms/studio/lib/references';
|
|
5
5
|
import type { AssetMetadataPatch, UpdateAssetMetadataResult } from './asset-metadata';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { ProjectRole } from '@elytracms/persistence';
|
|
2
|
+
import type { ProjectRole } from '@elytracms/core/persistence';
|
|
3
3
|
import type { AuthAdapter, AuthSession, AuthStatus, SignInResult } from '@elytracms/studio/lib/auth';
|
|
4
4
|
/**
|
|
5
5
|
* Session store (EC-150). Owns the one `AuthAdapter` the app talks to, keeps
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ComponentNode } from '@elytracms/project-graph';
|
|
2
|
-
import type { ComponentFixture, ComponentManifest } from '@elytracms/component-registry';
|
|
1
|
+
import type { ComponentNode } from '@elytracms/core/project-graph';
|
|
2
|
+
import type { ComponentFixture, ComponentManifest } from '@elytracms/core/component-registry';
|
|
3
3
|
import type { StudioRegistry } from '@elytracms/studio/lib/registry';
|
|
4
4
|
/**
|
|
5
5
|
* Blocks panel model (EC-164) — the pure, React-free derivation behind the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { cloneWithNewIds } from '@elytracms/project-graph';
|
|
2
|
-
import { isCanvasEligible, propValueValidator } from '@elytracms/component-registry';
|
|
1
|
+
import { cloneWithNewIds } from '@elytracms/core/project-graph';
|
|
2
|
+
import { isCanvasEligible, propValueValidator } from '@elytracms/core/component-registry';
|
|
3
3
|
import { componentStatus } from '@elytracms/studio/lib/registry';
|
|
4
4
|
import { nodeFromProps, previewSpecs } from '@elytracms/studio/lib/registry/preview';
|
|
5
5
|
import { LAYOUT_PRESETS, nodeFromManifest } from './node-factory';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks-model.js","sourceRoot":"","sources":["../../../src/components/builder/blocks-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"blocks-model.js","sourceRoot":"","sources":["../../../src/components/builder/blocks-model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAG/D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAEhE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AA+CjE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAwC,EACxC,UAAyC;IAEzC,IAAI,CAAC,SAAS;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/D,IAAI,CAAC,UAAU;QAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAA;IACtC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;IACnC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,aAAa,GAAG,OAAO,CAAA;AAE7B,SAAS,eAAe,CAAC,MAAc;IACrC,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,OAAO,GAAG,EAAE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CAAC,CAAC;QACjB,GAAG,EAAE,WAAW,MAAM,CAAC,GAAG,EAAE;QAC5B,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,WAAW;QACvC,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,WAAW;QAC3B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,eAAe,CAAC,kBAAkB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7F,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE;KAC5B,CAAC,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InsertTarget } from '@elytracms/project-graph';
|
|
2
|
-
import type { ClipboardFragment } from '@elytracms/clipboard';
|
|
1
|
+
import type { InsertTarget } from '@elytracms/core/project-graph';
|
|
2
|
+
import type { ClipboardFragment } from '@elytracms/core/clipboard';
|
|
3
3
|
import type { StudioRegistry } from '@elytracms/studio/lib/registry';
|
|
4
4
|
import type { BlockTile } from './blocks-model';
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AlertTriangle, ClipboardCopy, Search } from 'lucide-react';
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { buildFragmentFromRegistryFixture, buildFragmentFromSubtree, } from '@elytracms/clipboard';
|
|
4
|
+
import { buildFragmentFromRegistryFixture, buildFragmentFromSubtree, } from '@elytracms/core/clipboard';
|
|
5
5
|
import { getStudioRegistry } from '@elytracms/studio/lib/registry';
|
|
6
6
|
import { useCollab } from '../collab/collab-context';
|
|
7
7
|
import { useStudioClipboard } from './clipboard-actions';
|