@prismicio/client 6.7.0 → 7.0.0-alpha.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 (343) hide show
  1. package/dist/ForbiddenError.cjs +7 -0
  2. package/dist/ForbiddenError.cjs.map +1 -0
  3. package/dist/ForbiddenError.d.ts +11 -0
  4. package/dist/ForbiddenError.js +7 -0
  5. package/dist/ForbiddenError.js.map +1 -0
  6. package/dist/NotFoundError.cjs +7 -0
  7. package/dist/NotFoundError.cjs.map +1 -0
  8. package/dist/NotFoundError.d.ts +3 -0
  9. package/dist/NotFoundError.js +7 -0
  10. package/dist/NotFoundError.js.map +1 -0
  11. package/dist/ParsingError.cjs +7 -0
  12. package/dist/ParsingError.cjs.map +1 -0
  13. package/dist/ParsingError.d.ts +12 -0
  14. package/dist/ParsingError.js +7 -0
  15. package/dist/ParsingError.js.map +1 -0
  16. package/dist/PrismicError.cjs +19 -0
  17. package/dist/PrismicError.cjs.map +1 -0
  18. package/dist/PrismicError.d.ts +5 -0
  19. package/dist/PrismicError.js +19 -0
  20. package/dist/PrismicError.js.map +1 -0
  21. package/dist/buildQueryURL.cjs +41 -0
  22. package/dist/buildQueryURL.cjs.map +1 -0
  23. package/dist/buildQueryURL.d.ts +130 -0
  24. package/dist/buildQueryURL.js +41 -0
  25. package/dist/buildQueryURL.js.map +1 -0
  26. package/dist/client.cjs +414 -0
  27. package/dist/client.cjs.map +1 -0
  28. package/dist/client.d.ts +908 -0
  29. package/dist/client.js +414 -0
  30. package/dist/client.js.map +1 -0
  31. package/dist/cookie.cjs +5 -0
  32. package/dist/cookie.cjs.map +1 -0
  33. package/dist/cookie.d.ts +5 -0
  34. package/dist/cookie.js +5 -0
  35. package/dist/cookie.js.map +1 -0
  36. package/dist/getGraphQLEndpoint.cjs +13 -0
  37. package/dist/getGraphQLEndpoint.cjs.map +1 -0
  38. package/dist/getGraphQLEndpoint.d.ts +9 -0
  39. package/dist/getGraphQLEndpoint.js +13 -0
  40. package/dist/getGraphQLEndpoint.js.map +1 -0
  41. package/dist/getRepositoryEndpoint.cjs +13 -0
  42. package/dist/getRepositoryEndpoint.cjs.map +1 -0
  43. package/dist/getRepositoryEndpoint.d.ts +10 -0
  44. package/dist/getRepositoryEndpoint.js +13 -0
  45. package/dist/getRepositoryEndpoint.js.map +1 -0
  46. package/dist/getRepositoryName.cjs +12 -0
  47. package/dist/getRepositoryName.cjs.map +1 -0
  48. package/dist/getRepositoryName.d.ts +13 -0
  49. package/dist/getRepositoryName.js +12 -0
  50. package/dist/getRepositoryName.js.map +1 -0
  51. package/dist/helpers/asDate.cjs +14 -0
  52. package/dist/helpers/asDate.cjs.map +1 -0
  53. package/dist/helpers/asDate.d.ts +16 -0
  54. package/dist/helpers/asDate.js +14 -0
  55. package/dist/helpers/asDate.js.map +1 -0
  56. package/dist/helpers/asHTML.cjs +79 -0
  57. package/dist/helpers/asHTML.cjs.map +1 -0
  58. package/dist/helpers/asHTML.d.ts +20 -0
  59. package/dist/helpers/asHTML.js +79 -0
  60. package/dist/helpers/asHTML.js.map +1 -0
  61. package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
  62. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
  63. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +52 -0
  64. package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
  65. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
  66. package/dist/helpers/asImageSrc.cjs +13 -0
  67. package/dist/helpers/asImageSrc.cjs.map +1 -0
  68. package/dist/helpers/asImageSrc.d.ts +27 -0
  69. package/dist/helpers/asImageSrc.js +13 -0
  70. package/dist/helpers/asImageSrc.js.map +1 -0
  71. package/dist/helpers/asImageWidthSrcSet.cjs +40 -0
  72. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
  73. package/dist/helpers/asImageWidthSrcSet.d.ts +60 -0
  74. package/dist/helpers/asImageWidthSrcSet.js +40 -0
  75. package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
  76. package/dist/helpers/asLink.cjs +32 -0
  77. package/dist/helpers/asLink.cjs.map +1 -0
  78. package/dist/helpers/asLink.d.ts +24 -0
  79. package/dist/helpers/asLink.js +32 -0
  80. package/dist/helpers/asLink.js.map +1 -0
  81. package/dist/helpers/asText.cjs +12 -0
  82. package/dist/helpers/asText.cjs.map +1 -0
  83. package/dist/helpers/asText.d.ts +16 -0
  84. package/dist/helpers/asText.js +12 -0
  85. package/dist/helpers/asText.js.map +1 -0
  86. package/dist/helpers/documentToLinkField.cjs +19 -0
  87. package/dist/helpers/documentToLinkField.cjs.map +1 -0
  88. package/dist/helpers/documentToLinkField.d.ts +15 -0
  89. package/dist/helpers/documentToLinkField.js +19 -0
  90. package/dist/helpers/documentToLinkField.js.map +1 -0
  91. package/dist/helpers/isFilled.cjs +67 -0
  92. package/dist/helpers/isFilled.cjs.map +1 -0
  93. package/dist/helpers/isFilled.d.ts +175 -0
  94. package/dist/helpers/isFilled.js +67 -0
  95. package/dist/helpers/isFilled.js.map +1 -0
  96. package/dist/index.cjs +67 -721
  97. package/dist/index.cjs.map +1 -1
  98. package/dist/index.d.ts +92 -1526
  99. package/dist/index.js +64 -681
  100. package/dist/index.js.map +1 -1
  101. package/dist/isRepositoryEndpoint.cjs +12 -0
  102. package/dist/isRepositoryEndpoint.cjs.map +1 -0
  103. package/dist/isRepositoryEndpoint.d.ts +10 -0
  104. package/dist/isRepositoryEndpoint.js +12 -0
  105. package/dist/isRepositoryEndpoint.js.map +1 -0
  106. package/dist/isRepositoryName.cjs +7 -0
  107. package/dist/isRepositoryName.cjs.map +1 -0
  108. package/dist/isRepositoryName.d.ts +9 -0
  109. package/dist/isRepositoryName.js +7 -0
  110. package/dist/isRepositoryName.js.map +1 -0
  111. package/dist/lib/appendPredicates.cjs +14 -0
  112. package/dist/lib/appendPredicates.cjs.map +1 -0
  113. package/dist/lib/appendPredicates.d.ts +18 -0
  114. package/dist/lib/appendPredicates.js +14 -0
  115. package/dist/lib/appendPredicates.js.map +1 -0
  116. package/dist/lib/castArray.cjs +5 -0
  117. package/dist/lib/castArray.cjs.map +1 -0
  118. package/dist/lib/castArray.d.ts +11 -0
  119. package/dist/lib/castArray.js +5 -0
  120. package/dist/lib/castArray.js.map +1 -0
  121. package/dist/lib/castThunk.cjs +5 -0
  122. package/dist/lib/castThunk.cjs.map +1 -0
  123. package/dist/lib/castThunk.d.ts +10 -0
  124. package/dist/lib/castThunk.js +5 -0
  125. package/dist/lib/castThunk.js.map +1 -0
  126. package/dist/lib/findMasterRef.cjs +8 -0
  127. package/dist/lib/findMasterRef.cjs.map +1 -0
  128. package/dist/lib/findMasterRef.d.ts +10 -0
  129. package/dist/lib/findMasterRef.js +8 -0
  130. package/dist/lib/findMasterRef.js.map +1 -0
  131. package/dist/lib/findRef.cjs +12 -0
  132. package/dist/lib/findRef.cjs.map +1 -0
  133. package/dist/lib/findRef.d.ts +13 -0
  134. package/dist/lib/findRef.js +12 -0
  135. package/dist/lib/findRef.js.map +1 -0
  136. package/dist/lib/findRefByID.cjs +8 -0
  137. package/dist/lib/findRefByID.cjs.map +1 -0
  138. package/dist/lib/findRefByID.d.ts +11 -0
  139. package/dist/lib/findRefByID.js +8 -0
  140. package/dist/lib/findRefByID.js.map +1 -0
  141. package/dist/lib/findRefByLabel.cjs +8 -0
  142. package/dist/lib/findRefByLabel.cjs.map +1 -0
  143. package/dist/lib/findRefByLabel.d.ts +11 -0
  144. package/dist/lib/findRefByLabel.js +8 -0
  145. package/dist/lib/findRefByLabel.js.map +1 -0
  146. package/dist/lib/getPreviewCookie.cjs +21 -0
  147. package/dist/lib/getPreviewCookie.cjs.map +1 -0
  148. package/dist/lib/getPreviewCookie.d.ts +9 -0
  149. package/dist/lib/getPreviewCookie.js +21 -0
  150. package/dist/lib/getPreviewCookie.js.map +1 -0
  151. package/dist/lib/minifyGraphQLQuery.cjs +7 -0
  152. package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
  153. package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
  154. package/dist/lib/minifyGraphQLQuery.js +7 -0
  155. package/dist/lib/minifyGraphQLQuery.js.map +1 -0
  156. package/dist/lib/serializerHelpers.cjs +56 -0
  157. package/dist/lib/serializerHelpers.cjs.map +1 -0
  158. package/dist/lib/serializerHelpers.d.ts +9 -0
  159. package/dist/lib/serializerHelpers.js +54 -0
  160. package/dist/lib/serializerHelpers.js.map +1 -0
  161. package/dist/predicate.cjs +68 -0
  162. package/dist/predicate.cjs.map +1 -0
  163. package/dist/predicate.d.ts +209 -0
  164. package/dist/predicate.js +68 -0
  165. package/dist/predicate.js.map +1 -0
  166. package/dist/types/api/query.d.ts +42 -0
  167. package/dist/types/api/ref.d.ts +32 -0
  168. package/dist/types/api/release.d.ts +10 -0
  169. package/dist/types/api/repository.d.ts +100 -0
  170. package/dist/types/api/tags.d.ts +8 -0
  171. package/dist/types/client.d.ts +128 -0
  172. package/dist/types/helpers.d.ts +63 -0
  173. package/dist/types/model/boolean.d.ts +15 -0
  174. package/dist/types/model/color.d.ts +13 -0
  175. package/dist/types/model/contentRelationship.d.ts +18 -0
  176. package/dist/types/model/customType.d.ts +42 -0
  177. package/dist/types/model/date.d.ts +14 -0
  178. package/dist/types/model/embed.d.ts +13 -0
  179. package/dist/types/model/geoPoint.d.ts +12 -0
  180. package/dist/types/model/group.d.ts +15 -0
  181. package/dist/types/model/image.d.ts +31 -0
  182. package/dist/types/model/integrationFields.d.ts +14 -0
  183. package/dist/types/model/keyText.d.ts +13 -0
  184. package/dist/types/model/link.cjs +9 -0
  185. package/dist/types/model/link.cjs.map +1 -0
  186. package/dist/types/model/link.d.ts +27 -0
  187. package/dist/types/model/link.js +9 -0
  188. package/dist/types/model/link.js.map +1 -0
  189. package/dist/types/model/linkToMedia.d.ts +16 -0
  190. package/dist/types/model/number.d.ts +15 -0
  191. package/dist/types/model/range.d.ts +14 -0
  192. package/dist/types/model/richText.d.ts +35 -0
  193. package/dist/types/model/select.d.ts +18 -0
  194. package/dist/types/model/separator.d.ts +10 -0
  195. package/dist/types/model/sharedSlice.d.ts +19 -0
  196. package/dist/types/model/sharedSliceVariation.d.ts +22 -0
  197. package/dist/types/model/slice.cjs +8 -0
  198. package/dist/types/model/slice.cjs.map +1 -0
  199. package/dist/types/model/slice.d.ts +33 -0
  200. package/dist/types/model/slice.js +8 -0
  201. package/dist/types/model/slice.js.map +1 -0
  202. package/dist/types/model/sliceZone.cjs +8 -0
  203. package/dist/types/model/sliceZone.cjs.map +1 -0
  204. package/dist/types/model/sliceZone.d.ts +44 -0
  205. package/dist/types/model/sliceZone.js +8 -0
  206. package/dist/types/model/sliceZone.js.map +1 -0
  207. package/dist/types/model/timestamp.d.ts +14 -0
  208. package/dist/types/model/title.d.ts +7 -0
  209. package/dist/types/model/types.cjs +25 -0
  210. package/dist/types/model/types.cjs.map +1 -0
  211. package/dist/types/model/types.d.ts +62 -0
  212. package/dist/types/model/types.js +25 -0
  213. package/dist/types/model/types.js.map +1 -0
  214. package/dist/types/model/uid.d.ts +13 -0
  215. package/dist/types/utils.d.ts +28 -0
  216. package/dist/types/value/boolean.d.ts +6 -0
  217. package/dist/types/value/color.d.ts +8 -0
  218. package/dist/types/value/contentRelationship.d.ts +29 -0
  219. package/dist/types/value/date.d.ts +8 -0
  220. package/dist/types/value/document.d.ts +113 -0
  221. package/dist/types/value/embed.cjs +10 -0
  222. package/dist/types/value/embed.cjs.map +1 -0
  223. package/dist/types/value/embed.d.ts +167 -0
  224. package/dist/types/value/embed.js +10 -0
  225. package/dist/types/value/embed.js.map +1 -0
  226. package/dist/types/value/geoPoint.d.ts +11 -0
  227. package/dist/types/value/group.d.ts +7 -0
  228. package/dist/types/value/image.d.ts +36 -0
  229. package/dist/types/value/integrationFields.d.ts +9 -0
  230. package/dist/types/value/keyText.d.ts +8 -0
  231. package/dist/types/value/link.cjs +10 -0
  232. package/dist/types/value/link.cjs.map +1 -0
  233. package/dist/types/value/link.d.ts +40 -0
  234. package/dist/types/value/link.js +10 -0
  235. package/dist/types/value/link.js.map +1 -0
  236. package/dist/types/value/linkToMedia.d.ts +20 -0
  237. package/dist/types/value/number.d.ts +8 -0
  238. package/dist/types/value/richText.cjs +25 -0
  239. package/dist/types/value/richText.cjs.map +1 -0
  240. package/dist/types/value/richText.d.ts +203 -0
  241. package/dist/types/value/richText.js +25 -0
  242. package/dist/types/value/richText.js.map +1 -0
  243. package/dist/types/value/select.d.ts +9 -0
  244. package/dist/types/value/sharedSlice.d.ts +11 -0
  245. package/dist/types/value/sharedSliceVariation.d.ts +7 -0
  246. package/dist/types/value/slice.d.ts +13 -0
  247. package/dist/types/value/sliceZone.d.ts +12 -0
  248. package/dist/types/value/timestamp.d.ts +8 -0
  249. package/dist/types/value/title.d.ts +12 -0
  250. package/dist/types/value/types.d.ts +40 -0
  251. package/dist/types/webhook/apiUpdate.d.ts +52 -0
  252. package/dist/types/webhook/testTrigger.d.ts +9 -0
  253. package/dist/types/webhook/types.cjs +8 -0
  254. package/dist/types/webhook/types.cjs.map +1 -0
  255. package/dist/types/webhook/types.d.ts +18 -0
  256. package/dist/types/webhook/types.js +8 -0
  257. package/dist/types/webhook/types.js.map +1 -0
  258. package/package.json +40 -33
  259. package/src/buildQueryURL.ts +8 -4
  260. package/src/client.ts +111 -118
  261. package/src/cookie.ts +2 -1
  262. package/src/getRepositoryName.ts +4 -2
  263. package/src/helpers/asDate.ts +48 -0
  264. package/src/helpers/asHTML.ts +154 -0
  265. package/src/helpers/asImagePixelDensitySrcSet.ts +96 -0
  266. package/src/helpers/asImageSrc.ts +41 -0
  267. package/src/helpers/asImageWidthSrcSet.ts +139 -0
  268. package/src/helpers/asLink.ts +99 -0
  269. package/src/helpers/asText.ts +29 -0
  270. package/src/helpers/documentToLinkField.ts +47 -0
  271. package/src/helpers/isFilled.ts +290 -0
  272. package/src/index.ts +237 -21
  273. package/src/isRepositoryEndpoint.ts +2 -1
  274. package/src/isRepositoryName.ts +2 -1
  275. package/src/lib/appendPredicates.ts +2 -1
  276. package/src/lib/findMasterRef.ts +2 -2
  277. package/src/lib/findRef.ts +2 -5
  278. package/src/lib/findRefByID.ts +2 -2
  279. package/src/lib/findRefByLabel.ts +2 -5
  280. package/src/lib/getPreviewCookie.ts +3 -2
  281. package/src/lib/serializerHelpers.ts +96 -0
  282. package/src/predicate.ts +4 -2
  283. package/src/types/api/query.ts +50 -0
  284. package/src/types/api/ref.ts +36 -0
  285. package/src/types/api/release.ts +11 -0
  286. package/src/types/api/repository.ts +117 -0
  287. package/src/types/api/tags.ts +8 -0
  288. package/src/{types.ts → types/client.ts} +16 -52
  289. package/src/types/helpers.ts +103 -0
  290. package/src/types/model/boolean.ts +16 -0
  291. package/src/types/model/color.ts +14 -0
  292. package/src/types/model/contentRelationship.ts +22 -0
  293. package/src/types/model/customType.ts +61 -0
  294. package/src/types/model/date.ts +15 -0
  295. package/src/types/model/embed.ts +14 -0
  296. package/src/types/model/geoPoint.ts +13 -0
  297. package/src/types/model/group.ts +24 -0
  298. package/src/types/model/image.ts +37 -0
  299. package/src/types/model/integrationFields.ts +15 -0
  300. package/src/types/model/keyText.ts +14 -0
  301. package/src/types/model/link.ts +31 -0
  302. package/src/types/model/linkToMedia.ts +17 -0
  303. package/src/types/model/number.ts +16 -0
  304. package/src/types/model/range.ts +15 -0
  305. package/src/types/model/richText.ts +40 -0
  306. package/src/types/model/select.ts +22 -0
  307. package/src/types/model/separator.ts +11 -0
  308. package/src/types/model/sharedSlice.ts +23 -0
  309. package/src/types/model/sharedSliceVariation.ts +33 -0
  310. package/src/types/model/slice.ts +49 -0
  311. package/src/types/model/sliceZone.ts +62 -0
  312. package/src/types/model/timestamp.ts +15 -0
  313. package/src/types/model/title.ts +8 -0
  314. package/src/types/model/types.ts +91 -0
  315. package/src/types/model/uid.ts +14 -0
  316. package/src/types/utils.ts +34 -0
  317. package/src/types/value/boolean.ts +6 -0
  318. package/src/types/value/color.ts +10 -0
  319. package/src/types/value/contentRelationship.ts +48 -0
  320. package/src/types/value/date.ts +10 -0
  321. package/src/types/value/document.ts +142 -0
  322. package/src/types/value/embed.ts +196 -0
  323. package/src/types/value/geoPoint.ts +15 -0
  324. package/src/types/value/group.ts +14 -0
  325. package/src/types/value/image.ts +67 -0
  326. package/src/types/value/integrationFields.ts +13 -0
  327. package/src/types/value/keyText.ts +10 -0
  328. package/src/types/value/link.ts +59 -0
  329. package/src/types/value/linkToMedia.ts +25 -0
  330. package/src/types/value/number.ts +10 -0
  331. package/src/types/value/richText.ts +286 -0
  332. package/src/types/value/select.ts +13 -0
  333. package/src/types/value/sharedSlice.ts +15 -0
  334. package/src/types/value/sharedSliceVariation.ts +18 -0
  335. package/src/types/value/slice.ts +24 -0
  336. package/src/types/value/sliceZone.ts +16 -0
  337. package/src/types/value/timestamp.ts +12 -0
  338. package/src/types/value/title.ts +31 -0
  339. package/src/types/value/types.ts +60 -0
  340. package/src/types/webhook/apiUpdate.ts +56 -0
  341. package/src/types/webhook/testTrigger.ts +10 -0
  342. package/src/types/webhook/types.ts +21 -0
  343. package/src/lib/orElseThrow.ts +0 -17
@@ -0,0 +1,13 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A GeoPoint Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/geopoint}
7
+ */
8
+ export interface CustomTypeModelGeoPointField {
9
+ type: typeof CustomTypeModelFieldType.GeoPoint;
10
+ config?: {
11
+ label?: string | null;
12
+ };
13
+ }
@@ -0,0 +1,24 @@
1
+ import type {
2
+ CustomTypeModelFieldType,
3
+ CustomTypeModelFieldForGroup,
4
+ } from "./types";
5
+
6
+ /**
7
+ * A Group Custom Type field.
8
+ *
9
+ * More details: {@link https://prismic.io/docs/core-concepts/group}
10
+ *
11
+ * @typeParam Fields - A record of fields that can be repeated.
12
+ */
13
+ export interface CustomTypeModelGroupField<
14
+ Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<
15
+ string,
16
+ CustomTypeModelFieldForGroup
17
+ >,
18
+ > {
19
+ type: typeof CustomTypeModelFieldType.Group;
20
+ config?: {
21
+ label?: string | null;
22
+ fields?: Fields;
23
+ };
24
+ }
@@ -0,0 +1,37 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * Dimension constraints for an Image Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/image}
7
+ */
8
+ export interface CustomTypeModelImageConstraint {
9
+ width?: number | null;
10
+ height?: number | null;
11
+ }
12
+
13
+ /**
14
+ * A thumbnail for an Image Custom Type field.
15
+ *
16
+ * More details: {@link https://prismic.io/docs/core-concepts/image}
17
+ */
18
+ export interface CustomTypeModelImageThumbnail<Name extends string = string>
19
+ extends CustomTypeModelImageConstraint {
20
+ name: Name;
21
+ }
22
+
23
+ /**
24
+ * An Image Custom Type field.
25
+ *
26
+ * More details: {@link https://prismic.io/docs/core-concepts/image}
27
+ */
28
+ export interface CustomTypeModelImageField<
29
+ ThumbnailNames extends string = string,
30
+ > {
31
+ type: typeof CustomTypeModelFieldType.Image;
32
+ config?: {
33
+ label?: string | null;
34
+ constraint?: CustomTypeModelImageConstraint;
35
+ thumbnails?: readonly CustomTypeModelImageThumbnail<ThumbnailNames>[];
36
+ };
37
+ }
@@ -0,0 +1,15 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * An Integration Fields Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/integration-fields}
7
+ */
8
+ export interface CustomTypeModelIntegrationFieldsField {
9
+ type: typeof CustomTypeModelFieldType.IntegrationFields;
10
+ config?: {
11
+ label?: string | null;
12
+ placeholder?: string;
13
+ catalog?: string;
14
+ };
15
+ }
@@ -0,0 +1,14 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Key Text Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/key-text}
7
+ */
8
+ export interface CustomTypeModelKeyTextField {
9
+ type: typeof CustomTypeModelFieldType.Text;
10
+ config?: {
11
+ label?: string | null;
12
+ placeholder?: string;
13
+ };
14
+ }
@@ -0,0 +1,31 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Link Custom Type field.
5
+ *
6
+ * More details:
7
+ * {@link https://prismic.io/docs/core-concepts/link-content-relationship}
8
+ */
9
+ export interface CustomTypeModelLinkField {
10
+ type: typeof CustomTypeModelFieldType.Link;
11
+ config?: {
12
+ label?: string | null;
13
+ placeholder?: string;
14
+ select?:
15
+ | null
16
+ | typeof CustomTypeModelLinkSelectType[keyof typeof CustomTypeModelLinkSelectType];
17
+ allowTargetBlank?: boolean;
18
+ };
19
+ }
20
+
21
+ /**
22
+ * Type of a Link Custom Type field.
23
+ *
24
+ * More details:
25
+ * {@link https://prismic.io/docs/core-concepts/link-content-relationship}
26
+ */
27
+ export const CustomTypeModelLinkSelectType = {
28
+ Document: "document",
29
+ Media: "media",
30
+ Web: "web",
31
+ } as const;
@@ -0,0 +1,17 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+ import type { CustomTypeModelLinkSelectType } from "./link";
3
+
4
+ /**
5
+ * A Link to Media Custom Type field.
6
+ *
7
+ * More details:
8
+ * {@link https://prismic.io/docs/core-concepts/link-content-relationship}
9
+ */
10
+ export interface CustomTypeModelLinkToMediaField {
11
+ type: typeof CustomTypeModelFieldType.Link;
12
+ config?: {
13
+ label?: string | null;
14
+ placeholder?: string;
15
+ select: typeof CustomTypeModelLinkSelectType.Media;
16
+ };
17
+ }
@@ -0,0 +1,16 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Number Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/number}
7
+ */
8
+ export interface CustomTypeModelNumberField {
9
+ type: typeof CustomTypeModelFieldType.Number;
10
+ config?: {
11
+ label?: string | null;
12
+ placeholder?: string;
13
+ min?: number;
14
+ max?: number;
15
+ };
16
+ }
@@ -0,0 +1,15 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * @deprecated - Legacy field. Use `CustomTypeModelNumberField` instead.
5
+ */
6
+ export interface CustomTypeModelRangeField {
7
+ type: typeof CustomTypeModelFieldType.Range;
8
+ config?: {
9
+ label?: string | null;
10
+ placeholder?: string;
11
+ min?: number;
12
+ max?: number;
13
+ step?: number;
14
+ };
15
+ }
@@ -0,0 +1,40 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Rich Text Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
7
+ */
8
+ export type CustomTypeModelRichTextField =
9
+ | CustomTypeModelRichTextMultiField
10
+ | CustomTypeModelRichTextSingleField;
11
+
12
+ /**
13
+ * A Rich Text Custom Type field which supports multiple blocks of content.
14
+ *
15
+ * More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
16
+ */
17
+ export interface CustomTypeModelRichTextMultiField {
18
+ type: typeof CustomTypeModelFieldType.StructuredText;
19
+ config?: {
20
+ label?: string | null;
21
+ placeholder?: string;
22
+ allowTargetBlank?: boolean;
23
+ multi?: string;
24
+ };
25
+ }
26
+
27
+ /**
28
+ * A Rich Text Custom Type field which supports one block of content.
29
+ *
30
+ * More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
31
+ */
32
+ export interface CustomTypeModelRichTextSingleField {
33
+ type: typeof CustomTypeModelFieldType.StructuredText;
34
+ config?: {
35
+ label?: string | null;
36
+ placeholder?: string;
37
+ allowTargetBlank?: boolean;
38
+ single?: string;
39
+ };
40
+ }
@@ -0,0 +1,22 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Select Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/select}
7
+ *
8
+ * @typeParam Options - Options for the field.
9
+ * @typeParam DefaultValue - Default value for the field.
10
+ */
11
+ export interface CustomTypeModelSelectField<
12
+ Option extends string = string,
13
+ DefaultValue extends Option = Option,
14
+ > {
15
+ type: typeof CustomTypeModelFieldType.Select;
16
+ config?: {
17
+ label?: string | null;
18
+ placeholder?: string;
19
+ options?: readonly Option[];
20
+ default_value?: DefaultValue;
21
+ };
22
+ }
@@ -0,0 +1,11 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * @deprecated - Legacy field. Do not use.
5
+ */
6
+ export interface CustomTypeModelSeparatorField {
7
+ type: typeof CustomTypeModelFieldType.Separator;
8
+ config?: {
9
+ label?: string | null;
10
+ };
11
+ }
@@ -0,0 +1,23 @@
1
+ import type { CustomTypeModelSliceType } from "./sliceZone";
2
+ import type { SharedSliceModelVariation } from "./sharedSliceVariation";
3
+
4
+ /**
5
+ * A Prismic Shared Slice model.
6
+ *
7
+ * More details:
8
+ *
9
+ * - {@link https://prismic.io/docs/core-concepts/slices}
10
+ * - {@link https://prismic.io/docs/core-concepts/reusing-slices}
11
+ *
12
+ * @typeParam Variation - A variation for the Shared Slice.
13
+ */
14
+ export interface SharedSliceModel<
15
+ ID extends string = string,
16
+ Variation extends SharedSliceModelVariation = SharedSliceModelVariation,
17
+ > {
18
+ type: typeof CustomTypeModelSliceType.SharedSlice;
19
+ id: ID;
20
+ name: string;
21
+ description?: string;
22
+ variations: readonly Variation[];
23
+ }
@@ -0,0 +1,33 @@
1
+ import type { CustomTypeModelFieldForGroup } from "./types";
2
+
3
+ /**
4
+ * A Shared Slice variation.
5
+ *
6
+ * More details:
7
+ *
8
+ * - {@link https://prismic.io/docs/core-concepts/slices}
9
+ * - {@link https://prismic.io/docs/core-concepts/reusing-slices}
10
+ *
11
+ * @typeParam PrimaryFields - A record of fields that cannnot be repeated.
12
+ * @typeParam ItemFields - A record of fields that can be repeated.
13
+ */
14
+ export interface SharedSliceModelVariation<
15
+ ID extends string = string,
16
+ PrimaryFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
17
+ string,
18
+ CustomTypeModelFieldForGroup
19
+ >,
20
+ ItemFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
21
+ string,
22
+ CustomTypeModelFieldForGroup
23
+ >,
24
+ > {
25
+ id: ID;
26
+ name: string;
27
+ docURL: string;
28
+ version: string;
29
+ description: string;
30
+ primary?: PrimaryFields;
31
+ items?: ItemFields;
32
+ imageUrl: string;
33
+ }
@@ -0,0 +1,49 @@
1
+ import type { CustomTypeModelGroupField } from "./group";
2
+ import type { CustomTypeModelSliceType } from "./sliceZone";
3
+ import type { CustomTypeModelFieldForGroup } from "./types";
4
+
5
+ /**
6
+ * A Slice for a Custom Type.
7
+ *
8
+ * More details: {@link https://prismic.io/docs/core-concepts/slices}
9
+ *
10
+ * @typeParam NonRepeatFields - A record of fields that cannnot be repeated.
11
+ * @typeParam RepeatFields - A record of fields that can be repeated.
12
+ */
13
+ export interface CustomTypeModelSlice<
14
+ NonRepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
15
+ string,
16
+ CustomTypeModelFieldForGroup
17
+ >,
18
+ RepeatFields extends Record<string, CustomTypeModelFieldForGroup> = Record<
19
+ string,
20
+ CustomTypeModelFieldForGroup
21
+ >,
22
+ > {
23
+ type: typeof CustomTypeModelSliceType.Slice;
24
+ fieldset?: string | null;
25
+ description?: string;
26
+ icon?: string;
27
+ display?:
28
+ | typeof CustomTypeModelSliceDisplay[keyof typeof CustomTypeModelSliceDisplay]
29
+ | string;
30
+ "non-repeat"?: NonRepeatFields;
31
+ repeat?: RepeatFields;
32
+ }
33
+
34
+ /**
35
+ * Display type for a Slice.
36
+ *
37
+ * More details: {@link https://prismic.io/docs/core-concepts/slices}
38
+ */
39
+ export const CustomTypeModelSliceDisplay = {
40
+ List: "list",
41
+ Grid: "grid",
42
+ } as const;
43
+
44
+ /**
45
+ * @deprecated - Legacy slice type. Do not use.
46
+ */
47
+ export type CustomTypeModelLegacySlice =
48
+ | CustomTypeModelGroupField
49
+ | CustomTypeModelFieldForGroup;
@@ -0,0 +1,62 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+ import type { CustomTypeModelLegacySlice, CustomTypeModelSlice } from "./slice";
3
+
4
+ /**
5
+ * A Slice Zone Custom Type field.
6
+ *
7
+ * More details: {@link https://prismic.io/docs/core-concepts/slices}
8
+ */
9
+ export interface CustomTypeModelSliceZoneField<
10
+ Slices extends Record<
11
+ string,
12
+ | CustomTypeModelSlice
13
+ | CustomTypeModelSharedSlice
14
+ | CustomTypeModelLegacySlice
15
+ > = Record<
16
+ string,
17
+ | CustomTypeModelSlice
18
+ | CustomTypeModelSharedSlice
19
+ | CustomTypeModelLegacySlice
20
+ >,
21
+ > {
22
+ type:
23
+ | typeof CustomTypeModelFieldType.Slices
24
+ | typeof CustomTypeModelFieldType.LegacySlices;
25
+ fieldset?: string | null;
26
+ config?: {
27
+ labels?: Record<string, readonly CustomTypeModelSliceLabel[]> | null;
28
+ choices?: Slices;
29
+ };
30
+ }
31
+
32
+ /**
33
+ * Label for a Slice.
34
+ *
35
+ * More details: {@link https://prismic.io/docs/core-concepts/slices}
36
+ */
37
+ export interface CustomTypeModelSliceLabel {
38
+ name: string;
39
+ display?: string;
40
+ }
41
+
42
+ /**
43
+ * Type identifier for a Slice.
44
+ *
45
+ * More details: {@link https://prismic.io/docs/core-concepts/slices}
46
+ */
47
+ export const CustomTypeModelSliceType = {
48
+ Slice: "Slice",
49
+ SharedSlice: "SharedSlice",
50
+ } as const;
51
+
52
+ /**
53
+ * A Shared Slice for a Custom Type.
54
+ *
55
+ * More details:
56
+ *
57
+ * - {@link https://prismic.io/docs/core-concepts/slices}
58
+ * - {@link https://prismic.io/docs/core-concepts/reusing-slices}
59
+ */
60
+ export interface CustomTypeModelSharedSlice {
61
+ type: typeof CustomTypeModelSliceType.SharedSlice;
62
+ }
@@ -0,0 +1,15 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A Timestamp Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/timestamp}
7
+ */
8
+ export interface CustomTypeModelTimestampField {
9
+ type: typeof CustomTypeModelFieldType.Timestamp;
10
+ config?: {
11
+ label?: string | null;
12
+ placeholder?: string;
13
+ default?: string;
14
+ };
15
+ }
@@ -0,0 +1,8 @@
1
+ import { CustomTypeModelRichTextSingleField } from "./richText";
2
+
3
+ /**
4
+ * A Title Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
7
+ */
8
+ export type CustomTypeModelTitleField = CustomTypeModelRichTextSingleField;
@@ -0,0 +1,91 @@
1
+ import type { CustomTypeModelContentRelationshipField } from "./contentRelationship";
2
+ import type { CustomTypeModelEmbedField } from "./embed";
3
+ import type { CustomTypeModelImageField } from "./image";
4
+ import type { CustomTypeModelLinkField } from "./link";
5
+ import type { CustomTypeModelLinkToMediaField } from "./linkToMedia";
6
+ import type { CustomTypeModelRichTextField } from "./richText";
7
+ import type { CustomTypeModelTitleField } from "./title";
8
+
9
+ import type { CustomTypeModelBooleanField } from "./boolean";
10
+ import type { CustomTypeModelColorField } from "./color";
11
+ import type { CustomTypeModelDateField } from "./date";
12
+ import type { CustomTypeModelKeyTextField } from "./keyText";
13
+ import type { CustomTypeModelNumberField } from "./number";
14
+ import type { CustomTypeModelSelectField } from "./select";
15
+ import type { CustomTypeModelTimestampField } from "./timestamp";
16
+ import type { CustomTypeModelGeoPointField } from "./geoPoint";
17
+
18
+ import type { CustomTypeModelIntegrationFieldsField } from "./integrationFields";
19
+ import type { CustomTypeModelGroupField } from "./group";
20
+ import type { CustomTypeModelSliceZoneField } from "./sliceZone";
21
+
22
+ import type { CustomTypeModelUIDField } from "./uid";
23
+
24
+ import type { CustomTypeModelRangeField } from "./range";
25
+ import type { CustomTypeModelSeparatorField } from "./separator";
26
+
27
+ /**
28
+ * Type identifier for a Custom Type field.
29
+ */
30
+ export const CustomTypeModelFieldType = {
31
+ Boolean: "Boolean",
32
+ Color: "Color",
33
+ Date: "Date",
34
+ Embed: "Embed",
35
+ GeoPoint: "GeoPoint",
36
+ Group: "Group",
37
+ Image: "Image",
38
+ IntegrationFields: "IntegrationFields",
39
+ Link: "Link",
40
+ Number: "Number",
41
+ Select: "Select",
42
+ Slices: "Slices",
43
+ StructuredText: "StructuredText",
44
+ Text: "Text",
45
+ Timestamp: "Timestamp",
46
+ UID: "UID",
47
+ /**
48
+ * @deprecated - Legacy field type. Use `Number` instead.
49
+ */
50
+ Range: "Range",
51
+ /**
52
+ * @deprecated - Legacy field type. Do not use.
53
+ */
54
+ Separator: "Separator",
55
+ /**
56
+ * @deprecated - Legacy field type. Use `Slices` instead.
57
+ */
58
+ LegacySlices: "Choice",
59
+ } as const;
60
+
61
+ /**
62
+ * A Custom Type field.
63
+ */
64
+ export type CustomTypeModelField =
65
+ | CustomTypeModelUIDField
66
+ | CustomTypeModelGroupField
67
+ | CustomTypeModelSliceZoneField
68
+ | CustomTypeModelFieldForGroup;
69
+
70
+ /**
71
+ * Any Custom Type field that is valid for a Group field.
72
+ */
73
+ export type CustomTypeModelFieldForGroup =
74
+ | CustomTypeModelBooleanField
75
+ | CustomTypeModelColorField
76
+ | CustomTypeModelDateField
77
+ | CustomTypeModelEmbedField
78
+ | CustomTypeModelGeoPointField
79
+ | CustomTypeModelImageField
80
+ | CustomTypeModelIntegrationFieldsField
81
+ | CustomTypeModelContentRelationshipField
82
+ | CustomTypeModelLinkField
83
+ | CustomTypeModelLinkToMediaField
84
+ | CustomTypeModelNumberField
85
+ | CustomTypeModelRangeField
86
+ | CustomTypeModelSelectField
87
+ | CustomTypeModelRichTextField
88
+ | CustomTypeModelTitleField
89
+ | CustomTypeModelKeyTextField
90
+ | CustomTypeModelTimestampField
91
+ | CustomTypeModelSeparatorField;
@@ -0,0 +1,14 @@
1
+ import type { CustomTypeModelFieldType } from "./types";
2
+
3
+ /**
4
+ * A UID Custom Type field.
5
+ *
6
+ * More details: {@link https://prismic.io/docs/core-concepts/uid}
7
+ */
8
+ export interface CustomTypeModelUIDField {
9
+ type: typeof CustomTypeModelFieldType.UID;
10
+ config?: {
11
+ label?: string | null;
12
+ placeholder?: string;
13
+ };
14
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Create a union of the given object's values, and optionally specify which
3
+ * keys to get the values from.
4
+ *
5
+ * Taken from the `type-fest` package.
6
+ *
7
+ * See:
8
+ * https://github.com/sindresorhus/type-fest/blob/61c35052f09caa23de5eef96d95196375d8ed498/source/value-of.d.ts
9
+ */
10
+ export type ValueOf<
11
+ ObjectType,
12
+ ValueType extends keyof ObjectType = keyof ObjectType,
13
+ > = ObjectType[ValueType];
14
+
15
+ /**
16
+ * Functions like TypeScript's native `Extract` utility type with added support
17
+ * to fall back to a value if the resulting union is `never`.
18
+ *
19
+ * @example
20
+ *
21
+ * ```ts
22
+ * ExtractOrFallback<"a" | "b", "a">; // => "a"
23
+ * ExtractOrFallback<"a" | "b", "c">; // => "a" | "b"
24
+ * ExtractOrFallback<"a" | "b", "c", "foo">; // => "foo"
25
+ * ```
26
+ *
27
+ * @typeParam T - The union from which values will be extracted.
28
+ * @typeParam U - The extraction condition.
29
+ * @typeParam Fallback - The value to return if the resulting union is `never`.
30
+ * Defaults to `T`.
31
+ */
32
+ export type ExtractOrFallback<T, U, Fallback = T> = Extract<T, U> extends never
33
+ ? Fallback
34
+ : Extract<T, U>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A Boolean field.
3
+ *
4
+ * @see More details: {@link https://prismic.io/docs/core-concepts/boolean}
5
+ */
6
+ export type BooleanField = boolean;
@@ -0,0 +1,10 @@
1
+ import type { FieldState } from "./types";
2
+
3
+ /**
4
+ * A Color field.
5
+ *
6
+ * @typeParam State - State of the field which determines its shape.
7
+ * @see More details: {@link https://prismic.io/docs/core-concepts/color}
8
+ */
9
+ export type ColorField<State extends FieldState = FieldState> =
10
+ State extends "empty" ? null : `#${string}`;
@@ -0,0 +1,48 @@
1
+ import type { AnyRegularField, FieldState } from "./types";
2
+ import type { EmptyLinkField, LinkType } from "./link";
3
+ import type { GroupField } from "./group";
4
+ import type { SliceZone } from "./sliceZone";
5
+
6
+ /**
7
+ * Field for related documents
8
+ *
9
+ * @typeParam TypeEnum - Type API ID of the document.
10
+ * @typeParam LangEnum - Language API ID of the document.
11
+ * @typeParam DataInterface - Data fields for the document (filled in via
12
+ * GraphQuery of `fetchLinks`).
13
+ * @typeParam State - State of the field which determines its shape.
14
+ */
15
+ export type ContentRelationshipField<
16
+ TypeEnum = string,
17
+ LangEnum = string,
18
+ DataInterface extends Record<
19
+ string,
20
+ AnyRegularField | GroupField | SliceZone
21
+ > = never,
22
+ State extends FieldState = FieldState,
23
+ > = State extends "empty"
24
+ ? EmptyLinkField<typeof LinkType.Document>
25
+ : FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>;
26
+
27
+ /**
28
+ * Links that refer to Documents
29
+ */
30
+ export interface FilledContentRelationshipField<
31
+ TypeEnum = string,
32
+ LangEnum = string,
33
+ DataInterface extends Record<
34
+ string,
35
+ AnyRegularField | GroupField | SliceZone
36
+ > = never,
37
+ > {
38
+ link_type: typeof LinkType.Document;
39
+ id: string;
40
+ uid?: string;
41
+ type: TypeEnum;
42
+ tags: string[];
43
+ lang: LangEnum;
44
+ url?: string;
45
+ slug?: string;
46
+ isBroken?: boolean;
47
+ data?: DataInterface;
48
+ }