@prismicio/types-internal 3.1.0 → 3.2.0-alpha.1

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.
@@ -183,7 +183,7 @@ function traverseDocument({ document, customType, }) {
183
183
  key,
184
184
  apiId: key,
185
185
  model: (fieldModel === null || fieldModel === void 0 ? void 0 : fieldModel.type) === "Link" && ((_a = fieldModel.config) === null || _a === void 0 ? void 0 : _a.repeat)
186
- ? fieldModel
186
+ ? { ...fieldModel, config: { ...fieldModel.config, repeat: false } }
187
187
  : undefined,
188
188
  content,
189
189
  })(transformWidget);
@@ -5,12 +5,14 @@ import type { LegacyContentCtx, WithTypes } from "../LegacyContentCtx";
5
5
  export declare const RepeatableContent: t.ExactC<t.TypeC<{
6
6
  __TYPE__: t.LiteralC<"RepeatableContent">;
7
7
  type: t.LiteralC<"Link">;
8
- value: t.ArrayC<t.ExactC<t.TypeC<{
8
+ value: t.ArrayC<t.IntersectionC<[t.ExactC<t.TypeC<{
9
+ key: t.Type<string, string, unknown>;
10
+ }>>, t.ExactC<t.TypeC<{
9
11
  __TYPE__: t.LiteralC<"LinkContent">;
10
12
  value: t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
11
13
  __TYPE__: t.LiteralC<"ImageLink">;
12
- }>>, t.UnionC<[t.IntersectionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
13
- kind: t.StringC;
14
+ }>>, t.IntersectionC<[t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
15
+ kind: t.Type<"image", "image", unknown>;
14
16
  id: t.StringC;
15
17
  url: t.StringC;
16
18
  height: t.StringC;
@@ -19,38 +21,35 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
19
21
  name: t.StringC;
20
22
  }>>, t.ExactC<t.PartialC<{
21
23
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
22
- }>>]>, t.ExactC<t.PartialC<{
23
- text: t.StringC;
24
24
  }>>]>, t.ExactC<t.TypeC<{
25
25
  kind: t.LiteralC<"image">;
26
+ }>>]>, t.ExactC<t.PartialC<{
26
27
  text: t.StringC;
27
28
  }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
28
29
  __TYPE__: t.LiteralC<"FileLink">;
29
- }>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
30
- kind: t.StringC;
30
+ }>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
31
+ kind: t.Type<"file", "file", unknown>;
31
32
  id: t.StringC;
32
33
  url: t.StringC;
33
34
  name: t.StringC;
34
35
  size: t.StringC;
35
36
  }>, t.PartialC<{
36
37
  date: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
37
- }>]>>, t.ExactC<t.PartialC<{
38
- text: t.StringC;
39
- }>>]>, t.ExactC<t.TypeC<{
38
+ }>]>>, t.ExactC<t.TypeC<{
40
39
  kind: t.LiteralC<"file">;
40
+ }>>]>, t.ExactC<t.PartialC<{
41
41
  text: t.StringC;
42
42
  }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
43
43
  __TYPE__: t.LiteralC<"DocumentLink">;
44
- }>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.TypeC<{
44
+ }>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.TypeC<{
45
45
  id: t.Type<string, string, unknown>;
46
- }>>, t.ExactC<t.PartialC<{
47
- text: t.StringC;
48
- }>>]>, t.ExactC<t.TypeC<{
46
+ }>>, t.ExactC<t.TypeC<{
49
47
  kind: t.LiteralC<"document">;
48
+ }>>]>, t.ExactC<t.PartialC<{
50
49
  text: t.StringC;
51
50
  }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
52
51
  __TYPE__: t.LiteralC<"ExternalLink">;
53
- }>>, t.UnionC<[t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
52
+ }>>, t.IntersectionC<[t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
54
53
  url: t.StringC;
55
54
  }>, t.PartialC<{
56
55
  kind: t.LiteralC<"web">;
@@ -60,33 +59,37 @@ export declare const RepeatableContent: t.ExactC<t.TypeC<{
60
59
  }, {
61
60
  title?: string;
62
61
  }, unknown>, t.NullC, t.UndefinedC]>;
63
- }>]>>, t.ExactC<t.PartialC<{
64
- text: t.StringC;
65
- }>>]>, t.ExactC<t.TypeC<{
62
+ }>]>>, t.ExactC<t.TypeC<{
66
63
  kind: t.LiteralC<"web">;
64
+ }>>]>, t.ExactC<t.PartialC<{
67
65
  text: t.StringC;
68
66
  }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
69
67
  __TYPE__: t.LiteralC<"MediaLink">;
70
- }>>, t.ExactC<t.TypeC<{
68
+ }>>, t.IntersectionC<[t.ExactC<t.TypeC<{
71
69
  kind: t.LiteralC<"media">;
70
+ }>>, t.ExactC<t.PartialC<{
72
71
  text: t.StringC;
73
- }>>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
72
+ }>>]>]>, t.IntersectionC<[t.ExactC<t.TypeC<{
74
73
  __TYPE__: t.LiteralC<"AnyLink">;
75
- }>>, t.ExactC<t.TypeC<{
74
+ }>>, t.ExactC<t.IntersectionC<[t.TypeC<{
75
+ kind: t.LiteralC<"any">;
76
+ }>, t.PartialC<{
76
77
  text: t.StringC;
77
- }>>]>]>;
78
- }>>>;
78
+ }>]>>]>]>;
79
+ }>>]>>;
79
80
  }>>;
80
81
  export declare type RepeatableContent = t.TypeOf<typeof RepeatableContent>;
81
82
  export declare const isRepeatableContent: t.Is<{
82
83
  __TYPE__: "RepeatableContent";
83
84
  type: "Link";
84
- value: {
85
+ value: ({
86
+ key: string;
87
+ } & {
85
88
  __TYPE__: "LinkContent";
86
89
  value: ({
87
90
  __TYPE__: "ImageLink";
88
- } & (({
89
- kind: string;
91
+ } & ((({
92
+ kind: "image";
90
93
  id: string;
91
94
  url: string;
92
95
  height: string;
@@ -95,43 +98,41 @@ export declare const isRepeatableContent: t.Is<{
95
98
  name: string;
96
99
  } & {
97
100
  date?: string | null | undefined;
98
- } & {
99
- text?: string;
100
101
  }) | {
101
102
  kind: "image";
102
- text: string;
103
+ }) & {
104
+ text?: string;
103
105
  })) | ({
104
106
  __TYPE__: "FileLink";
105
- } & (({
106
- kind: string;
107
+ } & ((({
108
+ kind: "file";
107
109
  id: string;
108
110
  url: string;
109
111
  name: string;
110
112
  size: string;
111
113
  } & {
112
114
  date?: string | null | undefined;
113
- } & {
114
- text?: string;
115
115
  }) | {
116
116
  kind: "file";
117
- text: string;
117
+ }) & {
118
+ text?: string;
118
119
  })) | ({
119
120
  __TYPE__: "MediaLink";
120
121
  } & {
121
122
  kind: "media";
122
- text: string;
123
+ } & {
124
+ text?: string;
123
125
  }) | ({
124
126
  __TYPE__: "DocumentLink";
125
127
  } & (({
126
128
  id: string;
127
- } & {
128
- text?: string;
129
- }) | {
129
+ } | {
130
130
  kind: "document";
131
- text: string;
131
+ }) & {
132
+ text?: string;
132
133
  })) | ({
133
134
  __TYPE__: "ExternalLink";
134
- } & (({
135
+ } & ((({
135
136
  url: string;
136
137
  } & {
137
138
  kind?: "web";
@@ -139,17 +140,18 @@ export declare const isRepeatableContent: t.Is<{
139
140
  preview?: {
140
141
  title?: string;
141
142
  } | null | undefined;
142
- } & {
143
- text?: string;
144
143
  }) | {
145
144
  kind: "web";
146
- text: string;
145
+ }) & {
146
+ text?: string;
147
147
  })) | ({
148
148
  __TYPE__: "AnyLink";
149
149
  } & {
150
- text: string;
150
+ kind: "any";
151
+ } & {
152
+ text?: string;
151
153
  });
152
- }[];
154
+ })[];
153
155
  }>;
154
156
  export declare const RepeatableLegacy: (ctx: LegacyContentCtx, fieldType: "Link") => t.Type<RepeatableContent, WithTypes<Array<unknown>>, unknown>;
155
157
  export declare type RepeatableCustomType = Link;
@@ -66,7 +66,7 @@ function traverseRepeatableContent({ path, key, apiId, model, content, }) {
66
66
  path: itemPath,
67
67
  key: key,
68
68
  apiId: apiId,
69
- model: model,
69
+ model,
70
70
  content: fieldContent,
71
71
  });
72
72
  // Can happen if the transform function returns undefined to filter out a field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "3.1.0",
3
+ "version": "3.2.0-alpha.1",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -301,7 +301,7 @@ export function traverseDocument({
301
301
  apiId: key,
302
302
  model:
303
303
  fieldModel?.type === "Link" && fieldModel.config?.repeat
304
- ? fieldModel
304
+ ? { ...fieldModel, config: { ...fieldModel.config, repeat: false } }
305
305
  : undefined,
306
306
  content,
307
307
  })(transformWidget)
@@ -117,7 +117,7 @@ export function traverseRepeatableContent({
117
117
  path: itemPath,
118
118
  key: key,
119
119
  apiId: apiId,
120
- model: model,
120
+ model,
121
121
  content: fieldContent,
122
122
  })
123
123