@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,209 @@
1
+ export declare const filter: {
2
+ /**
3
+ * The `at` filter checks that the path matches the described value
4
+ * exactly. It takes a single value for a field or an array (only for tags).
5
+ *
6
+ * {@link https://prismic.io/docs/rest-api-technical-reference#at}
7
+ */
8
+ at: (path: string, value: string | number | boolean | string[] | Date) => string;
9
+ /**
10
+ * The `not` filter checks that the path doesn't match the provided value
11
+ * exactly. It takes a single value for a field or an array (only for tags).
12
+ *
13
+ * {@link https://prismic.io/docs/rest-api-technical-reference#not}
14
+ */
15
+ not: (path: string, value: string | number | boolean | string[] | Date) => string;
16
+ /**
17
+ * The `any` filter takes an array of values. It works exactly the same way
18
+ * as the `at` operator, but checks whether the fragment matches any of the
19
+ * values in the array.
20
+ *
21
+ * {@link https://prismic.io/docs/rest-api-technical-reference#any}
22
+ */
23
+ any: (path: string, values: (string | number | boolean | Date)[]) => string;
24
+ /**
25
+ * The `in` filter is used specifically to retrieve an array of documents
26
+ * by their IDs or UIDs. This filter is much more efficient at this than
27
+ * the any filter.
28
+ *
29
+ * {@link https://prismic.io/docs/rest-api-technical-reference#in}
30
+ */
31
+ in: (path: string, values: string[]) => string;
32
+ /**
33
+ * The `fulltext` filter provides two capabilities:
34
+ *
35
+ * 1. Checking if a certain string is anywhere inside a document (this is what
36
+ * you should use to make your project's search engine feature)
37
+ * 2. Checking if the string is contained inside a specific custom type’s Rich
38
+ * Text or Key Text fragment.
39
+ *
40
+ * {@link https://prismic.io/docs/rest-api-technical-reference#fulltext}
41
+ */
42
+ fulltext: (path: string, searchTerms: string) => string;
43
+ /**
44
+ * The `has` filter checks whether a fragment has a value. It will return
45
+ * all the documents of the specified type that contain a value for the
46
+ * specified field.
47
+ *
48
+ * {@link https://prismic.io/docs/rest-api-technical-reference#has}
49
+ */
50
+ has: (path: string) => string;
51
+ /**
52
+ * The `missing` filter checks if a fragment doesn't have a value. It will
53
+ * return all the documents of the specified type that do not contain a value
54
+ * for the specified field.
55
+ *
56
+ * {@link https://prismic.io/docs/rest-api-technical-reference#missing}
57
+ */
58
+ missing: (path: string) => string;
59
+ /**
60
+ * The `similar` filter takes the ID of a document, and returns a list of
61
+ * documents with similar content. This allows you to build an automated
62
+ * content discovery feature (for example, a "Related posts" section).
63
+ *
64
+ * {@link https://prismic.io/docs/rest-api-technical-reference#similar}
65
+ */
66
+ similar: (id: string, value: number) => string;
67
+ /**
68
+ * The `geopoint.near` filter checks that the value in the path is within
69
+ * the radius of the given coordinates.
70
+ *
71
+ * This filter will only work for a GeoPoint field.
72
+ *
73
+ * {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
74
+ */
75
+ geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
76
+ /**
77
+ * The `number.lt` filter checks that the value in the number field is less
78
+ * than the value passed into the filter.
79
+ *
80
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numberlessthan}
81
+ */
82
+ numberLessThan: (path: string, value: number) => string;
83
+ /**
84
+ * The `number.gt` filter checks that the value in the number field is
85
+ * greater than the value passed into the filter.
86
+ *
87
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}
88
+ */
89
+ numberGreaterThan: (path: string, value: number) => string;
90
+ /**
91
+ * The `number.inRange` filter checks that the value in the path is within
92
+ * the two values passed into the filter.
93
+ *
94
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}
95
+ */
96
+ numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
97
+ /**
98
+ * The `date.after` filter checks that the value in the path is after the
99
+ * date value passed into the filter.
100
+ *
101
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
102
+ */
103
+ dateAfter: (path: string, date: string | number | Date) => string;
104
+ /**
105
+ * The `date.before` filter checks that the value in the path is before the
106
+ * date value passed into the filter.
107
+ *
108
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
109
+ */
110
+ dateBefore: (path: string, date: string | number | Date) => string;
111
+ /**
112
+ * The `date.between` filter checks that the value in the path is within
113
+ * the date values passed into the filter.
114
+ *
115
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
116
+ */
117
+ dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
118
+ /**
119
+ * The `date.day-of-month` filter checks that the value in the path is
120
+ * equal to the day of the month passed into the filter.
121
+ *
122
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
123
+ */
124
+ dateDayOfMonth: (path: string, day: number) => string;
125
+ /**
126
+ * The `date.day-of-month-after` filter checks that the value in the path
127
+ * is after the day of the month passed into the filter.
128
+ *
129
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
130
+ */
131
+ dateDayOfMonthAfter: (path: string, day: number) => string;
132
+ /**
133
+ * The `date.day-of-month-before` filter checks that the value in the path
134
+ * is before the day of the month passed into the filter.
135
+ *
136
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
137
+ */
138
+ dateDayOfMonthBefore: (path: string, day: number) => string;
139
+ /**
140
+ * The `date.day-of-week` filter checks that the value in the path is equal
141
+ * to the day of the week passed into the filter.
142
+ *
143
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
144
+ */
145
+ dateDayOfWeek: (path: string, day: string | number) => string;
146
+ /**
147
+ * The `date.day-of-week-after` filter checks that the value in the path is
148
+ * after the day of the week passed into the filter.
149
+ *
150
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
151
+ */
152
+ dateDayOfWeekAfter: (path: string, day: string | number) => string;
153
+ /**
154
+ * The date.day-of-week-before filter checks that the value in the path is
155
+ * before the day of the week passed into the filter.
156
+ *
157
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
158
+ */
159
+ dateDayOfWeekBefore: (path: string, day: string | number) => string;
160
+ /**
161
+ * The `date.month` filter checks that the value in the path occurs in the
162
+ * month value passed into the filter.
163
+ *
164
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
165
+ */
166
+ dateMonth: (path: string, month: string | number) => string;
167
+ /**
168
+ * The `date.month-after` filter checks that the value in the path occurs
169
+ * in any month after the value passed into the filter.
170
+ *
171
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
172
+ */
173
+ dateMonthAfter: (path: string, month: string | number) => string;
174
+ /**
175
+ * The `date.month-before` filter checks that the value in the path occurs
176
+ * in any month before the value passed into the filter.
177
+ *
178
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
179
+ */
180
+ dateMonthBefore: (path: string, month: string | number) => string;
181
+ /**
182
+ * The `date.year` filter checks that the value in the path occurs in the
183
+ * year value passed into the filter.
184
+ *
185
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
186
+ */
187
+ dateYear: (path: string, year: number) => string;
188
+ /**
189
+ * The `date.hour` filter checks that the value in the path occurs within
190
+ * the hour value passed into the filter.
191
+ *
192
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
193
+ */
194
+ dateHour: (path: string, hour: number) => string;
195
+ /**
196
+ * The `date.hour-after` filter checks that the value in the path occurs
197
+ * after the hour value passed into the filter.
198
+ *
199
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
200
+ */
201
+ dateHourAfter: (path: string, hour: number) => string;
202
+ /**
203
+ * The `date.hour-before` filter checks that the value in the path occurs
204
+ * before the hour value passed into the filter.
205
+ *
206
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
207
+ */
208
+ dateHourBefore: (path: string, hour: number) => string;
209
+ };
package/dist/filter.js ADDED
@@ -0,0 +1,247 @@
1
+ const formatValue = (value) => {
2
+ if (Array.isArray(value)) {
3
+ return `[${value.map(formatValue).join(", ")}]`;
4
+ }
5
+ if (typeof value === "string") {
6
+ return `"${value}"`;
7
+ }
8
+ if (value instanceof Date) {
9
+ return `${value.getTime()}`;
10
+ }
11
+ return `${value}`;
12
+ };
13
+ const pathWithArgsFilter = (name) => {
14
+ const fn = (path, ...args) => {
15
+ const formattedArgs = args.map(formatValue).join(", ");
16
+ const joiner = path && args.length ? ", " : "";
17
+ return `[${name}(${path}${joiner}${formattedArgs})]`;
18
+ };
19
+ return fn;
20
+ };
21
+ const pathFilter = (name) => {
22
+ const filterFn = pathWithArgsFilter(name);
23
+ const fn = (path) => {
24
+ return filterFn(path);
25
+ };
26
+ return fn;
27
+ };
28
+ const argsFilter = (name) => {
29
+ const filterFn = pathWithArgsFilter(name);
30
+ const fn = (...args) => {
31
+ return filterFn("", ...args);
32
+ };
33
+ return fn;
34
+ };
35
+ const filter = {
36
+ /**
37
+ * The `at` filter checks that the path matches the described value
38
+ * exactly. It takes a single value for a field or an array (only for tags).
39
+ *
40
+ * {@link https://prismic.io/docs/rest-api-technical-reference#at}
41
+ */
42
+ at: pathWithArgsFilter("at"),
43
+ /**
44
+ * The `not` filter checks that the path doesn't match the provided value
45
+ * exactly. It takes a single value for a field or an array (only for tags).
46
+ *
47
+ * {@link https://prismic.io/docs/rest-api-technical-reference#not}
48
+ */
49
+ not: pathWithArgsFilter("not"),
50
+ /**
51
+ * The `any` filter takes an array of values. It works exactly the same way
52
+ * as the `at` operator, but checks whether the fragment matches any of the
53
+ * values in the array.
54
+ *
55
+ * {@link https://prismic.io/docs/rest-api-technical-reference#any}
56
+ */
57
+ any: pathWithArgsFilter("any"),
58
+ /**
59
+ * The `in` filter is used specifically to retrieve an array of documents
60
+ * by their IDs or UIDs. This filter is much more efficient at this than
61
+ * the any filter.
62
+ *
63
+ * {@link https://prismic.io/docs/rest-api-technical-reference#in}
64
+ */
65
+ in: pathWithArgsFilter("in"),
66
+ /**
67
+ * The `fulltext` filter provides two capabilities:
68
+ *
69
+ * 1. Checking if a certain string is anywhere inside a document (this is what
70
+ * you should use to make your project's search engine feature)
71
+ * 2. Checking if the string is contained inside a specific custom type’s Rich
72
+ * Text or Key Text fragment.
73
+ *
74
+ * {@link https://prismic.io/docs/rest-api-technical-reference#fulltext}
75
+ */
76
+ fulltext: pathWithArgsFilter("fulltext"),
77
+ /**
78
+ * The `has` filter checks whether a fragment has a value. It will return
79
+ * all the documents of the specified type that contain a value for the
80
+ * specified field.
81
+ *
82
+ * {@link https://prismic.io/docs/rest-api-technical-reference#has}
83
+ */
84
+ has: pathFilter("has"),
85
+ /**
86
+ * The `missing` filter checks if a fragment doesn't have a value. It will
87
+ * return all the documents of the specified type that do not contain a value
88
+ * for the specified field.
89
+ *
90
+ * {@link https://prismic.io/docs/rest-api-technical-reference#missing}
91
+ */
92
+ missing: pathFilter("missing"),
93
+ /**
94
+ * The `similar` filter takes the ID of a document, and returns a list of
95
+ * documents with similar content. This allows you to build an automated
96
+ * content discovery feature (for example, a "Related posts" section).
97
+ *
98
+ * {@link https://prismic.io/docs/rest-api-technical-reference#similar}
99
+ */
100
+ similar: argsFilter("similar"),
101
+ /**
102
+ * The `geopoint.near` filter checks that the value in the path is within
103
+ * the radius of the given coordinates.
104
+ *
105
+ * This filter will only work for a GeoPoint field.
106
+ *
107
+ * {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
108
+ */
109
+ geopointNear: pathWithArgsFilter("geopoint.near"),
110
+ /**
111
+ * The `number.lt` filter checks that the value in the number field is less
112
+ * than the value passed into the filter.
113
+ *
114
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numberlessthan}
115
+ */
116
+ numberLessThan: pathWithArgsFilter("number.lt"),
117
+ /**
118
+ * The `number.gt` filter checks that the value in the number field is
119
+ * greater than the value passed into the filter.
120
+ *
121
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}
122
+ */
123
+ numberGreaterThan: pathWithArgsFilter("number.gt"),
124
+ /**
125
+ * The `number.inRange` filter checks that the value in the path is within
126
+ * the two values passed into the filter.
127
+ *
128
+ * {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}
129
+ */
130
+ numberInRange: pathWithArgsFilter("number.inRange"),
131
+ /**
132
+ * The `date.after` filter checks that the value in the path is after the
133
+ * date value passed into the filter.
134
+ *
135
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
136
+ */
137
+ dateAfter: pathWithArgsFilter("date.after"),
138
+ /**
139
+ * The `date.before` filter checks that the value in the path is before the
140
+ * date value passed into the filter.
141
+ *
142
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
143
+ */
144
+ dateBefore: pathWithArgsFilter("date.before"),
145
+ /**
146
+ * The `date.between` filter checks that the value in the path is within
147
+ * the date values passed into the filter.
148
+ *
149
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
150
+ */
151
+ dateBetween: pathWithArgsFilter("date.between"),
152
+ /**
153
+ * The `date.day-of-month` filter checks that the value in the path is
154
+ * equal to the day of the month passed into the filter.
155
+ *
156
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
157
+ */
158
+ dateDayOfMonth: pathWithArgsFilter("date.day-of-month"),
159
+ /**
160
+ * The `date.day-of-month-after` filter checks that the value in the path
161
+ * is after the day of the month passed into the filter.
162
+ *
163
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
164
+ */
165
+ dateDayOfMonthAfter: pathWithArgsFilter("date.day-of-month-after"),
166
+ /**
167
+ * The `date.day-of-month-before` filter checks that the value in the path
168
+ * is before the day of the month passed into the filter.
169
+ *
170
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
171
+ */
172
+ dateDayOfMonthBefore: pathWithArgsFilter("date.day-of-month-before"),
173
+ /**
174
+ * The `date.day-of-week` filter checks that the value in the path is equal
175
+ * to the day of the week passed into the filter.
176
+ *
177
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
178
+ */
179
+ dateDayOfWeek: pathWithArgsFilter("date.day-of-week"),
180
+ /**
181
+ * The `date.day-of-week-after` filter checks that the value in the path is
182
+ * after the day of the week passed into the filter.
183
+ *
184
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
185
+ */
186
+ dateDayOfWeekAfter: pathWithArgsFilter("date.day-of-week-after"),
187
+ /**
188
+ * The date.day-of-week-before filter checks that the value in the path is
189
+ * before the day of the week passed into the filter.
190
+ *
191
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
192
+ */
193
+ dateDayOfWeekBefore: pathWithArgsFilter("date.day-of-week-before"),
194
+ /**
195
+ * The `date.month` filter checks that the value in the path occurs in the
196
+ * month value passed into the filter.
197
+ *
198
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
199
+ */
200
+ dateMonth: pathWithArgsFilter("date.month"),
201
+ /**
202
+ * The `date.month-after` filter checks that the value in the path occurs
203
+ * in any month after the value passed into the filter.
204
+ *
205
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
206
+ */
207
+ dateMonthAfter: pathWithArgsFilter("date.month-after"),
208
+ /**
209
+ * The `date.month-before` filter checks that the value in the path occurs
210
+ * in any month before the value passed into the filter.
211
+ *
212
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
213
+ */
214
+ dateMonthBefore: pathWithArgsFilter("date.month-before"),
215
+ /**
216
+ * The `date.year` filter checks that the value in the path occurs in the
217
+ * year value passed into the filter.
218
+ *
219
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
220
+ */
221
+ dateYear: pathWithArgsFilter("date.year"),
222
+ /**
223
+ * The `date.hour` filter checks that the value in the path occurs within
224
+ * the hour value passed into the filter.
225
+ *
226
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
227
+ */
228
+ dateHour: pathWithArgsFilter("date.hour"),
229
+ /**
230
+ * The `date.hour-after` filter checks that the value in the path occurs
231
+ * after the hour value passed into the filter.
232
+ *
233
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
234
+ */
235
+ dateHourAfter: pathWithArgsFilter("date.hour-after"),
236
+ /**
237
+ * The `date.hour-before` filter checks that the value in the path occurs
238
+ * before the hour value passed into the filter.
239
+ *
240
+ * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
241
+ */
242
+ dateHourBefore: pathWithArgsFilter("date.hour-before")
243
+ };
244
+ export {
245
+ filter
246
+ };
247
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sources":["../../src/filter.ts"],"sourcesContent":["/**\n * Formats the value of a filter element to a stringified version accepted by\n * the Prismic REST API.\n *\n * @param value - Value to format.\n *\n * @returns `value` formatted for the Prismic REST API.\n */\nconst formatValue = (\n\tvalue:\n\t\t| string\n\t\t| number\n\t\t| Date\n\t\t| unknown\n\t\t| (string | number | Date | unknown)[],\n): string => {\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map(formatValue).join(\", \")}]`;\n\t}\n\n\tif (typeof value === \"string\") {\n\t\treturn `\"${value}\"`;\n\t}\n\n\tif (value instanceof Date) {\n\t\treturn `${value.getTime()}`;\n\t}\n\n\treturn `${value}`;\n};\n\n/**\n * Creates a filter builder function for filters with a path and\n * arguments.\n *\n * @typeParam Args - Arguments for the filter.\n * @param name - Name of the filter used in the resulting string.\n *\n * @returns Filter builder function for the given name.\n */\nconst pathWithArgsFilter = <Args extends unknown[]>(name: string) => {\n\t/**\n\t * @param path - Path to the value to be compared.\n\t */\n\tconst fn = (path: string, ...args: Args): string => {\n\t\tconst formattedArgs = args.map(formatValue).join(\", \");\n\t\tconst joiner = path && args.length ? \", \" : \"\";\n\n\t\treturn `[${name}(${path}${joiner}${formattedArgs})]`;\n\t};\n\n\treturn fn;\n};\n\n/**\n * Creates a filter builder function for filters with only a path.\n *\n * @param name - Name of the filter used in the resulting string.\n *\n * @returns Filter builder function for the given name.\n */\nconst pathFilter = (name: string) => {\n\tconst filterFn = pathWithArgsFilter(name);\n\n\t/**\n\t * @param path - Path for the filter.\n\t */\n\tconst fn = (path: string): string => {\n\t\treturn filterFn(path);\n\t};\n\n\treturn fn;\n};\n\n/**\n * Creates a filter builder function for filters with only arguments and\n * no path.\n *\n * @param name - Name of the filter used in the resulting string.\n *\n * @returns Filter builder function for the given name.\n */\nconst argsFilter = <Args extends unknown[]>(name: string) => {\n\tconst filterFn = pathWithArgsFilter<Args>(name);\n\n\t/**\n\t * @param args - Arguments for the filter.\n\t */\n\tconst fn = (...args: Args): string => {\n\t\treturn filterFn(\"\", ...args);\n\t};\n\n\treturn fn;\n};\n\nexport const filter = {\n\t/**\n\t * The `at` filter checks that the path matches the described value\n\t * exactly. It takes a single value for a field or an array (only for tags).\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#at}\n\t */\n\tat: pathWithArgsFilter<[value: string | number | boolean | Date | string[]]>(\n\t\t\"at\",\n\t),\n\n\t/**\n\t * The `not` filter checks that the path doesn't match the provided value\n\t * exactly. It takes a single value for a field or an array (only for tags).\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#not}\n\t */\n\tnot: pathWithArgsFilter<[value: string | number | boolean | Date | string[]]>(\n\t\t\"not\",\n\t),\n\n\t/**\n\t * The `any` filter takes an array of values. It works exactly the same way\n\t * as the `at` operator, but checks whether the fragment matches any of the\n\t * values in the array.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#any}\n\t */\n\tany: pathWithArgsFilter<[values: (string | number | boolean | Date)[]]>(\n\t\t\"any\",\n\t),\n\n\t/**\n\t * The `in` filter is used specifically to retrieve an array of documents\n\t * by their IDs or UIDs. This filter is much more efficient at this than\n\t * the any filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#in}\n\t */\n\tin: pathWithArgsFilter<[values: string[]]>(\"in\"),\n\n\t/**\n\t * The `fulltext` filter provides two capabilities:\n\t *\n\t * 1. Checking if a certain string is anywhere inside a document (this is what\n\t * you should use to make your project's search engine feature)\n\t * 2. Checking if the string is contained inside a specific custom type’s Rich\n\t * Text or Key Text fragment.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#fulltext}\n\t */\n\tfulltext: pathWithArgsFilter<[searchTerms: string]>(\"fulltext\"),\n\n\t/**\n\t * The `has` filter checks whether a fragment has a value. It will return\n\t * all the documents of the specified type that contain a value for the\n\t * specified field.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#has}\n\t */\n\thas: pathFilter(\"has\"),\n\n\t/**\n\t * The `missing` filter checks if a fragment doesn't have a value. It will\n\t * return all the documents of the specified type that do not contain a value\n\t * for the specified field.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#missing}\n\t */\n\tmissing: pathFilter(\"missing\"),\n\n\t/**\n\t * The `similar` filter takes the ID of a document, and returns a list of\n\t * documents with similar content. This allows you to build an automated\n\t * content discovery feature (for example, a \"Related posts\" section).\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#similar}\n\t */\n\tsimilar: argsFilter<[id: string, value: number]>(\"similar\"),\n\n\t/**\n\t * The `geopoint.near` filter checks that the value in the path is within\n\t * the radius of the given coordinates.\n\t *\n\t * This filter will only work for a GeoPoint field.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}\n\t */\n\tgeopointNear:\n\t\tpathWithArgsFilter<[latitude: number, longitude: number, radius: number]>(\n\t\t\t\"geopoint.near\",\n\t\t),\n\n\t/**\n\t * The `number.lt` filter checks that the value in the number field is less\n\t * than the value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#numberlessthan}\n\t */\n\tnumberLessThan: pathWithArgsFilter<[value: number]>(\"number.lt\"),\n\n\t/**\n\t * The `number.gt` filter checks that the value in the number field is\n\t * greater than the value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}\n\t */\n\tnumberGreaterThan: pathWithArgsFilter<[value: number]>(\"number.gt\"),\n\n\t/**\n\t * The `number.inRange` filter checks that the value in the path is within\n\t * the two values passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}\n\t */\n\tnumberInRange:\n\t\tpathWithArgsFilter<[lowerLimit: number, upperLimit: number]>(\n\t\t\t\"number.inRange\",\n\t\t),\n\n\t/**\n\t * The `date.after` filter checks that the value in the path is after the\n\t * date value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateAfter: pathWithArgsFilter<[date: string | number | Date]>(\"date.after\"),\n\n\t/**\n\t * The `date.before` filter checks that the value in the path is before the\n\t * date value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateBefore: pathWithArgsFilter<[date: string | number | Date]>(\"date.before\"),\n\n\t/**\n\t * The `date.between` filter checks that the value in the path is within\n\t * the date values passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateBetween:\n\t\tpathWithArgsFilter<\n\t\t\t[startDate: string | number | Date, endDate: string | number | Date]\n\t\t>(\"date.between\"),\n\n\t/**\n\t * The `date.day-of-month` filter checks that the value in the path is\n\t * equal to the day of the month passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfMonth: pathWithArgsFilter<[day: number]>(\"date.day-of-month\"),\n\n\t/**\n\t * The `date.day-of-month-after` filter checks that the value in the path\n\t * is after the day of the month passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfMonthAfter: pathWithArgsFilter<[day: number]>(\n\t\t\"date.day-of-month-after\",\n\t),\n\n\t/**\n\t * The `date.day-of-month-before` filter checks that the value in the path\n\t * is before the day of the month passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfMonthBefore: pathWithArgsFilter<[day: number]>(\n\t\t\"date.day-of-month-before\",\n\t),\n\n\t/**\n\t * The `date.day-of-week` filter checks that the value in the path is equal\n\t * to the day of the week passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfWeek: pathWithArgsFilter<[day: string | number]>(\"date.day-of-week\"),\n\n\t/**\n\t * The `date.day-of-week-after` filter checks that the value in the path is\n\t * after the day of the week passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfWeekAfter: pathWithArgsFilter<[day: string | number]>(\n\t\t\"date.day-of-week-after\",\n\t),\n\n\t/**\n\t * The date.day-of-week-before filter checks that the value in the path is\n\t * before the day of the week passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateDayOfWeekBefore: pathWithArgsFilter<[day: string | number]>(\n\t\t\"date.day-of-week-before\",\n\t),\n\n\t/**\n\t * The `date.month` filter checks that the value in the path occurs in the\n\t * month value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateMonth: pathWithArgsFilter<[month: string | number]>(\"date.month\"),\n\n\t/**\n\t * The `date.month-after` filter checks that the value in the path occurs\n\t * in any month after the value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateMonthAfter:\n\t\tpathWithArgsFilter<[month: string | number]>(\"date.month-after\"),\n\n\t/**\n\t * The `date.month-before` filter checks that the value in the path occurs\n\t * in any month before the value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateMonthBefore:\n\t\tpathWithArgsFilter<[month: string | number]>(\"date.month-before\"),\n\n\t/**\n\t * The `date.year` filter checks that the value in the path occurs in the\n\t * year value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateYear: pathWithArgsFilter<[year: number]>(\"date.year\"),\n\n\t/**\n\t * The `date.hour` filter checks that the value in the path occurs within\n\t * the hour value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateHour: pathWithArgsFilter<[hour: number]>(\"date.hour\"),\n\n\t/**\n\t * The `date.hour-after` filter checks that the value in the path occurs\n\t * after the hour value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateHourAfter: pathWithArgsFilter<[hour: number]>(\"date.hour-after\"),\n\n\t/**\n\t * The `date.hour-before` filter checks that the value in the path occurs\n\t * before the hour value passed into the filter.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}\n\t */\n\tdateHourBefore: pathWithArgsFilter<[hour: number]>(\"date.hour-before\"),\n};\n"],"names":[],"mappings":"AAQA,MAAM,cAAc,CACnB,UAMW;AACP,MAAA,MAAM,QAAQ,KAAK,GAAG;AACzB,WAAO,IAAI,MAAM,IAAI,WAAW,EAAE,KAAK,IAAI;AAAA,EAC3C;AAEG,MAAA,OAAO,UAAU,UAAU;AAC9B,WAAO,IAAI;AAAA,EACX;AAED,MAAI,iBAAiB,MAAM;AACnB,WAAA,GAAG,MAAM,QAAO;AAAA,EACvB;AAED,SAAO,GAAG;AACX;AAWA,MAAM,qBAAqB,CAAyB,SAAgB;AAI7D,QAAA,KAAK,CAAC,SAAiB,SAAsB;AAClD,UAAM,gBAAgB,KAAK,IAAI,WAAW,EAAE,KAAK,IAAI;AACrD,UAAM,SAAS,QAAQ,KAAK,SAAS,OAAO;AAErC,WAAA,IAAI,QAAQ,OAAO,SAAS;AAAA,EAAA;AAG7B,SAAA;AACR;AASA,MAAM,aAAa,CAAC,SAAgB;AAC7B,QAAA,WAAW,mBAAmB,IAAI;AAKlC,QAAA,KAAK,CAAC,SAAwB;AACnC,WAAO,SAAS,IAAI;AAAA,EAAA;AAGd,SAAA;AACR;AAUA,MAAM,aAAa,CAAyB,SAAgB;AACrD,QAAA,WAAW,mBAAyB,IAAI;AAKxC,QAAA,KAAK,IAAI,SAAsB;AAC7B,WAAA,SAAS,IAAI,GAAG,IAAI;AAAA,EAAA;AAGrB,SAAA;AACR;AAEO,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOrB,IAAI,mBACH,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASL,KAAK,mBACJ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUN,KAAK,mBACJ,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUN,IAAI,mBAAuC,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAY/C,UAAU,mBAA0C,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS9D,KAAK,WAAW,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASrB,SAAS,WAAW,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,SAAS,WAAwC,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU1D,cACC,mBACC,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASjB,gBAAgB,mBAAoC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/D,mBAAmB,mBAAoC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlE,eACC,mBACC,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASlB,WAAW,mBAAmD,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ1E,YAAY,mBAAmD,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5E,aACC,mBAEE,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjB,gBAAgB,mBAAkC,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQrE,qBAAqB,mBACpB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS1B,sBAAsB,mBACrB,0BAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS3B,eAAe,mBAA2C,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ5E,oBAAoB,mBACnB,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzB,qBAAqB,mBACpB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS1B,WAAW,mBAA6C,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpE,gBACC,mBAA6C,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhE,iBACC,mBAA6C,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjE,UAAU,mBAAmC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxD,UAAU,mBAAmC,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQxD,eAAe,mBAAmC,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQnE,gBAAgB,mBAAmC,kBAAkB;;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const PrismicError = require("./errors/PrismicError.cjs");
3
4
  const isRepositoryName = require("./isRepositoryName.cjs");
4
- const PrismicError = require("./PrismicError.cjs");
5
5
  const getGraphQLEndpoint = (repositoryName) => {
6
6
  if (isRepositoryName.isRepositoryName(repositoryName)) {
7
7
  return `https://${repositoryName}.cdn.prismic.io/graphql`;
@@ -1 +1 @@
1
- {"version":3,"file":"getGraphQLEndpoint.cjs","sources":["../../src/getGraphQLEndpoint.ts"],"sourcesContent":["import { isRepositoryName } from \"./isRepositoryName\";\nimport { PrismicError } from \"./PrismicError\";\n\n/**\n * Get a repository's Prismic GraphQL endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic REST API V2 endpoint\n */\nexport const getGraphQLEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/graphql` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/graphql` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAWa,MAAA,qBAAqB,CACjC,mBACuD;AACnD,MAAAA,iBAAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAIC,aAAAA,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;;"}
1
+ {"version":3,"file":"getGraphQLEndpoint.cjs","sources":["../../src/getGraphQLEndpoint.ts"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError\";\n\nimport { isRepositoryName } from \"./isRepositoryName\";\n\n/**\n * Get a repository's Prismic GraphQL endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic REST API V2 endpoint\n */\nexport const getGraphQLEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/graphql` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/graphql` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAYa,MAAA,qBAAqB,CACjC,mBACuD;AACnD,MAAAA,iBAAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAIC,aAAAA,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;;"}
@@ -1,9 +1,9 @@
1
- /**
2
- * Get a repository's Prismic GraphQL endpoint.
3
- *
4
- * @typeParam RepositoryName - Name of the Prismic repository.
5
- * @param repositoryName - Name of the repository.
6
- *
7
- * @returns The repository's Prismic REST API V2 endpoint
8
- */
9
- export declare const getGraphQLEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/graphql`;
1
+ /**
2
+ * Get a repository's Prismic GraphQL endpoint.
3
+ *
4
+ * @typeParam RepositoryName - Name of the Prismic repository.
5
+ * @param repositoryName - Name of the repository.
6
+ *
7
+ * @returns The repository's Prismic REST API V2 endpoint
8
+ */
9
+ export declare const getGraphQLEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/graphql`;
@@ -1,5 +1,5 @@
1
+ import { PrismicError } from "./errors/PrismicError.js";
1
2
  import { isRepositoryName } from "./isRepositoryName.js";
2
- import { PrismicError } from "./PrismicError.js";
3
3
  const getGraphQLEndpoint = (repositoryName) => {
4
4
  if (isRepositoryName(repositoryName)) {
5
5
  return `https://${repositoryName}.cdn.prismic.io/graphql`;
@@ -1 +1 @@
1
- {"version":3,"file":"getGraphQLEndpoint.js","sources":["../../src/getGraphQLEndpoint.ts"],"sourcesContent":["import { isRepositoryName } from \"./isRepositoryName\";\nimport { PrismicError } from \"./PrismicError\";\n\n/**\n * Get a repository's Prismic GraphQL endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic REST API V2 endpoint\n */\nexport const getGraphQLEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/graphql` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/graphql` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":[],"mappings":";;AAWa,MAAA,qBAAqB,CACjC,mBACuD;AACnD,MAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAI,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;"}
1
+ {"version":3,"file":"getGraphQLEndpoint.js","sources":["../../src/getGraphQLEndpoint.ts"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError\";\n\nimport { isRepositoryName } from \"./isRepositoryName\";\n\n/**\n * Get a repository's Prismic GraphQL endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic REST API V2 endpoint\n */\nexport const getGraphQLEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/graphql` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/graphql` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":[],"mappings":";;AAYa,MAAA,qBAAqB,CACjC,mBACuD;AACnD,MAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAI,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;"}
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const PrismicError = require("./errors/PrismicError.cjs");
3
4
  const isRepositoryName = require("./isRepositoryName.cjs");
4
- const PrismicError = require("./PrismicError.cjs");
5
5
  const getRepositoryEndpoint = (repositoryName) => {
6
6
  if (isRepositoryName.isRepositoryName(repositoryName)) {
7
7
  return `https://${repositoryName}.cdn.prismic.io/api/v2`;
@@ -1 +1 @@
1
- {"version":3,"file":"getRepositoryEndpoint.cjs","sources":["../../src/getRepositoryEndpoint.ts"],"sourcesContent":["import { isRepositoryName } from \"./isRepositoryName\";\nimport { PrismicError } from \"./PrismicError\";\n\n/**\n * Get a repository's Prismic Rest API V2 endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic Rest API V2 endpoint\n * @throws {@link Error} Thrown if an invalid repository name is provided.\n */\nexport const getRepositoryEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/api/v2` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/api/v2` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAYa,MAAA,wBAAwB,CACpC,mBACsD;AAClD,MAAAA,iBAAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAIC,aAAAA,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;;"}
1
+ {"version":3,"file":"getRepositoryEndpoint.cjs","sources":["../../src/getRepositoryEndpoint.ts"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError\";\n\nimport { isRepositoryName } from \"./isRepositoryName\";\n\n/**\n * Get a repository's Prismic Rest API V2 endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic Rest API V2 endpoint\n * @throws {@link Error} Thrown if an invalid repository name is provided.\n */\nexport const getRepositoryEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/api/v2` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/api/v2` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAaa,MAAA,wBAAwB,CACpC,mBACsD;AAClD,MAAAA,iBAAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAIC,aAAAA,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;;"}
@@ -1,10 +1,10 @@
1
- /**
2
- * Get a repository's Prismic Rest API V2 endpoint.
3
- *
4
- * @typeParam RepositoryName - Name of the Prismic repository.
5
- * @param repositoryName - Name of the repository.
6
- *
7
- * @returns The repository's Prismic Rest API V2 endpoint
8
- * @throws {@link Error} Thrown if an invalid repository name is provided.
9
- */
10
- export declare const getRepositoryEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
1
+ /**
2
+ * Get a repository's Prismic Rest API V2 endpoint.
3
+ *
4
+ * @typeParam RepositoryName - Name of the Prismic repository.
5
+ * @param repositoryName - Name of the repository.
6
+ *
7
+ * @returns The repository's Prismic Rest API V2 endpoint
8
+ * @throws {@link Error} Thrown if an invalid repository name is provided.
9
+ */
10
+ export declare const getRepositoryEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
@@ -1,5 +1,5 @@
1
+ import { PrismicError } from "./errors/PrismicError.js";
1
2
  import { isRepositoryName } from "./isRepositoryName.js";
2
- import { PrismicError } from "./PrismicError.js";
3
3
  const getRepositoryEndpoint = (repositoryName) => {
4
4
  if (isRepositoryName(repositoryName)) {
5
5
  return `https://${repositoryName}.cdn.prismic.io/api/v2`;
@@ -1 +1 @@
1
- {"version":3,"file":"getRepositoryEndpoint.js","sources":["../../src/getRepositoryEndpoint.ts"],"sourcesContent":["import { isRepositoryName } from \"./isRepositoryName\";\nimport { PrismicError } from \"./PrismicError\";\n\n/**\n * Get a repository's Prismic Rest API V2 endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic Rest API V2 endpoint\n * @throws {@link Error} Thrown if an invalid repository name is provided.\n */\nexport const getRepositoryEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/api/v2` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/api/v2` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":[],"mappings":";;AAYa,MAAA,wBAAwB,CACpC,mBACsD;AAClD,MAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAI,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;"}
1
+ {"version":3,"file":"getRepositoryEndpoint.js","sources":["../../src/getRepositoryEndpoint.ts"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError\";\n\nimport { isRepositoryName } from \"./isRepositoryName\";\n\n/**\n * Get a repository's Prismic Rest API V2 endpoint.\n *\n * @typeParam RepositoryName - Name of the Prismic repository.\n * @param repositoryName - Name of the repository.\n *\n * @returns The repository's Prismic Rest API V2 endpoint\n * @throws {@link Error} Thrown if an invalid repository name is provided.\n */\nexport const getRepositoryEndpoint = <RepositoryName extends string>(\n\trepositoryName: RepositoryName,\n): `https://${RepositoryName}.cdn.prismic.io/api/v2` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://${repositoryName}.cdn.prismic.io/api/v2` as const;\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":[],"mappings":";;AAaa,MAAA,wBAAwB,CACpC,mBACsD;AAClD,MAAA,iBAAiB,cAAc,GAAG;AACrC,WAAO,WAAW;AAAA,EAAA,OACZ;AACN,UAAM,IAAI,aACT,iDAAiD,kBACjD,QACA,MAAS;AAAA,EAEV;AACF;"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PrismicError = require("./PrismicError.cjs");
3
+ const PrismicError = require("./errors/PrismicError.cjs");
4
4
  const getRepositoryName = (repositoryEndpoint) => {
5
5
  try {
6
6
  return new URL(repositoryEndpoint).hostname.split(".")[0];
@@ -1 +1 @@
1
- {"version":3,"file":"getRepositoryName.cjs","sources":["../../src/getRepositoryName.ts"],"sourcesContent":["import { PrismicError } from \"./PrismicError\";\n\n/**\n * Get a Prismic repository's name from its standard Prismic Rest API V2 or\n * GraphQL endpoint.\n *\n * @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the\n * repository.\n * @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.\n *\n * @returns The Prismic repository's name.\n * @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is\n * provided.\n */\nexport const getRepositoryName = (repositoryEndpoint: string): string => {\n\ttry {\n\t\treturn new URL(repositoryEndpoint).hostname.split(\".\")[0];\n\t} catch {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic Rest API V2 endpoint was provided: ${repositoryEndpoint}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["PrismicError"],"mappings":";;;AAca,MAAA,oBAAoB,CAAC,uBAAsC;AACnE,MAAA;AACH,WAAO,IAAI,IAAI,kBAAkB,EAAE,SAAS,MAAM,GAAG,EAAE;AAAA,EAAA,QACtD;AACD,UAAM,IAAIA,aAAAA,aACT,yDAAyD,sBACzD,QACA,MAAS;AAAA,EAEV;AACF;;"}
1
+ {"version":3,"file":"getRepositoryName.cjs","sources":["../../src/getRepositoryName.ts"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError\";\n\n/**\n * Get a Prismic repository's name from its standard Prismic Rest API V2 or\n * GraphQL endpoint.\n *\n * @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the\n * repository.\n * @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.\n *\n * @returns The Prismic repository's name.\n * @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is\n * provided.\n */\nexport const getRepositoryName = (repositoryEndpoint: string): string => {\n\ttry {\n\t\treturn new URL(repositoryEndpoint).hostname.split(\".\")[0];\n\t} catch {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic Rest API V2 endpoint was provided: ${repositoryEndpoint}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t);\n\t}\n};\n"],"names":["PrismicError"],"mappings":";;;AAca,MAAA,oBAAoB,CAAC,uBAAsC;AACnE,MAAA;AACI,WAAA,IAAI,IAAI,kBAAkB,EAAE,SAAS,MAAM,GAAG,EAAE,CAAC;AAAA,EAAA,QACvD;AACD,UAAM,IAAIA,aAAAA,aACT,yDAAyD,sBACzD,QACA,MAAS;AAAA,EAEV;AACF;;"}
@@ -1,13 +1,13 @@
1
- /**
2
- * Get a Prismic repository's name from its standard Prismic Rest API V2 or
3
- * GraphQL endpoint.
4
- *
5
- * @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the
6
- * repository.
7
- * @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
8
- *
9
- * @returns The Prismic repository's name.
10
- * @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is
11
- * provided.
12
- */
13
- export declare const getRepositoryName: (repositoryEndpoint: string) => string;
1
+ /**
2
+ * Get a Prismic repository's name from its standard Prismic Rest API V2 or
3
+ * GraphQL endpoint.
4
+ *
5
+ * @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the
6
+ * repository.
7
+ * @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
8
+ *
9
+ * @returns The Prismic repository's name.
10
+ * @throws {@link Error} Thrown if an invalid Prismic Rest API V2 endpoint is
11
+ * provided.
12
+ */
13
+ export declare const getRepositoryName: (repositoryEndpoint: string) => string;