@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.
- package/dist/content/codec/group.js +3 -2
- package/dist/content/codec/group.js.map +1 -1
- package/dist/content/codec/legacyContentCtx.d.ts.map +1 -1
- package/dist/content/codec/legacyContentCtx.js +5 -1
- package/dist/content/codec/legacyContentCtx.js.map +1 -1
- package/dist/helpers/documentContent.js +1 -1
- package/dist/helpers/documentContent.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -1
- package/dist/io-ts.d.ts +894 -894
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +16 -16
- package/dist/model/diff/changes.d.ts +21 -0
- package/dist/model/diff/changes.d.ts.map +1 -0
- package/dist/model/diff/changes.js +11 -0
- package/dist/model/diff/changes.js.map +1 -0
- package/dist/model/diff/sharedSlice.d.ts +14 -0
- package/dist/model/diff/sharedSlice.d.ts.map +1 -0
- package/dist/model/diff/sharedSlice.js +45 -0
- package/dist/model/diff/sharedSlice.js.map +1 -0
- package/dist/model/diff/utils.js +40 -0
- package/dist/model/diff/utils.js.map +1 -0
- package/dist/model/diff/variation.d.ts +15 -0
- package/dist/model/diff/variation.d.ts.map +1 -0
- package/dist/model/diff/variation.js +92 -0
- package/dist/model/diff/variation.js.map +1 -0
- package/dist/model/diff/widgets.d.ts +15 -0
- package/dist/model/diff/widgets.d.ts.map +1 -0
- package/dist/model/nestable.js +3 -3
- package/dist/zod4.js +16 -16
- package/package.json +5 -2
- package/src/content/codec/group.ts +1 -1
- package/src/content/codec/legacyContentCtx.ts +7 -1
- package/src/helpers/documentContent.ts +1 -1
- package/src/index.ts +12 -0
- package/src/model/diff/changes.ts +4 -4
- package/src/model/diff/sharedSlice.ts +8 -8
- package/src/model/diff/variation.ts +6 -6
- package/src/model/diff/widgets.ts +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { SharedSliceModel, SharedSliceModelVariation } from "../slice"
|
|
2
|
-
import { type
|
|
2
|
+
import { type Diff, DiffOperation } from "./changes"
|
|
3
3
|
import { isNotEmpty, toRecord, zipObjects } from "./utils"
|
|
4
|
-
import { type VariationDiff,
|
|
4
|
+
import { type VariationDiff, VariationDiffComparator } from "./variation"
|
|
5
5
|
|
|
6
|
-
export type
|
|
7
|
-
export type SliceDiff =
|
|
6
|
+
export type SliceDiffMetadata = Omit<SharedSliceModel, "variations">
|
|
7
|
+
export type SliceDiff = Diff<
|
|
8
8
|
SharedSliceModel,
|
|
9
9
|
Partial<
|
|
10
|
-
|
|
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<
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
14
|
-
export type VariationDiff =
|
|
13
|
+
export type VariationDiffMetadata = Omit<SharedSliceModelVariation, "primary" | "items">
|
|
14
|
+
export type VariationDiff = Diff<
|
|
15
15
|
SharedSliceModelVariation,
|
|
16
|
-
Partial<
|
|
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<
|
|
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
|
|
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 {
|
|
3
|
+
import type { Diff } from "./changes"
|
|
4
4
|
|
|
5
|
-
export type NestableWidgetDiff =
|
|
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 =
|
|
13
|
+
export type GroupWidgetDiff = Diff<GroupWidgetWithFieldsDiff, GroupWidgetWithFieldsDiff>
|
|
14
14
|
|
|
15
15
|
export type SlicePrimaryWidgetDiff = NestableWidgetDiff | GroupWidgetDiff
|