@elytracms/studio 0.0.96 → 0.0.97

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 (37) hide show
  1. package/convex/cms.ts +153 -13
  2. package/convex/delivery-folded-drift.test.ts +104 -0
  3. package/convex/delivery.ts +24 -8
  4. package/convex/depth-codec-lookalike.test.ts +192 -0
  5. package/convex/fixture-accounts.test.ts +305 -0
  6. package/convex/fixtureAccounts.ts +298 -0
  7. package/convex/incarnation.test.ts +149 -0
  8. package/convex/ingest.test.ts +145 -3
  9. package/convex/ingest.ts +123 -17
  10. package/convex/receipt-races.test.ts +184 -0
  11. package/convex/records-zod-copy.test.ts +76 -0
  12. package/convex/schema.ts +20 -1
  13. package/convex/strict-delete.test.ts +129 -0
  14. package/dist/components/cms/cms-store.d.ts +4 -1
  15. package/dist/components/cms/cms-store.js +11 -13
  16. package/dist/components/cms/cms-store.js.map +1 -1
  17. package/dist/components/cms/use-document-draft.d.ts +41 -2
  18. package/dist/components/cms/use-document-draft.js +60 -18
  19. package/dist/components/cms/use-document-draft.js.map +1 -1
  20. package/dist/lib/collection-view/collection-view-source.d.ts +5 -2
  21. package/dist/lib/collection-view/collection-view-source.js.map +1 -1
  22. package/dist/lib/engine-version.d.ts +1 -1
  23. package/dist/lib/engine-version.js +1 -1
  24. package/dist/lib/engine-version.js.map +1 -1
  25. package/dist/lib/i18n/messages.de.js +2 -0
  26. package/dist/lib/i18n/messages.de.js.map +1 -1
  27. package/dist/lib/i18n/messages.en.d.ts +2 -0
  28. package/dist/lib/i18n/messages.en.js +2 -0
  29. package/dist/lib/i18n/messages.en.js.map +1 -1
  30. package/dist/lib/operations/cms-persistence.d.ts +41 -2
  31. package/dist/lib/operations/cms-persistence.js +111 -24
  32. package/dist/lib/operations/cms-persistence.js.map +1 -1
  33. package/dist/lib/persistence/convex-adapter.js +27 -1
  34. package/dist/lib/persistence/convex-adapter.js.map +1 -1
  35. package/dist/lib/persona/labels.js +1 -0
  36. package/dist/lib/persona/labels.js.map +1 -1
  37. package/package.json +4 -3
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
- import { applyDocumentPatches, createCollectionRegistry, createDocumentStore, documentKey, documentReachabilityIssues, documentSchema, resolveDocumentTitle, seedDefaults, titleFieldOf, validateDocument, valuesInLocale, writeField, } from '@elytracms/core/cms-core';
3
+ import { applyDocumentPatches, createCollectionRegistry, createDocumentStore, documentKey, documentReachabilityIssues, documentSchema, resolveDocumentTitle, seedDefaults, titleFieldOf, touchedPaths, validateDocument, valuesInLocale, writeField, } from '@elytracms/core/cms-core';
4
4
  import { createUuidIdFactory } from '@elytracms/core/persistence';
5
5
  import { translate } from '../../lib/i18n/index.js';
6
6
  import { configureStudioLocales, useStudioLocale } from '../../lib/locale/index.js';
@@ -10,7 +10,7 @@ import { Heading, Panel, Stack, Text } from '@elytracms/studio/ui';
10
10
  import { assetLibraryOracle, gateValidateOptions } from './gate-validation.js';
11
11
  import { matchesRef, removeDoc, replaceDoc, upsertDoc } from './document-ref-utils.js';
12
12
  import { createRequiredContext } from '../../lib/required-context.js';
13
- import { createCmsPersister, getStudioActor, getStudioOperations } from '../../lib/operations/index.js';
13
+ import { createCmsPersister, getStudioActor, getStudioOperations, importWrite } from '../../lib/operations/index.js';
14
14
  import { publishInSession, publishWithRevision as publishRevision, } from '../../lib/operations/publish-with-revision.js';
15
15
  import { operationErrorMessage } from '../../lib/persona/labels.js';
16
16
  import { fieldWritePatch } from '../../lib/cms/field-patch.js';
@@ -430,10 +430,11 @@ function CmsSession({ children, projectId, initialCollections, initialDocuments,
430
430
  ? {
431
431
  // EC-595 A2: ONE field patch through the persister's queue — at the
432
432
  // revision the row was at — never a whole-document side channel.
433
- // EC-647: the row the table SHOWED names that revision.
433
+ // EC-647: the row the table SHOWED names that revision — EC-667: at the
434
+ // cell's position (the row may show a pending write elsewhere).
434
435
  dispatch: async (next) => {
435
436
  const patch = fieldWritePatch(input.collection, next, input.field.name, input.locale);
436
- const outcome = await persister.commit(ref, [patch], [persister.revisionOfView(input.doc)], input.doc);
437
+ const outcome = await persister.commit(ref, [patch], [persister.revisionOfView(input.doc, touchedPaths(patch)[0])], input.doc);
437
438
  if (outcome.status === 'applied')
438
439
  return { ok: true, value: outcome.record };
439
440
  if (outcome.status === 'failed')
@@ -739,12 +740,7 @@ function CmsSession({ children, projectId, initialCollections, initialDocuments,
739
740
  for (const doc of accepted) {
740
741
  if (!persister)
741
742
  continue;
742
- const shown = documents.find((d) => matchesRef(d, doc));
743
- if (persister.revisionOf(doc) !== undefined) {
744
- persister.replace(doc, shown ? persister.revisionOfView(shown) : undefined);
745
- }
746
- else
747
- persister.create(doc);
743
+ importWrite(persister, doc, documents.find((d) => matchesRef(d, doc)));
748
744
  }
749
745
  // EC-224: imports land as the working DRAFT. Publish-ness is the version
750
746
  // pointer (`publishedKeys`), set by publishing — never carried in the
@@ -873,8 +869,10 @@ function CmsSession({ children, projectId, initialCollections, initialDocuments,
873
869
  }
874
870
  const written = setFieldDoc(current);
875
871
  // EC-647: authored from the row the session holds — its revision, never the
876
- // tracked one (a colleague's change the user never saw is refused, visibly).
877
- const outcome = await persister.commit(ref, [fieldWritePatch(collection, written, setField.field, activeLocale)], [persister.revisionOfView(current)], current);
872
+ // tracked one (a colleague's change the user never saw is refused, visibly);
873
+ // EC-667: the revision of the field's position in that row.
874
+ const patch = fieldWritePatch(collection, written, setField.field, activeLocale);
875
+ const outcome = await persister.commit(ref, [patch], [persister.revisionOfView(current, touchedPaths(patch)[0])], current);
878
876
  if (outcome.status === 'applied')
879
877
  return { ok: true, value: outcome.record };
880
878
  if (outcome.status === 'failed')
@@ -1011,7 +1009,7 @@ function CmsSession({ children, projectId, initialCollections, initialDocuments,
1011
1009
  titleOf,
1012
1010
  commitPatches,
1013
1011
  revisionOf: (ref) => persisterRef.current?.revisionOf(ref),
1014
- revisionOfView: (view) => persisterRef.current?.revisionOfView(view),
1012
+ revisionOfView: (view, path) => persisterRef.current?.revisionOfView(view, path),
1015
1013
  insertDocument,
1016
1014
  newDocumentId: newId,
1017
1015
  commitFieldEdit,