@prismicio/types-internal 0.3.3 → 1.0.0
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/customtypes/CustomType.d.ts +309 -311
- package/lib/customtypes/CustomType.js +6 -6
- package/lib/customtypes/Format.d.ts +4 -0
- package/lib/customtypes/Format.js +8 -0
- package/lib/customtypes/Section.d.ts +309 -309
- package/lib/customtypes/widgets/Group.d.ts +22 -23
- package/lib/customtypes/widgets/Group.js +2 -2
- package/lib/customtypes/widgets/UID.d.ts +1 -2
- package/lib/customtypes/widgets/UID.js +2 -2
- package/lib/customtypes/widgets/Widget.d.ts +353 -354
- package/lib/customtypes/widgets/Widget.js +3 -3
- package/lib/customtypes/widgets/WidgetTypes.d.ts +22 -22
- package/lib/customtypes/widgets/WidgetTypes.js +22 -23
- package/lib/customtypes/widgets/index.d.ts +1 -1
- package/lib/customtypes/widgets/index.js +1 -1
- package/lib/customtypes/widgets/nestable/BooleanField.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/BooleanField.js +2 -2
- package/lib/customtypes/widgets/nestable/Color.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Color.js +2 -2
- package/lib/customtypes/widgets/nestable/Date.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Date.js +2 -2
- package/lib/customtypes/widgets/nestable/Embed.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Embed.js +2 -2
- package/lib/customtypes/widgets/nestable/GeoPoint.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/GeoPoint.js +2 -2
- package/lib/customtypes/widgets/nestable/Image.d.ts +2 -3
- package/lib/customtypes/widgets/nestable/Image.js +3 -3
- package/lib/customtypes/widgets/nestable/IntegrationField.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/IntegrationField.js +2 -2
- package/lib/customtypes/widgets/nestable/Link.d.ts +4 -5
- package/lib/customtypes/widgets/nestable/Link.js +3 -3
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +21 -21
- package/lib/customtypes/widgets/nestable/Number.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Number.js +2 -2
- package/lib/customtypes/widgets/nestable/Range.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Range.js +2 -2
- package/lib/customtypes/widgets/nestable/RichText.d.ts +22 -22
- package/lib/customtypes/widgets/nestable/RichText.js +38 -39
- package/lib/customtypes/widgets/nestable/Select.d.ts +2 -3
- package/lib/customtypes/widgets/nestable/Select.js +3 -3
- package/lib/customtypes/widgets/nestable/Separator.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Separator.js +2 -2
- package/lib/customtypes/widgets/nestable/Text.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Text.js +2 -2
- package/lib/customtypes/widgets/nestable/Timestamp.d.ts +1 -2
- package/lib/customtypes/widgets/nestable/Timestamp.js +2 -2
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +43 -44
- package/lib/customtypes/widgets/slices/CompositeSlice.js +2 -2
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +43 -43
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +86 -87
- package/lib/customtypes/widgets/slices/SharedSlice.js +3 -3
- package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +1 -2
- package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
- package/lib/customtypes/widgets/slices/Slices.d.ts +529 -531
- package/lib/customtypes/widgets/slices/Slices.js +6 -6
- package/lib/customtypes/widgets/slices/SlicesTypes.d.ts +5 -5
- package/lib/customtypes/widgets/slices/SlicesTypes.js +5 -6
- package/lib/customtypes/widgets/slices/index.d.ts +1 -1
- package/lib/customtypes/widgets/slices/index.js +1 -1
- package/lib/documents/widgets/index.d.ts +1 -0
- package/lib/documents/widgets/nestable/Link/index.d.ts +1 -0
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +16 -17
- package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +1 -1
- package/package.json +1 -1
- package/src/customtypes/CustomType.ts +2 -2
- package/src/customtypes/widgets/Group.ts +1 -1
- package/src/customtypes/widgets/UID.ts +1 -1
- package/src/customtypes/widgets/Widget.ts +1 -1
- package/src/customtypes/widgets/WidgetTypes.ts +22 -22
- package/src/customtypes/widgets/index.ts +1 -1
- package/src/customtypes/widgets/nestable/BooleanField.ts +1 -1
- package/src/customtypes/widgets/nestable/Color.ts +1 -1
- package/src/customtypes/widgets/nestable/Date.ts +1 -1
- package/src/customtypes/widgets/nestable/Embed.ts +1 -1
- package/src/customtypes/widgets/nestable/GeoPoint.ts +1 -1
- package/src/customtypes/widgets/nestable/Image.ts +2 -2
- package/src/customtypes/widgets/nestable/IntegrationField.ts +1 -1
- package/src/customtypes/widgets/nestable/Link.ts +4 -4
- package/src/customtypes/widgets/nestable/Number.ts +1 -1
- package/src/customtypes/widgets/nestable/Range.ts +1 -1
- package/src/customtypes/widgets/nestable/RichText.ts +37 -35
- package/src/customtypes/widgets/nestable/Select.ts +4 -2
- package/src/customtypes/widgets/nestable/Separator.ts +1 -1
- package/src/customtypes/widgets/nestable/Text.ts +1 -1
- package/src/customtypes/widgets/nestable/Timestamp.ts +1 -1
- package/src/customtypes/widgets/slices/CompositeSlice.ts +1 -1
- package/src/customtypes/widgets/slices/SharedSlice.ts +2 -2
- package/src/customtypes/widgets/slices/SharedSliceRef.ts +1 -1
- package/src/customtypes/widgets/slices/Slices.ts +3 -3
- package/src/customtypes/widgets/slices/SlicesTypes.ts +5 -5
- package/src/customtypes/widgets/slices/index.ts +1 -1
- package/src/documents/widgets/index.ts +1 -5
- package/src/documents/widgets/nestable/Link/index.ts +2 -0
- package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +1 -1
|
@@ -7,8 +7,8 @@ const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
|
7
7
|
const withFallback_1 = require("io-ts-types/lib/withFallback");
|
|
8
8
|
const validators_1 = require("../validators");
|
|
9
9
|
const Section_1 = require("./Section");
|
|
10
|
-
const SlicesTypes_1 =
|
|
11
|
-
const WidgetTypes_1 =
|
|
10
|
+
const SlicesTypes_1 = require("./widgets/slices/SlicesTypes");
|
|
11
|
+
const WidgetTypes_1 = require("./widgets/WidgetTypes");
|
|
12
12
|
class CustomTypeSlicesError extends Error {
|
|
13
13
|
constructor(slices) {
|
|
14
14
|
super();
|
|
@@ -58,12 +58,12 @@ function flattenWidgets(customType) {
|
|
|
58
58
|
}
|
|
59
59
|
exports.flattenWidgets = flattenWidgets;
|
|
60
60
|
function _retrieveSharedSlicesRef(customType) {
|
|
61
|
-
const slicezones = flattenWidgets(customType).filter(([, widget]) => widget.type === WidgetTypes_1.
|
|
61
|
+
const slicezones = flattenWidgets(customType).filter(([, widget]) => widget.type === WidgetTypes_1.WidgetTypes.Slices);
|
|
62
62
|
const allSharedRefs = slicezones.reduce((acc, [, slicezone]) => {
|
|
63
63
|
const sharedRefs = Object.entries(slicezone.config && slicezone.config.choices
|
|
64
64
|
? slicezone.config.choices
|
|
65
65
|
: {})
|
|
66
|
-
.filter(([, slice]) => slice.type === SlicesTypes_1.
|
|
66
|
+
.filter(([, slice]) => slice.type === SlicesTypes_1.SlicesTypes.SharedSlice)
|
|
67
67
|
.map(([key]) => key);
|
|
68
68
|
return acc.concat(sharedRefs);
|
|
69
69
|
}, []);
|
|
@@ -115,11 +115,11 @@ function collectWidgets(customType, f) {
|
|
|
115
115
|
exports.collectWidgets = collectWidgets;
|
|
116
116
|
function filterMissingSharedSlices(customType, sharedSlices) {
|
|
117
117
|
return collectWidgets(customType, (_widgetId, widget) => {
|
|
118
|
-
if (widget.type === WidgetTypes_1.
|
|
118
|
+
if (widget.type === WidgetTypes_1.WidgetTypes.Slices) {
|
|
119
119
|
if (!widget.config || !widget.config.choices)
|
|
120
120
|
return widget;
|
|
121
121
|
const choices = Object.entries(widget.config.choices).reduce((acc, [sliceId, sliceValue]) => {
|
|
122
|
-
if (sliceValue.type === SlicesTypes_1.
|
|
122
|
+
if (sliceValue.type === SlicesTypes_1.SlicesTypes.SharedSlice &&
|
|
123
123
|
!sharedSlices.get(sliceId))
|
|
124
124
|
return acc;
|
|
125
125
|
return { ...acc, [sliceId]: sliceValue };
|