@prismicio/client 7.0.0-alpha.4 → 7.0.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.
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +4 -4
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/createClient.cjs +24 -24
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +28 -28
- package/dist/createClient.js +24 -24
- package/dist/createClient.js.map +1 -1
- package/dist/filter.cjs +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.ts +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.ts +2 -2
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +5 -5
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +21 -21
- package/dist/helpers/asHTML.js +5 -5
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +5 -5
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +3 -3
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +6 -6
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +14 -14
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +5 -5
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +8 -8
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +3 -1
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.ts +24 -20
- package/dist/helpers/isFilled.js +3 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/api/repository.d.ts +2 -2
- package/dist/types/model/boolean.d.ts +1 -1
- package/dist/types/model/color.d.ts +1 -1
- package/dist/types/model/contentRelationship.d.ts +1 -1
- package/dist/types/model/customType.d.ts +11 -11
- package/dist/types/model/date.d.ts +1 -1
- package/dist/types/model/embed.d.ts +1 -1
- package/dist/types/model/geoPoint.d.ts +1 -1
- package/dist/types/model/group.d.ts +1 -1
- package/dist/types/model/image.d.ts +3 -3
- package/dist/types/model/{integrationFields.d.ts → integration.d.ts} +3 -3
- package/dist/types/model/keyText.d.ts +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.ts +2 -2
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -1
- package/dist/types/model/number.d.ts +1 -1
- package/dist/types/model/richText.d.ts +3 -3
- package/dist/types/model/select.d.ts +1 -1
- package/dist/types/model/sharedSlice.d.ts +2 -2
- package/dist/types/model/sharedSliceVariation.d.ts +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.ts +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.ts +2 -2
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/timestamp.d.ts +1 -1
- package/dist/types/model/title.d.ts +1 -1
- package/dist/types/model/types.cjs +5 -1
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.ts +10 -6
- package/dist/types/model/types.js +5 -1
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.ts +1 -1
- package/dist/types/value/boolean.d.ts +1 -1
- package/dist/types/value/color.d.ts +1 -1
- package/dist/types/value/contentRelationship.d.ts +1 -1
- package/dist/types/value/date.d.ts +1 -1
- package/dist/types/value/document.d.ts +4 -4
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.ts +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.ts +1 -1
- package/dist/types/value/group.d.ts +1 -1
- package/dist/types/value/image.d.ts +3 -3
- package/dist/types/value/{integrationFields.d.ts → integration.d.ts} +2 -2
- package/dist/types/value/keyText.d.ts +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.ts +2 -2
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +2 -2
- package/dist/types/value/number.d.ts +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.ts +26 -26
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.ts +1 -1
- package/dist/types/value/sharedSlice.d.ts +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +3 -0
- package/dist/types/value/slice.d.ts +1 -1
- package/dist/types/value/timestamp.d.ts +1 -1
- package/dist/types/value/title.d.ts +1 -1
- package/dist/types/value/types.d.ts +2 -2
- package/dist/types/webhook/apiUpdate.d.ts +1 -1
- package/package.json +2 -2
- package/src/buildQueryURL.ts +4 -4
- package/src/createClient.ts +28 -28
- package/src/filter.ts +1 -1
- package/src/helpers/asDate.ts +2 -2
- package/src/helpers/asHTML.ts +28 -29
- package/src/helpers/asImagePixelDensitySrcSet.ts +5 -5
- package/src/helpers/asImageSrc.ts +3 -3
- package/src/helpers/asImageWidthSrcSet.ts +6 -6
- package/src/helpers/asLink.ts +18 -18
- package/src/helpers/asLinkAttrs.ts +5 -5
- package/src/helpers/asText.ts +8 -8
- package/src/helpers/documentToLinkField.ts +1 -1
- package/src/helpers/isFilled.ts +27 -22
- package/src/index.ts +19 -3
- package/src/types/api/repository.ts +2 -2
- package/src/types/model/boolean.ts +1 -1
- package/src/types/model/color.ts +1 -1
- package/src/types/model/contentRelationship.ts +1 -1
- package/src/types/model/customType.ts +11 -11
- package/src/types/model/date.ts +1 -1
- package/src/types/model/embed.ts +1 -1
- package/src/types/model/geoPoint.ts +1 -1
- package/src/types/model/group.ts +1 -1
- package/src/types/model/image.ts +3 -3
- package/src/types/model/{integrationFields.ts → integration.ts} +3 -3
- package/src/types/model/keyText.ts +1 -1
- package/src/types/model/link.ts +2 -2
- package/src/types/model/linkToMedia.ts +1 -1
- package/src/types/model/number.ts +1 -1
- package/src/types/model/richText.ts +3 -3
- package/src/types/model/select.ts +1 -1
- package/src/types/model/sharedSlice.ts +2 -2
- package/src/types/model/sharedSliceVariation.ts +1 -1
- package/src/types/model/slice.ts +1 -1
- package/src/types/model/sliceZone.ts +2 -2
- package/src/types/model/timestamp.ts +1 -1
- package/src/types/model/title.ts +1 -1
- package/src/types/model/types.ts +10 -6
- package/src/types/model/uid.ts +1 -1
- package/src/types/value/boolean.ts +1 -1
- package/src/types/value/color.ts +1 -1
- package/src/types/value/contentRelationship.ts +1 -1
- package/src/types/value/date.ts +1 -1
- package/src/types/value/document.ts +4 -4
- package/src/types/value/embed.ts +1 -1
- package/src/types/value/geoPoint.ts +1 -1
- package/src/types/value/group.ts +1 -1
- package/src/types/value/image.ts +4 -4
- package/src/types/value/{integrationFields.ts → integration.ts} +2 -2
- package/src/types/value/keyText.ts +1 -1
- package/src/types/value/link.ts +2 -2
- package/src/types/value/linkToMedia.ts +2 -2
- package/src/types/value/number.ts +1 -1
- package/src/types/value/richText.ts +26 -26
- package/src/types/value/select.ts +1 -1
- package/src/types/value/sharedSlice.ts +1 -1
- package/src/types/value/sharedSliceVariation.ts +3 -0
- package/src/types/value/slice.ts +1 -1
- package/src/types/value/timestamp.ts +1 -1
- package/src/types/value/title.ts +1 -1
- package/src/types/value/types.ts +2 -2
- package/src/types/webhook/apiUpdate.ts +1 -1
package/src/helpers/asText.ts
CHANGED
|
@@ -28,13 +28,13 @@ type AsTextReturnType<Field extends RichTextField | null | undefined> =
|
|
|
28
28
|
|
|
29
29
|
export const asText: {
|
|
30
30
|
/**
|
|
31
|
-
* Serializes a
|
|
31
|
+
* Serializes a rich text or title field to a plain text string.
|
|
32
32
|
*
|
|
33
|
-
* @param richTextField - A
|
|
33
|
+
* @param richTextField - A rich text or title field from Prismic
|
|
34
34
|
* @param config - Configuration that determines the output of `asText()`
|
|
35
35
|
*
|
|
36
|
-
* @returns Plain text equivalent of the provided
|
|
37
|
-
* @see Templating
|
|
36
|
+
* @returns Plain text equivalent of the provided rich text or title field
|
|
37
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
38
38
|
*/
|
|
39
39
|
<Field extends RichTextField | null | undefined>(
|
|
40
40
|
richTextField: Field,
|
|
@@ -42,13 +42,13 @@ export const asText: {
|
|
|
42
42
|
): AsTextReturnType<Field>;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* Serializes a
|
|
45
|
+
* Serializes a rich text or title field to a plain text string.
|
|
46
46
|
*
|
|
47
|
-
* @param richTextField - A
|
|
47
|
+
* @param richTextField - A rich text or title field from Prismic
|
|
48
48
|
* @param separator - Separator used to join each element, defaults to a space
|
|
49
49
|
*
|
|
50
|
-
* @returns Plain text equivalent of the provided
|
|
51
|
-
* @see Templating
|
|
50
|
+
* @returns Plain text equivalent of the provided rich text or title field
|
|
51
|
+
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
52
52
|
*
|
|
53
53
|
* @deprecated Use object-style configuration instead.
|
|
54
54
|
*
|
|
@@ -32,7 +32,7 @@ export const documentToLinkField = <
|
|
|
32
32
|
tags: prismicDocument.tags,
|
|
33
33
|
lang: prismicDocument.lang,
|
|
34
34
|
url: prismicDocument.url == null ? undefined : prismicDocument.url,
|
|
35
|
-
slug: prismicDocument.slugs?.[0], // Slug field is not available with
|
|
35
|
+
slug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL
|
|
36
36
|
// The REST API does not include a `data` property if the data
|
|
37
37
|
// object is empty.
|
|
38
38
|
//
|
package/src/helpers/isFilled.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { AnyOEmbed, EmbedField } from "../types/value/embed";
|
|
|
5
5
|
import type { GeoPointField } from "../types/value/geoPoint";
|
|
6
6
|
import type { GroupField } from "../types/value/group";
|
|
7
7
|
import type { ImageField, ImageFieldImage } from "../types/value/image";
|
|
8
|
-
import type {
|
|
8
|
+
import type { IntegrationField } from "../types/value/integration";
|
|
9
9
|
import type { KeyTextField } from "../types/value/keyText";
|
|
10
10
|
import type { LinkField } from "../types/value/link";
|
|
11
11
|
import type { LinkToMediaField } from "../types/value/linkToMedia";
|
|
@@ -44,9 +44,9 @@ const isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* Determines if a
|
|
47
|
+
* Determines if a rich text field is filled.
|
|
48
48
|
*
|
|
49
|
-
* @param field -
|
|
49
|
+
* @param field - rich text field to check.
|
|
50
50
|
*
|
|
51
51
|
* @returns `true` if `field` is filled, `false` otherwise.
|
|
52
52
|
*/
|
|
@@ -63,7 +63,7 @@ export const richText = (
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* Determines if a
|
|
66
|
+
* Determines if a title field is filled.
|
|
67
67
|
*
|
|
68
68
|
* @param field - Title field to check.
|
|
69
69
|
*
|
|
@@ -87,7 +87,7 @@ export const imageThumbnail = (
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Determines if an
|
|
90
|
+
* Determines if an image field is filled.
|
|
91
91
|
*
|
|
92
92
|
* @param field - Image field to check.
|
|
93
93
|
*
|
|
@@ -100,7 +100,7 @@ export const image = imageThumbnail as <
|
|
|
100
100
|
) => field is ImageField<ThumbnailNames, "filled">;
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* Determines if a
|
|
103
|
+
* Determines if a link field is filled.
|
|
104
104
|
*
|
|
105
105
|
* @param field - Link field to check.
|
|
106
106
|
*
|
|
@@ -119,9 +119,9 @@ export const link = <
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Determines if a
|
|
122
|
+
* Determines if a link to media field is filled.
|
|
123
123
|
*
|
|
124
|
-
* @param field - Link to
|
|
124
|
+
* @param field - Link to media field to check.
|
|
125
125
|
*
|
|
126
126
|
* @returns `true` if `field` is filled, `false` otherwise.
|
|
127
127
|
*/
|
|
@@ -130,7 +130,7 @@ export const linkToMedia = link as (
|
|
|
130
130
|
) => field is LinkToMediaField<"filled">;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
-
* Determines if a
|
|
133
|
+
* Determines if a content relationship field is filled.
|
|
134
134
|
*
|
|
135
135
|
* @param field - Content Relationship field to check.
|
|
136
136
|
*
|
|
@@ -155,7 +155,7 @@ export const contentRelationship = link as <
|
|
|
155
155
|
>;
|
|
156
156
|
|
|
157
157
|
/**
|
|
158
|
-
* Determines if a
|
|
158
|
+
* Determines if a date field is filled.
|
|
159
159
|
*
|
|
160
160
|
* @param field - Date field to check.
|
|
161
161
|
*
|
|
@@ -166,7 +166,7 @@ export const date = isNonNullish as (
|
|
|
166
166
|
) => field is DateField<"filled">;
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
|
-
* Determines if a
|
|
169
|
+
* Determines if a timestamp field is filled.
|
|
170
170
|
*
|
|
171
171
|
* @param field - Timestamp field to check.
|
|
172
172
|
*
|
|
@@ -177,7 +177,7 @@ export const timestamp = isNonNullish as (
|
|
|
177
177
|
) => field is TimestampField<"filled">;
|
|
178
178
|
|
|
179
179
|
/**
|
|
180
|
-
* Determines if a
|
|
180
|
+
* Determines if a color field is filled.
|
|
181
181
|
*
|
|
182
182
|
* @param field - Color field to check.
|
|
183
183
|
*
|
|
@@ -188,7 +188,7 @@ export const color = isNonNullish as (
|
|
|
188
188
|
) => field is ColorField<"filled">;
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
|
-
* Determines if a
|
|
191
|
+
* Determines if a number field is filled.
|
|
192
192
|
*
|
|
193
193
|
* @param field - Number field to check.
|
|
194
194
|
*
|
|
@@ -199,7 +199,7 @@ export const number = isNonNullish as (
|
|
|
199
199
|
) => field is NumberField<"filled">;
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
|
-
* Determines if a
|
|
202
|
+
* Determines if a key text field is filled.
|
|
203
203
|
*
|
|
204
204
|
* @param field - Key Text field to check.
|
|
205
205
|
*
|
|
@@ -212,7 +212,7 @@ export const keyText = (
|
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
* Determines if a
|
|
215
|
+
* Determines if a select field is filled.
|
|
216
216
|
*
|
|
217
217
|
* @param field - Select field to check.
|
|
218
218
|
*
|
|
@@ -223,7 +223,7 @@ export const select = isNonNullish as <Enum extends string>(
|
|
|
223
223
|
) => field is SelectField<Enum, "filled">;
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
|
-
* Determines if an
|
|
226
|
+
* Determines if an embed field is filled.
|
|
227
227
|
*
|
|
228
228
|
* @param field - Embed field to check.
|
|
229
229
|
*
|
|
@@ -236,7 +236,7 @@ export const embed = <Field extends EmbedField<AnyOEmbed>>(
|
|
|
236
236
|
};
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
* Determines if a
|
|
239
|
+
* Determines if a geopoint field is filled.
|
|
240
240
|
*
|
|
241
241
|
* @param field - GeoPoint field to check.
|
|
242
242
|
*
|
|
@@ -249,17 +249,22 @@ export const geoPoint = (
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
* Determines if an
|
|
252
|
+
* Determines if an integration field is filled.
|
|
253
253
|
*
|
|
254
|
-
* @param field - Integration
|
|
254
|
+
* @param field - Integration field to check.
|
|
255
255
|
*
|
|
256
256
|
* @returns `true` if `field` is filled, `false` otherwise.
|
|
257
257
|
*/
|
|
258
|
-
export const
|
|
258
|
+
export const integrationField = isNonNullish as <
|
|
259
259
|
Data extends Record<string, unknown>,
|
|
260
260
|
>(
|
|
261
|
-
field:
|
|
262
|
-
) => field is
|
|
261
|
+
field: IntegrationField<Data> | null | undefined,
|
|
262
|
+
) => field is IntegrationField<Data, "filled">;
|
|
263
|
+
/**
|
|
264
|
+
* @deprecated Renamed to `integrationField`.
|
|
265
|
+
*/
|
|
266
|
+
// TODO: Remove when we remove support for deprecated `integrationFields` export.
|
|
267
|
+
export const integrationFields = integrationField;
|
|
263
268
|
|
|
264
269
|
/**
|
|
265
270
|
* Determines if a Group has at least one item.
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Imports are used for deprecations.
|
|
2
|
+
import type { CustomTypeModelIntegrationField } from "./types/model/integration";
|
|
3
|
+
import type { IntegrationField } from "./types/value/integration";
|
|
4
|
+
|
|
2
5
|
import type {
|
|
3
6
|
HTMLRichTextFunctionSerializer,
|
|
4
7
|
HTMLRichTextMapSerializer,
|
|
@@ -196,7 +199,12 @@ export type { SelectField } from "./types/value/select";
|
|
|
196
199
|
export type { TimestampField } from "./types/value/timestamp";
|
|
197
200
|
export type { GeoPointField } from "./types/value/geoPoint";
|
|
198
201
|
|
|
199
|
-
|
|
202
|
+
/**
|
|
203
|
+
* @deprecated Renamed to `IntegrationField`
|
|
204
|
+
*/
|
|
205
|
+
// TODO: Remove when we remove support for deprecated `IntegrationFields` export.
|
|
206
|
+
type IntegrationFields = IntegrationField;
|
|
207
|
+
export { IntegrationField, IntegrationFields };
|
|
200
208
|
|
|
201
209
|
export type { GroupField } from "./types/value/group";
|
|
202
210
|
|
|
@@ -247,7 +255,15 @@ export type { CustomTypeModelSelectField } from "./types/model/select";
|
|
|
247
255
|
export type { CustomTypeModelTimestampField } from "./types/model/timestamp";
|
|
248
256
|
export type { CustomTypeModelGeoPointField } from "./types/model/geoPoint";
|
|
249
257
|
|
|
250
|
-
|
|
258
|
+
/**
|
|
259
|
+
* @deprecated Renamed to `CustomTypeModelIntegrationField`.
|
|
260
|
+
*/
|
|
261
|
+
// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.
|
|
262
|
+
type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
|
|
263
|
+
export {
|
|
264
|
+
CustomTypeModelIntegrationField,
|
|
265
|
+
CustomTypeModelIntegrationFieldsField,
|
|
266
|
+
};
|
|
251
267
|
export type { CustomTypeModelGroupField } from "./types/model/group";
|
|
252
268
|
export type {
|
|
253
269
|
CustomTypeModelSliceZoneField,
|
|
@@ -15,7 +15,7 @@ export interface Repository {
|
|
|
15
15
|
refs: Ref[];
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* An identifier used to query content with the latest
|
|
18
|
+
* An identifier used to query content with the latest integration fields
|
|
19
19
|
* data.
|
|
20
20
|
*/
|
|
21
21
|
integrationFieldsRef: string | null;
|
|
@@ -28,7 +28,7 @@ export interface Repository {
|
|
|
28
28
|
languages: Language[];
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* A list of the repository's
|
|
31
|
+
* A list of the repository's custom type API IDs mapped to their
|
|
32
32
|
* human-readable name.
|
|
33
33
|
*/
|
|
34
34
|
types: Record<string, string>;
|
package/src/types/model/color.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CustomTypeModelFieldType } from "./types";
|
|
|
3
3
|
import type { CustomTypeModelLinkSelectType } from "./link";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A
|
|
6
|
+
* A content relationship custom type field.
|
|
7
7
|
*
|
|
8
8
|
* More details:
|
|
9
9
|
* {@link https://prismic.io/docs/content-relationship}
|
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { CustomTypeModelField } from "./types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A Prismic
|
|
4
|
+
* A Prismic custom type model.
|
|
5
5
|
*
|
|
6
|
-
* @typeParam ID - API ID of the
|
|
7
|
-
* @typeParam Definition - The
|
|
6
|
+
* @typeParam ID - API ID of the custom type.
|
|
7
|
+
* @typeParam Definition - The custom type's tabs and their fields.
|
|
8
8
|
*/
|
|
9
9
|
export interface CustomTypeModel<
|
|
10
10
|
ID extends string = string,
|
|
11
11
|
Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition,
|
|
12
12
|
> {
|
|
13
13
|
/**
|
|
14
|
-
* The ID of the
|
|
14
|
+
* The ID of the custom type model.
|
|
15
15
|
*/
|
|
16
16
|
id: ID;
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* The human readable name of the
|
|
19
|
+
* The human readable name of the custom type model.
|
|
20
20
|
*/
|
|
21
21
|
// TODO: Revert to `label?: string | null` if `label` can be partial in: https://github.com/prismicio/prismic-types-internal/blob/HEAD/src/customtypes/CustomType.ts#L39
|
|
22
22
|
label: string | null | undefined;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Determines if more than one document for the
|
|
25
|
+
* Determines if more than one document for the custom type can be created.
|
|
26
26
|
*/
|
|
27
27
|
repeatable: boolean;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* The
|
|
30
|
+
* The custom type model definition.
|
|
31
31
|
*/
|
|
32
32
|
json: Definition;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* Determines if new documents for the
|
|
35
|
+
* Determines if new documents for the custom type can be created.
|
|
36
36
|
*/
|
|
37
37
|
status: boolean;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* A Prismic
|
|
41
|
+
* A Prismic custom type's tabs and their fields.
|
|
42
42
|
*
|
|
43
|
-
* @typeParam TabName - Names of
|
|
43
|
+
* @typeParam TabName - Names of custom type tabs.
|
|
44
44
|
*/
|
|
45
45
|
export type CustomTypeModelDefinition<TabName extends string = string> = Record<
|
|
46
46
|
TabName,
|
|
@@ -48,7 +48,7 @@ export type CustomTypeModelDefinition<TabName extends string = string> = Record<
|
|
|
48
48
|
>;
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* A
|
|
51
|
+
* A custom type's tab. Each tab can contain any number of fields but is limited
|
|
52
52
|
* to one Slice Zone.
|
|
53
53
|
*
|
|
54
54
|
* @typeParam FieldName - API IDs of the fields.
|
package/src/types/model/date.ts
CHANGED
package/src/types/model/embed.ts
CHANGED
package/src/types/model/group.ts
CHANGED
package/src/types/model/image.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomTypeModelFieldType } from "./types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Dimension constraints for an
|
|
4
|
+
* Dimension constraints for an image custom type field.
|
|
5
5
|
*
|
|
6
6
|
* More details: {@link https://prismic.io/docs/image}
|
|
7
7
|
*/
|
|
@@ -11,7 +11,7 @@ export interface CustomTypeModelImageConstraint {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* A thumbnail for an
|
|
14
|
+
* A thumbnail for an image custom type field.
|
|
15
15
|
*
|
|
16
16
|
* More details: {@link https://prismic.io/docs/image}
|
|
17
17
|
*/
|
|
@@ -21,7 +21,7 @@ export interface CustomTypeModelImageThumbnail<Name extends string = string>
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* An
|
|
24
|
+
* An image custom type field.
|
|
25
25
|
*
|
|
26
26
|
* More details: {@link https://prismic.io/docs/image}
|
|
27
27
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { CustomTypeModelFieldType } from "./types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* An
|
|
4
|
+
* An integration custom type field.
|
|
5
5
|
*
|
|
6
6
|
* More details: {@link https://prismic.io/docs/integration-fields}
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
9
|
-
type: typeof CustomTypeModelFieldType.
|
|
8
|
+
export interface CustomTypeModelIntegrationField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.Integration;
|
|
10
10
|
config?: {
|
|
11
11
|
label?: string | null;
|
|
12
12
|
placeholder?: string;
|
package/src/types/model/link.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomTypeModelFieldType } from "./types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A
|
|
4
|
+
* A link custom type field.
|
|
5
5
|
*
|
|
6
6
|
* More details:
|
|
7
7
|
* {@link https://prismic.io/docs/link}
|
|
@@ -19,7 +19,7 @@ export interface CustomTypeModelLinkField {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Type of a
|
|
22
|
+
* Type of a link custom type field.
|
|
23
23
|
*
|
|
24
24
|
* More details:
|
|
25
25
|
* {@link https://prismic.io/docs/link}
|
|
@@ -3,7 +3,7 @@ import type { CustomTypeModelFieldType } from "./types";
|
|
|
3
3
|
import type { CustomTypeModelLinkSelectType } from "./link";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A
|
|
6
|
+
* A link to media custom type field.
|
|
7
7
|
*
|
|
8
8
|
* More details:
|
|
9
9
|
* {@link https://prismic.io/docs/media}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomTypeModelFieldType } from "./types";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A
|
|
4
|
+
* A rich text custom type field.
|
|
5
5
|
*
|
|
6
6
|
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
7
7
|
*/
|
|
@@ -10,7 +10,7 @@ export type CustomTypeModelRichTextField =
|
|
|
10
10
|
| CustomTypeModelRichTextSingleField;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* A
|
|
13
|
+
* A rich text custom type field which supports multiple blocks of content.
|
|
14
14
|
*
|
|
15
15
|
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
16
16
|
*/
|
|
@@ -25,7 +25,7 @@ export interface CustomTypeModelRichTextMultiField {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* A
|
|
28
|
+
* A rich text custom type field which supports one block of content.
|
|
29
29
|
*
|
|
30
30
|
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
31
31
|
*/
|
|
@@ -2,11 +2,11 @@ import type { SharedSliceModelVariation } from "./sharedSliceVariation";
|
|
|
2
2
|
import type { CustomTypeModelSliceType } from "./sliceZone";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* A Prismic
|
|
5
|
+
* A Prismic shared Slice model.
|
|
6
6
|
*
|
|
7
7
|
* More details: {@link https://prismic.io/docs/slice}
|
|
8
8
|
*
|
|
9
|
-
* @typeParam Variation - A variation for the
|
|
9
|
+
* @typeParam Variation - A variation for the shared Slice.
|
|
10
10
|
*/
|
|
11
11
|
export interface SharedSliceModel<
|
|
12
12
|
ID extends string = string,
|
package/src/types/model/slice.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { CustomTypeModelFieldType } from "./types";
|
|
|
3
3
|
import type { CustomTypeModelLegacySlice, CustomTypeModelSlice } from "./slice";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A Slice Zone
|
|
6
|
+
* A Slice Zone custom type field.
|
|
7
7
|
*
|
|
8
8
|
* More details: {@link https://prismic.io/docs/slice}
|
|
9
9
|
*/
|
|
@@ -51,7 +51,7 @@ export const CustomTypeModelSliceType = {
|
|
|
51
51
|
} as const;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* A
|
|
54
|
+
* A shared Slice for a custom type.
|
|
55
55
|
*
|
|
56
56
|
* More details: {@link https://prismic.io/docs/slice}
|
|
57
57
|
*/
|