@prismicio/client 6.7.3 → 7.0.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.
- package/README.md +4 -4
- package/dist/buildQueryURL.cjs +25 -6
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +207 -130
- package/dist/buildQueryURL.js +25 -6
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.d.ts +5 -5
- package/dist/createClient.cjs +1142 -0
- package/dist/createClient.cjs.map +1 -0
- package/dist/{client.d.ts → createClient.d.ts} +980 -929
- package/dist/createClient.js +1142 -0
- package/dist/createClient.js.map +1 -0
- package/dist/errors/ForbiddenError.cjs.map +1 -0
- package/dist/{ForbiddenError.d.ts → errors/ForbiddenError.d.ts} +11 -11
- package/dist/errors/ForbiddenError.js.map +1 -0
- package/dist/errors/NotFoundError.cjs.map +1 -0
- package/dist/{NotFoundError.d.ts → errors/NotFoundError.d.ts} +3 -3
- package/dist/errors/NotFoundError.js.map +1 -0
- package/dist/errors/ParsingError.cjs.map +1 -0
- package/dist/{ParsingError.d.ts → errors/ParsingError.d.ts} +12 -12
- package/dist/errors/ParsingError.js.map +1 -0
- package/dist/errors/PrismicError.cjs.map +1 -0
- package/dist/{PrismicError.d.ts → errors/PrismicError.d.ts} +5 -5
- package/dist/errors/PrismicError.js.map +1 -0
- package/dist/filter.cjs +247 -0
- package/dist/filter.cjs.map +1 -0
- package/dist/filter.d.ts +209 -0
- package/dist/filter.js +247 -0
- package/dist/filter.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +9 -9
- package/dist/getGraphQLEndpoint.js +1 -1
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +10 -10
- package/dist/getRepositoryEndpoint.js +1 -1
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.ts +13 -13
- package/dist/getRepositoryName.js +1 -1
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs +13 -0
- package/dist/getToolbarSrc.cjs.map +1 -0
- package/dist/getToolbarSrc.d.ts +34 -0
- package/dist/getToolbarSrc.js +13 -0
- package/dist/getToolbarSrc.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 +80 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.ts +77 -0
- package/dist/helpers/asHTML.js +80 -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 +45 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +60 -0
- package/dist/helpers/asImageWidthSrcSet.js +45 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +38 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.ts +34 -0
- package/dist/helpers/asLink.js +38 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asLinkAttrs.cjs +28 -0
- package/dist/helpers/asLinkAttrs.cjs.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +63 -0
- package/dist/helpers/asLinkAttrs.js +28 -0
- package/dist/helpers/asLinkAttrs.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 +26 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +15 -0
- package/dist/helpers/documentToLinkField.js +26 -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 +172 -0
- package/dist/helpers/isFilled.js +67 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/index.cjs +56 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +138 -88
- package/dist/index.js +50 -16
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.d.ts +10 -10
- package/dist/isRepositoryName.d.ts +9 -9
- package/dist/lib/appendFilters.cjs +11 -0
- package/dist/lib/appendFilters.cjs.map +1 -0
- package/dist/lib/appendFilters.d.ts +18 -0
- package/dist/lib/appendFilters.js +11 -0
- package/dist/lib/appendFilters.js.map +1 -0
- package/dist/lib/castArray.cjs +3 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.d.ts +11 -11
- package/dist/lib/castArray.js +3 -1
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs +3 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.d.ts +10 -10
- package/dist/lib/castThunk.js +3 -1
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/devMsg.cjs +8 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.d.ts +16 -0
- package/dist/lib/devMsg.js +8 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/escapeHTML.cjs +43 -0
- package/dist/lib/escapeHTML.cjs.map +1 -0
- package/dist/lib/escapeHTML.d.ts +1 -0
- package/dist/lib/escapeHTML.js +43 -0
- package/dist/lib/escapeHTML.js.map +1 -0
- package/dist/lib/everyTagFilter.cjs +9 -0
- package/dist/lib/everyTagFilter.cjs.map +1 -0
- package/dist/lib/everyTagFilter.d.ts +9 -0
- package/dist/lib/everyTagFilter.js +9 -0
- package/dist/lib/everyTagFilter.js.map +1 -0
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.d.ts +10 -10
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs +3 -3
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.d.ts +13 -13
- package/dist/lib/findRef.js +3 -3
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.d.ts +11 -11
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.d.ts +11 -11
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs +1 -1
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.d.ts +9 -9
- package/dist/lib/getPreviewCookie.js +1 -1
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs +9 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.d.ts +8 -0
- package/dist/lib/isInternalURL.js +9 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/minifyGraphQLQuery.d.ts +8 -8
- package/dist/lib/serializerHelpers.cjs +54 -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/lib/someTagsFilter.cjs +9 -0
- package/dist/lib/someTagsFilter.cjs.map +1 -0
- package/dist/lib/someTagsFilter.d.ts +9 -0
- package/dist/lib/someTagsFilter.js +9 -0
- package/dist/lib/someTagsFilter.js.map +1 -0
- package/dist/lib/typeFilter.cjs +8 -0
- package/dist/lib/typeFilter.cjs.map +1 -0
- package/dist/lib/typeFilter.d.ts +8 -0
- package/dist/lib/typeFilter.js +8 -0
- package/dist/lib/typeFilter.js.map +1 -0
- package/dist/package.json.cjs +5 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +5 -0
- package/dist/package.json.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/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 +16 -0
- package/dist/types/model/sharedSliceVariation.d.ts +19 -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 +41 -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 +34 -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 +34 -0
- package/dist/types/model/types.js.map +1 -0
- package/dist/types/model/uid.d.ts +13 -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 +42 -36
- package/src/buildQueryURL.ts +179 -32
- package/src/{client.ts → createClient.ts} +248 -186
- package/src/filter.ts +356 -0
- package/src/getGraphQLEndpoint.ts +2 -1
- package/src/getRepositoryEndpoint.ts +2 -1
- package/src/getRepositoryName.ts +1 -1
- package/src/getToolbarSrc.ts +50 -0
- package/src/helpers/asDate.ts +48 -0
- package/src/helpers/asHTML.ts +249 -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 +118 -0
- package/src/helpers/asLinkAttrs.ts +127 -0
- package/src/helpers/asText.ts +29 -0
- package/src/helpers/documentToLinkField.ts +47 -0
- package/src/helpers/isFilled.ts +288 -0
- package/src/index.ts +277 -31
- package/src/lib/appendFilters.ts +26 -0
- package/src/lib/castArray.ts +3 -1
- package/src/lib/castThunk.ts +3 -2
- package/src/lib/devMsg.ts +20 -0
- package/src/lib/escapeHTML.ts +51 -0
- package/src/lib/everyTagFilter.ts +15 -0
- package/src/lib/findMasterRef.ts +2 -2
- package/src/lib/findRef.ts +6 -9
- package/src/lib/findRefByID.ts +2 -2
- package/src/lib/findRefByLabel.ts +2 -5
- package/src/lib/getPreviewCookie.ts +1 -1
- package/src/lib/isInternalURL.ts +14 -0
- package/src/lib/serializerHelpers.ts +101 -0
- package/src/lib/someTagsFilter.ts +15 -0
- package/src/lib/typeFilter.ts +12 -0
- 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/model/boolean.ts +16 -0
- package/src/types/model/color.ts +14 -0
- package/src/types/model/contentRelationship.ts +23 -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 +18 -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 +20 -0
- package/src/types/model/sharedSliceVariation.ts +30 -0
- package/src/types/model/slice.ts +50 -0
- package/src/types/model/sliceZone.ts +60 -0
- package/src/types/model/timestamp.ts +15 -0
- package/src/types/model/title.ts +8 -0
- package/src/types/model/types.ts +87 -0
- package/src/types/model/uid.ts +14 -0
- package/src/types/value/boolean.ts +6 -0
- package/src/types/value/color.ts +10 -0
- package/src/types/value/contentRelationship.ts +47 -0
- package/src/types/value/date.ts +10 -0
- package/src/types/value/document.ts +143 -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 +26 -0
- package/src/types/value/number.ts +10 -0
- package/src/types/value/richText.ts +287 -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 +17 -0
- package/src/types/value/timestamp.ts +13 -0
- package/src/types/value/title.ts +32 -0
- package/src/types/value/types.ts +58 -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/dist/ForbiddenError.cjs.map +0 -1
- package/dist/ForbiddenError.js.map +0 -1
- package/dist/NotFoundError.cjs.map +0 -1
- package/dist/NotFoundError.js.map +0 -1
- package/dist/ParsingError.cjs.map +0 -1
- package/dist/ParsingError.js.map +0 -1
- package/dist/PrismicError.cjs.map +0 -1
- package/dist/PrismicError.js.map +0 -1
- package/dist/client.cjs +0 -436
- package/dist/client.cjs.map +0 -1
- package/dist/client.js +0 -419
- package/dist/client.js.map +0 -1
- package/dist/lib/appendPredicates.cjs +0 -14
- package/dist/lib/appendPredicates.cjs.map +0 -1
- package/dist/lib/appendPredicates.d.ts +0 -18
- package/dist/lib/appendPredicates.js +0 -14
- package/dist/lib/appendPredicates.js.map +0 -1
- package/dist/lib/orElseThrow.d.ts +0 -11
- package/dist/predicate.cjs +0 -68
- package/dist/predicate.cjs.map +0 -1
- package/dist/predicate.d.ts +0 -209
- package/dist/predicate.js +0 -68
- package/dist/predicate.js.map +0 -1
- package/dist/types.d.ts +0 -156
- package/src/lib/appendPredicates.ts +0 -29
- package/src/lib/orElseThrow.ts +0 -17
- package/src/predicate.ts +0 -359
- package/src/types.ts +0 -191
- /package/dist/{ForbiddenError.cjs → errors/ForbiddenError.cjs} +0 -0
- /package/dist/{ForbiddenError.js → errors/ForbiddenError.js} +0 -0
- /package/dist/{NotFoundError.cjs → errors/NotFoundError.cjs} +0 -0
- /package/dist/{NotFoundError.js → errors/NotFoundError.js} +0 -0
- /package/dist/{ParsingError.cjs → errors/ParsingError.cjs} +0 -0
- /package/dist/{ParsingError.js → errors/ParsingError.js} +0 -0
- /package/dist/{PrismicError.cjs → errors/PrismicError.cjs} +0 -0
- /package/dist/{PrismicError.js → errors/PrismicError.js} +0 -0
- /package/src/{ForbiddenError.ts → errors/ForbiddenError.ts} +0 -0
- /package/src/{NotFoundError.ts → errors/NotFoundError.ts} +0 -0
- /package/src/{ParsingError.ts → errors/ParsingError.ts} +0 -0
- /package/src/{PrismicError.ts → errors/PrismicError.ts} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldForGroup } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Shared Slice variation.
|
|
5
|
+
*
|
|
6
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
7
|
+
*
|
|
8
|
+
* @typeParam PrimaryFields - A record of fields that cannnot be repeated.
|
|
9
|
+
* @typeParam ItemFields - A record of fields that can be repeated.
|
|
10
|
+
*/
|
|
11
|
+
export interface SharedSliceModelVariation<
|
|
12
|
+
ID extends string = string,
|
|
13
|
+
PrimaryFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
14
|
+
string,
|
|
15
|
+
CustomTypeModelFieldForGroup
|
|
16
|
+
>,
|
|
17
|
+
ItemFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
18
|
+
string,
|
|
19
|
+
CustomTypeModelFieldForGroup
|
|
20
|
+
>,
|
|
21
|
+
> {
|
|
22
|
+
id: ID;
|
|
23
|
+
name: string;
|
|
24
|
+
docURL: string;
|
|
25
|
+
version: string;
|
|
26
|
+
description: string;
|
|
27
|
+
primary?: PrimaryFields;
|
|
28
|
+
items?: ItemFields;
|
|
29
|
+
imageUrl: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldForGroup } from "./types";
|
|
2
|
+
|
|
3
|
+
import type { CustomTypeModelGroupField } from "./group";
|
|
4
|
+
import type { CustomTypeModelSliceType } from "./sliceZone";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A Slice for a Custom Type.
|
|
8
|
+
*
|
|
9
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
10
|
+
*
|
|
11
|
+
* @typeParam NonRepeatFields - A record of fields that cannnot be repeated.
|
|
12
|
+
* @typeParam RepeatFields - A record of fields that can be repeated.
|
|
13
|
+
*/
|
|
14
|
+
export interface CustomTypeModelSlice<
|
|
15
|
+
NonRepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
16
|
+
string,
|
|
17
|
+
CustomTypeModelFieldForGroup
|
|
18
|
+
>,
|
|
19
|
+
RepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
|
|
20
|
+
string,
|
|
21
|
+
CustomTypeModelFieldForGroup
|
|
22
|
+
>,
|
|
23
|
+
> {
|
|
24
|
+
type: typeof CustomTypeModelSliceType.Slice;
|
|
25
|
+
fieldset?: string | null;
|
|
26
|
+
description?: string;
|
|
27
|
+
icon?: string;
|
|
28
|
+
display?:
|
|
29
|
+
| (typeof CustomTypeModelSliceDisplay)[keyof typeof CustomTypeModelSliceDisplay]
|
|
30
|
+
| string;
|
|
31
|
+
"non-repeat"?: NonRepeatFields;
|
|
32
|
+
repeat?: RepeatFields;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Display type for a Slice.
|
|
37
|
+
*
|
|
38
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
39
|
+
*/
|
|
40
|
+
export const CustomTypeModelSliceDisplay = {
|
|
41
|
+
List: "list",
|
|
42
|
+
Grid: "grid",
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated - Legacy slice type. Do not use.
|
|
47
|
+
*/
|
|
48
|
+
export type CustomTypeModelLegacySlice =
|
|
49
|
+
| CustomTypeModelGroupField
|
|
50
|
+
| CustomTypeModelFieldForGroup;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types";
|
|
2
|
+
|
|
3
|
+
import type { CustomTypeModelLegacySlice, CustomTypeModelSlice } from "./slice";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A Slice Zone Custom Type field.
|
|
7
|
+
*
|
|
8
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
9
|
+
*/
|
|
10
|
+
export interface CustomTypeModelSliceZoneField<
|
|
11
|
+
Slices extends Record<
|
|
12
|
+
string,
|
|
13
|
+
| CustomTypeModelSlice
|
|
14
|
+
| CustomTypeModelSharedSlice
|
|
15
|
+
| CustomTypeModelLegacySlice
|
|
16
|
+
> = Record<
|
|
17
|
+
string,
|
|
18
|
+
| CustomTypeModelSlice
|
|
19
|
+
| CustomTypeModelSharedSlice
|
|
20
|
+
| CustomTypeModelLegacySlice
|
|
21
|
+
>,
|
|
22
|
+
> {
|
|
23
|
+
type:
|
|
24
|
+
| typeof CustomTypeModelFieldType.Slices
|
|
25
|
+
| typeof CustomTypeModelFieldType.LegacySlices;
|
|
26
|
+
fieldset?: string | null;
|
|
27
|
+
config?: {
|
|
28
|
+
labels?: Record<string, readonly CustomTypeModelSliceLabel[]> | null;
|
|
29
|
+
choices?: Slices;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Label for a Slice.
|
|
35
|
+
*
|
|
36
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
37
|
+
*/
|
|
38
|
+
export interface CustomTypeModelSliceLabel {
|
|
39
|
+
name: string;
|
|
40
|
+
display?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Type identifier for a Slice.
|
|
45
|
+
*
|
|
46
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
47
|
+
*/
|
|
48
|
+
export const CustomTypeModelSliceType = {
|
|
49
|
+
Slice: "Slice",
|
|
50
|
+
SharedSlice: "SharedSlice",
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A Shared Slice for a Custom Type.
|
|
55
|
+
*
|
|
56
|
+
* More details: {@link https://prismic.io/docs/slice}
|
|
57
|
+
*/
|
|
58
|
+
export interface CustomTypeModelSharedSlice {
|
|
59
|
+
type: typeof CustomTypeModelSliceType.SharedSlice;
|
|
60
|
+
}
|
|
@@ -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/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,87 @@
|
|
|
1
|
+
import type { CustomTypeModelBooleanField } from "./boolean";
|
|
2
|
+
import type { CustomTypeModelColorField } from "./color";
|
|
3
|
+
import type { CustomTypeModelContentRelationshipField } from "./contentRelationship";
|
|
4
|
+
import type { CustomTypeModelDateField } from "./date";
|
|
5
|
+
import type { CustomTypeModelEmbedField } from "./embed";
|
|
6
|
+
import type { CustomTypeModelGeoPointField } from "./geoPoint";
|
|
7
|
+
import type { CustomTypeModelGroupField } from "./group";
|
|
8
|
+
import type { CustomTypeModelImageField } from "./image";
|
|
9
|
+
import type { CustomTypeModelIntegrationFieldsField } from "./integrationFields";
|
|
10
|
+
import type { CustomTypeModelKeyTextField } from "./keyText";
|
|
11
|
+
import type { CustomTypeModelLinkField } from "./link";
|
|
12
|
+
import type { CustomTypeModelLinkToMediaField } from "./linkToMedia";
|
|
13
|
+
import type { CustomTypeModelNumberField } from "./number";
|
|
14
|
+
import type { CustomTypeModelRangeField } from "./range";
|
|
15
|
+
import type { CustomTypeModelRichTextField } from "./richText";
|
|
16
|
+
import type { CustomTypeModelSelectField } from "./select";
|
|
17
|
+
import type { CustomTypeModelSeparatorField } from "./separator";
|
|
18
|
+
import type { CustomTypeModelSliceZoneField } from "./sliceZone";
|
|
19
|
+
import type { CustomTypeModelTimestampField } from "./timestamp";
|
|
20
|
+
import type { CustomTypeModelTitleField } from "./title";
|
|
21
|
+
import type { CustomTypeModelUIDField } from "./uid";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Type identifier for a Custom Type field.
|
|
25
|
+
*/
|
|
26
|
+
export const CustomTypeModelFieldType = {
|
|
27
|
+
Boolean: "Boolean",
|
|
28
|
+
Color: "Color",
|
|
29
|
+
Date: "Date",
|
|
30
|
+
Embed: "Embed",
|
|
31
|
+
GeoPoint: "GeoPoint",
|
|
32
|
+
Group: "Group",
|
|
33
|
+
Image: "Image",
|
|
34
|
+
IntegrationFields: "IntegrationFields",
|
|
35
|
+
Link: "Link",
|
|
36
|
+
Number: "Number",
|
|
37
|
+
Select: "Select",
|
|
38
|
+
Slices: "Slices",
|
|
39
|
+
StructuredText: "StructuredText",
|
|
40
|
+
Text: "Text",
|
|
41
|
+
Timestamp: "Timestamp",
|
|
42
|
+
UID: "UID",
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated - Legacy field type. Use `Number` instead.
|
|
45
|
+
*/
|
|
46
|
+
Range: "Range",
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated - Legacy field type. Do not use.
|
|
49
|
+
*/
|
|
50
|
+
Separator: "Separator",
|
|
51
|
+
/**
|
|
52
|
+
* @deprecated - Legacy field type. Use `Slices` instead.
|
|
53
|
+
*/
|
|
54
|
+
LegacySlices: "Choice",
|
|
55
|
+
} as const;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A Custom Type field.
|
|
59
|
+
*/
|
|
60
|
+
export type CustomTypeModelField =
|
|
61
|
+
| CustomTypeModelUIDField
|
|
62
|
+
| CustomTypeModelGroupField
|
|
63
|
+
| CustomTypeModelSliceZoneField
|
|
64
|
+
| CustomTypeModelFieldForGroup;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Any Custom Type field that is valid for a Group field.
|
|
68
|
+
*/
|
|
69
|
+
export type CustomTypeModelFieldForGroup =
|
|
70
|
+
| CustomTypeModelBooleanField
|
|
71
|
+
| CustomTypeModelColorField
|
|
72
|
+
| CustomTypeModelDateField
|
|
73
|
+
| CustomTypeModelEmbedField
|
|
74
|
+
| CustomTypeModelGeoPointField
|
|
75
|
+
| CustomTypeModelImageField
|
|
76
|
+
| CustomTypeModelIntegrationFieldsField
|
|
77
|
+
| CustomTypeModelContentRelationshipField
|
|
78
|
+
| CustomTypeModelLinkField
|
|
79
|
+
| CustomTypeModelLinkToMediaField
|
|
80
|
+
| CustomTypeModelNumberField
|
|
81
|
+
| CustomTypeModelRangeField
|
|
82
|
+
| CustomTypeModelSelectField
|
|
83
|
+
| CustomTypeModelRichTextField
|
|
84
|
+
| CustomTypeModelTitleField
|
|
85
|
+
| CustomTypeModelKeyTextField
|
|
86
|
+
| CustomTypeModelTimestampField
|
|
87
|
+
| 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/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,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/color}
|
|
8
|
+
*/
|
|
9
|
+
export type ColorField<State extends FieldState = FieldState> =
|
|
10
|
+
State extends "empty" ? null : `#${string}`;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AnyRegularField, FieldState } from "./types";
|
|
2
|
+
|
|
3
|
+
import type { GroupField } from "./group";
|
|
4
|
+
import type { EmptyLinkField, LinkType } from "./link";
|
|
5
|
+
import type { SliceZone } from "./sliceZone";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Field for related documents
|
|
9
|
+
*
|
|
10
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
11
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
12
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
13
|
+
* GraphQuery of `fetchLinks`).
|
|
14
|
+
* @typeParam State - State of the field which determines its shape.
|
|
15
|
+
*/
|
|
16
|
+
export type ContentRelationshipField<
|
|
17
|
+
TypeEnum = string,
|
|
18
|
+
LangEnum = string,
|
|
19
|
+
DataInterface extends
|
|
20
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
21
|
+
| unknown = unknown,
|
|
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
|
|
34
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
35
|
+
| unknown = unknown,
|
|
36
|
+
> {
|
|
37
|
+
link_type: typeof LinkType.Document;
|
|
38
|
+
id: string;
|
|
39
|
+
uid?: string;
|
|
40
|
+
type: TypeEnum;
|
|
41
|
+
tags: string[];
|
|
42
|
+
lang: LangEnum;
|
|
43
|
+
url?: string;
|
|
44
|
+
slug?: string;
|
|
45
|
+
isBroken?: boolean;
|
|
46
|
+
data?: DataInterface;
|
|
47
|
+
}
|
|
@@ -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/date}
|
|
8
|
+
*/
|
|
9
|
+
export type DateField<State extends FieldState = FieldState> =
|
|
10
|
+
State extends "empty" ? null : `${number}-${number}-${number}`;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { AnyRegularField } from "./types";
|
|
2
|
+
|
|
3
|
+
import { GroupField } from "./group";
|
|
4
|
+
import { SliceZone } from "./sliceZone";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Document metadata for a translation of a Prismic document.
|
|
8
|
+
*/
|
|
9
|
+
export interface AlternateLanguage<TypeEnum = string, LangEnum = string> {
|
|
10
|
+
id: string;
|
|
11
|
+
uid?: string;
|
|
12
|
+
type: TypeEnum;
|
|
13
|
+
lang: LangEnum;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Metadata for Prismic Document
|
|
18
|
+
*/
|
|
19
|
+
export interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
|
|
20
|
+
/**
|
|
21
|
+
* The unique identifier for the document. Guaranteed to be unique among all
|
|
22
|
+
* documents in the Prismic repository.
|
|
23
|
+
*/
|
|
24
|
+
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* The unique identifier for the document. Guaranteed to be unique among all
|
|
27
|
+
* Prismic documents of the same type.
|
|
28
|
+
*/
|
|
29
|
+
uid: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Url that refers to document.
|
|
32
|
+
*/
|
|
33
|
+
url: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Type of the document.
|
|
36
|
+
*/
|
|
37
|
+
type: TypeEnum;
|
|
38
|
+
/**
|
|
39
|
+
* Href for document.
|
|
40
|
+
*/
|
|
41
|
+
href: string;
|
|
42
|
+
/**
|
|
43
|
+
* Tags associated with document.
|
|
44
|
+
*/
|
|
45
|
+
tags: string[];
|
|
46
|
+
/**
|
|
47
|
+
* The timestamp at which the document was first published.
|
|
48
|
+
*/
|
|
49
|
+
first_publication_date: string;
|
|
50
|
+
/**
|
|
51
|
+
* The timestamp at which the document was last published.
|
|
52
|
+
*/
|
|
53
|
+
last_publication_date: string;
|
|
54
|
+
/**
|
|
55
|
+
* Slugs associated with document.
|
|
56
|
+
*
|
|
57
|
+
* @deprecated Slugs are a deprecated feature used before the UID field was
|
|
58
|
+
* introduced. Migrate to the UID field. For more details, see
|
|
59
|
+
* https://community.prismic.io/t/what-are-slugs/6493
|
|
60
|
+
*/
|
|
61
|
+
slugs: string[];
|
|
62
|
+
/**
|
|
63
|
+
* Documents that are related to this document.
|
|
64
|
+
*/
|
|
65
|
+
linked_documents: unknown[]; // TODO: Not sure of the type for this one
|
|
66
|
+
/**
|
|
67
|
+
* Language of document.
|
|
68
|
+
*/
|
|
69
|
+
lang: LangEnum;
|
|
70
|
+
/**
|
|
71
|
+
* Array to access alternate language versions for document.
|
|
72
|
+
*/
|
|
73
|
+
alternate_languages: AlternateLanguage<TypeEnum, LangEnum>[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A Prismic document served through REST API v2.
|
|
78
|
+
*
|
|
79
|
+
* @see More details on Custom Types: {@link https://prismic.io/docs/custom-types}
|
|
80
|
+
*/
|
|
81
|
+
export interface PrismicDocument<
|
|
82
|
+
DataInterface extends Record<
|
|
83
|
+
string,
|
|
84
|
+
AnyRegularField | GroupField | SliceZone
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
|
+
> = Record<string, any>,
|
|
87
|
+
TypeEnum = string,
|
|
88
|
+
LangEnum = string,
|
|
89
|
+
> extends PrismicDocumentHeader<TypeEnum, LangEnum> {
|
|
90
|
+
/**
|
|
91
|
+
* Data contained in the document.
|
|
92
|
+
*/
|
|
93
|
+
data: DataInterface;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A Prismic document served through REST API v2. Does not contain a UID (a
|
|
98
|
+
* unique identifier).
|
|
99
|
+
*
|
|
100
|
+
* @see More details on Custom Types: {@link https://prismic.io/docs/custom-types}
|
|
101
|
+
* @see More details on the UID field: {@link https://prismic.io/docs/uid}
|
|
102
|
+
*/
|
|
103
|
+
export interface PrismicDocumentWithoutUID<
|
|
104
|
+
DataInterface extends Record<
|
|
105
|
+
string,
|
|
106
|
+
AnyRegularField | GroupField | SliceZone
|
|
107
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
+
> = Record<string, any>,
|
|
109
|
+
TypeEnum = string,
|
|
110
|
+
LangEnum = string,
|
|
111
|
+
> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
|
|
112
|
+
/**
|
|
113
|
+
* This document does not have a UID field. This property will always be
|
|
114
|
+
* `null`.
|
|
115
|
+
*
|
|
116
|
+
* The unique identifier for the document. Guaranteed to be unique among all
|
|
117
|
+
* Prismic documents of the same type.
|
|
118
|
+
*/
|
|
119
|
+
uid: null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* A Prismic document served through REST API v2. Contains a UID (a unique
|
|
124
|
+
* identifier).
|
|
125
|
+
*
|
|
126
|
+
* @see More details on Custom Types: {@link https://prismic.io/docs/custom-types}
|
|
127
|
+
* @see More details on the UID field: {@link https://prismic.io/docs/uid}
|
|
128
|
+
*/
|
|
129
|
+
export interface PrismicDocumentWithUID<
|
|
130
|
+
DataInterface extends Record<
|
|
131
|
+
string,
|
|
132
|
+
AnyRegularField | GroupField | SliceZone
|
|
133
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
|
+
> = Record<string, any>,
|
|
135
|
+
TypeEnum = string,
|
|
136
|
+
LangEnum = string,
|
|
137
|
+
> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
|
|
138
|
+
/**
|
|
139
|
+
* The unique identifier for the document. Guaranteed to be unique among all
|
|
140
|
+
* Prismic documents of the same type.
|
|
141
|
+
*/
|
|
142
|
+
uid: string;
|
|
143
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { EmptyObjectField, FieldState } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* oEmbed 1.0 possible types.
|
|
5
|
+
*
|
|
6
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
7
|
+
*/
|
|
8
|
+
export const OEmbedType = {
|
|
9
|
+
Photo: "photo",
|
|
10
|
+
Video: "video",
|
|
11
|
+
Link: "link",
|
|
12
|
+
Rich: "rich",
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* oEmbed response base fields. Those are every mandatory fields an oEmbed
|
|
17
|
+
* response must feature.
|
|
18
|
+
*
|
|
19
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
20
|
+
*/
|
|
21
|
+
type OEmbedBase<TType extends (typeof OEmbedType)[keyof typeof OEmbedType]> = {
|
|
22
|
+
/**
|
|
23
|
+
* oEmbed resource type.
|
|
24
|
+
*/
|
|
25
|
+
type: TType;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* oEmbed version number, this must be "1.0".
|
|
29
|
+
*/
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* oEmbed response extra fields. Those are every non-mandatory and unknown
|
|
35
|
+
* fields an oEmbed response can feature.
|
|
36
|
+
*
|
|
37
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
38
|
+
*/
|
|
39
|
+
export type OEmbedExtra = {
|
|
40
|
+
/**
|
|
41
|
+
* oEmbed text title, describing the resource.
|
|
42
|
+
*/
|
|
43
|
+
title?: string | null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* oEmbed resource author/owner name.
|
|
47
|
+
*/
|
|
48
|
+
author_name?: string | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* oEmbed resource author/owner URL.
|
|
52
|
+
*/
|
|
53
|
+
author_url?: string | null;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* oEmbed resource provider name.
|
|
57
|
+
*/
|
|
58
|
+
provider_name?: string | null;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* oEmbed resource provider URL.
|
|
62
|
+
*/
|
|
63
|
+
provider_url?: string | null;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* oEmbed suggested cache lifetime for the resource, in seconds.
|
|
67
|
+
*/
|
|
68
|
+
cache_age?: number | null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* oEmbed resource thumbnail URL.
|
|
72
|
+
*/
|
|
73
|
+
thumbnail_url?: string | null;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* oEmbed resource thumbnail width.
|
|
77
|
+
*/
|
|
78
|
+
thumbnail_width?: number | null;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* oEmbed resource thumbnail height.
|
|
82
|
+
*/
|
|
83
|
+
thumbnail_height?: number | null;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Providers may optionally include any parameters not specified in this
|
|
87
|
+
* document (so long as they use the same key-value format) and consumers may
|
|
88
|
+
* choose to ignore these. Consumers must ignore parameters they do not
|
|
89
|
+
* understand.
|
|
90
|
+
*
|
|
91
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
92
|
+
*/
|
|
93
|
+
[key: string]: unknown | null;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* oEmbed photo type. Those are every mandatory fields an oEmbed photo response
|
|
98
|
+
* must feature.
|
|
99
|
+
*
|
|
100
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
101
|
+
*/
|
|
102
|
+
export type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {
|
|
103
|
+
/**
|
|
104
|
+
* oEmbed source URL of the image.
|
|
105
|
+
*/
|
|
106
|
+
url: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* oEmbed width in pixels of the image.
|
|
110
|
+
*/
|
|
111
|
+
width: number;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* oEmbed height in pixels of the image.
|
|
115
|
+
*/
|
|
116
|
+
height: number;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* oEmbed video type. Those are every mandatory fields an oEmbed video response
|
|
121
|
+
* must feature.
|
|
122
|
+
*
|
|
123
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
124
|
+
*/
|
|
125
|
+
export type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
|
|
126
|
+
/**
|
|
127
|
+
* oEmbed HTML required to embed a video player.
|
|
128
|
+
*/
|
|
129
|
+
html: string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* oEmbed width in pixels required to display the HTML.
|
|
133
|
+
*/
|
|
134
|
+
width: number;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* oEmbed height in pixels required to display the HTML.
|
|
138
|
+
*/
|
|
139
|
+
height: number;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* oEmbed link type. Those are every mandatory fields an oEmbed link response
|
|
144
|
+
* must feature.
|
|
145
|
+
*
|
|
146
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
147
|
+
*/
|
|
148
|
+
export type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* oEmbed rich type. Those are every mandatory fields an oEmbed rich response
|
|
152
|
+
* must feature.
|
|
153
|
+
*
|
|
154
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
155
|
+
*/
|
|
156
|
+
export type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
|
|
157
|
+
/**
|
|
158
|
+
* oEmbed HTML required to display the resource.
|
|
159
|
+
*/
|
|
160
|
+
html: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* oEmbed width in pixels required to display the HTML.
|
|
164
|
+
*/
|
|
165
|
+
width: number;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* oEmbed height in pixels required to display the HTML.
|
|
169
|
+
*/
|
|
170
|
+
height: number;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Any of the possible types of oEmbed response. Those contains only mandatory
|
|
175
|
+
* fields their respective oEmbed response type must feature.
|
|
176
|
+
*
|
|
177
|
+
* @see oEmbed specification: {@link https://oembed.com}
|
|
178
|
+
*/
|
|
179
|
+
export type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* An Embed field.
|
|
183
|
+
*
|
|
184
|
+
* @typeParam Data - Data provided by the URL's oEmbed provider.
|
|
185
|
+
* @typeParam State - State of the field which determines its shape.
|
|
186
|
+
* @see More details: {@link https://prismic.io/docs/embed}
|
|
187
|
+
*/
|
|
188
|
+
export type EmbedField<
|
|
189
|
+
Data extends AnyOEmbed = AnyOEmbed & OEmbedExtra,
|
|
190
|
+
State extends FieldState = FieldState,
|
|
191
|
+
> = State extends "empty"
|
|
192
|
+
? EmptyObjectField
|
|
193
|
+
: Data & {
|
|
194
|
+
embed_url: string;
|
|
195
|
+
html: string | null;
|
|
196
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EmptyObjectField, FieldState } from "./types";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A Geopoint field.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/geopoint}
|
|
8
|
+
*/
|
|
9
|
+
export type GeoPointField<State extends FieldState = FieldState> =
|
|
10
|
+
State extends "empty"
|
|
11
|
+
? EmptyObjectField
|
|
12
|
+
: {
|
|
13
|
+
latitude: number;
|
|
14
|
+
longitude: number;
|
|
15
|
+
};
|