@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
@@ -1,13 +1,13 @@
1
1
  import type { SharedSliceModel, SharedSliceModelVariation } from "../slice"
2
- import { type DiffChange, DiffOperation } from "./changes"
2
+ import { type Diff, DiffOperation } from "./changes"
3
3
  import { isNotEmpty, toRecord, zipObjects } from "./utils"
4
- import { type VariationDiff, VariationComparator } from "./variation"
4
+ import { type VariationDiff, VariationDiffComparator } from "./variation"
5
5
 
6
- export type SliceMetadata = Omit<SharedSliceModel, "variations">
7
- export type SliceDiff = DiffChange<
6
+ export type SliceDiffMetadata = Omit<SharedSliceModel, "variations">
7
+ export type SliceDiff = Diff<
8
8
  SharedSliceModel,
9
9
  Partial<
10
- SliceMetadata & {
10
+ SliceDiffMetadata & {
11
11
  variations?: Partial<Record<string, VariationDiff>>
12
12
  }
13
13
  >
@@ -16,7 +16,7 @@ export type SliceDiff = DiffChange<
16
16
  function compareSliceMeta(
17
17
  sliceA?: SharedSliceModel,
18
18
  sliceB?: SharedSliceModel,
19
- ): Partial<SliceMetadata> {
19
+ ): Partial<SliceDiffMetadata> {
20
20
  const zippedSlices = zipObjects(sliceA, sliceB)
21
21
 
22
22
  return Object.entries(zippedSlices).reduce((acc, [key, value]) => {
@@ -27,7 +27,7 @@ function compareSliceMeta(
27
27
  }, {})
28
28
  }
29
29
 
30
- export const SliceComparator = {
30
+ export const SliceDiffComparator = {
31
31
  compare(sliceA?: SharedSliceModel, sliceB?: SharedSliceModel): SliceDiff | undefined {
32
32
  if (!sliceA && sliceB)
33
33
  return {
@@ -51,7 +51,7 @@ export const SliceComparator = {
51
51
  >((acc, [variationId, value]) => {
52
52
  if (!value) return acc
53
53
 
54
- const vDiff = VariationComparator.compare(value.left, value.right)
54
+ const vDiff = VariationDiffComparator.compare(value.left, value.right)
55
55
  if (!vDiff) return acc
56
56
  return {
57
57
  ...acc,
@@ -2,7 +2,7 @@ import type { GroupModel } from "../group"
2
2
  import { GroupFieldType } from "../group"
3
3
  import type { NestableModel } from "../nestable"
4
4
  import type { SharedSliceModelVariation } from "../slice"
5
- import { type DiffChange, DiffOperation } from "./changes"
5
+ import { type Diff, DiffOperation } from "./changes"
6
6
  import { isNotEmpty, zipObjects } from "./utils"
7
7
  import type {
8
8
  GroupWidgetWithFieldsDiff,
@@ -10,10 +10,10 @@ import type {
10
10
  SlicePrimaryWidgetDiff,
11
11
  } from "./widgets"
12
12
 
13
- export type VariationMetadata = Omit<SharedSliceModelVariation, "primary" | "items">
14
- export type VariationDiff = DiffChange<
13
+ export type VariationDiffMetadata = Omit<SharedSliceModelVariation, "primary" | "items">
14
+ export type VariationDiff = Diff<
15
15
  SharedSliceModelVariation,
16
- Partial<VariationMetadata> & {
16
+ Partial<VariationDiffMetadata> & {
17
17
  primary?: Record<string, SlicePrimaryWidgetDiff>
18
18
  items?: Record<string, NestableWidgetDiff>
19
19
  }
@@ -22,7 +22,7 @@ export type VariationDiff = DiffChange<
22
22
  function compareVariationMeta(
23
23
  variationA?: SharedSliceModelVariation,
24
24
  variationB?: SharedSliceModelVariation,
25
- ): Partial<VariationMetadata> {
25
+ ): Partial<VariationDiffMetadata> {
26
26
  const zippedVariations = zipObjects(variationA, variationB)
27
27
 
28
28
  return Object.entries(zippedVariations).reduce((acc, [key, value]) => {
@@ -117,7 +117,7 @@ function compareWidgets<TWidget extends NestableModel | GroupModel>(
117
117
  return isNotEmpty(diffWidgets) ? diffWidgets : undefined
118
118
  }
119
119
 
120
- export const VariationComparator = {
120
+ export const VariationDiffComparator = {
121
121
  compare(
122
122
  variationA?: SharedSliceModelVariation,
123
123
  variationB?: SharedSliceModelVariation,
@@ -1,8 +1,8 @@
1
1
  import type { GroupModel } from "../group"
2
2
  import type { NestableModel } from "../nestable"
3
- import type { DiffChange } from "./changes"
3
+ import type { Diff } from "./changes"
4
4
 
5
- export type NestableWidgetDiff = DiffChange<NestableModel, NestableModel>
5
+ export type NestableWidgetDiff = Diff<NestableModel, NestableModel>
6
6
 
7
7
  export type GroupWidgetWithFieldsDiff = Omit<GroupModel, "config"> & {
8
8
  config: Omit<NonNullable<GroupModel["config"]>, "fields"> & {
@@ -10,6 +10,6 @@ export type GroupWidgetWithFieldsDiff = Omit<GroupModel, "config"> & {
10
10
  }
11
11
  }
12
12
 
13
- export type GroupWidgetDiff = DiffChange<GroupWidgetWithFieldsDiff, GroupWidgetWithFieldsDiff>
13
+ export type GroupWidgetDiff = Diff<GroupWidgetWithFieldsDiff, GroupWidgetWithFieldsDiff>
14
14
 
15
15
  export type SlicePrimaryWidgetDiff = NestableWidgetDiff | GroupWidgetDiff