@prismicio/client 7.0.0 → 7.0.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/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +11 -10
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/createClient.cjs +21 -0
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +32 -18
- package/dist/createClient.js +21 -0
- package/dist/createClient.js.map +1 -1
- package/dist/filter.cjs +38 -38
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.ts +38 -38
- package/dist/filter.js +38 -38
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +1 -0
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +2 -0
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.ts +1 -0
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.ts +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.ts +1 -0
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +18 -15
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +21 -15
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +9 -4
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +8 -7
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +2 -0
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/lib/appendFilters.cjs.map +1 -1
- package/dist/lib/appendFilters.d.ts +4 -4
- package/dist/lib/appendFilters.js.map +1 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.d.ts +1 -0
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.d.ts +1 -0
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/everyTagFilter.cjs.map +1 -1
- package/dist/lib/everyTagFilter.d.ts +2 -2
- package/dist/lib/everyTagFilter.js.map +1 -1
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.d.ts +1 -0
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.d.ts +3 -2
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.d.ts +1 -0
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.d.ts +1 -0
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/api/query.d.ts +1 -0
- package/dist/types/api/release.d.ts +1 -0
- package/dist/types/api/tags.d.ts +1 -0
- package/dist/types/model/contentRelationship.d.ts +1 -2
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.ts +2 -4
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -2
- package/dist/types/value/color.d.ts +1 -0
- package/dist/types/value/date.d.ts +1 -0
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.ts +1 -0
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.ts +1 -0
- package/dist/types/value/image.d.ts +2 -0
- package/dist/types/value/integration.d.ts +1 -0
- package/dist/types/value/keyText.d.ts +1 -0
- package/dist/types/value/number.d.ts +1 -0
- package/dist/types/value/select.d.ts +1 -0
- package/dist/types/value/types.d.ts +1 -0
- package/package.json +10 -4
- package/src/buildQueryURL.ts +11 -10
- package/src/createClient.ts +32 -18
- package/src/filter.ts +42 -42
- package/src/getGraphQLEndpoint.ts +1 -0
- package/src/getRepositoryEndpoint.ts +2 -0
- package/src/getRepositoryName.ts +1 -0
- package/src/getToolbarSrc.ts +1 -1
- package/src/helpers/asDate.ts +1 -0
- package/src/helpers/asHTML.ts +20 -17
- package/src/helpers/asLink.ts +21 -15
- package/src/helpers/asLinkAttrs.ts +9 -4
- package/src/helpers/asText.ts +8 -7
- package/src/helpers/documentToLinkField.ts +2 -0
- package/src/lib/appendFilters.ts +4 -4
- package/src/lib/castArray.ts +1 -0
- package/src/lib/castThunk.ts +1 -0
- package/src/lib/everyTagFilter.ts +2 -2
- package/src/lib/findMasterRef.ts +1 -0
- package/src/lib/findRef.ts +3 -2
- package/src/lib/findRefByID.ts +1 -0
- package/src/lib/findRefByLabel.ts +1 -0
- package/src/types/api/query.ts +1 -0
- package/src/types/api/release.ts +1 -0
- package/src/types/api/tags.ts +1 -0
- package/src/types/model/contentRelationship.ts +1 -2
- package/src/types/model/link.ts +2 -4
- package/src/types/model/linkToMedia.ts +1 -2
- package/src/types/value/color.ts +1 -0
- package/src/types/value/date.ts +1 -0
- package/src/types/value/embed.ts +1 -0
- package/src/types/value/geoPoint.ts +1 -0
- package/src/types/value/image.ts +2 -0
- package/src/types/value/integration.ts +1 -0
- package/src/types/value/keyText.ts +1 -0
- package/src/types/value/number.ts +1 -0
- package/src/types/value/select.ts +1 -0
- package/src/types/value/types.ts +1 -0
|
@@ -1 +1 @@
|
|
|
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 * @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 };\n"],"names":[],"mappings":";;AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;;"}
|
|
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 };\n"],"names":[],"mappings":";;AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;;"}
|
|
@@ -158,6 +158,7 @@ export type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;
|
|
|
158
158
|
*
|
|
159
159
|
* @typeParam Data - Data provided by the URL's oEmbed provider.
|
|
160
160
|
* @typeParam State - State of the field which determines its shape.
|
|
161
|
+
*
|
|
161
162
|
* @see More details: {@link https://prismic.io/docs/embed}
|
|
162
163
|
*/
|
|
163
164
|
export type EmbedField<Data extends AnyOEmbed = AnyOEmbed & OEmbedExtra, State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : Data & {
|
|
@@ -1 +1 @@
|
|
|
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 * @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 };\n"],"names":[],"mappings":"AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;"}
|
|
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 };\n"],"names":[],"mappings":"AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;"}
|
|
@@ -3,6 +3,7 @@ import type { EmptyObjectField, FieldState } from "./types";
|
|
|
3
3
|
* A geopoint field.
|
|
4
4
|
*
|
|
5
5
|
* @typeParam State - State of the field which determines its shape.
|
|
6
|
+
*
|
|
6
7
|
* @see More details: {@link https://prismic.io/docs/geopoint}
|
|
7
8
|
*/
|
|
8
9
|
export type GeoPointField<State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : {
|
|
@@ -4,6 +4,7 @@ import type { FieldState, Simplify } from "./types";
|
|
|
4
4
|
* uses this type.
|
|
5
5
|
*
|
|
6
6
|
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*
|
|
7
8
|
* @see {@link ImageField} for a full image field type.
|
|
8
9
|
*/
|
|
9
10
|
export type ImageFieldImage<State extends FieldState = FieldState> = State extends "empty" ? EmptyImageFieldImage : FilledImageFieldImage;
|
|
@@ -31,6 +32,7 @@ export interface EmptyImageFieldImage {
|
|
|
31
32
|
* @typeParam ThumbnailNames - Names of thumbnails. If the field does not
|
|
32
33
|
* contain thumbnails, `never` can be used to "disable" thumbnail fields.
|
|
33
34
|
* @typeParam State - State of the field which determines its shape.
|
|
35
|
+
*
|
|
34
36
|
* @see Image field documentation: {@link https://prismic.io/docs/image}
|
|
35
37
|
*/
|
|
36
38
|
export type ImageField<ThumbnailNames extends string | null = never, State extends FieldState = FieldState> = Simplify<State extends "filled" ? ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>> : ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>>>;
|
|
@@ -4,6 +4,7 @@ import type { FieldState } from "./types";
|
|
|
4
4
|
*
|
|
5
5
|
* @typeParam Data - Data from the integrated API.
|
|
6
6
|
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*
|
|
7
8
|
* @see More details: {@link https://prismic.io/docs/integration-fields}
|
|
8
9
|
*/
|
|
9
10
|
export type IntegrationField<Data extends Record<string, unknown> = Record<string, unknown>, State extends FieldState = FieldState> = State extends "empty" ? null : Data;
|
|
@@ -3,6 +3,7 @@ import type { FieldState } from "./types";
|
|
|
3
3
|
* A key text field
|
|
4
4
|
*
|
|
5
5
|
* @typeParam State - State of the field which determines its shape.
|
|
6
|
+
*
|
|
6
7
|
* @see More details: {@link https://prismic.io/docs/key-text}
|
|
7
8
|
*/
|
|
8
9
|
export type KeyTextField<State extends FieldState = FieldState> = State extends "empty" ? null | "" : string;
|
|
@@ -3,6 +3,7 @@ import type { FieldState } from "./types";
|
|
|
3
3
|
* A number field.
|
|
4
4
|
*
|
|
5
5
|
* @typeParam State - State of the field which determines its shape.
|
|
6
|
+
*
|
|
6
7
|
* @see More details: {@link https://prismic.io/docs/number}
|
|
7
8
|
*/
|
|
8
9
|
export type NumberField<State extends FieldState = FieldState> = State extends "empty" ? null : number;
|
|
@@ -4,6 +4,7 @@ import type { FieldState } from "./types";
|
|
|
4
4
|
*
|
|
5
5
|
* @typeParam Enum - Selectable options for the field.
|
|
6
6
|
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*
|
|
7
8
|
* @see More details: {@link https://prismic.io/docs/select}
|
|
8
9
|
*/
|
|
9
10
|
export type SelectField<Enum extends string = string, State extends FieldState = FieldState> = State extends "empty" ? null : Enum;
|
|
@@ -33,6 +33,7 @@ export type AnyRegularField = TitleField | RichTextField | ImageField | ContentR
|
|
|
33
33
|
* Taken from the `type-fest` package.
|
|
34
34
|
*
|
|
35
35
|
* @typeParam T - The type to simplify.
|
|
36
|
+
*
|
|
36
37
|
* @see https://github.com/sindresorhus/type-fest/blob/cbd7ec510bd136ac045bbc74e391ee686b8a9a2f/source/simplify.d.ts
|
|
37
38
|
*/
|
|
38
39
|
export type Simplify<T> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -23,8 +23,14 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"require":
|
|
27
|
-
|
|
26
|
+
"require": {
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"default": "./dist/index.cjs"
|
|
29
|
+
},
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
28
34
|
},
|
|
29
35
|
"./package.json": "./package.json"
|
|
30
36
|
},
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
"test": "npm run lint && npm run types && npm run unit && npm run build && npm run size"
|
|
54
60
|
},
|
|
55
61
|
"dependencies": {
|
|
56
|
-
"@prismicio/richtext": "^2.1.
|
|
62
|
+
"@prismicio/richtext": "^2.1.5",
|
|
57
63
|
"imgix-url-builder": "^0.0.3"
|
|
58
64
|
},
|
|
59
65
|
"devDependencies": {
|
package/src/buildQueryURL.ts
CHANGED
|
@@ -156,18 +156,18 @@ export interface QueryParams {
|
|
|
156
156
|
*
|
|
157
157
|
* {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
|
|
158
158
|
*
|
|
159
|
-
* @remarks
|
|
160
|
-
*
|
|
161
|
-
* array of
|
|
162
|
-
*
|
|
159
|
+
* @remarks
|
|
160
|
+
* Strings and arrays of strings are deprecated as of
|
|
161
|
+
* `@prismicio/client@7.0.0`. Please migrate to the more explicit array of
|
|
162
|
+
* objects.
|
|
163
163
|
* @example
|
|
164
164
|
*
|
|
165
165
|
* ```typescript
|
|
166
|
-
* buildQueryURL(endpoint,{
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
166
|
+
* buildQueryURL(endpoint, {
|
|
167
|
+
* orderings: [
|
|
168
|
+
* { field: "my.product.price", direction: "desc" },
|
|
169
|
+
* { field: "my.product.title" },
|
|
170
|
+
* ],
|
|
171
171
|
* });
|
|
172
172
|
* ```
|
|
173
173
|
*/
|
|
@@ -219,7 +219,8 @@ type BuildQueryURLParams = {
|
|
|
219
219
|
filters?: string | string[];
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
|
-
* @deprecated Renamed to `filters`. Ensure the value is an array of filters,
|
|
222
|
+
* @deprecated Renamed to `filters`. Ensure the value is an array of filters,
|
|
223
|
+
* not a single, non-array filter.
|
|
223
224
|
*/
|
|
224
225
|
predicates?: string | string[];
|
|
225
226
|
};
|
package/src/createClient.ts
CHANGED
|
@@ -106,7 +106,8 @@ export interface RequestInitLike extends Pick<RequestInit, "cache"> {
|
|
|
106
106
|
/**
|
|
107
107
|
* An AbortSignal to set the `fetch()` request's signal.
|
|
108
108
|
*
|
|
109
|
-
* See:
|
|
109
|
+
* See:
|
|
110
|
+
* [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
110
111
|
*/
|
|
111
112
|
// NOTE: `AbortSignalLike` is `any`! It is left as `AbortSignalLike`
|
|
112
113
|
// for backwards compatibility (the type is exported) and to signal to
|
|
@@ -234,8 +235,8 @@ export type ClientConfig = {
|
|
|
234
235
|
ref?: RefStringOrThunk;
|
|
235
236
|
|
|
236
237
|
/**
|
|
237
|
-
* A list of route resolver objects that define how a document's `url`
|
|
238
|
-
* is resolved.
|
|
238
|
+
* A list of route resolver objects that define how a document's `url`
|
|
239
|
+
* property is resolved.
|
|
239
240
|
*
|
|
240
241
|
* {@link https://prismic.io/docs/route-resolver}
|
|
241
242
|
*/
|
|
@@ -268,10 +269,9 @@ export type ClientConfig = {
|
|
|
268
269
|
fetch?: FetchLike;
|
|
269
270
|
|
|
270
271
|
/**
|
|
271
|
-
* Options provided to the client's `fetch()` on all network requests.
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
* `fetchOptions` parameter.
|
|
272
|
+
* Options provided to the client's `fetch()` on all network requests. These
|
|
273
|
+
* options will be merged with internally required options. They can also be
|
|
274
|
+
* overriden on a per-query basis using the query's `fetchOptions` parameter.
|
|
275
275
|
*/
|
|
276
276
|
fetchOptions?: RequestInitLike;
|
|
277
277
|
};
|
|
@@ -281,10 +281,9 @@ export type ClientConfig = {
|
|
|
281
281
|
*/
|
|
282
282
|
type FetchParams = {
|
|
283
283
|
/**
|
|
284
|
-
* Options provided to the client's `fetch()` on all network requests.
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* `fetchOptions` parameter.
|
|
284
|
+
* Options provided to the client's `fetch()` on all network requests. These
|
|
285
|
+
* options will be merged with internally required options. They can also be
|
|
286
|
+
* overriden on a per-query basis using the query's `fetchOptions` parameter.
|
|
288
287
|
*/
|
|
289
288
|
fetchOptions?: RequestInitLike;
|
|
290
289
|
|
|
@@ -292,15 +291,9 @@ type FetchParams = {
|
|
|
292
291
|
* An `AbortSignal` provided by an `AbortController`. This allows the network
|
|
293
292
|
* request to be cancelled if necessary.
|
|
294
293
|
*
|
|
295
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}
|
|
296
|
-
*
|
|
297
294
|
* @deprecated Move the `signal` parameter into `fetchOptions.signal`:
|
|
298
295
|
*
|
|
299
|
-
*
|
|
300
|
-
* client.getByUID("page", "home",{
|
|
301
|
-
* fetchOptions: { signal }
|
|
302
|
-
* });
|
|
303
|
-
* ```
|
|
296
|
+
* @see \<https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\>
|
|
304
297
|
*/
|
|
305
298
|
signal?: AbortSignalLike;
|
|
306
299
|
};
|
|
@@ -627,6 +620,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
627
620
|
* ```
|
|
628
621
|
*
|
|
629
622
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
623
|
+
*
|
|
630
624
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
631
625
|
*
|
|
632
626
|
* @returns A paginated response containing the result of the query.
|
|
@@ -650,6 +644,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
650
644
|
* ```
|
|
651
645
|
*
|
|
652
646
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
647
|
+
*
|
|
653
648
|
* @param params - Parameters to filter, sort, and paginate results. @returns
|
|
654
649
|
* The first result of the query, if any.
|
|
655
650
|
*/
|
|
@@ -690,6 +685,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
690
685
|
* ```
|
|
691
686
|
*
|
|
692
687
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
688
|
+
*
|
|
693
689
|
* @param params - Parameters to filter, sort, and paginate results.
|
|
694
690
|
*
|
|
695
691
|
* @returns A list of documents matching the query.
|
|
@@ -743,6 +739,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
743
739
|
* ```
|
|
744
740
|
*
|
|
745
741
|
* @typeParam TDocument- Type of the Prismic document returned.
|
|
742
|
+
*
|
|
746
743
|
* @param id - ID of the document.
|
|
747
744
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
748
745
|
*
|
|
@@ -776,6 +773,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
776
773
|
* ```
|
|
777
774
|
*
|
|
778
775
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
776
|
+
*
|
|
779
777
|
* @param ids - A list of document IDs.
|
|
780
778
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
781
779
|
*
|
|
@@ -812,6 +810,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
812
810
|
* ```
|
|
813
811
|
*
|
|
814
812
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
813
|
+
*
|
|
815
814
|
* @param ids - A list of document IDs.
|
|
816
815
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
817
816
|
*
|
|
@@ -842,6 +841,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
842
841
|
* ```
|
|
843
842
|
*
|
|
844
843
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
844
|
+
*
|
|
845
845
|
* @param documentType - The API ID of the document's custom type.
|
|
846
846
|
* @param uid - UID of the document.
|
|
847
847
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
@@ -884,6 +884,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
884
884
|
* ```
|
|
885
885
|
*
|
|
886
886
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
887
|
+
*
|
|
887
888
|
* @param documentType - The API ID of the document's custom type.
|
|
888
889
|
* @param uids - A list of document UIDs.
|
|
889
890
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
@@ -929,6 +930,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
929
930
|
* ```
|
|
930
931
|
*
|
|
931
932
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
933
|
+
*
|
|
932
934
|
* @param documentType - The API ID of the document's custom type.
|
|
933
935
|
* @param uids - A list of document UIDs.
|
|
934
936
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
@@ -969,6 +971,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
969
971
|
* ```
|
|
970
972
|
*
|
|
971
973
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
974
|
+
*
|
|
972
975
|
* @param documentType - The API ID of the singleton custom type.
|
|
973
976
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
974
977
|
*
|
|
@@ -1000,6 +1003,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1000
1003
|
* ```
|
|
1001
1004
|
*
|
|
1002
1005
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1006
|
+
*
|
|
1003
1007
|
* @param documentType - The API ID of the custom type.
|
|
1004
1008
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1005
1009
|
*
|
|
@@ -1031,6 +1035,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1031
1035
|
* ```
|
|
1032
1036
|
*
|
|
1033
1037
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1038
|
+
*
|
|
1034
1039
|
* @param documentType - The API ID of the custom type.
|
|
1035
1040
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1036
1041
|
*
|
|
@@ -1063,6 +1068,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1063
1068
|
* ```
|
|
1064
1069
|
*
|
|
1065
1070
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1071
|
+
*
|
|
1066
1072
|
* @param tag - The tag that must be included on a document.
|
|
1067
1073
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1068
1074
|
*
|
|
@@ -1090,6 +1096,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1090
1096
|
* ```
|
|
1091
1097
|
*
|
|
1092
1098
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1099
|
+
*
|
|
1093
1100
|
* @param tag - The tag that must be included on a document.
|
|
1094
1101
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1095
1102
|
*
|
|
@@ -1117,6 +1124,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1117
1124
|
* ```
|
|
1118
1125
|
*
|
|
1119
1126
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1127
|
+
*
|
|
1120
1128
|
* @param tags - A list of tags that must be included on a document.
|
|
1121
1129
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1122
1130
|
*
|
|
@@ -1145,6 +1153,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1145
1153
|
* ```
|
|
1146
1154
|
*
|
|
1147
1155
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1156
|
+
*
|
|
1148
1157
|
* @param tags - A list of tags that must be included on a document.
|
|
1149
1158
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1150
1159
|
*
|
|
@@ -1173,6 +1182,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1173
1182
|
* ```
|
|
1174
1183
|
*
|
|
1175
1184
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1185
|
+
*
|
|
1176
1186
|
* @param tags - A list of tags that must be included on a document.
|
|
1177
1187
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1178
1188
|
*
|
|
@@ -1203,6 +1213,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1203
1213
|
* ```
|
|
1204
1214
|
*
|
|
1205
1215
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1216
|
+
*
|
|
1206
1217
|
* @param tags - A list of tags that must be included on a document.
|
|
1207
1218
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1208
1219
|
*
|
|
@@ -1573,6 +1584,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1573
1584
|
* supported.
|
|
1574
1585
|
*
|
|
1575
1586
|
* @returns The `fetch()` Response for the request.
|
|
1587
|
+
*
|
|
1576
1588
|
* @experimental
|
|
1577
1589
|
*/
|
|
1578
1590
|
async graphQLFetch(
|
|
@@ -1667,6 +1679,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1667
1679
|
* @param name - Name of the form.
|
|
1668
1680
|
*
|
|
1669
1681
|
* @returns The repository form.
|
|
1682
|
+
*
|
|
1670
1683
|
* @throws If a matching form cannot be found.
|
|
1671
1684
|
*/
|
|
1672
1685
|
private async getCachedRepositoryForm(
|
|
@@ -1765,6 +1778,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1765
1778
|
* normalizes unsuccessful network requests.
|
|
1766
1779
|
*
|
|
1767
1780
|
* @typeParam T - The JSON response.
|
|
1781
|
+
*
|
|
1768
1782
|
* @param url - URL to the resource to fetch.
|
|
1769
1783
|
* @param params - Prismic REST API parameters for the network request.
|
|
1770
1784
|
*
|
package/src/filter.ts
CHANGED
|
@@ -30,10 +30,10 @@ const formatValue = (
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Creates a filter builder function for filters with a path and
|
|
34
|
-
* arguments.
|
|
33
|
+
* Creates a filter builder function for filters with a path and arguments.
|
|
35
34
|
*
|
|
36
35
|
* @typeParam Args - Arguments for the filter.
|
|
36
|
+
*
|
|
37
37
|
* @param name - Name of the filter used in the resulting string.
|
|
38
38
|
*
|
|
39
39
|
* @returns Filter builder function for the given name.
|
|
@@ -73,8 +73,8 @@ const pathFilter = (name: string) => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* Creates a filter builder function for filters with only arguments and
|
|
77
|
-
*
|
|
76
|
+
* Creates a filter builder function for filters with only arguments and no
|
|
77
|
+
* path.
|
|
78
78
|
*
|
|
79
79
|
* @param name - Name of the filter used in the resulting string.
|
|
80
80
|
*
|
|
@@ -95,8 +95,8 @@ const argsFilter = <Args extends unknown[]>(name: string) => {
|
|
|
95
95
|
|
|
96
96
|
export const filter = {
|
|
97
97
|
/**
|
|
98
|
-
* The `at` filter checks that the path matches the described value
|
|
99
|
-
*
|
|
98
|
+
* The `at` filter checks that the path matches the described value exactly.
|
|
99
|
+
* It takes a single value for a field or an array (only for tags).
|
|
100
100
|
*
|
|
101
101
|
* {@link https://prismic.io/docs/rest-api-technical-reference#at}
|
|
102
102
|
*/
|
|
@@ -115,8 +115,8 @@ export const filter = {
|
|
|
115
115
|
),
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
|
-
* The `any` filter takes an array of values. It works exactly the same way
|
|
119
|
-
*
|
|
118
|
+
* The `any` filter takes an array of values. It works exactly the same way as
|
|
119
|
+
* the `at` operator, but checks whether the fragment matches any of the
|
|
120
120
|
* values in the array.
|
|
121
121
|
*
|
|
122
122
|
* {@link https://prismic.io/docs/rest-api-technical-reference#any}
|
|
@@ -126,9 +126,9 @@ export const filter = {
|
|
|
126
126
|
),
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
|
-
* The `in` filter is used specifically to retrieve an array of documents
|
|
130
|
-
*
|
|
131
|
-
*
|
|
129
|
+
* The `in` filter is used specifically to retrieve an array of documents by
|
|
130
|
+
* their IDs or UIDs. This filter is much more efficient at this than the any
|
|
131
|
+
* filter.
|
|
132
132
|
*
|
|
133
133
|
* {@link https://prismic.io/docs/rest-api-technical-reference#in}
|
|
134
134
|
*/
|
|
@@ -147,9 +147,9 @@ export const filter = {
|
|
|
147
147
|
fulltext: pathWithArgsFilter<[searchTerms: string]>("fulltext"),
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* The `has` filter checks whether a fragment has a value. It will return
|
|
151
|
-
*
|
|
152
|
-
*
|
|
150
|
+
* The `has` filter checks whether a fragment has a value. It will return all
|
|
151
|
+
* the documents of the specified type that contain a value for the specified
|
|
152
|
+
* field.
|
|
153
153
|
*
|
|
154
154
|
* {@link https://prismic.io/docs/rest-api-technical-reference#has}
|
|
155
155
|
*/
|
|
@@ -174,8 +174,8 @@ export const filter = {
|
|
|
174
174
|
similar: argsFilter<[id: string, value: number]>("similar"),
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
|
-
* The `geopoint.near` filter checks that the value in the path is within
|
|
178
|
-
*
|
|
177
|
+
* The `geopoint.near` filter checks that the value in the path is within the
|
|
178
|
+
* radius of the given coordinates.
|
|
179
179
|
*
|
|
180
180
|
* This filter will only work for a geopoint field.
|
|
181
181
|
*
|
|
@@ -195,16 +195,16 @@ export const filter = {
|
|
|
195
195
|
numberLessThan: pathWithArgsFilter<[value: number]>("number.lt"),
|
|
196
196
|
|
|
197
197
|
/**
|
|
198
|
-
* The `number.gt` filter checks that the value in the number field is
|
|
199
|
-
*
|
|
198
|
+
* The `number.gt` filter checks that the value in the number field is greater
|
|
199
|
+
* than the value passed into the filter.
|
|
200
200
|
*
|
|
201
201
|
* {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}
|
|
202
202
|
*/
|
|
203
203
|
numberGreaterThan: pathWithArgsFilter<[value: number]>("number.gt"),
|
|
204
204
|
|
|
205
205
|
/**
|
|
206
|
-
* The `number.inRange` filter checks that the value in the path is within
|
|
207
|
-
*
|
|
206
|
+
* The `number.inRange` filter checks that the value in the path is within the
|
|
207
|
+
* two values passed into the filter.
|
|
208
208
|
*
|
|
209
209
|
* {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}
|
|
210
210
|
*/
|
|
@@ -214,8 +214,8 @@ export const filter = {
|
|
|
214
214
|
),
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* The `date.after` filter checks that the value in the path is after the
|
|
218
|
-
*
|
|
217
|
+
* The `date.after` filter checks that the value in the path is after the date
|
|
218
|
+
* value passed into the filter.
|
|
219
219
|
*
|
|
220
220
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
221
221
|
*/
|
|
@@ -230,8 +230,8 @@ export const filter = {
|
|
|
230
230
|
dateBefore: pathWithArgsFilter<[date: string | number | Date]>("date.before"),
|
|
231
231
|
|
|
232
232
|
/**
|
|
233
|
-
* The `date.between` filter checks that the value in the path is within
|
|
234
|
-
*
|
|
233
|
+
* The `date.between` filter checks that the value in the path is within the
|
|
234
|
+
* date values passed into the filter.
|
|
235
235
|
*
|
|
236
236
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
237
237
|
*/
|
|
@@ -241,16 +241,16 @@ export const filter = {
|
|
|
241
241
|
>("date.between"),
|
|
242
242
|
|
|
243
243
|
/**
|
|
244
|
-
* The `date.day-of-month` filter checks that the value in the path is
|
|
245
|
-
*
|
|
244
|
+
* The `date.day-of-month` filter checks that the value in the path is equal
|
|
245
|
+
* to the day of the month passed into the filter.
|
|
246
246
|
*
|
|
247
247
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
248
248
|
*/
|
|
249
249
|
dateDayOfMonth: pathWithArgsFilter<[day: number]>("date.day-of-month"),
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
* The `date.day-of-month-after` filter checks that the value in the path
|
|
253
|
-
*
|
|
252
|
+
* The `date.day-of-month-after` filter checks that the value in the path is
|
|
253
|
+
* after the day of the month passed into the filter.
|
|
254
254
|
*
|
|
255
255
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
256
256
|
*/
|
|
@@ -259,8 +259,8 @@ export const filter = {
|
|
|
259
259
|
),
|
|
260
260
|
|
|
261
261
|
/**
|
|
262
|
-
* The `date.day-of-month-before` filter checks that the value in the path
|
|
263
|
-
*
|
|
262
|
+
* The `date.day-of-month-before` filter checks that the value in the path is
|
|
263
|
+
* before the day of the month passed into the filter.
|
|
264
264
|
*
|
|
265
265
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
266
266
|
*/
|
|
@@ -269,8 +269,8 @@ export const filter = {
|
|
|
269
269
|
),
|
|
270
270
|
|
|
271
271
|
/**
|
|
272
|
-
* The `date.day-of-week` filter checks that the value in the path is equal
|
|
273
|
-
*
|
|
272
|
+
* The `date.day-of-week` filter checks that the value in the path is equal to
|
|
273
|
+
* the day of the week passed into the filter.
|
|
274
274
|
*
|
|
275
275
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
276
276
|
*/
|
|
@@ -305,8 +305,8 @@ export const filter = {
|
|
|
305
305
|
dateMonth: pathWithArgsFilter<[month: string | number]>("date.month"),
|
|
306
306
|
|
|
307
307
|
/**
|
|
308
|
-
* The `date.month-after` filter checks that the value in the path occurs
|
|
309
|
-
*
|
|
308
|
+
* The `date.month-after` filter checks that the value in the path occurs in
|
|
309
|
+
* any month after the value passed into the filter.
|
|
310
310
|
*
|
|
311
311
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
312
312
|
*/
|
|
@@ -314,8 +314,8 @@ export const filter = {
|
|
|
314
314
|
pathWithArgsFilter<[month: string | number]>("date.month-after"),
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
|
-
* The `date.month-before` filter checks that the value in the path occurs
|
|
318
|
-
*
|
|
317
|
+
* The `date.month-before` filter checks that the value in the path occurs in
|
|
318
|
+
* any month before the value passed into the filter.
|
|
319
319
|
*
|
|
320
320
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
321
321
|
*/
|
|
@@ -323,24 +323,24 @@ export const filter = {
|
|
|
323
323
|
pathWithArgsFilter<[month: string | number]>("date.month-before"),
|
|
324
324
|
|
|
325
325
|
/**
|
|
326
|
-
* The `date.year` filter checks that the value in the path occurs in the
|
|
327
|
-
*
|
|
326
|
+
* The `date.year` filter checks that the value in the path occurs in the year
|
|
327
|
+
* value passed into the filter.
|
|
328
328
|
*
|
|
329
329
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
330
330
|
*/
|
|
331
331
|
dateYear: pathWithArgsFilter<[year: number]>("date.year"),
|
|
332
332
|
|
|
333
333
|
/**
|
|
334
|
-
* The `date.hour` filter checks that the value in the path occurs within
|
|
335
|
-
*
|
|
334
|
+
* The `date.hour` filter checks that the value in the path occurs within the
|
|
335
|
+
* hour value passed into the filter.
|
|
336
336
|
*
|
|
337
337
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
338
338
|
*/
|
|
339
339
|
dateHour: pathWithArgsFilter<[hour: number]>("date.hour"),
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* The `date.hour-after` filter checks that the value in the path occurs
|
|
343
|
-
*
|
|
342
|
+
* The `date.hour-after` filter checks that the value in the path occurs after
|
|
343
|
+
* the hour value passed into the filter.
|
|
344
344
|
*
|
|
345
345
|
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
346
346
|
*/
|
|
@@ -6,6 +6,7 @@ import { isRepositoryName } from "./isRepositoryName";
|
|
|
6
6
|
* Get a repository's Prismic GraphQL endpoint.
|
|
7
7
|
*
|
|
8
8
|
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
9
|
+
*
|
|
9
10
|
* @param repositoryName - Name of the repository.
|
|
10
11
|
*
|
|
11
12
|
* @returns The repository's Prismic REST API V2 endpoint
|