@prismicio/client 7.0.1-alpha.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/createClient.cjs +6 -18
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +9 -42
- package/dist/createClient.js +6 -18
- package/dist/createClient.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +6 -9
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +4 -7
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +4 -7
- package/dist/helpers/asText.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.d.ts +1 -1
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/package.json +12 -6
- package/src/createClient.ts +16 -59
- package/src/helpers/asHTML.ts +6 -9
- package/src/helpers/asLink.ts +4 -7
- package/src/helpers/asText.ts +4 -7
- package/src/index.ts +0 -1
- package/src/lib/castThunk.ts +2 -8
package/dist/helpers/asLink.d.ts
CHANGED
|
@@ -38,13 +38,6 @@ export declare const asLink: {
|
|
|
38
38
|
/**
|
|
39
39
|
* Resolves any type of link field or Prismic document to a URL.
|
|
40
40
|
*
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* asLink(field);
|
|
45
|
-
* asLink(field, { linkResolver });
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
41
|
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
49
42
|
* type
|
|
50
43
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
@@ -64,6 +57,10 @@ export declare const asLink: {
|
|
|
64
57
|
*
|
|
65
58
|
* @deprecated Use object-style configuration instead.
|
|
66
59
|
*
|
|
60
|
+
* ```ts
|
|
61
|
+
* asLink(field);
|
|
62
|
+
* asLink(field, { linkResolver });
|
|
63
|
+
* ```
|
|
67
64
|
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
68
65
|
* type
|
|
69
66
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLink.js","sources":["../../../src/helpers/asLink.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\";\nimport type { PrismicDocument } from \"../types/value/document\";\nimport { FilledLinkToWebField, LinkField, LinkType } from \"../types/value/link\";\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\";\n\nimport { documentToLinkField } from \"./documentToLinkField\";\n\n/**\n * Resolves a link to a Prismic document to a URL\n *\n * @typeParam ReturnType - Return type of your link resolver function, useful if\n * you prefer to return a complex object\n * @param linkToDocumentField - A document link field to resolve\n *\n * @returns Resolved URL\n *\n * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}\n */\nexport type LinkResolverFunction<ReturnType = string | null | undefined> = (\n\tlinkToDocumentField: FilledContentRelationshipField,\n) => ReturnType;\n\n/**\n * Configuration that determines the output of `asLink()`.\n */\ntype AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> =\n\t{\n\t\t/**\n\t\t * An optional link resolver function. Without it, you are expected to use\n\t\t * the `routes` options from the API.\n\t\t */\n\t\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;\n\t};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsLinkDeprecatedTupleConfig<\n\tLinkResolverFunctionReturnType = string | null | undefined,\n> = [\n\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null,\n];\n\n/**\n * The return type of `asLink()`.\n */\nexport type AsLinkReturnType<\n\tLinkResolverFunctionReturnType = string | null | undefined,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = Field extends\n\t| FilledLinkToWebField\n\t| FilledLinkToMediaField\n\t| FilledContentRelationshipField\n\t| PrismicDocument\n\t? LinkResolverFunctionReturnType | string | null\n\t: null;\n\n// TODO: Remove overload when we remove support for deprecated tuple-style configuration.\nexport const asLink: {\n\t/**\n\t * Resolves any type of link field or Prismic document to a URL.\n\t *\n\t * @
|
|
1
|
+
{"version":3,"file":"asLink.js","sources":["../../../src/helpers/asLink.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\";\nimport type { PrismicDocument } from \"../types/value/document\";\nimport { FilledLinkToWebField, LinkField, LinkType } from \"../types/value/link\";\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\";\n\nimport { documentToLinkField } from \"./documentToLinkField\";\n\n/**\n * Resolves a link to a Prismic document to a URL\n *\n * @typeParam ReturnType - Return type of your link resolver function, useful if\n * you prefer to return a complex object\n * @param linkToDocumentField - A document link field to resolve\n *\n * @returns Resolved URL\n *\n * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}\n */\nexport type LinkResolverFunction<ReturnType = string | null | undefined> = (\n\tlinkToDocumentField: FilledContentRelationshipField,\n) => ReturnType;\n\n/**\n * Configuration that determines the output of `asLink()`.\n */\ntype AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> =\n\t{\n\t\t/**\n\t\t * An optional link resolver function. Without it, you are expected to use\n\t\t * the `routes` options from the API.\n\t\t */\n\t\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;\n\t};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsLinkDeprecatedTupleConfig<\n\tLinkResolverFunctionReturnType = string | null | undefined,\n> = [\n\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null,\n];\n\n/**\n * The return type of `asLink()`.\n */\nexport type AsLinkReturnType<\n\tLinkResolverFunctionReturnType = string | null | undefined,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = Field extends\n\t| FilledLinkToWebField\n\t| FilledLinkToMediaField\n\t| FilledContentRelationshipField\n\t| PrismicDocument\n\t? LinkResolverFunctionReturnType | string | null\n\t: null;\n\n// TODO: Remove overload when we remove support for deprecated tuple-style configuration.\nexport const asLink: {\n\t/**\n\t * Resolves any type of link field or Prismic document to a URL.\n\t *\n\t * @typeParam LinkResolverFunctionReturnType - link resolver function return\n\t * type\n\t * @typeParam Field - Link field or Prismic document to resolve to a URL\n\t *\n\t * @param linkFieldOrDocument - Any kind of link field or a document to\n\t * resolve\n\t * @param config - Configuration that determines the output of `asLink()`\n\t *\n\t * @returns Resolved URL or, if the provided link field or document is empty,\n\t * `null`\n\t * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}\n\t * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}\n\t */\n\t<\n\t\tLinkResolverFunctionReturnType = string | null | undefined,\n\t\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t\t| LinkField\n\t\t\t| PrismicDocument\n\t\t\t| null\n\t\t\t| undefined,\n\t>(\n\t\tlinkFieldOrDocument: Field,\n\t\tconfig?: AsLinkConfig<LinkResolverFunctionReturnType>,\n\t): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;\n\n\t/**\n\t * Resolves any type of link field or Prismic document to a URL.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t *\n\t * ```ts\n\t * asLink(field);\n\t * asLink(field, { linkResolver });\n\t * ```\n\t * @typeParam LinkResolverFunctionReturnType - link resolver function return\n\t * type\n\t * @typeParam Field - Link field or Prismic document to resolve to a URL\n\t *\n\t * @param linkFieldOrDocument - Any kind of link field or a document to\n\t * resolve\n\t * @param linkResolver - An optional link resolver function. Without it, you\n\t * are expected to use the `routes` options from the API\n\t *\n\t * @returns Resolved URL or, if the provided link field or document is empty,\n\t * `null`\n\t * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}\n\t * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}\n\t */\n\t<\n\t\tLinkResolverFunctionReturnType = string | null | undefined,\n\t\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t\t| LinkField\n\t\t\t| PrismicDocument\n\t\t\t| null\n\t\t\t| undefined,\n\t>(\n\t\tlinkFieldOrDocument: Field,\n\t\t...config: AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>\n\t): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;\n} = <\n\tLinkResolverFunctionReturnType = string | null | undefined,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n>(\n\tlinkFieldOrDocument: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple:\n\t\t| [config?: AsLinkConfig<LinkResolverFunctionReturnType>]\n\t\t| AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>\n): AsLinkReturnType<LinkResolverFunctionReturnType, Field> => {\n\tif (!linkFieldOrDocument) {\n\t\treturn null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;\n\t}\n\n\t// Converts document to link field if needed\n\tconst linkField =\n\t\t// prettier-ignore\n\t\t(\n\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n\t\t\t// TODO: Remove the `prettier-ignore` comment when this bug is fixed.\n\t\t\t\"link_type\" in linkFieldOrDocument\n\t\t\t\t? linkFieldOrDocument\n\t\t\t\t: documentToLinkField(linkFieldOrDocument)\n\t\t) as LinkField;\n\n\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\tconst [configObjectOrLinkResolver] = configObjectOrTuple;\n\tlet config: AsLinkConfig<LinkResolverFunctionReturnType>;\n\tif (\n\t\ttypeof configObjectOrLinkResolver === \"function\" ||\n\t\tconfigObjectOrLinkResolver == null\n\t) {\n\t\tconfig = {\n\t\t\tlinkResolver: configObjectOrLinkResolver,\n\t\t};\n\t} else {\n\t\tconfig = { ...configObjectOrLinkResolver };\n\t}\n\n\tswitch (linkField.link_type) {\n\t\tcase LinkType.Media:\n\t\tcase LinkType.Web:\n\t\t\treturn (\"url\" in linkField ? linkField.url : null) as AsLinkReturnType<\n\t\t\t\tLinkResolverFunctionReturnType,\n\t\t\t\tField\n\t\t\t>;\n\n\t\tcase LinkType.Document: {\n\t\t\tif (\"id\" in linkField && config.linkResolver) {\n\t\t\t\t// When using link resolver...\n\t\t\t\tconst resolvedURL = config.linkResolver(linkField);\n\n\t\t\t\tif (resolvedURL != null) {\n\t\t\t\t\treturn resolvedURL as AsLinkReturnType<\n\t\t\t\t\t\tLinkResolverFunctionReturnType,\n\t\t\t\t\t\tField\n\t\t\t\t\t>;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\"url\" in linkField && linkField.url) {\n\t\t\t\t// When using route resolver...\n\t\t\t\treturn linkField.url as AsLinkReturnType<\n\t\t\t\t\tLinkResolverFunctionReturnType,\n\t\t\t\t\tField\n\t\t\t\t>;\n\t\t\t}\n\n\t\t\t// When empty or link resolver and route resolver are not used...\n\t\t\treturn null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;\n\t\t}\n\n\t\tcase LinkType.Any:\n\t\tdefault:\n\t\t\treturn null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;\n\t}\n};\n"],"names":[],"mappings":";;AA+Da,MAAA,SA+DT,CAQH,wBAEG,wBAGyD;AAC5D,MAAI,CAAC,qBAAqB;AAClB,WAAA;AAAA,EACP;AAGK,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMJ,eAAe,sBACZ,sBACA,oBAAoB,mBAAmB;AAAA;AAItC,QAAA,CAAC,0BAA0B,IAAI;AACjC,MAAA;AACJ,MACC,OAAO,+BAA+B,cACtC,8BAA8B,MAC7B;AACQ,aAAA;AAAA,MACR,cAAc;AAAA,IAAA;AAAA,SAET;AACG,aAAA,EAAE,GAAG;EACd;AAED,UAAQ,UAAU,WAAW;AAAA,IAC5B,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACL,aAAA,SAAS,YAAY,UAAU,MAAM;AAAA,IAK9C,KAAK,SAAS,UAAU;AACnB,UAAA,QAAQ,aAAa,OAAO,cAAc;AAEvC,cAAA,cAAc,OAAO,aAAa,SAAS;AAEjD,YAAI,eAAe,MAAM;AACjB,iBAAA;AAAA,QAIP;AAAA,MACD;AAEG,UAAA,SAAS,aAAa,UAAU,KAAK;AAExC,eAAO,UAAU;AAAA,MAIjB;AAGM,aAAA;AAAA,IACP;AAAA,IAED,KAAK,SAAS;AAAA,IACd;AACQ,aAAA;AAAA,EACR;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.cjs","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"@prismicio/richtext\";\n\nimport { RichTextField } from \"../types/value/richText\";\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string;\n};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string];\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null;\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @
|
|
1
|
+
{"version":3,"file":"asText.cjs","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"@prismicio/richtext\";\n\nimport { RichTextField } from \"../types/value/richText\";\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string;\n};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string];\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null;\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param config - Configuration that determines the output of `asText()`\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>;\n\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t *\n\t * ```ts\n\t * asText(field);\n\t * asText(field, { separator });\n\t * ```\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param separator - Separator used to join each element, defaults to a space\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>;\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple;\n\t\tlet config: AsTextConfig;\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t};\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator };\n\t\t}\n\n\t\treturn baseAsText(\n\t\t\trichTextField,\n\t\t\tconfig.separator,\n\t\t) as AsTextReturnType<Field>;\n\t} else {\n\t\treturn null as AsTextReturnType<Field>;\n\t}\n};\n"],"names":["baseAsText"],"mappings":";;;AA4Ba,MAAA,SAoCT,CACH,kBAEG,wBACyB;AAC5B,MAAI,eAAe;AAEZ,UAAA,CAAC,uBAAuB,IAAI;AAC9B,QAAA;AACA,QAAA,OAAO,4BAA4B,UAAU;AACvC,eAAA;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,WAEN;AACG,eAAA,EAAE,GAAG;IACd;AAEM,WAAAA,gBACN,eACA,OAAO,SAAS;AAAA,EAAA,OAEX;AACC,WAAA;AAAA,EACP;AACF;;"}
|
package/dist/helpers/asText.d.ts
CHANGED
|
@@ -22,13 +22,6 @@ export declare const asText: {
|
|
|
22
22
|
/**
|
|
23
23
|
* Serializes a rich text or title field to a plain text string.
|
|
24
24
|
*
|
|
25
|
-
* @example
|
|
26
|
-
*
|
|
27
|
-
* ```ts
|
|
28
|
-
* asText(field);
|
|
29
|
-
* asText(field, { separator });
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
25
|
* @param richTextField - A rich text or title field from Prismic
|
|
33
26
|
* @param config - Configuration that determines the output of `asText()`
|
|
34
27
|
*
|
|
@@ -42,6 +35,10 @@ export declare const asText: {
|
|
|
42
35
|
*
|
|
43
36
|
* @deprecated Use object-style configuration instead.
|
|
44
37
|
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* asText(field);
|
|
40
|
+
* asText(field, { separator });
|
|
41
|
+
* ```
|
|
45
42
|
* @param richTextField - A rich text or title field from Prismic
|
|
46
43
|
* @param separator - Separator used to join each element, defaults to a space
|
|
47
44
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.js","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"@prismicio/richtext\";\n\nimport { RichTextField } from \"../types/value/richText\";\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string;\n};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string];\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null;\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @
|
|
1
|
+
{"version":3,"file":"asText.js","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"@prismicio/richtext\";\n\nimport { RichTextField } from \"../types/value/richText\";\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string;\n};\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string];\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null;\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param config - Configuration that determines the output of `asText()`\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>;\n\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t *\n\t * ```ts\n\t * asText(field);\n\t * asText(field, { separator });\n\t * ```\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param separator - Separator used to join each element, defaults to a space\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>;\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple;\n\t\tlet config: AsTextConfig;\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t};\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator };\n\t\t}\n\n\t\treturn baseAsText(\n\t\t\trichTextField,\n\t\t\tconfig.separator,\n\t\t) as AsTextReturnType<Field>;\n\t} else {\n\t\treturn null as AsTextReturnType<Field>;\n\t}\n};\n"],"names":["baseAsText"],"mappings":";AA4Ba,MAAA,SAoCT,CACH,kBAEG,wBACyB;AAC5B,MAAI,eAAe;AAEZ,UAAA,CAAC,uBAAuB,IAAI;AAC9B,QAAA;AACA,QAAA,OAAO,4BAA4B,UAAU;AACvC,eAAA;AAAA,QACR,WAAW;AAAA,MAAA;AAAA,WAEN;AACG,eAAA,EAAE,GAAG;IACd;AAEM,WAAAA,SACN,eACA,OAAO,SAAS;AAAA,EAAA,OAEX;AACC,WAAA;AAAA,EACP;AACF;"}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tRequestInitLikeOrThunk,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":["filter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAYA,OAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":["filter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAYA,OAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ declare const predicate: {
|
|
|
45
45
|
};
|
|
46
46
|
export { filter, predicate };
|
|
47
47
|
export * as cookie from "./cookie";
|
|
48
|
-
export type { AbortSignalLike, ClientConfig, CreateClient, FetchLike, HttpRequestLike, RequestInitLike,
|
|
48
|
+
export type { AbortSignalLike, ClientConfig, CreateClient, FetchLike, HttpRequestLike, RequestInitLike, ResponseLike, } from "./createClient";
|
|
49
49
|
export type { BuildQueryURLArgs, Ordering, QueryParams, Route, } from "./buildQueryURL";
|
|
50
50
|
export { asDate } from "./helpers/asDate";
|
|
51
51
|
export { asLink } from "./helpers/asLink";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tRequestInitLikeOrThunk,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"castThunk.cjs","sources":["../../../src/lib/castThunk.ts"],"sourcesContent":["/**\n * Ensures that a value is a thunk. If it is already a thunk, it is returned as\n * is. If it is not a thunk, it is converted to a thunk.\n *\n * @typeParam A - Value returned by the thunk.\n *\n * @param a - Value to ensure is a thunk.\n *\n * @returns `a` as a a thunk.\n */\nexport const castThunk =
|
|
1
|
+
{"version":3,"file":"castThunk.cjs","sources":["../../../src/lib/castThunk.ts"],"sourcesContent":["/**\n * Ensures that a value is a thunk. If it is already a thunk, it is returned as\n * is. If it is not a thunk, it is converted to a thunk.\n *\n * @typeParam A - Value returned by the thunk.\n *\n * @param a - Value to ensure is a thunk.\n *\n * @returns `a` as a a thunk.\n */\nexport const castThunk = <A>(a: A | (() => A)): (() => A) => {\n\treturn typeof a === \"function\" ? (a as () => A) : () => a;\n};\n"],"names":[],"mappings":";;AAUa,MAAA,YAAY,CAAI,MAA+B;AAC3D,SAAO,OAAO,MAAM,aAAc,IAAgB,MAAM;AACzD;;"}
|
package/dist/lib/castThunk.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"castThunk.js","sources":["../../../src/lib/castThunk.ts"],"sourcesContent":["/**\n * Ensures that a value is a thunk. If it is already a thunk, it is returned as\n * is. If it is not a thunk, it is converted to a thunk.\n *\n * @typeParam A - Value returned by the thunk.\n *\n * @param a - Value to ensure is a thunk.\n *\n * @returns `a` as a a thunk.\n */\nexport const castThunk =
|
|
1
|
+
{"version":3,"file":"castThunk.js","sources":["../../../src/lib/castThunk.ts"],"sourcesContent":["/**\n * Ensures that a value is a thunk. If it is already a thunk, it is returned as\n * is. If it is not a thunk, it is converted to a thunk.\n *\n * @typeParam A - Value returned by the thunk.\n *\n * @param a - Value to ensure is a thunk.\n *\n * @returns `a` as a a thunk.\n */\nexport const castThunk = <A>(a: A | (() => A)): (() => A) => {\n\treturn typeof a === \"function\" ? (a as () => A) : () => a;\n};\n"],"names":[],"mappings":"AAUa,MAAA,YAAY,CAAI,MAA+B;AAC3D,SAAO,OAAO,MAAM,aAAc,IAAgB,MAAM;AACzD;"}
|
package/dist/package.json.cjs
CHANGED
package/dist/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.0.1
|
|
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
|
},
|
|
@@ -43,8 +49,8 @@
|
|
|
43
49
|
"prepare": "npm run build",
|
|
44
50
|
"release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
|
|
45
51
|
"release:dry": "standard-version --dry-run",
|
|
46
|
-
"release:alpha": "npm run test && standard-version --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
|
|
47
|
-
"release:alpha:dry": "standard-version --prerelease alpha --dry-run",
|
|
52
|
+
"release:alpha": "npm run test && standard-version --release-as major --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
|
|
53
|
+
"release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run",
|
|
48
54
|
"lint": "eslint --ext .js,.ts .",
|
|
49
55
|
"types": "tsc --noEmit",
|
|
50
56
|
"unit": "vitest run --coverage",
|
|
@@ -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/createClient.ts
CHANGED
|
@@ -217,22 +217,6 @@ type RefStringOrThunk =
|
|
|
217
217
|
| string
|
|
218
218
|
| (() => string | undefined | Promise<string | undefined>);
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* Options or a function that returns options provided to the client's `fetch()`
|
|
222
|
-
* on all network requests. These options will be merged with internally
|
|
223
|
-
* required options. They can also be overriden on a per-query basis using the
|
|
224
|
-
* query's `fetchOptions` parameter.
|
|
225
|
-
*
|
|
226
|
-
* If the options must be determined on-demand, a function can be provided. This
|
|
227
|
-
* function can be asynchronous.
|
|
228
|
-
*/
|
|
229
|
-
export type RequestInitLikeOrThunk =
|
|
230
|
-
| RequestInitLike
|
|
231
|
-
| ((
|
|
232
|
-
url: string,
|
|
233
|
-
init?: RequestInitLike,
|
|
234
|
-
) => RequestInitLike | undefined | Promise<RequestInitLike | undefined>);
|
|
235
|
-
|
|
236
220
|
/**
|
|
237
221
|
* Configuration for clients that determine how content is queried.
|
|
238
222
|
*/
|
|
@@ -285,17 +269,11 @@ export type ClientConfig = {
|
|
|
285
269
|
fetch?: FetchLike;
|
|
286
270
|
|
|
287
271
|
/**
|
|
288
|
-
* Options
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* basis using the query's `fetchOptions` parameter.
|
|
292
|
-
*
|
|
293
|
-
* If the options must be determined on-demand, a function can be provided.
|
|
294
|
-
* This function can be asynchronous.
|
|
295
|
-
*
|
|
296
|
-
* @experimental
|
|
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.
|
|
297
275
|
*/
|
|
298
|
-
fetchOptions?:
|
|
276
|
+
fetchOptions?: RequestInitLike;
|
|
299
277
|
};
|
|
300
278
|
|
|
301
279
|
/**
|
|
@@ -303,17 +281,11 @@ export type ClientConfig = {
|
|
|
303
281
|
*/
|
|
304
282
|
type FetchParams = {
|
|
305
283
|
/**
|
|
306
|
-
* Options
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* basis using the query's `fetchOptions` parameter.
|
|
310
|
-
*
|
|
311
|
-
* If the options must be determined on-demand, a function can be provided.
|
|
312
|
-
* This function can be asynchronous.
|
|
313
|
-
*
|
|
314
|
-
* @experimental
|
|
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.
|
|
315
287
|
*/
|
|
316
|
-
fetchOptions?:
|
|
288
|
+
fetchOptions?: RequestInitLike;
|
|
317
289
|
|
|
318
290
|
/**
|
|
319
291
|
* An `AbortSignal` provided by an `AbortController`. This allows the network
|
|
@@ -460,18 +432,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
460
432
|
*/
|
|
461
433
|
fetchFn: FetchLike;
|
|
462
434
|
|
|
463
|
-
|
|
464
|
-
* Options or a function that returns options provided to the client's
|
|
465
|
-
* `fetch()` on all network requests. These options will be merged with
|
|
466
|
-
* internally required options. They can also be overriden on a per-query
|
|
467
|
-
* basis using the query's `fetchOptions` parameter.
|
|
468
|
-
*
|
|
469
|
-
* If the options must be determined on-demand, a function can be provided.
|
|
470
|
-
* This function can be asynchronous.
|
|
471
|
-
*
|
|
472
|
-
* @experimental
|
|
473
|
-
*/
|
|
474
|
-
fetchOptions?: RequestInitLikeOrThunk;
|
|
435
|
+
fetchOptions?: RequestInitLike;
|
|
475
436
|
|
|
476
437
|
/**
|
|
477
438
|
* Default parameters that will be sent with each query. These parameters can
|
|
@@ -1827,21 +1788,17 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1827
1788
|
url: string,
|
|
1828
1789
|
params: FetchParams = {},
|
|
1829
1790
|
): Promise<T> {
|
|
1830
|
-
const paramsFetchOptions = await castThunk(params.fetchOptions)(url);
|
|
1831
|
-
const thisFetchOptions = await castThunk(this.fetchOptions)(
|
|
1832
|
-
url,
|
|
1833
|
-
paramsFetchOptions,
|
|
1834
|
-
);
|
|
1835
|
-
|
|
1836
1791
|
const requestInit: RequestInitLike = {
|
|
1837
|
-
...
|
|
1838
|
-
...
|
|
1792
|
+
...this.fetchOptions,
|
|
1793
|
+
...params.fetchOptions,
|
|
1839
1794
|
headers: {
|
|
1840
|
-
...
|
|
1841
|
-
...
|
|
1795
|
+
...this.fetchOptions?.headers,
|
|
1796
|
+
...params.fetchOptions?.headers,
|
|
1842
1797
|
},
|
|
1843
1798
|
signal:
|
|
1844
|
-
|
|
1799
|
+
params.fetchOptions?.signal ||
|
|
1800
|
+
params.signal ||
|
|
1801
|
+
this.fetchOptions?.signal,
|
|
1845
1802
|
};
|
|
1846
1803
|
|
|
1847
1804
|
let job: Promise<FetchJobResult>;
|
package/src/helpers/asHTML.ts
CHANGED
|
@@ -238,15 +238,6 @@ export const asHTML: {
|
|
|
238
238
|
/**
|
|
239
239
|
* Serializes a rich text or title field to an HTML string.
|
|
240
240
|
*
|
|
241
|
-
* @example
|
|
242
|
-
*
|
|
243
|
-
* ```ts
|
|
244
|
-
* asHTML(field);
|
|
245
|
-
* asHTML(field, { linkResolver });
|
|
246
|
-
* asHTML(field, { serializer });
|
|
247
|
-
* asHTML(field, { linkResolver, serializer });
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
241
|
* @param richTextField - A rich text or title field from Prismic
|
|
251
242
|
* @param config - Configuration that determines the output of `asHTML()`
|
|
252
243
|
*
|
|
@@ -264,6 +255,12 @@ export const asHTML: {
|
|
|
264
255
|
*
|
|
265
256
|
* @deprecated Use object-style configuration instead.
|
|
266
257
|
*
|
|
258
|
+
* ```ts
|
|
259
|
+
* asHTML(field);
|
|
260
|
+
* asHTML(field, { linkResolver });
|
|
261
|
+
* asHTML(field, { serializer });
|
|
262
|
+
* asHTML(field, { linkResolver, serializer });
|
|
263
|
+
* ```
|
|
267
264
|
* @param richTextField - A rich text or title field from Prismic
|
|
268
265
|
* @param linkResolver - An optional link resolver function to resolve links,
|
|
269
266
|
* without it you're expected to use the `routes` options from the API
|
package/src/helpers/asLink.ts
CHANGED
|
@@ -65,13 +65,6 @@ export const asLink: {
|
|
|
65
65
|
/**
|
|
66
66
|
* Resolves any type of link field or Prismic document to a URL.
|
|
67
67
|
*
|
|
68
|
-
* @example
|
|
69
|
-
*
|
|
70
|
-
* ```ts
|
|
71
|
-
* asLink(field);
|
|
72
|
-
* asLink(field, { linkResolver });
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
68
|
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
76
69
|
* type
|
|
77
70
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
@@ -102,6 +95,10 @@ export const asLink: {
|
|
|
102
95
|
*
|
|
103
96
|
* @deprecated Use object-style configuration instead.
|
|
104
97
|
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* asLink(field);
|
|
100
|
+
* asLink(field, { linkResolver });
|
|
101
|
+
* ```
|
|
105
102
|
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
106
103
|
* type
|
|
107
104
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
package/src/helpers/asText.ts
CHANGED
|
@@ -30,13 +30,6 @@ export const asText: {
|
|
|
30
30
|
/**
|
|
31
31
|
* Serializes a rich text or title field to a plain text string.
|
|
32
32
|
*
|
|
33
|
-
* @example
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* asText(field);
|
|
37
|
-
* asText(field, { separator });
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
33
|
* @param richTextField - A rich text or title field from Prismic
|
|
41
34
|
* @param config - Configuration that determines the output of `asText()`
|
|
42
35
|
*
|
|
@@ -54,6 +47,10 @@ export const asText: {
|
|
|
54
47
|
*
|
|
55
48
|
* @deprecated Use object-style configuration instead.
|
|
56
49
|
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* asText(field);
|
|
52
|
+
* asText(field, { separator });
|
|
53
|
+
* ```
|
|
57
54
|
* @param richTextField - A rich text or title field from Prismic
|
|
58
55
|
* @param separator - Separator used to join each element, defaults to a space
|
|
59
56
|
*
|
package/src/index.ts
CHANGED
package/src/lib/castThunk.ts
CHANGED
|
@@ -8,12 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @returns `a` as a a thunk.
|
|
10
10
|
*/
|
|
11
|
-
export const castThunk = <
|
|
12
|
-
A
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
|
-
TArgs extends any[],
|
|
15
|
-
>(
|
|
16
|
-
a: A | ((...args: TArgs) => A),
|
|
17
|
-
): ((...args: TArgs) => A) => {
|
|
18
|
-
return typeof a === "function" ? (a as (...args: TArgs) => A) : () => a;
|
|
11
|
+
export const castThunk = <A>(a: A | (() => A)): (() => A) => {
|
|
12
|
+
return typeof a === "function" ? (a as () => A) : () => a;
|
|
19
13
|
};
|