@prismicio/client 7.7.3 → 7.7.4
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 +3 -3
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +1 -1
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +31 -31
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +35 -35
- package/dist/createClient.js +31 -31
- package/dist/createClient.js.map +1 -1
- package/dist/errors/ForbiddenError.cjs.map +1 -1
- package/dist/errors/ForbiddenError.js.map +1 -1
- package/dist/errors/NotFoundError.cjs.map +1 -1
- package/dist/errors/NotFoundError.js.map +1 -1
- package/dist/errors/ParsingError.cjs.map +1 -1
- package/dist/errors/ParsingError.js.map +1 -1
- package/dist/errors/PreviewTokenExpired.cjs.map +1 -1
- package/dist/errors/PreviewTokenExpired.js.map +1 -1
- package/dist/errors/PrismicError.cjs.map +1 -1
- package/dist/errors/PrismicError.js.map +1 -1
- package/dist/errors/PrismicRichTextSerializerError.cjs.map +1 -1
- package/dist/errors/PrismicRichTextSerializerError.js.map +1 -1
- package/dist/errors/RefExpiredError.cjs.map +1 -1
- package/dist/errors/RefExpiredError.js.map +1 -1
- package/dist/errors/RefNotFoundError.cjs.map +1 -1
- package/dist/errors/RefNotFoundError.js.map +1 -1
- package/dist/errors/RepositoryNotFoundError.cjs.map +1 -1
- package/dist/errors/RepositoryNotFoundError.js.map +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +2 -2
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +2 -2
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +2 -2
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +2 -2
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +2 -4
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +2 -2
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +1 -1
- 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.map +1 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +1 -1
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/helpers/unstable_htmlAsRichText.cjs.map +1 -1
- package/dist/helpers/unstable_htmlAsRichText.d.ts +4 -4
- package/dist/helpers/unstable_htmlAsRichText.js.map +1 -1
- package/dist/helpers/unstable_markdownAsRichText.cjs.map +1 -1
- package/dist/helpers/unstable_markdownAsRichText.d.ts +2 -2
- package/dist/helpers/unstable_markdownAsRichText.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/RichTextFieldBuilder.cjs.map +1 -1
- package/dist/lib/RichTextFieldBuilder.d.ts +1 -1
- package/dist/lib/RichTextFieldBuilder.js.map +1 -1
- package/dist/lib/appendFilters.cjs.map +1 -1
- package/dist/lib/appendFilters.js.map +1 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.d.ts +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/everyTagFilter.cjs.map +1 -1
- package/dist/lib/everyTagFilter.js.map +1 -1
- package/dist/lib/filterRichTextField.cjs.map +1 -1
- package/dist/lib/filterRichTextField.d.ts +3 -3
- package/dist/lib/filterRichTextField.js.map +1 -1
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.d.ts +1 -1
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.d.ts +1 -1
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.d.ts +1 -1
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.d.ts +1 -1
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/hastSerializerHelpers.cjs.map +1 -1
- package/dist/lib/hastSerializerHelpers.d.ts +3 -3
- package/dist/lib/hastSerializerHelpers.js.map +1 -1
- package/dist/lib/hastToRichText.cjs +1 -2
- package/dist/lib/hastToRichText.cjs.map +1 -1
- package/dist/lib/hastToRichText.d.ts +4 -4
- package/dist/lib/hastToRichText.js +1 -2
- package/dist/lib/hastToRichText.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -1
- package/dist/lib/minifyGraphQLQuery.js.map +1 -1
- package/dist/lib/rehypeRichText.cjs.map +1 -1
- package/dist/lib/rehypeRichText.d.ts +5 -5
- package/dist/lib/rehypeRichText.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.d.ts +2 -2
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/someTagsFilter.cjs.map +1 -1
- package/dist/lib/someTagsFilter.js.map +1 -1
- package/dist/lib/typeFilter.cjs.map +1 -1
- package/dist/lib/typeFilter.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.ts +1 -1
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.ts +2 -2
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +1 -1
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.ts +1 -1
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.ts +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +1 -1
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/query.d.ts +1 -1
- package/dist/types/api/release.d.ts +1 -1
- package/dist/types/api/repository.d.ts +1 -1
- package/dist/types/model/customType.d.ts +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/slice.cjs.map +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.js.map +1 -1
- package/dist/types/model/title.d.ts +1 -1
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.js.map +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.js.map +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/webhook/apiUpdate.d.ts +1 -1
- package/dist/types/webhook/testTrigger.d.ts +1 -1
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.ts +2 -2
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +1 -1
- package/src/buildQueryURL.ts +51 -51
- package/src/cookie.ts +1 -1
- package/src/createClient.ts +293 -293
- package/src/errors/ForbiddenError.ts +6 -6
- package/src/errors/NotFoundError.ts +1 -1
- package/src/errors/ParsingError.ts +8 -8
- package/src/errors/PreviewTokenExpired.ts +4 -4
- package/src/errors/PrismicError.ts +5 -5
- package/src/errors/PrismicRichTextSerializerError.ts +1 -1
- package/src/errors/RefExpiredError.ts +4 -4
- package/src/errors/RefNotFoundError.ts +4 -4
- package/src/errors/RepositoryNotFoundError.ts +1 -1
- package/src/filter.ts +22 -22
- package/src/getGraphQLEndpoint.ts +5 -5
- package/src/getRepositoryEndpoint.ts +5 -5
- package/src/getRepositoryName.ts +4 -4
- package/src/getToolbarSrc.ts +5 -5
- package/src/helpers/asDate.ts +7 -7
- package/src/helpers/asHTML.ts +54 -56
- package/src/helpers/asImagePixelDensitySrcSet.ts +14 -17
- package/src/helpers/asImageSrc.ts +9 -8
- package/src/helpers/asImageWidthSrcSet.ts +19 -22
- package/src/helpers/asLink.ts +26 -27
- package/src/helpers/asLinkAttrs.ts +30 -29
- package/src/helpers/asText.ts +15 -15
- package/src/helpers/documentToLinkField.ts +6 -6
- package/src/helpers/isFilled.ts +53 -53
- package/src/helpers/mapSliceZone.ts +34 -34
- package/src/helpers/unstable_htmlAsRichText.ts +23 -22
- package/src/helpers/unstable_markdownAsRichText.ts +14 -13
- package/src/index.ts +119 -119
- package/src/isRepositoryEndpoint.ts +4 -4
- package/src/isRepositoryName.ts +2 -2
- package/src/lib/RichTextFieldBuilder.ts +36 -41
- package/src/lib/appendFilters.ts +4 -4
- package/src/lib/castArray.ts +2 -2
- package/src/lib/castThunk.ts +2 -2
- package/src/lib/devMsg.ts +4 -4
- package/src/lib/escapeHTML.ts +24 -24
- package/src/lib/everyTagFilter.ts +4 -4
- package/src/lib/filterRichTextField.ts +31 -31
- package/src/lib/findMasterRef.ts +4 -4
- package/src/lib/findRef.ts +6 -6
- package/src/lib/findRefByID.ts +4 -4
- package/src/lib/findRefByLabel.ts +4 -4
- package/src/lib/getPreviewCookie.ts +11 -11
- package/src/lib/hastSerializerHelpers.ts +41 -37
- package/src/lib/hastToRichText.ts +74 -73
- package/src/lib/isInternalURL.ts +4 -4
- package/src/lib/minifyGraphQLQuery.ts +2 -2
- package/src/lib/rehypeRichText.ts +42 -41
- package/src/lib/serializerHelpers.ts +53 -54
- package/src/lib/someTagsFilter.ts +4 -4
- package/src/lib/typeFilter.ts +3 -3
- package/src/richtext/asText.ts +5 -5
- package/src/richtext/asTree.ts +53 -53
- package/src/richtext/composeSerializers.ts +6 -6
- package/src/richtext/index.ts +7 -7
- package/src/richtext/serialize.ts +11 -11
- package/src/richtext/types.ts +38 -38
- package/src/richtext/wrapMapSerializer.ts +6 -9
- package/src/types/api/query.ts +9 -9
- package/src/types/api/ref.ts +5 -5
- package/src/types/api/release.ts +2 -2
- package/src/types/api/repository.ts +24 -24
- package/src/types/api/tags.ts +1 -1
- package/src/types/model/boolean.ts +7 -7
- package/src/types/model/color.ts +5 -5
- package/src/types/model/contentRelationship.ts +9 -9
- package/src/types/model/customType.ts +9 -9
- package/src/types/model/date.ts +6 -6
- package/src/types/model/embed.ts +5 -5
- package/src/types/model/geoPoint.ts +4 -4
- package/src/types/model/group.ts +6 -6
- package/src/types/model/image.ts +9 -9
- package/src/types/model/integration.ts +6 -6
- package/src/types/model/keyText.ts +5 -5
- package/src/types/model/link.ts +8 -8
- package/src/types/model/linkToMedia.ts +7 -7
- package/src/types/model/number.ts +7 -7
- package/src/types/model/range.ts +8 -8
- package/src/types/model/richText.ts +16 -16
- package/src/types/model/select.ts +7 -7
- package/src/types/model/separator.ts +4 -4
- package/src/types/model/sharedSlice.ts +7 -7
- package/src/types/model/sharedSliceVariation.ts +9 -9
- package/src/types/model/slice.ts +12 -12
- package/src/types/model/sliceZone.ts +11 -11
- package/src/types/model/timestamp.ts +6 -6
- package/src/types/model/title.ts +2 -2
- package/src/types/model/types.ts +26 -26
- package/src/types/model/uid.ts +5 -5
- package/src/types/value/boolean.ts +1 -1
- package/src/types/value/color.ts +2 -2
- package/src/types/value/contentRelationship.ts +15 -15
- package/src/types/value/date.ts +2 -2
- package/src/types/value/document.ts +23 -23
- package/src/types/value/embed.ts +33 -33
- package/src/types/value/geoPoint.ts +4 -4
- package/src/types/value/group.ts +3 -3
- package/src/types/value/image.ts +21 -21
- package/src/types/value/integration.ts +2 -2
- package/src/types/value/keyText.ts +2 -2
- package/src/types/value/link.ts +12 -12
- package/src/types/value/linkToMedia.ts +11 -11
- package/src/types/value/number.ts +2 -2
- package/src/types/value/richText.ts +58 -58
- package/src/types/value/select.ts +2 -2
- package/src/types/value/sharedSlice.ts +5 -5
- package/src/types/value/sharedSliceVariation.ts +5 -5
- package/src/types/value/slice.ts +6 -6
- package/src/types/value/sliceZone.ts +4 -4
- package/src/types/value/timestamp.ts +3 -3
- package/src/types/value/title.ts +4 -4
- package/src/types/value/types.ts +22 -22
- package/src/types/webhook/apiUpdate.ts +18 -18
- package/src/types/webhook/testTrigger.ts +2 -2
- package/src/types/webhook/types.ts +8 -8
- package/dist/_node_modules/hast-util-whitespace/lib/index.cjs +0 -11
- package/dist/_node_modules/hast-util-whitespace/lib/index.cjs.map +0 -1
- package/dist/_node_modules/hast-util-whitespace/lib/index.js +0 -11
- package/dist/_node_modules/hast-util-whitespace/lib/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.cjs","sources":["../../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"embed.cjs","sources":["../../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\"\n\n/**\n * oEmbed 1.0 possible types.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport const OEmbedType = {\n\tPhoto: \"photo\",\n\tVideo: \"video\",\n\tLink: \"link\",\n\tRich: \"rich\",\n} as const\n\n/**\n * oEmbed response base fields. Those are every mandatory fields an oEmbed\n * response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\ntype OEmbedBase<TType extends (typeof OEmbedType)[keyof typeof OEmbedType]> = {\n\t/**\n\t * oEmbed resource type.\n\t */\n\ttype: TType\n\n\t/**\n\t * oEmbed version number, this must be \"1.0\".\n\t */\n\tversion: string\n}\n\n/**\n * oEmbed response extra fields. Those are every non-mandatory and unknown\n * fields an oEmbed response can feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type OEmbedExtra = {\n\t/**\n\t * oEmbed text title, describing the resource.\n\t */\n\ttitle?: string | null\n\n\t/**\n\t * oEmbed resource author/owner name.\n\t */\n\tauthor_name?: string | null\n\n\t/**\n\t * oEmbed resource author/owner URL.\n\t */\n\tauthor_url?: string | null\n\n\t/**\n\t * oEmbed resource provider name.\n\t */\n\tprovider_name?: string | null\n\n\t/**\n\t * oEmbed resource provider URL.\n\t */\n\tprovider_url?: string | null\n\n\t/**\n\t * oEmbed suggested cache lifetime for the resource, in seconds.\n\t */\n\tcache_age?: number | null\n\n\t/**\n\t * oEmbed resource thumbnail URL.\n\t */\n\tthumbnail_url?: string | null\n\n\t/**\n\t * oEmbed resource thumbnail width.\n\t */\n\tthumbnail_width?: number | null\n\n\t/**\n\t * oEmbed resource thumbnail height.\n\t */\n\tthumbnail_height?: number | null\n\n\t/**\n\t * Providers may optionally include any parameters not specified in this\n\t * document (so long as they use the same key-value format) and consumers may\n\t * choose to ignore these. Consumers must ignore parameters they do not\n\t * understand.\n\t *\n\t * @see oEmbed specification: {@link https://oembed.com}\n\t */\n\t[key: string]: unknown | null\n}\n\n/**\n * oEmbed photo type. Those are every mandatory fields an oEmbed photo response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {\n\t/**\n\t * oEmbed source URL of the image.\n\t */\n\turl: string\n\n\t/**\n\t * oEmbed width in pixels of the image.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels of the image.\n\t */\n\theight: number\n}\n\n/**\n * oEmbed video type. Those are every mandatory fields an oEmbed video response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {\n\t/**\n\t * oEmbed HTML required to embed a video player.\n\t */\n\thtml: string\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number\n}\n\n/**\n * oEmbed link type. Those are every mandatory fields an oEmbed link response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>\n\n/**\n * oEmbed rich type. Those are every mandatory fields an oEmbed rich response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {\n\t/**\n\t * oEmbed HTML required to display the resource.\n\t */\n\thtml: string\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number\n}\n\n/**\n * Any of the possible types of oEmbed response. Those contains only mandatory\n * fields their respective oEmbed response type must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed\n\n/**\n * An embed field.\n *\n * @typeParam Data - Data provided by the URL's oEmbed provider.\n * @typeParam State - State of the field which determines its shape.\n *\n * @see More details: {@link https://prismic.io/docs/embed}\n */\nexport type EmbedField<\n\tData extends AnyOEmbed = AnyOEmbed & OEmbedExtra,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyObjectField\n\t: Data & {\n\t\t\tembed_url: string\n\t\t\thtml: string | null\n\t\t}\n"],"names":[],"mappings":";;AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.js","sources":["../../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"embed.js","sources":["../../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\"\n\n/**\n * oEmbed 1.0 possible types.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport const OEmbedType = {\n\tPhoto: \"photo\",\n\tVideo: \"video\",\n\tLink: \"link\",\n\tRich: \"rich\",\n} as const\n\n/**\n * oEmbed response base fields. Those are every mandatory fields an oEmbed\n * response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\ntype OEmbedBase<TType extends (typeof OEmbedType)[keyof typeof OEmbedType]> = {\n\t/**\n\t * oEmbed resource type.\n\t */\n\ttype: TType\n\n\t/**\n\t * oEmbed version number, this must be \"1.0\".\n\t */\n\tversion: string\n}\n\n/**\n * oEmbed response extra fields. Those are every non-mandatory and unknown\n * fields an oEmbed response can feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type OEmbedExtra = {\n\t/**\n\t * oEmbed text title, describing the resource.\n\t */\n\ttitle?: string | null\n\n\t/**\n\t * oEmbed resource author/owner name.\n\t */\n\tauthor_name?: string | null\n\n\t/**\n\t * oEmbed resource author/owner URL.\n\t */\n\tauthor_url?: string | null\n\n\t/**\n\t * oEmbed resource provider name.\n\t */\n\tprovider_name?: string | null\n\n\t/**\n\t * oEmbed resource provider URL.\n\t */\n\tprovider_url?: string | null\n\n\t/**\n\t * oEmbed suggested cache lifetime for the resource, in seconds.\n\t */\n\tcache_age?: number | null\n\n\t/**\n\t * oEmbed resource thumbnail URL.\n\t */\n\tthumbnail_url?: string | null\n\n\t/**\n\t * oEmbed resource thumbnail width.\n\t */\n\tthumbnail_width?: number | null\n\n\t/**\n\t * oEmbed resource thumbnail height.\n\t */\n\tthumbnail_height?: number | null\n\n\t/**\n\t * Providers may optionally include any parameters not specified in this\n\t * document (so long as they use the same key-value format) and consumers may\n\t * choose to ignore these. Consumers must ignore parameters they do not\n\t * understand.\n\t *\n\t * @see oEmbed specification: {@link https://oembed.com}\n\t */\n\t[key: string]: unknown | null\n}\n\n/**\n * oEmbed photo type. Those are every mandatory fields an oEmbed photo response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {\n\t/**\n\t * oEmbed source URL of the image.\n\t */\n\turl: string\n\n\t/**\n\t * oEmbed width in pixels of the image.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels of the image.\n\t */\n\theight: number\n}\n\n/**\n * oEmbed video type. Those are every mandatory fields an oEmbed video response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {\n\t/**\n\t * oEmbed HTML required to embed a video player.\n\t */\n\thtml: string\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number\n}\n\n/**\n * oEmbed link type. Those are every mandatory fields an oEmbed link response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>\n\n/**\n * oEmbed rich type. Those are every mandatory fields an oEmbed rich response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {\n\t/**\n\t * oEmbed HTML required to display the resource.\n\t */\n\thtml: string\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number\n}\n\n/**\n * Any of the possible types of oEmbed response. Those contains only mandatory\n * fields their respective oEmbed response type must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed\n\n/**\n * An embed field.\n *\n * @typeParam Data - Data provided by the URL's oEmbed provider.\n * @typeParam State - State of the field which determines its shape.\n *\n * @see More details: {@link https://prismic.io/docs/embed}\n */\nexport type EmbedField<\n\tData extends AnyOEmbed = AnyOEmbed & OEmbedExtra,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyObjectField\n\t: Data & {\n\t\t\tembed_url: string\n\t\t\thtml: string | null\n\t\t}\n"],"names":[],"mappings":"AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.cjs","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"link.cjs","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { ContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { LinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * For link fields that haven't been filled\n *\n * @typeParam Type - The type of link.\n */\nexport type EmptyLinkField<\n\tType extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,\n> = {\n\tlink_type: Type | string\n}\n\n/**\n * Link that points to external website\n */\nexport interface FilledLinkToWebField {\n\tlink_type: typeof LinkType.Web\n\turl: string\n\ttarget?: string\n}\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled in via\n * GraphQuery of `fetchLinks`).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any>\n\t:\n\t\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>\n\t\t\t| FilledLinkToWebField\n\t\t\t| LinkToMediaField<State>\n"],"names":[],"mappings":";;AAUO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { ContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { LinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * For link fields that haven't been filled\n *\n * @typeParam Type - The type of link.\n */\nexport type EmptyLinkField<\n\tType extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,\n> = {\n\tlink_type: Type | string\n}\n\n/**\n * Link that points to external website\n */\nexport interface FilledLinkToWebField {\n\tlink_type: typeof LinkType.Web\n\turl: string\n\ttarget?: string\n}\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled in via\n * GraphQuery of `fetchLinks`).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any>\n\t:\n\t\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>\n\t\t\t| FilledLinkToWebField\n\t\t\t| LinkToMediaField<State>\n"],"names":[],"mappings":"AAUO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.cjs","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"richText.cjs","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { EmbedField } from \"./embed\"\nimport type { FilledLinkToWebField } from \"./link\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\n\n/**\n * Types enum for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextNodeTypes =\n\t(typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string\n\tspans: RTInlineNode[]\n\tdirection?: \"ltr\" | \"rtl\"\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number\n\tend: number\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label\n\tdata: {\n\t\tlabel: string\n\t}\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image\n\tid: string\n\turl: string\n\talt: string | null\n\tcopyright: string | null\n\tdimensions: {\n\t\twidth: number\n\t\theight: number\n\t}\n\tedit: {\n\t\tx: number\n\t\ty: number\n\t\tzoom: number\n\t\tbackground: string\n\t}\n\tlinkTo?:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField\n}\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed\n\toembed: EmbedField\n}\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink\n\tdata:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list\n\titems: RTListItemNode[]\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList\n\titems: RTOListItemNode[]\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]]\n"],"names":[],"mappings":";;AAYO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"
|
|
1
|
+
{"version":3,"file":"richText.js","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { EmbedField } from \"./embed\"\nimport type { FilledLinkToWebField } from \"./link\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\n\n/**\n * Types enum for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextNodeTypes =\n\t(typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string\n\tspans: RTInlineNode[]\n\tdirection?: \"ltr\" | \"rtl\"\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number\n\tend: number\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label\n\tdata: {\n\t\tlabel: string\n\t}\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image\n\tid: string\n\turl: string\n\talt: string | null\n\tcopyright: string | null\n\tdimensions: {\n\t\twidth: number\n\t\theight: number\n\t}\n\tedit: {\n\t\tx: number\n\t\ty: number\n\t\tzoom: number\n\t\tbackground: string\n\t}\n\tlinkTo?:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField\n}\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed\n\toembed: EmbedField\n}\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink\n\tdata:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list\n\titems: RTListItemNode[]\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList\n\titems: RTOListItemNode[]\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]]\n"],"names":[],"mappings":"AAYO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sources":["../../../../src/types/webhook/types.ts"],"sourcesContent":["import { WebhookBodyAPIUpdate } from \"./apiUpdate\"
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../../src/types/webhook/types.ts"],"sourcesContent":["import type { WebhookBodyAPIUpdate } from \"./apiUpdate\"\nimport type { WebhookBodyTestTrigger } from \"./testTrigger\"\n\nexport type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger\n\n/**\n * Types of Prismic Webhooks.\n *\n * @see More details: {@link https://prismic.io/docs/webhooks}\n */\nexport const WebhookType = {\n\tAPIUpdate: \"api-update\",\n\tTestTrigger: \"test-trigger\",\n} as const\n\nexport interface WebhookBodyBase {\n\ttype: (typeof WebhookType)[keyof typeof WebhookType]\n\tdomain: string\n\tapiUrl: string\n\tsecret: string | null\n}\n"],"names":[],"mappings":";;AAUO,MAAM,cAAc;AAAA,EAC1B,WAAW;AAAA,EACX,aAAa;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WebhookBodyAPIUpdate } from "./apiUpdate";
|
|
2
|
-
import { WebhookBodyTestTrigger } from "./testTrigger";
|
|
1
|
+
import type { WebhookBodyAPIUpdate } from "./apiUpdate";
|
|
2
|
+
import type { WebhookBodyTestTrigger } from "./testTrigger";
|
|
3
3
|
export type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger;
|
|
4
4
|
/**
|
|
5
5
|
* Types of Prismic Webhooks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../src/types/webhook/types.ts"],"sourcesContent":["import { WebhookBodyAPIUpdate } from \"./apiUpdate\"
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../src/types/webhook/types.ts"],"sourcesContent":["import type { WebhookBodyAPIUpdate } from \"./apiUpdate\"\nimport type { WebhookBodyTestTrigger } from \"./testTrigger\"\n\nexport type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger\n\n/**\n * Types of Prismic Webhooks.\n *\n * @see More details: {@link https://prismic.io/docs/webhooks}\n */\nexport const WebhookType = {\n\tAPIUpdate: \"api-update\",\n\tTestTrigger: \"test-trigger\",\n} as const\n\nexport interface WebhookBodyBase {\n\ttype: (typeof WebhookType)[keyof typeof WebhookType]\n\tdomain: string\n\tapiUrl: string\n\tsecret: string | null\n}\n"],"names":[],"mappings":"AAUO,MAAM,cAAc;AAAA,EAC1B,WAAW;AAAA,EACX,aAAa;;"}
|
package/package.json
CHANGED
package/src/buildQueryURL.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { castArray } from "./lib/castArray"
|
|
2
|
-
import { devMsg } from "./lib/devMsg"
|
|
1
|
+
import { castArray } from "./lib/castArray"
|
|
2
|
+
import { devMsg } from "./lib/devMsg"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Create a union of the given object's values, and optionally specify which
|
|
@@ -13,7 +13,7 @@ import { devMsg } from "./lib/devMsg";
|
|
|
13
13
|
type ValueOf<
|
|
14
14
|
ObjectType,
|
|
15
15
|
ValueType extends keyof ObjectType = keyof ObjectType,
|
|
16
|
-
> = ObjectType[ValueType]
|
|
16
|
+
> = ObjectType[ValueType]
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* An `orderings` parameter that orders the results by the specified field.
|
|
@@ -21,8 +21,8 @@ type ValueOf<
|
|
|
21
21
|
* {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
|
|
22
22
|
*/
|
|
23
23
|
export interface Ordering {
|
|
24
|
-
field: string
|
|
25
|
-
direction?: "asc" | "desc"
|
|
24
|
+
field: string
|
|
25
|
+
direction?: "asc" | "desc"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -55,29 +55,29 @@ export interface Route {
|
|
|
55
55
|
/**
|
|
56
56
|
* The custom type of the document.
|
|
57
57
|
*/
|
|
58
|
-
type: string
|
|
58
|
+
type: string
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* A specific UID to which this route definition is scoped. The route is only
|
|
62
62
|
* defined for the document whose UID matches the given UID.
|
|
63
63
|
*/
|
|
64
|
-
uid?: string
|
|
64
|
+
uid?: string
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* A specific language to which this route definition is scoped. The route is
|
|
68
68
|
* only defined for documents whose language matches the given language.
|
|
69
69
|
*/
|
|
70
|
-
lang?: string
|
|
70
|
+
lang?: string
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* The resolved path of the document with optional placeholders.
|
|
74
74
|
*/
|
|
75
|
-
path: string
|
|
75
|
+
path: string
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* An object that lists the API IDs of the Content Relationships in the route.
|
|
79
79
|
*/
|
|
80
|
-
resolvers?: Record<string, string
|
|
80
|
+
resolvers?: Record<string, string>
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -92,7 +92,7 @@ export interface QueryParams {
|
|
|
92
92
|
*
|
|
93
93
|
* {@link https://prismic.io/docs/access-token}
|
|
94
94
|
*/
|
|
95
|
-
accessToken?: string
|
|
95
|
+
accessToken?: string
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
98
|
* The `pageSize` parameter defines the maximum number of documents that the
|
|
@@ -100,14 +100,14 @@ export interface QueryParams {
|
|
|
100
100
|
*
|
|
101
101
|
* {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}
|
|
102
102
|
*/
|
|
103
|
-
pageSize?: number
|
|
103
|
+
pageSize?: number
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* The `page` parameter defines the pagination for the result of your query.
|
|
107
107
|
*
|
|
108
108
|
* {@link https://prismic.io/docs/rest-api-technical-reference#page}
|
|
109
109
|
*/
|
|
110
|
-
page?: number
|
|
110
|
+
page?: number
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* The `after` parameter can be used along with the orderings option. It will
|
|
@@ -116,7 +116,7 @@ export interface QueryParams {
|
|
|
116
116
|
*
|
|
117
117
|
* {@link https://prismic.io/docs/rest-api-technical-reference#after}
|
|
118
118
|
*/
|
|
119
|
-
after?: string
|
|
119
|
+
after?: string
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* The `fetch` parameter is used to make queries faster by only retrieving the
|
|
@@ -124,7 +124,7 @@ export interface QueryParams {
|
|
|
124
124
|
*
|
|
125
125
|
* {@link https://prismic.io/docs/rest-api-technical-reference#fetch}
|
|
126
126
|
*/
|
|
127
|
-
fetch?: string | string[]
|
|
127
|
+
fetch?: string | string[]
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
130
|
* The `fetchLinks` parameter allows you to retrieve a specific content field
|
|
@@ -132,7 +132,7 @@ export interface QueryParams {
|
|
|
132
132
|
*
|
|
133
133
|
* {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}
|
|
134
134
|
*/
|
|
135
|
-
fetchLinks?: string | string[]
|
|
135
|
+
fetchLinks?: string | string[]
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
138
|
* The `graphQuery` parameter allows you to specify which fields to retrieve
|
|
@@ -141,14 +141,14 @@ export interface QueryParams {
|
|
|
141
141
|
*
|
|
142
142
|
* {@link https://prismic.io/docs/graphquery-rest-api}
|
|
143
143
|
*/
|
|
144
|
-
graphQuery?: string
|
|
144
|
+
graphQuery?: string
|
|
145
145
|
|
|
146
146
|
/**
|
|
147
147
|
* The `lang` option defines the language code for the results of your query.
|
|
148
148
|
*
|
|
149
149
|
* {@link https://prismic.io/docs/rest-api-technical-reference#lang}
|
|
150
150
|
*/
|
|
151
|
-
lang?: string
|
|
151
|
+
lang?: string
|
|
152
152
|
|
|
153
153
|
/**
|
|
154
154
|
* The `orderings` parameter orders the results by the specified field(s). You
|
|
@@ -169,11 +169,11 @@ export interface QueryParams {
|
|
|
169
169
|
* { field: "my.product.price", direction: "desc" },
|
|
170
170
|
* { field: "my.product.title" },
|
|
171
171
|
* ],
|
|
172
|
-
* })
|
|
172
|
+
* })
|
|
173
173
|
* ```
|
|
174
174
|
*/
|
|
175
175
|
// TODO: Update TSDoc with deprecated API removal in v8
|
|
176
|
-
orderings?: string | Ordering | (string | Ordering)[]
|
|
176
|
+
orderings?: string | Ordering | (string | Ordering)[]
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* The `routes` option allows you to define how a document's `url` field is
|
|
@@ -181,7 +181,7 @@ export interface QueryParams {
|
|
|
181
181
|
*
|
|
182
182
|
* {@link https://prismic.io/docs/route-resolver}
|
|
183
183
|
*/
|
|
184
|
-
routes?: Route | string | (Route | string)[]
|
|
184
|
+
routes?: Route | string | (Route | string)[]
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
187
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
@@ -191,7 +191,7 @@ export interface QueryParams {
|
|
|
191
191
|
*
|
|
192
192
|
* {@link https://prismic.io/docs/route-resolver}
|
|
193
193
|
*/
|
|
194
|
-
brokenRoute?: string
|
|
194
|
+
brokenRoute?: string
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -203,28 +203,28 @@ type BuildQueryURLParams = {
|
|
|
203
203
|
*
|
|
204
204
|
* {@link https://prismic.io/docs/api#refs-and-the-entry-api}
|
|
205
205
|
*/
|
|
206
|
-
ref: string
|
|
206
|
+
ref: string
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* Ref used to populate integration fields with the latest content.
|
|
210
210
|
*
|
|
211
211
|
* {@link https://prismic.io/docs/integration-fields}
|
|
212
212
|
*/
|
|
213
|
-
integrationFieldsRef?: string
|
|
213
|
+
integrationFieldsRef?: string
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
216
|
* One or more filters to filter documents for the query.
|
|
217
217
|
*
|
|
218
218
|
* {@link https://prismic.io/docs/rest-api-technical-reference#q}
|
|
219
219
|
*/
|
|
220
|
-
filters?: string | string[]
|
|
220
|
+
filters?: string | string[]
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* @deprecated Renamed to `filters`. Ensure the value is an array of filters,
|
|
224
224
|
* not a single, non-array filter.
|
|
225
225
|
*/
|
|
226
|
-
predicates?: string | string[]
|
|
227
|
-
}
|
|
226
|
+
predicates?: string | string[]
|
|
227
|
+
}
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Parameters in this map have been renamed from the official Prismic REST API
|
|
@@ -234,7 +234,7 @@ type BuildQueryURLParams = {
|
|
|
234
234
|
*/
|
|
235
235
|
const RENAMED_PARAMS = {
|
|
236
236
|
accessToken: "access_token",
|
|
237
|
-
} as const
|
|
237
|
+
} as const
|
|
238
238
|
|
|
239
239
|
/**
|
|
240
240
|
* A valid parameter name for the Prismic REST API V2.
|
|
@@ -244,7 +244,7 @@ type ValidParamName =
|
|
|
244
244
|
keyof QueryParams,
|
|
245
245
|
keyof typeof RENAMED_PARAMS | keyof BuildQueryURLParams
|
|
246
246
|
>
|
|
247
|
-
| ValueOf<typeof RENAMED_PARAMS
|
|
247
|
+
| ValueOf<typeof RENAMED_PARAMS>
|
|
248
248
|
|
|
249
249
|
/**
|
|
250
250
|
* Converts an Ordering to a string that is compatible with Prismic's REST API.
|
|
@@ -258,29 +258,29 @@ const castOrderingToString = (ordering: Ordering | string): string => {
|
|
|
258
258
|
// TODO: Remove the following when `orderings` strings are no longer supported.
|
|
259
259
|
if (typeof ordering === "string") {
|
|
260
260
|
if (process.env.NODE_ENV === "development") {
|
|
261
|
-
const [field, direction] = ordering.split(" ")
|
|
261
|
+
const [field, direction] = ordering.split(" ")
|
|
262
262
|
|
|
263
263
|
const objectForm =
|
|
264
264
|
direction === "desc"
|
|
265
265
|
? `{ field: "${field}", direction: "desc" }`
|
|
266
|
-
: `{ field: "${field}" }
|
|
266
|
+
: `{ field: "${field}" }`
|
|
267
267
|
|
|
268
268
|
console.warn(
|
|
269
269
|
`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to the object form: ${objectForm}. For more details, see ${devMsg(
|
|
270
270
|
"orderings-must-be-an-array-of-objects",
|
|
271
271
|
)}`,
|
|
272
|
-
)
|
|
272
|
+
)
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
return ordering
|
|
275
|
+
return ordering
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
return ordering.direction === "desc"
|
|
279
279
|
? `${ordering.field} desc`
|
|
280
|
-
: ordering.field
|
|
281
|
-
}
|
|
280
|
+
: ordering.field
|
|
281
|
+
}
|
|
282
282
|
|
|
283
|
-
export type BuildQueryURLArgs = QueryParams & BuildQueryURLParams
|
|
283
|
+
export type BuildQueryURLArgs = QueryParams & BuildQueryURLParams
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
286
|
* Build a Prismic REST API V2 URL to request documents from a repository. The
|
|
@@ -303,9 +303,9 @@ export const buildQueryURL = (
|
|
|
303
303
|
endpoint: string,
|
|
304
304
|
args: BuildQueryURLArgs,
|
|
305
305
|
): string => {
|
|
306
|
-
const { filters, predicates, ...params } = args
|
|
306
|
+
const { filters, predicates, ...params } = args
|
|
307
307
|
|
|
308
|
-
const url = new URL(`documents/search`, `${endpoint}/`)
|
|
308
|
+
const url = new URL(`documents/search`, `${endpoint}/`)
|
|
309
309
|
|
|
310
310
|
if (filters) {
|
|
311
311
|
// TODO: Remove warning when we remove support for string `filters` values.
|
|
@@ -314,19 +314,19 @@ export const buildQueryURL = (
|
|
|
314
314
|
`[@prismicio/client] A non-array value was provided to the \`filters\` query parameter (\`${filters}\`). Non-array values are deprecated. Please convert it to an array. For more details, see ${devMsg(
|
|
315
315
|
"filters-must-be-an-array",
|
|
316
316
|
)}`,
|
|
317
|
-
)
|
|
317
|
+
)
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
// TODO: Remove `castArray` when we remove support for string `filters` values.
|
|
321
321
|
for (const filter of castArray(filters)) {
|
|
322
|
-
url.searchParams.append("q", `[${filter}]`)
|
|
322
|
+
url.searchParams.append("q", `[${filter}]`)
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
// TODO: Remove when we remove support for deprecated `predicates` argument.
|
|
327
327
|
if (predicates) {
|
|
328
328
|
for (const predicate of castArray(predicates)) {
|
|
329
|
-
url.searchParams.append("q", `[${predicate}]`)
|
|
329
|
+
url.searchParams.append("q", `[${predicate}]`)
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
|
|
@@ -334,12 +334,12 @@ export const buildQueryURL = (
|
|
|
334
334
|
// parameter value needs to be transformed to fit the REST API.
|
|
335
335
|
for (const k in params) {
|
|
336
336
|
const name = (RENAMED_PARAMS[k as keyof typeof RENAMED_PARAMS] ||
|
|
337
|
-
k) as ValidParamName
|
|
337
|
+
k) as ValidParamName
|
|
338
338
|
|
|
339
|
-
let value = params[k as keyof typeof params]
|
|
339
|
+
let value = params[k as keyof typeof params]
|
|
340
340
|
|
|
341
341
|
if (name === "orderings") {
|
|
342
|
-
const scopedValue = params[name]
|
|
342
|
+
const scopedValue = params[name]
|
|
343
343
|
|
|
344
344
|
if (scopedValue != null) {
|
|
345
345
|
// TODO: Remove the following warning when `orderings` strings are no longer supported.
|
|
@@ -351,18 +351,18 @@ export const buildQueryURL = (
|
|
|
351
351
|
`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to an array of objects. For more details, see ${devMsg(
|
|
352
352
|
"orderings-must-be-an-array-of-objects",
|
|
353
353
|
)}`,
|
|
354
|
-
)
|
|
354
|
+
)
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
const v = castArray(scopedValue)
|
|
358
358
|
.map((ordering) => castOrderingToString(ordering))
|
|
359
|
-
.join(",")
|
|
359
|
+
.join(",")
|
|
360
360
|
|
|
361
|
-
value = `[${v}]
|
|
361
|
+
value = `[${v}]`
|
|
362
362
|
}
|
|
363
363
|
} else if (name === "routes") {
|
|
364
364
|
if (typeof params[name] === "object") {
|
|
365
|
-
value = JSON.stringify(castArray(params[name]))
|
|
365
|
+
value = JSON.stringify(castArray(params[name]))
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
|
|
@@ -370,9 +370,9 @@ export const buildQueryURL = (
|
|
|
370
370
|
url.searchParams.set(
|
|
371
371
|
name,
|
|
372
372
|
castArray<string | number | Route | Ordering>(value).join(","),
|
|
373
|
-
)
|
|
373
|
+
)
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
return url.toString()
|
|
378
|
-
}
|
|
377
|
+
return url.toString()
|
|
378
|
+
}
|
package/src/cookie.ts
CHANGED