@prismicio/client 7.0.0-alpha.0 → 7.0.0-alpha.2

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 (396) hide show
  1. package/README.md +4 -4
  2. package/dist/buildQueryURL.cjs +26 -8
  3. package/dist/buildQueryURL.cjs.map +1 -1
  4. package/dist/buildQueryURL.d.ts +207 -130
  5. package/dist/buildQueryURL.js +25 -7
  6. package/dist/buildQueryURL.js.map +1 -1
  7. package/dist/cookie.cjs +1 -1
  8. package/dist/cookie.cjs.map +1 -1
  9. package/dist/cookie.d.ts +5 -5
  10. package/dist/cookie.js.map +1 -1
  11. package/dist/createClient.cjs +1142 -0
  12. package/dist/createClient.cjs.map +1 -0
  13. package/dist/{client.d.ts → createClient.d.ts} +980 -908
  14. package/dist/createClient.js +1142 -0
  15. package/dist/createClient.js.map +1 -0
  16. package/dist/{ForbiddenError.cjs → errors/ForbiddenError.cjs} +1 -1
  17. package/dist/errors/ForbiddenError.cjs.map +1 -0
  18. package/dist/{ForbiddenError.d.ts → errors/ForbiddenError.d.ts} +11 -11
  19. package/dist/errors/ForbiddenError.js.map +1 -0
  20. package/dist/{NotFoundError.cjs → errors/NotFoundError.cjs} +1 -1
  21. package/dist/errors/NotFoundError.cjs.map +1 -0
  22. package/dist/{NotFoundError.d.ts → errors/NotFoundError.d.ts} +3 -3
  23. package/dist/errors/NotFoundError.js.map +1 -0
  24. package/dist/{ParsingError.cjs → errors/ParsingError.cjs} +1 -1
  25. package/dist/errors/ParsingError.cjs.map +1 -0
  26. package/dist/{ParsingError.d.ts → errors/ParsingError.d.ts} +12 -12
  27. package/dist/errors/ParsingError.js.map +1 -0
  28. package/dist/{PrismicError.cjs → errors/PrismicError.cjs} +1 -1
  29. package/dist/errors/PrismicError.cjs.map +1 -0
  30. package/dist/{PrismicError.d.ts → errors/PrismicError.d.ts} +5 -5
  31. package/dist/errors/PrismicError.js.map +1 -0
  32. package/dist/filter.cjs +247 -0
  33. package/dist/filter.cjs.map +1 -0
  34. package/dist/filter.d.ts +209 -0
  35. package/dist/filter.js +247 -0
  36. package/dist/filter.js.map +1 -0
  37. package/dist/getGraphQLEndpoint.cjs +2 -2
  38. package/dist/getGraphQLEndpoint.cjs.map +1 -1
  39. package/dist/getGraphQLEndpoint.d.ts +9 -9
  40. package/dist/getGraphQLEndpoint.js +1 -1
  41. package/dist/getGraphQLEndpoint.js.map +1 -1
  42. package/dist/getRepositoryEndpoint.cjs +2 -2
  43. package/dist/getRepositoryEndpoint.cjs.map +1 -1
  44. package/dist/getRepositoryEndpoint.d.ts +10 -10
  45. package/dist/getRepositoryEndpoint.js +1 -1
  46. package/dist/getRepositoryEndpoint.js.map +1 -1
  47. package/dist/getRepositoryName.cjs +2 -2
  48. package/dist/getRepositoryName.cjs.map +1 -1
  49. package/dist/getRepositoryName.d.ts +13 -13
  50. package/dist/getRepositoryName.js +1 -1
  51. package/dist/getRepositoryName.js.map +1 -1
  52. package/dist/getToolbarSrc.cjs +13 -0
  53. package/dist/getToolbarSrc.cjs.map +1 -0
  54. package/dist/getToolbarSrc.d.ts +34 -0
  55. package/dist/getToolbarSrc.js +13 -0
  56. package/dist/getToolbarSrc.js.map +1 -0
  57. package/dist/helpers/asDate.cjs +1 -1
  58. package/dist/helpers/asDate.cjs.map +1 -1
  59. package/dist/helpers/asDate.d.ts +16 -16
  60. package/dist/helpers/asDate.js.map +1 -1
  61. package/dist/helpers/asHTML.cjs +7 -6
  62. package/dist/helpers/asHTML.cjs.map +1 -1
  63. package/dist/helpers/asHTML.d.ts +77 -20
  64. package/dist/helpers/asHTML.js +6 -5
  65. package/dist/helpers/asHTML.js.map +1 -1
  66. package/dist/helpers/asImagePixelDensitySrcSet.cjs +1 -1
  67. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  68. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +52 -52
  69. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  70. package/dist/helpers/asImageSrc.cjs +1 -1
  71. package/dist/helpers/asImageSrc.cjs.map +1 -1
  72. package/dist/helpers/asImageSrc.d.ts +27 -27
  73. package/dist/helpers/asImageSrc.js.map +1 -1
  74. package/dist/helpers/asImageWidthSrcSet.cjs +19 -14
  75. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  76. package/dist/helpers/asImageWidthSrcSet.d.ts +60 -60
  77. package/dist/helpers/asImageWidthSrcSet.js +18 -13
  78. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  79. package/dist/helpers/asLink.cjs +8 -2
  80. package/dist/helpers/asLink.cjs.map +1 -1
  81. package/dist/helpers/asLink.d.ts +34 -24
  82. package/dist/helpers/asLink.js +7 -1
  83. package/dist/helpers/asLink.js.map +1 -1
  84. package/dist/helpers/asLinkAttrs.cjs +28 -0
  85. package/dist/helpers/asLinkAttrs.cjs.map +1 -0
  86. package/dist/helpers/asLinkAttrs.d.ts +63 -0
  87. package/dist/helpers/asLinkAttrs.js +28 -0
  88. package/dist/helpers/asLinkAttrs.js.map +1 -0
  89. package/dist/helpers/asText.cjs +1 -1
  90. package/dist/helpers/asText.cjs.map +1 -1
  91. package/dist/helpers/asText.d.ts +16 -16
  92. package/dist/helpers/asText.js.map +1 -1
  93. package/dist/helpers/documentToLinkField.cjs +12 -5
  94. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  95. package/dist/helpers/documentToLinkField.d.ts +15 -15
  96. package/dist/helpers/documentToLinkField.js +11 -4
  97. package/dist/helpers/documentToLinkField.js.map +1 -1
  98. package/dist/helpers/isFilled.cjs +1 -1
  99. package/dist/helpers/isFilled.cjs.map +1 -1
  100. package/dist/helpers/isFilled.d.ts +172 -175
  101. package/dist/helpers/isFilled.js.map +1 -1
  102. package/dist/index.cjs +20 -14
  103. package/dist/index.cjs.map +1 -1
  104. package/dist/index.d.ts +139 -92
  105. package/dist/index.js +12 -6
  106. package/dist/index.js.map +1 -1
  107. package/dist/isRepositoryEndpoint.cjs +1 -1
  108. package/dist/isRepositoryEndpoint.cjs.map +1 -1
  109. package/dist/isRepositoryEndpoint.d.ts +10 -10
  110. package/dist/isRepositoryEndpoint.js.map +1 -1
  111. package/dist/isRepositoryName.cjs +1 -1
  112. package/dist/isRepositoryName.cjs.map +1 -1
  113. package/dist/isRepositoryName.d.ts +9 -9
  114. package/dist/isRepositoryName.js.map +1 -1
  115. package/dist/lib/appendFilters.cjs +11 -0
  116. package/dist/lib/appendFilters.cjs.map +1 -0
  117. package/dist/lib/appendFilters.d.ts +18 -0
  118. package/dist/lib/appendFilters.js +11 -0
  119. package/dist/lib/appendFilters.js.map +1 -0
  120. package/dist/lib/castArray.cjs +4 -2
  121. package/dist/lib/castArray.cjs.map +1 -1
  122. package/dist/lib/castArray.d.ts +11 -11
  123. package/dist/lib/castArray.js +3 -1
  124. package/dist/lib/castArray.js.map +1 -1
  125. package/dist/lib/castThunk.cjs +4 -2
  126. package/dist/lib/castThunk.cjs.map +1 -1
  127. package/dist/lib/castThunk.d.ts +10 -10
  128. package/dist/lib/castThunk.js +3 -1
  129. package/dist/lib/castThunk.js.map +1 -1
  130. package/dist/lib/devMsg.cjs +8 -0
  131. package/dist/lib/devMsg.cjs.map +1 -0
  132. package/dist/lib/devMsg.d.ts +16 -0
  133. package/dist/lib/devMsg.js +8 -0
  134. package/dist/lib/devMsg.js.map +1 -0
  135. package/dist/lib/escapeHTML.cjs +43 -0
  136. package/dist/lib/escapeHTML.cjs.map +1 -0
  137. package/dist/lib/escapeHTML.d.ts +1 -0
  138. package/dist/lib/escapeHTML.js +43 -0
  139. package/dist/lib/escapeHTML.js.map +1 -0
  140. package/dist/lib/everyTagFilter.cjs +9 -0
  141. package/dist/lib/everyTagFilter.cjs.map +1 -0
  142. package/dist/lib/everyTagFilter.d.ts +9 -0
  143. package/dist/lib/everyTagFilter.js +9 -0
  144. package/dist/lib/everyTagFilter.js.map +1 -0
  145. package/dist/lib/findMasterRef.cjs +1 -1
  146. package/dist/lib/findMasterRef.cjs.map +1 -1
  147. package/dist/lib/findMasterRef.d.ts +10 -10
  148. package/dist/lib/findMasterRef.js.map +1 -1
  149. package/dist/lib/findRef.cjs +4 -4
  150. package/dist/lib/findRef.cjs.map +1 -1
  151. package/dist/lib/findRef.d.ts +13 -13
  152. package/dist/lib/findRef.js +3 -3
  153. package/dist/lib/findRef.js.map +1 -1
  154. package/dist/lib/findRefByID.cjs +1 -1
  155. package/dist/lib/findRefByID.cjs.map +1 -1
  156. package/dist/lib/findRefByID.d.ts +11 -11
  157. package/dist/lib/findRefByID.js.map +1 -1
  158. package/dist/lib/findRefByLabel.cjs +1 -1
  159. package/dist/lib/findRefByLabel.cjs.map +1 -1
  160. package/dist/lib/findRefByLabel.d.ts +11 -11
  161. package/dist/lib/findRefByLabel.js.map +1 -1
  162. package/dist/lib/getPreviewCookie.cjs +1 -1
  163. package/dist/lib/getPreviewCookie.cjs.map +1 -1
  164. package/dist/lib/getPreviewCookie.d.ts +9 -9
  165. package/dist/lib/getPreviewCookie.js.map +1 -1
  166. package/dist/lib/isInternalURL.cjs +9 -0
  167. package/dist/lib/isInternalURL.cjs.map +1 -0
  168. package/dist/lib/isInternalURL.d.ts +8 -0
  169. package/dist/lib/isInternalURL.js +9 -0
  170. package/dist/lib/isInternalURL.js.map +1 -0
  171. package/dist/lib/minifyGraphQLQuery.cjs +1 -1
  172. package/dist/lib/minifyGraphQLQuery.cjs.map +1 -1
  173. package/dist/lib/minifyGraphQLQuery.d.ts +8 -8
  174. package/dist/lib/minifyGraphQLQuery.js.map +1 -1
  175. package/dist/lib/serializerHelpers.cjs +7 -9
  176. package/dist/lib/serializerHelpers.cjs.map +1 -1
  177. package/dist/lib/serializerHelpers.d.ts +9 -9
  178. package/dist/lib/serializerHelpers.js +6 -6
  179. package/dist/lib/serializerHelpers.js.map +1 -1
  180. package/dist/lib/someTagsFilter.cjs +9 -0
  181. package/dist/lib/someTagsFilter.cjs.map +1 -0
  182. package/dist/lib/someTagsFilter.d.ts +9 -0
  183. package/dist/lib/someTagsFilter.js +9 -0
  184. package/dist/lib/someTagsFilter.js.map +1 -0
  185. package/dist/lib/typeFilter.cjs +8 -0
  186. package/dist/lib/typeFilter.cjs.map +1 -0
  187. package/dist/lib/typeFilter.d.ts +8 -0
  188. package/dist/lib/typeFilter.js +8 -0
  189. package/dist/lib/typeFilter.js.map +1 -0
  190. package/dist/package.json.cjs +5 -0
  191. package/dist/package.json.cjs.map +1 -0
  192. package/dist/package.json.js +5 -0
  193. package/dist/package.json.js.map +1 -0
  194. package/dist/types/api/query.d.ts +42 -42
  195. package/dist/types/api/ref.d.ts +32 -32
  196. package/dist/types/api/release.d.ts +10 -10
  197. package/dist/types/api/repository.d.ts +100 -100
  198. package/dist/types/api/tags.d.ts +8 -8
  199. package/dist/types/model/boolean.d.ts +15 -15
  200. package/dist/types/model/color.d.ts +13 -13
  201. package/dist/types/model/contentRelationship.d.ts +18 -18
  202. package/dist/types/model/customType.d.ts +42 -42
  203. package/dist/types/model/date.d.ts +14 -14
  204. package/dist/types/model/embed.d.ts +13 -13
  205. package/dist/types/model/geoPoint.d.ts +12 -12
  206. package/dist/types/model/group.d.ts +15 -15
  207. package/dist/types/model/image.d.ts +31 -31
  208. package/dist/types/model/integrationFields.d.ts +14 -14
  209. package/dist/types/model/keyText.d.ts +13 -13
  210. package/dist/types/model/link.cjs +1 -1
  211. package/dist/types/model/link.cjs.map +1 -1
  212. package/dist/types/model/link.d.ts +27 -27
  213. package/dist/types/model/link.js.map +1 -1
  214. package/dist/types/model/linkToMedia.d.ts +16 -16
  215. package/dist/types/model/number.d.ts +15 -15
  216. package/dist/types/model/range.d.ts +14 -14
  217. package/dist/types/model/richText.d.ts +35 -35
  218. package/dist/types/model/select.d.ts +18 -18
  219. package/dist/types/model/separator.d.ts +10 -10
  220. package/dist/types/model/sharedSlice.d.ts +16 -19
  221. package/dist/types/model/sharedSliceVariation.d.ts +19 -22
  222. package/dist/types/model/slice.cjs +1 -1
  223. package/dist/types/model/slice.cjs.map +1 -1
  224. package/dist/types/model/slice.d.ts +33 -33
  225. package/dist/types/model/slice.js.map +1 -1
  226. package/dist/types/model/sliceZone.cjs +1 -1
  227. package/dist/types/model/sliceZone.cjs.map +1 -1
  228. package/dist/types/model/sliceZone.d.ts +41 -44
  229. package/dist/types/model/sliceZone.js.map +1 -1
  230. package/dist/types/model/timestamp.d.ts +14 -14
  231. package/dist/types/model/title.d.ts +7 -7
  232. package/dist/types/model/types.cjs +10 -1
  233. package/dist/types/model/types.cjs.map +1 -1
  234. package/dist/types/model/types.d.ts +62 -62
  235. package/dist/types/model/types.js +9 -0
  236. package/dist/types/model/types.js.map +1 -1
  237. package/dist/types/model/uid.d.ts +13 -13
  238. package/dist/types/value/boolean.d.ts +6 -6
  239. package/dist/types/value/color.d.ts +8 -8
  240. package/dist/types/value/contentRelationship.d.ts +29 -29
  241. package/dist/types/value/date.d.ts +8 -8
  242. package/dist/types/value/document.d.ts +113 -113
  243. package/dist/types/value/embed.cjs +1 -1
  244. package/dist/types/value/embed.cjs.map +1 -1
  245. package/dist/types/value/embed.d.ts +167 -167
  246. package/dist/types/value/embed.js.map +1 -1
  247. package/dist/types/value/geoPoint.d.ts +11 -11
  248. package/dist/types/value/group.d.ts +7 -7
  249. package/dist/types/value/image.d.ts +36 -36
  250. package/dist/types/value/integrationFields.d.ts +9 -9
  251. package/dist/types/value/keyText.d.ts +8 -8
  252. package/dist/types/value/link.cjs +1 -1
  253. package/dist/types/value/link.cjs.map +1 -1
  254. package/dist/types/value/link.d.ts +40 -40
  255. package/dist/types/value/link.js.map +1 -1
  256. package/dist/types/value/linkToMedia.d.ts +20 -20
  257. package/dist/types/value/number.d.ts +8 -8
  258. package/dist/types/value/richText.cjs +1 -1
  259. package/dist/types/value/richText.cjs.map +1 -1
  260. package/dist/types/value/richText.d.ts +203 -203
  261. package/dist/types/value/richText.js.map +1 -1
  262. package/dist/types/value/select.d.ts +9 -9
  263. package/dist/types/value/sharedSlice.d.ts +11 -11
  264. package/dist/types/value/sharedSliceVariation.d.ts +7 -7
  265. package/dist/types/value/slice.d.ts +13 -13
  266. package/dist/types/value/sliceZone.d.ts +12 -12
  267. package/dist/types/value/timestamp.d.ts +8 -8
  268. package/dist/types/value/title.d.ts +12 -12
  269. package/dist/types/value/types.d.ts +40 -40
  270. package/dist/types/webhook/apiUpdate.d.ts +52 -52
  271. package/dist/types/webhook/testTrigger.d.ts +9 -9
  272. package/dist/types/webhook/types.cjs +1 -1
  273. package/dist/types/webhook/types.cjs.map +1 -1
  274. package/dist/types/webhook/types.d.ts +18 -18
  275. package/dist/types/webhook/types.js.map +1 -1
  276. package/package.json +23 -24
  277. package/src/buildQueryURL.ts +179 -33
  278. package/src/{client.ts → createClient.ts} +214 -110
  279. package/src/filter.ts +356 -0
  280. package/src/getGraphQLEndpoint.ts +2 -1
  281. package/src/getRepositoryEndpoint.ts +2 -1
  282. package/src/getRepositoryName.ts +1 -1
  283. package/src/getToolbarSrc.ts +50 -0
  284. package/src/helpers/asDate.ts +3 -3
  285. package/src/helpers/asHTML.ts +122 -27
  286. package/src/helpers/asImagePixelDensitySrcSet.ts +1 -1
  287. package/src/helpers/asImageSrc.ts +1 -1
  288. package/src/helpers/asImageWidthSrcSet.ts +1 -1
  289. package/src/helpers/asLink.ts +37 -18
  290. package/src/helpers/asLinkAttrs.ts +127 -0
  291. package/src/helpers/asText.ts +4 -4
  292. package/src/helpers/documentToLinkField.ts +3 -3
  293. package/src/helpers/isFilled.ts +9 -11
  294. package/src/index.ts +60 -29
  295. package/src/lib/appendFilters.ts +26 -0
  296. package/src/lib/castArray.ts +3 -1
  297. package/src/lib/castThunk.ts +3 -2
  298. package/src/lib/devMsg.ts +20 -0
  299. package/src/lib/escapeHTML.ts +51 -0
  300. package/src/lib/everyTagFilter.ts +15 -0
  301. package/src/lib/findRef.ts +5 -5
  302. package/src/lib/isInternalURL.ts +14 -0
  303. package/src/lib/serializerHelpers.ts +20 -15
  304. package/src/lib/someTagsFilter.ts +15 -0
  305. package/src/lib/typeFilter.ts +12 -0
  306. package/src/types/api/query.ts +1 -1
  307. package/src/types/api/ref.ts +2 -2
  308. package/src/types/api/release.ts +1 -1
  309. package/src/types/api/repository.ts +1 -1
  310. package/src/types/api/tags.ts +1 -1
  311. package/src/types/model/boolean.ts +1 -1
  312. package/src/types/model/color.ts +1 -1
  313. package/src/types/model/contentRelationship.ts +2 -1
  314. package/src/types/model/date.ts +1 -1
  315. package/src/types/model/embed.ts +1 -1
  316. package/src/types/model/geoPoint.ts +1 -1
  317. package/src/types/model/group.ts +2 -2
  318. package/src/types/model/image.ts +3 -3
  319. package/src/types/model/integrationFields.ts +1 -1
  320. package/src/types/model/keyText.ts +1 -1
  321. package/src/types/model/link.ts +3 -3
  322. package/src/types/model/linkToMedia.ts +2 -1
  323. package/src/types/model/number.ts +1 -1
  324. package/src/types/model/richText.ts +3 -3
  325. package/src/types/model/select.ts +1 -1
  326. package/src/types/model/sharedSlice.ts +2 -5
  327. package/src/types/model/sharedSliceVariation.ts +1 -4
  328. package/src/types/model/slice.ts +5 -4
  329. package/src/types/model/sliceZone.ts +5 -7
  330. package/src/types/model/timestamp.ts +1 -1
  331. package/src/types/model/title.ts +1 -1
  332. package/src/types/model/types.ts +12 -16
  333. package/src/types/model/uid.ts +1 -1
  334. package/src/types/value/boolean.ts +1 -1
  335. package/src/types/value/color.ts +1 -1
  336. package/src/types/value/contentRelationship.ts +8 -9
  337. package/src/types/value/date.ts +1 -1
  338. package/src/types/value/document.ts +6 -5
  339. package/src/types/value/embed.ts +2 -2
  340. package/src/types/value/geoPoint.ts +1 -1
  341. package/src/types/value/group.ts +2 -2
  342. package/src/types/value/image.ts +1 -1
  343. package/src/types/value/integrationFields.ts +1 -1
  344. package/src/types/value/keyText.ts +1 -1
  345. package/src/types/value/link.ts +8 -8
  346. package/src/types/value/linkToMedia.ts +2 -1
  347. package/src/types/value/number.ts +1 -1
  348. package/src/types/value/richText.ts +6 -5
  349. package/src/types/value/select.ts +1 -1
  350. package/src/types/value/sharedSlice.ts +1 -1
  351. package/src/types/value/slice.ts +1 -1
  352. package/src/types/value/sliceZone.ts +2 -1
  353. package/src/types/value/timestamp.ts +1 -0
  354. package/src/types/value/title.ts +2 -1
  355. package/src/types/value/types.ts +9 -11
  356. package/src/types/webhook/apiUpdate.ts +4 -4
  357. package/src/types/webhook/testTrigger.ts +1 -1
  358. package/src/types/webhook/types.ts +2 -2
  359. package/dist/ForbiddenError.cjs.map +0 -1
  360. package/dist/ForbiddenError.js.map +0 -1
  361. package/dist/NotFoundError.cjs.map +0 -1
  362. package/dist/NotFoundError.js.map +0 -1
  363. package/dist/ParsingError.cjs.map +0 -1
  364. package/dist/ParsingError.js.map +0 -1
  365. package/dist/PrismicError.cjs.map +0 -1
  366. package/dist/PrismicError.js.map +0 -1
  367. package/dist/client.cjs +0 -414
  368. package/dist/client.cjs.map +0 -1
  369. package/dist/client.js +0 -414
  370. package/dist/client.js.map +0 -1
  371. package/dist/lib/appendPredicates.cjs +0 -14
  372. package/dist/lib/appendPredicates.cjs.map +0 -1
  373. package/dist/lib/appendPredicates.d.ts +0 -18
  374. package/dist/lib/appendPredicates.js +0 -14
  375. package/dist/lib/appendPredicates.js.map +0 -1
  376. package/dist/predicate.cjs +0 -68
  377. package/dist/predicate.cjs.map +0 -1
  378. package/dist/predicate.d.ts +0 -209
  379. package/dist/predicate.js +0 -68
  380. package/dist/predicate.js.map +0 -1
  381. package/dist/types/client.d.ts +0 -128
  382. package/dist/types/helpers.d.ts +0 -63
  383. package/dist/types/utils.d.ts +0 -28
  384. package/src/lib/appendPredicates.ts +0 -29
  385. package/src/predicate.ts +0 -359
  386. package/src/types/client.ts +0 -157
  387. package/src/types/helpers.ts +0 -103
  388. package/src/types/utils.ts +0 -34
  389. /package/dist/{ForbiddenError.js → errors/ForbiddenError.js} +0 -0
  390. /package/dist/{NotFoundError.js → errors/NotFoundError.js} +0 -0
  391. /package/dist/{ParsingError.js → errors/ParsingError.js} +0 -0
  392. /package/dist/{PrismicError.js → errors/PrismicError.js} +0 -0
  393. /package/src/{ForbiddenError.ts → errors/ForbiddenError.ts} +0 -0
  394. /package/src/{NotFoundError.ts → errors/NotFoundError.ts} +0 -0
  395. /package/src/{ParsingError.ts → errors/ParsingError.ts} +0 -0
  396. /package/src/{PrismicError.ts → errors/PrismicError.ts} +0 -0
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  The official JavaScript + TypeScript client library for [Prismic][prismic].
11
11
 
12
12
  - Query content from a Prismic repository.
13
- - Filter queries using [Predicates][prismic-predicates].
13
+ - Refines queries using [Filters][prismic-filters].
14
14
  - Automatically query draft content during [preview sessions][prismic-previews].
15
15
  - Built for browser and server usage.
16
16
 
@@ -51,7 +51,7 @@ For more clarity on this project and its structure you can also check out the de
51
51
  ## License
52
52
 
53
53
  ```
54
- Copyright 2013-2022 Prismic <contact@prismic.io> (https://prismic.io)
54
+ Copyright 2013-2023 Prismic <contact@prismic.io> (https://prismic.io)
55
55
 
56
56
  Licensed under the Apache License, Version 2.0 (the "License");
57
57
  you may not use this file except in compliance with the License.
@@ -69,8 +69,8 @@ For more clarity on this project and its structure you can also check out the de
69
69
  <!-- Links -->
70
70
 
71
71
  [prismic]: https://prismic.io
72
- [prismic-predicates]: https://prismic.io/docs/technologies/rest-api-technical-reference
73
- [prismic-previews]: https://prismic.io/docs/core-concepts/previews
72
+ [prismic-filters]: https://prismic.io/docs/rest-api-technical-reference#q
73
+ [prismic-previews]: https://prismic.io/docs/guides/previews
74
74
  [prismic-docs]: https://prismic.io/docs/technical-reference/prismicio-client
75
75
  [changelog]: ./CHANGELOG.md
76
76
  [contributing]: ./CONTRIBUTING.md
@@ -1,28 +1,46 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const castArray = require("./lib/castArray.cjs");
4
+ const devMsg = require("./lib/devMsg.cjs");
4
5
  const RENAMED_PARAMS = {
5
6
  accessToken: "access_token"
6
7
  };
7
- const castOrderingToString = (ordering) => typeof ordering === "string" ? ordering : [
8
- ordering.field,
9
- ordering.direction === "desc" ? ordering.direction : void 0
10
- ].filter(Boolean).join(" ");
8
+ const castOrderingToString = (ordering) => {
9
+ if (typeof ordering === "string") {
10
+ if (process.env.NODE_ENV === "development") {
11
+ const [field, direction] = ordering.split(" ");
12
+ const objectForm = direction === "desc" ? `{ field: "${field}", direction: "desc" }` : `{ field: "${field}" }`;
13
+ console.warn(`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to the object form: ${objectForm}. For more details, see ${devMsg.devMsg("orderings-must-be-an-array-of-objects")}`);
14
+ }
15
+ return ordering;
16
+ }
17
+ return ordering.direction === "desc" ? `${ordering.field} desc` : ordering.field;
18
+ };
11
19
  const buildQueryURL = (endpoint, args) => {
12
- var _a;
13
- const { predicates, ...params } = args;
20
+ const { filters, predicates, ...params } = args;
14
21
  const url = new URL(`documents/search`, `${endpoint}/`);
22
+ if (filters) {
23
+ if (process.env.NODE_ENV === "development" && !Array.isArray(filters)) {
24
+ console.warn(`[@prismicio/client] A non-array value was provided to the \`filters\` query parameter (\`${filters}\`). Non-array values are deprecated. Please convert it to an array. For more details, see ${devMsg.devMsg("filters-must-be-an-array")}`);
25
+ }
26
+ for (const filter of castArray.castArray(filters)) {
27
+ url.searchParams.append("q", `[${filter}]`);
28
+ }
29
+ }
15
30
  if (predicates) {
16
31
  for (const predicate of castArray.castArray(predicates)) {
17
32
  url.searchParams.append("q", `[${predicate}]`);
18
33
  }
19
34
  }
20
35
  for (const k in params) {
21
- const name = (_a = RENAMED_PARAMS[k]) != null ? _a : k;
36
+ const name = RENAMED_PARAMS[k] || k;
22
37
  let value = params[k];
23
38
  if (name === "orderings") {
24
39
  const scopedValue = params[name];
25
40
  if (scopedValue != null) {
41
+ if (process.env.NODE_ENV === "development" && typeof scopedValue === "string") {
42
+ console.warn(`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to an array of objects. For more details, see ${devMsg.devMsg("orderings-must-be-an-array-of-objects")}`);
43
+ }
26
44
  const v = castArray.castArray(scopedValue).map((ordering) => castOrderingToString(ordering)).join(",");
27
45
  value = `[${v}]`;
28
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildQueryURL.cjs","sources":["../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\";\n\nimport type { ValueOf } from \"./types/utils\";\nimport type { Ordering, Route } from \"./types/client\";\n\n/**\n * Parameters for the Prismic REST API V2.\n *\n * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}\n */\nexport interface QueryParams {\n\t/**\n\t * The secure token for accessing the API (only needed if your repository is\n\t * set to private).\n\t *\n\t * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}\n\t */\n\taccessToken?: string;\n\n\t/**\n\t * The `pageSize` parameter defines the maximum number of documents that the\n\t * API will return for your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#pagesize}\n\t */\n\tpageSize?: number;\n\n\t/**\n\t * The `page` parameter defines the pagination for the result of your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#page}\n\t */\n\tpage?: number;\n\n\t/**\n\t * The `after` parameter can be used along with the orderings option. It will\n\t * remove all the documents except for those after the specified document in\n\t * the list.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}\n\t */\n\tafter?: string;\n\n\t/**\n\t * The `fetch` parameter is used to make queries faster by only retrieving the\n\t * specified field(s).\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetch}\n\t */\n\tfetch?: string | string[];\n\n\t/**\n\t * The `fetchLinks` parameter allows you to retrieve a specific content field\n\t * from a linked document and add it to the document response object.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetchlinks}\n\t */\n\tfetchLinks?: string | string[];\n\n\t/**\n\t * The `graphQuery` parameter allows you to specify which fields to retrieve\n\t * and what content to retrieve from Linked Documents / Content\n\t * Relationships.\n\t *\n\t * {@link https://prismic.io/docs/technologies/graphquery-rest-api}\n\t */\n\tgraphQuery?: string;\n\n\t/**\n\t * The `lang` option defines the language code for the results of your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#lang}\n\t */\n\tlang?: string;\n\n\t/**\n\t * The `orderings` parameter orders the results by the specified field(s). You\n\t * can specify as many fields as you want.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}\n\t */\n\torderings?: Ordering | string | (Ordering | string)[];\n\n\t/**\n\t * The `routes` option allows you to define how a document's `url` field is\n\t * resolved.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}\n\t */\n\troutes?: Route | string | (Route | string)[];\n\n\t/**\n\t * The `brokenRoute` option allows you to define the route populated in the\n\t * `url` property for broken Link or Content Relationship fields. A broken\n\t * link is a Link or Content Relationship field whose linked document has been\n\t * unpublished or deleted.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}\n\t */\n\tbrokenRoute?: string;\n}\n\n/**\n * Arguments for `buildQueryURL` to construct a Query URL.\n */\ntype BuildQueryURLParams = {\n\t/**\n\t * Ref used to query documents.\n\t *\n\t * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}\n\t */\n\tref: string;\n\n\t/**\n\t * Ref used to populate Integration Fields with the latest content.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/integration-fields}\n\t */\n\tintegrationFieldsRef?: string;\n\n\t/**\n\t * One or more predicates to filter documents for the query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}\n\t */\n\tpredicates?: string | string[];\n};\n\n/**\n * Parameters in this map have been renamed from the official Prismic REST API\n * V2 specification for better developer ergonomics.\n *\n * These parameters are renamed to their mapped value.\n */\nconst RENAMED_PARAMS = {\n\taccessToken: \"access_token\",\n} as const;\n\n/**\n * A valid parameter name for the Prismic REST API V2.\n */\ntype ValidParamName =\n\t| Exclude<\n\t\t\tkeyof QueryParams,\n\t\t\tkeyof typeof RENAMED_PARAMS | keyof BuildQueryURLParams\n\t >\n\t| ValueOf<typeof RENAMED_PARAMS>;\n\n/**\n * Converts an Ordering to a string that is compatible with Prismic's REST API.\n * If the value provided is already a string, no conversion is performed.\n *\n * @param ordering - Ordering to convert.\n *\n * @returns String representation of the Ordering.\n */\nconst castOrderingToString = (ordering: Ordering | string): string =>\n\ttypeof ordering === \"string\"\n\t\t? ordering\n\t\t: [\n\t\t\t\tordering.field,\n\t\t\t\tordering.direction === \"desc\" ? ordering.direction : undefined,\n\t\t ]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \");\n\nexport type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;\n\n/**\n * Build a Prismic REST API V2 URL to request documents from a repository. The\n * paginated response for this URL includes documents matching the parameters.\n *\n * A ref is required to make a request. Request the `endpoint` URL to retrieve a\n * list of available refs.\n *\n * Type the JSON response with `Query`.\n *\n * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}\n * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}\n *\n * @param endpoint - URL to the repository's REST API V2.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request documents from the repository.\n */\nexport const buildQueryURL = (\n\tendpoint: string,\n\targs: BuildQueryURLArgs,\n): string => {\n\tconst { predicates, ...params } = args;\n\n\tconst url = new URL(`documents/search`, `${endpoint}/`);\n\n\tif (predicates) {\n\t\tfor (const predicate of castArray(predicates)) {\n\t\t\turl.searchParams.append(\"q\", `[${predicate}]`);\n\t\t}\n\t}\n\n\t// Iterate over each parameter and add it to the URL. In some cases, the\n\t// parameter value needs to be transformed to fit the REST API.\n\tfor (const k in params) {\n\t\tconst name = (RENAMED_PARAMS[k as keyof typeof RENAMED_PARAMS] ??\n\t\t\tk) as ValidParamName;\n\n\t\tlet value = params[k as keyof typeof params];\n\n\t\tif (name === \"orderings\") {\n\t\t\tconst scopedValue = params[name];\n\n\t\t\tif (scopedValue != null) {\n\t\t\t\tconst v = castArray(scopedValue)\n\t\t\t\t\t.map((ordering) => castOrderingToString(ordering))\n\t\t\t\t\t.join(\",\");\n\n\t\t\t\tvalue = `[${v}]`;\n\t\t\t}\n\t\t} else if (name === \"routes\") {\n\t\t\tif (typeof params[name] === \"object\") {\n\t\t\t\tvalue = JSON.stringify(castArray(params[name]));\n\t\t\t}\n\t\t}\n\n\t\tif (value != null) {\n\t\t\turl.searchParams.set(name, castArray(value).join(\",\"));\n\t\t}\n\t}\n\n\treturn url.toString();\n};\n"],"names":["castArray"],"mappings":";;;AAsIA,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAC7B,OAAO,aAAa,WACjB,WACA;AAAA,EACA,SAAS;AAAA,EACT,SAAS,cAAc,SAAS,SAAS,YAAY;AACpD,EACA,OAAO,OAAO,EACd,KAAK,GAAG;AAqBA,MAAA,gBAAgB,CAC5B,UACA,SACW;;AACL,QAAA,EAAE,eAAe,OAAA,IAAW;AAElC,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,WAAW;AAEtD,MAAI,YAAY;AACJ,eAAA,aAAaA,oBAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,YAAY;AAAA,IAC7C;AAAA,EACD;AAID,aAAW,KAAK,QAAQ;AACjB,UAAA,QAAQ,oBAAe,OAAf,YACb;AAED,QAAI,QAAQ,OAAO;AAEnB,QAAI,SAAS,aAAa;AACzB,YAAM,cAAc,OAAO;AAE3B,UAAI,eAAe,MAAM;AACxB,cAAM,IAAIA,UAAAA,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI;AAAA,MACZ;AAAA,IAAA,WACS,SAAS,UAAU;AACzB,UAAA,OAAO,OAAO,UAAU,UAAU;AACrC,gBAAQ,KAAK,UAAUA,UAAAA,UAAU,OAAO,KAAK,CAAC;AAAA,MAC9C;AAAA,IACD;AAED,QAAI,SAAS,MAAM;AACd,UAAA,aAAa,IAAI,MAAMA,UAAAA,UAAU,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IACrD;AAAA,EACD;AAED,SAAO,IAAI;AACZ;;"}
1
+ {"version":3,"file":"buildQueryURL.cjs","sources":["../../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\";\nimport { devMsg } from \"./lib/devMsg\";\n\n/**\n * Create a union of the given object's values, and optionally specify which\n * keys to get the values from.\n *\n * Taken from the `type-fest` package.\n *\n * See:\n * https://github.com/sindresorhus/type-fest/blob/61c35052f09caa23de5eef96d95196375d8ed498/source/value-of.d.ts\n */\ntype ValueOf<\n\tObjectType,\n\tValueType extends keyof ObjectType = keyof ObjectType,\n> = ObjectType[ValueType];\n\n/**\n * An `orderings` parameter that orders the results by the specified field.\n *\n * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}\n */\nexport interface Ordering {\n\tfield: string;\n\tdirection?: \"asc\" | \"desc\";\n}\n\n/**\n * A `routes` parameter that determines how a document's URL field is resolved.\n *\n * {@link https://prismic.io/docs/route-resolver}\n *\n * @example With a document's UID field.\n *\n * ```ts\n * {\n * \t\"type\": \"page\",\n * \t\"path\": \"/:uid\"\n * }\n * ```\n *\n * @example With a Content Relationship `parent` field.\n *\n * ```ts\n * {\n * \t\"type\": \"page\",\n * \t\"path\": \"/:parent?/:uid\",\n * \t\"resolvers\": {\n * \t\t\"parent\": \"parent\"\n * \t}\n * }\n * ```\n */\nexport interface Route {\n\t/**\n\t * The Custom Type of the document.\n\t */\n\ttype: string;\n\n\t/**\n\t * A specific UID to which this route definition is scoped. The route is only\n\t * defined for the document whose UID matches the given UID.\n\t */\n\tuid?: string;\n\n\t/**\n\t * A specific language to which this route definition is scoped. The route is\n\t * only defined for documents whose language matches the given language.\n\t */\n\tlang?: string;\n\n\t/**\n\t * The resolved path of the document with optional placeholders.\n\t */\n\tpath: string;\n\n\t/**\n\t * An object that lists the API IDs of the Content Relationships in the route.\n\t */\n\tresolvers?: Record<string, string>;\n}\n\n/**\n * Parameters for the Prismic REST API V2.\n *\n * {@link https://prismic.io/docs/api}\n */\nexport interface QueryParams {\n\t/**\n\t * The secure token for accessing the API (only needed if your repository is\n\t * set to private).\n\t *\n\t * {@link https://prismic.io/docs/access-token}\n\t */\n\taccessToken?: string;\n\n\t/**\n\t * The `pageSize` parameter defines the maximum number of documents that the\n\t * API will return for your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}\n\t */\n\tpageSize?: number;\n\n\t/**\n\t * The `page` parameter defines the pagination for the result of your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#page}\n\t */\n\tpage?: number;\n\n\t/**\n\t * The `after` parameter can be used along with the orderings option. It will\n\t * remove all the documents except for those after the specified document in\n\t * the list.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#after}\n\t */\n\tafter?: string;\n\n\t/**\n\t * The `fetch` parameter is used to make queries faster by only retrieving the\n\t * specified field(s).\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#fetch}\n\t */\n\tfetch?: string | string[];\n\n\t/**\n\t * The `fetchLinks` parameter allows you to retrieve a specific content field\n\t * from a linked document and add it to the document response object.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}\n\t */\n\tfetchLinks?: string | string[];\n\n\t/**\n\t * The `graphQuery` parameter allows you to specify which fields to retrieve\n\t * and what content to retrieve from Linked Documents / Content\n\t * Relationships.\n\t *\n\t * {@link https://prismic.io/docs/graphquery-rest-api}\n\t */\n\tgraphQuery?: string;\n\n\t/**\n\t * The `lang` option defines the language code for the results of your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#lang}\n\t */\n\tlang?: string;\n\n\t/**\n\t * The `orderings` parameter orders the results by the specified field(s). You\n\t * can specify as many fields as you want.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}\n\t *\n\t * @remarks Strings and arrays of strings are deprecated as of\n\t * `@prismicio/client@7.0.0`. Please migrate to the more explicit\n\t * array of objects.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * buildQueryURL(endpoint,{\n\t * orderings: [\n\t * { field: \"my.product.price\", direction: \"desc\" },\n\t * { field: \"my.product.title\" },\n\t * ],\n\t * });\n\t * ```\n\t */\n\t// TODO: Update TSDoc with deprecated API removal in v8\n\torderings?: string | Ordering | (string | Ordering)[];\n\n\t/**\n\t * The `routes` option allows you to define how a document's `url` field is\n\t * resolved.\n\t *\n\t * {@link https://prismic.io/docs/route-resolver}\n\t */\n\troutes?: Route | string | (Route | string)[];\n\n\t/**\n\t * The `brokenRoute` option allows you to define the route populated in the\n\t * `url` property for broken Link or Content Relationship fields. A broken\n\t * link is a Link or Content Relationship field whose linked document has been\n\t * unpublished or deleted.\n\t *\n\t * {@link https://prismic.io/docs/route-resolver}\n\t */\n\tbrokenRoute?: string;\n}\n\n/**\n * Arguments for `buildQueryURL` to construct a Query URL.\n */\ntype BuildQueryURLParams = {\n\t/**\n\t * Ref used to query documents.\n\t *\n\t * {@link https://prismic.io/docs/api#refs-and-the-entry-api}\n\t */\n\tref: string;\n\n\t/**\n\t * Ref used to populate Integration Fields with the latest content.\n\t *\n\t * {@link https://prismic.io/docs/integration-fields}\n\t */\n\tintegrationFieldsRef?: string;\n\n\t/**\n\t * One or more filters to filter documents for the query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#q}\n\t */\n\tfilters?: string | string[];\n\n\t/**\n\t * @deprecated Renamed to `filters`. Ensure the value is an array of filters, not a single, non-array filter.\n\t */\n\tpredicates?: string | string[];\n};\n\n/**\n * Parameters in this map have been renamed from the official Prismic REST API\n * V2 specification for better developer ergonomics.\n *\n * These parameters are renamed to their mapped value.\n */\nconst RENAMED_PARAMS = {\n\taccessToken: \"access_token\",\n} as const;\n\n/**\n * A valid parameter name for the Prismic REST API V2.\n */\ntype ValidParamName =\n\t| Exclude<\n\t\t\tkeyof QueryParams,\n\t\t\tkeyof typeof RENAMED_PARAMS | keyof BuildQueryURLParams\n\t >\n\t| ValueOf<typeof RENAMED_PARAMS>;\n\n/**\n * Converts an Ordering to a string that is compatible with Prismic's REST API.\n * If the value provided is already a string, no conversion is performed.\n *\n * @param ordering - Ordering to convert.\n *\n * @returns String representation of the Ordering.\n */\nconst castOrderingToString = (ordering: Ordering | string): string => {\n\t// TODO: Remove the following when `orderings` strings are no longer supported.\n\tif (typeof ordering === \"string\") {\n\t\tif (process.env.NODE_ENV === \"development\") {\n\t\t\tconst [field, direction] = ordering.split(\" \");\n\n\t\t\tconst objectForm =\n\t\t\t\tdirection === \"desc\"\n\t\t\t\t\t? `{ field: \"${field}\", direction: \"desc\" }`\n\t\t\t\t\t: `{ field: \"${field}\" }`;\n\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] A string value was provided to the \\`orderings\\` query parameter. Strings are deprecated. Please convert it to the object form: ${objectForm}. For more details, see ${devMsg(\n\t\t\t\t\t\"orderings-must-be-an-array-of-objects\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\treturn ordering;\n\t}\n\n\treturn ordering.direction === \"desc\"\n\t\t? `${ordering.field} desc`\n\t\t: ordering.field;\n};\n\nexport type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;\n\n/**\n * Build a Prismic REST API V2 URL to request documents from a repository. The\n * paginated response for this URL includes documents matching the parameters.\n *\n * A ref is required to make a request. Request the `endpoint` URL to retrieve a\n * list of available refs.\n *\n * Type the JSON response with `Query`.\n *\n * {@link https://prismic.io/docs/api#refs-and-the-entry-api}\n * {@link https://prismic.io/docs/rest-api-technical-reference}\n *\n * @param endpoint - URL to the repository's REST API V2.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request documents from the repository.\n */\nexport const buildQueryURL = (\n\tendpoint: string,\n\targs: BuildQueryURLArgs,\n): string => {\n\tconst { filters, predicates, ...params } = args;\n\n\tconst url = new URL(`documents/search`, `${endpoint}/`);\n\n\tif (filters) {\n\t\t// TODO: Remove warning when we remove support for string `filters` values.\n\t\tif (process.env.NODE_ENV === \"development\" && !Array.isArray(filters)) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] A non-array value was provided to the \\`filters\\` query parameter (\\`${filters}\\`). Non-array values are deprecated. Please convert it to an array. For more details, see ${devMsg(\n\t\t\t\t\t\"filters-must-be-an-array\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// TODO: Remove `castArray` when we remove support for string `filters` values.\n\t\tfor (const filter of castArray(filters)) {\n\t\t\turl.searchParams.append(\"q\", `[${filter}]`);\n\t\t}\n\t}\n\n\t// TODO: Remove when we remove support for deprecated `predicates` argument.\n\tif (predicates) {\n\t\tfor (const predicate of castArray(predicates)) {\n\t\t\turl.searchParams.append(\"q\", `[${predicate}]`);\n\t\t}\n\t}\n\n\t// Iterate over each parameter and add it to the URL. In some cases, the\n\t// parameter value needs to be transformed to fit the REST API.\n\tfor (const k in params) {\n\t\tconst name = (RENAMED_PARAMS[k as keyof typeof RENAMED_PARAMS] ||\n\t\t\tk) as ValidParamName;\n\n\t\tlet value = params[k as keyof typeof params];\n\n\t\tif (name === \"orderings\") {\n\t\t\tconst scopedValue = params[name];\n\n\t\t\tif (scopedValue != null) {\n\t\t\t\t// TODO: Remove the following warning when `orderings` strings are no longer supported.\n\t\t\t\tif (\n\t\t\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t\t\ttypeof scopedValue === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[@prismicio/client] A string value was provided to the \\`orderings\\` query parameter. Strings are deprecated. Please convert it to an array of objects. For more details, see ${devMsg(\n\t\t\t\t\t\t\t\"orderings-must-be-an-array-of-objects\",\n\t\t\t\t\t\t)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst v = castArray(scopedValue)\n\t\t\t\t\t.map((ordering) => castOrderingToString(ordering))\n\t\t\t\t\t.join(\",\");\n\n\t\t\t\tvalue = `[${v}]`;\n\t\t\t}\n\t\t} else if (name === \"routes\") {\n\t\t\tif (typeof params[name] === \"object\") {\n\t\t\t\tvalue = JSON.stringify(castArray(params[name]));\n\t\t\t}\n\t\t}\n\n\t\tif (value != null) {\n\t\t\turl.searchParams.set(\n\t\t\t\tname,\n\t\t\t\tcastArray<string | number | Route | Ordering>(value).join(\",\"),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn url.toString();\n};\n"],"names":["devMsg","castArray"],"mappings":";;;;AAwOA,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAAuC;AAEhE,MAAA,OAAO,aAAa,UAAU;AAC7B,QAAA,QAAQ,IAAI,aAAa,eAAe;AAC3C,YAAM,CAAC,OAAO,SAAS,IAAI,SAAS,MAAM,GAAG;AAE7C,YAAM,aACL,cAAc,SACX,aAAa,gCACb,aAAa;AAEjB,cAAQ,KACP,uJAAuJ,qCAAqCA,cAC3L,uCAAuC,GACrC;AAAA,IAEJ;AAEM,WAAA;AAAA,EACP;AAED,SAAO,SAAS,cAAc,SAC3B,GAAG,SAAS,eACZ,SAAS;AACb;AAqBa,MAAA,gBAAgB,CAC5B,UACA,SACW;AACX,QAAM,EAAE,SAAS,YAAY,GAAG,WAAW;AAE3C,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,WAAW;AAEtD,MAAI,SAAS;AAER,QAAA,QAAQ,IAAI,aAAa,iBAAiB,CAAC,MAAM,QAAQ,OAAO,GAAG;AACtE,cAAQ,KACP,4FAA4F,qGAAqGA,cAChM,0BAA0B,GACxB;AAAA,IAEJ;AAGU,eAAA,UAAUC,oBAAU,OAAO,GAAG;AACxC,UAAI,aAAa,OAAO,KAAK,IAAI,SAAS;AAAA,IAC1C;AAAA,EACD;AAGD,MAAI,YAAY;AACJ,eAAA,aAAaA,oBAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,YAAY;AAAA,IAC7C;AAAA,EACD;AAID,aAAW,KAAK,QAAQ;AACjB,UAAA,OAAQ,eAAe,CAAgC,KAC5D;AAEG,QAAA,QAAQ,OAAO,CAAwB;AAE3C,QAAI,SAAS,aAAa;AACnB,YAAA,cAAc,OAAO,IAAI;AAE/B,UAAI,eAAe,MAAM;AAExB,YACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,UACtB;AACD,kBAAQ,KACP,iLAAiLD,OAChL,OAAA,uCAAuC,GACrC;AAAA,QAEJ;AAED,cAAM,IAAIC,UAAAA,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI;AAAA,MACZ;AAAA,IAAA,WACS,SAAS,UAAU;AAC7B,UAAI,OAAO,OAAO,IAAI,MAAM,UAAU;AACrC,gBAAQ,KAAK,UAAUA,UAAAA,UAAU,OAAO,IAAI,CAAC,CAAC;AAAA,MAC9C;AAAA,IACD;AAED,QAAI,SAAS,MAAM;AACd,UAAA,aAAa,IAChB,MACAA,UAAAA,UAA8C,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IAE/D;AAAA,EACD;AAED,SAAO,IAAI;AACZ;;"}
@@ -1,130 +1,207 @@
1
- import type { Ordering, Route } from "./types/client";
2
- /**
3
- * Parameters for the Prismic REST API V2.
4
- *
5
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}
6
- */
7
- export interface QueryParams {
8
- /**
9
- * The secure token for accessing the API (only needed if your repository is
10
- * set to private).
11
- *
12
- * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
13
- */
14
- accessToken?: string;
15
- /**
16
- * The `pageSize` parameter defines the maximum number of documents that the
17
- * API will return for your query.
18
- *
19
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#pagesize}
20
- */
21
- pageSize?: number;
22
- /**
23
- * The `page` parameter defines the pagination for the result of your query.
24
- *
25
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#page}
26
- */
27
- page?: number;
28
- /**
29
- * The `after` parameter can be used along with the orderings option. It will
30
- * remove all the documents except for those after the specified document in
31
- * the list.
32
- *
33
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}
34
- */
35
- after?: string;
36
- /**
37
- * The `fetch` parameter is used to make queries faster by only retrieving the
38
- * specified field(s).
39
- *
40
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetch}
41
- */
42
- fetch?: string | string[];
43
- /**
44
- * The `fetchLinks` parameter allows you to retrieve a specific content field
45
- * from a linked document and add it to the document response object.
46
- *
47
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetchlinks}
48
- */
49
- fetchLinks?: string | string[];
50
- /**
51
- * The `graphQuery` parameter allows you to specify which fields to retrieve
52
- * and what content to retrieve from Linked Documents / Content
53
- * Relationships.
54
- *
55
- * {@link https://prismic.io/docs/technologies/graphquery-rest-api}
56
- */
57
- graphQuery?: string;
58
- /**
59
- * The `lang` option defines the language code for the results of your query.
60
- *
61
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#lang}
62
- */
63
- lang?: string;
64
- /**
65
- * The `orderings` parameter orders the results by the specified field(s). You
66
- * can specify as many fields as you want.
67
- *
68
- * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}
69
- */
70
- orderings?: Ordering | string | (Ordering | string)[];
71
- /**
72
- * The `routes` option allows you to define how a document's `url` field is
73
- * resolved.
74
- *
75
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
76
- */
77
- routes?: Route | string | (Route | string)[];
78
- /**
79
- * The `brokenRoute` option allows you to define the route populated in the
80
- * `url` property for broken Link or Content Relationship fields. A broken
81
- * link is a Link or Content Relationship field whose linked document has been
82
- * unpublished or deleted.
83
- *
84
- * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
85
- */
86
- brokenRoute?: string;
87
- }
88
- /**
89
- * Arguments for `buildQueryURL` to construct a Query URL.
90
- */
91
- declare type BuildQueryURLParams = {
92
- /**
93
- * Ref used to query documents.
94
- *
95
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
96
- */
97
- ref: string;
98
- /**
99
- * Ref used to populate Integration Fields with the latest content.
100
- *
101
- * {@link https://prismic.io/docs/core-concepts/integration-fields}
102
- */
103
- integrationFieldsRef?: string;
104
- /**
105
- * One or more predicates to filter documents for the query.
106
- *
107
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
108
- */
109
- predicates?: string | string[];
110
- };
111
- export declare type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
112
- /**
113
- * Build a Prismic REST API V2 URL to request documents from a repository. The
114
- * paginated response for this URL includes documents matching the parameters.
115
- *
116
- * A ref is required to make a request. Request the `endpoint` URL to retrieve a
117
- * list of available refs.
118
- *
119
- * Type the JSON response with `Query`.
120
- *
121
- * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}
122
- * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}
123
- *
124
- * @param endpoint - URL to the repository's REST API V2.
125
- * @param args - Arguments to filter and scope the query.
126
- *
127
- * @returns URL that can be used to request documents from the repository.
128
- */
129
- export declare const buildQueryURL: (endpoint: string, args: BuildQueryURLArgs) => string;
130
- export {};
1
+ /**
2
+ * An `orderings` parameter that orders the results by the specified field.
3
+ *
4
+ * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
5
+ */
6
+ export interface Ordering {
7
+ field: string;
8
+ direction?: "asc" | "desc";
9
+ }
10
+ /**
11
+ * A `routes` parameter that determines how a document's URL field is resolved.
12
+ *
13
+ * {@link https://prismic.io/docs/route-resolver}
14
+ *
15
+ * @example With a document's UID field.
16
+ *
17
+ * ```ts
18
+ * {
19
+ * "type": "page",
20
+ * "path": "/:uid"
21
+ * }
22
+ * ```
23
+ *
24
+ * @example With a Content Relationship `parent` field.
25
+ *
26
+ * ```ts
27
+ * {
28
+ * "type": "page",
29
+ * "path": "/:parent?/:uid",
30
+ * "resolvers": {
31
+ * "parent": "parent"
32
+ * }
33
+ * }
34
+ * ```
35
+ */
36
+ export interface Route {
37
+ /**
38
+ * The Custom Type of the document.
39
+ */
40
+ type: string;
41
+ /**
42
+ * A specific UID to which this route definition is scoped. The route is only
43
+ * defined for the document whose UID matches the given UID.
44
+ */
45
+ uid?: string;
46
+ /**
47
+ * A specific language to which this route definition is scoped. The route is
48
+ * only defined for documents whose language matches the given language.
49
+ */
50
+ lang?: string;
51
+ /**
52
+ * The resolved path of the document with optional placeholders.
53
+ */
54
+ path: string;
55
+ /**
56
+ * An object that lists the API IDs of the Content Relationships in the route.
57
+ */
58
+ resolvers?: Record<string, string>;
59
+ }
60
+ /**
61
+ * Parameters for the Prismic REST API V2.
62
+ *
63
+ * {@link https://prismic.io/docs/api}
64
+ */
65
+ export interface QueryParams {
66
+ /**
67
+ * The secure token for accessing the API (only needed if your repository is
68
+ * set to private).
69
+ *
70
+ * {@link https://prismic.io/docs/access-token}
71
+ */
72
+ accessToken?: string;
73
+ /**
74
+ * The `pageSize` parameter defines the maximum number of documents that the
75
+ * API will return for your query.
76
+ *
77
+ * {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}
78
+ */
79
+ pageSize?: number;
80
+ /**
81
+ * The `page` parameter defines the pagination for the result of your query.
82
+ *
83
+ * {@link https://prismic.io/docs/rest-api-technical-reference#page}
84
+ */
85
+ page?: number;
86
+ /**
87
+ * The `after` parameter can be used along with the orderings option. It will
88
+ * remove all the documents except for those after the specified document in
89
+ * the list.
90
+ *
91
+ * {@link https://prismic.io/docs/rest-api-technical-reference#after}
92
+ */
93
+ after?: string;
94
+ /**
95
+ * The `fetch` parameter is used to make queries faster by only retrieving the
96
+ * specified field(s).
97
+ *
98
+ * {@link https://prismic.io/docs/rest-api-technical-reference#fetch}
99
+ */
100
+ fetch?: string | string[];
101
+ /**
102
+ * The `fetchLinks` parameter allows you to retrieve a specific content field
103
+ * from a linked document and add it to the document response object.
104
+ *
105
+ * {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}
106
+ */
107
+ fetchLinks?: string | string[];
108
+ /**
109
+ * The `graphQuery` parameter allows you to specify which fields to retrieve
110
+ * and what content to retrieve from Linked Documents / Content
111
+ * Relationships.
112
+ *
113
+ * {@link https://prismic.io/docs/graphquery-rest-api}
114
+ */
115
+ graphQuery?: string;
116
+ /**
117
+ * The `lang` option defines the language code for the results of your query.
118
+ *
119
+ * {@link https://prismic.io/docs/rest-api-technical-reference#lang}
120
+ */
121
+ lang?: string;
122
+ /**
123
+ * The `orderings` parameter orders the results by the specified field(s). You
124
+ * can specify as many fields as you want.
125
+ *
126
+ * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
127
+ *
128
+ * @remarks Strings and arrays of strings are deprecated as of
129
+ * `@prismicio/client@7.0.0`. Please migrate to the more explicit
130
+ * array of objects.
131
+ *
132
+ * @example
133
+ *
134
+ * ```typescript
135
+ * buildQueryURL(endpoint,{
136
+ * orderings: [
137
+ * { field: "my.product.price", direction: "desc" },
138
+ * { field: "my.product.title" },
139
+ * ],
140
+ * });
141
+ * ```
142
+ */
143
+ orderings?: string | Ordering | (string | Ordering)[];
144
+ /**
145
+ * The `routes` option allows you to define how a document's `url` field is
146
+ * resolved.
147
+ *
148
+ * {@link https://prismic.io/docs/route-resolver}
149
+ */
150
+ routes?: Route | string | (Route | string)[];
151
+ /**
152
+ * The `brokenRoute` option allows you to define the route populated in the
153
+ * `url` property for broken Link or Content Relationship fields. A broken
154
+ * link is a Link or Content Relationship field whose linked document has been
155
+ * unpublished or deleted.
156
+ *
157
+ * {@link https://prismic.io/docs/route-resolver}
158
+ */
159
+ brokenRoute?: string;
160
+ }
161
+ /**
162
+ * Arguments for `buildQueryURL` to construct a Query URL.
163
+ */
164
+ type BuildQueryURLParams = {
165
+ /**
166
+ * Ref used to query documents.
167
+ *
168
+ * {@link https://prismic.io/docs/api#refs-and-the-entry-api}
169
+ */
170
+ ref: string;
171
+ /**
172
+ * Ref used to populate Integration Fields with the latest content.
173
+ *
174
+ * {@link https://prismic.io/docs/integration-fields}
175
+ */
176
+ integrationFieldsRef?: string;
177
+ /**
178
+ * One or more filters to filter documents for the query.
179
+ *
180
+ * {@link https://prismic.io/docs/rest-api-technical-reference#q}
181
+ */
182
+ filters?: string | string[];
183
+ /**
184
+ * @deprecated Renamed to `filters`. Ensure the value is an array of filters, not a single, non-array filter.
185
+ */
186
+ predicates?: string | string[];
187
+ };
188
+ export type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
189
+ /**
190
+ * Build a Prismic REST API V2 URL to request documents from a repository. The
191
+ * paginated response for this URL includes documents matching the parameters.
192
+ *
193
+ * A ref is required to make a request. Request the `endpoint` URL to retrieve a
194
+ * list of available refs.
195
+ *
196
+ * Type the JSON response with `Query`.
197
+ *
198
+ * {@link https://prismic.io/docs/api#refs-and-the-entry-api}
199
+ * {@link https://prismic.io/docs/rest-api-technical-reference}
200
+ *
201
+ * @param endpoint - URL to the repository's REST API V2.
202
+ * @param args - Arguments to filter and scope the query.
203
+ *
204
+ * @returns URL that can be used to request documents from the repository.
205
+ */
206
+ export declare const buildQueryURL: (endpoint: string, args: BuildQueryURLArgs) => string;
207
+ export {};
@@ -1,26 +1,44 @@
1
1
  import { castArray } from "./lib/castArray.js";
2
+ import { devMsg } from "./lib/devMsg.js";
2
3
  const RENAMED_PARAMS = {
3
4
  accessToken: "access_token"
4
5
  };
5
- const castOrderingToString = (ordering) => typeof ordering === "string" ? ordering : [
6
- ordering.field,
7
- ordering.direction === "desc" ? ordering.direction : void 0
8
- ].filter(Boolean).join(" ");
6
+ const castOrderingToString = (ordering) => {
7
+ if (typeof ordering === "string") {
8
+ if (process.env.NODE_ENV === "development") {
9
+ const [field, direction] = ordering.split(" ");
10
+ const objectForm = direction === "desc" ? `{ field: "${field}", direction: "desc" }` : `{ field: "${field}" }`;
11
+ console.warn(`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to the object form: ${objectForm}. For more details, see ${devMsg("orderings-must-be-an-array-of-objects")}`);
12
+ }
13
+ return ordering;
14
+ }
15
+ return ordering.direction === "desc" ? `${ordering.field} desc` : ordering.field;
16
+ };
9
17
  const buildQueryURL = (endpoint, args) => {
10
- var _a;
11
- const { predicates, ...params } = args;
18
+ const { filters, predicates, ...params } = args;
12
19
  const url = new URL(`documents/search`, `${endpoint}/`);
20
+ if (filters) {
21
+ if (process.env.NODE_ENV === "development" && !Array.isArray(filters)) {
22
+ console.warn(`[@prismicio/client] A non-array value was provided to the \`filters\` query parameter (\`${filters}\`). Non-array values are deprecated. Please convert it to an array. For more details, see ${devMsg("filters-must-be-an-array")}`);
23
+ }
24
+ for (const filter of castArray(filters)) {
25
+ url.searchParams.append("q", `[${filter}]`);
26
+ }
27
+ }
13
28
  if (predicates) {
14
29
  for (const predicate of castArray(predicates)) {
15
30
  url.searchParams.append("q", `[${predicate}]`);
16
31
  }
17
32
  }
18
33
  for (const k in params) {
19
- const name = (_a = RENAMED_PARAMS[k]) != null ? _a : k;
34
+ const name = RENAMED_PARAMS[k] || k;
20
35
  let value = params[k];
21
36
  if (name === "orderings") {
22
37
  const scopedValue = params[name];
23
38
  if (scopedValue != null) {
39
+ if (process.env.NODE_ENV === "development" && typeof scopedValue === "string") {
40
+ console.warn(`[@prismicio/client] A string value was provided to the \`orderings\` query parameter. Strings are deprecated. Please convert it to an array of objects. For more details, see ${devMsg("orderings-must-be-an-array-of-objects")}`);
41
+ }
24
42
  const v = castArray(scopedValue).map((ordering) => castOrderingToString(ordering)).join(",");
25
43
  value = `[${v}]`;
26
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"buildQueryURL.js","sources":["../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\";\n\nimport type { ValueOf } from \"./types/utils\";\nimport type { Ordering, Route } from \"./types/client\";\n\n/**\n * Parameters for the Prismic REST API V2.\n *\n * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api}\n */\nexport interface QueryParams {\n\t/**\n\t * The secure token for accessing the API (only needed if your repository is\n\t * set to private).\n\t *\n\t * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}\n\t */\n\taccessToken?: string;\n\n\t/**\n\t * The `pageSize` parameter defines the maximum number of documents that the\n\t * API will return for your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#pagesize}\n\t */\n\tpageSize?: number;\n\n\t/**\n\t * The `page` parameter defines the pagination for the result of your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#page}\n\t */\n\tpage?: number;\n\n\t/**\n\t * The `after` parameter can be used along with the orderings option. It will\n\t * remove all the documents except for those after the specified document in\n\t * the list.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}\n\t */\n\tafter?: string;\n\n\t/**\n\t * The `fetch` parameter is used to make queries faster by only retrieving the\n\t * specified field(s).\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetch}\n\t */\n\tfetch?: string | string[];\n\n\t/**\n\t * The `fetchLinks` parameter allows you to retrieve a specific content field\n\t * from a linked document and add it to the document response object.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#fetchlinks}\n\t */\n\tfetchLinks?: string | string[];\n\n\t/**\n\t * The `graphQuery` parameter allows you to specify which fields to retrieve\n\t * and what content to retrieve from Linked Documents / Content\n\t * Relationships.\n\t *\n\t * {@link https://prismic.io/docs/technologies/graphquery-rest-api}\n\t */\n\tgraphQuery?: string;\n\n\t/**\n\t * The `lang` option defines the language code for the results of your query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#lang}\n\t */\n\tlang?: string;\n\n\t/**\n\t * The `orderings` parameter orders the results by the specified field(s). You\n\t * can specify as many fields as you want.\n\t *\n\t * {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#orderings}\n\t */\n\torderings?: Ordering | string | (Ordering | string)[];\n\n\t/**\n\t * The `routes` option allows you to define how a document's `url` field is\n\t * resolved.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}\n\t */\n\troutes?: Route | string | (Route | string)[];\n\n\t/**\n\t * The `brokenRoute` option allows you to define the route populated in the\n\t * `url` property for broken Link or Content Relationship fields. A broken\n\t * link is a Link or Content Relationship field whose linked document has been\n\t * unpublished or deleted.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}\n\t */\n\tbrokenRoute?: string;\n}\n\n/**\n * Arguments for `buildQueryURL` to construct a Query URL.\n */\ntype BuildQueryURLParams = {\n\t/**\n\t * Ref used to query documents.\n\t *\n\t * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}\n\t */\n\tref: string;\n\n\t/**\n\t * Ref used to populate Integration Fields with the latest content.\n\t *\n\t * {@link https://prismic.io/docs/core-concepts/integration-fields}\n\t */\n\tintegrationFieldsRef?: string;\n\n\t/**\n\t * One or more predicates to filter documents for the query.\n\t *\n\t * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}\n\t */\n\tpredicates?: string | string[];\n};\n\n/**\n * Parameters in this map have been renamed from the official Prismic REST API\n * V2 specification for better developer ergonomics.\n *\n * These parameters are renamed to their mapped value.\n */\nconst RENAMED_PARAMS = {\n\taccessToken: \"access_token\",\n} as const;\n\n/**\n * A valid parameter name for the Prismic REST API V2.\n */\ntype ValidParamName =\n\t| Exclude<\n\t\t\tkeyof QueryParams,\n\t\t\tkeyof typeof RENAMED_PARAMS | keyof BuildQueryURLParams\n\t >\n\t| ValueOf<typeof RENAMED_PARAMS>;\n\n/**\n * Converts an Ordering to a string that is compatible with Prismic's REST API.\n * If the value provided is already a string, no conversion is performed.\n *\n * @param ordering - Ordering to convert.\n *\n * @returns String representation of the Ordering.\n */\nconst castOrderingToString = (ordering: Ordering | string): string =>\n\ttypeof ordering === \"string\"\n\t\t? ordering\n\t\t: [\n\t\t\t\tordering.field,\n\t\t\t\tordering.direction === \"desc\" ? ordering.direction : undefined,\n\t\t ]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(\" \");\n\nexport type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;\n\n/**\n * Build a Prismic REST API V2 URL to request documents from a repository. The\n * paginated response for this URL includes documents matching the parameters.\n *\n * A ref is required to make a request. Request the `endpoint` URL to retrieve a\n * list of available refs.\n *\n * Type the JSON response with `Query`.\n *\n * {@link https://prismic.io/docs/technologies/introduction-to-the-content-query-api#prismic-api-ref}\n * {@link https://prismic.io/docs/technologies/query-predicates-reference-rest-api}\n *\n * @param endpoint - URL to the repository's REST API V2.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request documents from the repository.\n */\nexport const buildQueryURL = (\n\tendpoint: string,\n\targs: BuildQueryURLArgs,\n): string => {\n\tconst { predicates, ...params } = args;\n\n\tconst url = new URL(`documents/search`, `${endpoint}/`);\n\n\tif (predicates) {\n\t\tfor (const predicate of castArray(predicates)) {\n\t\t\turl.searchParams.append(\"q\", `[${predicate}]`);\n\t\t}\n\t}\n\n\t// Iterate over each parameter and add it to the URL. In some cases, the\n\t// parameter value needs to be transformed to fit the REST API.\n\tfor (const k in params) {\n\t\tconst name = (RENAMED_PARAMS[k as keyof typeof RENAMED_PARAMS] ??\n\t\t\tk) as ValidParamName;\n\n\t\tlet value = params[k as keyof typeof params];\n\n\t\tif (name === \"orderings\") {\n\t\t\tconst scopedValue = params[name];\n\n\t\t\tif (scopedValue != null) {\n\t\t\t\tconst v = castArray(scopedValue)\n\t\t\t\t\t.map((ordering) => castOrderingToString(ordering))\n\t\t\t\t\t.join(\",\");\n\n\t\t\t\tvalue = `[${v}]`;\n\t\t\t}\n\t\t} else if (name === \"routes\") {\n\t\t\tif (typeof params[name] === \"object\") {\n\t\t\t\tvalue = JSON.stringify(castArray(params[name]));\n\t\t\t}\n\t\t}\n\n\t\tif (value != null) {\n\t\t\turl.searchParams.set(name, castArray(value).join(\",\"));\n\t\t}\n\t}\n\n\treturn url.toString();\n};\n"],"names":[],"mappings":";AAsIA,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAC7B,OAAO,aAAa,WACjB,WACA;AAAA,EACA,SAAS;AAAA,EACT,SAAS,cAAc,SAAS,SAAS,YAAY;AACpD,EACA,OAAO,OAAO,EACd,KAAK,GAAG;AAqBA,MAAA,gBAAgB,CAC5B,UACA,SACW;;AACL,QAAA,EAAE,eAAe,OAAA,IAAW;AAElC,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,WAAW;AAEtD,MAAI,YAAY;AACJ,eAAA,aAAa,UAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,YAAY;AAAA,IAC7C;AAAA,EACD;AAID,aAAW,KAAK,QAAQ;AACjB,UAAA,QAAQ,oBAAe,OAAf,YACb;AAED,QAAI,QAAQ,OAAO;AAEnB,QAAI,SAAS,aAAa;AACzB,YAAM,cAAc,OAAO;AAE3B,UAAI,eAAe,MAAM;AACxB,cAAM,IAAI,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI;AAAA,MACZ;AAAA,IAAA,WACS,SAAS,UAAU;AACzB,UAAA,OAAO,OAAO,UAAU,UAAU;AACrC,gBAAQ,KAAK,UAAU,UAAU,OAAO,KAAK,CAAC;AAAA,MAC9C;AAAA,IACD;AAED,QAAI,SAAS,MAAM;AACd,UAAA,aAAa,IAAI,MAAM,UAAU,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IACrD;AAAA,EACD;AAED,SAAO,IAAI;AACZ;"}
1
+ {"version":3,"file":"buildQueryURL.js","sources":["../../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\";\nimport { devMsg } from \"./lib/devMsg\";\n\n/**\n * Create a union of the given object's values, and optionally specify which\n * keys to get the values from.\n *\n * Taken from the `type-fest` package.\n *\n * See:\n * https://github.com/sindresorhus/type-fest/blob/61c35052f09caa23de5eef96d95196375d8ed498/source/value-of.d.ts\n */\ntype ValueOf<\n\tObjectType,\n\tValueType extends keyof ObjectType = keyof ObjectType,\n> = ObjectType[ValueType];\n\n/**\n * An `orderings` parameter that orders the results by the specified field.\n *\n * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}\n */\nexport interface Ordering {\n\tfield: string;\n\tdirection?: \"asc\" | \"desc\";\n}\n\n/**\n * A `routes` parameter that determines how a document's URL field is resolved.\n *\n * {@link https://prismic.io/docs/route-resolver}\n *\n * @example With a document's UID field.\n *\n * ```ts\n * {\n * \t\"type\": \"page\",\n * \t\"path\": \"/:uid\"\n * }\n * ```\n *\n * @example With a Content Relationship `parent` field.\n *\n * ```ts\n * {\n * \t\"type\": \"page\",\n * \t\"path\": \"/:parent?/:uid\",\n * \t\"resolvers\": {\n * \t\t\"parent\": \"parent\"\n * \t}\n * }\n * ```\n */\nexport interface Route {\n\t/**\n\t * The Custom Type of the document.\n\t */\n\ttype: string;\n\n\t/**\n\t * A specific UID to which this route definition is scoped. The route is only\n\t * defined for the document whose UID matches the given UID.\n\t */\n\tuid?: string;\n\n\t/**\n\t * A specific language to which this route definition is scoped. The route is\n\t * only defined for documents whose language matches the given language.\n\t */\n\tlang?: string;\n\n\t/**\n\t * The resolved path of the document with optional placeholders.\n\t */\n\tpath: string;\n\n\t/**\n\t * An object that lists the API IDs of the Content Relationships in the route.\n\t */\n\tresolvers?: Record<string, string>;\n}\n\n/**\n * Parameters for the Prismic REST API V2.\n *\n * {@link https://prismic.io/docs/api}\n */\nexport interface QueryParams {\n\t/**\n\t * The secure token for accessing the API (only needed if your repository is\n\t * set to private).\n\t *\n\t * {@link https://prismic.io/docs/access-token}\n\t */\n\taccessToken?: string;\n\n\t/**\n\t * The `pageSize` parameter defines the maximum number of documents that the\n\t * API will return for your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}\n\t */\n\tpageSize?: number;\n\n\t/**\n\t * The `page` parameter defines the pagination for the result of your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#page}\n\t */\n\tpage?: number;\n\n\t/**\n\t * The `after` parameter can be used along with the orderings option. It will\n\t * remove all the documents except for those after the specified document in\n\t * the list.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#after}\n\t */\n\tafter?: string;\n\n\t/**\n\t * The `fetch` parameter is used to make queries faster by only retrieving the\n\t * specified field(s).\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#fetch}\n\t */\n\tfetch?: string | string[];\n\n\t/**\n\t * The `fetchLinks` parameter allows you to retrieve a specific content field\n\t * from a linked document and add it to the document response object.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}\n\t */\n\tfetchLinks?: string | string[];\n\n\t/**\n\t * The `graphQuery` parameter allows you to specify which fields to retrieve\n\t * and what content to retrieve from Linked Documents / Content\n\t * Relationships.\n\t *\n\t * {@link https://prismic.io/docs/graphquery-rest-api}\n\t */\n\tgraphQuery?: string;\n\n\t/**\n\t * The `lang` option defines the language code for the results of your query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#lang}\n\t */\n\tlang?: string;\n\n\t/**\n\t * The `orderings` parameter orders the results by the specified field(s). You\n\t * can specify as many fields as you want.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#orderings}\n\t *\n\t * @remarks Strings and arrays of strings are deprecated as of\n\t * `@prismicio/client@7.0.0`. Please migrate to the more explicit\n\t * array of objects.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * buildQueryURL(endpoint,{\n\t * orderings: [\n\t * { field: \"my.product.price\", direction: \"desc\" },\n\t * { field: \"my.product.title\" },\n\t * ],\n\t * });\n\t * ```\n\t */\n\t// TODO: Update TSDoc with deprecated API removal in v8\n\torderings?: string | Ordering | (string | Ordering)[];\n\n\t/**\n\t * The `routes` option allows you to define how a document's `url` field is\n\t * resolved.\n\t *\n\t * {@link https://prismic.io/docs/route-resolver}\n\t */\n\troutes?: Route | string | (Route | string)[];\n\n\t/**\n\t * The `brokenRoute` option allows you to define the route populated in the\n\t * `url` property for broken Link or Content Relationship fields. A broken\n\t * link is a Link or Content Relationship field whose linked document has been\n\t * unpublished or deleted.\n\t *\n\t * {@link https://prismic.io/docs/route-resolver}\n\t */\n\tbrokenRoute?: string;\n}\n\n/**\n * Arguments for `buildQueryURL` to construct a Query URL.\n */\ntype BuildQueryURLParams = {\n\t/**\n\t * Ref used to query documents.\n\t *\n\t * {@link https://prismic.io/docs/api#refs-and-the-entry-api}\n\t */\n\tref: string;\n\n\t/**\n\t * Ref used to populate Integration Fields with the latest content.\n\t *\n\t * {@link https://prismic.io/docs/integration-fields}\n\t */\n\tintegrationFieldsRef?: string;\n\n\t/**\n\t * One or more filters to filter documents for the query.\n\t *\n\t * {@link https://prismic.io/docs/rest-api-technical-reference#q}\n\t */\n\tfilters?: string | string[];\n\n\t/**\n\t * @deprecated Renamed to `filters`. Ensure the value is an array of filters, not a single, non-array filter.\n\t */\n\tpredicates?: string | string[];\n};\n\n/**\n * Parameters in this map have been renamed from the official Prismic REST API\n * V2 specification for better developer ergonomics.\n *\n * These parameters are renamed to their mapped value.\n */\nconst RENAMED_PARAMS = {\n\taccessToken: \"access_token\",\n} as const;\n\n/**\n * A valid parameter name for the Prismic REST API V2.\n */\ntype ValidParamName =\n\t| Exclude<\n\t\t\tkeyof QueryParams,\n\t\t\tkeyof typeof RENAMED_PARAMS | keyof BuildQueryURLParams\n\t >\n\t| ValueOf<typeof RENAMED_PARAMS>;\n\n/**\n * Converts an Ordering to a string that is compatible with Prismic's REST API.\n * If the value provided is already a string, no conversion is performed.\n *\n * @param ordering - Ordering to convert.\n *\n * @returns String representation of the Ordering.\n */\nconst castOrderingToString = (ordering: Ordering | string): string => {\n\t// TODO: Remove the following when `orderings` strings are no longer supported.\n\tif (typeof ordering === \"string\") {\n\t\tif (process.env.NODE_ENV === \"development\") {\n\t\t\tconst [field, direction] = ordering.split(\" \");\n\n\t\t\tconst objectForm =\n\t\t\t\tdirection === \"desc\"\n\t\t\t\t\t? `{ field: \"${field}\", direction: \"desc\" }`\n\t\t\t\t\t: `{ field: \"${field}\" }`;\n\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] A string value was provided to the \\`orderings\\` query parameter. Strings are deprecated. Please convert it to the object form: ${objectForm}. For more details, see ${devMsg(\n\t\t\t\t\t\"orderings-must-be-an-array-of-objects\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\treturn ordering;\n\t}\n\n\treturn ordering.direction === \"desc\"\n\t\t? `${ordering.field} desc`\n\t\t: ordering.field;\n};\n\nexport type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;\n\n/**\n * Build a Prismic REST API V2 URL to request documents from a repository. The\n * paginated response for this URL includes documents matching the parameters.\n *\n * A ref is required to make a request. Request the `endpoint` URL to retrieve a\n * list of available refs.\n *\n * Type the JSON response with `Query`.\n *\n * {@link https://prismic.io/docs/api#refs-and-the-entry-api}\n * {@link https://prismic.io/docs/rest-api-technical-reference}\n *\n * @param endpoint - URL to the repository's REST API V2.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request documents from the repository.\n */\nexport const buildQueryURL = (\n\tendpoint: string,\n\targs: BuildQueryURLArgs,\n): string => {\n\tconst { filters, predicates, ...params } = args;\n\n\tconst url = new URL(`documents/search`, `${endpoint}/`);\n\n\tif (filters) {\n\t\t// TODO: Remove warning when we remove support for string `filters` values.\n\t\tif (process.env.NODE_ENV === \"development\" && !Array.isArray(filters)) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] A non-array value was provided to the \\`filters\\` query parameter (\\`${filters}\\`). Non-array values are deprecated. Please convert it to an array. For more details, see ${devMsg(\n\t\t\t\t\t\"filters-must-be-an-array\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\t// TODO: Remove `castArray` when we remove support for string `filters` values.\n\t\tfor (const filter of castArray(filters)) {\n\t\t\turl.searchParams.append(\"q\", `[${filter}]`);\n\t\t}\n\t}\n\n\t// TODO: Remove when we remove support for deprecated `predicates` argument.\n\tif (predicates) {\n\t\tfor (const predicate of castArray(predicates)) {\n\t\t\turl.searchParams.append(\"q\", `[${predicate}]`);\n\t\t}\n\t}\n\n\t// Iterate over each parameter and add it to the URL. In some cases, the\n\t// parameter value needs to be transformed to fit the REST API.\n\tfor (const k in params) {\n\t\tconst name = (RENAMED_PARAMS[k as keyof typeof RENAMED_PARAMS] ||\n\t\t\tk) as ValidParamName;\n\n\t\tlet value = params[k as keyof typeof params];\n\n\t\tif (name === \"orderings\") {\n\t\t\tconst scopedValue = params[name];\n\n\t\t\tif (scopedValue != null) {\n\t\t\t\t// TODO: Remove the following warning when `orderings` strings are no longer supported.\n\t\t\t\tif (\n\t\t\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t\t\ttypeof scopedValue === \"string\"\n\t\t\t\t) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[@prismicio/client] A string value was provided to the \\`orderings\\` query parameter. Strings are deprecated. Please convert it to an array of objects. For more details, see ${devMsg(\n\t\t\t\t\t\t\t\"orderings-must-be-an-array-of-objects\",\n\t\t\t\t\t\t)}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst v = castArray(scopedValue)\n\t\t\t\t\t.map((ordering) => castOrderingToString(ordering))\n\t\t\t\t\t.join(\",\");\n\n\t\t\t\tvalue = `[${v}]`;\n\t\t\t}\n\t\t} else if (name === \"routes\") {\n\t\t\tif (typeof params[name] === \"object\") {\n\t\t\t\tvalue = JSON.stringify(castArray(params[name]));\n\t\t\t}\n\t\t}\n\n\t\tif (value != null) {\n\t\t\turl.searchParams.set(\n\t\t\t\tname,\n\t\t\t\tcastArray<string | number | Route | Ordering>(value).join(\",\"),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn url.toString();\n};\n"],"names":[],"mappings":";;AAwOA,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAAuC;AAEhE,MAAA,OAAO,aAAa,UAAU;AAC7B,QAAA,QAAQ,IAAI,aAAa,eAAe;AAC3C,YAAM,CAAC,OAAO,SAAS,IAAI,SAAS,MAAM,GAAG;AAE7C,YAAM,aACL,cAAc,SACX,aAAa,gCACb,aAAa;AAEjB,cAAQ,KACP,uJAAuJ,qCAAqC,OAC3L,uCAAuC,GACrC;AAAA,IAEJ;AAEM,WAAA;AAAA,EACP;AAED,SAAO,SAAS,cAAc,SAC3B,GAAG,SAAS,eACZ,SAAS;AACb;AAqBa,MAAA,gBAAgB,CAC5B,UACA,SACW;AACX,QAAM,EAAE,SAAS,YAAY,GAAG,WAAW;AAE3C,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,WAAW;AAEtD,MAAI,SAAS;AAER,QAAA,QAAQ,IAAI,aAAa,iBAAiB,CAAC,MAAM,QAAQ,OAAO,GAAG;AACtE,cAAQ,KACP,4FAA4F,qGAAqG,OAChM,0BAA0B,GACxB;AAAA,IAEJ;AAGU,eAAA,UAAU,UAAU,OAAO,GAAG;AACxC,UAAI,aAAa,OAAO,KAAK,IAAI,SAAS;AAAA,IAC1C;AAAA,EACD;AAGD,MAAI,YAAY;AACJ,eAAA,aAAa,UAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,YAAY;AAAA,IAC7C;AAAA,EACD;AAID,aAAW,KAAK,QAAQ;AACjB,UAAA,OAAQ,eAAe,CAAgC,KAC5D;AAEG,QAAA,QAAQ,OAAO,CAAwB;AAE3C,QAAI,SAAS,aAAa;AACnB,YAAA,cAAc,OAAO,IAAI;AAE/B,UAAI,eAAe,MAAM;AAExB,YACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,UACtB;AACD,kBAAQ,KACP,iLAAiL,OAChL,uCAAuC,GACrC;AAAA,QAEJ;AAED,cAAM,IAAI,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI;AAAA,MACZ;AAAA,IAAA,WACS,SAAS,UAAU;AAC7B,UAAI,OAAO,OAAO,IAAI,MAAM,UAAU;AACrC,gBAAQ,KAAK,UAAU,UAAU,OAAO,IAAI,CAAC,CAAC;AAAA,MAC9C;AAAA,IACD;AAED,QAAI,SAAS,MAAM;AACd,UAAA,aAAa,IAChB,MACA,UAA8C,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IAE/D;AAAA,EACD;AAED,SAAO,IAAI;AACZ;"}
package/dist/cookie.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const preview = "io.prismic.preview";
4
4
  exports.preview = preview;
5
5
  //# sourceMappingURL=cookie.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.cjs","sources":["../src/cookie.ts"],"sourcesContent":["/**\n * The well-known name of the cookie used to store a Prismic preview session's\n * ref.\n */\nexport const preview = \"io.prismic.preview\";\n"],"names":[],"mappings":";;AAIO,MAAM,UAAU;;"}
1
+ {"version":3,"file":"cookie.cjs","sources":["../../src/cookie.ts"],"sourcesContent":["/**\n * The well-known name of the cookie used to store a Prismic preview session's\n * ref.\n */\nexport const preview = \"io.prismic.preview\";\n"],"names":[],"mappings":";;AAIO,MAAM,UAAU;;"}
package/dist/cookie.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /**
2
- * The well-known name of the cookie used to store a Prismic preview session's
3
- * ref.
4
- */
5
- export declare const preview = "io.prismic.preview";
1
+ /**
2
+ * The well-known name of the cookie used to store a Prismic preview session's
3
+ * ref.
4
+ */
5
+ export declare const preview = "io.prismic.preview";
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","sources":["../src/cookie.ts"],"sourcesContent":["/**\n * The well-known name of the cookie used to store a Prismic preview session's\n * ref.\n */\nexport const preview = \"io.prismic.preview\";\n"],"names":[],"mappings":"AAIO,MAAM,UAAU;"}
1
+ {"version":3,"file":"cookie.js","sources":["../../src/cookie.ts"],"sourcesContent":["/**\n * The well-known name of the cookie used to store a Prismic preview session's\n * ref.\n */\nexport const preview = \"io.prismic.preview\";\n"],"names":[],"mappings":"AAIO,MAAM,UAAU;"}