@prismicio/types-internal
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -6,6 +6,5 @@ "use strict"; | ||
const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const widgets_1 = require("../documents/widgets"); | ||
const Widget_1 = require("./widgets/Widget"); | ||
function sectionReader(codec) { | ||
return t.record(widgets_1.WidgetKey, codec); // WidgetId -> Widget Data | ||
return t.record(t.string, codec); // WidgetId -> Widget Data | ||
} | ||
@@ -12,0 +11,0 @@ exports.sectionReader = sectionReader; |
@@ -12,3 +12,3 @@ import * as t from "io-ts"; | ||
repeat: t.BooleanC; | ||
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
fields: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<WidgetTypes.Color>; | ||
@@ -15,0 +15,0 @@ }>, t.PartialC<{ |
@@ -5,3 +5,2 @@ "use strict"; | ||
const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const widgets_1 = require("../../documents/widgets"); | ||
const validators_1 = require("../../validators"); | ||
@@ -13,3 +12,3 @@ const NestableWidget_1 = (0, tslib_1.__importDefault)(require("./nestable/NestableWidget")); | ||
repeat: t.boolean, | ||
fields: t.record(widgets_1.WidgetKey, NestableWidget_1.default), | ||
fields: t.record(t.string, NestableWidget_1.default), | ||
})); | ||
@@ -16,0 +15,0 @@ const Group = t.exact(t.intersection([ |
@@ -10,3 +10,3 @@ import * as t from "io-ts"; | ||
display: t.StringC; | ||
"non-repeat": t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
"non-repeat": t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -168,3 +168,3 @@ }>, t.PartialC<{ | ||
}>]>>]>>; | ||
repeat: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
repeat: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -171,0 +171,0 @@ }>, t.PartialC<{ |
@@ -5,3 +5,2 @@ "use strict"; | ||
const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const widgets_1 = require("../../../documents/widgets"); | ||
const validators_1 = require("../../../validators"); | ||
@@ -22,4 +21,4 @@ const NestableWidget_1 = (0, tslib_1.__importDefault)(require("../nestable/NestableWidget")); | ||
display: t.string, | ||
"non-repeat": t.record(widgets_1.WidgetKey, NestableWidget_1.default), | ||
repeat: t.record(widgets_1.WidgetKey, NestableWidget_1.default), | ||
"non-repeat": t.record(t.string, NestableWidget_1.default), | ||
repeat: t.record(t.string, NestableWidget_1.default), | ||
config: CompositeSliceConfig, | ||
@@ -26,0 +25,0 @@ }), |
@@ -167,3 +167,3 @@ import * as t from "io-ts"; | ||
repeat: t.BooleanC; | ||
fields: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
fields: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -170,0 +170,0 @@ }>, t.PartialC<{ |
@@ -12,3 +12,3 @@ import * as t from "io-ts"; | ||
display: t.StringC; | ||
primary: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
primary: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -170,3 +170,3 @@ }>, t.PartialC<{ | ||
}>]>>]>>; | ||
items: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
items: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -343,3 +343,3 @@ }>, t.PartialC<{ | ||
display: t.StringC; | ||
primary: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
primary: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -501,3 +501,3 @@ }>, t.PartialC<{ | ||
}>]>>]>>; | ||
items: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
items: t.RecordC<t.StringC, t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{ | ||
type: t.LiteralC<import("../WidgetTypes").default.Color>; | ||
@@ -504,0 +504,0 @@ }>, t.PartialC<{ |
@@ -7,3 +7,2 @@ "use strict"; | ||
const withFallback_1 = require("io-ts-types/lib/withFallback"); | ||
const widgets_1 = require("../../../documents/widgets"); | ||
const NestableWidget_1 = (0, tslib_1.__importDefault)(require("../nestable/NestableWidget")); | ||
@@ -23,4 +22,4 @@ const SlicesTypes_1 = (0, tslib_1.__importDefault)(require("./SlicesTypes")); | ||
display: t.string, | ||
primary: t.record(widgets_1.WidgetKey, NestableWidget_1.default), | ||
items: t.record(widgets_1.WidgetKey, NestableWidget_1.default), | ||
primary: t.record(t.string, NestableWidget_1.default), | ||
items: t.record(t.string, NestableWidget_1.default), | ||
}), | ||
@@ -27,0 +26,0 @@ ])); |
@@ -6,3 +6,2 @@ "use strict"; | ||
const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const widgets_1 = require("../../../documents/widgets"); | ||
const validators_1 = require("../../../validators"); | ||
@@ -30,3 +29,3 @@ const WidgetTypes_1 = (0, tslib_1.__importDefault)(require("../WidgetTypes")); | ||
labels: exports.SlicesLabels, | ||
choices: t.record(widgets_1.WidgetKey, t.union([LegacySlice_1.default, CompositeSlice_1.default, codec])), | ||
choices: t.record(t.string, t.union([LegacySlice_1.default, CompositeSlice_1.default, codec])), | ||
})); | ||
@@ -33,0 +32,0 @@ } |
@@ -1,2 +0,1 @@ | ||
import * as t from "io-ts"; | ||
import { SlicesContent } from "./slices"; | ||
@@ -9,3 +8,3 @@ import StaticWidgetContent from "./StaticWidgetContent"; | ||
export * as Slices from "./slices"; | ||
export { type NonEmptyStaticWidgetContent, default as StaticWidgetContent, } from "./StaticWidgetContent"; | ||
export { type NonEmptyStaticWidgetContent } from "./StaticWidgetContent"; | ||
export * from "./UIDContent"; | ||
@@ -33,4 +32,3 @@ export declare const WidgetTypes: { | ||
}; | ||
export declare const WidgetKey: t.Type<string, string, unknown>; | ||
export declare type WidgetKey = t.TypeOf<typeof WidgetKey>; | ||
export declare type WidgetKey = string; | ||
export declare type WidgetContent = SlicesContent | StaticWidgetContent; | ||
@@ -37,0 +35,0 @@ export declare const Widget: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Widget = exports.WidgetKey = exports.WidgetTypes = exports.StaticWidgetContent = exports.Slices = exports.Nestable = void 0; | ||
exports.Widget = exports.WidgetTypes = exports.Slices = exports.Nestable = void 0; | ||
const tslib_1 = require("tslib"); | ||
const t = (0, tslib_1.__importStar)(require("io-ts")); | ||
const function_1 = require("../../validators/function"); | ||
const EmptyContent_1 = require("./EmptyContent"); | ||
@@ -19,3 +17,2 @@ const GroupContent_1 = require("./GroupContent"); | ||
var StaticWidgetContent_2 = require("./StaticWidgetContent"); | ||
Object.defineProperty(exports, "StaticWidgetContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(StaticWidgetContent_2).default; } }); | ||
(0, tslib_1.__exportStar)(require("./UIDContent"), exports); | ||
@@ -29,4 +26,2 @@ exports.WidgetTypes = { | ||
}; | ||
const widgetKeyRegex = new RegExp("^[^<>]*$"); | ||
exports.WidgetKey = (0, function_1.refineType)(t.string, "WidgetKey", (s) => widgetKeyRegex.test(s)); | ||
exports.Widget = { | ||
@@ -33,0 +28,0 @@ fromJson(widgetKey, widgetValue, widgetTypes, widgetPositions) { |
{ | ||
"name": "@prismicio/types-internal", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "Prismic types for Custom Types and Prismic Data", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import * as t from "io-ts" | ||
import { WidgetKey } from "../documents/widgets" | ||
import type { SharedSlice } from "./widgets/slices" | ||
@@ -10,3 +9,3 @@ import { DynamicWidget, StaticWidget, Widgets } from "./widgets/Widget" | ||
) { | ||
return t.record(WidgetKey, codec) // WidgetId -> Widget Data | ||
return t.record(t.string, codec) // WidgetId -> Widget Data | ||
} | ||
@@ -13,0 +12,0 @@ |
import * as t from "io-ts" | ||
import { WidgetKey } from "../../documents/widgets" | ||
import { StringOrNull } from "../../validators" | ||
@@ -12,3 +11,3 @@ import NestableWidget from "./nestable/NestableWidget" | ||
repeat: t.boolean, | ||
fields: t.record(WidgetKey, NestableWidget), | ||
fields: t.record(t.string, NestableWidget), | ||
}), | ||
@@ -15,0 +14,0 @@ ) |
import * as t from "io-ts" | ||
import { WidgetKey } from "../../../documents/widgets" | ||
import { StringOrNull } from "../../../validators" | ||
@@ -25,4 +24,4 @@ import NestableWidget from "../nestable/NestableWidget" | ||
display: t.string, | ||
"non-repeat": t.record(WidgetKey, NestableWidget), | ||
repeat: t.record(WidgetKey, NestableWidget), | ||
"non-repeat": t.record(t.string, NestableWidget), | ||
repeat: t.record(t.string, NestableWidget), | ||
config: CompositeSliceConfig, | ||
@@ -29,0 +28,0 @@ }), |
import * as t from "io-ts" | ||
import { withFallback } from "io-ts-types/lib/withFallback" | ||
import { WidgetKey } from "../../../documents/widgets" | ||
import NestableWidget from "../nestable/NestableWidget" | ||
@@ -23,4 +22,4 @@ import SlicesTypes from "./SlicesTypes" | ||
display: t.string, | ||
primary: t.record(WidgetKey, NestableWidget), | ||
items: t.record(WidgetKey, NestableWidget), | ||
primary: t.record(t.string, NestableWidget), | ||
items: t.record(t.string, NestableWidget), | ||
}), | ||
@@ -27,0 +26,0 @@ ]), |
import * as t from "io-ts" | ||
import { WidgetKey } from "../../../documents/widgets" | ||
import { StringOrNull } from "../../../validators" | ||
@@ -40,3 +39,3 @@ import WidgetTypes from "../WidgetTypes" | ||
choices: t.record( | ||
WidgetKey, | ||
t.string, | ||
t.union([LegacySlice, CompositeSlice, codec]), | ||
@@ -43,0 +42,0 @@ ), |
@@ -1,4 +0,1 @@ | ||
import * as t from "io-ts" | ||
import { refineType } from "../../validators/function" | ||
import { EmptyContentType } from "./EmptyContent" | ||
@@ -16,6 +13,3 @@ import { GroupContentType } from "./GroupContent" | ||
export * as Slices from "./slices" | ||
export { | ||
type NonEmptyStaticWidgetContent, | ||
default as StaticWidgetContent, | ||
} from "./StaticWidgetContent" | ||
export { type NonEmptyStaticWidgetContent } from "./StaticWidgetContent" | ||
export * from "./UIDContent" | ||
@@ -31,8 +25,10 @@ | ||
const widgetKeyRegex = new RegExp("^[^<>]*$") | ||
/*const widgetKeyRegex = new RegExp("^[^<>]*$") | ||
export const WidgetKey = refineType(t.string, "WidgetKey", (s: string) => | ||
widgetKeyRegex.test(s), | ||
) | ||
export type WidgetKey = t.TypeOf<typeof WidgetKey> | ||
export type WidgetKey = t.TypeOf<typeof WidgetKey>*/ | ||
export type WidgetKey = string | ||
export type WidgetContent = SlicesContent | StaticWidgetContent | ||
@@ -39,0 +35,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
837219
19360