@prismicio/client 7.21.0-alpha.2 → 7.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/dist/Client.cjs +1262 -0
  2. package/dist/Client.cjs.map +1 -0
  3. package/dist/Client.d.ts +981 -0
  4. package/dist/Client.js +1262 -0
  5. package/dist/Client.js.map +1 -0
  6. package/dist/Migration.cjs +297 -0
  7. package/dist/Migration.cjs.map +1 -0
  8. package/dist/Migration.d.ts +213 -0
  9. package/dist/Migration.js +297 -0
  10. package/dist/Migration.js.map +1 -0
  11. package/dist/WriteClient.cjs +575 -0
  12. package/dist/WriteClient.cjs.map +1 -0
  13. package/dist/WriteClient.d.ts +281 -0
  14. package/dist/WriteClient.js +575 -0
  15. package/dist/WriteClient.js.map +1 -0
  16. package/dist/buildQueryURL.cjs +66 -0
  17. package/dist/buildQueryURL.cjs.map +1 -0
  18. package/dist/buildQueryURL.d.ts +217 -0
  19. package/dist/buildQueryURL.js +66 -0
  20. package/dist/buildQueryURL.js.map +1 -0
  21. package/dist/cookie.cjs +5 -0
  22. package/dist/cookie.cjs.map +1 -0
  23. package/dist/cookie.d.ts +5 -0
  24. package/dist/cookie.js +5 -0
  25. package/dist/cookie.js.map +1 -0
  26. package/dist/createClient.cjs +6 -0
  27. package/dist/createClient.cjs.map +1 -0
  28. package/dist/createClient.d.ts +35 -0
  29. package/dist/createClient.js +6 -0
  30. package/dist/createClient.js.map +1 -0
  31. package/dist/createMigration.cjs +6 -0
  32. package/dist/createMigration.cjs.map +1 -0
  33. package/dist/createMigration.d.ts +24 -0
  34. package/dist/createMigration.js +6 -0
  35. package/dist/createMigration.js.map +1 -0
  36. package/dist/createWriteClient.cjs +6 -0
  37. package/dist/createWriteClient.cjs.map +1 -0
  38. package/dist/createWriteClient.d.ts +32 -0
  39. package/dist/createWriteClient.js +6 -0
  40. package/dist/createWriteClient.js.map +1 -0
  41. package/dist/errors/ForbiddenError.cjs +7 -0
  42. package/dist/errors/ForbiddenError.cjs.map +1 -0
  43. package/dist/errors/ForbiddenError.d.ts +11 -0
  44. package/dist/errors/ForbiddenError.js +7 -0
  45. package/dist/errors/ForbiddenError.js.map +1 -0
  46. package/dist/errors/InvalidDataError.cjs +7 -0
  47. package/dist/errors/InvalidDataError.cjs.map +1 -0
  48. package/dist/errors/InvalidDataError.d.ts +3 -0
  49. package/dist/errors/InvalidDataError.js +7 -0
  50. package/dist/errors/InvalidDataError.js.map +1 -0
  51. package/dist/errors/NotFoundError.cjs +7 -0
  52. package/dist/errors/NotFoundError.cjs.map +1 -0
  53. package/dist/errors/NotFoundError.d.ts +3 -0
  54. package/dist/errors/NotFoundError.js +7 -0
  55. package/dist/errors/NotFoundError.js.map +1 -0
  56. package/dist/errors/ParsingError.cjs +7 -0
  57. package/dist/errors/ParsingError.cjs.map +1 -0
  58. package/dist/errors/ParsingError.d.ts +14 -0
  59. package/dist/errors/ParsingError.js +7 -0
  60. package/dist/errors/ParsingError.js.map +1 -0
  61. package/dist/errors/PreviewTokenExpired.cjs +7 -0
  62. package/dist/errors/PreviewTokenExpired.cjs.map +1 -0
  63. package/dist/errors/PreviewTokenExpired.d.ts +8 -0
  64. package/dist/errors/PreviewTokenExpired.js +7 -0
  65. package/dist/errors/PreviewTokenExpired.js.map +1 -0
  66. package/dist/errors/PrismicError.cjs +13 -0
  67. package/dist/errors/PrismicError.cjs.map +1 -0
  68. package/dist/errors/PrismicError.d.ts +5 -0
  69. package/dist/errors/PrismicError.js +13 -0
  70. package/dist/errors/PrismicError.js.map +1 -0
  71. package/dist/errors/RefExpiredError.cjs +7 -0
  72. package/dist/errors/RefExpiredError.cjs.map +1 -0
  73. package/dist/errors/RefExpiredError.d.ts +8 -0
  74. package/dist/errors/RefExpiredError.js +7 -0
  75. package/dist/errors/RefExpiredError.js.map +1 -0
  76. package/dist/errors/RefNotFoundError.cjs +7 -0
  77. package/dist/errors/RefNotFoundError.cjs.map +1 -0
  78. package/dist/errors/RefNotFoundError.d.ts +8 -0
  79. package/dist/errors/RefNotFoundError.js +7 -0
  80. package/dist/errors/RefNotFoundError.js.map +1 -0
  81. package/dist/errors/RepositoryNotFoundError.cjs +7 -0
  82. package/dist/errors/RepositoryNotFoundError.cjs.map +1 -0
  83. package/dist/errors/RepositoryNotFoundError.d.ts +3 -0
  84. package/dist/errors/RepositoryNotFoundError.js +7 -0
  85. package/dist/errors/RepositoryNotFoundError.js.map +1 -0
  86. package/dist/filter.cjs +247 -0
  87. package/dist/filter.cjs.map +1 -0
  88. package/dist/filter.d.ts +209 -0
  89. package/dist/filter.js +247 -0
  90. package/dist/filter.js.map +1 -0
  91. package/dist/getGraphQLEndpoint.cjs +13 -0
  92. package/dist/getGraphQLEndpoint.cjs.map +1 -0
  93. package/dist/getGraphQLEndpoint.d.ts +10 -0
  94. package/dist/getGraphQLEndpoint.js +13 -0
  95. package/dist/getGraphQLEndpoint.js.map +1 -0
  96. package/dist/getRepositoryEndpoint.cjs +13 -0
  97. package/dist/getRepositoryEndpoint.cjs.map +1 -0
  98. package/dist/getRepositoryEndpoint.d.ts +19 -0
  99. package/dist/getRepositoryEndpoint.js +13 -0
  100. package/dist/getRepositoryEndpoint.js.map +1 -0
  101. package/dist/getRepositoryName.cjs +17 -0
  102. package/dist/getRepositoryName.cjs.map +1 -0
  103. package/dist/getRepositoryName.d.ts +12 -0
  104. package/dist/getRepositoryName.js +17 -0
  105. package/dist/getRepositoryName.js.map +1 -0
  106. package/dist/getToolbarSrc.cjs +13 -0
  107. package/dist/getToolbarSrc.cjs.map +1 -0
  108. package/dist/getToolbarSrc.d.ts +34 -0
  109. package/dist/getToolbarSrc.js +13 -0
  110. package/dist/getToolbarSrc.js.map +1 -0
  111. package/dist/helpers/asDate.cjs +14 -0
  112. package/dist/helpers/asDate.cjs.map +1 -0
  113. package/dist/helpers/asDate.d.ts +24 -0
  114. package/dist/helpers/asDate.js +14 -0
  115. package/dist/helpers/asDate.js.map +1 -0
  116. package/dist/helpers/asHTML.cjs +86 -0
  117. package/dist/helpers/asHTML.cjs.map +1 -0
  118. package/dist/helpers/asHTML.d.ts +149 -0
  119. package/dist/helpers/asHTML.js +86 -0
  120. package/dist/helpers/asHTML.js.map +1 -0
  121. package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
  122. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
  123. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +54 -0
  124. package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
  125. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
  126. package/dist/helpers/asImageSrc.cjs +13 -0
  127. package/dist/helpers/asImageSrc.cjs.map +1 -0
  128. package/dist/helpers/asImageSrc.d.ts +29 -0
  129. package/dist/helpers/asImageSrc.js +13 -0
  130. package/dist/helpers/asImageSrc.js.map +1 -0
  131. package/dist/helpers/asImageWidthSrcSet.cjs +45 -0
  132. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
  133. package/dist/helpers/asImageWidthSrcSet.d.ts +62 -0
  134. package/dist/helpers/asImageWidthSrcSet.js +45 -0
  135. package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
  136. package/dist/helpers/asLink.cjs +47 -0
  137. package/dist/helpers/asLink.cjs.map +1 -0
  138. package/dist/helpers/asLink.d.ts +78 -0
  139. package/dist/helpers/asLink.js +47 -0
  140. package/dist/helpers/asLink.js.map +1 -0
  141. package/dist/helpers/asLinkAttrs.cjs +28 -0
  142. package/dist/helpers/asLinkAttrs.cjs.map +1 -0
  143. package/dist/helpers/asLinkAttrs.d.ts +47 -0
  144. package/dist/helpers/asLinkAttrs.js +28 -0
  145. package/dist/helpers/asLinkAttrs.js.map +1 -0
  146. package/dist/helpers/asText.cjs +21 -0
  147. package/dist/helpers/asText.cjs.map +1 -0
  148. package/dist/helpers/asText.d.ts +57 -0
  149. package/dist/helpers/asText.js +21 -0
  150. package/dist/helpers/asText.js.map +1 -0
  151. package/dist/helpers/documentToLinkField.cjs +26 -0
  152. package/dist/helpers/documentToLinkField.cjs.map +1 -0
  153. package/dist/helpers/documentToLinkField.d.ts +17 -0
  154. package/dist/helpers/documentToLinkField.js +26 -0
  155. package/dist/helpers/documentToLinkField.js.map +1 -0
  156. package/dist/helpers/isFilled.cjs +77 -0
  157. package/dist/helpers/isFilled.cjs.map +1 -0
  158. package/dist/helpers/isFilled.d.ts +191 -0
  159. package/dist/helpers/isFilled.js +77 -0
  160. package/dist/helpers/isFilled.js.map +1 -0
  161. package/dist/helpers/mapSliceZone.cjs +42 -0
  162. package/dist/helpers/mapSliceZone.cjs.map +1 -0
  163. package/dist/helpers/mapSliceZone.d.ts +136 -0
  164. package/dist/helpers/mapSliceZone.js +42 -0
  165. package/dist/helpers/mapSliceZone.js.map +1 -0
  166. package/dist/index.cjs +94 -3880
  167. package/dist/index.cjs.map +1 -1
  168. package/dist/index.d.ts +129 -4349
  169. package/dist/index.js +99 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/isRepositoryEndpoint.cjs +12 -0
  172. package/dist/isRepositoryEndpoint.cjs.map +1 -0
  173. package/dist/isRepositoryEndpoint.d.ts +10 -0
  174. package/dist/isRepositoryEndpoint.js +12 -0
  175. package/dist/isRepositoryEndpoint.js.map +1 -0
  176. package/dist/isRepositoryName.cjs +7 -0
  177. package/dist/isRepositoryName.cjs.map +1 -0
  178. package/dist/isRepositoryName.d.ts +9 -0
  179. package/dist/isRepositoryName.js +7 -0
  180. package/dist/isRepositoryName.js.map +1 -0
  181. package/dist/lib/appendFilters.cjs +11 -0
  182. package/dist/lib/appendFilters.cjs.map +1 -0
  183. package/dist/lib/appendFilters.d.ts +18 -0
  184. package/dist/lib/appendFilters.js +11 -0
  185. package/dist/lib/appendFilters.js.map +1 -0
  186. package/dist/lib/castArray.cjs +7 -0
  187. package/dist/lib/castArray.cjs.map +1 -0
  188. package/dist/lib/castArray.d.ts +12 -0
  189. package/dist/lib/castArray.js +7 -0
  190. package/dist/lib/castArray.js.map +1 -0
  191. package/dist/lib/castThunk.cjs +7 -0
  192. package/dist/lib/castThunk.cjs.map +1 -0
  193. package/dist/lib/castThunk.d.ts +11 -0
  194. package/dist/lib/castThunk.js +7 -0
  195. package/dist/lib/castThunk.js.map +1 -0
  196. package/dist/lib/devMsg.cjs +8 -0
  197. package/dist/lib/devMsg.cjs.map +1 -0
  198. package/dist/lib/devMsg.d.ts +16 -0
  199. package/dist/lib/devMsg.js +8 -0
  200. package/dist/lib/devMsg.js.map +1 -0
  201. package/dist/lib/escapeHTML.cjs +43 -0
  202. package/dist/lib/escapeHTML.cjs.map +1 -0
  203. package/dist/lib/escapeHTML.d.ts +1 -0
  204. package/dist/lib/escapeHTML.js +43 -0
  205. package/dist/lib/escapeHTML.js.map +1 -0
  206. package/dist/lib/everyTagFilter.cjs +9 -0
  207. package/dist/lib/everyTagFilter.cjs.map +1 -0
  208. package/dist/lib/everyTagFilter.d.ts +9 -0
  209. package/dist/lib/everyTagFilter.js +9 -0
  210. package/dist/lib/everyTagFilter.js.map +1 -0
  211. package/dist/lib/findMasterRef.cjs +8 -0
  212. package/dist/lib/findMasterRef.cjs.map +1 -0
  213. package/dist/lib/findMasterRef.d.ts +11 -0
  214. package/dist/lib/findMasterRef.js +8 -0
  215. package/dist/lib/findMasterRef.js.map +1 -0
  216. package/dist/lib/findRef.cjs +12 -0
  217. package/dist/lib/findRef.cjs.map +1 -0
  218. package/dist/lib/findRef.d.ts +14 -0
  219. package/dist/lib/findRef.js +12 -0
  220. package/dist/lib/findRef.js.map +1 -0
  221. package/dist/lib/findRefByID.cjs +8 -0
  222. package/dist/lib/findRefByID.cjs.map +1 -0
  223. package/dist/lib/findRefByID.d.ts +12 -0
  224. package/dist/lib/findRefByID.js +8 -0
  225. package/dist/lib/findRefByID.js.map +1 -0
  226. package/dist/lib/findRefByLabel.cjs +8 -0
  227. package/dist/lib/findRefByLabel.cjs.map +1 -0
  228. package/dist/lib/findRefByLabel.d.ts +12 -0
  229. package/dist/lib/findRefByLabel.js +8 -0
  230. package/dist/lib/findRefByLabel.js.map +1 -0
  231. package/dist/lib/getOptionalLinkProperties.cjs +14 -0
  232. package/dist/lib/getOptionalLinkProperties.cjs.map +1 -0
  233. package/dist/lib/getOptionalLinkProperties.d.ts +12 -0
  234. package/dist/lib/getOptionalLinkProperties.js +14 -0
  235. package/dist/lib/getOptionalLinkProperties.js.map +1 -0
  236. package/dist/lib/getPreviewCookie.cjs +21 -0
  237. package/dist/lib/getPreviewCookie.cjs.map +1 -0
  238. package/dist/lib/getPreviewCookie.d.ts +9 -0
  239. package/dist/lib/getPreviewCookie.js +21 -0
  240. package/dist/lib/getPreviewCookie.js.map +1 -0
  241. package/dist/lib/isInternalURL.cjs +9 -0
  242. package/dist/lib/isInternalURL.cjs.map +1 -0
  243. package/dist/lib/isInternalURL.d.ts +8 -0
  244. package/dist/lib/isInternalURL.js +9 -0
  245. package/dist/lib/isInternalURL.js.map +1 -0
  246. package/dist/lib/isMigrationValue.cjs +24 -0
  247. package/dist/lib/isMigrationValue.cjs.map +1 -0
  248. package/dist/lib/isMigrationValue.d.ts +71 -0
  249. package/dist/lib/isMigrationValue.js +24 -0
  250. package/dist/lib/isMigrationValue.js.map +1 -0
  251. package/dist/lib/isValue.cjs +53 -0
  252. package/dist/lib/isValue.cjs.map +1 -0
  253. package/dist/lib/isValue.d.ts +78 -0
  254. package/dist/lib/isValue.js +53 -0
  255. package/dist/lib/isValue.js.map +1 -0
  256. package/dist/lib/minifyGraphQLQuery.cjs +7 -0
  257. package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
  258. package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
  259. package/dist/lib/minifyGraphQLQuery.js +7 -0
  260. package/dist/lib/minifyGraphQLQuery.js.map +1 -0
  261. package/dist/lib/pLimit.cjs +48 -0
  262. package/dist/lib/pLimit.cjs.map +1 -0
  263. package/dist/lib/pLimit.d.ts +22 -0
  264. package/dist/lib/pLimit.js +48 -0
  265. package/dist/lib/pLimit.js.map +1 -0
  266. package/dist/lib/request.cjs +41 -0
  267. package/dist/lib/request.cjs.map +1 -0
  268. package/dist/lib/request.d.ts +73 -0
  269. package/dist/lib/request.js +41 -0
  270. package/dist/lib/request.js.map +1 -0
  271. package/dist/lib/resolveMigrationDocumentData.cjs +132 -0
  272. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
  273. package/dist/lib/resolveMigrationDocumentData.d.ts +54 -0
  274. package/dist/lib/resolveMigrationDocumentData.js +132 -0
  275. package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
  276. package/dist/lib/serializerHelpers.cjs +113 -0
  277. package/dist/lib/serializerHelpers.cjs.map +1 -0
  278. package/dist/lib/serializerHelpers.d.ts +9 -0
  279. package/dist/lib/serializerHelpers.js +113 -0
  280. package/dist/lib/serializerHelpers.js.map +1 -0
  281. package/dist/lib/someTagsFilter.cjs +9 -0
  282. package/dist/lib/someTagsFilter.cjs.map +1 -0
  283. package/dist/lib/someTagsFilter.d.ts +9 -0
  284. package/dist/lib/someTagsFilter.js +9 -0
  285. package/dist/lib/someTagsFilter.js.map +1 -0
  286. package/dist/lib/throttledLog.cjs +17 -0
  287. package/dist/lib/throttledLog.cjs.map +1 -0
  288. package/dist/lib/throttledLog.d.ts +15 -0
  289. package/dist/lib/throttledLog.js +17 -0
  290. package/dist/lib/throttledLog.js.map +1 -0
  291. package/dist/lib/typeFilter.cjs +8 -0
  292. package/dist/lib/typeFilter.cjs.map +1 -0
  293. package/dist/lib/typeFilter.d.ts +8 -0
  294. package/dist/lib/typeFilter.js +8 -0
  295. package/dist/lib/typeFilter.js.map +1 -0
  296. package/dist/lib/validateAssetMetadata.cjs +28 -0
  297. package/dist/lib/validateAssetMetadata.cjs.map +1 -0
  298. package/dist/lib/validateAssetMetadata.d.ts +10 -0
  299. package/dist/lib/validateAssetMetadata.js +28 -0
  300. package/dist/lib/validateAssetMetadata.js.map +1 -0
  301. package/dist/package.json.cjs +7 -0
  302. package/dist/package.json.cjs.map +1 -0
  303. package/dist/package.json.js +7 -0
  304. package/dist/package.json.js.map +1 -0
  305. package/dist/richtext/asText.cjs +13 -0
  306. package/dist/richtext/asText.cjs.map +1 -0
  307. package/dist/richtext/asText.d.ts +12 -0
  308. package/dist/richtext/asText.js +13 -0
  309. package/dist/richtext/asText.js.map +1 -0
  310. package/dist/richtext/asTree.cjs +123 -0
  311. package/dist/richtext/asTree.cjs.map +1 -0
  312. package/dist/richtext/asTree.d.ts +14 -0
  313. package/dist/richtext/asTree.js +123 -0
  314. package/dist/richtext/asTree.js.map +1 -0
  315. package/dist/richtext/composeSerializers.cjs +17 -0
  316. package/dist/richtext/composeSerializers.cjs.map +1 -0
  317. package/dist/richtext/composeSerializers.d.ts +16 -0
  318. package/dist/richtext/composeSerializers.js +17 -0
  319. package/dist/richtext/composeSerializers.js.map +1 -0
  320. package/dist/richtext/index.d.ts +7 -78
  321. package/dist/richtext/serialize.cjs +19 -0
  322. package/dist/richtext/serialize.cjs.map +1 -0
  323. package/dist/richtext/serialize.d.ts +19 -0
  324. package/dist/richtext/serialize.js +19 -0
  325. package/dist/richtext/serialize.js.map +1 -0
  326. package/dist/richtext/types.cjs +11 -0
  327. package/dist/richtext/types.cjs.map +1 -0
  328. package/dist/richtext/types.d.ts +71 -0
  329. package/dist/richtext/types.js +11 -0
  330. package/dist/richtext/types.js.map +1 -0
  331. package/dist/richtext/wrapMapSerializer.cjs +24 -0
  332. package/dist/richtext/wrapMapSerializer.cjs.map +1 -0
  333. package/dist/richtext/wrapMapSerializer.d.ts +15 -0
  334. package/dist/richtext/wrapMapSerializer.js +24 -0
  335. package/dist/richtext/wrapMapSerializer.js.map +1 -0
  336. package/dist/richtext.cjs +15 -0
  337. package/dist/richtext.cjs.map +1 -0
  338. package/dist/richtext.js +15 -0
  339. package/dist/richtext.js.map +1 -0
  340. package/dist/types/api/asset/asset.d.ts +177 -0
  341. package/dist/types/api/asset/tag.d.ts +53 -0
  342. package/dist/types/api/integration.d.ts +28 -0
  343. package/dist/types/api/migration/document.d.ts +60 -0
  344. package/dist/types/api/query.d.ts +43 -0
  345. package/dist/types/api/ref.d.ts +32 -0
  346. package/dist/types/api/release.d.ts +11 -0
  347. package/dist/types/api/repository.d.ts +109 -0
  348. package/dist/types/api/tags.d.ts +9 -0
  349. package/dist/types/migration/Asset.cjs +30 -0
  350. package/dist/types/migration/Asset.cjs.map +1 -0
  351. package/dist/types/migration/Asset.d.ts +108 -0
  352. package/dist/types/migration/Asset.js +30 -0
  353. package/dist/types/migration/Asset.js.map +1 -0
  354. package/dist/types/migration/ContentRelationship.d.ts +16 -0
  355. package/dist/types/migration/Document.cjs +44 -0
  356. package/dist/types/migration/Document.cjs.map +1 -0
  357. package/dist/types/migration/Document.d.ts +94 -0
  358. package/dist/types/migration/Document.js +44 -0
  359. package/dist/types/migration/Document.js.map +1 -0
  360. package/dist/types/migration/Link.d.ts +19 -0
  361. package/dist/types/model/boolean.d.ts +15 -0
  362. package/dist/types/model/color.d.ts +13 -0
  363. package/dist/types/model/contentRelationship.d.ts +53 -0
  364. package/dist/types/model/customType.d.ts +48 -0
  365. package/dist/types/model/date.d.ts +14 -0
  366. package/dist/types/model/embed.d.ts +13 -0
  367. package/dist/types/model/geoPoint.d.ts +12 -0
  368. package/dist/types/model/group.d.ts +23 -0
  369. package/dist/types/model/image.d.ts +31 -0
  370. package/dist/types/model/integration.d.ts +14 -0
  371. package/dist/types/model/keyText.d.ts +13 -0
  372. package/dist/types/model/link.cjs +9 -0
  373. package/dist/types/model/link.cjs.map +1 -0
  374. package/dist/types/model/link.d.ts +28 -0
  375. package/dist/types/model/link.js +9 -0
  376. package/dist/types/model/link.js.map +1 -0
  377. package/dist/types/model/linkToMedia.d.ts +17 -0
  378. package/dist/types/model/number.d.ts +15 -0
  379. package/dist/types/model/range.d.ts +14 -0
  380. package/dist/types/model/richText.d.ts +37 -0
  381. package/dist/types/model/select.d.ts +18 -0
  382. package/dist/types/model/separator.d.ts +10 -0
  383. package/dist/types/model/sharedSlice.d.ts +16 -0
  384. package/dist/types/model/sharedSliceVariation.d.ts +19 -0
  385. package/dist/types/model/slice.cjs +8 -0
  386. package/dist/types/model/slice.cjs.map +1 -0
  387. package/dist/types/model/slice.d.ts +33 -0
  388. package/dist/types/model/slice.js +8 -0
  389. package/dist/types/model/slice.js.map +1 -0
  390. package/dist/types/model/sliceZone.cjs +8 -0
  391. package/dist/types/model/sliceZone.cjs.map +1 -0
  392. package/dist/types/model/sliceZone.d.ts +41 -0
  393. package/dist/types/model/sliceZone.js +8 -0
  394. package/dist/types/model/sliceZone.js.map +1 -0
  395. package/dist/types/model/table.d.ts +12 -0
  396. package/dist/types/model/timestamp.d.ts +14 -0
  397. package/dist/types/model/title.d.ts +7 -0
  398. package/dist/types/model/types.cjs +39 -0
  399. package/dist/types/model/types.cjs.map +1 -0
  400. package/dist/types/model/types.d.ts +76 -0
  401. package/dist/types/model/types.js +39 -0
  402. package/dist/types/model/types.js.map +1 -0
  403. package/dist/types/model/uid.d.ts +13 -0
  404. package/dist/types/value/boolean.d.ts +6 -0
  405. package/dist/types/value/color.d.ts +9 -0
  406. package/dist/types/value/contentRelationship.d.ts +31 -0
  407. package/dist/types/value/date.d.ts +9 -0
  408. package/dist/types/value/document.d.ts +114 -0
  409. package/dist/types/value/embed.cjs +10 -0
  410. package/dist/types/value/embed.cjs.map +1 -0
  411. package/dist/types/value/embed.d.ts +168 -0
  412. package/dist/types/value/embed.js +10 -0
  413. package/dist/types/value/embed.js.map +1 -0
  414. package/dist/types/value/geoPoint.d.ts +12 -0
  415. package/dist/types/value/group.d.ts +13 -0
  416. package/dist/types/value/image.d.ts +47 -0
  417. package/dist/types/value/integration.d.ts +16 -0
  418. package/dist/types/value/keyText.d.ts +9 -0
  419. package/dist/types/value/link.cjs +10 -0
  420. package/dist/types/value/link.cjs.map +1 -0
  421. package/dist/types/value/link.d.ts +68 -0
  422. package/dist/types/value/link.js +10 -0
  423. package/dist/types/value/link.js.map +1 -0
  424. package/dist/types/value/linkToMedia.d.ts +28 -0
  425. package/dist/types/value/number.d.ts +9 -0
  426. package/dist/types/value/richText.cjs +25 -0
  427. package/dist/types/value/richText.cjs.map +1 -0
  428. package/dist/types/value/richText.d.ts +215 -0
  429. package/dist/types/value/richText.js +25 -0
  430. package/dist/types/value/richText.js.map +1 -0
  431. package/dist/types/value/select.d.ts +10 -0
  432. package/dist/types/value/sharedSlice.d.ts +11 -0
  433. package/dist/types/value/sharedSliceVariation.d.ts +10 -0
  434. package/dist/types/value/slice.d.ts +13 -0
  435. package/dist/types/value/sliceZone.d.ts +12 -0
  436. package/dist/types/value/table.d.ts +91 -0
  437. package/dist/types/value/timestamp.d.ts +8 -0
  438. package/dist/types/value/title.d.ts +12 -0
  439. package/dist/types/value/types.d.ts +58 -0
  440. package/dist/types/webhook/apiUpdate.d.ts +52 -0
  441. package/dist/types/webhook/testTrigger.d.ts +9 -0
  442. package/dist/types/webhook/types.cjs +8 -0
  443. package/dist/types/webhook/types.cjs.map +1 -0
  444. package/dist/types/webhook/types.d.ts +18 -0
  445. package/dist/types/webhook/types.js +8 -0
  446. package/dist/types/webhook/types.js.map +1 -0
  447. package/package.json +34 -11
  448. package/src/WriteClient.ts +21 -32
  449. package/src/index.ts +1 -0
  450. package/src/types/model/contentRelationship.ts +1 -0
  451. package/dist/index.d.cts +0 -4424
  452. package/dist/index.d.mts +0 -4424
  453. package/dist/index.mjs +0 -3837
  454. package/dist/index.mjs.map +0 -1
  455. package/dist/richtext/index.cjs +0 -244
  456. package/dist/richtext/index.cjs.map +0 -1
  457. package/dist/richtext/index.d.cts +0 -78
  458. package/dist/richtext/index.d.mts +0 -78
  459. package/dist/richtext/index.mjs +0 -237
  460. package/dist/richtext/index.mjs.map +0 -1
  461. package/dist/shared/client.TSGr56lO.d.cts +0 -899
  462. package/dist/shared/client.TSGr56lO.d.mts +0 -899
  463. package/dist/shared/client.TSGr56lO.d.ts +0 -899
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const castArray = require("./lib/castArray.cjs");
4
+ const devMsg = require("./lib/devMsg.cjs");
5
+ const _package = require("./package.json.cjs");
6
+ const PRISMIC_DEV_PARAM = "x-d";
7
+ const PRISMIC_CLIENT_VERSION_PARAM = "x-c";
8
+ const RENAMED_PARAMS = {
9
+ accessToken: "access_token"
10
+ };
11
+ const castOrderingToString = (ordering) => {
12
+ if (typeof ordering === "string") {
13
+ if (process.env.NODE_ENV === "development") {
14
+ const [field, direction] = ordering.split(" ");
15
+ const objectForm = direction === "desc" ? `{ field: "${field}", direction: "desc" }` : `{ field: "${field}" }`;
16
+ 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")}`);
17
+ }
18
+ return ordering;
19
+ }
20
+ return ordering.direction === "desc" ? `${ordering.field} desc` : ordering.field;
21
+ };
22
+ const buildQueryURL = (endpoint, args) => {
23
+ const { filters, predicates, ...params } = args;
24
+ const url = new URL(`documents/search`, `${endpoint}/`);
25
+ if (filters) {
26
+ if (process.env.NODE_ENV === "development" && !Array.isArray(filters)) {
27
+ 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")}`);
28
+ }
29
+ for (const filter of castArray.castArray(filters)) {
30
+ url.searchParams.append("q", `[${filter}]`);
31
+ }
32
+ }
33
+ if (predicates) {
34
+ for (const predicate of castArray.castArray(predicates)) {
35
+ url.searchParams.append("q", `[${predicate}]`);
36
+ }
37
+ }
38
+ for (const k in params) {
39
+ const name = RENAMED_PARAMS[k] || k;
40
+ let value = params[k];
41
+ if (name === "orderings") {
42
+ const scopedValue = params[name];
43
+ if (scopedValue != null) {
44
+ if (process.env.NODE_ENV === "development" && typeof scopedValue === "string") {
45
+ 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")}`);
46
+ }
47
+ const v = castArray.castArray(scopedValue).map((ordering) => castOrderingToString(ordering)).join(",");
48
+ value = `[${v}]`;
49
+ }
50
+ } else if (name === "routes") {
51
+ if (typeof params[name] === "object") {
52
+ value = JSON.stringify(castArray.castArray(params[name]));
53
+ }
54
+ }
55
+ if (value != null) {
56
+ url.searchParams.set(name, castArray.castArray(value).join(","));
57
+ }
58
+ }
59
+ url.searchParams.set(PRISMIC_CLIENT_VERSION_PARAM, `js-${_package.version}`);
60
+ if (process.env.NODE_ENV === "development") {
61
+ url.searchParams.set(PRISMIC_DEV_PARAM, "1");
62
+ }
63
+ return url.toString();
64
+ };
65
+ exports.buildQueryURL = buildQueryURL;
66
+ //# sourceMappingURL=buildQueryURL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildQueryURL.cjs","sources":["../../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\"\nimport { devMsg } from \"./lib/devMsg\"\n\nimport { version } from \"../package.json\"\n\n/**\n * The query parameter used to indicate if the client is in development mode to\n * the API.\n */\nconst PRISMIC_DEV_PARAM = \"x-d\"\n\n/**\n * The query parameter used to indicate the version of the client to the API.\n */\nconst PRISMIC_CLIENT_VERSION_PARAM = \"x-c\"\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 page's URL field is resolved.\n *\n * {@link https://prismic.io/docs/route-resolver}\n *\n * @example With a page'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 page.\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 page 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 pages whose language matches the given language.\n\t */\n\tlang?: string\n\n\t/**\n\t * The resolved path of the page 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 Content API.\n *\n * @see Learn how to fetch content from Prismic: {@link https://prismic.io/docs/fetch-content}\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 pages that the API\n\t * 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 pages except for those after the specified page in the\n\t * 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 page and add it to the page 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\n\t * Strings and arrays of strings are deprecated as of\n\t * `@prismicio/client@7.0.0`. Please migrate to the more explicit array of\n\t * objects.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * buildQueryURL(endpoint, {\n\t * \torderings: [\n\t * \t\t{ field: \"my.product.price\", direction: \"desc\" },\n\t * \t\t{ field: \"my.product.title\" },\n\t * \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 page'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 page 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,\n\t * 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 * Builds a Prismic Content API URL to request pages from a repository. The\n * paginated response for this URL includes pages 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 * @example\n *\n * ```ts\n * const url = buildQueryURL(\"https://my-repo.cdn.prismic.io/api/v2\", {\n * \tref: \"my-ref\",\n * \tfilters: [filter.at(\"document.type\", \"blog_post\")],\n * })\n * ```\n *\n * @param endpoint - URL to the repository's Content API.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request pages from the repository.\n *\n * @see Prismic Content API technical reference: {@link https://prismic.io/docs/content-api}\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\turl.searchParams.set(PRISMIC_CLIENT_VERSION_PARAM, `js-${version}`)\n\n\tif (process.env.NODE_ENV === \"development\") {\n\t\turl.searchParams.set(PRISMIC_DEV_PARAM, \"1\")\n\t}\n\n\treturn url.toString()\n}\n"],"names":["devMsg","castArray","version"],"mappings":";;;;;AASA,MAAM,oBAAoB;AAK1B,MAAM,+BAA+B;AAyOrC,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAAuC;AAEpE,MAAI,OAAO,aAAa,UAAU;AACjC,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC3C,YAAM,CAAC,OAAO,SAAS,IAAI,SAAS,MAAM,GAAG;AAE7C,YAAM,aACL,cAAc,SACX,aAAa,KAAK,2BAClB,aAAa,KAAK;AAEtB,cAAQ,KACP,uJAAuJ,UAAU,2BAA2BA,OAAAA,OAC3L,uCAAuC,CACvC,EAAE;AAAA,IAEL;AAEA,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,cAAc,SAC3B,GAAG,SAAS,KAAK,UACjB,SAAS;AACb;AA6BO,MAAM,gBAAgB,CAC5B,UACA,SACW;AACX,QAAM,EAAE,SAAS,YAAY,GAAG,WAAW;AAE3C,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,QAAQ,GAAG;AAEtD,MAAI,SAAS;AAEZ,QAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,MAAM,QAAQ,OAAO,GAAG;AACtE,cAAQ,KACP,4FAA4F,OAAO,8FAA8FA,OAAAA,OAChM,0BAA0B,CAC1B,EAAE;AAAA,IAEL;AAGA,eAAW,UAAUC,oBAAU,OAAO,GAAG;AACxC,UAAI,aAAa,OAAO,KAAK,IAAI,MAAM,GAAG;AAAA,IAC3C;AAAA,EACD;AAGA,MAAI,YAAY;AACf,eAAW,aAAaA,oBAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,SAAS,GAAG;AAAA,IAC9C;AAAA,EACD;AAIA,aAAW,KAAK,QAAQ;AACvB,UAAM,OAAQ,eAAe,CAAgC,KAC5D;AAED,QAAI,QAAQ,OAAO,CAAwB;AAE3C,QAAI,SAAS,aAAa;AACzB,YAAM,cAAc,OAAO,IAAI;AAE/B,UAAI,eAAe,MAAM;AAExB,YACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,UACtB;AACD,kBAAQ,KACP,iLAAiLD,OAAAA,OAChL,uCAAuC,CACvC,EAAE;AAAA,QAEL;AAEA,cAAM,IAAIC,UAAAA,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI,CAAC;AAAA,MACd;AAAA,IACD,WAAW,SAAS,UAAU;AAC7B,UAAI,OAAO,OAAO,IAAI,MAAM,UAAU;AACrC,gBAAQ,KAAK,UAAUA,UAAAA,UAAU,OAAO,IAAI,CAAC,CAAC;AAAA,MAC/C;AAAA,IACD;AAEA,QAAI,SAAS,MAAM;AAClB,UAAI,aAAa,IAChB,MACAA,UAAAA,UAA8C,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IAEhE;AAAA,EACD;AAEA,MAAI,aAAa,IAAI,8BAA8B,MAAMC,SAAAA,OAAO,EAAE;AAElE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC3C,QAAI,aAAa,IAAI,mBAAmB,GAAG;AAAA,EAC5C;AAEA,SAAO,IAAI,SAAA;AACZ;;"}
@@ -0,0 +1,217 @@
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 page's URL field is resolved.
12
+ *
13
+ * {@link https://prismic.io/docs/route-resolver}
14
+ *
15
+ * @example With a page'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 page.
39
+ */
40
+ type: string;
41
+ /**
42
+ * A specific UID to which this route definition is scoped. The route is only
43
+ * defined for the page 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 pages whose language matches the given language.
49
+ */
50
+ lang?: string;
51
+ /**
52
+ * The resolved path of the page 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 Content API.
62
+ *
63
+ * @see Learn how to fetch content from Prismic: {@link https://prismic.io/docs/fetch-content}
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 pages that the API
75
+ * 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 pages except for those after the specified page in the
89
+ * 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 page and add it to the page 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
129
+ * Strings and arrays of strings are deprecated as of
130
+ * `@prismicio/client@7.0.0`. Please migrate to the more explicit array of
131
+ * objects.
132
+ *
133
+ * @example
134
+ *
135
+ * ```typescript
136
+ * buildQueryURL(endpoint, {
137
+ * orderings: [
138
+ * { field: "my.product.price", direction: "desc" },
139
+ * { field: "my.product.title" },
140
+ * ],
141
+ * })
142
+ * ```
143
+ */
144
+ orderings?: string | Ordering | (string | Ordering)[];
145
+ /**
146
+ * The `routes` option allows you to define how a page's `url` field is
147
+ * resolved.
148
+ *
149
+ * {@link https://prismic.io/docs/route-resolver}
150
+ */
151
+ routes?: Route | string | (Route | string)[];
152
+ /**
153
+ * The `brokenRoute` option allows you to define the route populated in the
154
+ * `url` property for broken link or content relationship fields. A broken
155
+ * link is a link or content relationship field whose linked page has been
156
+ * unpublished or deleted.
157
+ *
158
+ * {@link https://prismic.io/docs/route-resolver}
159
+ */
160
+ brokenRoute?: string;
161
+ }
162
+ /**
163
+ * Arguments for `buildQueryURL` to construct a Query URL.
164
+ */
165
+ type BuildQueryURLParams = {
166
+ /**
167
+ * Ref used to query documents.
168
+ *
169
+ * {@link https://prismic.io/docs/api#refs-and-the-entry-api}
170
+ */
171
+ ref: string;
172
+ /**
173
+ * Ref used to populate integration fields with the latest content.
174
+ *
175
+ * {@link https://prismic.io/docs/integration-fields}
176
+ */
177
+ integrationFieldsRef?: string;
178
+ /**
179
+ * One or more filters to filter documents for the query.
180
+ *
181
+ * {@link https://prismic.io/docs/rest-api-technical-reference#q}
182
+ */
183
+ filters?: string | string[];
184
+ /**
185
+ * @deprecated Renamed to `filters`. Ensure the value is an array of filters,
186
+ * not a single, non-array filter.
187
+ */
188
+ predicates?: string | string[];
189
+ };
190
+ export type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
191
+ /**
192
+ * Builds a Prismic Content API URL to request pages from a repository. The
193
+ * paginated response for this URL includes pages matching the parameters.
194
+ *
195
+ * A ref is required to make a request. Request the `endpoint` URL to retrieve a
196
+ * list of available refs.
197
+ *
198
+ * Type the JSON response with `Query`.
199
+ *
200
+ * @example
201
+ *
202
+ * ```ts
203
+ * const url = buildQueryURL("https://my-repo.cdn.prismic.io/api/v2", {
204
+ * ref: "my-ref",
205
+ * filters: [filter.at("document.type", "blog_post")],
206
+ * })
207
+ * ```
208
+ *
209
+ * @param endpoint - URL to the repository's Content API.
210
+ * @param args - Arguments to filter and scope the query.
211
+ *
212
+ * @returns URL that can be used to request pages from the repository.
213
+ *
214
+ * @see Prismic Content API technical reference: {@link https://prismic.io/docs/content-api}
215
+ */
216
+ export declare const buildQueryURL: (endpoint: string, args: BuildQueryURLArgs) => string;
217
+ export {};
@@ -0,0 +1,66 @@
1
+ import { castArray } from "./lib/castArray.js";
2
+ import { devMsg } from "./lib/devMsg.js";
3
+ import { version } from "./package.json.js";
4
+ const PRISMIC_DEV_PARAM = "x-d";
5
+ const PRISMIC_CLIENT_VERSION_PARAM = "x-c";
6
+ const RENAMED_PARAMS = {
7
+ accessToken: "access_token"
8
+ };
9
+ const castOrderingToString = (ordering) => {
10
+ if (typeof ordering === "string") {
11
+ if (process.env.NODE_ENV === "development") {
12
+ const [field, direction] = ordering.split(" ");
13
+ const objectForm = direction === "desc" ? `{ field: "${field}", direction: "desc" }` : `{ field: "${field}" }`;
14
+ 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")}`);
15
+ }
16
+ return ordering;
17
+ }
18
+ return ordering.direction === "desc" ? `${ordering.field} desc` : ordering.field;
19
+ };
20
+ const buildQueryURL = (endpoint, args) => {
21
+ const { filters, predicates, ...params } = args;
22
+ const url = new URL(`documents/search`, `${endpoint}/`);
23
+ if (filters) {
24
+ if (process.env.NODE_ENV === "development" && !Array.isArray(filters)) {
25
+ 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")}`);
26
+ }
27
+ for (const filter of castArray(filters)) {
28
+ url.searchParams.append("q", `[${filter}]`);
29
+ }
30
+ }
31
+ if (predicates) {
32
+ for (const predicate of castArray(predicates)) {
33
+ url.searchParams.append("q", `[${predicate}]`);
34
+ }
35
+ }
36
+ for (const k in params) {
37
+ const name = RENAMED_PARAMS[k] || k;
38
+ let value = params[k];
39
+ if (name === "orderings") {
40
+ const scopedValue = params[name];
41
+ if (scopedValue != null) {
42
+ if (process.env.NODE_ENV === "development" && typeof scopedValue === "string") {
43
+ 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")}`);
44
+ }
45
+ const v = castArray(scopedValue).map((ordering) => castOrderingToString(ordering)).join(",");
46
+ value = `[${v}]`;
47
+ }
48
+ } else if (name === "routes") {
49
+ if (typeof params[name] === "object") {
50
+ value = JSON.stringify(castArray(params[name]));
51
+ }
52
+ }
53
+ if (value != null) {
54
+ url.searchParams.set(name, castArray(value).join(","));
55
+ }
56
+ }
57
+ url.searchParams.set(PRISMIC_CLIENT_VERSION_PARAM, `js-${version}`);
58
+ if (process.env.NODE_ENV === "development") {
59
+ url.searchParams.set(PRISMIC_DEV_PARAM, "1");
60
+ }
61
+ return url.toString();
62
+ };
63
+ export {
64
+ buildQueryURL
65
+ };
66
+ //# sourceMappingURL=buildQueryURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildQueryURL.js","sources":["../../src/buildQueryURL.ts"],"sourcesContent":["import { castArray } from \"./lib/castArray\"\nimport { devMsg } from \"./lib/devMsg\"\n\nimport { version } from \"../package.json\"\n\n/**\n * The query parameter used to indicate if the client is in development mode to\n * the API.\n */\nconst PRISMIC_DEV_PARAM = \"x-d\"\n\n/**\n * The query parameter used to indicate the version of the client to the API.\n */\nconst PRISMIC_CLIENT_VERSION_PARAM = \"x-c\"\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 page's URL field is resolved.\n *\n * {@link https://prismic.io/docs/route-resolver}\n *\n * @example With a page'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 page.\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 page 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 pages whose language matches the given language.\n\t */\n\tlang?: string\n\n\t/**\n\t * The resolved path of the page 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 Content API.\n *\n * @see Learn how to fetch content from Prismic: {@link https://prismic.io/docs/fetch-content}\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 pages that the API\n\t * 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 pages except for those after the specified page in the\n\t * 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 page and add it to the page 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\n\t * Strings and arrays of strings are deprecated as of\n\t * `@prismicio/client@7.0.0`. Please migrate to the more explicit array of\n\t * objects.\n\t *\n\t * @example\n\t *\n\t * ```typescript\n\t * buildQueryURL(endpoint, {\n\t * \torderings: [\n\t * \t\t{ field: \"my.product.price\", direction: \"desc\" },\n\t * \t\t{ field: \"my.product.title\" },\n\t * \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 page'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 page 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,\n\t * 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 * Builds a Prismic Content API URL to request pages from a repository. The\n * paginated response for this URL includes pages 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 * @example\n *\n * ```ts\n * const url = buildQueryURL(\"https://my-repo.cdn.prismic.io/api/v2\", {\n * \tref: \"my-ref\",\n * \tfilters: [filter.at(\"document.type\", \"blog_post\")],\n * })\n * ```\n *\n * @param endpoint - URL to the repository's Content API.\n * @param args - Arguments to filter and scope the query.\n *\n * @returns URL that can be used to request pages from the repository.\n *\n * @see Prismic Content API technical reference: {@link https://prismic.io/docs/content-api}\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\turl.searchParams.set(PRISMIC_CLIENT_VERSION_PARAM, `js-${version}`)\n\n\tif (process.env.NODE_ENV === \"development\") {\n\t\turl.searchParams.set(PRISMIC_DEV_PARAM, \"1\")\n\t}\n\n\treturn url.toString()\n}\n"],"names":[],"mappings":";;;AASA,MAAM,oBAAoB;AAK1B,MAAM,+BAA+B;AAyOrC,MAAM,iBAAiB;AAAA,EACtB,aAAa;;AAqBd,MAAM,uBAAuB,CAAC,aAAuC;AAEpE,MAAI,OAAO,aAAa,UAAU;AACjC,QAAI,QAAQ,IAAI,aAAa,eAAe;AAC3C,YAAM,CAAC,OAAO,SAAS,IAAI,SAAS,MAAM,GAAG;AAE7C,YAAM,aACL,cAAc,SACX,aAAa,KAAK,2BAClB,aAAa,KAAK;AAEtB,cAAQ,KACP,uJAAuJ,UAAU,2BAA2B,OAC3L,uCAAuC,CACvC,EAAE;AAAA,IAEL;AAEA,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,cAAc,SAC3B,GAAG,SAAS,KAAK,UACjB,SAAS;AACb;AA6BO,MAAM,gBAAgB,CAC5B,UACA,SACW;AACX,QAAM,EAAE,SAAS,YAAY,GAAG,WAAW;AAE3C,QAAM,MAAM,IAAI,IAAI,oBAAoB,GAAG,QAAQ,GAAG;AAEtD,MAAI,SAAS;AAEZ,QAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,MAAM,QAAQ,OAAO,GAAG;AACtE,cAAQ,KACP,4FAA4F,OAAO,8FAA8F,OAChM,0BAA0B,CAC1B,EAAE;AAAA,IAEL;AAGA,eAAW,UAAU,UAAU,OAAO,GAAG;AACxC,UAAI,aAAa,OAAO,KAAK,IAAI,MAAM,GAAG;AAAA,IAC3C;AAAA,EACD;AAGA,MAAI,YAAY;AACf,eAAW,aAAa,UAAU,UAAU,GAAG;AAC9C,UAAI,aAAa,OAAO,KAAK,IAAI,SAAS,GAAG;AAAA,IAC9C;AAAA,EACD;AAIA,aAAW,KAAK,QAAQ;AACvB,UAAM,OAAQ,eAAe,CAAgC,KAC5D;AAED,QAAI,QAAQ,OAAO,CAAwB;AAE3C,QAAI,SAAS,aAAa;AACzB,YAAM,cAAc,OAAO,IAAI;AAE/B,UAAI,eAAe,MAAM;AAExB,YACC,QAAQ,IAAI,aAAa,iBACzB,OAAO,gBAAgB,UACtB;AACD,kBAAQ,KACP,iLAAiL,OAChL,uCAAuC,CACvC,EAAE;AAAA,QAEL;AAEA,cAAM,IAAI,UAAU,WAAW,EAC7B,IAAI,CAAC,aAAa,qBAAqB,QAAQ,CAAC,EAChD,KAAK,GAAG;AAEV,gBAAQ,IAAI,CAAC;AAAA,MACd;AAAA,IACD,WAAW,SAAS,UAAU;AAC7B,UAAI,OAAO,OAAO,IAAI,MAAM,UAAU;AACrC,gBAAQ,KAAK,UAAU,UAAU,OAAO,IAAI,CAAC,CAAC;AAAA,MAC/C;AAAA,IACD;AAEA,QAAI,SAAS,MAAM;AAClB,UAAI,aAAa,IAChB,MACA,UAA8C,KAAK,EAAE,KAAK,GAAG,CAAC;AAAA,IAEhE;AAAA,EACD;AAEA,MAAI,aAAa,IAAI,8BAA8B,MAAM,OAAO,EAAE;AAElE,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC3C,QAAI,aAAa,IAAI,mBAAmB,GAAG;AAAA,EAC5C;AAEA,SAAO,IAAI,SAAA;AACZ;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const preview = "io.prismic.preview";
4
+ exports.preview = preview;
5
+ //# sourceMappingURL=cookie.cjs.map
@@ -0,0 +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;;"}
@@ -0,0 +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";
package/dist/cookie.js ADDED
@@ -0,0 +1,5 @@
1
+ const preview = "io.prismic.preview";
2
+ export {
3
+ preview
4
+ };
5
+ //# sourceMappingURL=cookie.js.map
@@ -0,0 +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;"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Client = require("./Client.cjs");
4
+ const createClient = (repositoryNameOrEndpoint, options) => new Client.Client(repositoryNameOrEndpoint, options);
5
+ exports.createClient = createClient;
6
+ //# sourceMappingURL=createClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClient.cjs","sources":["../../src/createClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { ClientConfig } from \"./Client\"\nimport { Client } from \"./Client\"\n\n/**\n * Type definitions for the `createClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof Client>\n\t): Client<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query content from a repository.\n *\n * @example\n *\n * ```ts\n * // With a repository name\n * createClient(\"my-repo\")\n *\n * // With a full Prismic Content API endpoint\n * createClient(\"https://my-repo.cdn.prismic.io/api/v2\")\n * ```\n *\n * @typeParam TDocuments - A union of Prismic page and custom types for the\n * repository.\n *\n * @param repositoryNameOrEndpoint - The Prismic repository name or full Content\n * API endpoint for the repository.\n * @param options - Configuration that determines how content will be queried\n * from the Prismic repository.\n *\n * @returns A client that can query content from the repository.\n *\n * @see @prismicio/client technical reference: {@link https://prismic.io/docs/technical-reference/prismicio-client/v7}\n */\nexport const createClient: CreateClient = <TDocuments extends PrismicDocument>(\n\trepositoryNameOrEndpoint: string,\n\toptions?: ClientConfig,\n) => new Client<TDocuments>(repositoryNameOrEndpoint, options)\n"],"names":["Client"],"mappings":";;;AAwCO,MAAM,eAA6B,CACzC,0BACA,YACI,IAAIA,OAAAA,OAAmB,0BAA0B,OAAO;;"}
@@ -0,0 +1,35 @@
1
+ import type { PrismicDocument } from "./types/value/document.js";
2
+ import { Client } from "./Client.js";
3
+ /**
4
+ * Type definitions for the `createClient()` function. May be augmented by
5
+ * third-party libraries.
6
+ */
7
+ export interface CreateClient {
8
+ <TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof Client>): Client<TDocuments>;
9
+ }
10
+ /**
11
+ * Creates a Prismic client that can be used to query content from a repository.
12
+ *
13
+ * @example
14
+ *
15
+ * ```ts
16
+ * // With a repository name
17
+ * createClient("my-repo")
18
+ *
19
+ * // With a full Prismic Content API endpoint
20
+ * createClient("https://my-repo.cdn.prismic.io/api/v2")
21
+ * ```
22
+ *
23
+ * @typeParam TDocuments - A union of Prismic page and custom types for the
24
+ * repository.
25
+ *
26
+ * @param repositoryNameOrEndpoint - The Prismic repository name or full Content
27
+ * API endpoint for the repository.
28
+ * @param options - Configuration that determines how content will be queried
29
+ * from the Prismic repository.
30
+ *
31
+ * @returns A client that can query content from the repository.
32
+ *
33
+ * @see @prismicio/client technical reference: {@link https://prismic.io/docs/technical-reference/prismicio-client/v7}
34
+ */
35
+ export declare const createClient: CreateClient;
@@ -0,0 +1,6 @@
1
+ import { Client } from "./Client.js";
2
+ const createClient = (repositoryNameOrEndpoint, options) => new Client(repositoryNameOrEndpoint, options);
3
+ export {
4
+ createClient
5
+ };
6
+ //# sourceMappingURL=createClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createClient.js","sources":["../../src/createClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { ClientConfig } from \"./Client\"\nimport { Client } from \"./Client\"\n\n/**\n * Type definitions for the `createClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof Client>\n\t): Client<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query content from a repository.\n *\n * @example\n *\n * ```ts\n * // With a repository name\n * createClient(\"my-repo\")\n *\n * // With a full Prismic Content API endpoint\n * createClient(\"https://my-repo.cdn.prismic.io/api/v2\")\n * ```\n *\n * @typeParam TDocuments - A union of Prismic page and custom types for the\n * repository.\n *\n * @param repositoryNameOrEndpoint - The Prismic repository name or full Content\n * API endpoint for the repository.\n * @param options - Configuration that determines how content will be queried\n * from the Prismic repository.\n *\n * @returns A client that can query content from the repository.\n *\n * @see @prismicio/client technical reference: {@link https://prismic.io/docs/technical-reference/prismicio-client/v7}\n */\nexport const createClient: CreateClient = <TDocuments extends PrismicDocument>(\n\trepositoryNameOrEndpoint: string,\n\toptions?: ClientConfig,\n) => new Client<TDocuments>(repositoryNameOrEndpoint, options)\n"],"names":[],"mappings":";AAwCO,MAAM,eAA6B,CACzC,0BACA,YACI,IAAI,OAAmB,0BAA0B,OAAO;"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Migration = require("./Migration.cjs");
4
+ const createMigration = () => new Migration.Migration();
5
+ exports.createMigration = createMigration;
6
+ //# sourceMappingURL=createMigration.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMigration.cjs","sources":["../../src/createMigration.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport { Migration } from \"./Migration\"\n\n/**\n * Type definitions for the `createMigration()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateMigration {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof Migration>\n\t): Migration<TDocuments>\n}\n\n/**\n * Creates a Prismic migration instance that can be used to prepare your\n * migration to Prismic.\n *\n * @example\n *\n * ```ts\n * createMigration()\n * ```\n *\n * @typeParam TDocuments - A union of Prismic document types for the repository.\n *\n * @returns A migration instance to prepare your migration.\n */\nexport const createMigration: CreateMigration = <\n\tTDocuments extends PrismicDocument,\n>() => new Migration<TDocuments>()\n"],"names":["Migration"],"mappings":";;;AA4BO,MAAM,kBAAmC,MAEzC,IAAIA,UAAAA,UAAA;;"}
@@ -0,0 +1,24 @@
1
+ import type { PrismicDocument } from "./types/value/document.js";
2
+ import { Migration } from "./Migration.js";
3
+ /**
4
+ * Type definitions for the `createMigration()` function. May be augmented by
5
+ * third-party libraries.
6
+ */
7
+ export interface CreateMigration {
8
+ <TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof Migration>): Migration<TDocuments>;
9
+ }
10
+ /**
11
+ * Creates a Prismic migration instance that can be used to prepare your
12
+ * migration to Prismic.
13
+ *
14
+ * @example
15
+ *
16
+ * ```ts
17
+ * createMigration()
18
+ * ```
19
+ *
20
+ * @typeParam TDocuments - A union of Prismic document types for the repository.
21
+ *
22
+ * @returns A migration instance to prepare your migration.
23
+ */
24
+ export declare const createMigration: CreateMigration;
@@ -0,0 +1,6 @@
1
+ import { Migration } from "./Migration.js";
2
+ const createMigration = () => new Migration();
3
+ export {
4
+ createMigration
5
+ };
6
+ //# sourceMappingURL=createMigration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMigration.js","sources":["../../src/createMigration.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport { Migration } from \"./Migration\"\n\n/**\n * Type definitions for the `createMigration()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateMigration {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof Migration>\n\t): Migration<TDocuments>\n}\n\n/**\n * Creates a Prismic migration instance that can be used to prepare your\n * migration to Prismic.\n *\n * @example\n *\n * ```ts\n * createMigration()\n * ```\n *\n * @typeParam TDocuments - A union of Prismic document types for the repository.\n *\n * @returns A migration instance to prepare your migration.\n */\nexport const createMigration: CreateMigration = <\n\tTDocuments extends PrismicDocument,\n>() => new Migration<TDocuments>()\n"],"names":[],"mappings":";AA4BO,MAAM,kBAAmC,MAEzC,IAAI,UAAA;"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const WriteClient = require("./WriteClient.cjs");
4
+ const createWriteClient = (repositoryName, options) => new WriteClient.WriteClient(repositoryName, options);
5
+ exports.createWriteClient = createWriteClient;
6
+ //# sourceMappingURL=createWriteClient.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWriteClient.cjs","sources":["../../src/createWriteClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { WriteClientConfig } from \"./WriteClient\"\nimport { WriteClient } from \"./WriteClient\"\n\n/**\n * Type definitions for the `createWriteClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateWriteClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof WriteClient>\n\t): WriteClient<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query and write content to a\n * repository.\n *\n * @remarks\n * This client works in environments supporting File, Blob, and FormData,\n * including Node.js 20 and later.\n *\n * @example\n *\n * ```ts\n * createWriteClient(\"qwerty\", { writeToken: \"***\" })\n * ```\n *\n * @typeParam TDocuments - A union of Prismic document types for the repository.\n *\n * @param repositoryName - The Prismic repository name for the repository.\n * @param options - Configuration that determines how content will be queried\n * from and written to the Prismic repository.\n *\n * @returns A client that can query and write content to the repository.\n */\nexport const createWriteClient: CreateWriteClient = <\n\tTDocuments extends PrismicDocument,\n>(\n\trepositoryName: string,\n\toptions: WriteClientConfig,\n) => new WriteClient<TDocuments>(repositoryName, options)\n"],"names":["WriteClient"],"mappings":";;;AAqCO,MAAM,oBAAuC,CAGnD,gBACA,YACI,IAAIA,YAAAA,YAAwB,gBAAgB,OAAO;;"}
@@ -0,0 +1,32 @@
1
+ import type { PrismicDocument } from "./types/value/document.js";
2
+ import { WriteClient } from "./WriteClient.js";
3
+ /**
4
+ * Type definitions for the `createWriteClient()` function. May be augmented by
5
+ * third-party libraries.
6
+ */
7
+ export interface CreateWriteClient {
8
+ <TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof WriteClient>): WriteClient<TDocuments>;
9
+ }
10
+ /**
11
+ * Creates a Prismic client that can be used to query and write content to a
12
+ * repository.
13
+ *
14
+ * @remarks
15
+ * This client works in environments supporting File, Blob, and FormData,
16
+ * including Node.js 20 and later.
17
+ *
18
+ * @example
19
+ *
20
+ * ```ts
21
+ * createWriteClient("qwerty", { writeToken: "***" })
22
+ * ```
23
+ *
24
+ * @typeParam TDocuments - A union of Prismic document types for the repository.
25
+ *
26
+ * @param repositoryName - The Prismic repository name for the repository.
27
+ * @param options - Configuration that determines how content will be queried
28
+ * from and written to the Prismic repository.
29
+ *
30
+ * @returns A client that can query and write content to the repository.
31
+ */
32
+ export declare const createWriteClient: CreateWriteClient;
@@ -0,0 +1,6 @@
1
+ import { WriteClient } from "./WriteClient.js";
2
+ const createWriteClient = (repositoryName, options) => new WriteClient(repositoryName, options);
3
+ export {
4
+ createWriteClient
5
+ };
6
+ //# sourceMappingURL=createWriteClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWriteClient.js","sources":["../../src/createWriteClient.ts"],"sourcesContent":["import type { PrismicDocument } from \"./types/value/document\"\n\nimport type { WriteClientConfig } from \"./WriteClient\"\nimport { WriteClient } from \"./WriteClient\"\n\n/**\n * Type definitions for the `createWriteClient()` function. May be augmented by\n * third-party libraries.\n */\nexport interface CreateWriteClient {\n\t<TDocuments extends PrismicDocument>(\n\t\t...args: ConstructorParameters<typeof WriteClient>\n\t): WriteClient<TDocuments>\n}\n\n/**\n * Creates a Prismic client that can be used to query and write content to a\n * repository.\n *\n * @remarks\n * This client works in environments supporting File, Blob, and FormData,\n * including Node.js 20 and later.\n *\n * @example\n *\n * ```ts\n * createWriteClient(\"qwerty\", { writeToken: \"***\" })\n * ```\n *\n * @typeParam TDocuments - A union of Prismic document types for the repository.\n *\n * @param repositoryName - The Prismic repository name for the repository.\n * @param options - Configuration that determines how content will be queried\n * from and written to the Prismic repository.\n *\n * @returns A client that can query and write content to the repository.\n */\nexport const createWriteClient: CreateWriteClient = <\n\tTDocuments extends PrismicDocument,\n>(\n\trepositoryName: string,\n\toptions: WriteClientConfig,\n) => new WriteClient<TDocuments>(repositoryName, options)\n"],"names":[],"mappings":";AAqCO,MAAM,oBAAuC,CAGnD,gBACA,YACI,IAAI,YAAwB,gBAAgB,OAAO;"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const PrismicError = require("./PrismicError.cjs");
4
+ class ForbiddenError extends PrismicError.PrismicError {
5
+ }
6
+ exports.ForbiddenError = ForbiddenError;
7
+ //# sourceMappingURL=ForbiddenError.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForbiddenError.cjs","sources":["../../../src/errors/ForbiddenError.ts"],"sourcesContent":["import { PrismicError } from \"./PrismicError\"\n\ntype ForbiddenErrorRepositoryAPIResponse = {\n\ttype: string\n\tmessage: string\n}\n\ntype ForbiddenErrorQueryAPIResponse = {\n\terror: string\n}\n\nexport class ForbiddenError<\n\tTResponse =\n\t\t| ForbiddenErrorRepositoryAPIResponse\n\t\t| ForbiddenErrorQueryAPIResponse,\n> extends PrismicError<TResponse> {}\n"],"names":["PrismicError"],"mappings":";;;AAWM,MAAO,uBAIHA,aAAAA,aAAuB;AAAG;;"}