@prismicio/types-internal 1.4.1 → 1.5.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.
Files changed (31) hide show
  1. package/lib/content/CustomType.d.ts +2964 -0
  2. package/lib/content/CustomType.js +15 -0
  3. package/lib/content/fields/UIDContent.d.ts +6 -0
  4. package/lib/content/fields/UIDContent.js +10 -0
  5. package/lib/content/fields/index.d.ts +1 -0
  6. package/lib/content/fields/index.js +1 -0
  7. package/lib/content/fields/slices/CompositeSliceContent.d.ts +739 -0
  8. package/lib/content/fields/slices/CompositeSliceContent.js +12 -0
  9. package/lib/content/fields/slices/SharedSliceContent.d.ts +343 -346
  10. package/lib/content/fields/slices/SharedSliceContent.js +1 -2
  11. package/lib/content/fields/slices/SimpleSliceContent.d.ts +741 -0
  12. package/lib/content/fields/slices/SimpleSliceContent.js +8 -0
  13. package/lib/content/fields/slices/SlicesContent.d.ts +4440 -0
  14. package/lib/content/fields/slices/SlicesContent.js +23 -0
  15. package/lib/content/fields/slices/index.d.ts +3 -0
  16. package/lib/content/fields/slices/index.js +3 -0
  17. package/lib/content/index.d.ts +1 -0
  18. package/lib/content/index.js +1 -0
  19. package/lib/customtypes/index.d.ts +1 -1
  20. package/lib/customtypes/index.js +1 -1
  21. package/package.json +2 -1
  22. package/src/content/CustomType.ts +20 -0
  23. package/src/content/fields/UIDContent.ts +10 -0
  24. package/src/content/fields/index.ts +1 -0
  25. package/src/content/fields/slices/CompositeSliceContent.ts +12 -0
  26. package/src/content/fields/slices/SharedSliceContent.ts +1 -2
  27. package/src/content/fields/slices/SimpleSliceContent.ts +7 -0
  28. package/src/content/fields/slices/SlicesContent.ts +26 -0
  29. package/src/content/fields/slices/index.ts +3 -0
  30. package/src/content/index.ts +1 -0
  31. package/src/customtypes/index.ts +1 -1
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlicesContent = exports.SliceItemContent = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const t = (0, tslib_1.__importStar)(require("io-ts"));
6
+ const slices_1 = require("../../../documents/widgets/slices");
7
+ const CompositeSliceContent_1 = require("./CompositeSliceContent");
8
+ const SharedSliceContent_1 = require("./SharedSliceContent");
9
+ const SimpleSliceContent_1 = require("./SimpleSliceContent");
10
+ exports.SliceItemContent = t.type({
11
+ key: t.string,
12
+ name: t.string,
13
+ maybeLabel: t.union([t.string, t.undefined]),
14
+ widget: t.union([
15
+ CompositeSliceContent_1.CompositeSliceContent,
16
+ SharedSliceContent_1.SharedSliceContent,
17
+ SimpleSliceContent_1.SimpleSliceContent,
18
+ ]),
19
+ });
20
+ exports.SlicesContent = t.type({
21
+ __TYPE__: t.literal(slices_1.SlicesContentType),
22
+ value: t.array(exports.SliceItemContent),
23
+ });
@@ -1 +1,4 @@
1
+ export * from "./CompositeSliceContent";
1
2
  export * from "./SharedSliceContent";
3
+ export * from "./SimpleSliceContent";
4
+ export * from "./SlicesContent";
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ (0, tslib_1.__exportStar)(require("./CompositeSliceContent"), exports);
4
5
  (0, tslib_1.__exportStar)(require("./SharedSliceContent"), exports);
6
+ (0, tslib_1.__exportStar)(require("./SimpleSliceContent"), exports);
7
+ (0, tslib_1.__exportStar)(require("./SlicesContent"), exports);
@@ -1 +1,2 @@
1
+ export * from "./CustomType";
1
2
  export * from "./fields";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ (0, tslib_1.__exportStar)(require("./CustomType"), exports);
4
5
  (0, tslib_1.__exportStar)(require("./fields"), exports);
@@ -1,4 +1,4 @@
1
- export * as Comparators from "./diff";
2
1
  export * from "./CustomType";
2
+ export * as Comparators from "./diff";
3
3
  export * as Section from "./Section";
4
4
  export * as Widgets from "./widgets";
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Widgets = exports.Section = exports.Comparators = void 0;
4
4
  const tslib_1 = require("tslib");
5
- exports.Comparators = (0, tslib_1.__importStar)(require("./diff"));
6
5
  (0, tslib_1.__exportStar)(require("./CustomType"), exports);
6
+ exports.Comparators = (0, tslib_1.__importStar)(require("./diff"));
7
7
  exports.Section = (0, tslib_1.__importStar)(require("./Section"));
8
8
  exports.Widgets = (0, tslib_1.__importStar)(require("./widgets"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -40,6 +40,7 @@
40
40
  "tslib": "^2.3.1"
41
41
  },
42
42
  "devDependencies": {
43
+ "@fast-check/jest": "^1.4.0",
43
44
  "@relmify/jest-fp-ts": "^1.1.1",
44
45
  "@types/jest": "^27.4.0",
45
46
  "@typescript-eslint/eslint-plugin": "^5.8.1",
@@ -0,0 +1,20 @@
1
+ import * as t from "io-ts"
2
+
3
+ import { WidgetKey as KeyForWidgetContent } from "../documents/widgets"
4
+ import {
5
+ GroupContent,
6
+ NestableContent,
7
+ SlicesContent,
8
+ UIDContent,
9
+ } from "./fields"
10
+
11
+ export const WidgetKey = KeyForWidgetContent
12
+
13
+ const WidgetContent = t.union([
14
+ SlicesContent,
15
+ UIDContent,
16
+ NestableContent,
17
+ GroupContent,
18
+ ])
19
+ export const CustomTypeContent = t.record(WidgetKey, WidgetContent)
20
+ export type CustomTypeContent = t.TypeOf<typeof CustomTypeContent>
@@ -0,0 +1,10 @@
1
+ import * as t from "io-ts"
2
+
3
+ import { UIDContentType } from "../../documents/widgets/UIDContent"
4
+
5
+ export const UIDContent = t.type({
6
+ __TYPE__: t.literal(UIDContentType),
7
+ value: t.string,
8
+ })
9
+
10
+ export type UIDContent = t.TypeOf<typeof UIDContent>
@@ -1,3 +1,4 @@
1
1
  export * from "./GroupContent"
2
2
  export * from "./nestable"
3
3
  export * from "./slices"
4
+ export * from "./UIDContent"
@@ -0,0 +1,12 @@
1
+ import * as t from "io-ts"
2
+
3
+ import { CompositeSliceContentType } from "../../../documents/widgets/slices"
4
+ import { NestableContent } from "../nestable"
5
+
6
+ export const CompositeSliceContent = t.type({
7
+ __TYPE__: t.literal(CompositeSliceContentType),
8
+ repeat: t.array(t.tuple([t.string, NestableContent])),
9
+ "non-repeat": t.record(t.string, NestableContent),
10
+ })
11
+
12
+ export type CompositeSliceContent = t.TypeOf<typeof CompositeSliceContent>
@@ -1,14 +1,13 @@
1
1
  import * as t from "io-ts"
2
2
 
3
3
  import { SharedSliceContentType as type } from "../../../documents/widgets/slices"
4
- import { GroupItemContent } from "../GroupContent"
5
4
  import { NestableContent } from "../nestable"
6
5
 
7
6
  export const SharedSliceContent = t.strict({
8
7
  __TYPE__: t.literal(type),
9
8
  variation: t.string,
10
9
  primary: t.record(t.string, NestableContent),
11
- items: t.array(GroupItemContent),
10
+ items: t.array(t.tuple([t.string, NestableContent])),
12
11
  })
13
12
  export type SharedSliceContent = t.TypeOf<typeof SharedSliceContent>
14
13
  export const SharedSliceContentType = type
@@ -0,0 +1,7 @@
1
+ import * as t from "io-ts"
2
+
3
+ import { GroupContent } from "../GroupContent"
4
+ import { NestableContent } from "../nestable"
5
+
6
+ export const SimpleSliceContent = t.union([NestableContent, GroupContent])
7
+ export type SimpleSliceContent = t.TypeOf<typeof SimpleSliceContent>
@@ -0,0 +1,26 @@
1
+ import * as t from "io-ts"
2
+
3
+ import { SlicesContentType } from "../../../documents/widgets/slices"
4
+ import { CompositeSliceContent } from "./CompositeSliceContent"
5
+ import { SharedSliceContent } from "./SharedSliceContent"
6
+ import { SimpleSliceContent } from "./SimpleSliceContent"
7
+
8
+ export const SliceItemContent = t.type({
9
+ key: t.string,
10
+ name: t.string,
11
+ maybeLabel: t.union([t.string, t.undefined]),
12
+ widget: t.union([
13
+ CompositeSliceContent,
14
+ SharedSliceContent,
15
+ SimpleSliceContent,
16
+ ]),
17
+ })
18
+
19
+ export type SliceContentItem = t.TypeOf<typeof SliceItemContent>
20
+
21
+ export const SlicesContent = t.type({
22
+ __TYPE__: t.literal(SlicesContentType),
23
+ value: t.array(SliceItemContent),
24
+ })
25
+
26
+ export type SlicesContent = t.TypeOf<typeof SlicesContent>
@@ -1 +1,4 @@
1
+ export * from "./CompositeSliceContent"
1
2
  export * from "./SharedSliceContent"
3
+ export * from "./SimpleSliceContent"
4
+ export * from "./SlicesContent"
@@ -1 +1,2 @@
1
+ export * from "./CustomType"
1
2
  export * from "./fields"
@@ -1,4 +1,4 @@
1
- export * as Comparators from "./diff"
2
1
  export * from "./CustomType"
2
+ export * as Comparators from "./diff"
3
3
  export * as Section from "./Section"
4
4
  export * as Widgets from "./widgets"