@prismicio/types-internal 2.2.0-traverse.alpha-7 → 2.2.0-traverse.alpha-9
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/lib/_internal/utils.d.ts +0 -3
- package/lib/content/Document.d.ts +96 -32
- package/lib/content/Document.js +1 -1
- package/lib/content/fields/GroupContent.d.ts +21 -7
- package/lib/content/fields/WidgetContent.d.ts +96 -32
- package/lib/content/fields/nestable/NestableContent.d.ts +12 -6
- package/lib/content/fields/nestable/NestableContent.js +1 -29
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +30 -12
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +11 -2
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +15 -5
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/CompositeSliceContent.js +15 -7
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +9 -3
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +5 -1
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +24 -8
- package/lib/content/fields/slices/Slice/SimpleSliceContent.js +1 -1
- package/lib/content/fields/slices/Slice/index.d.ts +54 -18
- package/lib/content/fields/slices/SliceItem.d.ts +54 -18
- package/lib/content/fields/slices/SlicesContent.d.ts +72 -24
- package/lib/customtypes/CustomType.d.ts +1 -1
- package/lib/customtypes/CustomType.js +3 -3
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +1 -2
- package/package.json +1 -1
- package/src/_internal/utils.ts +0 -4
- package/src/content/Document.ts +2 -2
- package/src/content/fields/nestable/NestableContent.ts +0 -32
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +15 -3
- package/src/content/fields/slices/Slice/CompositeSliceContent.ts +22 -7
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +7 -1
- package/src/content/fields/slices/Slice/SimpleSliceContent.ts +1 -1
- package/src/customtypes/CustomType.ts +1 -1
- package/src/customtypes/widgets/slices/SharedSlice.ts +2 -2
|
@@ -174,7 +174,13 @@ export function traverseSharedSliceContent({
|
|
|
174
174
|
content: fieldContent,
|
|
175
175
|
})
|
|
176
176
|
// Can happen if the transform function returns undefined to filter out a field
|
|
177
|
-
if (!transformedField
|
|
177
|
+
if (!transformedField) return acc
|
|
178
|
+
if (!isNestableContent(transformedField)) {
|
|
179
|
+
console.warn(
|
|
180
|
+
`Warn: Non nestable content with key [${fieldKey}] detected in a shared slice [${sliceName}] with key [${sliceKey}]`,
|
|
181
|
+
)
|
|
182
|
+
return acc
|
|
183
|
+
}
|
|
178
184
|
return {
|
|
179
185
|
...acc,
|
|
180
186
|
[fieldKey]: transformedField,
|
|
@@ -168,7 +168,7 @@ export function migrateSimpleSlice(
|
|
|
168
168
|
__TYPE__: "SharedSliceContent",
|
|
169
169
|
variation: model.variationId,
|
|
170
170
|
primary: model.fields.primary?.[content.name]
|
|
171
|
-
? { [content.
|
|
171
|
+
? { [content.name]: content.widget }
|
|
172
172
|
: {},
|
|
173
173
|
items: [],
|
|
174
174
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts"
|
|
2
2
|
import { withFallback } from "io-ts-types/lib/withFallback"
|
|
3
3
|
|
|
4
|
-
import type { PickOnly } from "../../../_internal/utils"
|
|
5
4
|
import { WidgetKey } from "../../../common"
|
|
6
5
|
import { NestableWidget } from "../nestable/NestableWidget"
|
|
7
6
|
import type { SharedSliceRef } from "./SharedSliceRef"
|
|
@@ -30,11 +29,12 @@ export const Variation = t.exact(
|
|
|
30
29
|
|
|
31
30
|
export type Variation = t.TypeOf<typeof Variation>
|
|
32
31
|
|
|
32
|
+
// VariationFields is used exclusively for the slices migration, LegacySlice -> SharedSlice
|
|
33
33
|
export type VariationFields = {
|
|
34
34
|
type: "SharedSlice"
|
|
35
35
|
sliceName: string
|
|
36
36
|
variationId: string
|
|
37
|
-
fields:
|
|
37
|
+
fields: Pick<Variation, "primary" | "items">
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export const SharedSliceType = "SharedSlice"
|