@prismicio/types-internal 4.0.0-pr.7.9dec8db → 4.0.0-pr.9.e09af2c
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/boolean.d.ts.map +1 -1
- package/dist/content/boolean.js.map +1 -1
- package/dist/content/field.d.ts.map +1 -1
- package/dist/content/field.js +1 -1
- package/dist/content/field.js.map +1 -1
- package/dist/content/group.d.ts.map +1 -1
- package/dist/content/group.js.map +1 -1
- package/dist/content/nestable.d.ts.map +1 -1
- package/dist/content/nestable.js.map +1 -1
- package/dist/helpers/traverseContent.d.ts +4 -4
- package/dist/helpers/traverseContent.d.ts.map +1 -1
- package/dist/helpers/traverseContent.js +4 -2
- package/dist/helpers/traverseContent.js.map +1 -1
- package/dist/helpers/traverseContentWithModel.d.ts +4 -4
- package/dist/helpers/withDefaultContent.d.ts +17 -0
- package/dist/helpers/withDefaultContent.d.ts.map +1 -0
- package/dist/helpers/withDefaultContent.js +113 -0
- package/dist/helpers/withDefaultContent.js.map +1 -0
- package/dist/index.d.ts +21 -20
- package/dist/index.js +2 -1
- package/dist/io-ts.d.ts +1067 -322
- package/dist/io-ts.d.ts.map +1 -1
- package/dist/io-ts.js +3 -2
- package/dist/io-ts.js.map +1 -1
- package/dist/model/slice.d.ts +1251 -643
- package/dist/model/slice.d.ts.map +1 -1
- package/dist/model/slice.js +4 -4
- package/dist/model/slice.js.map +1 -1
- package/dist/model/widget.d.ts +1 -3
- package/dist/model/widget.d.ts.map +1 -1
- package/dist/model/widget.js +5 -2
- package/dist/model/widget.js.map +1 -1
- package/dist/zod4.d.ts +909 -322
- package/dist/zod4.d.ts.map +1 -1
- package/dist/zod4.js +3 -2
- package/dist/zod4.js.map +1 -1
- package/package.json +1 -1
- package/src/content/boolean.ts +0 -13
- package/src/content/field.ts +0 -14
- package/src/content/group.ts +1 -54
- package/src/content/nestable.ts +1 -20
- package/src/helpers/traverseContent.ts +4 -1
- package/src/helpers/withDefaultContent.ts +173 -0
- package/src/index.ts +3 -1
- package/src/io-ts.ts +2 -0
- package/src/model/diff/sharedSlice.ts +2 -2
- package/src/model/diff/variation.ts +7 -7
- package/src/model/slice.ts +6 -8
- package/src/model/widget.ts +6 -2
- package/src/zod4.ts +2 -0
- package/src/content/withDefaultValues.ts +0 -114
package/dist/zod4.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod4.d.ts","names":[],"sources":["../src/zod4.ts"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"zod4.d.ts","names":[],"sources":["../src/zod4.ts"],"mappings":";;;;;;;;;;;;;;cAwGa,WAAA,YAAW,aAAA;MAAyB,SAAA,CAAA,aAAA;;;;;;;;;;;;;;cACpC,WAAA,YAAW,aAAA;QAAyB,SAAA,CAAA,aAAA;;;;;;;;;;;;;cACpC,mBAAA,EAAoD,SAAA,CAAjC,aAAA;AAAA,cACnB,oBAAA,EAAsD,SAAA,CAAlC,aAAA;AAAA,cACpB,eAAA,EAA4C,SAAA,CAA7B,aAAA;AAAA,cAGf,oBAAA,YAAoB,aAAA;YAAkC,SAAA,CAAA,cAAA;;;cACtD,kBAAA,YAAkB,aAAA;QAAgC,SAAA,CAAA,cAAA;;;;cAClD,iBAAA,YAAiB,aAAA;QAA+B,SAAA,CAAA,cAAA;;;;cAChD,kBAAA,YAAkB,aAAA;QAAgC,SAAA,CAAA,aAAA;;;cAClD,qBAAA,YAAqB,aAAA;;SAAmC,SAAA,CAAA,aAAA;;;;;cACxD,iBAAA,YAAiB,aAAA;YAA+B,SAAA,CAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAChD,mBAAA,YAAmB,aAAA;QAAiC,SAAA,CAAA,cAAA;;;;cACpD,kBAAA,YAAkB,aAAA;QAAgC,SAAA,CAAA,cAAA;;;;cAClD,mBAAA,Y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AAA;MAAyC,SAAA,CAAA,aAAA;;;;;;;;;;cACpE,qBAAA,YAAqB,aAAA;MAAmC,SAAA,CAAA,aAAA"}
|
package/dist/zod4.js
CHANGED
|
@@ -37,7 +37,7 @@ import { TextModelSchema as TextModelSchema$1 } from "./model/text.js";
|
|
|
37
37
|
import { TimestampModelSchema as TimestampModelSchema$1 } from "./model/timestamp.js";
|
|
38
38
|
import { NestableModelSchema as NestableModelSchema$1 } from "./model/nestable.js";
|
|
39
39
|
import { GroupModelSchema as GroupModelSchema$1, NestedGroupModelSchema as NestedGroupModelSchema$1 } from "./model/group.js";
|
|
40
|
-
import { CompositeSliceModelSchema as CompositeSliceModelSchema$1, DynamicSliceModelSchema as DynamicSliceModelSchema$1, LegacySliceModelSchema as LegacySliceModelSchema$1, SharedSliceModelSchema as SharedSliceModelSchema$1, SharedSliceRefModelSchema as SharedSliceRefModelSchema$1, SliceContentModelSchema as SliceContentModelSchema$1, StaticSliceModelSchema as StaticSliceModelSchema$1 } from "./model/slice.js";
|
|
40
|
+
import { CompositeSliceModelSchema as CompositeSliceModelSchema$1, DynamicSliceModelSchema as DynamicSliceModelSchema$1, LegacySliceModelSchema as LegacySliceModelSchema$1, SharedSliceModelSchema as SharedSliceModelSchema$1, SharedSliceModelVariationSchema as SharedSliceModelVariationSchema$1, SharedSliceRefModelSchema as SharedSliceRefModelSchema$1, SliceContentModelSchema as SliceContentModelSchema$1, StaticSliceModelSchema as StaticSliceModelSchema$1 } from "./model/slice.js";
|
|
41
41
|
import { DynamicSlicesModelSchema as DynamicSlicesModelSchema$1, StaticSlicesModelSchema as StaticSlicesModelSchema$1 } from "./model/slices.js";
|
|
42
42
|
import { UIDModelSchema as UIDModelSchema$1 } from "./model/uid.js";
|
|
43
43
|
import { DynamicWidgetModelSchema as DynamicWidgetModelSchema$1, StaticWidgetModelSchema as StaticWidgetModelSchema$1 } from "./model/widget.js";
|
|
@@ -109,6 +109,7 @@ const TimestampModelSchema = toZod4(TimestampModelSchema$1);
|
|
|
109
109
|
const UIDModelSchema = toZod4(UIDModelSchema$1);
|
|
110
110
|
const GroupModelSchema = toZod4(GroupModelSchema$1);
|
|
111
111
|
const NestedGroupModelSchema = toZod4(NestedGroupModelSchema$1);
|
|
112
|
+
const SharedSliceModelVariationSchema = toZod4(SharedSliceModelVariationSchema$1);
|
|
112
113
|
const SharedSliceRefModelSchema = toZod4(SharedSliceRefModelSchema$1);
|
|
113
114
|
const CompositeSliceModelSchema = toZod4(CompositeSliceModelSchema$1);
|
|
114
115
|
const LegacySliceModelSchema = toZod4(LegacySliceModelSchema$1);
|
|
@@ -127,6 +128,6 @@ function toZod4(type) {
|
|
|
127
128
|
return type;
|
|
128
129
|
}
|
|
129
130
|
//#endregion
|
|
130
|
-
export { AssetSchema, BooleanContentSchema, BooleanModelSchema, ColorContentSchema, ColorModelSchema, CompositeSliceContentSchema, CompositeSliceItemContentSchema, CompositeSliceModelSchema, CustomTypeModelSchema, DateContentSchema, DateModelSchema, DocumentContentSchema, DynamicSectionModelSchema, DynamicSliceModelSchema, DynamicSlicesModelSchema, DynamicWidgetModelSchema, EmbedContentSchema, EmbedModelSchema, EmbedSchema, EmptyContentSchema, FieldContentSchema, GeoPointContentSchema, GeoPointModelSchema, GroupContentSchema, GroupItemContentSchema, GroupModelSchema, HexaColorCodeSchema, ImageContentSchema, ImageModelSchema, IntegrationFieldContentSchema, IntegrationFieldModelSchema, LegacySliceContentSchema, LegacySliceItemContentSchema, LegacySliceModelSchema, LinkContentSchema, LinkModelSchema, NestableContentSchema, NestableModelSchema, NestedGroupModelSchema, NonEmptyStringSchema, NumberContentSchema, NumberModelSchema, RangeContentSchema, RangeModelSchema, RepeatableContentSchema, RichTextContentBlockSchema, RichTextContentSchema, RichTextContentSpanSchema, RichTextModelSchema, SelectContentSchema, SelectModelSchema, SeparatorContentSchema, SeparatorModelSchema, SharedSliceContentSchema, SharedSliceItemContentSchema, SharedSliceModelSchema, SharedSliceRefModelSchema, SliceContentModelSchema, SliceContentSchema, SliceItemContentSchema, SlicesContentSchema, StaticCustomTypeModelSchema, StaticSectionModelSchema, StaticSliceModelSchema, StaticSlicesModelSchema, StaticWidgetModelSchema, TableContentSchema, TableModelSchema, TextContentSchema, TextModelSchema, TimestampContentSchema, TimestampModelSchema, UIDContentSchema, UIDModelSchema, WidgetContentSchema, WidgetKeySchema };
|
|
131
|
+
export { AssetSchema, BooleanContentSchema, BooleanModelSchema, ColorContentSchema, ColorModelSchema, CompositeSliceContentSchema, CompositeSliceItemContentSchema, CompositeSliceModelSchema, CustomTypeModelSchema, DateContentSchema, DateModelSchema, DocumentContentSchema, DynamicSectionModelSchema, DynamicSliceModelSchema, DynamicSlicesModelSchema, DynamicWidgetModelSchema, EmbedContentSchema, EmbedModelSchema, EmbedSchema, EmptyContentSchema, FieldContentSchema, GeoPointContentSchema, GeoPointModelSchema, GroupContentSchema, GroupItemContentSchema, GroupModelSchema, HexaColorCodeSchema, ImageContentSchema, ImageModelSchema, IntegrationFieldContentSchema, IntegrationFieldModelSchema, LegacySliceContentSchema, LegacySliceItemContentSchema, LegacySliceModelSchema, LinkContentSchema, LinkModelSchema, NestableContentSchema, NestableModelSchema, NestedGroupModelSchema, NonEmptyStringSchema, NumberContentSchema, NumberModelSchema, RangeContentSchema, RangeModelSchema, RepeatableContentSchema, RichTextContentBlockSchema, RichTextContentSchema, RichTextContentSpanSchema, RichTextModelSchema, SelectContentSchema, SelectModelSchema, SeparatorContentSchema, SeparatorModelSchema, SharedSliceContentSchema, SharedSliceItemContentSchema, SharedSliceModelSchema, SharedSliceModelVariationSchema, SharedSliceRefModelSchema, SliceContentModelSchema, SliceContentSchema, SliceItemContentSchema, SlicesContentSchema, StaticCustomTypeModelSchema, StaticSectionModelSchema, StaticSliceModelSchema, StaticSlicesModelSchema, StaticWidgetModelSchema, TableContentSchema, TableModelSchema, TextContentSchema, TextModelSchema, TimestampContentSchema, TimestampModelSchema, UIDContentSchema, UIDModelSchema, WidgetContentSchema, WidgetKeySchema };
|
|
131
132
|
|
|
132
133
|
//# sourceMappingURL=zod4.js.map
|
package/dist/zod4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod4.js","names":["rawAssetSchema","rawEmbedSchema","rawHexaColorCodeSchema","rawNonEmptyStringSchema","rawWidgetKeySchema","rawBooleanContentSchema","rawColorContentSchema","rawDateContentSchema","rawEmptyContentSchema","rawGeoPointContentSchema","rawLinkContentSchema","rawNumberContentSchema","rawRangeContentSchema","rawSelectContentSchema","rawSeparatorContentSchema","rawSharedSliceContentSchema","rawTextContentSchema","rawTimestampContentSchema","rawFieldContentSchema","rawUIDContentSchema","rawIntegrationFieldContentSchema","rawEmbedContentSchema","rawImageContentSchema","rawRichTextContentSchema","rawRichTextContentBlockSchema","rawRichTextContentSpanSchema","rawTableContentSchema","rawRepeatableContentSchema","rawNestableContentSchema","rawGroupContentSchema","rawGroupItemContentSchema","rawCompositeSliceContentSchema","rawLegacySliceContentSchema","rawSliceContentSchema","rawLegacySliceItemContentSchema","rawCompositeSliceItemContentSchema","rawSharedSliceItemContentSchema","rawSliceItemContentSchema","rawSlicesContentSchema","rawWidgetContentSchema","rawDocumentContentSchema","rawBooleanModelSchema","rawColorModelSchema","rawDateModelSchema","rawEmbedModelSchema","rawGeoPointModelSchema","rawImageModelSchema","rawIntegrationFieldModelSchema","rawLinkModelSchema","rawNestableModelSchema","rawNumberModelSchema","rawRangeModelSchema","rawRichTextModelSchema","rawSelectModelSchema","rawSeparatorModelSchema","rawSharedSliceModelSchema","rawTableModelSchema","rawTextModelSchema","rawTimestampModelSchema","rawUIDModelSchema","rawGroupModelSchema","rawNestedGroupModelSchema","rawSharedSliceRefModelSchema","rawCompositeSliceModelSchema","rawLegacySliceModelSchema","rawDynamicSliceModelSchema","rawStaticSliceModelSchema","rawSliceContentModelSchema","rawDynamicSlicesModelSchema","rawStaticSlicesModelSchema","rawStaticWidgetModelSchema","rawDynamicWidgetModelSchema","rawStaticSectionModelSchema","rawDynamicSectionModelSchema","rawStaticCustomTypeModelSchema","rawCustomTypeModelSchema"],"sources":["../src/zod4.ts"],"sourcesContent":["// Common\nimport { AssetSchema as rawAssetSchema } from \"./common/asset\"\nimport { EmbedSchema as rawEmbedSchema } from \"./common/embed\"\nimport { HexaColorCodeSchema as rawHexaColorCodeSchema } from \"./common/hexaColorCode\"\nimport { NonEmptyStringSchema as rawNonEmptyStringSchema } from \"./common/nonEmptyString\"\nimport { WidgetKeySchema as rawWidgetKeySchema } from \"./common/widgetKey\"\n// Content\nimport { BooleanContentSchema as rawBooleanContentSchema } from \"./content/boolean\"\nimport { DocumentContentSchema as rawDocumentContentSchema } from \"./content/document\"\nimport { EmbedContentSchema as rawEmbedContentSchema } from \"./content/embed\"\nimport { EmptyContentSchema as rawEmptyContentSchema } from \"./content/empty\"\nimport {\n\tColorContentSchema as rawColorContentSchema,\n\tDateContentSchema as rawDateContentSchema,\n\tNumberContentSchema as rawNumberContentSchema,\n\tRangeContentSchema as rawRangeContentSchema,\n\tSelectContentSchema as rawSelectContentSchema,\n\tTextContentSchema as rawTextContentSchema,\n\tTimestampContentSchema as rawTimestampContentSchema,\n\tFieldContentSchema as rawFieldContentSchema,\n} from \"./content/field\"\nimport { GeoPointContentSchema as rawGeoPointContentSchema } from \"./content/geopoint\"\nimport {\n\tGroupContentSchema as rawGroupContentSchema,\n\tGroupItemContentSchema as rawGroupItemContentSchema,\n} from \"./content/group\"\nimport { ImageContentSchema as rawImageContentSchema } from \"./content/image\"\nimport { IntegrationFieldContentSchema as rawIntegrationFieldContentSchema } from \"./content/integrationField\"\nimport { LinkContentSchema as rawLinkContentSchema } from \"./content/link\"\nimport { NestableContentSchema as rawNestableContentSchema } from \"./content/nestable\"\nimport { RepeatableContentSchema as rawRepeatableContentSchema } from \"./content/repeatable\"\nimport {\n\tRichTextContentSchema as rawRichTextContentSchema,\n\tRichTextContentBlockSchema as rawRichTextContentBlockSchema,\n\tRichTextContentSpanSchema as rawRichTextContentSpanSchema,\n} from \"./content/richText\"\nimport { SeparatorContentSchema as rawSeparatorContentSchema } from \"./content/separator\"\nimport {\n\tCompositeSliceContentSchema as rawCompositeSliceContentSchema,\n\tLegacySliceContentSchema as rawLegacySliceContentSchema,\n\tSharedSliceContentSchema as rawSharedSliceContentSchema,\n\tSliceContentSchema as rawSliceContentSchema,\n} from \"./content/slice\"\nimport {\n\tLegacySliceItemContentSchema as rawLegacySliceItemContentSchema,\n\tCompositeSliceItemContentSchema as rawCompositeSliceItemContentSchema,\n\tSharedSliceItemContentSchema as rawSharedSliceItemContentSchema,\n\tSliceItemContentSchema as rawSliceItemContentSchema,\n\tSlicesContentSchema as rawSlicesContentSchema,\n} from \"./content/slices\"\nimport { TableContentSchema as rawTableContentSchema } from \"./content/table\"\nimport { UIDContentSchema as rawUIDContentSchema } from \"./content/uid\"\nimport { WidgetContentSchema as rawWidgetContentSchema } from \"./content/widget\"\n// Model\nimport { BooleanModelSchema as rawBooleanModelSchema } from \"./model/boolean\"\nimport { ColorModelSchema as rawColorModelSchema } from \"./model/color\"\nimport {\n\tStaticCustomTypeModelSchema as rawStaticCustomTypeModelSchema,\n\tCustomTypeModelSchema as rawCustomTypeModelSchema,\n} from \"./model/customType\"\nimport { DateModelSchema as rawDateModelSchema } from \"./model/date\"\nimport { EmbedModelSchema as rawEmbedModelSchema } from \"./model/embed\"\nimport { GeoPointModelSchema as rawGeoPointModelSchema } from \"./model/geopoint\"\nimport {\n\tGroupModelSchema as rawGroupModelSchema,\n\tNestedGroupModelSchema as rawNestedGroupModelSchema,\n} from \"./model/group\"\nimport { ImageModelSchema as rawImageModelSchema } from \"./model/image\"\nimport { IntegrationFieldModelSchema as rawIntegrationFieldModelSchema } from \"./model/integrationField\"\nimport { LinkModelSchema as rawLinkModelSchema } from \"./model/link\"\nimport { NestableModelSchema as rawNestableModelSchema } from \"./model/nestable\"\nimport { NumberModelSchema as rawNumberModelSchema } from \"./model/number\"\nimport { RangeModelSchema as rawRangeModelSchema } from \"./model/range\"\nimport { RichTextModelSchema as rawRichTextModelSchema } from \"./model/richText\"\nimport {\n\tStaticSectionModelSchema as rawStaticSectionModelSchema,\n\tDynamicSectionModelSchema as rawDynamicSectionModelSchema,\n} from \"./model/section\"\nimport { SelectModelSchema as rawSelectModelSchema } from \"./model/select\"\nimport { SeparatorModelSchema as rawSeparatorModelSchema } from \"./model/separator\"\nimport {\n\tLegacySliceModelSchema as rawLegacySliceModelSchema,\n\tCompositeSliceModelSchema as rawCompositeSliceModelSchema,\n\tSharedSliceModelSchema as rawSharedSliceModelSchema,\n\tSharedSliceRefModelSchema as rawSharedSliceRefModelSchema,\n\tStaticSliceModelSchema as rawStaticSliceModelSchema,\n\tDynamicSliceModelSchema as rawDynamicSliceModelSchema,\n\tSliceContentModelSchema as rawSliceContentModelSchema,\n} from \"./model/slice\"\nimport {\n\tDynamicSlicesModelSchema as rawDynamicSlicesModelSchema,\n\tStaticSlicesModelSchema as rawStaticSlicesModelSchema,\n} from \"./model/slices\"\nimport { TableModelSchema as rawTableModelSchema } from \"./model/table\"\nimport { TextModelSchema as rawTextModelSchema } from \"./model/text\"\nimport { TimestampModelSchema as rawTimestampModelSchema } from \"./model/timestamp\"\nimport { UIDModelSchema as rawUIDModelSchema } from \"./model/uid\"\nimport {\n\tStaticWidgetModelSchema as rawStaticWidgetModelSchema,\n\tDynamicWidgetModelSchema as rawDynamicWidgetModelSchema,\n} from \"./model/widget\"\n\n// Common\nexport const AssetSchema = toZod4(rawAssetSchema)\nexport const EmbedSchema = toZod4(rawEmbedSchema)\nexport const HexaColorCodeSchema = toZod4(rawHexaColorCodeSchema)\nexport const NonEmptyStringSchema = toZod4(rawNonEmptyStringSchema)\nexport const WidgetKeySchema = toZod4(rawWidgetKeySchema)\n\n// Content\nexport const BooleanContentSchema = toZod4(rawBooleanContentSchema)\nexport const ColorContentSchema = toZod4(rawColorContentSchema)\nexport const DateContentSchema = toZod4(rawDateContentSchema)\nexport const EmptyContentSchema = toZod4(rawEmptyContentSchema)\nexport const GeoPointContentSchema = toZod4(rawGeoPointContentSchema)\nexport const LinkContentSchema = toZod4(rawLinkContentSchema)\nexport const NumberContentSchema = toZod4(rawNumberContentSchema)\nexport const RangeContentSchema = toZod4(rawRangeContentSchema)\nexport const SelectContentSchema = toZod4(rawSelectContentSchema)\nexport const SeparatorContentSchema = toZod4(rawSeparatorContentSchema)\nexport const SharedSliceContentSchema = toZod4(rawSharedSliceContentSchema)\nexport const TextContentSchema = toZod4(rawTextContentSchema)\nexport const TimestampContentSchema = toZod4(rawTimestampContentSchema)\nexport const FieldContentSchema = toZod4(rawFieldContentSchema)\nexport const UIDContentSchema = toZod4(rawUIDContentSchema)\nexport const IntegrationFieldContentSchema = toZod4(rawIntegrationFieldContentSchema)\nexport const EmbedContentSchema = toZod4(rawEmbedContentSchema)\nexport const ImageContentSchema = toZod4(rawImageContentSchema)\nexport const RichTextContentSchema = toZod4(rawRichTextContentSchema)\nexport const RichTextContentBlockSchema = toZod4(rawRichTextContentBlockSchema)\nexport const RichTextContentSpanSchema = toZod4(rawRichTextContentSpanSchema)\nexport const TableContentSchema = toZod4(rawTableContentSchema)\nexport const RepeatableContentSchema = toZod4(rawRepeatableContentSchema)\nexport const NestableContentSchema = toZod4(rawNestableContentSchema)\nexport const GroupContentSchema = toZod4(rawGroupContentSchema)\nexport const GroupItemContentSchema = toZod4(rawGroupItemContentSchema)\nexport const CompositeSliceContentSchema = toZod4(rawCompositeSliceContentSchema)\nexport const LegacySliceContentSchema = toZod4(rawLegacySliceContentSchema)\nexport const SliceContentSchema = toZod4(rawSliceContentSchema)\nexport const LegacySliceItemContentSchema = toZod4(rawLegacySliceItemContentSchema)\nexport const CompositeSliceItemContentSchema = toZod4(rawCompositeSliceItemContentSchema)\nexport const SharedSliceItemContentSchema = toZod4(rawSharedSliceItemContentSchema)\nexport const SliceItemContentSchema = toZod4(rawSliceItemContentSchema)\nexport const SlicesContentSchema = toZod4(rawSlicesContentSchema)\nexport const WidgetContentSchema = toZod4(rawWidgetContentSchema)\nexport const DocumentContentSchema = toZod4(rawDocumentContentSchema)\n\n// Model\nexport const BooleanModelSchema = toZod4(rawBooleanModelSchema)\nexport const ColorModelSchema = toZod4(rawColorModelSchema)\nexport const DateModelSchema = toZod4(rawDateModelSchema)\nexport const EmbedModelSchema = toZod4(rawEmbedModelSchema)\nexport const GeoPointModelSchema = toZod4(rawGeoPointModelSchema)\nexport const ImageModelSchema = toZod4(rawImageModelSchema)\nexport const IntegrationFieldModelSchema = toZod4(rawIntegrationFieldModelSchema)\nexport const LinkModelSchema = toZod4(rawLinkModelSchema)\nexport const NestableModelSchema = toZod4(rawNestableModelSchema)\nexport const NumberModelSchema = toZod4(rawNumberModelSchema)\nexport const RangeModelSchema = toZod4(rawRangeModelSchema)\nexport const RichTextModelSchema = toZod4(rawRichTextModelSchema)\nexport const SelectModelSchema = toZod4(rawSelectModelSchema)\nexport const SeparatorModelSchema = toZod4(rawSeparatorModelSchema)\nexport const SharedSliceModelSchema = toZod4(rawSharedSliceModelSchema)\nexport const TableModelSchema = toZod4(rawTableModelSchema)\nexport const TextModelSchema = toZod4(rawTextModelSchema)\nexport const TimestampModelSchema = toZod4(rawTimestampModelSchema)\nexport const UIDModelSchema = toZod4(rawUIDModelSchema)\nexport const GroupModelSchema = toZod4(rawGroupModelSchema)\nexport const NestedGroupModelSchema = toZod4(rawNestedGroupModelSchema)\nexport const SharedSliceRefModelSchema = toZod4(rawSharedSliceRefModelSchema)\nexport const CompositeSliceModelSchema = toZod4(rawCompositeSliceModelSchema)\nexport const LegacySliceModelSchema = toZod4(rawLegacySliceModelSchema)\nexport const DynamicSliceModelSchema = toZod4(rawDynamicSliceModelSchema)\nexport const StaticSliceModelSchema = toZod4(rawStaticSliceModelSchema)\nexport const SliceContentModelSchema = toZod4(rawSliceContentModelSchema)\nexport const DynamicSlicesModelSchema = toZod4(rawDynamicSlicesModelSchema)\nexport const StaticSlicesModelSchema = toZod4(rawStaticSlicesModelSchema)\nexport const StaticWidgetModelSchema = toZod4(rawStaticWidgetModelSchema)\nexport const DynamicWidgetModelSchema = toZod4(rawDynamicWidgetModelSchema)\nexport const StaticSectionModelSchema = toZod4(rawStaticSectionModelSchema)\nexport const DynamicSectionModelSchema = toZod4(rawDynamicSectionModelSchema)\nexport const StaticCustomTypeModelSchema = toZod4(rawStaticCustomTypeModelSchema)\nexport const CustomTypeModelSchema = toZod4(rawCustomTypeModelSchema)\n\nfunction toZod4<T>(type: T): T {\n\treturn type\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuGA,MAAa,cAAc,OAAOA,cAAe;AACjD,MAAa,cAAc,OAAOC,cAAe;AACjD,MAAa,sBAAsB,OAAOC,sBAAuB;AACjE,MAAa,uBAAuB,OAAOC,uBAAwB;AACnE,MAAa,kBAAkB,OAAOC,kBAAmB;AAGzD,MAAa,uBAAuB,OAAOC,uBAAwB;AACnE,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,oBAAoB,OAAOC,oBAAqB;AAC7D,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,wBAAwB,OAAOC,wBAAyB;AACrE,MAAa,oBAAoB,OAAOC,oBAAqB;AAC7D,MAAa,sBAAsB,OAAOC,sBAAuB;AACjE,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,sBAAsB,OAAOC,sBAAuB;AACjE,MAAa,yBAAyB,OAAOC,yBAA0B;AACvE,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,oBAAoB,OAAOC,oBAAqB;AAC7D,MAAa,yBAAyB,OAAOC,yBAA0B;AACvE,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,mBAAmB,OAAOC,mBAAoB;AAC3D,MAAa,gCAAgC,OAAOC,gCAAiC;AACrF,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,qBAAqB,OAAOC,qBAAsB;AAC/D,MAAa,wBAAwB,OAAOC,wBAAyB;AACrE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kBAAmB;AACzD,MAAa,uBAAuB,OAAOC,uBAAwB;AACnE,MAAa,iBAAiB,OAAOC,iBAAkB;AACvD,MAAa,mBAAmB,OAAOC,mBAAoB;AAC3D,MAAa,yBAAyB,OAAOC,yBAA0B;AACvE,MAAa,4BAA4B,OAAOC,4BAA6B;AAC7E,MAAa,4BAA4B,OAAOC,4BAA6B;AAC7E,MAAa,yBAAyB,OAAOC,yBAA0B;AACvE,MAAa,0BAA0B,OAAOC,0BAA2B;AACzE,MAAa,yBAAyB,OAAOC,yBAA0B;AACvE,MAAa,0BAA0B,OAAOC,0BAA2B;AACzE,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,0BAA0B,OAAOC,0BAA2B;AACzE,MAAa,0BAA0B,OAAOC,0BAA2B;AACzE,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,4BAA4B,OAAOC,4BAA6B;AAC7E,MAAa,8BAA8B,OAAOC,8BAA+B;AACjF,MAAa,wBAAwB,OAAOC,wBAAyB;AAErE,SAAS,OAAU,MAAY;AAC9B,QAAO"}
|
|
1
|
+
{"version":3,"file":"zod4.js","names":["rawAssetSchema","rawEmbedSchema","rawHexaColorCodeSchema","rawNonEmptyStringSchema","rawWidgetKeySchema","rawBooleanContentSchema","rawColorContentSchema","rawDateContentSchema","rawEmptyContentSchema","rawGeoPointContentSchema","rawLinkContentSchema","rawNumberContentSchema","rawRangeContentSchema","rawSelectContentSchema","rawSeparatorContentSchema","rawSharedSliceContentSchema","rawTextContentSchema","rawTimestampContentSchema","rawFieldContentSchema","rawUIDContentSchema","rawIntegrationFieldContentSchema","rawEmbedContentSchema","rawImageContentSchema","rawRichTextContentSchema","rawRichTextContentBlockSchema","rawRichTextContentSpanSchema","rawTableContentSchema","rawRepeatableContentSchema","rawNestableContentSchema","rawGroupContentSchema","rawGroupItemContentSchema","rawCompositeSliceContentSchema","rawLegacySliceContentSchema","rawSliceContentSchema","rawLegacySliceItemContentSchema","rawCompositeSliceItemContentSchema","rawSharedSliceItemContentSchema","rawSliceItemContentSchema","rawSlicesContentSchema","rawWidgetContentSchema","rawDocumentContentSchema","rawBooleanModelSchema","rawColorModelSchema","rawDateModelSchema","rawEmbedModelSchema","rawGeoPointModelSchema","rawImageModelSchema","rawIntegrationFieldModelSchema","rawLinkModelSchema","rawNestableModelSchema","rawNumberModelSchema","rawRangeModelSchema","rawRichTextModelSchema","rawSelectModelSchema","rawSeparatorModelSchema","rawSharedSliceModelSchema","rawTableModelSchema","rawTextModelSchema","rawTimestampModelSchema","rawUIDModelSchema","rawGroupModelSchema","rawNestedGroupModelSchema","rawSharedSliceModelVariationSchema","rawSharedSliceRefModelSchema","rawCompositeSliceModelSchema","rawLegacySliceModelSchema","rawDynamicSliceModelSchema","rawStaticSliceModelSchema","rawSliceContentModelSchema","rawDynamicSlicesModelSchema","rawStaticSlicesModelSchema","rawStaticWidgetModelSchema","rawDynamicWidgetModelSchema","rawStaticSectionModelSchema","rawDynamicSectionModelSchema","rawStaticCustomTypeModelSchema","rawCustomTypeModelSchema"],"sources":["../src/zod4.ts"],"sourcesContent":["// Common\nimport { AssetSchema as rawAssetSchema } from \"./common/asset\"\nimport { EmbedSchema as rawEmbedSchema } from \"./common/embed\"\nimport { HexaColorCodeSchema as rawHexaColorCodeSchema } from \"./common/hexaColorCode\"\nimport { NonEmptyStringSchema as rawNonEmptyStringSchema } from \"./common/nonEmptyString\"\nimport { WidgetKeySchema as rawWidgetKeySchema } from \"./common/widgetKey\"\n// Content\nimport { BooleanContentSchema as rawBooleanContentSchema } from \"./content/boolean\"\nimport { DocumentContentSchema as rawDocumentContentSchema } from \"./content/document\"\nimport { EmbedContentSchema as rawEmbedContentSchema } from \"./content/embed\"\nimport { EmptyContentSchema as rawEmptyContentSchema } from \"./content/empty\"\nimport {\n\tColorContentSchema as rawColorContentSchema,\n\tDateContentSchema as rawDateContentSchema,\n\tNumberContentSchema as rawNumberContentSchema,\n\tRangeContentSchema as rawRangeContentSchema,\n\tSelectContentSchema as rawSelectContentSchema,\n\tTextContentSchema as rawTextContentSchema,\n\tTimestampContentSchema as rawTimestampContentSchema,\n\tFieldContentSchema as rawFieldContentSchema,\n} from \"./content/field\"\nimport { GeoPointContentSchema as rawGeoPointContentSchema } from \"./content/geopoint\"\nimport {\n\tGroupContentSchema as rawGroupContentSchema,\n\tGroupItemContentSchema as rawGroupItemContentSchema,\n} from \"./content/group\"\nimport { ImageContentSchema as rawImageContentSchema } from \"./content/image\"\nimport { IntegrationFieldContentSchema as rawIntegrationFieldContentSchema } from \"./content/integrationField\"\nimport { LinkContentSchema as rawLinkContentSchema } from \"./content/link\"\nimport { NestableContentSchema as rawNestableContentSchema } from \"./content/nestable\"\nimport { RepeatableContentSchema as rawRepeatableContentSchema } from \"./content/repeatable\"\nimport {\n\tRichTextContentSchema as rawRichTextContentSchema,\n\tRichTextContentBlockSchema as rawRichTextContentBlockSchema,\n\tRichTextContentSpanSchema as rawRichTextContentSpanSchema,\n} from \"./content/richText\"\nimport { SeparatorContentSchema as rawSeparatorContentSchema } from \"./content/separator\"\nimport {\n\tCompositeSliceContentSchema as rawCompositeSliceContentSchema,\n\tLegacySliceContentSchema as rawLegacySliceContentSchema,\n\tSharedSliceContentSchema as rawSharedSliceContentSchema,\n\tSliceContentSchema as rawSliceContentSchema,\n} from \"./content/slice\"\nimport {\n\tLegacySliceItemContentSchema as rawLegacySliceItemContentSchema,\n\tCompositeSliceItemContentSchema as rawCompositeSliceItemContentSchema,\n\tSharedSliceItemContentSchema as rawSharedSliceItemContentSchema,\n\tSliceItemContentSchema as rawSliceItemContentSchema,\n\tSlicesContentSchema as rawSlicesContentSchema,\n} from \"./content/slices\"\nimport { TableContentSchema as rawTableContentSchema } from \"./content/table\"\nimport { UIDContentSchema as rawUIDContentSchema } from \"./content/uid\"\nimport { WidgetContentSchema as rawWidgetContentSchema } from \"./content/widget\"\n// Model\nimport { BooleanModelSchema as rawBooleanModelSchema } from \"./model/boolean\"\nimport { ColorModelSchema as rawColorModelSchema } from \"./model/color\"\nimport {\n\tStaticCustomTypeModelSchema as rawStaticCustomTypeModelSchema,\n\tCustomTypeModelSchema as rawCustomTypeModelSchema,\n} from \"./model/customType\"\nimport { DateModelSchema as rawDateModelSchema } from \"./model/date\"\nimport { EmbedModelSchema as rawEmbedModelSchema } from \"./model/embed\"\nimport { GeoPointModelSchema as rawGeoPointModelSchema } from \"./model/geopoint\"\nimport {\n\tGroupModelSchema as rawGroupModelSchema,\n\tNestedGroupModelSchema as rawNestedGroupModelSchema,\n} from \"./model/group\"\nimport { ImageModelSchema as rawImageModelSchema } from \"./model/image\"\nimport { IntegrationFieldModelSchema as rawIntegrationFieldModelSchema } from \"./model/integrationField\"\nimport { LinkModelSchema as rawLinkModelSchema } from \"./model/link\"\nimport { NestableModelSchema as rawNestableModelSchema } from \"./model/nestable\"\nimport { NumberModelSchema as rawNumberModelSchema } from \"./model/number\"\nimport { RangeModelSchema as rawRangeModelSchema } from \"./model/range\"\nimport { RichTextModelSchema as rawRichTextModelSchema } from \"./model/richText\"\nimport {\n\tStaticSectionModelSchema as rawStaticSectionModelSchema,\n\tDynamicSectionModelSchema as rawDynamicSectionModelSchema,\n} from \"./model/section\"\nimport { SelectModelSchema as rawSelectModelSchema } from \"./model/select\"\nimport { SeparatorModelSchema as rawSeparatorModelSchema } from \"./model/separator\"\nimport {\n\tLegacySliceModelSchema as rawLegacySliceModelSchema,\n\tCompositeSliceModelSchema as rawCompositeSliceModelSchema,\n\tSharedSliceModelSchema as rawSharedSliceModelSchema,\n\tSharedSliceModelVariationSchema as rawSharedSliceModelVariationSchema,\n\tSharedSliceRefModelSchema as rawSharedSliceRefModelSchema,\n\tStaticSliceModelSchema as rawStaticSliceModelSchema,\n\tDynamicSliceModelSchema as rawDynamicSliceModelSchema,\n\tSliceContentModelSchema as rawSliceContentModelSchema,\n} from \"./model/slice\"\nimport {\n\tDynamicSlicesModelSchema as rawDynamicSlicesModelSchema,\n\tStaticSlicesModelSchema as rawStaticSlicesModelSchema,\n} from \"./model/slices\"\nimport { TableModelSchema as rawTableModelSchema } from \"./model/table\"\nimport { TextModelSchema as rawTextModelSchema } from \"./model/text\"\nimport { TimestampModelSchema as rawTimestampModelSchema } from \"./model/timestamp\"\nimport { UIDModelSchema as rawUIDModelSchema } from \"./model/uid\"\nimport {\n\tStaticWidgetModelSchema as rawStaticWidgetModelSchema,\n\tDynamicWidgetModelSchema as rawDynamicWidgetModelSchema,\n} from \"./model/widget\"\n\n// Common\nexport const AssetSchema = toZod4(rawAssetSchema)\nexport const EmbedSchema = toZod4(rawEmbedSchema)\nexport const HexaColorCodeSchema = toZod4(rawHexaColorCodeSchema)\nexport const NonEmptyStringSchema = toZod4(rawNonEmptyStringSchema)\nexport const WidgetKeySchema = toZod4(rawWidgetKeySchema)\n\n// Content\nexport const BooleanContentSchema = toZod4(rawBooleanContentSchema)\nexport const ColorContentSchema = toZod4(rawColorContentSchema)\nexport const DateContentSchema = toZod4(rawDateContentSchema)\nexport const EmptyContentSchema = toZod4(rawEmptyContentSchema)\nexport const GeoPointContentSchema = toZod4(rawGeoPointContentSchema)\nexport const LinkContentSchema = toZod4(rawLinkContentSchema)\nexport const NumberContentSchema = toZod4(rawNumberContentSchema)\nexport const RangeContentSchema = toZod4(rawRangeContentSchema)\nexport const SelectContentSchema = toZod4(rawSelectContentSchema)\nexport const SeparatorContentSchema = toZod4(rawSeparatorContentSchema)\nexport const SharedSliceContentSchema = toZod4(rawSharedSliceContentSchema)\nexport const TextContentSchema = toZod4(rawTextContentSchema)\nexport const TimestampContentSchema = toZod4(rawTimestampContentSchema)\nexport const FieldContentSchema = toZod4(rawFieldContentSchema)\nexport const UIDContentSchema = toZod4(rawUIDContentSchema)\nexport const IntegrationFieldContentSchema = toZod4(rawIntegrationFieldContentSchema)\nexport const EmbedContentSchema = toZod4(rawEmbedContentSchema)\nexport const ImageContentSchema = toZod4(rawImageContentSchema)\nexport const RichTextContentSchema = toZod4(rawRichTextContentSchema)\nexport const RichTextContentBlockSchema = toZod4(rawRichTextContentBlockSchema)\nexport const RichTextContentSpanSchema = toZod4(rawRichTextContentSpanSchema)\nexport const TableContentSchema = toZod4(rawTableContentSchema)\nexport const RepeatableContentSchema = toZod4(rawRepeatableContentSchema)\nexport const NestableContentSchema = toZod4(rawNestableContentSchema)\nexport const GroupContentSchema = toZod4(rawGroupContentSchema)\nexport const GroupItemContentSchema = toZod4(rawGroupItemContentSchema)\nexport const CompositeSliceContentSchema = toZod4(rawCompositeSliceContentSchema)\nexport const LegacySliceContentSchema = toZod4(rawLegacySliceContentSchema)\nexport const SliceContentSchema = toZod4(rawSliceContentSchema)\nexport const LegacySliceItemContentSchema = toZod4(rawLegacySliceItemContentSchema)\nexport const CompositeSliceItemContentSchema = toZod4(rawCompositeSliceItemContentSchema)\nexport const SharedSliceItemContentSchema = toZod4(rawSharedSliceItemContentSchema)\nexport const SliceItemContentSchema = toZod4(rawSliceItemContentSchema)\nexport const SlicesContentSchema = toZod4(rawSlicesContentSchema)\nexport const WidgetContentSchema = toZod4(rawWidgetContentSchema)\nexport const DocumentContentSchema = toZod4(rawDocumentContentSchema)\n\n// Model\nexport const BooleanModelSchema = toZod4(rawBooleanModelSchema)\nexport const ColorModelSchema = toZod4(rawColorModelSchema)\nexport const DateModelSchema = toZod4(rawDateModelSchema)\nexport const EmbedModelSchema = toZod4(rawEmbedModelSchema)\nexport const GeoPointModelSchema = toZod4(rawGeoPointModelSchema)\nexport const ImageModelSchema = toZod4(rawImageModelSchema)\nexport const IntegrationFieldModelSchema = toZod4(rawIntegrationFieldModelSchema)\nexport const LinkModelSchema = toZod4(rawLinkModelSchema)\nexport const NestableModelSchema = toZod4(rawNestableModelSchema)\nexport const NumberModelSchema = toZod4(rawNumberModelSchema)\nexport const RangeModelSchema = toZod4(rawRangeModelSchema)\nexport const RichTextModelSchema = toZod4(rawRichTextModelSchema)\nexport const SelectModelSchema = toZod4(rawSelectModelSchema)\nexport const SeparatorModelSchema = toZod4(rawSeparatorModelSchema)\nexport const SharedSliceModelSchema = toZod4(rawSharedSliceModelSchema)\nexport const TableModelSchema = toZod4(rawTableModelSchema)\nexport const TextModelSchema = toZod4(rawTextModelSchema)\nexport const TimestampModelSchema = toZod4(rawTimestampModelSchema)\nexport const UIDModelSchema = toZod4(rawUIDModelSchema)\nexport const GroupModelSchema = toZod4(rawGroupModelSchema)\nexport const NestedGroupModelSchema = toZod4(rawNestedGroupModelSchema)\nexport const SharedSliceModelVariationSchema = toZod4(rawSharedSliceModelVariationSchema)\nexport const SharedSliceRefModelSchema = toZod4(rawSharedSliceRefModelSchema)\nexport const CompositeSliceModelSchema = toZod4(rawCompositeSliceModelSchema)\nexport const LegacySliceModelSchema = toZod4(rawLegacySliceModelSchema)\nexport const DynamicSliceModelSchema = toZod4(rawDynamicSliceModelSchema)\nexport const StaticSliceModelSchema = toZod4(rawStaticSliceModelSchema)\nexport const SliceContentModelSchema = toZod4(rawSliceContentModelSchema)\nexport const DynamicSlicesModelSchema = toZod4(rawDynamicSlicesModelSchema)\nexport const StaticSlicesModelSchema = toZod4(rawStaticSlicesModelSchema)\nexport const StaticWidgetModelSchema = toZod4(rawStaticWidgetModelSchema)\nexport const DynamicWidgetModelSchema = toZod4(rawDynamicWidgetModelSchema)\nexport const StaticSectionModelSchema = toZod4(rawStaticSectionModelSchema)\nexport const DynamicSectionModelSchema = toZod4(rawDynamicSectionModelSchema)\nexport const StaticCustomTypeModelSchema = toZod4(rawStaticCustomTypeModelSchema)\nexport const CustomTypeModelSchema = toZod4(rawCustomTypeModelSchema)\n\nfunction toZod4<T>(type: T): T {\n\treturn type\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,MAAa,cAAc,OAAOA,cAAe;AACjD,MAAa,cAAc,OAAOC,cAAe;AACjD,MAAa,sBAAsB,OAAOC,sBAAuB;AACjE,MAAa,uBAAuB,OAAOC,uBAAwB;AACnE,M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A0B,OAAOC,0BAA2B;AACzE,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,2BAA2B,OAAOC,2BAA4B;AAC3E,MAAa,4BAA4B,OAAOC,4BAA6B;AAC7E,MAAa,8BAA8B,OAAOC,8BAA+B;AACjF,MAAa,wBAAwB,OAAOC,wBAAyB;AAErE,SAAS,OAAU,MAAY;AAC9B,QAAO"}
|
package/package.json
CHANGED
package/src/content/boolean.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
|
-
import type { BooleanModel } from "../model/boolean"
|
|
4
|
-
|
|
5
3
|
export const BooleanContentType = "BooleanContent" as const
|
|
6
4
|
|
|
7
5
|
export const BooleanContentSchema = z.object({
|
|
@@ -10,14 +8,3 @@ export const BooleanContentSchema = z.object({
|
|
|
10
8
|
})
|
|
11
9
|
|
|
12
10
|
export type BooleanContent = z.infer<typeof BooleanContentSchema>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Returns the default value for a Boolean field based on its configuration.
|
|
16
|
-
*/
|
|
17
|
-
export const BooleanContentDefaultValue = (field: BooleanModel): BooleanContent | undefined =>
|
|
18
|
-
field.config?.default_value !== undefined
|
|
19
|
-
? {
|
|
20
|
-
__TYPE__: BooleanContentType,
|
|
21
|
-
value: field.config.default_value || false,
|
|
22
|
-
}
|
|
23
|
-
: undefined
|
package/src/content/field.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
|
-
import type { SelectModel } from "../model/select"
|
|
4
|
-
|
|
5
3
|
export const FieldContentType = "FieldContent" as const
|
|
6
4
|
export const SelectFieldType = "Select" as const
|
|
7
5
|
|
|
@@ -80,15 +78,3 @@ export type FieldContent =
|
|
|
80
78
|
| NumberContent
|
|
81
79
|
| RangeContent
|
|
82
80
|
| SelectContent
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Returns the default value for a Select field based on its configuration.
|
|
86
|
-
*/
|
|
87
|
-
export const SelectContentDefaultValue = (field: SelectModel): SelectContent | undefined =>
|
|
88
|
-
field.config?.default_value
|
|
89
|
-
? {
|
|
90
|
-
__TYPE__: FieldContentType,
|
|
91
|
-
type: SelectFieldType,
|
|
92
|
-
value: field.config.default_value || "",
|
|
93
|
-
}
|
|
94
|
-
: undefined
|
package/src/content/group.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { NestableContentDefaultValue, NestableContentSchema } from "./nestable"
|
|
3
|
+
import { NestableContentSchema } from "./nestable"
|
|
5
4
|
import type { NestableContent } from "./nestable"
|
|
6
5
|
|
|
7
6
|
// Item
|
|
@@ -45,55 +44,3 @@ export const NestableAndGroupContentSchema: z.ZodMiniType<NestableAndGroupConten
|
|
|
45
44
|
])
|
|
46
45
|
|
|
47
46
|
export type NestableAndGroupContent = NestableContent | GroupContent
|
|
48
|
-
|
|
49
|
-
// Default values for GroupContent
|
|
50
|
-
export function groupContentWithDefaultValues(
|
|
51
|
-
customType: GroupModel,
|
|
52
|
-
content: GroupContent,
|
|
53
|
-
): GroupContent {
|
|
54
|
-
const fields = customType.config?.fields
|
|
55
|
-
if (!fields) return content
|
|
56
|
-
|
|
57
|
-
return {
|
|
58
|
-
...content,
|
|
59
|
-
value: content.value.map((groupItem) => {
|
|
60
|
-
const updatedValue = Object.entries(fields).reduce<GroupItemContent["value"]>(
|
|
61
|
-
(acc, [fieldKey, fieldDef]) => {
|
|
62
|
-
const existingField = groupItem.value.find(([key]) => key === fieldKey)
|
|
63
|
-
|
|
64
|
-
if (existingField) {
|
|
65
|
-
return [...acc, existingField]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Field is missing, check if we can add a default value
|
|
69
|
-
if (fieldDef.type === "Group") {
|
|
70
|
-
// Recursively apply defaults to nested groups
|
|
71
|
-
return [
|
|
72
|
-
...acc,
|
|
73
|
-
[
|
|
74
|
-
fieldKey,
|
|
75
|
-
{
|
|
76
|
-
__TYPE__: GroupContentType,
|
|
77
|
-
value: [],
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const defaultValue = NestableContentDefaultValue(fieldDef)
|
|
84
|
-
if (defaultValue) {
|
|
85
|
-
return [...acc, [fieldKey, defaultValue]]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return acc
|
|
89
|
-
},
|
|
90
|
-
[],
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
...groupItem,
|
|
95
|
-
value: updatedValue,
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
}
|
|
99
|
-
}
|
package/src/content/nestable.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
|
-
import type { NestableModel } from "../model/nestable"
|
|
4
3
|
import type { BooleanContent } from "./boolean"
|
|
5
|
-
import {
|
|
4
|
+
import { BooleanContentSchema, BooleanContentType } from "./boolean"
|
|
6
5
|
import type { EmbedContent } from "./embed"
|
|
7
6
|
import { EmbedContentSchema, EmbedContentType } from "./embed"
|
|
8
7
|
import type { EmptyContent } from "./empty"
|
|
@@ -22,7 +21,6 @@ import {
|
|
|
22
21
|
FieldContentType,
|
|
23
22
|
NumberContentSchema,
|
|
24
23
|
RangeContentSchema,
|
|
25
|
-
SelectContentDefaultValue,
|
|
26
24
|
SelectContentSchema,
|
|
27
25
|
TextContentSchema,
|
|
28
26
|
TimestampContentSchema,
|
|
@@ -107,20 +105,3 @@ export function isNestableContent(content: {
|
|
|
107
105
|
}): content is { __TYPE__: NestableContentType } {
|
|
108
106
|
return (NestableContentTypes as string[]).includes(content.__TYPE__)
|
|
109
107
|
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Returns the default value for a nestable widget based on its configuration.
|
|
113
|
-
* Currently only Boolean and Select fields have default values.
|
|
114
|
-
*/
|
|
115
|
-
export const NestableContentDefaultValue = (
|
|
116
|
-
widgetDef: NestableModel,
|
|
117
|
-
): NestableContent | undefined => {
|
|
118
|
-
switch (widgetDef.type) {
|
|
119
|
-
case "Boolean":
|
|
120
|
-
return BooleanContentDefaultValue(widgetDef)
|
|
121
|
-
case "Select":
|
|
122
|
-
return SelectContentDefaultValue(widgetDef)
|
|
123
|
-
default:
|
|
124
|
-
return undefined
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -332,7 +332,10 @@ export function traverseLegacySliceContent(
|
|
|
332
332
|
}
|
|
333
333
|
} else {
|
|
334
334
|
if (model?.type === "SharedSlice") {
|
|
335
|
-
|
|
335
|
+
const primaryModel = model.fields.primary?.[content.name]
|
|
336
|
+
if (primaryModel?.type !== "Group") {
|
|
337
|
+
legacySliceModel = primaryModel
|
|
338
|
+
}
|
|
336
339
|
} else if (model?.type !== "Group") {
|
|
337
340
|
legacySliceModel = model
|
|
338
341
|
}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { BooleanContentType } from "../content/boolean"
|
|
2
|
+
import type { DocumentContent } from "../content/document"
|
|
3
|
+
import { FieldContentType, SelectFieldType } from "../content/field"
|
|
4
|
+
import type { GroupContent, GroupItemContent } from "../content/group"
|
|
5
|
+
import { GroupContentType } from "../content/group"
|
|
6
|
+
import type { SliceContent } from "../content/slice"
|
|
7
|
+
import { CompositeSliceContentType, SharedSliceContentType } from "../content/slice"
|
|
8
|
+
import type { SlicesContent } from "../content/slices"
|
|
9
|
+
import { SlicesContentType } from "../content/slices"
|
|
10
|
+
import type { WidgetContent } from "../content/widget"
|
|
11
|
+
import type { StaticCustomTypeModel } from "../model/customType"
|
|
12
|
+
import type { GroupModel } from "../model/group"
|
|
13
|
+
import type { NestableModel } from "../model/nestable"
|
|
14
|
+
import type { StaticSliceModel } from "../model/slice"
|
|
15
|
+
import type { StaticWidgetModel } from "../model/widget"
|
|
16
|
+
import * as customTypeModel from "./customTypeModel"
|
|
17
|
+
|
|
18
|
+
export function document(content: DocumentContent, model: StaticCustomTypeModel): DocumentContent {
|
|
19
|
+
return record(content, customTypeModel.flatten(model))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function slice(content: SliceContent, model: StaticSliceModel | undefined): SliceContent {
|
|
23
|
+
if (!model) {
|
|
24
|
+
return content
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (model.type === "SharedSlice") {
|
|
28
|
+
if (content.__TYPE__ !== SharedSliceContentType) {
|
|
29
|
+
return content
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const variation = model.variations.find((variation) => variation.id === content.variation)
|
|
33
|
+
if (!variation) {
|
|
34
|
+
return content
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...content,
|
|
39
|
+
primary: record(content.primary, variation?.primary),
|
|
40
|
+
items: items(content.items, variation?.items),
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (model.type === "Slice") {
|
|
45
|
+
if (content.__TYPE__ !== CompositeSliceContentType) {
|
|
46
|
+
return content
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
...content,
|
|
51
|
+
nonRepeat: record(content.nonRepeat, model["non-repeat"]),
|
|
52
|
+
repeat: items(content.repeat, model.repeat),
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (
|
|
57
|
+
content.__TYPE__ === SharedSliceContentType ||
|
|
58
|
+
content.__TYPE__ === CompositeSliceContentType
|
|
59
|
+
) {
|
|
60
|
+
return content
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return widget(content, model)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function widget<TContent extends WidgetContent | undefined>(
|
|
67
|
+
content: TContent,
|
|
68
|
+
model: StaticWidgetModel | undefined,
|
|
69
|
+
): TContent {
|
|
70
|
+
if (!model) {
|
|
71
|
+
return content
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (
|
|
75
|
+
(model.type === "Slices" || model.type === "Choice") &&
|
|
76
|
+
content?.__TYPE__ === SlicesContentType
|
|
77
|
+
) {
|
|
78
|
+
if (!model.config?.choices) return content
|
|
79
|
+
|
|
80
|
+
const value: SlicesContent["value"] = []
|
|
81
|
+
for (const sliceItem of content.value) {
|
|
82
|
+
value.push({
|
|
83
|
+
...sliceItem,
|
|
84
|
+
widget: slice(sliceItem.widget, model.config.choices[sliceItem.name]),
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return { ...content, value }
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (model.type === "Group" && content?.__TYPE__ === GroupContentType) {
|
|
92
|
+
return { ...content, value: items(content.value, model.config?.fields) }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (model.type === "Boolean" && !content) {
|
|
96
|
+
if (model.config?.default_value === undefined) {
|
|
97
|
+
return <TContent>undefined
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return <TContent>{
|
|
101
|
+
__TYPE__: BooleanContentType,
|
|
102
|
+
value: model.config.default_value,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (model.type === "Select" && !content) {
|
|
107
|
+
if (!model.config?.default_value) {
|
|
108
|
+
return <TContent>undefined
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return <TContent>{
|
|
112
|
+
__TYPE__: FieldContentType,
|
|
113
|
+
type: SelectFieldType,
|
|
114
|
+
value: model.config.default_value,
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return content
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function items(
|
|
122
|
+
items: GroupContent["value"],
|
|
123
|
+
fields: Record<string, GroupModel | NestableModel> | undefined,
|
|
124
|
+
): GroupContent["value"] {
|
|
125
|
+
if (!fields) {
|
|
126
|
+
return items
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const itemsWithDefaults: GroupContent["value"] = []
|
|
130
|
+
for (const item of items) {
|
|
131
|
+
const itemValue: GroupItemContent["value"] = []
|
|
132
|
+
|
|
133
|
+
const missingFields = { ...fields }
|
|
134
|
+
for (const [key, value] of item.value) {
|
|
135
|
+
delete missingFields[key]
|
|
136
|
+
itemValue.push([key, widget(value, fields[key])])
|
|
137
|
+
}
|
|
138
|
+
for (const [key, field] of Object.entries(missingFields)) {
|
|
139
|
+
const content = widget(undefined, field)
|
|
140
|
+
if (content) {
|
|
141
|
+
itemValue.push([key, content])
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
itemsWithDefaults.push({ ...item, value: itemValue })
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return itemsWithDefaults
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function record<TContent extends WidgetContent>(
|
|
152
|
+
record: Record<string, TContent>,
|
|
153
|
+
fields: Record<string, StaticWidgetModel> | undefined,
|
|
154
|
+
): Record<string, TContent> {
|
|
155
|
+
if (!fields) {
|
|
156
|
+
return record
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const missingFields = { ...fields }
|
|
160
|
+
const recordWithDefaults: Record<string, TContent> = {}
|
|
161
|
+
for (const [key, value] of Object.entries(record)) {
|
|
162
|
+
delete missingFields[key]
|
|
163
|
+
recordWithDefaults[key] = widget(value, fields[key])
|
|
164
|
+
}
|
|
165
|
+
for (const [key, field] of Object.entries(missingFields)) {
|
|
166
|
+
const content = widget(undefined, field)
|
|
167
|
+
if (content) {
|
|
168
|
+
recordWithDefaults[key] = content
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return recordWithDefaults
|
|
173
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -69,7 +69,8 @@ export type {
|
|
|
69
69
|
CompositeSliceModel,
|
|
70
70
|
SharedSliceModel,
|
|
71
71
|
SharedSliceRefModel,
|
|
72
|
-
|
|
72
|
+
SharedSliceModelVariation,
|
|
73
|
+
SharedSliceVariationContentModel,
|
|
73
74
|
StaticSliceModel,
|
|
74
75
|
DynamicSliceModel,
|
|
75
76
|
SliceContentModel,
|
|
@@ -91,6 +92,7 @@ export * as contentPath from "./helpers/contentPath"
|
|
|
91
92
|
export * as customTypeModel from "./helpers/customTypeModel"
|
|
92
93
|
export * as documentContent from "./helpers/documentContent"
|
|
93
94
|
export * as sliceContent from "./helpers/sliceContent"
|
|
95
|
+
export * as withDefaultContent from "./helpers/withDefaultContent"
|
|
94
96
|
export {
|
|
95
97
|
traverseDocumentContent,
|
|
96
98
|
traverseSlicesContent,
|
package/src/io-ts.ts
CHANGED
|
@@ -118,6 +118,7 @@ import {
|
|
|
118
118
|
LegacySliceModelSchema as rawLegacySliceModelSchema,
|
|
119
119
|
CompositeSliceModelSchema as rawCompositeSliceModelSchema,
|
|
120
120
|
SharedSliceModelSchema as rawSharedSliceModelSchema,
|
|
121
|
+
SharedSliceModelVariationSchema as rawSharedSliceModelVariationSchema,
|
|
121
122
|
SharedSliceRefModelSchema as rawSharedSliceRefModelSchema,
|
|
122
123
|
StaticSliceModelSchema as rawStaticSliceModelSchema,
|
|
123
124
|
DynamicSliceModelSchema as rawDynamicSliceModelSchema,
|
|
@@ -235,6 +236,7 @@ export const TimestampModelSchema = toIOTS(rawTimestampModelSchema)
|
|
|
235
236
|
export const UIDModelSchema = toIOTS(rawUIDModelSchema)
|
|
236
237
|
export const GroupModelSchema = toIOTS(rawGroupModelSchema)
|
|
237
238
|
export const NestedGroupModelSchema = toIOTS(rawNestedGroupModelSchema)
|
|
239
|
+
export const SharedSliceModelVariationSchema = toIOTS(rawSharedSliceModelVariationSchema)
|
|
238
240
|
export const SharedSliceRefModelSchema = toIOTS(rawSharedSliceRefModelSchema)
|
|
239
241
|
export const CompositeSliceModelSchema = toIOTS(rawCompositeSliceModelSchema)
|
|
240
242
|
export const LegacySliceModelSchema = toIOTS(rawLegacySliceModelSchema)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SharedSliceModel,
|
|
1
|
+
import type { SharedSliceModel, SharedSliceModelVariation } from "../slice"
|
|
2
2
|
import { type DiffChange, DiffOperation } from "./changes"
|
|
3
3
|
import { isNotEmpty, toRecord, zipObjects } from "./utils"
|
|
4
4
|
import { type VariationDiff, VariationComparator } from "./variation"
|
|
@@ -41,7 +41,7 @@ export const SliceComparator = {
|
|
|
41
41
|
|
|
42
42
|
const diffMeta = compareSliceMeta(sliceA, sliceB)
|
|
43
43
|
|
|
44
|
-
const zippedSlices = zipObjects<
|
|
44
|
+
const zippedSlices = zipObjects<SharedSliceModelVariation>(
|
|
45
45
|
sliceA && toRecord(sliceA.variations, (v) => v.id),
|
|
46
46
|
sliceB && toRecord(sliceB.variations, (v) => v.id),
|
|
47
47
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { GroupModel } from "../group"
|
|
2
2
|
import { GroupFieldType } from "../group"
|
|
3
3
|
import type { NestableModel } from "../nestable"
|
|
4
|
-
import type {
|
|
4
|
+
import type { SharedSliceModelVariation } from "../slice"
|
|
5
5
|
import { type DiffChange, DiffOperation } from "./changes"
|
|
6
6
|
import { isNotEmpty, zipObjects } from "./utils"
|
|
7
7
|
import type {
|
|
@@ -10,9 +10,9 @@ import type {
|
|
|
10
10
|
SlicePrimaryWidgetDiff,
|
|
11
11
|
} from "./widgets"
|
|
12
12
|
|
|
13
|
-
export type VariationMetadata = Omit<
|
|
13
|
+
export type VariationMetadata = Omit<SharedSliceModelVariation, "primary" | "items">
|
|
14
14
|
export type VariationDiff = DiffChange<
|
|
15
|
-
|
|
15
|
+
SharedSliceModelVariation,
|
|
16
16
|
Partial<VariationMetadata> & {
|
|
17
17
|
primary?: Record<string, SlicePrimaryWidgetDiff>
|
|
18
18
|
items?: Record<string, NestableWidgetDiff>
|
|
@@ -20,8 +20,8 @@ export type VariationDiff = DiffChange<
|
|
|
20
20
|
>
|
|
21
21
|
|
|
22
22
|
function compareVariationMeta(
|
|
23
|
-
variationA?:
|
|
24
|
-
variationB?:
|
|
23
|
+
variationA?: SharedSliceModelVariation,
|
|
24
|
+
variationB?: SharedSliceModelVariation,
|
|
25
25
|
): Partial<VariationMetadata> {
|
|
26
26
|
const zippedVariations = zipObjects(variationA, variationB)
|
|
27
27
|
|
|
@@ -119,8 +119,8 @@ function compareWidgets<TWidget extends NestableModel | GroupModel>(
|
|
|
119
119
|
|
|
120
120
|
export const VariationComparator = {
|
|
121
121
|
compare(
|
|
122
|
-
variationA?:
|
|
123
|
-
variationB?:
|
|
122
|
+
variationA?: SharedSliceModelVariation,
|
|
123
|
+
variationB?: SharedSliceModelVariation,
|
|
124
124
|
): VariationDiff | undefined {
|
|
125
125
|
if (variationA && !variationB)
|
|
126
126
|
return {
|
package/src/model/slice.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod/mini"
|
|
2
2
|
|
|
3
3
|
import { WidgetKeySchema } from "../common/widgetKey"
|
|
4
|
-
import type { NestedGroupModel } from "./group"
|
|
4
|
+
import type { GroupModel, NestedGroupModel } from "./group"
|
|
5
5
|
import { GroupModelSchema, NestedGroupModelSchema } from "./group"
|
|
6
6
|
import type { NestableModel } from "./nestable"
|
|
7
7
|
import { NestableModelSchema } from "./nestable"
|
|
@@ -40,7 +40,7 @@ export const SharedSliceType = "SharedSlice" as const
|
|
|
40
40
|
const IMAGE_PLACEHOLDER_URL =
|
|
41
41
|
"https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format"
|
|
42
42
|
|
|
43
|
-
export const
|
|
43
|
+
export const SharedSliceModelVariationSchema = z.object({
|
|
44
44
|
id: z.string(),
|
|
45
45
|
name: z.string(),
|
|
46
46
|
description: z.string(),
|
|
@@ -51,21 +51,19 @@ export const SharedSliceVariationSchema = z.object({
|
|
|
51
51
|
primary: z.optional(
|
|
52
52
|
z.record(
|
|
53
53
|
z.string(),
|
|
54
|
-
z.union([NestableModelSchema, GroupModelSchema]) as z.ZodMiniType<
|
|
55
|
-
NestableModel | NestedGroupModel
|
|
56
|
-
>,
|
|
54
|
+
z.union([NestableModelSchema, GroupModelSchema]) as z.ZodMiniType<NestableModel | GroupModel>,
|
|
57
55
|
),
|
|
58
56
|
),
|
|
59
57
|
items: z.optional(z.record(z.string(), NestableModelSchema)),
|
|
60
58
|
})
|
|
61
59
|
|
|
62
|
-
export type
|
|
60
|
+
export type SharedSliceModelVariation = z.infer<typeof SharedSliceModelVariationSchema>
|
|
63
61
|
|
|
64
62
|
export const SharedSliceModelSchema = z.object({
|
|
65
63
|
id: z.string(),
|
|
66
64
|
type: z.literal(SharedSliceType),
|
|
67
65
|
name: z.string(),
|
|
68
|
-
variations: z.array(
|
|
66
|
+
variations: z.array(SharedSliceModelVariationSchema),
|
|
69
67
|
description: z.optional(z.string()),
|
|
70
68
|
legacyPaths: z.optional(z.record(z.string(), z.string())),
|
|
71
69
|
})
|
|
@@ -84,7 +82,7 @@ export const SharedSliceVariationContentModelSchema = z.object({
|
|
|
84
82
|
type: z.literal(SharedSliceType),
|
|
85
83
|
sliceName: z.string(),
|
|
86
84
|
variationID: z.string(),
|
|
87
|
-
fields: z.pick(
|
|
85
|
+
fields: z.pick(SharedSliceModelVariationSchema, { primary: true, items: true }),
|
|
88
86
|
})
|
|
89
87
|
|
|
90
88
|
export type SharedSliceVariationContentModel = z.infer<
|