@elytracms/studio 0.0.99 → 0.0.100

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.
@@ -1,4 +1,4 @@
1
- import { applyDocumentPatches, documentKey, documentValueBuckets, expandValuePath, fieldPath, formatValuePath, isValuePathPrefix, readValueAt, selfTypeDocument, semanticValueEqual, touchedPaths, touchedPathsOfEntry, valuePathsOverlap, } from '@elytracms/core/cms-core';
1
+ import { applyDocumentPatches, documentKey, expandValuePath, fieldPositionPatches, formatValuePath, isValuePathPrefix, readValueAt, selfTypeDocument, semanticValueEqual, touchedPaths, touchedPathsOfEntry, valuePathsOverlap, } from '@elytracms/core/cms-core';
2
2
  import { createPersistQueue } from './persist-queue.js';
3
3
  /** EC-686 — a decomposed alias is re-sent at most this often (each time a colleague wrote the document in between). */
4
4
  const ALIAS_ATTEMPTS = 3;
@@ -231,22 +231,16 @@ function withAlias(document, alias) {
231
231
  /**
232
232
  * EC-686 item 1 — what a whole-document snapshot changed against the view it was made from,
233
233
  * position by position: a `set` (or an `unset`, the value gone) of every field position —
234
- * `values[f]`, `localized[l][f]` — whose value differs by THE equality
235
- * (`documentValueBuckets` + `semanticValueEqual`, the document diff's own reading). Every
236
- * value change of a document is one of these; its slot `alias` is the one key that is not.
234
+ * `values[f]`, `localized[l][f]` — whose value differs by THE equality. Every value change of
235
+ * a document is one of these; its slot `alias` is the one key that is not.
236
+ *
237
+ * EC-703 (Codex round 6 F33): THE own-property per-position diff (`fieldPositionPatches`,
238
+ * cms-core — the one the publish strip reads too). This copy read `bucket.after[key]`, so a
239
+ * removed field named after an `Object.prototype` member became `set constructor = Object`
240
+ * and every later `documentOf` threw (measured).
237
241
  */
238
242
  function positionPatches(view, snapshot) {
239
- const patches = [];
240
- for (const bucket of documentValueBuckets(view, snapshot)) {
241
- for (const key of new Set([...Object.keys(bucket.before), ...Object.keys(bucket.after)])) {
242
- if (semanticValueEqual(bucket.before[key], bucket.after[key]))
243
- continue;
244
- const path = fieldPath(key, bucket.locale);
245
- const value = bucket.after[key];
246
- patches.push(value === undefined ? { op: 'unset', path } : { op: 'set', path, value });
247
- }
248
- }
249
- return patches;
243
+ return fieldPositionPatches(view, snapshot);
250
244
  }
251
245
  export function createCmsPersister(options) {
252
246
  const queue = createPersistQueue((error) => {