@prismicio/types-internal 4.6.0-pr.26.ebb6cbc → 4.7.0-canary.a13781f

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 (39) hide show
  1. package/dist/content/codec/group.js +3 -2
  2. package/dist/content/codec/group.js.map +1 -1
  3. package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
  4. package/dist/content/codec/legacyContentCtx.js +5 -1
  5. package/dist/content/codec/legacyContentCtx.js.map +1 -1
  6. package/dist/helpers/documentContent.js +1 -1
  7. package/dist/helpers/documentContent.js.map +1 -1
  8. package/dist/index.d.ts +5 -1
  9. package/dist/index.js +4 -1
  10. package/dist/io-ts.d.ts +894 -894
  11. package/dist/io-ts.d.ts.map +1 -1
  12. package/dist/io-ts.js +16 -16
  13. package/dist/model/diff/changes.d.ts +21 -0
  14. package/dist/model/diff/changes.d.ts.map +1 -0
  15. package/dist/model/diff/changes.js +11 -0
  16. package/dist/model/diff/changes.js.map +1 -0
  17. package/dist/model/diff/sharedSlice.d.ts +14 -0
  18. package/dist/model/diff/sharedSlice.d.ts.map +1 -0
  19. package/dist/model/diff/sharedSlice.js +45 -0
  20. package/dist/model/diff/sharedSlice.js.map +1 -0
  21. package/dist/model/diff/utils.js +40 -0
  22. package/dist/model/diff/utils.js.map +1 -0
  23. package/dist/model/diff/variation.d.ts +15 -0
  24. package/dist/model/diff/variation.d.ts.map +1 -0
  25. package/dist/model/diff/variation.js +92 -0
  26. package/dist/model/diff/variation.js.map +1 -0
  27. package/dist/model/diff/widgets.d.ts +15 -0
  28. package/dist/model/diff/widgets.d.ts.map +1 -0
  29. package/dist/model/nestable.js +3 -3
  30. package/dist/zod4.js +16 -16
  31. package/package.json +5 -2
  32. package/src/content/codec/group.ts +1 -1
  33. package/src/content/codec/legacyContentCtx.ts +7 -1
  34. package/src/helpers/documentContent.ts +1 -1
  35. package/src/index.ts +12 -0
  36. package/src/model/diff/changes.ts +4 -4
  37. package/src/model/diff/sharedSlice.ts +8 -8
  38. package/src/model/diff/variation.ts +6 -6
  39. package/src/model/diff/widgets.ts +3 -3
@@ -32,15 +32,16 @@ const GroupItemLegacyCodec = (ctx, index) => ({
32
32
  };
33
33
  },
34
34
  fromContent(input) {
35
+ const groupItemCtx = ctx.withContentKey(index.toString());
35
36
  const legacy = {
36
37
  content: {},
37
38
  types: {},
38
- keys: { [ctx.withContentKey(index.toString()).keyOfKey]: input.key }
39
+ keys: { [groupItemCtx.keyOfKey]: input.key }
39
40
  };
40
41
  for (const [key, content] of input.value) {
41
42
  const itemCtx = getFieldCtx({
42
43
  fieldKey: key,
43
- ctx
44
+ ctx: groupItemCtx
44
45
  });
45
46
  const result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content);
46
47
  if (result) {
@@ -1 +1 @@
1
- {"version":3,"file":"group.js","names":[],"sources":["../../../src/content/codec/group.ts"],"sourcesContent":["import {\n\tGroupContentSchema,\n\tGroupContentType,\n\tGroupItemContentSchema,\n\tGroupItemContentType,\n\tNestableAndGroupContentSchema,\n} from \"../group\"\nimport type { GroupContent, GroupItemContent, NestableAndGroupContent } from \"../group\"\nimport { GroupItemLegacySchema, GroupLegacySchema } from \"../legacy/group\"\nimport type { GroupItemLegacy, GroupLegacy, NestableAndGroupLegacy } from \"../legacy/group\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\nexport const GroupItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n\tindex: number,\n): LegacyCodec<GroupItemContent, GroupItemLegacy> => ({\n\tname: \"GroupItemLegacy\",\n\n\tis(input): input is GroupItemContent {\n\t\treturn GroupItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst value: GroupItemContent[\"value\"] = []\n\t\tfor (const [key, legacy] of Object.entries(parsed.data)) {\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tcontentKey: key,\n\t\t\t\tctx: groupItemCtx,\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).toContent(legacy)\n\t\t\tif (result.success) {\n\t\t\t\tvalue.push([key, result.data])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\tkey: groupItemCtx.fieldContentKey,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst legacy: ReturnType<LegacyCodec<GroupItemContent, GroupItemLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {},\n\t\t\ttypes: {},\n\t\t\tkeys: { [groupItemCtx.keyOfKey]: input.key },\n\t\t}\n\n\t\tfor (const [key, content] of input.value) {\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: key, ctx })\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content)\n\t\t\tif (result) {\n\t\t\t\tlegacy.content[key] = result.content\n\t\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t\t}\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const GroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<GroupContent, GroupLegacy> => ({\n\tname: \"GroupLegacy\",\n\n\tis(input): input is GroupContent {\n\t\treturn GroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: GroupContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\n\t\t\t// Replace null items with empty GroupItemContent\n\t\t\tif (!item) {\n\t\t\t\tvalue.push({\n\t\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\t\tkey: ctx.withContentKey(index.toString()).fieldContentKey,\n\t\t\t\t\tvalue: [],\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: GroupContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<GroupContent, GroupLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Group\" },\n\t\t\tkeys: {},\n\t\t}\n\n\t\tfor (let index = 0; index < input.value.length; index++) {\n\t\t\tconst item = input.value[index]\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).fromContent(item)\n\n\t\t\tlegacy.content.push(result.content)\n\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const NestableAndGroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<NestableAndGroupContent, NestableAndGroupLegacy, true> => ({\n\tname: \"NestableAndGroupLegacy\",\n\n\tis(input): input is NestableAndGroupContent {\n\t\treturn NestableAndGroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn ctx.fieldType === \"Group\"\n\t\t\t? GroupLegacyCodec(ctx).toContent(input)\n\t\t\t: NestableLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn input.__TYPE__ === GroupContentType\n\t\t\t? Gro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AC;CACvD;CAEA,UAAU,OAAO;EAChB,OAAO,IAAI,cAAc,UACtB,iBAAiB,GAAG,CAAC,CAAC,UAAU,KAAK,IACrC,oBAAoB,GAAG,CAAC,CAAC,UAAU,KAAK;CAC5C;CAEA,YAAY,OAAO;EAClB,OAAO,MAAM,aAAA,qBACV,iBAAiB,GAAG,CAAC,CAAC,YAAY,KAAK,IACvC,oBAAoB,GAAG,CAAC,CAAC,YAAY,KAAK;CAC9C;AACD"}
1
+ {"version":3,"file":"group.js","names":[],"sources":["../../../src/content/codec/group.ts"],"sourcesContent":["import {\n\tGroupContentSchema,\n\tGroupContentType,\n\tGroupItemContentSchema,\n\tGroupItemContentType,\n\tNestableAndGroupContentSchema,\n} from \"../group\"\nimport type { GroupContent, GroupItemContent, NestableAndGroupContent } from \"../group\"\nimport { GroupItemLegacySchema, GroupLegacySchema } from \"../legacy/group\"\nimport type { GroupItemLegacy, GroupLegacy, NestableAndGroupLegacy } from \"../legacy/group\"\nimport { type LegacyContentCtx, type LegacyCodec, getFieldCtx } from \"./legacyContentCtx\"\nimport { NestableLegacyCodec } from \"./nestable\"\n\nexport const GroupItemLegacyCodec = (\n\tctx: LegacyContentCtx,\n\tindex: number,\n): LegacyCodec<GroupItemContent, GroupItemLegacy> => ({\n\tname: \"GroupItemLegacy\",\n\n\tis(input): input is GroupItemContent {\n\t\treturn GroupItemContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupItemLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst value: GroupItemContent[\"value\"] = []\n\t\tfor (const [key, legacy] of Object.entries(parsed.data)) {\n\t\t\tconst itemCtx = getFieldCtx({\n\t\t\t\tfieldKey: key,\n\t\t\t\tcontentKey: key,\n\t\t\t\tctx: groupItemCtx,\n\t\t\t})\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).toContent(legacy)\n\t\t\tif (result.success) {\n\t\t\t\tvalue.push([key, result.data])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\tkey: groupItemCtx.fieldContentKey,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst groupItemCtx = ctx.withContentKey(index.toString())\n\n\t\tconst legacy: ReturnType<LegacyCodec<GroupItemContent, GroupItemLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: {},\n\t\t\ttypes: {},\n\t\t\tkeys: { [groupItemCtx.keyOfKey]: input.key },\n\t\t}\n\n\t\tfor (const [key, content] of input.value) {\n\t\t\tconst itemCtx = getFieldCtx({ fieldKey: key, ctx: groupItemCtx })\n\n\t\t\tconst result = NestableAndGroupLegacyCodec(itemCtx).fromContent(content)\n\t\t\tif (result) {\n\t\t\t\tlegacy.content[key] = result.content\n\t\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t\t}\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const GroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<GroupContent, GroupLegacy> => ({\n\tname: \"GroupLegacy\",\n\n\tis(input): input is GroupContent {\n\t\treturn GroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\tconst parsed = GroupLegacySchema.safeParse(input)\n\t\tif (!parsed.success) {\n\t\t\treturn parsed\n\t\t}\n\n\t\tconst value: GroupContent[\"value\"] = []\n\t\tfor (let index = 0; index < parsed.data.length; index++) {\n\t\t\tconst item = parsed.data[index]\n\n\t\t\t// Replace null items with empty GroupItemContent\n\t\t\tif (!item) {\n\t\t\t\tvalue.push({\n\t\t\t\t\t__TYPE__: GroupItemContentType,\n\t\t\t\t\tkey: ctx.withContentKey(index.toString()).fieldContentKey,\n\t\t\t\t\tvalue: [],\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).toContent(item)\n\t\t\tif (!result.success) {\n\t\t\t\treturn result\n\t\t\t}\n\n\t\t\tvalue.push(result.data)\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: { __TYPE__: GroupContentType, value },\n\t\t}\n\t},\n\n\tfromContent(input) {\n\t\tconst legacy: ReturnType<LegacyCodec<GroupContent, GroupLegacy>[\"fromContent\"]> = {\n\t\t\tcontent: [],\n\t\t\ttypes: { [ctx.keyOfType]: \"Group\" },\n\t\t\tkeys: {},\n\t\t}\n\n\t\tfor (let index = 0; index < input.value.length; index++) {\n\t\t\tconst item = input.value[index]\n\t\t\tconst result = GroupItemLegacyCodec(ctx, index).fromContent(item)\n\n\t\t\tlegacy.content.push(result.content)\n\t\t\tlegacy.types = { ...legacy.types, ...result.types }\n\t\t\tlegacy.keys = { ...legacy.keys, ...result.keys }\n\t\t}\n\n\t\treturn legacy\n\t},\n})\n\nexport const NestableAndGroupLegacyCodec = (\n\tctx: LegacyContentCtx,\n): LegacyCodec<NestableAndGroupContent, NestableAndGroupLegacy, true> => ({\n\tname: \"NestableAndGroupLegacy\",\n\n\tis(input): input is NestableAndGroupContent {\n\t\treturn NestableAndGroupContentSchema.safeParse(input).success\n\t},\n\n\ttoContent(input) {\n\t\treturn ctx.fieldType === \"Group\"\n\t\t\t? GroupLegacyCodec(ctx).toContent(input)\n\t\t\t: NestableLegacyCodec(ctx).toContent(input)\n\t},\n\n\tfromContent(input) {\n\t\treturn input.__TYPE__ === GroupContentType\n\t\t\t? GroupLegacyCodec(ctx).fromContent(input)\n\t\t\t: NestableLegacyCodec(ctx).fromContent(input)\n\t},\n})\n"],"mappings":";;;;;AAaA,MAAa,wBACZ,KACA,WACqD;CACrD,MAAM;CAEN,GAAG,OAAkC;EACpC,OAAO,uBAAuB,UAAU,KAAK,CAAC,CAAC;C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,MAAM,aAAA,qBACV,iBAAiB,GAAG,CAAC,CAAC,YAAY,KAAK,IACvC,oBAAoB,GAAG,CAAC,CAAC,YAAY,KAAK;CAC9C;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"legacyContentCtx.d.ts","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"mappings":";;;UAIU;EACT;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW,YAAY;EACvB,UAAU;;cAGE;EACZ;EACA;EACA;EACA;EACA,WAAW;EACX,YAAY;EACZ,UAAU,YAAY;EACtB,SAAS;EACT;EACA,aAAa;EACb;EAEA,cACC,UACA,YACA,aACA,WACA,UACA,WACE;EAmBH,eAAe,qBAAqB;;UAS3B;EACT;EACA;EACA,KAAK;EACL,WAAW;;iBAGI,cACf,UACA,YAAY,iBACZ,KACA,YACE,oBAAoB;iBAYP,WACf,aACA,WAAU,YAAY,mBACtB,UAAS,sBACP"}
1
+ {"version":3,"file":"legacyContentCtx.d.ts","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"mappings":";;;UASU;EACT;EACA;EACA,YAAY;EACZ,cAAc;EACd,WAAW,YAAY;EACvB,UAAU;;cAGE;EACZ;EACA;EACA;EACA;EACA,WAAW;EACX,YAAY;EACZ,UAAU,YAAY;EACtB,SAAS;EACT;EACA,aAAa;EACb;EAEA,cACC,UACA,YACA,aACA,WACA,UACA,WACE;EAoBH,eAAe,qBAAqB;;UAS3B;EACT;EACA;EACA,KAAK;EACL,WAAW;;iBAGI,cACf,UACA,YAAY,iBACZ,KACA,YACE,oBAAoB;iBAYP,WACf,aACA,WAAU,YAAY,mBACtB,UAAS,sBACP"}
@@ -1,4 +1,8 @@
1
+ import { v5 } from "uuid";
1
2
  //#region src/content/codec/legacyContentCtx.ts
3
+ function uuidV5ForPath(path) {
4
+ return v5(JSON.stringify(path), v5.URL);
5
+ }
2
6
  var LegacyContentCtx = class LegacyContentCtx {
3
7
  fieldKey;
4
8
  prefixedKey;
@@ -24,7 +28,7 @@ var LegacyContentCtx = class LegacyContentCtx {
24
28
  this.keyOfType = `${prefixedKey}_TYPE`;
25
29
  this.keyOfKey = `${prefixedContentKey}_KEY`;
26
30
  this.fieldType = this.allTypes.get(this.prefixedKey);
27
- this.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? crypto.randomUUID();
31
+ this.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? uuidV5ForPath([...this.contentPath, this.contentKey]);
28
32
  }
29
33
  withContentKey(contentKey) {
30
34
  return new LegacyContentCtx({
@@ -1 +1 @@
1
- {"version":3,"file":"legacyContentCtx.js","names":[],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"sourcesContent":["import type { z } from \"zod/mini\"\n\nimport type { FieldOrSliceType } from \"../../model/widget\"\n\ninterface LegacyContentCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tfieldPath?: Array<string>\n\tcontentPath?: Array<string>\n\tallTypes?: Map<string, FieldOrSliceType>\n\tallKeys?: Map<string, string>\n}\n\nexport class LegacyContentCtx {\n\tfieldKey: string\n\tprefixedKey: string\n\tkeyOfType: string\n\tkeyOfKey: string\n\tfieldPath: Array<string>\n\tfieldType?: FieldOrSliceType | undefined\n\tallTypes: Map<string, FieldOrSliceType>\n\tallKeys: Map<string, string>\n\tcontentKey: string\n\tcontentPath: Array<string>\n\tfieldContentKey: string\n\n\tconstructor({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath,\n\t\tfieldPath,\n\t\tallTypes,\n\t\tallKeys,\n\t}: LegacyContentCtxParams) {\n\t\tthis.fieldKey = fieldKey\n\t\tthis.contentKey = contentKey || fieldKey\n\t\tthis.fieldPath = fieldPath || []\n\t\tthis.contentPath = contentPath || []\n\t\tthis.allTypes = allTypes || new Map<string, FieldOrSliceType>()\n\t\tthis.allKeys = allKeys || new Map<string, string>()\n\n\t\tconst prefixedKey = Array.of(this.fieldPath, [this.fieldKey]).flat().join(\".\")\n\n\t\tconst prefixedContentKey = Array.of(this.contentPath, [this.contentKey]).flat().join(\".\")\n\n\t\tthis.prefixedKey = prefixedKey\n\t\tthis.keyOfType = `${prefixedKey}_TYPE`\n\t\tthis.keyOfKey = `${prefixedContentKey}_KEY`\n\t\tthis.fieldType = this.allTypes.get(this.prefixedKey)\n\t\tthis.fieldContentKey = this.allKeys.get(prefixedContentKey) ?? crypto.randomUUID()\n\t}\n\n\twithContentKey(contentKey: string): LegacyContentCtx {\n\t\treturn new LegacyContentCtx({\n\t\t\t...this,\n\t\t\tcontentPath: [...this.contentPath, this.contentKey],\n\t\t\tcontentKey,\n\t\t})\n\t}\n}\n\ninterface GetFieldCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tctx: LegacyContentCtx\n\tprefixes?: Array<string>\n}\n\nexport function getFieldCtx({\n\tfieldKey,\n\tcontentKey: contentKeyParam,\n\tctx,\n\tprefixes,\n}: GetFieldCtxParams): LegacyContentCtx {\n\tconst contentKey = contentKeyParam || fieldKey\n\treturn new LegacyContentCtx({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath: [...ctx.contentPath, ctx.contentKey, ...(prefixes || [])],\n\t\tfieldPath: [...ctx.fieldPath, ctx.fieldKey, ...(prefixes || [])],\n\t\tallTypes: ctx.allTypes,\n\t\tallKeys: ctx.allKeys,\n\t})\n}\n\nexport function defaultCtx(\n\tkey: string,\n\tallTypes: Map<string, FieldOrSliceType> = new Map(),\n\tallKeys: Map<string, string> = new Map(),\n): LegacyContentCtx {\n\treturn new LegacyContentCtx({\n\t\tfieldKey: key,\n\t\tcontentKey: key,\n\t\tcontentPath: [],\n\t\tfieldPath: [],\n\t\tallTypes,\n\t\tallKeys,\n\t})\n}\n\ntype WithTypes<T> = {\n\tkeys: Record<string, string>\n\ttypes: Record<string, FieldOrSliceType>\n\tcontent: T\n}\n\nexport type LegacyCodec<A, LegacyRaw, AllowUndefined extends boolean = false> = {\n\tname: string\n\tis(input: unknown): input is A\n\ttoContent(\n\t\tinput: unknown,\n\t): z.core.util.SafeParseSuccess<A> | z.core.util.SafeParseError<LegacyRaw | unknown>\n\tfromContent(\n\t\tvalue: A,\n\t): AllowUndefined extends false ? WithTypes<LegacyRaw> : WithTypes<LegacyRaw> | undefined\n}\n"],"mappings":";AAaA,IAAa,mBAAb,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,EACX,UACA,YACA,aACA,WACA,UACA,WAC0B;EAC1B,KAAK,WAAW;EAChB,KAAK,aAAa,cAAc;EAChC,KAAK,YAAY,aAAa,CAAC;EAC/B,KAAK,cAAc,eAAe,CAAC;EACnC,KAAK,WAAW,4BAAY,IAAI,IAA8B;EAC9D,KAAK,UAAU,2BAAW,IAAI,IAAoB;EAElD,MAAM,cAAc,MAAM,GAAG,KAAK,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAE7E,MAAM,qBAAqB,MAAM,GAAG,KAAK,aAAa,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAExF,KAAK,cAAc;EACnB,KAAK,YAAY,GAAG,YAAY;EAChC,KAAK,WAAW,GAAG,mBAAmB;EACtC,KAAK,YAAY,KAAK,SAAS,IAAI,KAAK,WAAW;EACnD,KAAK,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,KAAK,OAAO,WAAW;CAClF;CAEA,eAAe,YAAsC;EACpD,OAAO,IAAI,iBAAiB;GAC3B,GAAG;GACH,aAAa,CAAC,GAAG,KAAK,aAAa,KAAK,UAAU;GAClD;EACD,CAAC;CACF;AACD;AASA,SAAgB,YAAY,EAC3B,UACA,YAAY,iBACZ,KACA,YACuC;CAEvC,OAAO,IAAI,iBAAiB;EAC3B;EACA,YAHkB,mBAAmB;EAIrC,aAAa;GAAC,GAAG,IAAI;GAAa,IAAI;GAAY,GAAI,YAAY,CAAC;EAAE;EACrE,WAAW;GAAC,GAAG,IAAI;GAAW,IAAI;GAAU,GAAI,YAAY,CAAC;EAAE;EAC/D,UAAU,IAAI;EACd,SAAS,IAAI;CACd,CAAC;AACF;AAEA,SAAgB,WACf,KACA,2BAA0C,IAAI,IAAI,GAClD,0BAA+B,IAAI,IAAI,GACpB;CACnB,OAAO,IAAI,iBAAiB;EAC3B,UAAU;EACV,YAAY;EACZ,aAAa,CAAC;EACd,WAAW,CAAC;EACZ;EACA;CACD,CAAC;AACF"}
1
+ {"version":3,"file":"legacyContentCtx.js","names":["uuidV5"],"sources":["../../../src/content/codec/legacyContentCtx.ts"],"sourcesContent":["import { v5 as uuidV5 } from \"uuid\"\nimport type { z } from \"zod/mini\"\n\nimport type { FieldOrSliceType } from \"../../model/widget\"\n\nfunction uuidV5ForPath(path: string[]): string {\n\treturn uuidV5(JSON.stringify(path), uuidV5.URL)\n}\n\ninterface LegacyContentCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tfieldPath?: Array<string>\n\tcontentPath?: Array<string>\n\tallTypes?: Map<string, FieldOrSliceType>\n\tallKeys?: Map<string, string>\n}\n\nexport class LegacyContentCtx {\n\tfieldKey: string\n\tprefixedKey: string\n\tkeyOfType: string\n\tkeyOfKey: string\n\tfieldPath: Array<string>\n\tfieldType?: FieldOrSliceType | undefined\n\tallTypes: Map<string, FieldOrSliceType>\n\tallKeys: Map<string, string>\n\tcontentKey: string\n\tcontentPath: Array<string>\n\tfieldContentKey: string\n\n\tconstructor({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath,\n\t\tfieldPath,\n\t\tallTypes,\n\t\tallKeys,\n\t}: LegacyContentCtxParams) {\n\t\tthis.fieldKey = fieldKey\n\t\tthis.contentKey = contentKey || fieldKey\n\t\tthis.fieldPath = fieldPath || []\n\t\tthis.contentPath = contentPath || []\n\t\tthis.allTypes = allTypes || new Map<string, FieldOrSliceType>()\n\t\tthis.allKeys = allKeys || new Map<string, string>()\n\n\t\tconst prefixedKey = Array.of(this.fieldPath, [this.fieldKey]).flat().join(\".\")\n\n\t\tconst prefixedContentKey = Array.of(this.contentPath, [this.contentKey]).flat().join(\".\")\n\n\t\tthis.prefixedKey = prefixedKey\n\t\tthis.keyOfType = `${prefixedKey}_TYPE`\n\t\tthis.keyOfKey = `${prefixedContentKey}_KEY`\n\t\tthis.fieldType = this.allTypes.get(this.prefixedKey)\n\t\tthis.fieldContentKey =\n\t\t\tthis.allKeys.get(prefixedContentKey) ?? uuidV5ForPath([...this.contentPath, this.contentKey])\n\t}\n\n\twithContentKey(contentKey: string): LegacyContentCtx {\n\t\treturn new LegacyContentCtx({\n\t\t\t...this,\n\t\t\tcontentPath: [...this.contentPath, this.contentKey],\n\t\t\tcontentKey,\n\t\t})\n\t}\n}\n\ninterface GetFieldCtxParams {\n\tfieldKey: string\n\tcontentKey?: string\n\tctx: LegacyContentCtx\n\tprefixes?: Array<string>\n}\n\nexport function getFieldCtx({\n\tfieldKey,\n\tcontentKey: contentKeyParam,\n\tctx,\n\tprefixes,\n}: GetFieldCtxParams): LegacyContentCtx {\n\tconst contentKey = contentKeyParam || fieldKey\n\treturn new LegacyContentCtx({\n\t\tfieldKey,\n\t\tcontentKey,\n\t\tcontentPath: [...ctx.contentPath, ctx.contentKey, ...(prefixes || [])],\n\t\tfieldPath: [...ctx.fieldPath, ctx.fieldKey, ...(prefixes || [])],\n\t\tallTypes: ctx.allTypes,\n\t\tallKeys: ctx.allKeys,\n\t})\n}\n\nexport function defaultCtx(\n\tkey: string,\n\tallTypes: Map<string, FieldOrSliceType> = new Map(),\n\tallKeys: Map<string, string> = new Map(),\n): LegacyContentCtx {\n\treturn new LegacyContentCtx({\n\t\tfieldKey: key,\n\t\tcontentKey: key,\n\t\tcontentPath: [],\n\t\tfieldPath: [],\n\t\tallTypes,\n\t\tallKeys,\n\t})\n}\n\ntype WithTypes<T> = {\n\tkeys: Record<string, string>\n\ttypes: Record<string, FieldOrSliceType>\n\tcontent: T\n}\n\nexport type LegacyCodec<A, LegacyRaw, AllowUndefined extends boolean = false> = {\n\tname: string\n\tis(input: unknown): input is A\n\ttoContent(\n\t\tinput: unknown,\n\t): z.core.util.SafeParseSuccess<A> | z.core.util.SafeParseError<LegacyRaw | unknown>\n\tfromContent(\n\t\tvalue: A,\n\t): AllowUndefined extends false ? WithTypes<LegacyRaw> : WithTypes<LegacyRaw> | undefined\n}\n"],"mappings":";;AAKA,SAAS,cAAc,MAAwB;CAC9C,OAAOA,GAAO,KAAK,UAAU,IAAI,GAAGA,GAAO,GAAG;AAC/C;AAWA,IAAa,mBAAb,MAAa,iBAAiB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,EACX,UACA,YACA,aACA,WACA,UACA,WAC0B;EAC1B,KAAK,WAAW;EAChB,KAAK,aAAa,cAAc;EAChC,KAAK,YAAY,aAAa,CAAC;EAC/B,KAAK,cAAc,eAAe,CAAC;EACnC,KAAK,WAAW,4BAAY,IAAI,IAA8B;EAC9D,KAAK,UAAU,2BAAW,IAAI,IAAoB;EAElD,MAAM,cAAc,MAAM,GAAG,KAAK,WAAW,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAE7E,MAAM,qBAAqB,MAAM,GAAG,KAAK,aAAa,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG;EAExF,KAAK,cAAc;EACnB,KAAK,YAAY,GAAG,YAAY;EAChC,KAAK,WAAW,GAAG,mBAAmB;EACtC,KAAK,YAAY,KAAK,SAAS,IAAI,KAAK,WAAW;EACnD,KAAK,kBACJ,KAAK,QAAQ,IAAI,kBAAkB,KAAK,cAAc,CAAC,GAAG,KAAK,aAAa,KAAK,UAAU,CAAC;CAC9F;CAEA,eAAe,YAAsC;EACpD,OAAO,IAAI,iBAAiB;GAC3B,GAAG;GACH,aAAa,CAAC,GAAG,KAAK,aAAa,KAAK,UAAU;GAClD;EACD,CAAC;CACF;AACD;AASA,SAAgB,YAAY,EAC3B,UACA,YAAY,iBACZ,KACA,YACuC;CAEvC,OAAO,IAAI,iBAAiB;EAC3B;EACA,YAHkB,mBAAmB;EAIrC,aAAa;GAAC,GAAG,IAAI;GAAa,IAAI;GAAY,GAAI,YAAY,CAAC;EAAE;EACrE,WAAW;GAAC,GAAG,IAAI;GAAW,IAAI;GAAU,GAAI,YAAY,CAAC;EAAE;EAC/D,UAAU,IAAI;EACd,SAAS,IAAI;CACd,CAAC;AACF;AAEA,SAAgB,WACf,KACA,2BAA0C,IAAI,IAAI,GAClD,0BAA+B,IAAI,IAAI,GACpB;CACnB,OAAO,IAAI,iBAAiB;EAC3B,UAAU;EACV,YAAY;EACZ,aAAa,CAAC;EACd,WAAW,CAAC;EACZ;EACA;CACD,CAAC;AACF"}
@@ -34,7 +34,7 @@ function fromLegacy(legacy, model) {
34
34
  const parsed = FieldOrSliceTypeSchema.safeParse(value);
35
35
  if (parsed.success) types.set(key.substring(0, key.length - 5), parsed.data);
36
36
  } else if (key.endsWith("_KEY")) {
37
- const parsed = z.uuidv4().safeParse(value);
37
+ const parsed = z.union([z.uuidv4(), z.uuid({ version: "v5" })]).safeParse(value);
38
38
  if (parsed.success) keys.set(key.substring(0, key.length - 4), parsed.data);
39
39
  } else if (!key.endsWith("_POSITION")) widgets[key] = value;
40
40
  const result = DocumentLegacyCodec(defaultCtx("", types, keys)).toContent(widgets);
@@ -1 +1 @@
1
- {"version":3,"file":"documentContent.js","names":["contentPath.serialize","customTypeModel.collectSharedSlices","sliceContent.compositeToShared","sliceContent.legacyToShared"],"sources":["../../src/helpers/documentContent.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { DocumentLegacyCodec } from \"../content/codec/document\"\nimport { defaultCtx } from \"../content/codec/legacyContentCtx\"\nimport type { DocumentContent } from \"../content/document\"\nimport type { DocumentLegacy } from \"../content/legacy/document\"\nimport { DocumentLegacySchema } from \"../content/legacy/document\"\nimport { isNestableContent } from \"../content/nestable\"\nimport type { CompositeSliceItemContent, LegacySliceItemContent } from \"../content/slices\"\nimport type { WidgetContent } from \"../content/widget\"\nimport type { StaticCustomTypeModel } from \"../model/customType\"\nimport type { FieldOrSliceType } from \"../model/widget\"\nimport { FieldOrSliceTypeSchema } from \"../model/widget\"\nimport * as contentPath from \"./contentPath\"\nimport * as customTypeModel from \"./customTypeModel\"\nimport * as sliceContent from \"./sliceContent\"\nimport { traverseDocumentContent } from \"./traverseContent\"\n\nexport function collectWidgets<TWidgetContent extends WidgetContent>(\n\tdocument: DocumentContent,\n\ttest: (\n\t\tcontent: WidgetContent,\n\t\targs: {\n\t\t\tpath: contentPath.Path\n\t\t\tkey: string\n\t\t\tapiID: string\n\t\t},\n\t) => content is TWidgetContent,\n): Record<string, TWidgetContent> {\n\tconst collected: Record<string, TWidgetContent> = {}\n\n\ttraverseDocumentContent(document, {\n\t\ttransformWidget: ({ content, ...args }) => {\n\t\t\tif (test(content, args)) {\n\t\t\t\tcollected[contentPath.serialize(args.path)] = content\n\t\t\t}\n\n\t\t\treturn content\n\t\t},\n\t})\n\n\treturn collected\n}\n\nexport function fromLegacy(\n\tlegacy: DocumentLegacy,\n\tmodel: StaticCustomTypeModel,\n): DocumentContent | undefined {\n\tconst parsed = DocumentLegacySchema.safeParse(legacy)\n\tif (!parsed.success) {\n\t\treturn\n\t}\n\n\tconst types = new Map<string, FieldOrSliceType>()\n\tconst keys = new Map<string, string>()\n\tconst widgets: DocumentLegacy = {}\n\tfor (const [key, value] of Object.entries(parsed.data)) {\n\t\tif (key.endsWith(\"_TYPE\")) {\n\t\t\tconst parsed = FieldOrSliceTypeSchema.safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\ttypes.set(key.substring(0, key.length - 5), parsed.data)\n\t\t\t}\n\t\t} else if (key.endsWith(\"_KEY\")) {\n\t\t\tconst parsed = z.uuidv4().safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\tkeys.set(key.substring(0, key.length - 4), parsed.data)\n\t\t\t}\n\t\t} else if (!key.endsWith(\"_POSITION\")) {\n\t\t\twidgets[key] = value\n\t\t}\n\t}\n\n\tconst result = DocumentLegacyCodec(defaultCtx(\"\", types, keys)).toContent(widgets)\n\tif (!result.success) {\n\t\treturn\n\t}\n\n\tconst needsMigration = Object.values(customTypeModel.collectSharedSlices(model)).some((slice) =>\n\t\tBoolean(slice.legacyPaths),\n\t)\n\n\tif (needsMigration) {\n\t\treturn traverseDocumentContent(result.data, {\n\t\t\tmodel,\n\t\t\ttransformSlice: ({ content, model }) => {\n\t\t\t\tif (model?.type === \"SharedSlice\") {\n\t\t\t\t\tif (content.widget.__TYPE__ === \"CompositeSliceContent\") {\n\t\t\t\t\t\treturn sliceContent.compositeToShared(content as CompositeSliceItemContent, model)\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontent.widget.__TYPE__ === \"GroupContentType\" ||\n\t\t\t\t\t\tisNestableContent(content.widget)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn sliceContent.legacyToShared(content as LegacySliceItemContent, model)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn content\n\t\t\t},\n\t\t})\n\t}\n\n\treturn result.data\n}\n\nexport function toLegacy(document: DocumentContent): DocumentLegacy {\n\tconst { content, types, keys } = DocumentLegacyCodec(defaultCtx(\"\")).fromContent(document)\n\n\treturn { ...content, ...types, ...keys }\n}\n\nexport function serializeUID(input: string): string {\n\tconst nowhitespace = input.replace(/ /g, \"-\")\n\n\tconst normalized = nowhitespace.normalize(\"NFD\").replace(/\\p{M}/gu, \"\")\n\n\tconst slug = normalized.replace(/[^\\p{L}\\d_.-]/gu, \"\")\n\n\treturn slug.toLowerCase()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eACf,UACA,MAQiC;CACjC,MAAM,YAA4C,CAAC;CAEnD,wBAAwB,UAAU,EACjC,kBAAkB,EAAE,SAAS,GAAG,WAAW;EAC1C,IAAI,KAAK,SAAS,IAAI,GACrB,UAAUA,UAAsB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O,OAAO;AACf;AAEA,SAAgB,SAAS,UAA2C;CACnE,MAAM,EAAE,SAAS,OAAO,SAAS,oBAAoB,WAAW,EAAE,CAAC,CAAC,CAAC,YAAY,QAAQ;CAEzF,OAAO;EAAE,GAAG;EAAS,GAAG;EAAO,GAAG;CAAK;AACxC;AAEA,SAAgB,aAAa,OAAuB;CAOnD,OANqB,MAAM,QAAQ,MAAM,GAEX,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,QAAQ,WAAW,EAE9C,CAAC,CAAC,QAAQ,mBAAmB,EAEzC,CAAC,CAAC,YAAY;AACzB"}
1
+ {"version":3,"file":"documentContent.js","names":["contentPath.serialize","customTypeModel.collectSharedSlices","sliceContent.compositeToShared","sliceContent.legacyToShared"],"sources":["../../src/helpers/documentContent.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { DocumentLegacyCodec } from \"../content/codec/document\"\nimport { defaultCtx } from \"../content/codec/legacyContentCtx\"\nimport type { DocumentContent } from \"../content/document\"\nimport type { DocumentLegacy } from \"../content/legacy/document\"\nimport { DocumentLegacySchema } from \"../content/legacy/document\"\nimport { isNestableContent } from \"../content/nestable\"\nimport type { CompositeSliceItemContent, LegacySliceItemContent } from \"../content/slices\"\nimport type { WidgetContent } from \"../content/widget\"\nimport type { StaticCustomTypeModel } from \"../model/customType\"\nimport type { FieldOrSliceType } from \"../model/widget\"\nimport { FieldOrSliceTypeSchema } from \"../model/widget\"\nimport * as contentPath from \"./contentPath\"\nimport * as customTypeModel from \"./customTypeModel\"\nimport * as sliceContent from \"./sliceContent\"\nimport { traverseDocumentContent } from \"./traverseContent\"\n\nexport function collectWidgets<TWidgetContent extends WidgetContent>(\n\tdocument: DocumentContent,\n\ttest: (\n\t\tcontent: WidgetContent,\n\t\targs: {\n\t\t\tpath: contentPath.Path\n\t\t\tkey: string\n\t\t\tapiID: string\n\t\t},\n\t) => content is TWidgetContent,\n): Record<string, TWidgetContent> {\n\tconst collected: Record<string, TWidgetContent> = {}\n\n\ttraverseDocumentContent(document, {\n\t\ttransformWidget: ({ content, ...args }) => {\n\t\t\tif (test(content, args)) {\n\t\t\t\tcollected[contentPath.serialize(args.path)] = content\n\t\t\t}\n\n\t\t\treturn content\n\t\t},\n\t})\n\n\treturn collected\n}\n\nexport function fromLegacy(\n\tlegacy: DocumentLegacy,\n\tmodel: StaticCustomTypeModel,\n): DocumentContent | undefined {\n\tconst parsed = DocumentLegacySchema.safeParse(legacy)\n\tif (!parsed.success) {\n\t\treturn\n\t}\n\n\tconst types = new Map<string, FieldOrSliceType>()\n\tconst keys = new Map<string, string>()\n\tconst widgets: DocumentLegacy = {}\n\tfor (const [key, value] of Object.entries(parsed.data)) {\n\t\tif (key.endsWith(\"_TYPE\")) {\n\t\t\tconst parsed = FieldOrSliceTypeSchema.safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\ttypes.set(key.substring(0, key.length - 5), parsed.data)\n\t\t\t}\n\t\t} else if (key.endsWith(\"_KEY\")) {\n\t\t\tconst parsed = z.union([z.uuidv4(), z.uuid({ version: \"v5\" })]).safeParse(value)\n\t\t\tif (parsed.success) {\n\t\t\t\tkeys.set(key.substring(0, key.length - 4), parsed.data)\n\t\t\t}\n\t\t} else if (!key.endsWith(\"_POSITION\")) {\n\t\t\twidgets[key] = value\n\t\t}\n\t}\n\n\tconst result = DocumentLegacyCodec(defaultCtx(\"\", types, keys)).toContent(widgets)\n\tif (!result.success) {\n\t\treturn\n\t}\n\n\tconst needsMigration = Object.values(customTypeModel.collectSharedSlices(model)).some((slice) =>\n\t\tBoolean(slice.legacyPaths),\n\t)\n\n\tif (needsMigration) {\n\t\treturn traverseDocumentContent(result.data, {\n\t\t\tmodel,\n\t\t\ttransformSlice: ({ content, model }) => {\n\t\t\t\tif (model?.type === \"SharedSlice\") {\n\t\t\t\t\tif (content.widget.__TYPE__ === \"CompositeSliceContent\") {\n\t\t\t\t\t\treturn sliceContent.compositeToShared(content as CompositeSliceItemContent, model)\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tcontent.widget.__TYPE__ === \"GroupContentType\" ||\n\t\t\t\t\t\tisNestableContent(content.widget)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn sliceContent.legacyToShared(content as LegacySliceItemContent, model)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn content\n\t\t\t},\n\t\t})\n\t}\n\n\treturn result.data\n}\n\nexport function toLegacy(document: DocumentContent): DocumentLegacy {\n\tconst { content, types, keys } = DocumentLegacyCodec(defaultCtx(\"\")).fromContent(document)\n\n\treturn { ...content, ...types, ...keys }\n}\n\nexport function serializeUID(input: string): string {\n\tconst nowhitespace = input.replace(/ /g, \"-\")\n\n\tconst normalized = nowhitespace.normalize(\"NFD\").replace(/\\p{M}/gu, \"\")\n\n\tconst slug = normalized.replace(/[^\\p{L}\\d_.-]/gu, \"\")\n\n\treturn slug.toLowerCase()\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,eACf,UACA,MAQiC;CACjC,MAAM,YAA4C,CAAC;CAEnD,wBAAwB,UAAU,EACjC,kBAAkB,EAAE,SAAS,GAAG,WAAW;EAC1C,IAAI,KAAK,SAAS,IAAI,GACrB,UAAUA,UAAsB,KAAK,IAAI,KAAK;EAG/C,OAAO;CACR,EACD,CAAC;CAED,OAAO;AACR;AAEA,SAAgB,WACf,QACA,OAC8B;CAC9B,MAAM,SAAS,qBAAqB,UAAU,MAAM;CACpD,IAAI,CAAC,OAAO,SACX;CAGD,MAAM,wBAAQ,IAAI,IAA8B;CAChD,MAAM,uBAAO,IAAI,IAAoB;CACrC,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,IAAI,GACpD,IAAI,IAAI,SAAS,OAAO,GAAG;EAC1B,MAAM,SAAS,uBAAuB,UAAU,KAAK;EACrD,IAAI,OAAO,SACV,MAAM,IAAI,IAAI,UAAU,GAAG,IAAI,SAAS,CAAC,GAAG,OAAO,IAAI;CAE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 import { DynamicSlicesModel, StaticSlicesModel } from "./model/slices.js";
46
46
  import { UIDModel } from "./model/uid.js";
47
47
  import { DynamicWidgetModel, FieldModelType, StaticWidgetModel } from "./model/widget.js";
48
48
  import { CustomTypeModel, DynamicCustomTypeModel, DynamicCustomTypeModelTab, StaticCustomTypeModel, StaticCustomTypeModelTab } from "./model/customType.js";
49
+ import { AddedDiff, Diff, DiffOperation, RemovedDiff, UpdatedDiff } from "./model/diff/changes.js";
50
+ import { GroupWidgetDiff, GroupWidgetWithFieldsDiff, NestableWidgetDiff, SlicePrimaryWidgetDiff } from "./model/diff/widgets.js";
51
+ import { VariationDiff, VariationDiffComparator, VariationDiffMetadata } from "./model/diff/variation.js";
52
+ import { SliceDiff, SliceDiffComparator, SliceDiffMetadata } from "./model/diff/sharedSlice.js";
49
53
  import { LegacyContentCtx, defaultCtx, getFieldCtx } from "./content/codec/legacyContentCtx.js";
50
54
  import { contentPath_d_exports } from "./helpers/contentPath.js";
51
55
  import { customTypeModel_d_exports } from "./helpers/customTypeModel.js";
@@ -58,4 +62,4 @@ import { withDefaultContent_d_exports } from "./helpers/withDefaultContent.js";
58
62
  import { imageContent_d_exports } from "./helpers/imageContent.js";
59
63
  import { TraverseSliceContentFunction, TraverseWidgetContentFunction, traverseCompositeSliceContent, traverseDocumentContent, traverseGroupContent, traverseGroupItemsContent, traverseLegacySliceContent, traverseRepeatableContent, traverseSharedSliceContent, traverseSlicesContent, traverseTableContent } from "./helpers/traverseContent.js";
60
64
  import { TraverseSliceContentWithModelFunction, TraverseWidgetContentWithModelFunction, traverseCompositeSliceContentWithModel, traverseDocumentContentWithModel, traverseGroupContentWithModel, traverseGroupItemsContentWithModel, traverseLegacySliceContentWithModel, traverseRepeatableContentWithModel, traverseSharedSliceContentWithModel, traverseSlicesContentWithModel, traverseTableContentWithModel } from "./helpers/traverseContentWithModel.js";
61
- export { type Asset, type BooleanContent, type BooleanModel, type ColorContent, type ColorModel, type CompositeSliceContent, type CompositeSliceItemContent, type CompositeSliceModel, type CustomTypeModel, type DateContent, type DateModel, type DocumentContent, type DynamicCustomTypeModel, type DynamicCustomTypeModelTab, type DynamicSliceModel, type DynamicSlicesModel, type DynamicWidgetModel, type Embed, type EmbedContent, type EmbedModel, type EmptyContent, type EmptyLinkContent, type FieldContent, type FieldModelType, type FilledLinkContent, type GeoPointContent, type GeoPointModel, type GroupContent, type GroupItemContent, type GroupModel, type HexaColorCode, type ImageContent, type ImageContentView, type ImageModel, type IntegrationFieldContent, type IntegrationFieldModel, LegacyContentCtx, type LegacySliceContent, type LegacySliceItemContent, type LegacySliceModel, type LinkContent, type LinkModel, type NestableContent, type NestableModel, type NestedGroupModel, type NonEmptyString, type NumberContent, type NumberModel, type RangeContent, type RangeModel, type RepeatableContent, type RichTextContent, type RichTextContentBlock, type RichTextContentEmbedBlock, type RichTextContentImageBlock, type RichTextContentSpan, type RichTextContentTextBlock, type RichTextModel, RichTextModelNodeType, type RichTextModelNodeTypes, RichTextNodeType, type RichTextNodeTypes, type SelectContent, type SelectModel, type SeparatorContent, type SeparatorModel, type SharedSliceContent, type SharedSliceItemContent, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceRefModel, type SharedSliceVariationContentModel, type SliceContent, type SliceContentModel, type SliceItemContent, type SliceModelType, type SlicesContent, type StaticCustomTypeModel, type StaticCustomTypeModelTab, type StaticSliceModel, type StaticSlicesModel, type StaticWidgetModel, TableCellModelNodeTypes, type TableContent, type TableModel, type TextContent, type TextModel, type TimestampContent, type TimestampModel, type TraverseSliceContentFunction, type TraverseSliceContentWithModelFunction, type TraverseWidgetContentFunction, type TraverseWidgetContentWithModelFunction, type UIDContent, type UIDModel, type WidgetContent, type WidgetKey, contentPath_d_exports as contentPath, customTypeModel_d_exports as customTypeModel, defaultCtx, documentContent_d_exports as documentContent, fieldModel_d_exports as fieldModel, getFieldCtx, imageContent_d_exports as imageContent, repository_d_exports as repository, sliceContent_d_exports as sliceContent, sliceModel_d_exports as sliceModel, traverseCompositeSliceContent, traverseCompositeSliceContentWithModel, traverseDocumentContent, traverseDocumentContentWithModel, traverseGroupContent, traverseGroupContentWithModel, traverseGroupItemsContent, traverseGroupItemsContentWithModel, traverseLegacySliceContent, traverseLegacySliceContentWithModel, traverseRepeatableContent, traverseRepeatableContentWithModel, traverseSharedSliceContent, traverseSharedSliceContentWithModel, traverseSlicesContent, traverseSlicesContentWithModel, traverseTableContent, traverseTableContentWithModel, withDefaultContent_d_exports as withDefaultContent };
65
+ export { type AddedDiff, type Asset, type BooleanContent, type BooleanModel, type ColorContent, type ColorModel, type CompositeSliceContent, type CompositeSliceItemContent, type CompositeSliceModel, type CustomTypeModel, type DateContent, type DateModel, type Diff, DiffOperation, type DocumentContent, type DynamicCustomTypeModel, type DynamicCustomTypeModelTab, type DynamicSliceModel, type DynamicSlicesModel, type DynamicWidgetModel, type Embed, type EmbedContent, type EmbedModel, type EmptyContent, type EmptyLinkContent, type FieldContent, type FieldModelType, type FilledLinkContent, type GeoPointContent, type GeoPointModel, type GroupContent, type GroupItemContent, type GroupModel, type GroupWidgetDiff, type GroupWidgetWithFieldsDiff, type HexaColorCode, type ImageContent, type ImageContentView, type ImageModel, type IntegrationFieldContent, type IntegrationFieldModel, LegacyContentCtx, type LegacySliceContent, type LegacySliceItemContent, type LegacySliceModel, type LinkContent, type LinkModel, type NestableContent, type NestableModel, type NestableWidgetDiff, type NestedGroupModel, type NonEmptyString, type NumberContent, type NumberModel, type RangeContent, type RangeModel, type RemovedDiff, type RepeatableContent, type RichTextContent, type RichTextContentBlock, type RichTextContentEmbedBlock, type RichTextContentImageBlock, type RichTextContentSpan, type RichTextContentTextBlock, type RichTextModel, RichTextModelNodeType, type RichTextModelNodeTypes, RichTextNodeType, type RichTextNodeTypes, type SelectContent, type SelectModel, type SeparatorContent, type SeparatorModel, type SharedSliceContent, type SharedSliceItemContent, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceRefModel, type SharedSliceVariationContentModel, type SliceContent, type SliceContentModel, type SliceDiff, SliceDiffComparator, type SliceDiffMetadata, type SliceItemContent, type SliceModelType, type SlicePrimaryWidgetDiff, type SlicesContent, type StaticCustomTypeModel, type StaticCustomTypeModelTab, type StaticSliceModel, type StaticSlicesModel, type StaticWidgetModel, TableCellModelNodeTypes, type TableContent, type TableModel, type TextContent, type TextModel, type TimestampContent, type TimestampModel, type TraverseSliceContentFunction, type TraverseSliceContentWithModelFunction, type TraverseWidgetContentFunction, type TraverseWidgetContentWithModelFunction, type UIDContent, type UIDModel, type UpdatedDiff, type VariationDiff, VariationDiffComparator, type VariationDiffMetadata, type WidgetContent, type WidgetKey, contentPath_d_exports as contentPath, customTypeModel_d_exports as customTypeModel, defaultCtx, documentContent_d_exports as documentContent, fieldModel_d_exports as fieldModel, getFieldCtx, imageContent_d_exports as imageContent, repository_d_exports as repository, sliceContent_d_exports as sliceContent, sliceModel_d_exports as sliceModel, traverseCompositeSliceContent, traverseCompositeSliceContentWithModel, traverseDocumentContent, traverseDocumentContentWithModel, traverseGroupContent, traverseGroupContentWithModel, traverseGroupItemsContent, traverseGroupItemsContentWithModel, traverseLegacySliceContent, traverseLegacySliceContentWithModel, traverseRepeatableContent, traverseRepeatableContentWithModel, traverseSharedSliceContent, traverseSharedSliceContentWithModel, traverseSlicesContent, traverseSlicesContentWithModel, traverseTableContent, traverseTableContentWithModel, withDefaultContent_d_exports as withDefaultContent };
package/dist/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { RichTextNodeType } from "./content/legacy/richText.js";
2
2
  import "./content/richText.js";
3
+ import { DiffOperation } from "./model/diff/changes.js";
3
4
  import { RichTextModelNodeType } from "./model/richText.js";
4
5
  import { TableCellModelNodeTypes } from "./model/table.js";
6
+ import { VariationDiffComparator } from "./model/diff/variation.js";
7
+ import { SliceDiffComparator } from "./model/diff/sharedSlice.js";
5
8
  import { LegacyContentCtx, defaultCtx, getFieldCtx } from "./content/codec/legacyContentCtx.js";
6
9
  import { contentPath_exports } from "./helpers/contentPath.js";
7
10
  import { customTypeModel_exports } from "./helpers/customTypeModel.js";
@@ -14,4 +17,4 @@ import { sliceModel_exports } from "./helpers/sliceModel.js";
14
17
  import { withDefaultContent_exports } from "./helpers/withDefaultContent.js";
15
18
  import { imageContent_exports } from "./helpers/imageContent.js";
16
19
  import { traverseCompositeSliceContentWithModel, traverseDocumentContentWithModel, traverseGroupContentWithModel, traverseGroupItemsContentWithModel, traverseLegacySliceContentWithModel, traverseRepeatableContentWithModel, traverseSharedSliceContentWithModel, traverseSlicesContentWithModel, traverseTableContentWithModel } from "./helpers/traverseContentWithModel.js";
17
- export { LegacyContentCtx, RichTextModelNodeType, RichTextNodeType, TableCellModelNodeTypes, contentPath_exports as contentPath, customTypeModel_exports as customTypeModel, defaultCtx, documentContent_exports as documentContent, fieldModel_exports as fieldModel, getFieldCtx, imageContent_exports as imageContent, repository_exports as repository, sliceContent_exports as sliceContent, sliceModel_exports as sliceModel, traverseCompositeSliceContent, traverseCompositeSliceContentWithModel, traverseDocumentContent, traverseDocumentContentWithModel, traverseGroupContent, traverseGroupContentWithModel, traverseGroupItemsContent, traverseGroupItemsContentWithModel, traverseLegacySliceContent, traverseLegacySliceContentWithModel, traverseRepeatableContent, traverseRepeatableContentWithModel, traverseSharedSliceContent, traverseSharedSliceContentWithModel, traverseSlicesContent, traverseSlicesContentWithModel, traverseTableContent, traverseTableContentWithModel, withDefaultContent_exports as withDefaultContent };
20
+ export { DiffOperation, LegacyContentCtx, RichTextModelNodeType, RichTextNodeType, SliceDiffComparator, TableCellModelNodeTypes, VariationDiffComparator, contentPath_exports as contentPath, customTypeModel_exports as customTypeModel, defaultCtx, documentContent_exports as documentContent, fieldModel_exports as fieldModel, getFieldCtx, imageContent_exports as imageContent, repository_exports as repository, sliceContent_exports as sliceContent, sliceModel_exports as sliceModel, traverseCompositeSliceContent, traverseCompositeSliceContentWithModel, traverseDocumentContent, traverseDocumentContentWithModel, traverseGroupContent, traverseGroupContentWithModel, traverseGroupItemsContent, traverseGroupItemsContentWithModel, traverseLegacySliceContent, traverseLegacySliceContentWithModel, traverseRepeatableContent, traverseRepeatableContentWithModel, traverseSharedSliceContent, traverseSharedSliceContentWithModel, traverseSlicesContent, traverseSlicesContentWithModel, traverseTableContent, traverseTableContentWithModel, withDefaultContent_exports as withDefaultContent };