@prismicio/types-internal 2.0.0-alpha.2 → 2.0.0-alpha.4

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 (141) hide show
  1. package/lib/content/LegacyContentCtx.js +1 -1
  2. package/lib/content/fields/WidgetContent.d.ts +1 -1
  3. package/lib/customtypes/widgets/Group.d.ts +164 -3
  4. package/lib/customtypes/widgets/Group.js +4 -5
  5. package/lib/customtypes/widgets/UID.d.ts +8 -3
  6. package/lib/customtypes/widgets/UID.js +4 -5
  7. package/lib/customtypes/widgets/Widget.d.ts +2 -2
  8. package/lib/customtypes/widgets/Widget.js +5 -5
  9. package/lib/customtypes/widgets/nestable/Link.d.ts +0 -1
  10. package/lib/customtypes/widgets/nestable/Link.js +0 -1
  11. package/lib/customtypes/widgets/nestable/RichText.d.ts +1 -1
  12. package/lib/customtypes/widgets/nestable/Text.d.ts +0 -1
  13. package/lib/customtypes/widgets/nestable/Text.js +0 -1
  14. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +6 -3
  15. package/lib/customtypes/widgets/slices/CompositeSlice.js +4 -5
  16. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -3
  17. package/lib/customtypes/widgets/slices/LegacySlice.js +3 -3
  18. package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +2 -3
  19. package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
  20. package/lib/customtypes/widgets/slices/Slice.d.ts +3 -3
  21. package/lib/customtypes/widgets/slices/Slices.d.ts +1 -1
  22. package/lib/customtypes/widgets/slices/Slices.js +5 -5
  23. package/lib/customtypes/widgets/slices/index.d.ts +3 -3
  24. package/lib/customtypes/widgets/slices/index.js +3 -3
  25. package/package.json +1 -1
  26. package/src/content/LegacyContentCtx.ts +2 -2
  27. package/src/content/fields/WidgetContent.ts +1 -1
  28. package/src/customtypes/widgets/Group.ts +4 -6
  29. package/src/customtypes/widgets/UID.ts +4 -6
  30. package/src/customtypes/widgets/Widget.ts +5 -5
  31. package/src/customtypes/widgets/nestable/Link.ts +0 -2
  32. package/src/customtypes/widgets/nestable/RichText.ts +1 -1
  33. package/src/customtypes/widgets/nestable/Text.ts +0 -2
  34. package/src/customtypes/widgets/slices/CompositeSlice.ts +4 -6
  35. package/src/customtypes/widgets/slices/LegacySlice.ts +3 -5
  36. package/src/customtypes/widgets/slices/SharedSliceRef.ts +2 -4
  37. package/src/customtypes/widgets/slices/Slice.ts +3 -3
  38. package/src/customtypes/widgets/slices/Slices.ts +3 -3
  39. package/src/customtypes/widgets/slices/index.ts +3 -3
  40. package/lib/content/CustomType.d.ts +0 -2972
  41. package/lib/content/CustomType.js +0 -15
  42. package/lib/content/fields/nestable/FieldContent.d.ts +0 -32
  43. package/lib/content/fields/nestable/FieldContent.js +0 -37
  44. package/lib/content/fields/nestable/Image.d.ts +0 -103
  45. package/lib/content/fields/nestable/Image.js +0 -13
  46. package/lib/content/fields/nestable/RichTextContent.d.ts +0 -376
  47. package/lib/content/fields/nestable/RichTextContent.js +0 -16
  48. package/lib/content/fields/slices/CompositeSliceContent.d.ts +0 -677
  49. package/lib/content/fields/slices/CompositeSliceContent.js +0 -14
  50. package/lib/content/fields/slices/RepeatableContent.d.ts +0 -338
  51. package/lib/content/fields/slices/RepeatableContent.js +0 -16
  52. package/lib/content/fields/slices/SharedSliceContent.d.ts +0 -678
  53. package/lib/content/fields/slices/SharedSliceContent.js +0 -15
  54. package/lib/content/fields/slices/SimpleSliceContent.d.ts +0 -675
  55. package/lib/content/fields/slices/SimpleSliceContent.js +0 -8
  56. package/lib/customtypes/Comparators/Changes.d.ts +0 -17
  57. package/lib/customtypes/Comparators/Changes.js +0 -9
  58. package/lib/customtypes/Comparators/SharedSlice.d.ts +0 -679
  59. package/lib/customtypes/Comparators/SharedSlice.js +0 -55
  60. package/lib/customtypes/Comparators/Variation.d.ts +0 -662
  61. package/lib/customtypes/Comparators/Variation.js +0 -75
  62. package/lib/customtypes/Comparators/index.d.ts +0 -3
  63. package/lib/customtypes/Comparators/index.js +0 -6
  64. package/lib/customtypes/Format.d.ts +0 -4
  65. package/lib/customtypes/Format.js +0 -8
  66. package/lib/customtypes/comp/Changes.d.ts +0 -17
  67. package/lib/customtypes/comp/Changes.js +0 -9
  68. package/lib/customtypes/comp/SharedSlice.d.ts +0 -679
  69. package/lib/customtypes/comp/SharedSlice.js +0 -55
  70. package/lib/customtypes/comp/Variation.d.ts +0 -662
  71. package/lib/customtypes/comp/Variation.js +0 -76
  72. package/lib/customtypes/comp/index.d.ts +0 -3
  73. package/lib/customtypes/comp/index.js +0 -6
  74. package/lib/customtypes/utils/Comparator.d.ts +0 -1353
  75. package/lib/customtypes/utils/Comparator.js +0 -59
  76. package/lib/customtypes/utils/index.d.ts +0 -1
  77. package/lib/customtypes/utils/index.js +0 -4
  78. package/lib/customtypes/widgets/WidgetTypes.d.ts +0 -22
  79. package/lib/customtypes/widgets/WidgetTypes.js +0 -25
  80. package/lib/documents/DocumentData.d.ts +0 -6
  81. package/lib/documents/DocumentData.js +0 -15
  82. package/lib/documents/index.d.ts +0 -2
  83. package/lib/documents/index.js +0 -7
  84. package/lib/documents/widgets/EmptyContent.d.ts +0 -8
  85. package/lib/documents/widgets/EmptyContent.js +0 -9
  86. package/lib/documents/widgets/GroupContent.d.ts +0 -16
  87. package/lib/documents/widgets/GroupContent.js +0 -60
  88. package/lib/documents/widgets/SimpleWidgetContent.d.ts +0 -20
  89. package/lib/documents/widgets/SimpleWidgetContent.js +0 -75
  90. package/lib/documents/widgets/StaticWidgetContent.d.ts +0 -10
  91. package/lib/documents/widgets/StaticWidgetContent.js +0 -26
  92. package/lib/documents/widgets/UIDContent.d.ts +0 -7
  93. package/lib/documents/widgets/UIDContent.js +0 -10
  94. package/lib/documents/widgets/index.d.ts +0 -38
  95. package/lib/documents/widgets/index.js +0 -40
  96. package/lib/documents/widgets/nestable/BooleanContent.d.ts +0 -8
  97. package/lib/documents/widgets/nestable/BooleanContent.js +0 -11
  98. package/lib/documents/widgets/nestable/EmbedContent.d.ts +0 -42
  99. package/lib/documents/widgets/nestable/EmbedContent.js +0 -35
  100. package/lib/documents/widgets/nestable/FieldContent.d.ts +0 -13
  101. package/lib/documents/widgets/nestable/FieldContent.js +0 -37
  102. package/lib/documents/widgets/nestable/GeoPointContent.d.ts +0 -17
  103. package/lib/documents/widgets/nestable/GeoPointContent.js +0 -13
  104. package/lib/documents/widgets/nestable/ImageContent.d.ts +0 -127
  105. package/lib/documents/widgets/nestable/ImageContent.js +0 -41
  106. package/lib/documents/widgets/nestable/IntegrationFieldsContent.d.ts +0 -8
  107. package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +0 -16
  108. package/lib/documents/widgets/nestable/Link/DocumentLink.d.ts +0 -12
  109. package/lib/documents/widgets/nestable/Link/DocumentLink.js +0 -13
  110. package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +0 -24
  111. package/lib/documents/widgets/nestable/Link/ExternalLink.js +0 -24
  112. package/lib/documents/widgets/nestable/Link/FileLink.d.ts +0 -22
  113. package/lib/documents/widgets/nestable/Link/FileLink.js +0 -25
  114. package/lib/documents/widgets/nestable/Link/ImageLink.d.ts +0 -28
  115. package/lib/documents/widgets/nestable/Link/ImageLink.js +0 -26
  116. package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +0 -42
  117. package/lib/documents/widgets/nestable/Link/LinkContent.js +0 -17
  118. package/lib/documents/widgets/nestable/Link/index.d.ts +0 -90
  119. package/lib/documents/widgets/nestable/Link/index.js +0 -35
  120. package/lib/documents/widgets/nestable/SeparatorContent.d.ts +0 -11
  121. package/lib/documents/widgets/nestable/SeparatorContent.js +0 -15
  122. package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +0 -314
  123. package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +0 -98
  124. package/lib/documents/widgets/nestable/StructuredTextContent/index.d.ts +0 -9
  125. package/lib/documents/widgets/nestable/StructuredTextContent/index.js +0 -14
  126. package/lib/documents/widgets/nestable/index.d.ts +0 -26
  127. package/lib/documents/widgets/nestable/index.js +0 -39
  128. package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +0 -14
  129. package/lib/documents/widgets/slices/CompositeSliceContent.js +0 -52
  130. package/lib/documents/widgets/slices/SharedSliceContent.d.ts +0 -15
  131. package/lib/documents/widgets/slices/SharedSliceContent.js +0 -63
  132. package/lib/documents/widgets/slices/SimpleSliceContent.d.ts +0 -6
  133. package/lib/documents/widgets/slices/SimpleSliceContent.js +0 -6
  134. package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +0 -8
  135. package/lib/documents/widgets/slices/SliceWidgetContent.js +0 -26
  136. package/lib/documents/widgets/slices/SlicesContent.d.ts +0 -17
  137. package/lib/documents/widgets/slices/SlicesContent.js +0 -52
  138. package/lib/documents/widgets/slices/index.d.ts +0 -5
  139. package/lib/documents/widgets/slices/index.js +0 -8
  140. package/lib/index.d.ts +0 -3
  141. package/lib/index.js +0 -7
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SliceComparator = void 0;
4
- const utils_1 = require("../../utils");
5
- const Changes_1 = require("./Changes");
6
- const Variation_1 = require("./Variation");
7
- function compareSliceMeta(sliceA, sliceB) {
8
- const zippedSlices = utils_1.Objects.zipObjects(sliceA, sliceB);
9
- return Object.entries(zippedSlices).reduce((acc, [key, value]) => {
10
- if (key === `variations`)
11
- return acc;
12
- if ((value === null || value === void 0 ? void 0 : value.left) === (value === null || value === void 0 ? void 0 : value.right))
13
- return acc;
14
- return { ...acc, [key]: value === null || value === void 0 ? void 0 : value.right };
15
- }, {});
16
- }
17
- exports.SliceComparator = {
18
- compare(sliceA, sliceB) {
19
- if (!sliceA && sliceB)
20
- return {
21
- op: Changes_1.DiffOperation.Added,
22
- value: sliceB,
23
- };
24
- if (sliceA && !sliceB)
25
- return {
26
- op: Changes_1.DiffOperation.Removed,
27
- };
28
- const diffMeta = compareSliceMeta(sliceA, sliceB);
29
- const zippedSlices = utils_1.Objects.zipObjects(sliceA && utils_1.Arrays.toRecord(sliceA.variations, (v) => v.id), sliceB && utils_1.Arrays.toRecord(sliceB.variations, (v) => v.id));
30
- const diffVariations = Object.entries(zippedSlices).reduce((acc, [variationId, value]) => {
31
- if (!value)
32
- return acc;
33
- const vDiff = Variation_1.VariationComparator.compare(value.left, value.right);
34
- if (!vDiff)
35
- return acc;
36
- return {
37
- ...acc,
38
- [variationId]: vDiff,
39
- };
40
- }, {});
41
- const diffSlice = {
42
- ...diffMeta,
43
- ...(utils_1.Objects.isNotEmpty(diffVariations)
44
- ? { variations: diffVariations }
45
- : {}),
46
- };
47
- if (utils_1.Objects.isNotEmpty(diffSlice)) {
48
- return {
49
- op: Changes_1.DiffOperation.Updated,
50
- value: diffSlice,
51
- };
52
- }
53
- return undefined;
54
- },
55
- };