@prismicio/client 6.7.3 → 7.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/README.md +4 -4
  2. package/dist/buildQueryURL.cjs +25 -6
  3. package/dist/buildQueryURL.cjs.map +1 -1
  4. package/dist/buildQueryURL.d.ts +207 -130
  5. package/dist/buildQueryURL.js +25 -6
  6. package/dist/buildQueryURL.js.map +1 -1
  7. package/dist/cookie.d.ts +5 -5
  8. package/dist/createClient.cjs +1142 -0
  9. package/dist/createClient.cjs.map +1 -0
  10. package/dist/{client.d.ts → createClient.d.ts} +980 -929
  11. package/dist/createClient.js +1142 -0
  12. package/dist/createClient.js.map +1 -0
  13. package/dist/errors/ForbiddenError.cjs.map +1 -0
  14. package/dist/{ForbiddenError.d.ts → errors/ForbiddenError.d.ts} +11 -11
  15. package/dist/errors/ForbiddenError.js.map +1 -0
  16. package/dist/errors/NotFoundError.cjs.map +1 -0
  17. package/dist/{NotFoundError.d.ts → errors/NotFoundError.d.ts} +3 -3
  18. package/dist/errors/NotFoundError.js.map +1 -0
  19. package/dist/errors/ParsingError.cjs.map +1 -0
  20. package/dist/{ParsingError.d.ts → errors/ParsingError.d.ts} +12 -12
  21. package/dist/errors/ParsingError.js.map +1 -0
  22. package/dist/errors/PrismicError.cjs.map +1 -0
  23. package/dist/{PrismicError.d.ts → errors/PrismicError.d.ts} +5 -5
  24. package/dist/errors/PrismicError.js.map +1 -0
  25. package/dist/filter.cjs +247 -0
  26. package/dist/filter.cjs.map +1 -0
  27. package/dist/filter.d.ts +209 -0
  28. package/dist/filter.js +247 -0
  29. package/dist/filter.js.map +1 -0
  30. package/dist/getGraphQLEndpoint.cjs +1 -1
  31. package/dist/getGraphQLEndpoint.cjs.map +1 -1
  32. package/dist/getGraphQLEndpoint.d.ts +9 -9
  33. package/dist/getGraphQLEndpoint.js +1 -1
  34. package/dist/getGraphQLEndpoint.js.map +1 -1
  35. package/dist/getRepositoryEndpoint.cjs +1 -1
  36. package/dist/getRepositoryEndpoint.cjs.map +1 -1
  37. package/dist/getRepositoryEndpoint.d.ts +10 -10
  38. package/dist/getRepositoryEndpoint.js +1 -1
  39. package/dist/getRepositoryEndpoint.js.map +1 -1
  40. package/dist/getRepositoryName.cjs +1 -1
  41. package/dist/getRepositoryName.cjs.map +1 -1
  42. package/dist/getRepositoryName.d.ts +13 -13
  43. package/dist/getRepositoryName.js +1 -1
  44. package/dist/getRepositoryName.js.map +1 -1
  45. package/dist/getToolbarSrc.cjs +13 -0
  46. package/dist/getToolbarSrc.cjs.map +1 -0
  47. package/dist/getToolbarSrc.d.ts +34 -0
  48. package/dist/getToolbarSrc.js +13 -0
  49. package/dist/getToolbarSrc.js.map +1 -0
  50. package/dist/helpers/asDate.cjs +14 -0
  51. package/dist/helpers/asDate.cjs.map +1 -0
  52. package/dist/helpers/asDate.d.ts +16 -0
  53. package/dist/helpers/asDate.js +14 -0
  54. package/dist/helpers/asDate.js.map +1 -0
  55. package/dist/helpers/asHTML.cjs +80 -0
  56. package/dist/helpers/asHTML.cjs.map +1 -0
  57. package/dist/helpers/asHTML.d.ts +77 -0
  58. package/dist/helpers/asHTML.js +80 -0
  59. package/dist/helpers/asHTML.js.map +1 -0
  60. package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
  61. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
  62. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +52 -0
  63. package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
  64. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
  65. package/dist/helpers/asImageSrc.cjs +13 -0
  66. package/dist/helpers/asImageSrc.cjs.map +1 -0
  67. package/dist/helpers/asImageSrc.d.ts +27 -0
  68. package/dist/helpers/asImageSrc.js +13 -0
  69. package/dist/helpers/asImageSrc.js.map +1 -0
  70. package/dist/helpers/asImageWidthSrcSet.cjs +45 -0
  71. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
  72. package/dist/helpers/asImageWidthSrcSet.d.ts +60 -0
  73. package/dist/helpers/asImageWidthSrcSet.js +45 -0
  74. package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
  75. package/dist/helpers/asLink.cjs +38 -0
  76. package/dist/helpers/asLink.cjs.map +1 -0
  77. package/dist/helpers/asLink.d.ts +34 -0
  78. package/dist/helpers/asLink.js +38 -0
  79. package/dist/helpers/asLink.js.map +1 -0
  80. package/dist/helpers/asLinkAttrs.cjs +28 -0
  81. package/dist/helpers/asLinkAttrs.cjs.map +1 -0
  82. package/dist/helpers/asLinkAttrs.d.ts +63 -0
  83. package/dist/helpers/asLinkAttrs.js +28 -0
  84. package/dist/helpers/asLinkAttrs.js.map +1 -0
  85. package/dist/helpers/asText.cjs +12 -0
  86. package/dist/helpers/asText.cjs.map +1 -0
  87. package/dist/helpers/asText.d.ts +16 -0
  88. package/dist/helpers/asText.js +12 -0
  89. package/dist/helpers/asText.js.map +1 -0
  90. package/dist/helpers/documentToLinkField.cjs +26 -0
  91. package/dist/helpers/documentToLinkField.cjs.map +1 -0
  92. package/dist/helpers/documentToLinkField.d.ts +15 -0
  93. package/dist/helpers/documentToLinkField.js +26 -0
  94. package/dist/helpers/documentToLinkField.js.map +1 -0
  95. package/dist/helpers/isFilled.cjs +67 -0
  96. package/dist/helpers/isFilled.cjs.map +1 -0
  97. package/dist/helpers/isFilled.d.ts +172 -0
  98. package/dist/helpers/isFilled.js +67 -0
  99. package/dist/helpers/isFilled.js.map +1 -0
  100. package/dist/index.cjs +56 -17
  101. package/dist/index.cjs.map +1 -1
  102. package/dist/index.d.ts +138 -88
  103. package/dist/index.js +50 -16
  104. package/dist/index.js.map +1 -1
  105. package/dist/isRepositoryEndpoint.d.ts +10 -10
  106. package/dist/isRepositoryName.d.ts +9 -9
  107. package/dist/lib/appendFilters.cjs +11 -0
  108. package/dist/lib/appendFilters.cjs.map +1 -0
  109. package/dist/lib/appendFilters.d.ts +18 -0
  110. package/dist/lib/appendFilters.js +11 -0
  111. package/dist/lib/appendFilters.js.map +1 -0
  112. package/dist/lib/castArray.cjs +3 -1
  113. package/dist/lib/castArray.cjs.map +1 -1
  114. package/dist/lib/castArray.d.ts +11 -11
  115. package/dist/lib/castArray.js +3 -1
  116. package/dist/lib/castArray.js.map +1 -1
  117. package/dist/lib/castThunk.cjs +3 -1
  118. package/dist/lib/castThunk.cjs.map +1 -1
  119. package/dist/lib/castThunk.d.ts +10 -10
  120. package/dist/lib/castThunk.js +3 -1
  121. package/dist/lib/castThunk.js.map +1 -1
  122. package/dist/lib/devMsg.cjs +8 -0
  123. package/dist/lib/devMsg.cjs.map +1 -0
  124. package/dist/lib/devMsg.d.ts +16 -0
  125. package/dist/lib/devMsg.js +8 -0
  126. package/dist/lib/devMsg.js.map +1 -0
  127. package/dist/lib/escapeHTML.cjs +43 -0
  128. package/dist/lib/escapeHTML.cjs.map +1 -0
  129. package/dist/lib/escapeHTML.d.ts +1 -0
  130. package/dist/lib/escapeHTML.js +43 -0
  131. package/dist/lib/escapeHTML.js.map +1 -0
  132. package/dist/lib/everyTagFilter.cjs +9 -0
  133. package/dist/lib/everyTagFilter.cjs.map +1 -0
  134. package/dist/lib/everyTagFilter.d.ts +9 -0
  135. package/dist/lib/everyTagFilter.js +9 -0
  136. package/dist/lib/everyTagFilter.js.map +1 -0
  137. package/dist/lib/findMasterRef.cjs.map +1 -1
  138. package/dist/lib/findMasterRef.d.ts +10 -10
  139. package/dist/lib/findMasterRef.js.map +1 -1
  140. package/dist/lib/findRef.cjs +3 -3
  141. package/dist/lib/findRef.cjs.map +1 -1
  142. package/dist/lib/findRef.d.ts +13 -13
  143. package/dist/lib/findRef.js +3 -3
  144. package/dist/lib/findRef.js.map +1 -1
  145. package/dist/lib/findRefByID.cjs.map +1 -1
  146. package/dist/lib/findRefByID.d.ts +11 -11
  147. package/dist/lib/findRefByID.js.map +1 -1
  148. package/dist/lib/findRefByLabel.cjs.map +1 -1
  149. package/dist/lib/findRefByLabel.d.ts +11 -11
  150. package/dist/lib/findRefByLabel.js.map +1 -1
  151. package/dist/lib/getPreviewCookie.cjs +1 -1
  152. package/dist/lib/getPreviewCookie.cjs.map +1 -1
  153. package/dist/lib/getPreviewCookie.d.ts +9 -9
  154. package/dist/lib/getPreviewCookie.js +1 -1
  155. package/dist/lib/getPreviewCookie.js.map +1 -1
  156. package/dist/lib/isInternalURL.cjs +9 -0
  157. package/dist/lib/isInternalURL.cjs.map +1 -0
  158. package/dist/lib/isInternalURL.d.ts +8 -0
  159. package/dist/lib/isInternalURL.js +9 -0
  160. package/dist/lib/isInternalURL.js.map +1 -0
  161. package/dist/lib/minifyGraphQLQuery.d.ts +8 -8
  162. package/dist/lib/serializerHelpers.cjs +54 -0
  163. package/dist/lib/serializerHelpers.cjs.map +1 -0
  164. package/dist/lib/serializerHelpers.d.ts +9 -0
  165. package/dist/lib/serializerHelpers.js +54 -0
  166. package/dist/lib/serializerHelpers.js.map +1 -0
  167. package/dist/lib/someTagsFilter.cjs +9 -0
  168. package/dist/lib/someTagsFilter.cjs.map +1 -0
  169. package/dist/lib/someTagsFilter.d.ts +9 -0
  170. package/dist/lib/someTagsFilter.js +9 -0
  171. package/dist/lib/someTagsFilter.js.map +1 -0
  172. package/dist/lib/typeFilter.cjs +8 -0
  173. package/dist/lib/typeFilter.cjs.map +1 -0
  174. package/dist/lib/typeFilter.d.ts +8 -0
  175. package/dist/lib/typeFilter.js +8 -0
  176. package/dist/lib/typeFilter.js.map +1 -0
  177. package/dist/package.json.cjs +5 -0
  178. package/dist/package.json.cjs.map +1 -0
  179. package/dist/package.json.js +5 -0
  180. package/dist/package.json.js.map +1 -0
  181. package/dist/types/api/query.d.ts +42 -0
  182. package/dist/types/api/ref.d.ts +32 -0
  183. package/dist/types/api/release.d.ts +10 -0
  184. package/dist/types/api/repository.d.ts +100 -0
  185. package/dist/types/api/tags.d.ts +8 -0
  186. package/dist/types/model/boolean.d.ts +15 -0
  187. package/dist/types/model/color.d.ts +13 -0
  188. package/dist/types/model/contentRelationship.d.ts +18 -0
  189. package/dist/types/model/customType.d.ts +42 -0
  190. package/dist/types/model/date.d.ts +14 -0
  191. package/dist/types/model/embed.d.ts +13 -0
  192. package/dist/types/model/geoPoint.d.ts +12 -0
  193. package/dist/types/model/group.d.ts +15 -0
  194. package/dist/types/model/image.d.ts +31 -0
  195. package/dist/types/model/integrationFields.d.ts +14 -0
  196. package/dist/types/model/keyText.d.ts +13 -0
  197. package/dist/types/model/link.cjs +9 -0
  198. package/dist/types/model/link.cjs.map +1 -0
  199. package/dist/types/model/link.d.ts +27 -0
  200. package/dist/types/model/link.js +9 -0
  201. package/dist/types/model/link.js.map +1 -0
  202. package/dist/types/model/linkToMedia.d.ts +16 -0
  203. package/dist/types/model/number.d.ts +15 -0
  204. package/dist/types/model/range.d.ts +14 -0
  205. package/dist/types/model/richText.d.ts +35 -0
  206. package/dist/types/model/select.d.ts +18 -0
  207. package/dist/types/model/separator.d.ts +10 -0
  208. package/dist/types/model/sharedSlice.d.ts +16 -0
  209. package/dist/types/model/sharedSliceVariation.d.ts +19 -0
  210. package/dist/types/model/slice.cjs +8 -0
  211. package/dist/types/model/slice.cjs.map +1 -0
  212. package/dist/types/model/slice.d.ts +33 -0
  213. package/dist/types/model/slice.js +8 -0
  214. package/dist/types/model/slice.js.map +1 -0
  215. package/dist/types/model/sliceZone.cjs +8 -0
  216. package/dist/types/model/sliceZone.cjs.map +1 -0
  217. package/dist/types/model/sliceZone.d.ts +41 -0
  218. package/dist/types/model/sliceZone.js +8 -0
  219. package/dist/types/model/sliceZone.js.map +1 -0
  220. package/dist/types/model/timestamp.d.ts +14 -0
  221. package/dist/types/model/title.d.ts +7 -0
  222. package/dist/types/model/types.cjs +34 -0
  223. package/dist/types/model/types.cjs.map +1 -0
  224. package/dist/types/model/types.d.ts +62 -0
  225. package/dist/types/model/types.js +34 -0
  226. package/dist/types/model/types.js.map +1 -0
  227. package/dist/types/model/uid.d.ts +13 -0
  228. package/dist/types/value/boolean.d.ts +6 -0
  229. package/dist/types/value/color.d.ts +8 -0
  230. package/dist/types/value/contentRelationship.d.ts +29 -0
  231. package/dist/types/value/date.d.ts +8 -0
  232. package/dist/types/value/document.d.ts +113 -0
  233. package/dist/types/value/embed.cjs +10 -0
  234. package/dist/types/value/embed.cjs.map +1 -0
  235. package/dist/types/value/embed.d.ts +167 -0
  236. package/dist/types/value/embed.js +10 -0
  237. package/dist/types/value/embed.js.map +1 -0
  238. package/dist/types/value/geoPoint.d.ts +11 -0
  239. package/dist/types/value/group.d.ts +7 -0
  240. package/dist/types/value/image.d.ts +36 -0
  241. package/dist/types/value/integrationFields.d.ts +9 -0
  242. package/dist/types/value/keyText.d.ts +8 -0
  243. package/dist/types/value/link.cjs +10 -0
  244. package/dist/types/value/link.cjs.map +1 -0
  245. package/dist/types/value/link.d.ts +40 -0
  246. package/dist/types/value/link.js +10 -0
  247. package/dist/types/value/link.js.map +1 -0
  248. package/dist/types/value/linkToMedia.d.ts +20 -0
  249. package/dist/types/value/number.d.ts +8 -0
  250. package/dist/types/value/richText.cjs +25 -0
  251. package/dist/types/value/richText.cjs.map +1 -0
  252. package/dist/types/value/richText.d.ts +203 -0
  253. package/dist/types/value/richText.js +25 -0
  254. package/dist/types/value/richText.js.map +1 -0
  255. package/dist/types/value/select.d.ts +9 -0
  256. package/dist/types/value/sharedSlice.d.ts +11 -0
  257. package/dist/types/value/sharedSliceVariation.d.ts +7 -0
  258. package/dist/types/value/slice.d.ts +13 -0
  259. package/dist/types/value/sliceZone.d.ts +12 -0
  260. package/dist/types/value/timestamp.d.ts +8 -0
  261. package/dist/types/value/title.d.ts +12 -0
  262. package/dist/types/value/types.d.ts +40 -0
  263. package/dist/types/webhook/apiUpdate.d.ts +52 -0
  264. package/dist/types/webhook/testTrigger.d.ts +9 -0
  265. package/dist/types/webhook/types.cjs +8 -0
  266. package/dist/types/webhook/types.cjs.map +1 -0
  267. package/dist/types/webhook/types.d.ts +18 -0
  268. package/dist/types/webhook/types.js +8 -0
  269. package/dist/types/webhook/types.js.map +1 -0
  270. package/package.json +42 -36
  271. package/src/buildQueryURL.ts +179 -32
  272. package/src/{client.ts → createClient.ts} +248 -186
  273. package/src/filter.ts +356 -0
  274. package/src/getGraphQLEndpoint.ts +2 -1
  275. package/src/getRepositoryEndpoint.ts +2 -1
  276. package/src/getRepositoryName.ts +1 -1
  277. package/src/getToolbarSrc.ts +50 -0
  278. package/src/helpers/asDate.ts +48 -0
  279. package/src/helpers/asHTML.ts +249 -0
  280. package/src/helpers/asImagePixelDensitySrcSet.ts +96 -0
  281. package/src/helpers/asImageSrc.ts +41 -0
  282. package/src/helpers/asImageWidthSrcSet.ts +139 -0
  283. package/src/helpers/asLink.ts +118 -0
  284. package/src/helpers/asLinkAttrs.ts +127 -0
  285. package/src/helpers/asText.ts +29 -0
  286. package/src/helpers/documentToLinkField.ts +47 -0
  287. package/src/helpers/isFilled.ts +288 -0
  288. package/src/index.ts +277 -31
  289. package/src/lib/appendFilters.ts +26 -0
  290. package/src/lib/castArray.ts +3 -1
  291. package/src/lib/castThunk.ts +3 -2
  292. package/src/lib/devMsg.ts +20 -0
  293. package/src/lib/escapeHTML.ts +51 -0
  294. package/src/lib/everyTagFilter.ts +15 -0
  295. package/src/lib/findMasterRef.ts +2 -2
  296. package/src/lib/findRef.ts +6 -9
  297. package/src/lib/findRefByID.ts +2 -2
  298. package/src/lib/findRefByLabel.ts +2 -5
  299. package/src/lib/getPreviewCookie.ts +1 -1
  300. package/src/lib/isInternalURL.ts +14 -0
  301. package/src/lib/serializerHelpers.ts +101 -0
  302. package/src/lib/someTagsFilter.ts +15 -0
  303. package/src/lib/typeFilter.ts +12 -0
  304. package/src/types/api/query.ts +50 -0
  305. package/src/types/api/ref.ts +36 -0
  306. package/src/types/api/release.ts +11 -0
  307. package/src/types/api/repository.ts +117 -0
  308. package/src/types/api/tags.ts +8 -0
  309. package/src/types/model/boolean.ts +16 -0
  310. package/src/types/model/color.ts +14 -0
  311. package/src/types/model/contentRelationship.ts +23 -0
  312. package/src/types/model/customType.ts +61 -0
  313. package/src/types/model/date.ts +15 -0
  314. package/src/types/model/embed.ts +14 -0
  315. package/src/types/model/geoPoint.ts +13 -0
  316. package/src/types/model/group.ts +24 -0
  317. package/src/types/model/image.ts +37 -0
  318. package/src/types/model/integrationFields.ts +15 -0
  319. package/src/types/model/keyText.ts +14 -0
  320. package/src/types/model/link.ts +31 -0
  321. package/src/types/model/linkToMedia.ts +18 -0
  322. package/src/types/model/number.ts +16 -0
  323. package/src/types/model/range.ts +15 -0
  324. package/src/types/model/richText.ts +40 -0
  325. package/src/types/model/select.ts +22 -0
  326. package/src/types/model/separator.ts +11 -0
  327. package/src/types/model/sharedSlice.ts +20 -0
  328. package/src/types/model/sharedSliceVariation.ts +30 -0
  329. package/src/types/model/slice.ts +50 -0
  330. package/src/types/model/sliceZone.ts +60 -0
  331. package/src/types/model/timestamp.ts +15 -0
  332. package/src/types/model/title.ts +8 -0
  333. package/src/types/model/types.ts +87 -0
  334. package/src/types/model/uid.ts +14 -0
  335. package/src/types/value/boolean.ts +6 -0
  336. package/src/types/value/color.ts +10 -0
  337. package/src/types/value/contentRelationship.ts +47 -0
  338. package/src/types/value/date.ts +10 -0
  339. package/src/types/value/document.ts +143 -0
  340. package/src/types/value/embed.ts +196 -0
  341. package/src/types/value/geoPoint.ts +15 -0
  342. package/src/types/value/group.ts +14 -0
  343. package/src/types/value/image.ts +67 -0
  344. package/src/types/value/integrationFields.ts +13 -0
  345. package/src/types/value/keyText.ts +10 -0
  346. package/src/types/value/link.ts +59 -0
  347. package/src/types/value/linkToMedia.ts +26 -0
  348. package/src/types/value/number.ts +10 -0
  349. package/src/types/value/richText.ts +287 -0
  350. package/src/types/value/select.ts +13 -0
  351. package/src/types/value/sharedSlice.ts +15 -0
  352. package/src/types/value/sharedSliceVariation.ts +18 -0
  353. package/src/types/value/slice.ts +24 -0
  354. package/src/types/value/sliceZone.ts +17 -0
  355. package/src/types/value/timestamp.ts +13 -0
  356. package/src/types/value/title.ts +32 -0
  357. package/src/types/value/types.ts +58 -0
  358. package/src/types/webhook/apiUpdate.ts +56 -0
  359. package/src/types/webhook/testTrigger.ts +10 -0
  360. package/src/types/webhook/types.ts +21 -0
  361. package/dist/ForbiddenError.cjs.map +0 -1
  362. package/dist/ForbiddenError.js.map +0 -1
  363. package/dist/NotFoundError.cjs.map +0 -1
  364. package/dist/NotFoundError.js.map +0 -1
  365. package/dist/ParsingError.cjs.map +0 -1
  366. package/dist/ParsingError.js.map +0 -1
  367. package/dist/PrismicError.cjs.map +0 -1
  368. package/dist/PrismicError.js.map +0 -1
  369. package/dist/client.cjs +0 -436
  370. package/dist/client.cjs.map +0 -1
  371. package/dist/client.js +0 -419
  372. package/dist/client.js.map +0 -1
  373. package/dist/lib/appendPredicates.cjs +0 -14
  374. package/dist/lib/appendPredicates.cjs.map +0 -1
  375. package/dist/lib/appendPredicates.d.ts +0 -18
  376. package/dist/lib/appendPredicates.js +0 -14
  377. package/dist/lib/appendPredicates.js.map +0 -1
  378. package/dist/lib/orElseThrow.d.ts +0 -11
  379. package/dist/predicate.cjs +0 -68
  380. package/dist/predicate.cjs.map +0 -1
  381. package/dist/predicate.d.ts +0 -209
  382. package/dist/predicate.js +0 -68
  383. package/dist/predicate.js.map +0 -1
  384. package/dist/types.d.ts +0 -156
  385. package/src/lib/appendPredicates.ts +0 -29
  386. package/src/lib/orElseThrow.ts +0 -17
  387. package/src/predicate.ts +0 -359
  388. package/src/types.ts +0 -191
  389. /package/dist/{ForbiddenError.cjs → errors/ForbiddenError.cjs} +0 -0
  390. /package/dist/{ForbiddenError.js → errors/ForbiddenError.js} +0 -0
  391. /package/dist/{NotFoundError.cjs → errors/NotFoundError.cjs} +0 -0
  392. /package/dist/{NotFoundError.js → errors/NotFoundError.js} +0 -0
  393. /package/dist/{ParsingError.cjs → errors/ParsingError.cjs} +0 -0
  394. /package/dist/{ParsingError.js → errors/ParsingError.js} +0 -0
  395. /package/dist/{PrismicError.cjs → errors/PrismicError.cjs} +0 -0
  396. /package/dist/{PrismicError.js → errors/PrismicError.js} +0 -0
  397. /package/src/{ForbiddenError.ts → errors/ForbiddenError.ts} +0 -0
  398. /package/src/{NotFoundError.ts → errors/NotFoundError.ts} +0 -0
  399. /package/src/{ParsingError.ts → errors/ParsingError.ts} +0 -0
  400. /package/src/{PrismicError.ts → errors/PrismicError.ts} +0 -0
@@ -0,0 +1,26 @@
1
+ import { LinkType } from "../types/value/link.js";
2
+ const documentToLinkField = (prismicDocument) => {
3
+ var _a;
4
+ return {
5
+ link_type: LinkType.Document,
6
+ id: prismicDocument.id,
7
+ uid: prismicDocument.uid || void 0,
8
+ type: prismicDocument.type,
9
+ tags: prismicDocument.tags,
10
+ lang: prismicDocument.lang,
11
+ url: prismicDocument.url == null ? void 0 : prismicDocument.url,
12
+ slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],
13
+ // The REST API does not include a `data` property if the data
14
+ // object is empty.
15
+ //
16
+ // A presence check for `prismicDocument.data` is done to
17
+ // support partial documents. While `documentToLinkField` is
18
+ // not typed to accept partial documents, passing a partial
19
+ // document can happen in untyped projects.
20
+ ...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
21
+ };
22
+ };
23
+ export {
24
+ documentToLinkField
25
+ };
26
+ //# sourceMappingURL=documentToLinkField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentToLinkField.js","sources":["../../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\";\nimport type { PrismicDocument } from \"../types/value/document\";\nimport { LinkType } from \"../types/value/link\";\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys> &\n\tPartial<Pick<T, Keys>>;\n\n/**\n * Converts a document into a link field, this is useful when crawling the API\n * for document links\n *\n * @typeParam TDocument - Specific interface of the provided document\n * @param prismicDocument - A document coming from Prismic\n *\n * @returns The equivalent link field to use with `asLink()`\n * @internal\n */\nexport const documentToLinkField = <\n\tTDocument extends SetOptional<PrismicDocument, \"slugs\">,\n>(\n\tprismicDocument: TDocument,\n): FilledContentRelationshipField<\n\tTDocument[\"type\"],\n\tTDocument[\"lang\"],\n\tTDocument[\"data\"]\n> => {\n\treturn {\n\t\tlink_type: LinkType.Document,\n\t\tid: prismicDocument.id,\n\t\tuid: prismicDocument.uid || undefined,\n\t\ttype: prismicDocument.type,\n\t\ttags: prismicDocument.tags,\n\t\tlang: prismicDocument.lang,\n\t\turl: prismicDocument.url == null ? undefined : prismicDocument.url,\n\t\tslug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQl\n\t\t// The REST API does not include a `data` property if the data\n\t\t// object is empty.\n\t\t//\n\t\t// A presence check for `prismicDocument.data` is done to\n\t\t// support partial documents. While `documentToLinkField` is\n\t\t// not typed to accept partial documents, passing a partial\n\t\t// document can happen in untyped projects.\n\t\t...(prismicDocument.data && Object.keys(prismicDocument.data).length > 0\n\t\t\t? { data: prismicDocument.data }\n\t\t\t: {}),\n\t};\n};\n"],"names":[],"mappings":";AAiBa,MAAA,sBAAsB,CAGlC,oBAKG;;AACI,SAAA;AAAA,IACN,WAAW,SAAS;AAAA,IACpB,IAAI,gBAAgB;AAAA,IACpB,KAAK,gBAAgB,OAAO;AAAA,IAC5B,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,KAAK,gBAAgB,OAAO,OAAO,SAAY,gBAAgB;AAAA,IAC/D,OAAM,qBAAgB,UAAhB,mBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ9B,GAAI,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,IAAI,EAAE,SAAS,IACpE,EAAE,MAAM,gBAAgB,SACxB;;AAEL;"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isNonNullish = (input) => {
4
+ return input != null;
5
+ };
6
+ const isNonEmptyArray = (input) => {
7
+ return !!input.length;
8
+ };
9
+ const richText = (field) => {
10
+ if (!isNonNullish(field)) {
11
+ return false;
12
+ } else if (field.length === 1 && "text" in field[0]) {
13
+ return !!field[0].text;
14
+ } else {
15
+ return !!field.length;
16
+ }
17
+ };
18
+ const title = richText;
19
+ const imageThumbnail = (thumbnail) => {
20
+ return isNonNullish(thumbnail) && !!thumbnail.url;
21
+ };
22
+ const image = imageThumbnail;
23
+ const link = (field) => {
24
+ return isNonNullish(field) && ("id" in field || "url" in field);
25
+ };
26
+ const linkToMedia = link;
27
+ const contentRelationship = link;
28
+ const date = isNonNullish;
29
+ const timestamp = isNonNullish;
30
+ const color = isNonNullish;
31
+ const number = isNonNullish;
32
+ const keyText = (field) => {
33
+ return isNonNullish(keyText) && !!field;
34
+ };
35
+ const select = isNonNullish;
36
+ const embed = (field) => {
37
+ return isNonNullish(field) && !!field.embed_url;
38
+ };
39
+ const geoPoint = (field) => {
40
+ return isNonNullish(field) && "longitude" in field;
41
+ };
42
+ const integrationFields = isNonNullish;
43
+ const group = (group2) => {
44
+ return isNonNullish(group2) && isNonEmptyArray(group2);
45
+ };
46
+ const sliceZone = (slices) => {
47
+ return isNonNullish(slices) && isNonEmptyArray(slices);
48
+ };
49
+ exports.color = color;
50
+ exports.contentRelationship = contentRelationship;
51
+ exports.date = date;
52
+ exports.embed = embed;
53
+ exports.geoPoint = geoPoint;
54
+ exports.group = group;
55
+ exports.image = image;
56
+ exports.imageThumbnail = imageThumbnail;
57
+ exports.integrationFields = integrationFields;
58
+ exports.keyText = keyText;
59
+ exports.link = link;
60
+ exports.linkToMedia = linkToMedia;
61
+ exports.number = number;
62
+ exports.richText = richText;
63
+ exports.select = select;
64
+ exports.sliceZone = sliceZone;
65
+ exports.timestamp = timestamp;
66
+ exports.title = title;
67
+ //# sourceMappingURL=isFilled.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isFilled.cjs","sources":["../../../src/helpers/isFilled.ts"],"sourcesContent":["import type { ColorField } from \"../types/value/color\";\nimport type { ContentRelationshipField } from \"../types/value/contentRelationship\";\nimport type { DateField } from \"../types/value/date\";\nimport type { AnyOEmbed, EmbedField } from \"../types/value/embed\";\nimport type { GeoPointField } from \"../types/value/geoPoint\";\nimport type { GroupField } from \"../types/value/group\";\nimport type { ImageField, ImageFieldImage } from \"../types/value/image\";\nimport type { IntegrationFields } from \"../types/value/integrationFields\";\nimport type { KeyTextField } from \"../types/value/keyText\";\nimport type { LinkField } from \"../types/value/link\";\nimport type { LinkToMediaField } from \"../types/value/linkToMedia\";\nimport type { NumberField } from \"../types/value/number\";\nimport type { RichTextField } from \"../types/value/richText\";\nimport type { SelectField } from \"../types/value/select\";\nimport type { SharedSlice } from \"../types/value/sharedSlice\";\nimport type { Slice } from \"../types/value/slice\";\nimport type { SliceZone } from \"../types/value/sliceZone\";\nimport type { TimestampField } from \"../types/value/timestamp\";\nimport type { TitleField } from \"../types/value/title\";\nimport type { AnyRegularField } from \"../types/value/types\";\n\n/**\n * Determines if a value is not nullish (i.e. not `null` or `undefined`). This\n * is used to check if nullable field values are filled.\n *\n * @param input - The value to check.\n *\n * @returns `true` if `input` is not nullish, `false` otherwise.\n */\nconst isNonNullish = <T>(input: T): input is NonNullable<T> => {\n\treturn input != null;\n};\n\n/**\n * Determines if an array is not empty. This is used to check if array-based\n * fields are filled.\n *\n * @param input - The array to check.\n *\n * @returns `true` if `input` has at least one element, `false` otherwise.\n */\nconst isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {\n\treturn !!input.length;\n};\n\n/**\n * Determines if a Rich Text field is filled.\n *\n * @param field - Rich Text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const richText = (\n\tfield: RichTextField | null | undefined,\n): field is RichTextField<\"filled\"> => {\n\tif (!isNonNullish(field)) {\n\t\treturn false;\n\t} else if (field.length === 1 && \"text\" in field[0]) {\n\t\treturn !!field[0].text;\n\t} else {\n\t\treturn !!field.length;\n\t}\n};\n\n/**\n * Determines if a Title field is filled.\n *\n * @param field - Title field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const title = richText as (\n\tfield: TitleField | null | undefined,\n) => field is TitleField<\"filled\">;\n\n/**\n * Determines if an Image thumbnail is filled.\n *\n * @param thumbnail - Image thumbnail to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const imageThumbnail = (\n\tthumbnail: ImageFieldImage | null | undefined,\n): thumbnail is ImageFieldImage<\"filled\"> => {\n\treturn isNonNullish(thumbnail) && !!thumbnail.url;\n};\n\n/**\n * Determines if an Image field is filled.\n *\n * @param field - Image field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <\n\tThumbnailNames extends string | null = never,\n>(\n\tfield: ImageField<ThumbnailNames> | null | undefined,\n) => field is ImageField<ThumbnailNames, \"filled\">;\n\n/**\n * Determines if a Link field is filled.\n *\n * @param field - Link field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n>(\n\tfield: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined,\n): field is LinkField<TypeEnum, LangEnum, DataInterface, \"filled\"> => {\n\treturn isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\n\n/**\n * Determines if a Link to Media field is filled.\n *\n * @param field - Link to Media field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const linkToMedia = link as (\n\tfield: LinkToMediaField | null | undefined,\n) => field is LinkToMediaField<\"filled\">;\n\n/**\n * Determines if a Content Relationship field is filled.\n *\n * @param field - Content Relationship field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n>(\n\tfield:\n\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface>\n\t\t| null\n\t\t| undefined,\n) => field is ContentRelationshipField<\n\tTypeEnum,\n\tLangEnum,\n\tDataInterface,\n\t\"filled\"\n>;\n\n/**\n * Determines if a Date field is filled.\n *\n * @param field - Date field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const date = isNonNullish as (\n\tfield: DateField | null | undefined,\n) => field is DateField<\"filled\">;\n\n/**\n * Determines if a Timestamp field is filled.\n *\n * @param field - Timestamp field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const timestamp = isNonNullish as (\n\tfield: TimestampField | null | undefined,\n) => field is TimestampField<\"filled\">;\n\n/**\n * Determines if a Color field is filled.\n *\n * @param field - Color field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const color = isNonNullish as (\n\tfield: ColorField | null | undefined,\n) => field is ColorField<\"filled\">;\n\n/**\n * Determines if a Number field is filled.\n *\n * @param field - Number field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const number = isNonNullish as (\n\tfield: NumberField | null | undefined,\n) => field is NumberField<\"filled\">;\n\n/**\n * Determines if a Key Text field is filled.\n *\n * @param field - Key Text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn isNonNullish(keyText) && !!field;\n};\n\n/**\n * Determines if a Select field is filled.\n *\n * @param field - Select field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const select = isNonNullish as <Enum extends string>(\n\tfield: SelectField<Enum> | null | undefined,\n) => field is SelectField<Enum, \"filled\">;\n\n/**\n * Determines if an Embed field is filled.\n *\n * @param field - Embed field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const embed = <Field extends EmbedField<AnyOEmbed>>(\n\tfield: Field | null | undefined,\n): field is Extract<Field, EmbedField<AnyOEmbed, \"filled\">> => {\n\treturn isNonNullish(field) && !!field.embed_url;\n};\n\n/**\n * Determines if a GeoPoint field is filled.\n *\n * @param field - GeoPoint field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const geoPoint = (\n\tfield: GeoPointField | null | undefined,\n): field is GeoPointField<\"filled\"> => {\n\treturn isNonNullish(field) && \"longitude\" in field;\n};\n\n/**\n * Determines if an Integration Fields field is filled.\n *\n * @param field - Integration Fields field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const integrationFields = isNonNullish as <\n\tData extends Record<string, unknown>,\n>(\n\tfield: IntegrationFields<Data> | null | undefined,\n) => field is IntegrationFields<Data, \"filled\">;\n\n/**\n * Determines if a Group has at least one item.\n *\n * @param group - Group to check.\n *\n * @returns `true` if `group` contains at least one item, `false` otherwise.\n */\nexport const group = <Fields extends Record<string, AnyRegularField>>(\n\tgroup: GroupField<Fields> | null | undefined,\n): group is GroupField<Fields, \"filled\"> => {\n\treturn isNonNullish(group) && isNonEmptyArray(group);\n};\n\n/**\n * Determines if a Slice Zone has at least one Slice.\n *\n * @param slices - Slice Zone to check.\n *\n * @returns `true` if `slices` contains at least one Slice, `false` otherwise.\n */\nexport const sliceZone = <Slices extends Slice | SharedSlice>(\n\tslices: SliceZone<Slices> | null | undefined,\n): slices is SliceZone<Slices, \"filled\"> => {\n\treturn isNonNullish(slices) && isNonEmptyArray(slices);\n};\n"],"names":["group"],"mappings":";;AA6BA,MAAM,eAAe,CAAI,UAAqC;AAC7D,SAAO,SAAS;AACjB;AAUA,MAAM,kBAAkB,CAAI,UAAoC;AACxD,SAAA,CAAC,CAAC,MAAM;AAChB;AASa,MAAA,WAAW,CACvB,UACqC;AACjC,MAAA,CAAC,aAAa,KAAK,GAAG;AAClB,WAAA;AAAA,EAAA,WACG,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACpD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EAAA,OACZ;AACC,WAAA,CAAC,CAAC,MAAM;AAAA,EACf;AACF;AASO,MAAM,QAAQ;AAWR,MAAA,iBAAiB,CAC7B,cAC2C;AAC3C,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAC/C;AASO,MAAM,QAAQ;AAaR,MAAA,OAAO,CAOnB,UACoE;AACpE,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC1D;AASO,MAAM,cAAc;AAWpB,MAAM,sBAAsB;AAyB5B,MAAM,OAAO;AAWb,MAAM,YAAY;AAWlB,MAAM,QAAQ;AAWd,MAAM,SAAS;AAWT,MAAA,UAAU,CACtB,UACoC;AACpC,SAAO,aAAa,OAAO,KAAK,CAAC,CAAC;AACnC;AASO,MAAM,SAAS;AAWT,MAAA,QAAQ,CACpB,UAC6D;AAC7D,SAAO,aAAa,KAAK,KAAK,CAAC,CAAC,MAAM;AACvC;AASa,MAAA,WAAW,CACvB,UACqC;AAC9B,SAAA,aAAa,KAAK,KAAK,eAAe;AAC9C;AASO,MAAM,oBAAoB;AAapB,MAAA,QAAQ,CACpBA,WAC0C;AAC1C,SAAO,aAAaA,MAAK,KAAK,gBAAgBA,MAAK;AACpD;AASa,MAAA,YAAY,CACxB,WAC0C;AAC1C,SAAO,aAAa,MAAM,KAAK,gBAAgB,MAAM;AACtD;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,172 @@
1
+ import type { ColorField } from "../types/value/color";
2
+ import type { ContentRelationshipField } from "../types/value/contentRelationship";
3
+ import type { DateField } from "../types/value/date";
4
+ import type { AnyOEmbed, EmbedField } from "../types/value/embed";
5
+ import type { GeoPointField } from "../types/value/geoPoint";
6
+ import type { GroupField } from "../types/value/group";
7
+ import type { ImageField, ImageFieldImage } from "../types/value/image";
8
+ import type { IntegrationFields } from "../types/value/integrationFields";
9
+ import type { KeyTextField } from "../types/value/keyText";
10
+ import type { LinkField } from "../types/value/link";
11
+ import type { LinkToMediaField } from "../types/value/linkToMedia";
12
+ import type { NumberField } from "../types/value/number";
13
+ import type { RichTextField } from "../types/value/richText";
14
+ import type { SelectField } from "../types/value/select";
15
+ import type { SharedSlice } from "../types/value/sharedSlice";
16
+ import type { Slice } from "../types/value/slice";
17
+ import type { SliceZone } from "../types/value/sliceZone";
18
+ import type { TimestampField } from "../types/value/timestamp";
19
+ import type { TitleField } from "../types/value/title";
20
+ import type { AnyRegularField } from "../types/value/types";
21
+ /**
22
+ * Determines if a Rich Text field is filled.
23
+ *
24
+ * @param field - Rich Text field to check.
25
+ *
26
+ * @returns `true` if `field` is filled, `false` otherwise.
27
+ */
28
+ export declare const richText: (field: RichTextField | null | undefined) => field is [import("../types/value/richText").RTNode, ...import("../types/value/richText").RTNode[]];
29
+ /**
30
+ * Determines if a Title field is filled.
31
+ *
32
+ * @param field - Title field to check.
33
+ *
34
+ * @returns `true` if `field` is filled, `false` otherwise.
35
+ */
36
+ export declare const title: (field: TitleField | null | undefined) => field is [Omit<import("../types/value/richText").RTHeading1Node | import("../types/value/richText").RTHeading2Node | import("../types/value/richText").RTHeading3Node | import("../types/value/richText").RTHeading4Node | import("../types/value/richText").RTHeading5Node | import("../types/value/richText").RTHeading6Node, "spans"> & {
37
+ spans: [];
38
+ }];
39
+ /**
40
+ * Determines if an Image thumbnail is filled.
41
+ *
42
+ * @param thumbnail - Image thumbnail to check.
43
+ *
44
+ * @returns `true` if `field` is filled, `false` otherwise.
45
+ */
46
+ export declare const imageThumbnail: (thumbnail: ImageFieldImage | null | undefined) => thumbnail is import("../types/value/image").FilledImageFieldImage;
47
+ /**
48
+ * Determines if an Image field is filled.
49
+ *
50
+ * @param field - Image field to check.
51
+ *
52
+ * @returns `true` if `field` is filled, `false` otherwise.
53
+ */
54
+ export declare const image: <ThumbnailNames extends string | null = never>(field: ImageField<ThumbnailNames> | null | undefined) => field is import("../types/value/types").Simplify<import("../types/value/image").FilledImageFieldImage & Record<Extract<ThumbnailNames, string>, import("../types/value/image").FilledImageFieldImage>>;
55
+ /**
56
+ * Determines if a Link field is filled.
57
+ *
58
+ * @param field - Link field to check.
59
+ *
60
+ * @returns `true` if `field` is filled, `false` otherwise.
61
+ */
62
+ export declare const link: <TypeEnum = string, LangEnum = string, DataInterface extends unknown = unknown>(field: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined) => field is import("../types/value/link").FilledLinkToWebField | import("../types/value/linkToMedia").FilledLinkToMediaField | import("../types/value/contentRelationship").FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>;
63
+ /**
64
+ * Determines if a Link to Media field is filled.
65
+ *
66
+ * @param field - Link to Media field to check.
67
+ *
68
+ * @returns `true` if `field` is filled, `false` otherwise.
69
+ */
70
+ export declare const linkToMedia: (field: LinkToMediaField | null | undefined) => field is import("../types/value/linkToMedia").FilledLinkToMediaField;
71
+ /**
72
+ * Determines if a Content Relationship field is filled.
73
+ *
74
+ * @param field - Content Relationship field to check.
75
+ *
76
+ * @returns `true` if `field` is filled, `false` otherwise.
77
+ */
78
+ export declare const contentRelationship: <TypeEnum = string, LangEnum = string, DataInterface extends unknown = unknown>(field: ContentRelationshipField<TypeEnum, LangEnum, DataInterface> | null | undefined) => field is import("../types/value/contentRelationship").FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>;
79
+ /**
80
+ * Determines if a Date field is filled.
81
+ *
82
+ * @param field - Date field to check.
83
+ *
84
+ * @returns `true` if `field` is filled, `false` otherwise.
85
+ */
86
+ export declare const date: (field: DateField | null | undefined) => field is `${number}-${number}-${number}`;
87
+ /**
88
+ * Determines if a Timestamp field is filled.
89
+ *
90
+ * @param field - Timestamp field to check.
91
+ *
92
+ * @returns `true` if `field` is filled, `false` otherwise.
93
+ */
94
+ export declare const timestamp: (field: TimestampField | null | undefined) => field is `${number}-${number}-${number}T${number}:${number}:${number}+${number}`;
95
+ /**
96
+ * Determines if a Color field is filled.
97
+ *
98
+ * @param field - Color field to check.
99
+ *
100
+ * @returns `true` if `field` is filled, `false` otherwise.
101
+ */
102
+ export declare const color: (field: ColorField | null | undefined) => field is `#${string}`;
103
+ /**
104
+ * Determines if a Number field is filled.
105
+ *
106
+ * @param field - Number field to check.
107
+ *
108
+ * @returns `true` if `field` is filled, `false` otherwise.
109
+ */
110
+ export declare const number: (field: NumberField | null | undefined) => field is number;
111
+ /**
112
+ * Determines if a Key Text field is filled.
113
+ *
114
+ * @param field - Key Text field to check.
115
+ *
116
+ * @returns `true` if `field` is filled, `false` otherwise.
117
+ */
118
+ export declare const keyText: (field: KeyTextField | null | undefined) => field is string;
119
+ /**
120
+ * Determines if a Select field is filled.
121
+ *
122
+ * @param field - Select field to check.
123
+ *
124
+ * @returns `true` if `field` is filled, `false` otherwise.
125
+ */
126
+ export declare const select: <Enum extends string>(field: SelectField<Enum> | undefined) => field is Enum;
127
+ /**
128
+ * Determines if an Embed field is filled.
129
+ *
130
+ * @param field - Embed field to check.
131
+ *
132
+ * @returns `true` if `field` is filled, `false` otherwise.
133
+ */
134
+ export declare const embed: <Field extends EmbedField<AnyOEmbed>>(field: Field | null | undefined) => field is Extract<Field, AnyOEmbed & {
135
+ embed_url: string;
136
+ html: string | null;
137
+ }>;
138
+ /**
139
+ * Determines if a GeoPoint field is filled.
140
+ *
141
+ * @param field - GeoPoint field to check.
142
+ *
143
+ * @returns `true` if `field` is filled, `false` otherwise.
144
+ */
145
+ export declare const geoPoint: (field: GeoPointField | null | undefined) => field is {
146
+ latitude: number;
147
+ longitude: number;
148
+ };
149
+ /**
150
+ * Determines if an Integration Fields field is filled.
151
+ *
152
+ * @param field - Integration Fields field to check.
153
+ *
154
+ * @returns `true` if `field` is filled, `false` otherwise.
155
+ */
156
+ export declare const integrationFields: <Data extends Record<string, unknown>>(field: IntegrationFields<Data> | undefined) => field is Data;
157
+ /**
158
+ * Determines if a Group has at least one item.
159
+ *
160
+ * @param group - Group to check.
161
+ *
162
+ * @returns `true` if `group` contains at least one item, `false` otherwise.
163
+ */
164
+ export declare const group: <Fields extends Record<string, AnyRegularField>>(group: GroupField<Fields> | null | undefined) => group is [Fields, ...Fields[]];
165
+ /**
166
+ * Determines if a Slice Zone has at least one Slice.
167
+ *
168
+ * @param slices - Slice Zone to check.
169
+ *
170
+ * @returns `true` if `slices` contains at least one Slice, `false` otherwise.
171
+ */
172
+ export declare const sliceZone: <Slices extends Slice<string, Record<string, AnyRegularField>, Record<string, AnyRegularField>> | SharedSlice>(slices: SliceZone<Slices> | null | undefined) => slices is [Slices, ...Slices[]];
@@ -0,0 +1,67 @@
1
+ const isNonNullish = (input) => {
2
+ return input != null;
3
+ };
4
+ const isNonEmptyArray = (input) => {
5
+ return !!input.length;
6
+ };
7
+ const richText = (field) => {
8
+ if (!isNonNullish(field)) {
9
+ return false;
10
+ } else if (field.length === 1 && "text" in field[0]) {
11
+ return !!field[0].text;
12
+ } else {
13
+ return !!field.length;
14
+ }
15
+ };
16
+ const title = richText;
17
+ const imageThumbnail = (thumbnail) => {
18
+ return isNonNullish(thumbnail) && !!thumbnail.url;
19
+ };
20
+ const image = imageThumbnail;
21
+ const link = (field) => {
22
+ return isNonNullish(field) && ("id" in field || "url" in field);
23
+ };
24
+ const linkToMedia = link;
25
+ const contentRelationship = link;
26
+ const date = isNonNullish;
27
+ const timestamp = isNonNullish;
28
+ const color = isNonNullish;
29
+ const number = isNonNullish;
30
+ const keyText = (field) => {
31
+ return isNonNullish(keyText) && !!field;
32
+ };
33
+ const select = isNonNullish;
34
+ const embed = (field) => {
35
+ return isNonNullish(field) && !!field.embed_url;
36
+ };
37
+ const geoPoint = (field) => {
38
+ return isNonNullish(field) && "longitude" in field;
39
+ };
40
+ const integrationFields = isNonNullish;
41
+ const group = (group2) => {
42
+ return isNonNullish(group2) && isNonEmptyArray(group2);
43
+ };
44
+ const sliceZone = (slices) => {
45
+ return isNonNullish(slices) && isNonEmptyArray(slices);
46
+ };
47
+ export {
48
+ color,
49
+ contentRelationship,
50
+ date,
51
+ embed,
52
+ geoPoint,
53
+ group,
54
+ image,
55
+ imageThumbnail,
56
+ integrationFields,
57
+ keyText,
58
+ link,
59
+ linkToMedia,
60
+ number,
61
+ richText,
62
+ select,
63
+ sliceZone,
64
+ timestamp,
65
+ title
66
+ };
67
+ //# sourceMappingURL=isFilled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isFilled.js","sources":["../../../src/helpers/isFilled.ts"],"sourcesContent":["import type { ColorField } from \"../types/value/color\";\nimport type { ContentRelationshipField } from \"../types/value/contentRelationship\";\nimport type { DateField } from \"../types/value/date\";\nimport type { AnyOEmbed, EmbedField } from \"../types/value/embed\";\nimport type { GeoPointField } from \"../types/value/geoPoint\";\nimport type { GroupField } from \"../types/value/group\";\nimport type { ImageField, ImageFieldImage } from \"../types/value/image\";\nimport type { IntegrationFields } from \"../types/value/integrationFields\";\nimport type { KeyTextField } from \"../types/value/keyText\";\nimport type { LinkField } from \"../types/value/link\";\nimport type { LinkToMediaField } from \"../types/value/linkToMedia\";\nimport type { NumberField } from \"../types/value/number\";\nimport type { RichTextField } from \"../types/value/richText\";\nimport type { SelectField } from \"../types/value/select\";\nimport type { SharedSlice } from \"../types/value/sharedSlice\";\nimport type { Slice } from \"../types/value/slice\";\nimport type { SliceZone } from \"../types/value/sliceZone\";\nimport type { TimestampField } from \"../types/value/timestamp\";\nimport type { TitleField } from \"../types/value/title\";\nimport type { AnyRegularField } from \"../types/value/types\";\n\n/**\n * Determines if a value is not nullish (i.e. not `null` or `undefined`). This\n * is used to check if nullable field values are filled.\n *\n * @param input - The value to check.\n *\n * @returns `true` if `input` is not nullish, `false` otherwise.\n */\nconst isNonNullish = <T>(input: T): input is NonNullable<T> => {\n\treturn input != null;\n};\n\n/**\n * Determines if an array is not empty. This is used to check if array-based\n * fields are filled.\n *\n * @param input - The array to check.\n *\n * @returns `true` if `input` has at least one element, `false` otherwise.\n */\nconst isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {\n\treturn !!input.length;\n};\n\n/**\n * Determines if a Rich Text field is filled.\n *\n * @param field - Rich Text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const richText = (\n\tfield: RichTextField | null | undefined,\n): field is RichTextField<\"filled\"> => {\n\tif (!isNonNullish(field)) {\n\t\treturn false;\n\t} else if (field.length === 1 && \"text\" in field[0]) {\n\t\treturn !!field[0].text;\n\t} else {\n\t\treturn !!field.length;\n\t}\n};\n\n/**\n * Determines if a Title field is filled.\n *\n * @param field - Title field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const title = richText as (\n\tfield: TitleField | null | undefined,\n) => field is TitleField<\"filled\">;\n\n/**\n * Determines if an Image thumbnail is filled.\n *\n * @param thumbnail - Image thumbnail to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const imageThumbnail = (\n\tthumbnail: ImageFieldImage | null | undefined,\n): thumbnail is ImageFieldImage<\"filled\"> => {\n\treturn isNonNullish(thumbnail) && !!thumbnail.url;\n};\n\n/**\n * Determines if an Image field is filled.\n *\n * @param field - Image field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <\n\tThumbnailNames extends string | null = never,\n>(\n\tfield: ImageField<ThumbnailNames> | null | undefined,\n) => field is ImageField<ThumbnailNames, \"filled\">;\n\n/**\n * Determines if a Link field is filled.\n *\n * @param field - Link field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n>(\n\tfield: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined,\n): field is LinkField<TypeEnum, LangEnum, DataInterface, \"filled\"> => {\n\treturn isNonNullish(field) && (\"id\" in field || \"url\" in field);\n};\n\n/**\n * Determines if a Link to Media field is filled.\n *\n * @param field - Link to Media field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const linkToMedia = link as (\n\tfield: LinkToMediaField | null | undefined,\n) => field is LinkToMediaField<\"filled\">;\n\n/**\n * Determines if a Content Relationship field is filled.\n *\n * @param field - Content Relationship field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n>(\n\tfield:\n\t\t| ContentRelationshipField<TypeEnum, LangEnum, DataInterface>\n\t\t| null\n\t\t| undefined,\n) => field is ContentRelationshipField<\n\tTypeEnum,\n\tLangEnum,\n\tDataInterface,\n\t\"filled\"\n>;\n\n/**\n * Determines if a Date field is filled.\n *\n * @param field - Date field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const date = isNonNullish as (\n\tfield: DateField | null | undefined,\n) => field is DateField<\"filled\">;\n\n/**\n * Determines if a Timestamp field is filled.\n *\n * @param field - Timestamp field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const timestamp = isNonNullish as (\n\tfield: TimestampField | null | undefined,\n) => field is TimestampField<\"filled\">;\n\n/**\n * Determines if a Color field is filled.\n *\n * @param field - Color field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const color = isNonNullish as (\n\tfield: ColorField | null | undefined,\n) => field is ColorField<\"filled\">;\n\n/**\n * Determines if a Number field is filled.\n *\n * @param field - Number field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const number = isNonNullish as (\n\tfield: NumberField | null | undefined,\n) => field is NumberField<\"filled\">;\n\n/**\n * Determines if a Key Text field is filled.\n *\n * @param field - Key Text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn isNonNullish(keyText) && !!field;\n};\n\n/**\n * Determines if a Select field is filled.\n *\n * @param field - Select field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const select = isNonNullish as <Enum extends string>(\n\tfield: SelectField<Enum> | null | undefined,\n) => field is SelectField<Enum, \"filled\">;\n\n/**\n * Determines if an Embed field is filled.\n *\n * @param field - Embed field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const embed = <Field extends EmbedField<AnyOEmbed>>(\n\tfield: Field | null | undefined,\n): field is Extract<Field, EmbedField<AnyOEmbed, \"filled\">> => {\n\treturn isNonNullish(field) && !!field.embed_url;\n};\n\n/**\n * Determines if a GeoPoint field is filled.\n *\n * @param field - GeoPoint field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const geoPoint = (\n\tfield: GeoPointField | null | undefined,\n): field is GeoPointField<\"filled\"> => {\n\treturn isNonNullish(field) && \"longitude\" in field;\n};\n\n/**\n * Determines if an Integration Fields field is filled.\n *\n * @param field - Integration Fields field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const integrationFields = isNonNullish as <\n\tData extends Record<string, unknown>,\n>(\n\tfield: IntegrationFields<Data> | null | undefined,\n) => field is IntegrationFields<Data, \"filled\">;\n\n/**\n * Determines if a Group has at least one item.\n *\n * @param group - Group to check.\n *\n * @returns `true` if `group` contains at least one item, `false` otherwise.\n */\nexport const group = <Fields extends Record<string, AnyRegularField>>(\n\tgroup: GroupField<Fields> | null | undefined,\n): group is GroupField<Fields, \"filled\"> => {\n\treturn isNonNullish(group) && isNonEmptyArray(group);\n};\n\n/**\n * Determines if a Slice Zone has at least one Slice.\n *\n * @param slices - Slice Zone to check.\n *\n * @returns `true` if `slices` contains at least one Slice, `false` otherwise.\n */\nexport const sliceZone = <Slices extends Slice | SharedSlice>(\n\tslices: SliceZone<Slices> | null | undefined,\n): slices is SliceZone<Slices, \"filled\"> => {\n\treturn isNonNullish(slices) && isNonEmptyArray(slices);\n};\n"],"names":["group"],"mappings":"AA6BA,MAAM,eAAe,CAAI,UAAqC;AAC7D,SAAO,SAAS;AACjB;AAUA,MAAM,kBAAkB,CAAI,UAAoC;AACxD,SAAA,CAAC,CAAC,MAAM;AAChB;AASa,MAAA,WAAW,CACvB,UACqC;AACjC,MAAA,CAAC,aAAa,KAAK,GAAG;AAClB,WAAA;AAAA,EAAA,WACG,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACpD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EAAA,OACZ;AACC,WAAA,CAAC,CAAC,MAAM;AAAA,EACf;AACF;AASO,MAAM,QAAQ;AAWR,MAAA,iBAAiB,CAC7B,cAC2C;AAC3C,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAC/C;AASO,MAAM,QAAQ;AAaR,MAAA,OAAO,CAOnB,UACoE;AACpE,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC1D;AASO,MAAM,cAAc;AAWpB,MAAM,sBAAsB;AAyB5B,MAAM,OAAO;AAWb,MAAM,YAAY;AAWlB,MAAM,QAAQ;AAWd,MAAM,SAAS;AAWT,MAAA,UAAU,CACtB,UACoC;AACpC,SAAO,aAAa,OAAO,KAAK,CAAC,CAAC;AACnC;AASO,MAAM,SAAS;AAWT,MAAA,QAAQ,CACpB,UAC6D;AAC7D,SAAO,aAAa,KAAK,KAAK,CAAC,CAAC,MAAM;AACvC;AASa,MAAA,WAAW,CACvB,UACqC;AAC9B,SAAA,aAAa,KAAK,KAAK,eAAe;AAC9C;AASO,MAAM,oBAAoB;AAapB,MAAA,QAAQ,CACpBA,WAC0C;AAC1C,SAAO,aAAaA,MAAK,KAAK,gBAAgBA,MAAK;AACpD;AASa,MAAA,YAAY,CACxB,WAC0C;AAC1C,SAAO,aAAa,MAAM,KAAK,gBAAgB,MAAM;AACtD;"}
package/dist/index.cjs CHANGED
@@ -1,36 +1,75 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const filter = require("./filter.cjs");
4
+ const createClient = require("./createClient.cjs");
3
5
  const getRepositoryEndpoint = require("./getRepositoryEndpoint.cjs");
4
6
  const getRepositoryName = require("./getRepositoryName.cjs");
5
7
  const getGraphQLEndpoint = require("./getGraphQLEndpoint.cjs");
6
8
  const isRepositoryName = require("./isRepositoryName.cjs");
7
9
  const isRepositoryEndpoint = require("./isRepositoryEndpoint.cjs");
8
10
  const buildQueryURL = require("./buildQueryURL.cjs");
9
- const client = require("./client.cjs");
10
- const predicate = require("./predicate.cjs");
11
- const PrismicError = require("./PrismicError.cjs");
12
- const ForbiddenError = require("./ForbiddenError.cjs");
13
- const ParsingError = require("./ParsingError.cjs");
14
- const NotFoundError = require("./NotFoundError.cjs");
11
+ const getToolbarSrc = require("./getToolbarSrc.cjs");
15
12
  const cookie = require("./cookie.cjs");
16
- const getEndpoint = getRepositoryEndpoint.getRepositoryEndpoint;
17
- const predicates = predicate.predicate;
18
- const Predicates = predicate.predicate;
13
+ const asDate = require("./helpers/asDate.cjs");
14
+ const asLink = require("./helpers/asLink.cjs");
15
+ const asLinkAttrs = require("./helpers/asLinkAttrs.cjs");
16
+ const asText = require("./helpers/asText.cjs");
17
+ const asHTML = require("./helpers/asHTML.cjs");
18
+ const asImageSrc = require("./helpers/asImageSrc.cjs");
19
+ const asImageWidthSrcSet = require("./helpers/asImageWidthSrcSet.cjs");
20
+ const asImagePixelDensitySrcSet = require("./helpers/asImagePixelDensitySrcSet.cjs");
21
+ const isFilled = require("./helpers/isFilled.cjs");
22
+ const documentToLinkField = require("./helpers/documentToLinkField.cjs");
23
+ const richtext = require("@prismicio/richtext");
24
+ const PrismicError = require("./errors/PrismicError.cjs");
25
+ const ForbiddenError = require("./errors/ForbiddenError.cjs");
26
+ const NotFoundError = require("./errors/NotFoundError.cjs");
27
+ const ParsingError = require("./errors/ParsingError.cjs");
28
+ const richText = require("./types/value/richText.cjs");
29
+ const link = require("./types/value/link.cjs");
30
+ const embed = require("./types/value/embed.cjs");
31
+ const types = require("./types/model/types.cjs");
32
+ const link$1 = require("./types/model/link.cjs");
33
+ const sliceZone = require("./types/model/sliceZone.cjs");
34
+ const slice = require("./types/model/slice.cjs");
35
+ const types$1 = require("./types/webhook/types.cjs");
36
+ const predicate = filter.filter;
37
+ exports.filter = filter.filter;
38
+ exports.Client = createClient.Client;
39
+ exports.createClient = createClient.createClient;
19
40
  exports.getRepositoryEndpoint = getRepositoryEndpoint.getRepositoryEndpoint;
20
41
  exports.getRepositoryName = getRepositoryName.getRepositoryName;
21
42
  exports.getGraphQLEndpoint = getGraphQLEndpoint.getGraphQLEndpoint;
22
43
  exports.isRepositoryName = isRepositoryName.isRepositoryName;
23
44
  exports.isRepositoryEndpoint = isRepositoryEndpoint.isRepositoryEndpoint;
24
45
  exports.buildQueryURL = buildQueryURL.buildQueryURL;
25
- exports.Client = client.Client;
26
- exports.createClient = client.createClient;
27
- exports.predicate = predicate.predicate;
46
+ exports.getToolbarSrc = getToolbarSrc.getToolbarSrc;
47
+ exports.cookie = cookie;
48
+ exports.asDate = asDate.asDate;
49
+ exports.asLink = asLink.asLink;
50
+ exports.asLinkAttrs = asLinkAttrs.asLinkAttrs;
51
+ exports.asText = asText.asText;
52
+ exports.asHTML = asHTML.asHTML;
53
+ exports.asImageSrc = asImageSrc.asImageSrc;
54
+ exports.asImageWidthSrcSet = asImageWidthSrcSet.asImageWidthSrcSet;
55
+ exports.asImagePixelDensitySrcSet = asImagePixelDensitySrcSet.asImagePixelDensitySrcSet;
56
+ exports.isFilled = isFilled;
57
+ exports.documentToLinkField = documentToLinkField.documentToLinkField;
58
+ Object.defineProperty(exports, "Element", {
59
+ enumerable: true,
60
+ get: () => richtext.Element
61
+ });
28
62
  exports.PrismicError = PrismicError.PrismicError;
29
63
  exports.ForbiddenError = ForbiddenError.ForbiddenError;
30
- exports.ParsingError = ParsingError.ParsingError;
31
64
  exports.NotFoundError = NotFoundError.NotFoundError;
32
- exports.cookie = cookie;
33
- exports.Predicates = Predicates;
34
- exports.getEndpoint = getEndpoint;
35
- exports.predicates = predicates;
65
+ exports.ParsingError = ParsingError.ParsingError;
66
+ exports.RichTextNodeType = richText.RichTextNodeType;
67
+ exports.LinkType = link.LinkType;
68
+ exports.OEmbedType = embed.OEmbedType;
69
+ exports.CustomTypeModelFieldType = types.CustomTypeModelFieldType;
70
+ exports.CustomTypeModelLinkSelectType = link$1.CustomTypeModelLinkSelectType;
71
+ exports.CustomTypeModelSliceType = sliceZone.CustomTypeModelSliceType;
72
+ exports.CustomTypeModelSliceDisplay = slice.CustomTypeModelSliceDisplay;
73
+ exports.WebhookType = types$1.WebhookType;
74
+ exports.predicate = predicate;
36
75
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["// Primary library API.\nimport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryEndpoint };\n/**\n * @deprecated Renamed to `getRepositoryEndpoint`.\n */\n// TODO: Remove in v3.\nexport const getEndpoint = getRepositoryEndpoint;\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\nexport { createClient, Client } from \"./client\";\n\n// Predicates API.\nimport { predicate } from \"./predicate\";\nexport { predicate };\n/**\n * @deprecated Renamed to `predicate` (without an \"s\").\n */\n// TODO: Remove in v3.\nexport const predicates = predicate;\n/**\n * @deprecated Renamed to `predicate` (lowercase and without an \"s\").\n */\n// TODO: Remove in v3.\nexport const Predicates = predicate;\n\n// Custom errors used by Client.\nexport { PrismicError } from \"./PrismicError\";\nexport { ForbiddenError } from \"./ForbiddenError\";\nexport { ParsingError } from \"./ParsingError\";\nexport { NotFoundError } from \"./NotFoundError\";\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used throughout the project. These are made public to allow users to better type their projects.\nexport type { CreateClient, ClientConfig } from \"./client\";\nexport type { QueryParams, BuildQueryURLArgs } from \"./buildQueryURL\";\nexport type {\n\tAbortSignalLike,\n\tFetchLike,\n\tHttpRequestLike,\n\tOrdering,\n\tRequestInitLike,\n\tResponseLike,\n\tRoute,\n} from \"./types\";\n"],"names":["getRepositoryEndpoint","predicate"],"mappings":";;;;;;;;;;;;;;;AAOO,MAAM,cAAcA,sBAAA;AAepB,MAAM,aAAaC,UAAA;AAKnB,MAAM,aAAaA,UAAAA;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["// Use for deprecations.\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\nexport type { IntegrationFields } from \"./types/value/integrationFields\";\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\nexport type { CustomTypeModelIntegrationFieldsField } from \"./types/model/integrationFields\";\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":["filter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,YAAYA,OAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}