@prismicio/client 6.7.1 → 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} +3 -37
  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,8 @@
1
+ import type { FieldState } from "./types";
2
+ /**
3
+ * A Color field.
4
+ *
5
+ * @typeParam State - State of the field which determines its shape.
6
+ * @see More details: {@link https://prismic.io/docs/core-concepts/color}
7
+ */
8
+ export declare type ColorField<State extends FieldState = FieldState> = State extends "empty" ? null : `#${string}`;
@@ -0,0 +1,29 @@
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
+ * Field for related documents
7
+ *
8
+ * @typeParam TypeEnum - Type API ID of the document.
9
+ * @typeParam LangEnum - Language API ID of the document.
10
+ * @typeParam DataInterface - Data fields for the document (filled in via
11
+ * GraphQuery of `fetchLinks`).
12
+ * @typeParam State - State of the field which determines its shape.
13
+ */
14
+ export declare type ContentRelationshipField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Document> : FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>;
15
+ /**
16
+ * Links that refer to Documents
17
+ */
18
+ export interface FilledContentRelationshipField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never> {
19
+ link_type: typeof LinkType.Document;
20
+ id: string;
21
+ uid?: string;
22
+ type: TypeEnum;
23
+ tags: string[];
24
+ lang: LangEnum;
25
+ url?: string;
26
+ slug?: string;
27
+ isBroken?: boolean;
28
+ data?: DataInterface;
29
+ }
@@ -0,0 +1,8 @@
1
+ import type { FieldState } from "./types";
2
+ /**
3
+ * A Date field.
4
+ *
5
+ * @typeParam State - State of the field which determines its shape.
6
+ * @see More details: {@link https://prismic.io/docs/core-concepts/date}
7
+ */
8
+ export declare type DateField<State extends FieldState = FieldState> = State extends "empty" ? null : `${number}-${number}-${number}`;
@@ -0,0 +1,113 @@
1
+ import { AnyRegularField } from "./types";
2
+ import { GroupField } from "./group";
3
+ import { SliceZone } from "./sliceZone";
4
+ /**
5
+ * Document metadata for a translation of a Prismic document.
6
+ */
7
+ export interface AlternateLanguage<TypeEnum = string, LangEnum = string> {
8
+ id: string;
9
+ uid?: string;
10
+ type: TypeEnum;
11
+ lang: LangEnum;
12
+ }
13
+ /**
14
+ * Metadata for Prismic Document
15
+ */
16
+ export interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
17
+ /**
18
+ * The unique identifier for the document. Guaranteed to be unique among all
19
+ * documents in the Prismic repository.
20
+ */
21
+ id: string;
22
+ /**
23
+ * The unique identifier for the document. Guaranteed to be unique among all
24
+ * Prismic documents of the same type.
25
+ */
26
+ uid: string | null;
27
+ /**
28
+ * Url that refers to document.
29
+ */
30
+ url: string | null;
31
+ /**
32
+ * Type of the document.
33
+ */
34
+ type: TypeEnum;
35
+ /**
36
+ * Href for document.
37
+ */
38
+ href: string;
39
+ /**
40
+ * Tags associated with document.
41
+ */
42
+ tags: string[];
43
+ /**
44
+ * The timestamp at which the document was first published.
45
+ */
46
+ first_publication_date: string;
47
+ /**
48
+ * The timestamp at which the document was last published.
49
+ */
50
+ last_publication_date: string;
51
+ /**
52
+ * Slugs associated with document.
53
+ *
54
+ * @deprecated Slugs are a deprecated feature used before the UID field was
55
+ * introduced. Migrate to the UID field. For more details, see
56
+ * https://community.prismic.io/t/what-are-slugs/6493
57
+ */
58
+ slugs: string[];
59
+ /**
60
+ * Documents that are related to this document.
61
+ */
62
+ linked_documents: unknown[];
63
+ /**
64
+ * Language of document.
65
+ */
66
+ lang: LangEnum;
67
+ /**
68
+ * Array to access alternate language versions for document.
69
+ */
70
+ alternate_languages: AlternateLanguage<TypeEnum, LangEnum>[];
71
+ }
72
+ /**
73
+ * A Prismic document served through REST API v2.
74
+ *
75
+ * @see More details on Custom Types: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
76
+ */
77
+ export interface PrismicDocument<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocumentHeader<TypeEnum, LangEnum> {
78
+ /**
79
+ * Data contained in the document.
80
+ */
81
+ data: DataInterface;
82
+ }
83
+ /**
84
+ * A Prismic document served through REST API v2. Does not contain a UID (a
85
+ * unique identifier).
86
+ *
87
+ * @see More details on Custom Types: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
88
+ * @see More details on the UID field: {@link https://prismic.io/docs/core-concepts/uid}
89
+ */
90
+ export interface PrismicDocumentWithoutUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
91
+ /**
92
+ * This document does not have a UID field. This property will always be
93
+ * `null`.
94
+ *
95
+ * The unique identifier for the document. Guaranteed to be unique among all
96
+ * Prismic documents of the same type.
97
+ */
98
+ uid: null;
99
+ }
100
+ /**
101
+ * A Prismic document served through REST API v2. Contains a UID (a unique
102
+ * identifier).
103
+ *
104
+ * @see More details on Custom Types: {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
105
+ * @see More details on the UID field: {@link https://prismic.io/docs/core-concepts/uid}
106
+ */
107
+ export interface PrismicDocumentWithUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
108
+ /**
109
+ * The unique identifier for the document. Guaranteed to be unique among all
110
+ * Prismic documents of the same type.
111
+ */
112
+ uid: string;
113
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const OEmbedType = {
4
+ Photo: "photo",
5
+ Video: "video",
6
+ Link: "link",
7
+ Rich: "rich"
8
+ };
9
+ exports.OEmbedType = OEmbedType;
10
+ //# sourceMappingURL=embed.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.cjs","sources":["../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\";\n\n/**\n * oEmbed 1.0 possible types.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport const OEmbedType = {\n\tPhoto: \"photo\",\n\tVideo: \"video\",\n\tLink: \"link\",\n\tRich: \"rich\",\n} as const;\n\n/**\n * oEmbed response base fields. Those are every mandatory fields an oEmbed\n * response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\ntype OEmbedBase<TType extends typeof OEmbedType[keyof typeof OEmbedType]> = {\n\t/**\n\t * oEmbed resource type.\n\t */\n\ttype: TType;\n\n\t/**\n\t * oEmbed version number, this must be \"1.0\".\n\t */\n\tversion: string;\n};\n\n/**\n * oEmbed response extra fields. Those are every non-mandatory and unknown\n * fields an oEmbed response can feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type OEmbedExtra = {\n\t/**\n\t * oEmbed text title, describing the resource.\n\t */\n\ttitle?: string | null;\n\n\t/**\n\t * oEmbed resource author/owner name.\n\t */\n\tauthor_name?: string | null;\n\n\t/**\n\t * oEmbed resource author/owner URL.\n\t */\n\tauthor_url?: string | null;\n\n\t/**\n\t * oEmbed resource provider name.\n\t */\n\tprovider_name?: string | null;\n\n\t/**\n\t * oEmbed resource provider URL.\n\t */\n\tprovider_url?: string | null;\n\n\t/**\n\t * oEmbed suggested cache lifetime for the resource, in seconds.\n\t */\n\tcache_age?: number | null;\n\n\t/**\n\t * oEmbed resource thumbnail URL.\n\t */\n\tthumbnail_url?: string | null;\n\n\t/**\n\t * oEmbed resource thumbnail width.\n\t */\n\tthumbnail_width?: number | null;\n\n\t/**\n\t * oEmbed resource thumbnail height.\n\t */\n\tthumbnail_height?: number | null;\n\n\t/**\n\t * Providers may optionally include any parameters not specified in this\n\t * document (so long as they use the same key-value format) and consumers may\n\t * choose to ignore these. Consumers must ignore parameters they do not\n\t * understand.\n\t *\n\t * @see oEmbed specification: {@link https://oembed.com}\n\t */\n\t[key: string]: unknown | null;\n};\n\n/**\n * oEmbed photo type. Those are every mandatory fields an oEmbed photo response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {\n\t/**\n\t * oEmbed source URL of the image.\n\t */\n\turl: string;\n\n\t/**\n\t * oEmbed width in pixels of the image.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels of the image.\n\t */\n\theight: number;\n};\n\n/**\n * oEmbed video type. Those are every mandatory fields an oEmbed video response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {\n\t/**\n\t * oEmbed HTML required to embed a video player.\n\t */\n\thtml: string;\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number;\n};\n\n/**\n * oEmbed link type. Those are every mandatory fields an oEmbed link response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;\n\n/**\n * oEmbed rich type. Those are every mandatory fields an oEmbed rich response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {\n\t/**\n\t * oEmbed HTML required to display the resource.\n\t */\n\thtml: string;\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number;\n};\n\n/**\n * Any of the possible types of oEmbed response. Those contains only mandatory\n * fields their respective oEmbed response type must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;\n\n/**\n * An Embed field.\n *\n * @typeParam Data - Data provided by the URL's oEmbed provider.\n * @typeParam State - State of the field which determines its shape.\n * @see More details: {@link https://prismic.io/docs/core-concepts/embed}\n */\nexport type EmbedField<\n\tData extends AnyOEmbed = AnyOEmbed & OEmbedExtra,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyObjectField\n\t: Data & {\n\t\t\tembed_url: string;\n\t\t\thtml: string | null;\n\t };\n"],"names":[],"mappings":";;AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;;"}
@@ -0,0 +1,167 @@
1
+ import type { EmptyObjectField, FieldState } from "./types";
2
+ /**
3
+ * oEmbed 1.0 possible types.
4
+ *
5
+ * @see oEmbed specification: {@link https://oembed.com}
6
+ */
7
+ export declare const OEmbedType: {
8
+ readonly Photo: "photo";
9
+ readonly Video: "video";
10
+ readonly Link: "link";
11
+ readonly Rich: "rich";
12
+ };
13
+ /**
14
+ * oEmbed response base fields. Those are every mandatory fields an oEmbed
15
+ * response must feature.
16
+ *
17
+ * @see oEmbed specification: {@link https://oembed.com}
18
+ */
19
+ declare type OEmbedBase<TType extends typeof OEmbedType[keyof typeof OEmbedType]> = {
20
+ /**
21
+ * oEmbed resource type.
22
+ */
23
+ type: TType;
24
+ /**
25
+ * oEmbed version number, this must be "1.0".
26
+ */
27
+ version: string;
28
+ };
29
+ /**
30
+ * oEmbed response extra fields. Those are every non-mandatory and unknown
31
+ * fields an oEmbed response can feature.
32
+ *
33
+ * @see oEmbed specification: {@link https://oembed.com}
34
+ */
35
+ export declare type OEmbedExtra = {
36
+ /**
37
+ * oEmbed text title, describing the resource.
38
+ */
39
+ title?: string | null;
40
+ /**
41
+ * oEmbed resource author/owner name.
42
+ */
43
+ author_name?: string | null;
44
+ /**
45
+ * oEmbed resource author/owner URL.
46
+ */
47
+ author_url?: string | null;
48
+ /**
49
+ * oEmbed resource provider name.
50
+ */
51
+ provider_name?: string | null;
52
+ /**
53
+ * oEmbed resource provider URL.
54
+ */
55
+ provider_url?: string | null;
56
+ /**
57
+ * oEmbed suggested cache lifetime for the resource, in seconds.
58
+ */
59
+ cache_age?: number | null;
60
+ /**
61
+ * oEmbed resource thumbnail URL.
62
+ */
63
+ thumbnail_url?: string | null;
64
+ /**
65
+ * oEmbed resource thumbnail width.
66
+ */
67
+ thumbnail_width?: number | null;
68
+ /**
69
+ * oEmbed resource thumbnail height.
70
+ */
71
+ thumbnail_height?: number | null;
72
+ /**
73
+ * Providers may optionally include any parameters not specified in this
74
+ * document (so long as they use the same key-value format) and consumers may
75
+ * choose to ignore these. Consumers must ignore parameters they do not
76
+ * understand.
77
+ *
78
+ * @see oEmbed specification: {@link https://oembed.com}
79
+ */
80
+ [key: string]: unknown | null;
81
+ };
82
+ /**
83
+ * oEmbed photo type. Those are every mandatory fields an oEmbed photo response
84
+ * must feature.
85
+ *
86
+ * @see oEmbed specification: {@link https://oembed.com}
87
+ */
88
+ export declare type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {
89
+ /**
90
+ * oEmbed source URL of the image.
91
+ */
92
+ url: string;
93
+ /**
94
+ * oEmbed width in pixels of the image.
95
+ */
96
+ width: number;
97
+ /**
98
+ * oEmbed height in pixels of the image.
99
+ */
100
+ height: number;
101
+ };
102
+ /**
103
+ * oEmbed video type. Those are every mandatory fields an oEmbed video response
104
+ * must feature.
105
+ *
106
+ * @see oEmbed specification: {@link https://oembed.com}
107
+ */
108
+ export declare type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
109
+ /**
110
+ * oEmbed HTML required to embed a video player.
111
+ */
112
+ html: string;
113
+ /**
114
+ * oEmbed width in pixels required to display the HTML.
115
+ */
116
+ width: number;
117
+ /**
118
+ * oEmbed height in pixels required to display the HTML.
119
+ */
120
+ height: number;
121
+ };
122
+ /**
123
+ * oEmbed link type. Those are every mandatory fields an oEmbed link response
124
+ * must feature.
125
+ *
126
+ * @see oEmbed specification: {@link https://oembed.com}
127
+ */
128
+ export declare type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;
129
+ /**
130
+ * oEmbed rich type. Those are every mandatory fields an oEmbed rich response
131
+ * must feature.
132
+ *
133
+ * @see oEmbed specification: {@link https://oembed.com}
134
+ */
135
+ export declare type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
136
+ /**
137
+ * oEmbed HTML required to display the resource.
138
+ */
139
+ html: string;
140
+ /**
141
+ * oEmbed width in pixels required to display the HTML.
142
+ */
143
+ width: number;
144
+ /**
145
+ * oEmbed height in pixels required to display the HTML.
146
+ */
147
+ height: number;
148
+ };
149
+ /**
150
+ * Any of the possible types of oEmbed response. Those contains only mandatory
151
+ * fields their respective oEmbed response type must feature.
152
+ *
153
+ * @see oEmbed specification: {@link https://oembed.com}
154
+ */
155
+ export declare type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;
156
+ /**
157
+ * An Embed field.
158
+ *
159
+ * @typeParam Data - Data provided by the URL's oEmbed provider.
160
+ * @typeParam State - State of the field which determines its shape.
161
+ * @see More details: {@link https://prismic.io/docs/core-concepts/embed}
162
+ */
163
+ export declare type EmbedField<Data extends AnyOEmbed = AnyOEmbed & OEmbedExtra, State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : Data & {
164
+ embed_url: string;
165
+ html: string | null;
166
+ };
167
+ export {};
@@ -0,0 +1,10 @@
1
+ const OEmbedType = {
2
+ Photo: "photo",
3
+ Video: "video",
4
+ Link: "link",
5
+ Rich: "rich"
6
+ };
7
+ export {
8
+ OEmbedType
9
+ };
10
+ //# sourceMappingURL=embed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"embed.js","sources":["../../../src/types/value/embed.ts"],"sourcesContent":["import type { EmptyObjectField, FieldState } from \"./types\";\n\n/**\n * oEmbed 1.0 possible types.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport const OEmbedType = {\n\tPhoto: \"photo\",\n\tVideo: \"video\",\n\tLink: \"link\",\n\tRich: \"rich\",\n} as const;\n\n/**\n * oEmbed response base fields. Those are every mandatory fields an oEmbed\n * response must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\ntype OEmbedBase<TType extends typeof OEmbedType[keyof typeof OEmbedType]> = {\n\t/**\n\t * oEmbed resource type.\n\t */\n\ttype: TType;\n\n\t/**\n\t * oEmbed version number, this must be \"1.0\".\n\t */\n\tversion: string;\n};\n\n/**\n * oEmbed response extra fields. Those are every non-mandatory and unknown\n * fields an oEmbed response can feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type OEmbedExtra = {\n\t/**\n\t * oEmbed text title, describing the resource.\n\t */\n\ttitle?: string | null;\n\n\t/**\n\t * oEmbed resource author/owner name.\n\t */\n\tauthor_name?: string | null;\n\n\t/**\n\t * oEmbed resource author/owner URL.\n\t */\n\tauthor_url?: string | null;\n\n\t/**\n\t * oEmbed resource provider name.\n\t */\n\tprovider_name?: string | null;\n\n\t/**\n\t * oEmbed resource provider URL.\n\t */\n\tprovider_url?: string | null;\n\n\t/**\n\t * oEmbed suggested cache lifetime for the resource, in seconds.\n\t */\n\tcache_age?: number | null;\n\n\t/**\n\t * oEmbed resource thumbnail URL.\n\t */\n\tthumbnail_url?: string | null;\n\n\t/**\n\t * oEmbed resource thumbnail width.\n\t */\n\tthumbnail_width?: number | null;\n\n\t/**\n\t * oEmbed resource thumbnail height.\n\t */\n\tthumbnail_height?: number | null;\n\n\t/**\n\t * Providers may optionally include any parameters not specified in this\n\t * document (so long as they use the same key-value format) and consumers may\n\t * choose to ignore these. Consumers must ignore parameters they do not\n\t * understand.\n\t *\n\t * @see oEmbed specification: {@link https://oembed.com}\n\t */\n\t[key: string]: unknown | null;\n};\n\n/**\n * oEmbed photo type. Those are every mandatory fields an oEmbed photo response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {\n\t/**\n\t * oEmbed source URL of the image.\n\t */\n\turl: string;\n\n\t/**\n\t * oEmbed width in pixels of the image.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels of the image.\n\t */\n\theight: number;\n};\n\n/**\n * oEmbed video type. Those are every mandatory fields an oEmbed video response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {\n\t/**\n\t * oEmbed HTML required to embed a video player.\n\t */\n\thtml: string;\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number;\n};\n\n/**\n * oEmbed link type. Those are every mandatory fields an oEmbed link response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>;\n\n/**\n * oEmbed rich type. Those are every mandatory fields an oEmbed rich response\n * must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {\n\t/**\n\t * oEmbed HTML required to display the resource.\n\t */\n\thtml: string;\n\n\t/**\n\t * oEmbed width in pixels required to display the HTML.\n\t */\n\twidth: number;\n\n\t/**\n\t * oEmbed height in pixels required to display the HTML.\n\t */\n\theight: number;\n};\n\n/**\n * Any of the possible types of oEmbed response. Those contains only mandatory\n * fields their respective oEmbed response type must feature.\n *\n * @see oEmbed specification: {@link https://oembed.com}\n */\nexport type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed;\n\n/**\n * An Embed field.\n *\n * @typeParam Data - Data provided by the URL's oEmbed provider.\n * @typeParam State - State of the field which determines its shape.\n * @see More details: {@link https://prismic.io/docs/core-concepts/embed}\n */\nexport type EmbedField<\n\tData extends AnyOEmbed = AnyOEmbed & OEmbedExtra,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyObjectField\n\t: Data & {\n\t\t\tembed_url: string;\n\t\t\thtml: string | null;\n\t };\n"],"names":[],"mappings":"AAOO,MAAM,aAAa;AAAA,EACzB,OAAO;AAAA,EACP,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;;"}
@@ -0,0 +1,11 @@
1
+ import type { EmptyObjectField, FieldState } from "./types";
2
+ /**
3
+ * A Geopoint field.
4
+ *
5
+ * @typeParam State - State of the field which determines its shape.
6
+ * @see More details: {@link https://prismic.io/docs/core-concepts/geopoint}
7
+ */
8
+ export declare type GeoPointField<State extends FieldState = FieldState> = State extends "empty" ? EmptyObjectField : {
9
+ latitude: number;
10
+ longitude: number;
11
+ };
@@ -0,0 +1,7 @@
1
+ import type { FieldState, AnyRegularField } from "./types";
2
+ /**
3
+ * A Group field.
4
+ *
5
+ * More details: {@link https://prismic.io/docs/core-concepts/group}
6
+ */
7
+ export declare type GroupField<Fields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, State extends FieldState = FieldState> = State extends "empty" ? [] : [Fields, ...Fields[]];
@@ -0,0 +1,36 @@
1
+ import type { FieldState, Simplify } from "./types";
2
+ /**
3
+ * An individual image within an Image field. The base image and each thumbnail
4
+ * uses this type.
5
+ *
6
+ * @typeParam State - State of the field which determines its shape.
7
+ * @see {@link ImageField} for a full Image field type.
8
+ */
9
+ export declare type ImageFieldImage<State extends FieldState = FieldState> = State extends "empty" ? EmptyImageFieldImage : FilledImageFieldImage;
10
+ export interface FilledImageFieldImage {
11
+ url: string;
12
+ dimensions: {
13
+ width: number;
14
+ height: number;
15
+ };
16
+ alt: string | null;
17
+ copyright: string | null;
18
+ }
19
+ export interface EmptyImageFieldImage {
20
+ url?: null;
21
+ dimensions?: null;
22
+ alt?: null;
23
+ copyright?: null;
24
+ }
25
+ /**
26
+ * Image Field
27
+ *
28
+ * **Note**: Passing `null` to the `ThumbnailNames` parameter is deprecated and
29
+ * will be removed in a future version. Use `never` instead.
30
+ *
31
+ * @typeParam ThumbnailNames - Names of thumbnails. If the field does not
32
+ * contain thumbnails, `never` can be used to "disable" thumbnail fields.
33
+ * @typeParam State - State of the field which determines its shape.
34
+ * @see Image field documentation: {@link https://prismic.io/docs/core-concepts/image}
35
+ */
36
+ export declare type ImageField<ThumbnailNames extends string | null = never, State extends FieldState = FieldState> = Simplify<State extends "filled" ? ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>> : ImageFieldImage<State> & Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>>>;
@@ -0,0 +1,9 @@
1
+ import type { FieldState } from "./types";
2
+ /**
3
+ * Integration Fields for Custom APIs
4
+ *
5
+ * @typeParam Data - Data from the integrated API.
6
+ * @typeParam State - State of the field which determines its shape.
7
+ * @see More details: {@link https://prismic.io/docs/core-concepts/integration-fields-setup}
8
+ */
9
+ export declare type IntegrationFields<Data extends Record<string, unknown> = Record<string, unknown>, State extends FieldState = FieldState> = State extends "empty" ? null : Data;
@@ -0,0 +1,8 @@
1
+ import type { FieldState } from "./types";
2
+ /**
3
+ * A Key text field
4
+ *
5
+ * @typeParam State - State of the field which determines its shape.
6
+ * @see More details: {@link https://prismic.io/docs/core-concepts/key-text}
7
+ */
8
+ export declare type KeyTextField<State extends FieldState = FieldState> = State extends "empty" ? null | "" : string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const LinkType = {
4
+ Any: "Any",
5
+ Document: "Document",
6
+ Media: "Media",
7
+ Web: "Web"
8
+ };
9
+ exports.LinkType = LinkType;
10
+ //# sourceMappingURL=link.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.cjs","sources":["../../../src/types/value/link.ts"],"sourcesContent":["import type { FieldState, AnyRegularField } from \"./types\";\nimport type { GroupField } from \"./group\";\nimport type { SliceZone } from \"./sliceZone\";\nimport type { ContentRelationshipField } from \"./contentRelationship\";\nimport type { LinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Link Types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const;\n\n/**\n * For link fields that haven't been filled\n *\n * @typeParam Type - The type of link.\n */\nexport type EmptyLinkField<\n\tType extends typeof LinkType[keyof typeof LinkType] = typeof LinkType.Any,\n> = {\n\tlink_type: Type | string;\n};\n\n/**\n * Link that points to external website\n */\nexport interface FilledLinkToWebField {\n\tlink_type: typeof LinkType.Web;\n\turl: string;\n\ttarget?: string;\n}\n\n/**\n * Link Field\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled in via\n * GraphQuery of `fetchLinks`).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends Record<\n\t\tstring,\n\t\tAnyRegularField | GroupField | SliceZone\n\t> = never,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any>\n\t:\n\t\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>\n\t\t\t| FilledLinkToWebField\n\t\t\t| LinkToMediaField<State>;\n"],"names":[],"mappings":";;AASO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;;"}
@@ -0,0 +1,40 @@
1
+ import type { FieldState, AnyRegularField } from "./types";
2
+ import type { GroupField } from "./group";
3
+ import type { SliceZone } from "./sliceZone";
4
+ import type { ContentRelationshipField } from "./contentRelationship";
5
+ import type { LinkToMediaField } from "./linkToMedia";
6
+ /**
7
+ * Link Types
8
+ */
9
+ export declare const LinkType: {
10
+ readonly Any: "Any";
11
+ readonly Document: "Document";
12
+ readonly Media: "Media";
13
+ readonly Web: "Web";
14
+ };
15
+ /**
16
+ * For link fields that haven't been filled
17
+ *
18
+ * @typeParam Type - The type of link.
19
+ */
20
+ export declare type EmptyLinkField<Type extends typeof LinkType[keyof typeof LinkType] = typeof LinkType.Any> = {
21
+ link_type: Type | string;
22
+ };
23
+ /**
24
+ * Link that points to external website
25
+ */
26
+ export interface FilledLinkToWebField {
27
+ link_type: typeof LinkType.Web;
28
+ url: string;
29
+ target?: string;
30
+ }
31
+ /**
32
+ * Link Field
33
+ *
34
+ * @typeParam TypeEnum - Type API ID of the document.
35
+ * @typeParam LangEnum - Language API ID of the document.
36
+ * @typeParam DataInterface - Data fields for the document (filled in via
37
+ * GraphQuery of `fetchLinks`).
38
+ * @typeParam State - State of the field which determines its shape.
39
+ */
40
+ export declare type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = never, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Any> : ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State> | FilledLinkToWebField | LinkToMediaField<State>;
@@ -0,0 +1,10 @@
1
+ const LinkType = {
2
+ Any: "Any",
3
+ Document: "Document",
4
+ Media: "Media",
5
+ Web: "Web"
6
+ };
7
+ export {
8
+ LinkType
9
+ };
10
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sources":["../../../src/types/value/link.ts"],"sourcesContent":["import type { FieldState, AnyRegularField } from \"./types\";\nimport type { GroupField } from \"./group\";\nimport type { SliceZone } from \"./sliceZone\";\nimport type { ContentRelationshipField } from \"./contentRelationship\";\nimport type { LinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Link Types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const;\n\n/**\n * For link fields that haven't been filled\n *\n * @typeParam Type - The type of link.\n */\nexport type EmptyLinkField<\n\tType extends typeof LinkType[keyof typeof LinkType] = typeof LinkType.Any,\n> = {\n\tlink_type: Type | string;\n};\n\n/**\n * Link that points to external website\n */\nexport interface FilledLinkToWebField {\n\tlink_type: typeof LinkType.Web;\n\turl: string;\n\ttarget?: string;\n}\n\n/**\n * Link Field\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled in via\n * GraphQuery of `fetchLinks`).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends Record<\n\t\tstring,\n\t\tAnyRegularField | GroupField | SliceZone\n\t> = never,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any>\n\t:\n\t\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>\n\t\t\t| FilledLinkToWebField\n\t\t\t| LinkToMediaField<State>;\n"],"names":[],"mappings":"AASO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;"}
@@ -0,0 +1,20 @@
1
+ import type { EmptyLinkField, LinkType } from "./link";
2
+ import type { FieldState } from "./types";
3
+ /**
4
+ * Link field that points to media
5
+ *
6
+ * @typeParam State - State of the field which determines its shape.
7
+ */
8
+ export declare type LinkToMediaField<State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField<typeof LinkType.Media> : FilledLinkToMediaField;
9
+ /**
10
+ * Link that points to media
11
+ */
12
+ export interface FilledLinkToMediaField {
13
+ link_type: typeof LinkType.Media;
14
+ name: string;
15
+ kind: string;
16
+ url: string;
17
+ size: string;
18
+ height?: string | null;
19
+ width?: string | null;
20
+ }
@@ -0,0 +1,8 @@
1
+ import type { FieldState } from "./types";
2
+ /**
3
+ * A Number field
4
+ *
5
+ * @typeParam State - State of the field which determines its shape.
6
+ * @see More details: {@link https://prismic.io/docs/core-concepts/number}
7
+ */
8
+ export declare type NumberField<State extends FieldState = FieldState> = State extends "empty" ? null : number;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const RichTextNodeType = {
4
+ heading1: "heading1",
5
+ heading2: "heading2",
6
+ heading3: "heading3",
7
+ heading4: "heading4",
8
+ heading5: "heading5",
9
+ heading6: "heading6",
10
+ paragraph: "paragraph",
11
+ preformatted: "preformatted",
12
+ strong: "strong",
13
+ em: "em",
14
+ listItem: "list-item",
15
+ oListItem: "o-list-item",
16
+ list: "group-list-item",
17
+ oList: "group-o-list-item",
18
+ image: "image",
19
+ embed: "embed",
20
+ hyperlink: "hyperlink",
21
+ label: "label",
22
+ span: "span"
23
+ };
24
+ exports.RichTextNodeType = RichTextNodeType;
25
+ //# sourceMappingURL=richText.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"richText.cjs","sources":["../../../src/types/value/richText.ts"],"sourcesContent":["import type { EmbedField } from \"./embed\";\nimport type { FieldState } from \"./types\";\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\nimport type { FilledLinkToWebField } from \"./link\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const;\n\n// Text nodes\n\n/**\n * Base to be extended by other RT Nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string;\n\tspans: RTInlineNode[];\n}\n\n/**\n * Rich Text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1;\n}\n\n/**\n * Rich Text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2;\n}\n\n/**\n * Rich Text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3;\n}\n\n/**\n * Rich Text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4;\n}\n\n/**\n * Rich Text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5;\n}\n\n/**\n * Rich Text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6;\n}\n\n/**\n * Rich Text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph;\n}\n\n/**\n * Rich Text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted;\n}\n\n/**\n * Rich Text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem;\n}\n\n/**\n * Rich Text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem;\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number;\n\tend: number;\n}\n/**\n * Rich Text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong;\n}\n\n/**\n * Rich Text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em;\n}\n\n/**\n * Rich Text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label;\n\tdata: {\n\t\tlabel: string;\n\t};\n}\n\n// Media nodes\n\n/**\n * Rich Text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image;\n\turl: string;\n\talt: string | null;\n\tcopyright: string | null;\n\tdimensions: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n\tlinkTo?:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n};\n\n/**\n * Rich Text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed;\n\toembed: EmbedField;\n};\n\n// Link nodes\n\n/**\n * Rich Text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/core-concepts/edit-rich-text#add-links}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink;\n\tdata:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n}\n\n// Serialization related nodes\n\n/**\n * Rich Text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list;\n\titems: RTListItemNode[];\n}\n\n/**\n * Rich Text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList;\n\titems: RTOListItemNode[];\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich Text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span;\n}\n\n// Helpers\n\n/**\n * Nodes from a Rich Text Field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode;\n\n/**\n * Rich Text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Inline Rich Text Nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;\n\n/**\n * All Rich Text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;\n\n/**\n * Rich Text Field\n *\n * @see Rich Text field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]];\n"],"names":[],"mappings":";;AAWO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;;"}