@prismicio/client 7.0.0-alpha.5 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/buildQueryURL.cjs.map +1 -1
  2. package/dist/buildQueryURL.d.ts +4 -4
  3. package/dist/buildQueryURL.js.map +1 -1
  4. package/dist/createClient.cjs +24 -24
  5. package/dist/createClient.cjs.map +1 -1
  6. package/dist/createClient.d.ts +28 -28
  7. package/dist/createClient.js +24 -24
  8. package/dist/createClient.js.map +1 -1
  9. package/dist/filter.cjs +1 -1
  10. package/dist/filter.cjs.map +1 -1
  11. package/dist/filter.d.ts +1 -1
  12. package/dist/filter.js +1 -1
  13. package/dist/filter.js.map +1 -1
  14. package/dist/helpers/asDate.cjs.map +1 -1
  15. package/dist/helpers/asDate.d.ts +2 -2
  16. package/dist/helpers/asDate.js.map +1 -1
  17. package/dist/helpers/asHTML.cjs.map +1 -1
  18. package/dist/helpers/asHTML.d.ts +17 -17
  19. package/dist/helpers/asHTML.js.map +1 -1
  20. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  21. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +5 -5
  22. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  23. package/dist/helpers/asImageSrc.cjs.map +1 -1
  24. package/dist/helpers/asImageSrc.d.ts +3 -3
  25. package/dist/helpers/asImageSrc.js.map +1 -1
  26. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  27. package/dist/helpers/asImageWidthSrcSet.d.ts +6 -6
  28. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  29. package/dist/helpers/asLink.cjs.map +1 -1
  30. package/dist/helpers/asLink.d.ts +14 -14
  31. package/dist/helpers/asLink.js.map +1 -1
  32. package/dist/helpers/asLinkAttrs.cjs.map +1 -1
  33. package/dist/helpers/asLinkAttrs.d.ts +5 -5
  34. package/dist/helpers/asLinkAttrs.js.map +1 -1
  35. package/dist/helpers/asText.cjs.map +1 -1
  36. package/dist/helpers/asText.d.ts +8 -8
  37. package/dist/helpers/asText.js.map +1 -1
  38. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  39. package/dist/helpers/documentToLinkField.js.map +1 -1
  40. package/dist/helpers/isFilled.cjs +3 -1
  41. package/dist/helpers/isFilled.cjs.map +1 -1
  42. package/dist/helpers/isFilled.d.ts +24 -20
  43. package/dist/helpers/isFilled.js +3 -1
  44. package/dist/helpers/isFilled.js.map +1 -1
  45. package/dist/index.cjs.map +1 -1
  46. package/dist/index.d.ts +12 -2
  47. package/dist/index.js.map +1 -1
  48. package/dist/package.json.cjs +1 -1
  49. package/dist/package.json.js +1 -1
  50. package/dist/types/api/repository.d.ts +2 -2
  51. package/dist/types/model/boolean.d.ts +1 -1
  52. package/dist/types/model/color.d.ts +1 -1
  53. package/dist/types/model/contentRelationship.d.ts +1 -1
  54. package/dist/types/model/customType.d.ts +11 -11
  55. package/dist/types/model/date.d.ts +1 -1
  56. package/dist/types/model/embed.d.ts +1 -1
  57. package/dist/types/model/geoPoint.d.ts +1 -1
  58. package/dist/types/model/group.d.ts +1 -1
  59. package/dist/types/model/image.d.ts +3 -3
  60. package/dist/types/model/{integrationFields.d.ts → integration.d.ts} +3 -3
  61. package/dist/types/model/keyText.d.ts +1 -1
  62. package/dist/types/model/link.cjs.map +1 -1
  63. package/dist/types/model/link.d.ts +2 -2
  64. package/dist/types/model/link.js.map +1 -1
  65. package/dist/types/model/linkToMedia.d.ts +1 -1
  66. package/dist/types/model/number.d.ts +1 -1
  67. package/dist/types/model/richText.d.ts +3 -3
  68. package/dist/types/model/select.d.ts +1 -1
  69. package/dist/types/model/sharedSlice.d.ts +2 -2
  70. package/dist/types/model/sharedSliceVariation.d.ts +1 -1
  71. package/dist/types/model/slice.cjs.map +1 -1
  72. package/dist/types/model/slice.d.ts +1 -1
  73. package/dist/types/model/slice.js.map +1 -1
  74. package/dist/types/model/sliceZone.cjs.map +1 -1
  75. package/dist/types/model/sliceZone.d.ts +2 -2
  76. package/dist/types/model/sliceZone.js.map +1 -1
  77. package/dist/types/model/timestamp.d.ts +1 -1
  78. package/dist/types/model/title.d.ts +1 -1
  79. package/dist/types/model/types.cjs +5 -1
  80. package/dist/types/model/types.cjs.map +1 -1
  81. package/dist/types/model/types.d.ts +10 -6
  82. package/dist/types/model/types.js +5 -1
  83. package/dist/types/model/types.js.map +1 -1
  84. package/dist/types/model/uid.d.ts +1 -1
  85. package/dist/types/value/boolean.d.ts +1 -1
  86. package/dist/types/value/color.d.ts +1 -1
  87. package/dist/types/value/contentRelationship.d.ts +1 -1
  88. package/dist/types/value/date.d.ts +1 -1
  89. package/dist/types/value/document.d.ts +4 -4
  90. package/dist/types/value/embed.cjs.map +1 -1
  91. package/dist/types/value/embed.d.ts +1 -1
  92. package/dist/types/value/embed.js.map +1 -1
  93. package/dist/types/value/geoPoint.d.ts +1 -1
  94. package/dist/types/value/group.d.ts +1 -1
  95. package/dist/types/value/image.d.ts +3 -3
  96. package/dist/types/value/{integrationFields.d.ts → integration.d.ts} +2 -2
  97. package/dist/types/value/keyText.d.ts +1 -1
  98. package/dist/types/value/link.cjs.map +1 -1
  99. package/dist/types/value/link.d.ts +2 -2
  100. package/dist/types/value/link.js.map +1 -1
  101. package/dist/types/value/linkToMedia.d.ts +2 -2
  102. package/dist/types/value/number.d.ts +1 -1
  103. package/dist/types/value/richText.cjs.map +1 -1
  104. package/dist/types/value/richText.d.ts +26 -26
  105. package/dist/types/value/richText.js.map +1 -1
  106. package/dist/types/value/select.d.ts +1 -1
  107. package/dist/types/value/sharedSlice.d.ts +1 -1
  108. package/dist/types/value/sharedSliceVariation.d.ts +3 -0
  109. package/dist/types/value/slice.d.ts +1 -1
  110. package/dist/types/value/timestamp.d.ts +1 -1
  111. package/dist/types/value/title.d.ts +1 -1
  112. package/dist/types/value/types.d.ts +2 -2
  113. package/dist/types/webhook/apiUpdate.d.ts +1 -1
  114. package/package.json +2 -2
  115. package/src/buildQueryURL.ts +4 -4
  116. package/src/createClient.ts +28 -28
  117. package/src/filter.ts +1 -1
  118. package/src/helpers/asDate.ts +2 -2
  119. package/src/helpers/asHTML.ts +18 -18
  120. package/src/helpers/asImagePixelDensitySrcSet.ts +5 -5
  121. package/src/helpers/asImageSrc.ts +3 -3
  122. package/src/helpers/asImageWidthSrcSet.ts +6 -6
  123. package/src/helpers/asLink.ts +18 -18
  124. package/src/helpers/asLinkAttrs.ts +5 -5
  125. package/src/helpers/asText.ts +8 -8
  126. package/src/helpers/documentToLinkField.ts +1 -1
  127. package/src/helpers/isFilled.ts +27 -22
  128. package/src/index.ts +19 -3
  129. package/src/types/api/repository.ts +2 -2
  130. package/src/types/model/boolean.ts +1 -1
  131. package/src/types/model/color.ts +1 -1
  132. package/src/types/model/contentRelationship.ts +1 -1
  133. package/src/types/model/customType.ts +11 -11
  134. package/src/types/model/date.ts +1 -1
  135. package/src/types/model/embed.ts +1 -1
  136. package/src/types/model/geoPoint.ts +1 -1
  137. package/src/types/model/group.ts +1 -1
  138. package/src/types/model/image.ts +3 -3
  139. package/src/types/model/{integrationFields.ts → integration.ts} +3 -3
  140. package/src/types/model/keyText.ts +1 -1
  141. package/src/types/model/link.ts +2 -2
  142. package/src/types/model/linkToMedia.ts +1 -1
  143. package/src/types/model/number.ts +1 -1
  144. package/src/types/model/richText.ts +3 -3
  145. package/src/types/model/select.ts +1 -1
  146. package/src/types/model/sharedSlice.ts +2 -2
  147. package/src/types/model/sharedSliceVariation.ts +1 -1
  148. package/src/types/model/slice.ts +1 -1
  149. package/src/types/model/sliceZone.ts +2 -2
  150. package/src/types/model/timestamp.ts +1 -1
  151. package/src/types/model/title.ts +1 -1
  152. package/src/types/model/types.ts +10 -6
  153. package/src/types/model/uid.ts +1 -1
  154. package/src/types/value/boolean.ts +1 -1
  155. package/src/types/value/color.ts +1 -1
  156. package/src/types/value/contentRelationship.ts +1 -1
  157. package/src/types/value/date.ts +1 -1
  158. package/src/types/value/document.ts +4 -4
  159. package/src/types/value/embed.ts +1 -1
  160. package/src/types/value/geoPoint.ts +1 -1
  161. package/src/types/value/group.ts +1 -1
  162. package/src/types/value/image.ts +4 -4
  163. package/src/types/value/{integrationFields.ts → integration.ts} +2 -2
  164. package/src/types/value/keyText.ts +1 -1
  165. package/src/types/value/link.ts +2 -2
  166. package/src/types/value/linkToMedia.ts +2 -2
  167. package/src/types/value/number.ts +1 -1
  168. package/src/types/value/richText.ts +26 -26
  169. package/src/types/value/select.ts +1 -1
  170. package/src/types/value/sharedSlice.ts +1 -1
  171. package/src/types/value/sharedSliceVariation.ts +3 -0
  172. package/src/types/value/slice.ts +1 -1
  173. package/src/types/value/timestamp.ts +1 -1
  174. package/src/types/value/title.ts +1 -1
  175. package/src/types/value/types.ts +2 -2
  176. package/src/types/webhook/apiUpdate.ts +1 -1
@@ -22,13 +22,13 @@ import type { RichTextField } from "../types/value/richText";
22
22
  import { LinkResolverFunction } from "./asLink";
23
23
 
24
24
  /**
25
- * Serializes a node from a Rich Text or Title field with a function to HTML.
25
+ * Serializes a node from a rich text or title field with a function to HTML.
26
26
  *
27
27
  * Unlike a typical `@prismicio/richtext` function serializer, this serializer
28
28
  * converts the `children` argument to a single string rather than an array of
29
29
  * strings.
30
30
  *
31
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
31
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
32
32
  */
33
33
  export type HTMLRichTextFunctionSerializer = (
34
34
  type: Parameters<RichTextFunctionSerializer<string>>[0],
@@ -39,13 +39,13 @@ export type HTMLRichTextFunctionSerializer = (
39
39
  ) => string | null | undefined;
40
40
 
41
41
  /**
42
- * Serializes a node from a Rich Text or Title field with a map to HTML
42
+ * Serializes a node from a rich text or title field with a map to HTML
43
43
  *
44
44
  * Unlike a typical `@prismicio/richtext` map serializer, this serializer
45
45
  * converts the `children` property to a single string rather than an array of
46
46
  * strings.
47
47
  *
48
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
48
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
49
49
  */
50
50
  export type HTMLRichTextMapSerializer = {
51
51
  [P in keyof RichTextMapSerializer<string>]: (payload: {
@@ -63,7 +63,7 @@ export type HTMLRichTextMapSerializer = {
63
63
  * A {@link RichTextMapSerializerFunction} type specifically for
64
64
  * {@link HTMLRichTextMapSerializer}.
65
65
  *
66
- * @typeParam BlockName - The serializer's Rich Text block type.
66
+ * @typeParam BlockName - The serializer's rich text block type.
67
67
  */
68
68
  type HTMLRichTextMapSerializerFunction<
69
69
  BlockType extends keyof RichTextMapSerializer<string>,
@@ -106,17 +106,17 @@ type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<
106
106
  : never;
107
107
 
108
108
  /**
109
- * Serializes a node from a Rich Text or Title field with a map or a function to HTML
109
+ * Serializes a node from a rich text or title field with a map or a function to HTML
110
110
  *
111
111
  * @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
112
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
112
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
113
113
  */
114
114
  export type HTMLRichTextSerializer =
115
115
  | HTMLRichTextMapSerializer
116
116
  | HTMLRichTextFunctionSerializer;
117
117
 
118
118
  /**
119
- * Creates a default HTML Rich Text Serializer with a given Link Resolver providing
119
+ * Creates a default HTML rich text serializer with a given link resolver providing
120
120
  * sensible and safe defaults for every node type
121
121
  *
122
122
  * @internal
@@ -211,7 +211,7 @@ type AsHTMLConfig = {
211
211
  linkResolver?: LinkResolverFunction | null;
212
212
 
213
213
  /**
214
- * An optional Rich Text Serializer, unhandled cases will fallback to the default serializer
214
+ * An optional rich text serializer, unhandled cases will fallback to the default serializer
215
215
  */
216
216
  serializer?: HTMLRichTextSerializer | null;
217
217
  };
@@ -234,13 +234,13 @@ type AsHTMLReturnType<Field extends RichTextField | null | undefined> =
234
234
  // TODO: Remove overload when we remove support for deprecated tuple-style configuration.
235
235
  export const asHTML: {
236
236
  /**
237
- * Serializes a Rich Text or Title field to an HTML string.
237
+ * Serializes a rich text or title field to an HTML string.
238
238
  *
239
- * @param richTextField - A Rich Text or Title field from Prismic
239
+ * @param richTextField - A rich text or title field from Prismic
240
240
  * @param config - Configuration that determines the output of `asHTML()`
241
241
  *
242
- * @returns HTML equivalent of the provided Rich Text or Title field
243
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
242
+ * @returns HTML equivalent of the provided rich text or title field
243
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
244
244
  */
245
245
  <Field extends RichTextField | null | undefined>(
246
246
  richTextField: Field,
@@ -248,16 +248,16 @@ export const asHTML: {
248
248
  ): AsHTMLReturnType<Field>;
249
249
 
250
250
  /**
251
- * Serializes a Rich Text or Title field to an HTML string.
251
+ * Serializes a rich text or title field to an HTML string.
252
252
  *
253
- * @param richTextField - A Rich Text or Title field from Prismic
253
+ * @param richTextField - A rich text or title field from Prismic
254
254
  * @param linkResolver - An optional link resolver function to resolve links,
255
255
  * without it you're expected to use the `routes` options from the API
256
- * @param serializer - An optional Rich Text Serializer, unhandled cases will fallback
256
+ * @param serializer - An optional rich text serializer, unhandled cases will fallback
257
257
  * to the default serializer
258
258
  *
259
- * @returns HTML equivalent of the provided Rich Text or Title field
260
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
259
+ * @returns HTML equivalent of the provided rich text or title field
260
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
261
261
  *
262
262
  * @deprecated Use object-style configuration instead.
263
263
  *
@@ -30,12 +30,12 @@ type AsImagePixelDensitySrcSetReturnType<
30
30
  > = Field extends ImageFieldImage<"filled">
31
31
  ? {
32
32
  /**
33
- * The Image field's image URL with Imgix URL parameters (if given).
33
+ * The image field's image URL with Imgix URL parameters (if given).
34
34
  */
35
35
  src: string;
36
36
 
37
37
  /**
38
- * A pixel-densitye-based `srcset` attribute value for the Image field's
38
+ * A pixel-densitye-based `srcset` attribute value for the image field's
39
39
  * image with Imgix URL parameters (if given).
40
40
  */
41
41
  srcset: string;
@@ -43,7 +43,7 @@ type AsImagePixelDensitySrcSetReturnType<
43
43
  : null;
44
44
 
45
45
  /**
46
- * Creates a pixel-density-based `srcset` from an Image field with optional
46
+ * Creates a pixel-density-based `srcset` from an image field with optional
47
47
  * image transformations (via Imgix URL parameters).
48
48
  *
49
49
  * If a `pixelDensities` parameter is not given, the following pixel densities
@@ -68,8 +68,8 @@ type AsImagePixelDensitySrcSetReturnType<
68
68
  * @param config - An object of Imgix URL API parameters. The `pixelDensities`
69
69
  * parameter defines the resulting `srcset` widths.
70
70
  *
71
- * @returns A `srcset` attribute value for the Image field with Imgix URL
72
- * parameters (if given). If the Image field is empty, `null` is returned.
71
+ * @returns A `srcset` attribute value for the image field with Imgix URL
72
+ * parameters (if given). If the image field is empty, `null` is returned.
73
73
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
74
74
  */
75
75
  export const asImagePixelDensitySrcSet = <
@@ -11,7 +11,7 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
11
11
  Field extends ImageFieldImage<"filled"> ? string : null;
12
12
 
13
13
  /**
14
- * Returns the URL of an Image field with optional image transformations (via
14
+ * Returns the URL of an image field with optional image transformations (via
15
15
  * Imgix URL parameters).
16
16
  *
17
17
  * @example
@@ -25,8 +25,8 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
25
25
  * an image URL.
26
26
  * @param config - An object of Imgix URL API parameters to transform the image.
27
27
  *
28
- * @returns The Image field's image URL with transformations applied (if given).
29
- * If the Image field is empty, `null` is returned.
28
+ * @returns The image field's image URL with transformations applied (if given).
29
+ * If the image field is empty, `null` is returned.
30
30
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
31
31
  */
32
32
  export const asImageSrc = <Field extends ImageFieldImage | null | undefined>(
@@ -21,12 +21,12 @@ type AsImageWidthSrcSetReturnType<
21
21
  > = Field extends ImageFieldImage<"filled">
22
22
  ? {
23
23
  /**
24
- * The Image field's image URL with Imgix URL parameters (if given).
24
+ * The image field's image URL with Imgix URL parameters (if given).
25
25
  */
26
26
  src: string;
27
27
 
28
28
  /**
29
- * A width-based `srcset` attribute value for the Image field's image with
29
+ * A width-based `srcset` attribute value for the image field's image with
30
30
  * Imgix URL parameters (if given).
31
31
  */
32
32
  srcset: string;
@@ -41,13 +41,13 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
41
41
  };
42
42
 
43
43
  /**
44
- * Creates a width-based `srcset` from an Image field with optional image
44
+ * Creates a width-based `srcset` from an image field with optional image
45
45
  * transformations (via Imgix URL parameters).
46
46
  *
47
47
  * If a `widths` parameter is not given, the following widths will be used by
48
48
  * default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
49
49
  *
50
- * If the Image field contains responsive views, each responsive view can be
50
+ * If the image field contains responsive views, each responsive view can be
51
51
  * used as a width in the resulting `srcset` by passing `"thumbnails"` as the
52
52
  * `widths` parameter.
53
53
  *
@@ -72,8 +72,8 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
72
72
  * defines the resulting `srcset` widths. Pass `"thumbnails"` to automatically
73
73
  * use the field's responsive views.
74
74
  *
75
- * @returns A `srcset` attribute value for the Image field with Imgix URL
76
- * parameters (if given). If the Image field is empty, `null` is returned.
75
+ * @returns A `srcset` attribute value for the image field with Imgix URL
76
+ * parameters (if given). If the image field is empty, `null` is returned.
77
77
  * @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
78
78
  */
79
79
  export const asImageWidthSrcSet = <
@@ -6,11 +6,11 @@ import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
6
6
  import { documentToLinkField } from "./documentToLinkField";
7
7
 
8
8
  /**
9
- * Resolves a Link to a Prismic document to a URL
9
+ * Resolves a link to a Prismic document to a URL
10
10
  *
11
11
  * @typeParam ReturnType - Return type of your link resolver function, useful if
12
12
  * you prefer to return a complex object
13
- * @param linkToDocumentField - A document Link Field to resolve
13
+ * @param linkToDocumentField - A document link field to resolve
14
14
  *
15
15
  * @returns Resolved URL
16
16
  * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
@@ -25,7 +25,7 @@ export type LinkResolverFunction<ReturnType = string | null | undefined> = (
25
25
  type AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> =
26
26
  {
27
27
  /**
28
- * An optional Link Resolver function. Without it, you are
28
+ * An optional link resolver function. Without it, you are
29
29
  * expected to use the `routes` options from the API.
30
30
  */
31
31
  linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;
@@ -62,16 +62,16 @@ export type AsLinkReturnType<
62
62
  // TODO: Remove overload when we remove support for deprecated tuple-style configuration.
63
63
  export const asLink: {
64
64
  /**
65
- * Resolves any type of Link field or Prismic document to a URL.
65
+ * Resolves any type of link field or Prismic document to a URL.
66
66
  *
67
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
67
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
68
68
  * type
69
69
  * @typeParam Field - Link field or Prismic document to resolve to a URL
70
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
70
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
71
71
  * @param config - Configuration that determines the output of `asLink()`
72
72
  *
73
- * @returns Resolved URL or, if the provided Link field or document is empty, `null`
74
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
73
+ * @returns Resolved URL or, if the provided link field or document is empty, `null`
74
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
75
75
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
76
76
  */
77
77
  <
@@ -87,17 +87,17 @@ export const asLink: {
87
87
  ): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
88
88
 
89
89
  /**
90
- * Resolves any type of Link field or Prismic document to a URL.
90
+ * Resolves any type of link field or Prismic document to a URL.
91
91
  *
92
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
92
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
93
93
  * type
94
94
  * @typeParam Field - Link field or Prismic document to resolve to a URL
95
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
96
- * @param linkResolver - An optional Link Resolver function. Without it, you are
95
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
96
+ * @param linkResolver - An optional link resolver function. Without it, you are
97
97
  * expected to use the `routes` options from the API
98
98
  *
99
- * @returns Resolved URL or, if the provided Link field or document is empty, `null`
100
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
99
+ * @returns Resolved URL or, if the provided link field or document is empty, `null`
100
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
101
101
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
102
102
  *
103
103
  * @deprecated Use object-style configuration instead.
@@ -136,7 +136,7 @@ export const asLink: {
136
136
  return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
137
137
  }
138
138
 
139
- // Converts document to Link Field if needed
139
+ // Converts document to link field if needed
140
140
  const linkField =
141
141
  // prettier-ignore
142
142
  (
@@ -172,7 +172,7 @@ export const asLink: {
172
172
 
173
173
  case LinkType.Document: {
174
174
  if ("id" in linkField && config.linkResolver) {
175
- // When using Link Resolver...
175
+ // When using link resolver...
176
176
  const resolvedURL = config.linkResolver(linkField);
177
177
 
178
178
  if (resolvedURL != null) {
@@ -184,14 +184,14 @@ export const asLink: {
184
184
  }
185
185
 
186
186
  if ("url" in linkField && linkField.url) {
187
- // When using Route Resolver...
187
+ // When using route resolver...
188
188
  return linkField.url as AsLinkReturnType<
189
189
  LinkResolverFunctionReturnType,
190
190
  Field
191
191
  >;
192
192
  }
193
193
 
194
- // When empty or Link Resolver and Route Resolver are not used...
194
+ // When empty or link resolver and route resolver are not used...
195
195
  return null as AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
196
196
  }
197
197
 
@@ -66,18 +66,18 @@ type AsLinkAttrsReturnType<
66
66
  };
67
67
 
68
68
  /**
69
- * Resolves any type of Link field or Prismic document to a set of link attributes. The attributes are designed to be passed to link HTML elements, like `<a>`.
69
+ * Resolves any type of link field or Prismic document to a set of link attributes. The attributes are designed to be passed to link HTML elements, like `<a>`.
70
70
  *
71
71
  * If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as `"noreferrer"`.
72
72
  *
73
- * @typeParam LinkResolverFunctionReturnType - Link Resolver function return
73
+ * @typeParam LinkResolverFunctionReturnType - link resolver function return
74
74
  * type
75
75
  * @typeParam Field - Link field or Prismic document to resolve to link attributes
76
- * @param linkFieldOrDocument - Any kind of Link field or a document to resolve
76
+ * @param linkFieldOrDocument - Any kind of link field or a document to resolve
77
77
  * @param config - Configuration that determines the output of `asLinkAttrs()`
78
78
  *
79
- * @returns Resolved set of link attributes or, if the provided Link field or document is empty, and empty object
80
- * @see Prismic Link Resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
79
+ * @returns Resolved set of link attributes or, if the provided link field or document is empty, and empty object
80
+ * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
81
81
  * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
82
82
  */
83
83
  export const asLinkAttrs = <
@@ -28,13 +28,13 @@ type AsTextReturnType<Field extends RichTextField | null | undefined> =
28
28
 
29
29
  export const asText: {
30
30
  /**
31
- * Serializes a Rich Text or Title field to a plain text string.
31
+ * Serializes a rich text or title field to a plain text string.
32
32
  *
33
- * @param richTextField - A Rich Text or Title field from Prismic
33
+ * @param richTextField - A rich text or title field from Prismic
34
34
  * @param config - Configuration that determines the output of `asText()`
35
35
  *
36
- * @returns Plain text equivalent of the provided Rich Text or Title field
37
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
36
+ * @returns Plain text equivalent of the provided rich text or title field
37
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
38
38
  */
39
39
  <Field extends RichTextField | null | undefined>(
40
40
  richTextField: Field,
@@ -42,13 +42,13 @@ export const asText: {
42
42
  ): AsTextReturnType<Field>;
43
43
 
44
44
  /**
45
- * Serializes a Rich Text or Title field to a plain text string.
45
+ * Serializes a rich text or title field to a plain text string.
46
46
  *
47
- * @param richTextField - A Rich Text or Title field from Prismic
47
+ * @param richTextField - A rich text or title field from Prismic
48
48
  * @param separator - Separator used to join each element, defaults to a space
49
49
  *
50
- * @returns Plain text equivalent of the provided Rich Text or Title field
51
- * @see Templating Rich Text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
50
+ * @returns Plain text equivalent of the provided rich text or title field
51
+ * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
52
52
  *
53
53
  * @deprecated Use object-style configuration instead.
54
54
  *
@@ -32,7 +32,7 @@ export const documentToLinkField = <
32
32
  tags: prismicDocument.tags,
33
33
  lang: prismicDocument.lang,
34
34
  url: prismicDocument.url == null ? undefined : prismicDocument.url,
35
- slug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQl
35
+ slug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL
36
36
  // The REST API does not include a `data` property if the data
37
37
  // object is empty.
38
38
  //
@@ -5,7 +5,7 @@ import type { AnyOEmbed, EmbedField } from "../types/value/embed";
5
5
  import type { GeoPointField } from "../types/value/geoPoint";
6
6
  import type { GroupField } from "../types/value/group";
7
7
  import type { ImageField, ImageFieldImage } from "../types/value/image";
8
- import type { IntegrationFields } from "../types/value/integrationFields";
8
+ import type { IntegrationField } from "../types/value/integration";
9
9
  import type { KeyTextField } from "../types/value/keyText";
10
10
  import type { LinkField } from "../types/value/link";
11
11
  import type { LinkToMediaField } from "../types/value/linkToMedia";
@@ -44,9 +44,9 @@ const isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {
44
44
  };
45
45
 
46
46
  /**
47
- * Determines if a Rich Text field is filled.
47
+ * Determines if a rich text field is filled.
48
48
  *
49
- * @param field - Rich Text field to check.
49
+ * @param field - rich text field to check.
50
50
  *
51
51
  * @returns `true` if `field` is filled, `false` otherwise.
52
52
  */
@@ -63,7 +63,7 @@ export const richText = (
63
63
  };
64
64
 
65
65
  /**
66
- * Determines if a Title field is filled.
66
+ * Determines if a title field is filled.
67
67
  *
68
68
  * @param field - Title field to check.
69
69
  *
@@ -87,7 +87,7 @@ export const imageThumbnail = (
87
87
  };
88
88
 
89
89
  /**
90
- * Determines if an Image field is filled.
90
+ * Determines if an image field is filled.
91
91
  *
92
92
  * @param field - Image field to check.
93
93
  *
@@ -100,7 +100,7 @@ export const image = imageThumbnail as <
100
100
  ) => field is ImageField<ThumbnailNames, "filled">;
101
101
 
102
102
  /**
103
- * Determines if a Link field is filled.
103
+ * Determines if a link field is filled.
104
104
  *
105
105
  * @param field - Link field to check.
106
106
  *
@@ -119,9 +119,9 @@ export const link = <
119
119
  };
120
120
 
121
121
  /**
122
- * Determines if a Link to Media field is filled.
122
+ * Determines if a link to media field is filled.
123
123
  *
124
- * @param field - Link to Media field to check.
124
+ * @param field - Link to media field to check.
125
125
  *
126
126
  * @returns `true` if `field` is filled, `false` otherwise.
127
127
  */
@@ -130,7 +130,7 @@ export const linkToMedia = link as (
130
130
  ) => field is LinkToMediaField<"filled">;
131
131
 
132
132
  /**
133
- * Determines if a Content Relationship field is filled.
133
+ * Determines if a content relationship field is filled.
134
134
  *
135
135
  * @param field - Content Relationship field to check.
136
136
  *
@@ -155,7 +155,7 @@ export const contentRelationship = link as <
155
155
  >;
156
156
 
157
157
  /**
158
- * Determines if a Date field is filled.
158
+ * Determines if a date field is filled.
159
159
  *
160
160
  * @param field - Date field to check.
161
161
  *
@@ -166,7 +166,7 @@ export const date = isNonNullish as (
166
166
  ) => field is DateField<"filled">;
167
167
 
168
168
  /**
169
- * Determines if a Timestamp field is filled.
169
+ * Determines if a timestamp field is filled.
170
170
  *
171
171
  * @param field - Timestamp field to check.
172
172
  *
@@ -177,7 +177,7 @@ export const timestamp = isNonNullish as (
177
177
  ) => field is TimestampField<"filled">;
178
178
 
179
179
  /**
180
- * Determines if a Color field is filled.
180
+ * Determines if a color field is filled.
181
181
  *
182
182
  * @param field - Color field to check.
183
183
  *
@@ -188,7 +188,7 @@ export const color = isNonNullish as (
188
188
  ) => field is ColorField<"filled">;
189
189
 
190
190
  /**
191
- * Determines if a Number field is filled.
191
+ * Determines if a number field is filled.
192
192
  *
193
193
  * @param field - Number field to check.
194
194
  *
@@ -199,7 +199,7 @@ export const number = isNonNullish as (
199
199
  ) => field is NumberField<"filled">;
200
200
 
201
201
  /**
202
- * Determines if a Key Text field is filled.
202
+ * Determines if a key text field is filled.
203
203
  *
204
204
  * @param field - Key Text field to check.
205
205
  *
@@ -212,7 +212,7 @@ export const keyText = (
212
212
  };
213
213
 
214
214
  /**
215
- * Determines if a Select field is filled.
215
+ * Determines if a select field is filled.
216
216
  *
217
217
  * @param field - Select field to check.
218
218
  *
@@ -223,7 +223,7 @@ export const select = isNonNullish as <Enum extends string>(
223
223
  ) => field is SelectField<Enum, "filled">;
224
224
 
225
225
  /**
226
- * Determines if an Embed field is filled.
226
+ * Determines if an embed field is filled.
227
227
  *
228
228
  * @param field - Embed field to check.
229
229
  *
@@ -236,7 +236,7 @@ export const embed = <Field extends EmbedField<AnyOEmbed>>(
236
236
  };
237
237
 
238
238
  /**
239
- * Determines if a GeoPoint field is filled.
239
+ * Determines if a geopoint field is filled.
240
240
  *
241
241
  * @param field - GeoPoint field to check.
242
242
  *
@@ -249,17 +249,22 @@ export const geoPoint = (
249
249
  };
250
250
 
251
251
  /**
252
- * Determines if an Integration Fields field is filled.
252
+ * Determines if an integration field is filled.
253
253
  *
254
- * @param field - Integration Fields field to check.
254
+ * @param field - Integration field to check.
255
255
  *
256
256
  * @returns `true` if `field` is filled, `false` otherwise.
257
257
  */
258
- export const integrationFields = isNonNullish as <
258
+ export const integrationField = isNonNullish as <
259
259
  Data extends Record<string, unknown>,
260
260
  >(
261
- field: IntegrationFields<Data> | null | undefined,
262
- ) => field is IntegrationFields<Data, "filled">;
261
+ field: IntegrationField<Data> | null | undefined,
262
+ ) => field is IntegrationField<Data, "filled">;
263
+ /**
264
+ * @deprecated Renamed to `integrationField`.
265
+ */
266
+ // TODO: Remove when we remove support for deprecated `integrationFields` export.
267
+ export const integrationFields = integrationField;
263
268
 
264
269
  /**
265
270
  * Determines if a Group has at least one item.
package/src/index.ts CHANGED
@@ -1,4 +1,7 @@
1
- // Use for deprecations.
1
+ // Imports are used for deprecations.
2
+ import type { CustomTypeModelIntegrationField } from "./types/model/integration";
3
+ import type { IntegrationField } from "./types/value/integration";
4
+
2
5
  import type {
3
6
  HTMLRichTextFunctionSerializer,
4
7
  HTMLRichTextMapSerializer,
@@ -196,7 +199,12 @@ export type { SelectField } from "./types/value/select";
196
199
  export type { TimestampField } from "./types/value/timestamp";
197
200
  export type { GeoPointField } from "./types/value/geoPoint";
198
201
 
199
- export type { IntegrationFields } from "./types/value/integrationFields";
202
+ /**
203
+ * @deprecated Renamed to `IntegrationField`
204
+ */
205
+ // TODO: Remove when we remove support for deprecated `IntegrationFields` export.
206
+ type IntegrationFields = IntegrationField;
207
+ export { IntegrationField, IntegrationFields };
200
208
 
201
209
  export type { GroupField } from "./types/value/group";
202
210
 
@@ -247,7 +255,15 @@ export type { CustomTypeModelSelectField } from "./types/model/select";
247
255
  export type { CustomTypeModelTimestampField } from "./types/model/timestamp";
248
256
  export type { CustomTypeModelGeoPointField } from "./types/model/geoPoint";
249
257
 
250
- export type { CustomTypeModelIntegrationFieldsField } from "./types/model/integrationFields";
258
+ /**
259
+ * @deprecated Renamed to `CustomTypeModelIntegrationField`.
260
+ */
261
+ // TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.
262
+ type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
263
+ export {
264
+ CustomTypeModelIntegrationField,
265
+ CustomTypeModelIntegrationFieldsField,
266
+ };
251
267
  export type { CustomTypeModelGroupField } from "./types/model/group";
252
268
  export type {
253
269
  CustomTypeModelSliceZoneField,
@@ -15,7 +15,7 @@ export interface Repository {
15
15
  refs: Ref[];
16
16
 
17
17
  /**
18
- * An identifier used to query content with the latest Integration Fields
18
+ * An identifier used to query content with the latest integration fields
19
19
  * data.
20
20
  */
21
21
  integrationFieldsRef: string | null;
@@ -28,7 +28,7 @@ export interface Repository {
28
28
  languages: Language[];
29
29
 
30
30
  /**
31
- * A list of the repository's Custom Type API IDs mapped to their
31
+ * A list of the repository's custom type API IDs mapped to their
32
32
  * human-readable name.
33
33
  */
34
34
  types: Record<string, string>;
@@ -1,7 +1,7 @@
1
1
  import type { CustomTypeModelFieldType } from "./types";
2
2
 
3
3
  /**
4
- * A Boolean Custom Type field.
4
+ * A boolean custom type field.
5
5
  *
6
6
  * More details: {@link https://prismic.io/docs/boolean}
7
7
  */
@@ -1,7 +1,7 @@
1
1
  import type { CustomTypeModelFieldType } from "./types";
2
2
 
3
3
  /**
4
- * A Color Custom Type field.
4
+ * A color custom type field.
5
5
  *
6
6
  * More details: {@link https://prismic.io/docs/color}
7
7
  */
@@ -3,7 +3,7 @@ import type { CustomTypeModelFieldType } from "./types";
3
3
  import type { CustomTypeModelLinkSelectType } from "./link";
4
4
 
5
5
  /**
6
- * A Content Relationship Custom Type field.
6
+ * A content relationship custom type field.
7
7
  *
8
8
  * More details:
9
9
  * {@link https://prismic.io/docs/content-relationship}