@prismicio/client 6.7.1 → 7.0.0-alpha.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/ForbiddenError.cjs +7 -0
- package/dist/ForbiddenError.cjs.map +1 -0
- package/dist/ForbiddenError.d.ts +11 -0
- package/dist/ForbiddenError.js +7 -0
- package/dist/ForbiddenError.js.map +1 -0
- package/dist/NotFoundError.cjs +7 -0
- package/dist/NotFoundError.cjs.map +1 -0
- package/dist/NotFoundError.d.ts +3 -0
- package/dist/NotFoundError.js +7 -0
- package/dist/NotFoundError.js.map +1 -0
- package/dist/ParsingError.cjs +7 -0
- package/dist/ParsingError.cjs.map +1 -0
- package/dist/ParsingError.d.ts +12 -0
- package/dist/ParsingError.js +7 -0
- package/dist/ParsingError.js.map +1 -0
- package/dist/PrismicError.cjs +19 -0
- package/dist/PrismicError.cjs.map +1 -0
- package/dist/PrismicError.d.ts +5 -0
- package/dist/PrismicError.js +19 -0
- package/dist/PrismicError.js.map +1 -0
- package/dist/buildQueryURL.cjs +41 -0
- package/dist/buildQueryURL.cjs.map +1 -0
- package/dist/buildQueryURL.d.ts +130 -0
- package/dist/buildQueryURL.js +41 -0
- package/dist/buildQueryURL.js.map +1 -0
- package/dist/client.cjs +414 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.ts +908 -0
- package/dist/client.js +414 -0
- package/dist/client.js.map +1 -0
- package/dist/cookie.cjs +5 -0
- package/dist/cookie.cjs.map +1 -0
- package/dist/cookie.d.ts +5 -0
- package/dist/cookie.js +5 -0
- package/dist/cookie.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +13 -0
- package/dist/getGraphQLEndpoint.cjs.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +9 -0
- package/dist/getGraphQLEndpoint.js +13 -0
- package/dist/getGraphQLEndpoint.js.map +1 -0
- package/dist/getRepositoryEndpoint.cjs +13 -0
- package/dist/getRepositoryEndpoint.cjs.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +10 -0
- package/dist/getRepositoryEndpoint.js +13 -0
- package/dist/getRepositoryEndpoint.js.map +1 -0
- package/dist/getRepositoryName.cjs +12 -0
- package/dist/getRepositoryName.cjs.map +1 -0
- package/dist/getRepositoryName.d.ts +13 -0
- package/dist/getRepositoryName.js +12 -0
- package/dist/getRepositoryName.js.map +1 -0
- package/dist/helpers/asDate.cjs +14 -0
- package/dist/helpers/asDate.cjs.map +1 -0
- package/dist/helpers/asDate.d.ts +16 -0
- package/dist/helpers/asDate.js +14 -0
- package/dist/helpers/asDate.js.map +1 -0
- package/dist/helpers/asHTML.cjs +79 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.ts +20 -0
- package/dist/helpers/asHTML.js +79 -0
- package/dist/helpers/asHTML.js.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +52 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
- package/dist/helpers/asImageSrc.cjs +13 -0
- package/dist/helpers/asImageSrc.cjs.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +27 -0
- package/dist/helpers/asImageSrc.js +13 -0
- package/dist/helpers/asImageSrc.js.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.cjs +40 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +60 -0
- package/dist/helpers/asImageWidthSrcSet.js +40 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +32 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.ts +24 -0
- package/dist/helpers/asLink.js +32 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asText.cjs +12 -0
- package/dist/helpers/asText.cjs.map +1 -0
- package/dist/helpers/asText.d.ts +16 -0
- package/dist/helpers/asText.js +12 -0
- package/dist/helpers/asText.js.map +1 -0
- package/dist/helpers/documentToLinkField.cjs +19 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +15 -0
- package/dist/helpers/documentToLinkField.js +19 -0
- package/dist/helpers/documentToLinkField.js.map +1 -0
- package/dist/helpers/isFilled.cjs +67 -0
- package/dist/helpers/isFilled.cjs.map +1 -0
- package/dist/helpers/isFilled.d.ts +175 -0
- package/dist/helpers/isFilled.js +67 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/index.cjs +67 -721
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +92 -1526
- package/dist/index.js +64 -681
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +12 -0
- package/dist/isRepositoryEndpoint.cjs.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +10 -0
- package/dist/isRepositoryEndpoint.js +12 -0
- package/dist/isRepositoryEndpoint.js.map +1 -0
- package/dist/isRepositoryName.cjs +7 -0
- package/dist/isRepositoryName.cjs.map +1 -0
- package/dist/isRepositoryName.d.ts +9 -0
- package/dist/isRepositoryName.js +7 -0
- package/dist/isRepositoryName.js.map +1 -0
- package/dist/lib/appendPredicates.cjs +14 -0
- package/dist/lib/appendPredicates.cjs.map +1 -0
- package/dist/lib/appendPredicates.d.ts +18 -0
- package/dist/lib/appendPredicates.js +14 -0
- package/dist/lib/appendPredicates.js.map +1 -0
- package/dist/lib/castArray.cjs +5 -0
- package/dist/lib/castArray.cjs.map +1 -0
- package/dist/lib/castArray.d.ts +11 -0
- package/dist/lib/castArray.js +5 -0
- package/dist/lib/castArray.js.map +1 -0
- package/dist/lib/castThunk.cjs +5 -0
- package/dist/lib/castThunk.cjs.map +1 -0
- package/dist/lib/castThunk.d.ts +10 -0
- package/dist/lib/castThunk.js +5 -0
- package/dist/lib/castThunk.js.map +1 -0
- package/dist/lib/findMasterRef.cjs +8 -0
- package/dist/lib/findMasterRef.cjs.map +1 -0
- package/dist/lib/findMasterRef.d.ts +10 -0
- package/dist/lib/findMasterRef.js +8 -0
- package/dist/lib/findMasterRef.js.map +1 -0
- package/dist/lib/findRef.cjs +12 -0
- package/dist/lib/findRef.cjs.map +1 -0
- package/dist/lib/findRef.d.ts +13 -0
- package/dist/lib/findRef.js +12 -0
- package/dist/lib/findRef.js.map +1 -0
- package/dist/lib/findRefByID.cjs +8 -0
- package/dist/lib/findRefByID.cjs.map +1 -0
- package/dist/lib/findRefByID.d.ts +11 -0
- package/dist/lib/findRefByID.js +8 -0
- package/dist/lib/findRefByID.js.map +1 -0
- package/dist/lib/findRefByLabel.cjs +8 -0
- package/dist/lib/findRefByLabel.cjs.map +1 -0
- package/dist/lib/findRefByLabel.d.ts +11 -0
- package/dist/lib/findRefByLabel.js +8 -0
- package/dist/lib/findRefByLabel.js.map +1 -0
- package/dist/lib/getPreviewCookie.cjs +21 -0
- package/dist/lib/getPreviewCookie.cjs.map +1 -0
- package/dist/lib/getPreviewCookie.d.ts +9 -0
- package/dist/lib/getPreviewCookie.js +21 -0
- package/dist/lib/getPreviewCookie.js.map +1 -0
- package/dist/lib/minifyGraphQLQuery.cjs +7 -0
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
- package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
- package/dist/lib/minifyGraphQLQuery.js +7 -0
- package/dist/lib/minifyGraphQLQuery.js.map +1 -0
- package/dist/lib/serializerHelpers.cjs +56 -0
- package/dist/lib/serializerHelpers.cjs.map +1 -0
- package/dist/lib/serializerHelpers.d.ts +9 -0
- package/dist/lib/serializerHelpers.js +54 -0
- package/dist/lib/serializerHelpers.js.map +1 -0
- package/dist/predicate.cjs +68 -0
- package/dist/predicate.cjs.map +1 -0
- package/dist/predicate.d.ts +209 -0
- package/dist/predicate.js +68 -0
- package/dist/predicate.js.map +1 -0
- package/dist/types/api/query.d.ts +42 -0
- package/dist/types/api/ref.d.ts +32 -0
- package/dist/types/api/release.d.ts +10 -0
- package/dist/types/api/repository.d.ts +100 -0
- package/dist/types/api/tags.d.ts +8 -0
- package/dist/types/client.d.ts +128 -0
- package/dist/types/helpers.d.ts +63 -0
- package/dist/types/model/boolean.d.ts +15 -0
- package/dist/types/model/color.d.ts +13 -0
- package/dist/types/model/contentRelationship.d.ts +18 -0
- package/dist/types/model/customType.d.ts +42 -0
- package/dist/types/model/date.d.ts +14 -0
- package/dist/types/model/embed.d.ts +13 -0
- package/dist/types/model/geoPoint.d.ts +12 -0
- package/dist/types/model/group.d.ts +15 -0
- package/dist/types/model/image.d.ts +31 -0
- package/dist/types/model/integrationFields.d.ts +14 -0
- package/dist/types/model/keyText.d.ts +13 -0
- package/dist/types/model/link.cjs +9 -0
- package/dist/types/model/link.cjs.map +1 -0
- package/dist/types/model/link.d.ts +27 -0
- package/dist/types/model/link.js +9 -0
- package/dist/types/model/link.js.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +16 -0
- package/dist/types/model/number.d.ts +15 -0
- package/dist/types/model/range.d.ts +14 -0
- package/dist/types/model/richText.d.ts +35 -0
- package/dist/types/model/select.d.ts +18 -0
- package/dist/types/model/separator.d.ts +10 -0
- package/dist/types/model/sharedSlice.d.ts +19 -0
- package/dist/types/model/sharedSliceVariation.d.ts +22 -0
- package/dist/types/model/slice.cjs +8 -0
- package/dist/types/model/slice.cjs.map +1 -0
- package/dist/types/model/slice.d.ts +33 -0
- package/dist/types/model/slice.js +8 -0
- package/dist/types/model/slice.js.map +1 -0
- package/dist/types/model/sliceZone.cjs +8 -0
- package/dist/types/model/sliceZone.cjs.map +1 -0
- package/dist/types/model/sliceZone.d.ts +44 -0
- package/dist/types/model/sliceZone.js +8 -0
- package/dist/types/model/sliceZone.js.map +1 -0
- package/dist/types/model/timestamp.d.ts +14 -0
- package/dist/types/model/title.d.ts +7 -0
- package/dist/types/model/types.cjs +25 -0
- package/dist/types/model/types.cjs.map +1 -0
- package/dist/types/model/types.d.ts +62 -0
- package/dist/types/model/types.js +25 -0
- package/dist/types/model/types.js.map +1 -0
- package/dist/types/model/uid.d.ts +13 -0
- package/dist/types/utils.d.ts +28 -0
- package/dist/types/value/boolean.d.ts +6 -0
- package/dist/types/value/color.d.ts +8 -0
- package/dist/types/value/contentRelationship.d.ts +29 -0
- package/dist/types/value/date.d.ts +8 -0
- package/dist/types/value/document.d.ts +113 -0
- package/dist/types/value/embed.cjs +10 -0
- package/dist/types/value/embed.cjs.map +1 -0
- package/dist/types/value/embed.d.ts +167 -0
- package/dist/types/value/embed.js +10 -0
- package/dist/types/value/embed.js.map +1 -0
- package/dist/types/value/geoPoint.d.ts +11 -0
- package/dist/types/value/group.d.ts +7 -0
- package/dist/types/value/image.d.ts +36 -0
- package/dist/types/value/integrationFields.d.ts +9 -0
- package/dist/types/value/keyText.d.ts +8 -0
- package/dist/types/value/link.cjs +10 -0
- package/dist/types/value/link.cjs.map +1 -0
- package/dist/types/value/link.d.ts +40 -0
- package/dist/types/value/link.js +10 -0
- package/dist/types/value/link.js.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +20 -0
- package/dist/types/value/number.d.ts +8 -0
- package/dist/types/value/richText.cjs +25 -0
- package/dist/types/value/richText.cjs.map +1 -0
- package/dist/types/value/richText.d.ts +203 -0
- package/dist/types/value/richText.js +25 -0
- package/dist/types/value/richText.js.map +1 -0
- package/dist/types/value/select.d.ts +9 -0
- package/dist/types/value/sharedSlice.d.ts +11 -0
- package/dist/types/value/sharedSliceVariation.d.ts +7 -0
- package/dist/types/value/slice.d.ts +13 -0
- package/dist/types/value/sliceZone.d.ts +12 -0
- package/dist/types/value/timestamp.d.ts +8 -0
- package/dist/types/value/title.d.ts +12 -0
- package/dist/types/value/types.d.ts +40 -0
- package/dist/types/webhook/apiUpdate.d.ts +52 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -0
- package/dist/types/webhook/types.cjs +8 -0
- package/dist/types/webhook/types.cjs.map +1 -0
- package/dist/types/webhook/types.d.ts +18 -0
- package/dist/types/webhook/types.js +8 -0
- package/dist/types/webhook/types.js.map +1 -0
- package/package.json +40 -33
- package/src/buildQueryURL.ts +8 -4
- package/src/client.ts +111 -118
- package/src/cookie.ts +2 -1
- package/src/getRepositoryName.ts +4 -2
- package/src/helpers/asDate.ts +48 -0
- package/src/helpers/asHTML.ts +154 -0
- package/src/helpers/asImagePixelDensitySrcSet.ts +96 -0
- package/src/helpers/asImageSrc.ts +41 -0
- package/src/helpers/asImageWidthSrcSet.ts +139 -0
- package/src/helpers/asLink.ts +99 -0
- package/src/helpers/asText.ts +29 -0
- package/src/helpers/documentToLinkField.ts +47 -0
- package/src/helpers/isFilled.ts +290 -0
- package/src/index.ts +237 -21
- package/src/isRepositoryEndpoint.ts +2 -1
- package/src/isRepositoryName.ts +2 -1
- package/src/lib/appendPredicates.ts +2 -1
- package/src/lib/findMasterRef.ts +2 -2
- package/src/lib/findRef.ts +2 -5
- package/src/lib/findRefByID.ts +2 -2
- package/src/lib/findRefByLabel.ts +2 -5
- package/src/lib/getPreviewCookie.ts +3 -2
- package/src/lib/serializerHelpers.ts +96 -0
- package/src/predicate.ts +4 -2
- package/src/types/api/query.ts +50 -0
- package/src/types/api/ref.ts +36 -0
- package/src/types/api/release.ts +11 -0
- package/src/types/api/repository.ts +117 -0
- package/src/types/api/tags.ts +8 -0
- package/src/{types.ts → types/client.ts} +3 -37
- package/src/types/helpers.ts +103 -0
- package/src/types/model/boolean.ts +16 -0
- package/src/types/model/color.ts +14 -0
- package/src/types/model/contentRelationship.ts +22 -0
- package/src/types/model/customType.ts +61 -0
- package/src/types/model/date.ts +15 -0
- package/src/types/model/embed.ts +14 -0
- package/src/types/model/geoPoint.ts +13 -0
- package/src/types/model/group.ts +24 -0
- package/src/types/model/image.ts +37 -0
- package/src/types/model/integrationFields.ts +15 -0
- package/src/types/model/keyText.ts +14 -0
- package/src/types/model/link.ts +31 -0
- package/src/types/model/linkToMedia.ts +17 -0
- package/src/types/model/number.ts +16 -0
- package/src/types/model/range.ts +15 -0
- package/src/types/model/richText.ts +40 -0
- package/src/types/model/select.ts +22 -0
- package/src/types/model/separator.ts +11 -0
- package/src/types/model/sharedSlice.ts +23 -0
- package/src/types/model/sharedSliceVariation.ts +33 -0
- package/src/types/model/slice.ts +49 -0
- package/src/types/model/sliceZone.ts +62 -0
- package/src/types/model/timestamp.ts +15 -0
- package/src/types/model/title.ts +8 -0
- package/src/types/model/types.ts +91 -0
- package/src/types/model/uid.ts +14 -0
- package/src/types/utils.ts +34 -0
- package/src/types/value/boolean.ts +6 -0
- package/src/types/value/color.ts +10 -0
- package/src/types/value/contentRelationship.ts +48 -0
- package/src/types/value/date.ts +10 -0
- package/src/types/value/document.ts +142 -0
- package/src/types/value/embed.ts +196 -0
- package/src/types/value/geoPoint.ts +15 -0
- package/src/types/value/group.ts +14 -0
- package/src/types/value/image.ts +67 -0
- package/src/types/value/integrationFields.ts +13 -0
- package/src/types/value/keyText.ts +10 -0
- package/src/types/value/link.ts +59 -0
- package/src/types/value/linkToMedia.ts +25 -0
- package/src/types/value/number.ts +10 -0
- package/src/types/value/richText.ts +286 -0
- package/src/types/value/select.ts +13 -0
- package/src/types/value/sharedSlice.ts +15 -0
- package/src/types/value/sharedSliceVariation.ts +18 -0
- package/src/types/value/slice.ts +24 -0
- package/src/types/value/sliceZone.ts +16 -0
- package/src/types/value/timestamp.ts +12 -0
- package/src/types/value/title.ts +31 -0
- package/src/types/value/types.ts +60 -0
- package/src/types/webhook/apiUpdate.ts +56 -0
- package/src/types/webhook/testTrigger.ts +10 -0
- package/src/types/webhook/types.ts +21 -0
- package/src/lib/orElseThrow.ts +0 -17
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Dimension constraints for an Image Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/image}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelImageConstraint {
|
|
9
|
+
width?: number | null;
|
|
10
|
+
height?: number | null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A thumbnail for an Image Custom Type field.
|
|
15
|
+
*
|
|
16
|
+
* More details: {@link https://prismic.io/docs/core-concepts/image}
|
|
17
|
+
*/
|
|
18
|
+
export interface CustomTypeModelImageThumbnail<Name extends string = string>
|
|
19
|
+
extends CustomTypeModelImageConstraint {
|
|
20
|
+
name: Name;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An Image Custom Type field.
|
|
25
|
+
*
|
|
26
|
+
* More details: {@link https://prismic.io/docs/core-concepts/image}
|
|
27
|
+
*/
|
|
28
|
+
export interface CustomTypeModelImageField<
|
|
29
|
+
ThumbnailNames extends string = string,
|
|
30
|
+
> {
|
|
31
|
+
type: typeof CustomTypeModelFieldType.Image;
|
|
32
|
+
config?: {
|
|
33
|
+
label?: string | null;
|
|
34
|
+
constraint?: CustomTypeModelImageConstraint;
|
|
35
|
+
thumbnails?: readonly CustomTypeModelImageThumbnail<ThumbnailNames>[];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An Integration Fields Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/integration-fields}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelIntegrationFieldsField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.IntegrationFields;
|
|
10
|
+
config?: {
|
|
11
|
+
label?: string | null;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
catalog?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Key Text Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/key-text}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelKeyTextField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.Text;
|
|
10
|
+
config?: {
|
|
11
|
+
label?: string | null;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Link Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details:
|
|
7
|
+
* {@link https://prismic.io/docs/core-concepts/link-content-relationship}
|
|
8
|
+
*/
|
|
9
|
+
export interface CustomTypeModelLinkField {
|
|
10
|
+
type: typeof CustomTypeModelFieldType.Link;
|
|
11
|
+
config?: {
|
|
12
|
+
label?: string | null;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
select?:
|
|
15
|
+
| null
|
|
16
|
+
| typeof CustomTypeModelLinkSelectType[keyof typeof CustomTypeModelLinkSelectType];
|
|
17
|
+
allowTargetBlank?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Type of a Link Custom Type field.
|
|
23
|
+
*
|
|
24
|
+
* More details:
|
|
25
|
+
* {@link https://prismic.io/docs/core-concepts/link-content-relationship}
|
|
26
|
+
*/
|
|
27
|
+
export const CustomTypeModelLinkSelectType = {
|
|
28
|
+
Document: "document",
|
|
29
|
+
Media: "media",
|
|
30
|
+
Web: "web",
|
|
31
|
+
} as const;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
import type { CustomTypeModelLinkSelectType } from "./link";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A Link to Media Custom Type field.
|
|
6
|
+
*
|
|
7
|
+
* More details:
|
|
8
|
+
* {@link https://prismic.io/docs/core-concepts/link-content-relationship}
|
|
9
|
+
*/
|
|
10
|
+
export interface CustomTypeModelLinkToMediaField {
|
|
11
|
+
type: typeof CustomTypeModelFieldType.Link;
|
|
12
|
+
config?: {
|
|
13
|
+
label?: string | null;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
select: typeof CustomTypeModelLinkSelectType.Media;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Number Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/number}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelNumberField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.Number;
|
|
10
|
+
config?: {
|
|
11
|
+
label?: string | null;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated - Legacy field. Use `CustomTypeModelNumberField` instead.
|
|
5
|
+
*/
|
|
6
|
+
export interface CustomTypeModelRangeField {
|
|
7
|
+
type: typeof CustomTypeModelFieldType.Range;
|
|
8
|
+
config?: {
|
|
9
|
+
label?: string | null;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
min?: number;
|
|
12
|
+
max?: number;
|
|
13
|
+
step?: number;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Rich Text Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
7
|
+
*/
|
|
8
|
+
export type CustomTypeModelRichTextField =
|
|
9
|
+
| CustomTypeModelRichTextMultiField
|
|
10
|
+
| CustomTypeModelRichTextSingleField;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A Rich Text Custom Type field which supports multiple blocks of content.
|
|
14
|
+
*
|
|
15
|
+
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
16
|
+
*/
|
|
17
|
+
export interface CustomTypeModelRichTextMultiField {
|
|
18
|
+
type: typeof CustomTypeModelFieldType.StructuredText;
|
|
19
|
+
config?: {
|
|
20
|
+
label?: string | null;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
allowTargetBlank?: boolean;
|
|
23
|
+
multi?: string;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A Rich Text Custom Type field which supports one block of content.
|
|
29
|
+
*
|
|
30
|
+
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
31
|
+
*/
|
|
32
|
+
export interface CustomTypeModelRichTextSingleField {
|
|
33
|
+
type: typeof CustomTypeModelFieldType.StructuredText;
|
|
34
|
+
config?: {
|
|
35
|
+
label?: string | null;
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
allowTargetBlank?: boolean;
|
|
38
|
+
single?: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Select Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/select}
|
|
7
|
+
*
|
|
8
|
+
* @typeParam Options - Options for the field.
|
|
9
|
+
* @typeParam DefaultValue - Default value for the field.
|
|
10
|
+
*/
|
|
11
|
+
export interface CustomTypeModelSelectField<
|
|
12
|
+
Option extends string = string,
|
|
13
|
+
DefaultValue extends Option = Option,
|
|
14
|
+
> {
|
|
15
|
+
type: typeof CustomTypeModelFieldType.Select;
|
|
16
|
+
config?: {
|
|
17
|
+
label?: string | null;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
options?: readonly Option[];
|
|
20
|
+
default_value?: DefaultValue;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated - Legacy field. Do not use.
|
|
5
|
+
*/
|
|
6
|
+
export interface CustomTypeModelSeparatorField {
|
|
7
|
+
type: typeof CustomTypeModelFieldType.Separator;
|
|
8
|
+
config?: {
|
|
9
|
+
label?: string | null;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CustomTypeModelSliceType } from "./sliceZone";
|
|
2
|
+
import type { SharedSliceModelVariation } from "./sharedSliceVariation";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A Prismic Shared Slice model.
|
|
6
|
+
*
|
|
7
|
+
* More details:
|
|
8
|
+
*
|
|
9
|
+
* - {@link https://prismic.io/docs/core-concepts/slices}
|
|
10
|
+
* - {@link https://prismic.io/docs/core-concepts/reusing-slices}
|
|
11
|
+
*
|
|
12
|
+
* @typeParam Variation - A variation for the Shared Slice.
|
|
13
|
+
*/
|
|
14
|
+
export interface SharedSliceModel<
|
|
15
|
+
ID extends string = string,
|
|
16
|
+
Variation extends SharedSliceModelVariation = SharedSliceModelVariation,
|
|
17
|
+
> {
|
|
18
|
+
type: typeof CustomTypeModelSliceType.SharedSlice;
|
|
19
|
+
id: ID;
|
|
20
|
+
name: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
variations: readonly Variation[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldForGroup } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Shared Slice variation.
|
|
5
|
+
*
|
|
6
|
+
* More details:
|
|
7
|
+
*
|
|
8
|
+
* - {@link https://prismic.io/docs/core-concepts/slices}
|
|
9
|
+
* - {@link https://prismic.io/docs/core-concepts/reusing-slices}
|
|
10
|
+
*
|
|
11
|
+
* @typeParam PrimaryFields - A record of fields that cannnot be repeated.
|
|
12
|
+
* @typeParam ItemFields - A record of fields that can be repeated.
|
|
13
|
+
*/
|
|
14
|
+
export interface SharedSliceModelVariation<
|
|
15
|
+
ID extends string = string,
|
|
16
|
+
PrimaryFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
17
|
+
string,
|
|
18
|
+
CustomTypeModelFieldForGroup
|
|
19
|
+
>,
|
|
20
|
+
ItemFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
21
|
+
string,
|
|
22
|
+
CustomTypeModelFieldForGroup
|
|
23
|
+
>,
|
|
24
|
+
> {
|
|
25
|
+
id: ID;
|
|
26
|
+
name: string;
|
|
27
|
+
docURL: string;
|
|
28
|
+
version: string;
|
|
29
|
+
description: string;
|
|
30
|
+
primary?: PrimaryFields;
|
|
31
|
+
items?: ItemFields;
|
|
32
|
+
imageUrl: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CustomTypeModelGroupField } from "./group";
|
|
2
|
+
import type { CustomTypeModelSliceType } from "./sliceZone";
|
|
3
|
+
import type { CustomTypeModelFieldForGroup } from "./types";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A Slice for a Custom Type.
|
|
7
|
+
*
|
|
8
|
+
* More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
9
|
+
*
|
|
10
|
+
* @typeParam NonRepeatFields - A record of fields that cannnot be repeated.
|
|
11
|
+
* @typeParam RepeatFields - A record of fields that can be repeated.
|
|
12
|
+
*/
|
|
13
|
+
export interface CustomTypeModelSlice<
|
|
14
|
+
NonRepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
15
|
+
string,
|
|
16
|
+
CustomTypeModelFieldForGroup
|
|
17
|
+
>,
|
|
18
|
+
RepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
19
|
+
string,
|
|
20
|
+
CustomTypeModelFieldForGroup
|
|
21
|
+
>,
|
|
22
|
+
> {
|
|
23
|
+
type: typeof CustomTypeModelSliceType.Slice;
|
|
24
|
+
fieldset?: string | null;
|
|
25
|
+
description?: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
display?:
|
|
28
|
+
| typeof CustomTypeModelSliceDisplay[keyof typeof CustomTypeModelSliceDisplay]
|
|
29
|
+
| string;
|
|
30
|
+
"non-repeat"?: NonRepeatFields;
|
|
31
|
+
repeat?: RepeatFields;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Display type for a Slice.
|
|
36
|
+
*
|
|
37
|
+
* More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
38
|
+
*/
|
|
39
|
+
export const CustomTypeModelSliceDisplay = {
|
|
40
|
+
List: "list",
|
|
41
|
+
Grid: "grid",
|
|
42
|
+
} as const;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated - Legacy slice type. Do not use.
|
|
46
|
+
*/
|
|
47
|
+
export type CustomTypeModelLegacySlice =
|
|
48
|
+
| CustomTypeModelGroupField
|
|
49
|
+
| CustomTypeModelFieldForGroup;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
import type { CustomTypeModelLegacySlice, CustomTypeModelSlice } from "./slice";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A Slice Zone Custom Type field.
|
|
6
|
+
*
|
|
7
|
+
* More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
8
|
+
*/
|
|
9
|
+
export interface CustomTypeModelSliceZoneField<
|
|
10
|
+
Slices extends Record<
|
|
11
|
+
string,
|
|
12
|
+
| CustomTypeModelSlice
|
|
13
|
+
| CustomTypeModelSharedSlice
|
|
14
|
+
| CustomTypeModelLegacySlice
|
|
15
|
+
> = Record<
|
|
16
|
+
string,
|
|
17
|
+
| CustomTypeModelSlice
|
|
18
|
+
| CustomTypeModelSharedSlice
|
|
19
|
+
| CustomTypeModelLegacySlice
|
|
20
|
+
>,
|
|
21
|
+
> {
|
|
22
|
+
type:
|
|
23
|
+
| typeof CustomTypeModelFieldType.Slices
|
|
24
|
+
| typeof CustomTypeModelFieldType.LegacySlices;
|
|
25
|
+
fieldset?: string | null;
|
|
26
|
+
config?: {
|
|
27
|
+
labels?: Record<string, readonly CustomTypeModelSliceLabel[]> | null;
|
|
28
|
+
choices?: Slices;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Label for a Slice.
|
|
34
|
+
*
|
|
35
|
+
* More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
36
|
+
*/
|
|
37
|
+
export interface CustomTypeModelSliceLabel {
|
|
38
|
+
name: string;
|
|
39
|
+
display?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Type identifier for a Slice.
|
|
44
|
+
*
|
|
45
|
+
* More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
46
|
+
*/
|
|
47
|
+
export const CustomTypeModelSliceType = {
|
|
48
|
+
Slice: "Slice",
|
|
49
|
+
SharedSlice: "SharedSlice",
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A Shared Slice for a Custom Type.
|
|
54
|
+
*
|
|
55
|
+
* More details:
|
|
56
|
+
*
|
|
57
|
+
* - {@link https://prismic.io/docs/core-concepts/slices}
|
|
58
|
+
* - {@link https://prismic.io/docs/core-concepts/reusing-slices}
|
|
59
|
+
*/
|
|
60
|
+
export interface CustomTypeModelSharedSlice {
|
|
61
|
+
type: typeof CustomTypeModelSliceType.SharedSlice;
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Timestamp Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/timestamp}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelTimestampField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.Timestamp;
|
|
10
|
+
config?: {
|
|
11
|
+
label?: string | null;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
default?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CustomTypeModelRichTextSingleField } from "./richText";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Title Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
7
|
+
*/
|
|
8
|
+
export type CustomTypeModelTitleField = CustomTypeModelRichTextSingleField;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { CustomTypeModelContentRelationshipField } from "./contentRelationship";
|
|
2
|
+
import type { CustomTypeModelEmbedField } from "./embed";
|
|
3
|
+
import type { CustomTypeModelImageField } from "./image";
|
|
4
|
+
import type { CustomTypeModelLinkField } from "./link";
|
|
5
|
+
import type { CustomTypeModelLinkToMediaField } from "./linkToMedia";
|
|
6
|
+
import type { CustomTypeModelRichTextField } from "./richText";
|
|
7
|
+
import type { CustomTypeModelTitleField } from "./title";
|
|
8
|
+
|
|
9
|
+
import type { CustomTypeModelBooleanField } from "./boolean";
|
|
10
|
+
import type { CustomTypeModelColorField } from "./color";
|
|
11
|
+
import type { CustomTypeModelDateField } from "./date";
|
|
12
|
+
import type { CustomTypeModelKeyTextField } from "./keyText";
|
|
13
|
+
import type { CustomTypeModelNumberField } from "./number";
|
|
14
|
+
import type { CustomTypeModelSelectField } from "./select";
|
|
15
|
+
import type { CustomTypeModelTimestampField } from "./timestamp";
|
|
16
|
+
import type { CustomTypeModelGeoPointField } from "./geoPoint";
|
|
17
|
+
|
|
18
|
+
import type { CustomTypeModelIntegrationFieldsField } from "./integrationFields";
|
|
19
|
+
import type { CustomTypeModelGroupField } from "./group";
|
|
20
|
+
import type { CustomTypeModelSliceZoneField } from "./sliceZone";
|
|
21
|
+
|
|
22
|
+
import type { CustomTypeModelUIDField } from "./uid";
|
|
23
|
+
|
|
24
|
+
import type { CustomTypeModelRangeField } from "./range";
|
|
25
|
+
import type { CustomTypeModelSeparatorField } from "./separator";
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Type identifier for a Custom Type field.
|
|
29
|
+
*/
|
|
30
|
+
export const CustomTypeModelFieldType = {
|
|
31
|
+
Boolean: "Boolean",
|
|
32
|
+
Color: "Color",
|
|
33
|
+
Date: "Date",
|
|
34
|
+
Embed: "Embed",
|
|
35
|
+
GeoPoint: "GeoPoint",
|
|
36
|
+
Group: "Group",
|
|
37
|
+
Image: "Image",
|
|
38
|
+
IntegrationFields: "IntegrationFields",
|
|
39
|
+
Link: "Link",
|
|
40
|
+
Number: "Number",
|
|
41
|
+
Select: "Select",
|
|
42
|
+
Slices: "Slices",
|
|
43
|
+
StructuredText: "StructuredText",
|
|
44
|
+
Text: "Text",
|
|
45
|
+
Timestamp: "Timestamp",
|
|
46
|
+
UID: "UID",
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated - Legacy field type. Use `Number` instead.
|
|
49
|
+
*/
|
|
50
|
+
Range: "Range",
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated - Legacy field type. Do not use.
|
|
53
|
+
*/
|
|
54
|
+
Separator: "Separator",
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated - Legacy field type. Use `Slices` instead.
|
|
57
|
+
*/
|
|
58
|
+
LegacySlices: "Choice",
|
|
59
|
+
} as const;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A Custom Type field.
|
|
63
|
+
*/
|
|
64
|
+
export type CustomTypeModelField =
|
|
65
|
+
| CustomTypeModelUIDField
|
|
66
|
+
| CustomTypeModelGroupField
|
|
67
|
+
| CustomTypeModelSliceZoneField
|
|
68
|
+
| CustomTypeModelFieldForGroup;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Any Custom Type field that is valid for a Group field.
|
|
72
|
+
*/
|
|
73
|
+
export type CustomTypeModelFieldForGroup =
|
|
74
|
+
| CustomTypeModelBooleanField
|
|
75
|
+
| CustomTypeModelColorField
|
|
76
|
+
| CustomTypeModelDateField
|
|
77
|
+
| CustomTypeModelEmbedField
|
|
78
|
+
| CustomTypeModelGeoPointField
|
|
79
|
+
| CustomTypeModelImageField
|
|
80
|
+
| CustomTypeModelIntegrationFieldsField
|
|
81
|
+
| CustomTypeModelContentRelationshipField
|
|
82
|
+
| CustomTypeModelLinkField
|
|
83
|
+
| CustomTypeModelLinkToMediaField
|
|
84
|
+
| CustomTypeModelNumberField
|
|
85
|
+
| CustomTypeModelRangeField
|
|
86
|
+
| CustomTypeModelSelectField
|
|
87
|
+
| CustomTypeModelRichTextField
|
|
88
|
+
| CustomTypeModelTitleField
|
|
89
|
+
| CustomTypeModelKeyTextField
|
|
90
|
+
| CustomTypeModelTimestampField
|
|
91
|
+
| CustomTypeModelSeparatorField;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A UID Custom Type field.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/core-concepts/uid}
|
|
7
|
+
*/
|
|
8
|
+
export interface CustomTypeModelUIDField {
|
|
9
|
+
type: typeof CustomTypeModelFieldType.UID;
|
|
10
|
+
config?: {
|
|
11
|
+
label?: string | null;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a union of the given object's values, and optionally specify which
|
|
3
|
+
* keys to get the values from.
|
|
4
|
+
*
|
|
5
|
+
* Taken from the `type-fest` package.
|
|
6
|
+
*
|
|
7
|
+
* See:
|
|
8
|
+
* https://github.com/sindresorhus/type-fest/blob/61c35052f09caa23de5eef96d95196375d8ed498/source/value-of.d.ts
|
|
9
|
+
*/
|
|
10
|
+
export type ValueOf<
|
|
11
|
+
ObjectType,
|
|
12
|
+
ValueType extends keyof ObjectType = keyof ObjectType,
|
|
13
|
+
> = ObjectType[ValueType];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Functions like TypeScript's native `Extract` utility type with added support
|
|
17
|
+
* to fall back to a value if the resulting union is `never`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* ExtractOrFallback<"a" | "b", "a">; // => "a"
|
|
23
|
+
* ExtractOrFallback<"a" | "b", "c">; // => "a" | "b"
|
|
24
|
+
* ExtractOrFallback<"a" | "b", "c", "foo">; // => "foo"
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @typeParam T - The union from which values will be extracted.
|
|
28
|
+
* @typeParam U - The extraction condition.
|
|
29
|
+
* @typeParam Fallback - The value to return if the resulting union is `never`.
|
|
30
|
+
* Defaults to `T`.
|
|
31
|
+
*/
|
|
32
|
+
export type ExtractOrFallback<T, U, Fallback = T> = Extract<T, U> extends never
|
|
33
|
+
? Fallback
|
|
34
|
+
: Extract<T, U>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Color field.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/color}
|
|
8
|
+
*/
|
|
9
|
+
export type ColorField<State extends FieldState = FieldState> =
|
|
10
|
+
State extends "empty" ? null : `#${string}`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { AnyRegularField, FieldState } from "./types";
|
|
2
|
+
import type { EmptyLinkField, LinkType } from "./link";
|
|
3
|
+
import type { GroupField } from "./group";
|
|
4
|
+
import type { SliceZone } from "./sliceZone";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Field for related documents
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
10
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
11
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
12
|
+
* GraphQuery of `fetchLinks`).
|
|
13
|
+
* @typeParam State - State of the field which determines its shape.
|
|
14
|
+
*/
|
|
15
|
+
export type ContentRelationshipField<
|
|
16
|
+
TypeEnum = string,
|
|
17
|
+
LangEnum = string,
|
|
18
|
+
DataInterface extends Record<
|
|
19
|
+
string,
|
|
20
|
+
AnyRegularField | GroupField | SliceZone
|
|
21
|
+
> = never,
|
|
22
|
+
State extends FieldState = FieldState,
|
|
23
|
+
> = State extends "empty"
|
|
24
|
+
? EmptyLinkField<typeof LinkType.Document>
|
|
25
|
+
: FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Links that refer to Documents
|
|
29
|
+
*/
|
|
30
|
+
export interface FilledContentRelationshipField<
|
|
31
|
+
TypeEnum = string,
|
|
32
|
+
LangEnum = string,
|
|
33
|
+
DataInterface extends Record<
|
|
34
|
+
string,
|
|
35
|
+
AnyRegularField | GroupField | SliceZone
|
|
36
|
+
> = never,
|
|
37
|
+
> {
|
|
38
|
+
link_type: typeof LinkType.Document;
|
|
39
|
+
id: string;
|
|
40
|
+
uid?: string;
|
|
41
|
+
type: TypeEnum;
|
|
42
|
+
tags: string[];
|
|
43
|
+
lang: LangEnum;
|
|
44
|
+
url?: string;
|
|
45
|
+
slug?: string;
|
|
46
|
+
isBroken?: boolean;
|
|
47
|
+
data?: DataInterface;
|
|
48
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Date field.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/date}
|
|
8
|
+
*/
|
|
9
|
+
export type DateField<State extends FieldState = FieldState> =
|
|
10
|
+
State extends "empty" ? null : `${number}-${number}-${number}`;
|