@prismicio/types-internal 4.2.0-canary.0e66451 → 4.2.0-canary.3468ca2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType.d.ts","names":[],"sources":["../../src/model/customType.ts"],"mappings":";;;;cAMa,8BAAA,EAA8B,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,iBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,iBAAA;AAAA,KAC/B,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEzC,+BAAA,EAA+B,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,kBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,kBAAA;AAAA,KAChC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"customType.d.ts","names":[],"sources":["../../src/model/customType.ts"],"mappings":";;;;cAMa,8BAAA,EAA8B,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,iBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,iBAAA;AAAA,KAC/B,wBAAA,GAA2B,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAEzC,+BAAA,EAA+B,CAAA,CAAA,aAAA,CAAA,CAAA,CAAA,aAAA,UAAA,CAAA,CAAA,WAAA,CAAA,kBAAA,WAAA,CAAA,CAAA,IAAA,CAAA,iBAAA,CAAA,kBAAA;AAAA,KAChC,yBAAA,GAA4B,CAAA,CAAE,KAAA,QAAa,+BAAA;AAAA,cAwD1C,2BAAA,EAA2B,CAAA,CAAA,aAAA;;;;;;;;;;;KAC5B,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAEtC,4BAAA,EAA4B,CAAA,CAAA,aAAA;;;;;;;;;;;KAC7B,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,4BAAA;;KAKxC,eAAA,GAAkB,sBAAA"}
|
package/dist/model/customType.js
CHANGED
|
@@ -15,11 +15,6 @@ const createCustomTypeSchema = (sectionSchema) => z.object({
|
|
|
15
15
|
}).check(z.superRefine((model, ctx) => {
|
|
16
16
|
const { json } = model;
|
|
17
17
|
const tabEntries = Object.entries(json);
|
|
18
|
-
if (tabEntries.length === 0) ctx.addIssue({
|
|
19
|
-
code: "custom",
|
|
20
|
-
message: `Custom type "${model.id}" must have at least one tab`,
|
|
21
|
-
path: ["json"]
|
|
22
|
-
});
|
|
23
18
|
const existingWidgetKeys = /* @__PURE__ */ new Map();
|
|
24
19
|
for (const [tabID, tab] of tabEntries) for (const [widgetID, widget] of Object.entries(tab)) {
|
|
25
20
|
if (widget.type === "UID" && widgetID !== "uid") ctx.addIssue({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customType.js","names":[],"sources":["../../src/model/customType.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { DynamicWidgetModelSchema, StaticWidgetModelSchema } from \"./widget\"\n\n// Tab\nexport const StaticCustomTypeModelTabSchema = z.record(WidgetKeySchema, StaticWidgetModelSchema)\nexport type StaticCustomTypeModelTab = z.infer<typeof StaticCustomTypeModelTabSchema>\n\nexport const DynamicCustomTypeModelTabSchema = z.record(WidgetKeySchema, DynamicWidgetModelSchema)\nexport type DynamicCustomTypeModelTab = z.infer<typeof DynamicCustomTypeModelTabSchema>\n\n// Custom types\nexport const CustomTypeFormatSchema = z.enum([\"page\", \"custom\"])\nexport type CustomTypeFormat = z.infer<typeof CustomTypeFormatSchema>\n\n// Factory to create CustomType schema with configurable section type\nconst createCustomTypeSchema = <\n\tT extends typeof StaticCustomTypeModelTabSchema | typeof DynamicCustomTypeModelTabSchema,\n>(\n\tsectionSchema: T,\n) =>\n\tz\n\t\t.object({\n\t\t\tid: z.string(),\n\t\t\tlabel: z.nullish(z.string()),\n\t\t\trepeatable: z._default(z.boolean(), true),\n\t\t\tjson: z.record(z.string(), sectionSchema),\n\t\t\tstatus: z._default(z.boolean(), true),\n\t\t\tformat: z._default(CustomTypeFormatSchema, \"custom\"),\n\t\t})\n\t\t.check(\n\t\t\tz.superRefine((model, ctx) => {\n\t\t\t\tconst { json } = model\n\n\t\t\t\tconst tabEntries = Object.entries(json)\n\
|
|
1
|
+
{"version":3,"file":"customType.js","names":[],"sources":["../../src/model/customType.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\nimport { WidgetKeySchema } from \"../common/widgetKey\"\nimport { DynamicWidgetModelSchema, StaticWidgetModelSchema } from \"./widget\"\n\n// Tab\nexport const StaticCustomTypeModelTabSchema = z.record(WidgetKeySchema, StaticWidgetModelSchema)\nexport type StaticCustomTypeModelTab = z.infer<typeof StaticCustomTypeModelTabSchema>\n\nexport const DynamicCustomTypeModelTabSchema = z.record(WidgetKeySchema, DynamicWidgetModelSchema)\nexport type DynamicCustomTypeModelTab = z.infer<typeof DynamicCustomTypeModelTabSchema>\n\n// Custom types\nexport const CustomTypeFormatSchema = z.enum([\"page\", \"custom\"])\nexport type CustomTypeFormat = z.infer<typeof CustomTypeFormatSchema>\n\n// Factory to create CustomType schema with configurable section type\nconst createCustomTypeSchema = <\n\tT extends typeof StaticCustomTypeModelTabSchema | typeof DynamicCustomTypeModelTabSchema,\n>(\n\tsectionSchema: T,\n) =>\n\tz\n\t\t.object({\n\t\t\tid: z.string(),\n\t\t\tlabel: z.nullish(z.string()),\n\t\t\trepeatable: z._default(z.boolean(), true),\n\t\t\tjson: z.record(z.string(), sectionSchema),\n\t\t\tstatus: z._default(z.boolean(), true),\n\t\t\tformat: z._default(CustomTypeFormatSchema, \"custom\"),\n\t\t})\n\t\t.check(\n\t\t\tz.superRefine((model, ctx) => {\n\t\t\t\tconst { json } = model\n\n\t\t\t\tconst tabEntries = Object.entries(json)\n\n\t\t\t\t// A map of widget IDs to the tab they belong to\n\t\t\t\t// to check for ID uniqueness across all tabs.\n\t\t\t\tconst existingWidgetKeys = new Map<string, string>()\n\t\t\t\tfor (const [tabID, tab] of tabEntries) {\n\t\t\t\t\tfor (const [widgetID, widget] of Object.entries(tab)) {\n\t\t\t\t\t\tif (widget.type === \"UID\" && widgetID !== \"uid\") {\n\t\t\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\t\t\tmessage: `The UID widget ID must be set to \"uid\"`,\n\t\t\t\t\t\t\t\tpath: [\"json\", tabID, widgetID],\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst maybeTabID = existingWidgetKeys.get(widgetID)\n\t\t\t\t\t\tif (typeof maybeTabID === \"string\") {\n\t\t\t\t\t\t\tctx.addIssue({\n\t\t\t\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\t\t\t\tmessage: `${widgetID} already exists in the \"${maybeTabID}\" tab`,\n\t\t\t\t\t\t\t\tpath: [\"json\", tabID, widgetID],\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\texistingWidgetKeys.set(widgetID, tabID)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}),\n\t\t)\n\nexport const StaticCustomTypeModelSchema = createCustomTypeSchema(StaticCustomTypeModelTabSchema)\nexport type StaticCustomTypeModel = z.infer<typeof StaticCustomTypeModelSchema>\n\nexport const DynamicCustomTypeModelSchema = createCustomTypeSchema(DynamicCustomTypeModelTabSchema)\nexport type DynamicCustomTypeModel = z.infer<typeof DynamicCustomTypeModelSchema>\n\n/** @deprecated Use DynamicCustomTypeModelSchema instead */\nexport const CustomTypeModelSchema = DynamicCustomTypeModelSchema\n/** @deprecated Use DynamicCustomTypeMod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7 @@ const SideConstraintSchema = z.union([
|
|
|
12
12
|
z.pipe(z.literal("auto"), z.transform(() => null)),
|
|
13
13
|
z.pipe(z.literal(""), z.transform(() => null)),
|
|
14
14
|
z.null(),
|
|
15
|
-
z.
|
|
15
|
+
z.int(),
|
|
16
16
|
z.pipe(z.string(), z.transform((s) => parseInt(s.replace("px", ""), 10)))
|
|
17
17
|
]);
|
|
18
18
|
const ImageConstraintSchema = z.object({
|
package/dist/model/image.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema: z.ZodMiniType<number | null> = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.
|
|
1
|
+
{"version":3,"file":"image.js","names":[],"sources":["../../src/model/image.ts"],"sourcesContent":["import { z } from \"zod/mini\"\n\n/**\n * SideConstraint accepts multiple input formats and normalizes to number | null:\n * - Integer values\n * - String integers (e.g., \"100\")\n * - Pixel strings (e.g., \"100px\")\n * - \"auto\" or \"\" → null\n * - null\n */\nexport const SideConstraintSchema: z.ZodMiniType<number | null> = z.union([\n\tz.pipe(\n\t\tz.literal(\"auto\"),\n\t\tz.transform(() => null),\n\t),\n\tz.pipe(\n\t\tz.literal(\"\"),\n\t\tz.transform(() => null),\n\t),\n\tz.null(),\n\tz.int(),\n\tz.pipe(\n\t\tz.string(),\n\t\tz.transform((s: string) => parseInt(s.replace(\"px\", \"\"), 10)),\n\t),\n])\n\nexport const ImageConstraintSchema = z.object({\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nexport type ImageConstraint = z.infer<typeof ImageConstraintSchema>\n\nconst ThumbnailSchema = z.object({\n\tname: z.string(),\n\twidth: z.optional(SideConstraintSchema),\n\theight: z.optional(SideConstraintSchema),\n})\n\nconst ImageConfigSchema = z.object({\n\tlabel: z.nullish(z.string()),\n\tplaceholder: z.optional(z.string()),\n\tconstraint: z.optional(ImageConstraintSchema),\n\tthumbnails: z.optional(z.array(ThumbnailSchema)),\n})\n\nexport const ImageModelSchema = z.object({\n\ttype: z.literal(\"Image\"),\n\tfieldset: z.nullish(z.string()),\n\tconfig: z.optional(ImageConfigSchema),\n})\n\nexport type ImageModel = z.infer<typeof ImageModelSchema>\n"],"mappings":";;;;;;;;;;AAUA,MAAa,uBAAqD,EAAE,MAAM;CACzE,EAAE,KACD,EAAE,QAAQ,OAAO,EACjB,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,KACD,EAAE,QAAQ,GAAG,EACb,EAAE,gBAAgB,KAAK,CACvB;CACD,EAAE,MAAM;CACR,EAAE,KAAK;CACP,EAAE,KACD,EAAE,QAAQ,EACV,EAAE,WAAW,MAAc,SAAS,EAAE,QAAQ,MAAM,GAAG,EAAE,GAAG,CAAC,CAC7D;CACD,CAAC;AAEF,MAAa,wBAAwB,EAAE,OAAO;CAC7C,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAIF,MAAM,kBAAkB,EAAE,OAAO;CAChC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,SAAS,qBAAqB;CACvC,QAAQ,EAAE,SAAS,qBAAqB;CACxC,CAAC;AAEF,MAAM,oBAAoB,EAAE,OAAO;CAClC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC5B,aAAa,EAAE,SAAS,EAAE,QAAQ,CAAC;CACnC,YAAY,EAAE,SAAS,sBAAsB;CAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;CAChD,CAAC;AAEF,MAAa,mBAAmB,EAAE,OAAO;CACxC,MAAM,EAAE,QAAQ,QAAQ;CACxB,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAC;CAC/B,QAAQ,EAAE,SAAS,kBAAkB;CACrC,CAAC"}
|
package/package.json
CHANGED
package/src/model/customType.ts
CHANGED
|
@@ -34,13 +34,6 @@ const createCustomTypeSchema = <
|
|
|
34
34
|
const { json } = model
|
|
35
35
|
|
|
36
36
|
const tabEntries = Object.entries(json)
|
|
37
|
-
if (tabEntries.length === 0) {
|
|
38
|
-
ctx.addIssue({
|
|
39
|
-
code: "custom",
|
|
40
|
-
message: `Custom type "${model.id}" must have at least one tab`,
|
|
41
|
-
path: ["json"],
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
37
|
|
|
45
38
|
// A map of widget IDs to the tab they belong to
|
|
46
39
|
// to check for ID uniqueness across all tabs.
|
package/src/model/image.ts
CHANGED