@prismicio/client 7.21.0-alpha.1 → 7.21.0-canary.147e3f2

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 (820) hide show
  1. package/dist/Client.cjs +920 -1268
  2. package/dist/Client.cjs.map +1 -1
  3. package/dist/Client.d.cts +704 -0
  4. package/dist/Client.d.cts.map +1 -0
  5. package/dist/Client.d.ts +678 -955
  6. package/dist/Client.d.ts.map +1 -0
  7. package/dist/Client.js +913 -1261
  8. package/dist/Client.js.map +1 -1
  9. package/dist/Migration.cjs +281 -312
  10. package/dist/Migration.cjs.map +1 -1
  11. package/dist/Migration.d.cts +216 -0
  12. package/dist/Migration.d.cts.map +1 -0
  13. package/dist/Migration.d.ts +197 -194
  14. package/dist/Migration.d.ts.map +1 -0
  15. package/dist/Migration.js +280 -311
  16. package/dist/Migration.js.map +1 -1
  17. package/dist/WriteClient.cjs +486 -558
  18. package/dist/WriteClient.cjs.map +1 -1
  19. package/dist/WriteClient.d.cts +262 -0
  20. package/dist/WriteClient.d.cts.map +1 -0
  21. package/dist/WriteClient.d.ts +226 -245
  22. package/dist/WriteClient.d.ts.map +1 -0
  23. package/dist/WriteClient.js +482 -554
  24. package/dist/WriteClient.js.map +1 -1
  25. package/dist/_virtual/rolldown_runtime.cjs +14 -0
  26. package/dist/_virtual/rolldown_runtime.js +13 -0
  27. package/dist/buildQueryURL.cjs +89 -59
  28. package/dist/buildQueryURL.cjs.map +1 -1
  29. package/dist/buildQueryURL.d.cts +212 -0
  30. package/dist/buildQueryURL.d.cts.map +1 -0
  31. package/dist/buildQueryURL.d.ts +164 -161
  32. package/dist/buildQueryURL.d.ts.map +1 -0
  33. package/dist/buildQueryURL.js +89 -59
  34. package/dist/buildQueryURL.js.map +1 -1
  35. package/dist/cookie.cjs +17 -3
  36. package/dist/cookie.cjs.map +1 -1
  37. package/dist/cookie.d.cts +11 -0
  38. package/dist/cookie.d.cts.map +1 -0
  39. package/dist/cookie.d.ts +7 -1
  40. package/dist/cookie.d.ts.map +1 -0
  41. package/dist/cookie.js +12 -4
  42. package/dist/cookie.js.map +1 -1
  43. package/dist/createClient.cjs +32 -5
  44. package/dist/createClient.cjs.map +1 -1
  45. package/dist/createClient.d.cts +41 -0
  46. package/dist/createClient.d.cts.map +1 -0
  47. package/dist/createClient.d.ts +22 -13
  48. package/dist/createClient.d.ts.map +1 -0
  49. package/dist/createClient.js +31 -4
  50. package/dist/createClient.js.map +1 -1
  51. package/dist/createMigration.cjs +21 -5
  52. package/dist/createMigration.cjs.map +1 -1
  53. package/dist/createMigration.d.cts +30 -0
  54. package/dist/createMigration.d.cts.map +1 -0
  55. package/dist/createMigration.d.ts +11 -5
  56. package/dist/createMigration.d.ts.map +1 -0
  57. package/dist/createMigration.js +20 -4
  58. package/dist/createMigration.js.map +1 -1
  59. package/dist/createWriteClient.cjs +29 -5
  60. package/dist/createWriteClient.cjs.map +1 -1
  61. package/dist/createWriteClient.d.cts +38 -0
  62. package/dist/createWriteClient.d.cts.map +1 -0
  63. package/dist/createWriteClient.d.ts +11 -5
  64. package/dist/createWriteClient.d.ts.map +1 -0
  65. package/dist/createWriteClient.js +28 -4
  66. package/dist/createWriteClient.js.map +1 -1
  67. package/dist/errors.cjs +31 -0
  68. package/dist/errors.cjs.map +1 -0
  69. package/dist/errors.d.cts +46 -0
  70. package/dist/errors.d.cts.map +1 -0
  71. package/dist/errors.d.ts +46 -0
  72. package/dist/errors.d.ts.map +1 -0
  73. package/dist/errors.js +22 -0
  74. package/dist/errors.js.map +1 -0
  75. package/dist/filter.cjs +93 -236
  76. package/dist/filter.cjs.map +1 -1
  77. package/dist/filter.d.cts +213 -0
  78. package/dist/filter.d.cts.map +1 -0
  79. package/dist/filter.d.ts +212 -208
  80. package/dist/filter.d.ts.map +1 -0
  81. package/dist/filter.js +93 -237
  82. package/dist/filter.js.map +1 -1
  83. package/dist/getGraphQLEndpoint.cjs +18 -10
  84. package/dist/getGraphQLEndpoint.cjs.map +1 -1
  85. package/dist/getGraphQLEndpoint.d.cts +14 -0
  86. package/dist/getGraphQLEndpoint.d.cts.map +1 -0
  87. package/dist/getGraphQLEndpoint.d.ts +5 -1
  88. package/dist/getGraphQLEndpoint.d.ts.map +1 -0
  89. package/dist/getGraphQLEndpoint.js +18 -10
  90. package/dist/getGraphQLEndpoint.js.map +1 -1
  91. package/dist/getRepositoryEndpoint.cjs +27 -10
  92. package/dist/getRepositoryEndpoint.cjs.map +1 -1
  93. package/dist/getRepositoryEndpoint.d.cts +23 -0
  94. package/dist/getRepositoryEndpoint.d.cts.map +1 -0
  95. package/dist/getRepositoryEndpoint.d.ts +14 -3
  96. package/dist/getRepositoryEndpoint.d.ts.map +1 -0
  97. package/dist/getRepositoryEndpoint.js +27 -10
  98. package/dist/getRepositoryEndpoint.js.map +1 -1
  99. package/dist/getRepositoryName.cjs +22 -14
  100. package/dist/getRepositoryName.cjs.map +1 -1
  101. package/dist/getRepositoryName.d.cts +16 -0
  102. package/dist/getRepositoryName.d.cts.map +1 -0
  103. package/dist/getRepositoryName.d.ts +5 -1
  104. package/dist/getRepositoryName.d.ts.map +1 -0
  105. package/dist/getRepositoryName.js +23 -15
  106. package/dist/getRepositoryName.js.map +1 -1
  107. package/dist/getToolbarSrc.cjs +42 -10
  108. package/dist/getToolbarSrc.cjs.map +1 -1
  109. package/dist/getToolbarSrc.d.cts +38 -0
  110. package/dist/getToolbarSrc.d.cts.map +1 -0
  111. package/dist/getToolbarSrc.d.ts +5 -1
  112. package/dist/getToolbarSrc.d.ts.map +1 -0
  113. package/dist/getToolbarSrc.js +42 -10
  114. package/dist/getToolbarSrc.js.map +1 -1
  115. package/dist/helpers/asDate.cjs +36 -11
  116. package/dist/helpers/asDate.cjs.map +1 -1
  117. package/dist/helpers/asDate.d.cts +29 -0
  118. package/dist/helpers/asDate.d.cts.map +1 -0
  119. package/dist/helpers/asDate.d.ts +20 -8
  120. package/dist/helpers/asDate.d.ts.map +1 -0
  121. package/dist/helpers/asDate.js +36 -12
  122. package/dist/helpers/asDate.js.map +1 -1
  123. package/dist/helpers/asHTML.cjs +76 -79
  124. package/dist/helpers/asHTML.cjs.map +1 -1
  125. package/dist/helpers/asHTML.d.cts +147 -0
  126. package/dist/helpers/asHTML.d.cts.map +1 -0
  127. package/dist/helpers/asHTML.d.ts +84 -78
  128. package/dist/helpers/asHTML.d.ts.map +1 -0
  129. package/dist/helpers/asHTML.js +74 -77
  130. package/dist/helpers/asHTML.js.map +1 -1
  131. package/dist/helpers/asImagePixelDensitySrcSet.cjs +57 -18
  132. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  133. package/dist/helpers/asImagePixelDensitySrcSet.d.cts +59 -0
  134. package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -0
  135. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +31 -25
  136. package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -0
  137. package/dist/helpers/asImagePixelDensitySrcSet.js +57 -18
  138. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  139. package/dist/helpers/asImageSrc.cjs +30 -10
  140. package/dist/helpers/asImageSrc.cjs.map +1 -1
  141. package/dist/helpers/asImageSrc.d.cts +34 -0
  142. package/dist/helpers/asImageSrc.d.cts.map +1 -0
  143. package/dist/helpers/asImageSrc.d.ts +20 -14
  144. package/dist/helpers/asImageSrc.d.ts.map +1 -0
  145. package/dist/helpers/asImageSrc.js +30 -10
  146. package/dist/helpers/asImageSrc.js.map +1 -1
  147. package/dist/helpers/asImageWidthSrcSet.cjs +76 -42
  148. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  149. package/dist/helpers/asImageWidthSrcSet.d.cts +67 -0
  150. package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -0
  151. package/dist/helpers/asImageWidthSrcSet.d.ts +34 -28
  152. package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -0
  153. package/dist/helpers/asImageWidthSrcSet.js +76 -42
  154. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  155. package/dist/helpers/asLink.cjs +26 -44
  156. package/dist/helpers/asLink.cjs.map +1 -1
  157. package/dist/helpers/asLink.d.cts +83 -0
  158. package/dist/helpers/asLink.d.cts.map +1 -0
  159. package/dist/helpers/asLink.d.ts +64 -58
  160. package/dist/helpers/asLink.d.ts.map +1 -0
  161. package/dist/helpers/asLink.js +25 -43
  162. package/dist/helpers/asLink.js.map +1 -1
  163. package/dist/helpers/asLinkAttrs.cjs +44 -25
  164. package/dist/helpers/asLinkAttrs.cjs.map +1 -1
  165. package/dist/helpers/asLinkAttrs.d.cts +51 -0
  166. package/dist/helpers/asLinkAttrs.d.cts.map +1 -0
  167. package/dist/helpers/asLinkAttrs.d.ts +29 -28
  168. package/dist/helpers/asLinkAttrs.d.ts.map +1 -0
  169. package/dist/helpers/asLinkAttrs.js +43 -24
  170. package/dist/helpers/asLinkAttrs.js.map +1 -1
  171. package/dist/helpers/asText.cjs +15 -20
  172. package/dist/helpers/asText.cjs.map +1 -1
  173. package/dist/helpers/asText.d.cts +62 -0
  174. package/dist/helpers/asText.d.cts.map +1 -0
  175. package/dist/helpers/asText.d.ts +48 -33
  176. package/dist/helpers/asText.d.ts.map +1 -0
  177. package/dist/helpers/asText.js +15 -20
  178. package/dist/helpers/asText.js.map +1 -1
  179. package/dist/helpers/documentToLinkField.cjs +30 -24
  180. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  181. package/dist/helpers/documentToLinkField.d.cts +21 -0
  182. package/dist/helpers/documentToLinkField.d.cts.map +1 -0
  183. package/dist/helpers/documentToLinkField.d.ts +8 -4
  184. package/dist/helpers/documentToLinkField.d.ts.map +1 -0
  185. package/dist/helpers/documentToLinkField.js +30 -24
  186. package/dist/helpers/documentToLinkField.js.map +1 -1
  187. package/dist/helpers/isFilled.cjs +215 -42
  188. package/dist/helpers/isFilled.cjs.map +1 -1
  189. package/dist/helpers/isFilled.d.cts +199 -0
  190. package/dist/helpers/isFilled.d.cts.map +1 -0
  191. package/dist/helpers/isFilled.d.ts +65 -56
  192. package/dist/helpers/isFilled.d.ts.map +1 -0
  193. package/dist/helpers/isFilled.js +210 -44
  194. package/dist/helpers/isFilled.js.map +1 -1
  195. package/dist/helpers/mapSliceZone.cjs +50 -39
  196. package/dist/helpers/mapSliceZone.cjs.map +1 -1
  197. package/dist/helpers/mapSliceZone.d.cts +139 -0
  198. package/dist/helpers/mapSliceZone.d.cts.map +1 -0
  199. package/dist/helpers/mapSliceZone.d.ts +47 -44
  200. package/dist/helpers/mapSliceZone.d.ts.map +1 -0
  201. package/dist/helpers/mapSliceZone.js +50 -40
  202. package/dist/helpers/mapSliceZone.js.map +1 -1
  203. package/dist/index.cjs +109 -94
  204. package/dist/index.cjs.map +1 -1
  205. package/dist/index.d.cts +173 -0
  206. package/dist/index.d.cts.map +1 -0
  207. package/dist/index.d.ts +143 -173
  208. package/dist/index.d.ts.map +1 -0
  209. package/dist/index.js +31 -73
  210. package/dist/index.js.map +1 -1
  211. package/dist/isRepositoryEndpoint.cjs +20 -9
  212. package/dist/isRepositoryEndpoint.cjs.map +1 -1
  213. package/dist/isRepositoryEndpoint.d.cts +14 -0
  214. package/dist/isRepositoryEndpoint.d.cts.map +1 -0
  215. package/dist/isRepositoryEndpoint.d.ts +7 -3
  216. package/dist/isRepositoryEndpoint.d.ts.map +1 -0
  217. package/dist/isRepositoryEndpoint.js +20 -10
  218. package/dist/isRepositoryEndpoint.js.map +1 -1
  219. package/dist/isRepositoryName.cjs +14 -4
  220. package/dist/isRepositoryName.cjs.map +1 -1
  221. package/dist/isRepositoryName.d.cts +13 -0
  222. package/dist/isRepositoryName.d.cts.map +1 -0
  223. package/dist/isRepositoryName.d.ts +5 -1
  224. package/dist/isRepositoryName.d.ts.map +1 -0
  225. package/dist/isRepositoryName.js +14 -5
  226. package/dist/isRepositoryName.js.map +1 -1
  227. package/dist/lib/devMsg.cjs +22 -5
  228. package/dist/lib/devMsg.cjs.map +1 -1
  229. package/dist/lib/devMsg.js +23 -6
  230. package/dist/lib/devMsg.js.map +1 -1
  231. package/dist/lib/escapeHTML.cjs +36 -39
  232. package/dist/lib/escapeHTML.cjs.map +1 -1
  233. package/dist/lib/escapeHTML.js +36 -40
  234. package/dist/lib/escapeHTML.js.map +1 -1
  235. package/dist/lib/getOptionalLinkProperties.cjs +19 -11
  236. package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
  237. package/dist/lib/getOptionalLinkProperties.js +19 -12
  238. package/dist/lib/getOptionalLinkProperties.js.map +1 -1
  239. package/dist/lib/getPreviewCookie.cjs +25 -16
  240. package/dist/lib/getPreviewCookie.cjs.map +1 -1
  241. package/dist/lib/getPreviewCookie.js +25 -16
  242. package/dist/lib/getPreviewCookie.js.map +1 -1
  243. package/dist/lib/isInternalURL.cjs +15 -6
  244. package/dist/lib/isInternalURL.cjs.map +1 -1
  245. package/dist/lib/isInternalURL.js +15 -7
  246. package/dist/lib/isInternalURL.js.map +1 -1
  247. package/dist/lib/isMigrationValue.cjs +65 -12
  248. package/dist/lib/isMigrationValue.cjs.map +1 -1
  249. package/dist/lib/isMigrationValue.js +63 -13
  250. package/dist/lib/isMigrationValue.js.map +1 -1
  251. package/dist/lib/isValue.cjs +93 -36
  252. package/dist/lib/isValue.cjs.map +1 -1
  253. package/dist/lib/isValue.js +93 -40
  254. package/dist/lib/isValue.js.map +1 -1
  255. package/dist/lib/pLimit.cjs +51 -45
  256. package/dist/lib/pLimit.cjs.map +1 -1
  257. package/dist/lib/pLimit.js +51 -46
  258. package/dist/lib/pLimit.js.map +1 -1
  259. package/dist/lib/request.cjs +54 -37
  260. package/dist/lib/request.cjs.map +1 -1
  261. package/dist/lib/request.d.cts +61 -0
  262. package/dist/lib/request.d.cts.map +1 -0
  263. package/dist/lib/request.d.ts +38 -50
  264. package/dist/lib/request.d.ts.map +1 -0
  265. package/dist/lib/request.js +54 -37
  266. package/dist/lib/request.js.map +1 -1
  267. package/dist/lib/resolveMigrationDocumentData.cjs +147 -125
  268. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
  269. package/dist/lib/resolveMigrationDocumentData.js +143 -122
  270. package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
  271. package/dist/lib/serializerHelpers.cjs +73 -91
  272. package/dist/lib/serializerHelpers.cjs.map +1 -1
  273. package/dist/lib/serializerHelpers.js +71 -94
  274. package/dist/lib/serializerHelpers.js.map +1 -1
  275. package/dist/lib/throttledWarn.cjs +27 -0
  276. package/dist/lib/throttledWarn.cjs.map +1 -0
  277. package/dist/lib/throttledWarn.js +26 -0
  278. package/dist/lib/throttledWarn.js.map +1 -0
  279. package/dist/lib/validateAssetMetadata.cjs +40 -20
  280. package/dist/lib/validateAssetMetadata.cjs.map +1 -1
  281. package/dist/lib/validateAssetMetadata.js +41 -21
  282. package/dist/lib/validateAssetMetadata.js.map +1 -1
  283. package/dist/package.cjs +19 -0
  284. package/dist/package.cjs.map +1 -0
  285. package/dist/package.js +7 -0
  286. package/dist/package.js.map +1 -0
  287. package/dist/richtext/asText.cjs +18 -10
  288. package/dist/richtext/asText.cjs.map +1 -1
  289. package/dist/richtext/asText.d.cts +18 -0
  290. package/dist/richtext/asText.d.cts.map +1 -0
  291. package/dist/richtext/asText.d.ts +13 -7
  292. package/dist/richtext/asText.d.ts.map +1 -0
  293. package/dist/richtext/asText.js +18 -11
  294. package/dist/richtext/asText.js.map +1 -1
  295. package/dist/richtext/asTree.cjs +106 -107
  296. package/dist/richtext/asTree.cjs.map +1 -1
  297. package/dist/richtext/asTree.d.cts +20 -0
  298. package/dist/richtext/asTree.d.cts.map +1 -0
  299. package/dist/richtext/asTree.d.ts +9 -3
  300. package/dist/richtext/asTree.d.ts.map +1 -0
  301. package/dist/richtext/asTree.js +106 -107
  302. package/dist/richtext/asTree.js.map +1 -1
  303. package/dist/richtext/composeSerializers.cjs +28 -14
  304. package/dist/richtext/composeSerializers.cjs.map +1 -1
  305. package/dist/richtext/composeSerializers.d.cts +22 -0
  306. package/dist/richtext/composeSerializers.d.cts.map +1 -0
  307. package/dist/richtext/composeSerializers.d.ts +8 -2
  308. package/dist/richtext/composeSerializers.d.ts.map +1 -0
  309. package/dist/richtext/composeSerializers.js +28 -15
  310. package/dist/richtext/composeSerializers.js.map +1 -1
  311. package/dist/richtext/serialize.cjs +30 -14
  312. package/dist/richtext/serialize.cjs.map +1 -1
  313. package/dist/richtext/serialize.d.cts +25 -0
  314. package/dist/richtext/serialize.d.cts.map +1 -0
  315. package/dist/richtext/serialize.d.ts +17 -11
  316. package/dist/richtext/serialize.d.ts.map +1 -0
  317. package/dist/richtext/serialize.js +30 -14
  318. package/dist/richtext/serialize.js.map +1 -1
  319. package/dist/richtext/types.cjs +10 -8
  320. package/dist/richtext/types.cjs.map +1 -1
  321. package/dist/richtext/types.d.cts +71 -0
  322. package/dist/richtext/types.d.cts.map +1 -0
  323. package/dist/richtext/types.d.ts +49 -49
  324. package/dist/richtext/types.d.ts.map +1 -0
  325. package/dist/richtext/types.js +10 -8
  326. package/dist/richtext/types.js.map +1 -1
  327. package/dist/richtext/wrapMapSerializer.cjs +29 -21
  328. package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
  329. package/dist/richtext/wrapMapSerializer.d.cts +21 -0
  330. package/dist/richtext/wrapMapSerializer.d.cts.map +1 -0
  331. package/dist/richtext/wrapMapSerializer.d.ts +8 -2
  332. package/dist/richtext/wrapMapSerializer.d.ts.map +1 -0
  333. package/dist/richtext/wrapMapSerializer.js +29 -21
  334. package/dist/richtext/wrapMapSerializer.js.map +1 -1
  335. package/dist/richtext.cjs +13 -15
  336. package/dist/richtext.d.cts +8 -0
  337. package/dist/richtext.d.ts +8 -0
  338. package/dist/richtext.js +4 -11
  339. package/dist/types/api/asset/asset.d.cts +97 -0
  340. package/dist/types/api/asset/asset.d.cts.map +1 -0
  341. package/dist/types/api/asset/asset.d.ts +87 -167
  342. package/dist/types/api/asset/asset.d.ts.map +1 -0
  343. package/dist/types/api/asset/tag.d.cts +35 -0
  344. package/dist/types/api/asset/tag.d.cts.map +1 -0
  345. package/dist/types/api/asset/tag.d.ts +29 -47
  346. package/dist/types/api/asset/tag.d.ts.map +1 -0
  347. package/dist/types/api/integration.d.cts +34 -0
  348. package/dist/types/api/integration.d.cts.map +1 -0
  349. package/dist/types/api/integration.d.ts +17 -11
  350. package/dist/types/api/integration.d.ts.map +1 -0
  351. package/dist/types/api/query.d.cts +49 -0
  352. package/dist/types/api/query.d.cts.map +1 -0
  353. package/dist/types/api/query.d.ts +40 -34
  354. package/dist/types/api/query.d.ts.map +1 -0
  355. package/dist/types/api/ref.d.cts +36 -0
  356. package/dist/types/api/ref.d.cts.map +1 -0
  357. package/dist/types/api/ref.d.ts +30 -26
  358. package/dist/types/api/ref.d.ts.map +1 -0
  359. package/dist/types/api/release.d.cts +17 -0
  360. package/dist/types/api/release.d.cts.map +1 -0
  361. package/dist/types/api/release.d.ts +8 -2
  362. package/dist/types/api/release.d.ts.map +1 -0
  363. package/dist/types/api/repository.d.cts +115 -0
  364. package/dist/types/api/repository.d.cts.map +1 -0
  365. package/dist/types/api/repository.d.ts +90 -84
  366. package/dist/types/api/repository.d.ts.map +1 -0
  367. package/dist/types/api/tags.d.cts +13 -0
  368. package/dist/types/api/tags.d.cts.map +1 -0
  369. package/dist/types/api/tags.d.ts +5 -1
  370. package/dist/types/api/tags.d.ts.map +1 -0
  371. package/dist/types/migration/Asset.cjs +34 -32
  372. package/dist/types/migration/Asset.cjs.map +1 -1
  373. package/dist/types/migration/Asset.d.cts +109 -0
  374. package/dist/types/migration/Asset.d.cts.map +1 -0
  375. package/dist/types/migration/Asset.d.ts +89 -88
  376. package/dist/types/migration/Asset.d.ts.map +1 -0
  377. package/dist/types/migration/Asset.js +33 -32
  378. package/dist/types/migration/Asset.js.map +1 -1
  379. package/dist/types/migration/ContentRelationship.d.cts +15 -0
  380. package/dist/types/migration/ContentRelationship.d.cts.map +1 -0
  381. package/dist/types/migration/ContentRelationship.d.ts +10 -11
  382. package/dist/types/migration/ContentRelationship.d.ts.map +1 -0
  383. package/dist/types/migration/Document.cjs +50 -46
  384. package/dist/types/migration/Document.cjs.map +1 -1
  385. package/dist/types/migration/Document.d.cts +97 -0
  386. package/dist/types/migration/Document.d.cts.map +1 -0
  387. package/dist/types/migration/Document.d.ts +62 -59
  388. package/dist/types/migration/Document.d.ts.map +1 -0
  389. package/dist/types/migration/Document.js +49 -46
  390. package/dist/types/migration/Document.js.map +1 -1
  391. package/dist/types/model/boolean.d.cts +21 -0
  392. package/dist/types/model/boolean.d.cts.map +1 -0
  393. package/dist/types/model/boolean.d.ts +15 -9
  394. package/dist/types/model/boolean.d.ts.map +1 -0
  395. package/dist/types/model/color.d.cts +19 -0
  396. package/dist/types/model/color.d.cts.map +1 -0
  397. package/dist/types/model/color.d.ts +13 -7
  398. package/dist/types/model/color.d.ts.map +1 -0
  399. package/dist/types/model/contentRelationship.d.cts +59 -0
  400. package/dist/types/model/contentRelationship.d.cts.map +1 -0
  401. package/dist/types/model/contentRelationship.d.ts +33 -26
  402. package/dist/types/model/contentRelationship.d.ts.map +1 -0
  403. package/dist/types/model/customType.d.cts +54 -0
  404. package/dist/types/model/customType.d.cts.map +1 -0
  405. package/dist/types/model/customType.d.ts +36 -30
  406. package/dist/types/model/customType.d.ts.map +1 -0
  407. package/dist/types/model/date.d.cts +20 -0
  408. package/dist/types/model/date.d.cts.map +1 -0
  409. package/dist/types/model/date.d.ts +14 -8
  410. package/dist/types/model/date.d.ts.map +1 -0
  411. package/dist/types/model/embed.d.cts +19 -0
  412. package/dist/types/model/embed.d.cts.map +1 -0
  413. package/dist/types/model/embed.d.ts +13 -7
  414. package/dist/types/model/embed.d.ts.map +1 -0
  415. package/dist/types/model/geoPoint.d.cts +18 -0
  416. package/dist/types/model/geoPoint.d.cts.map +1 -0
  417. package/dist/types/model/geoPoint.d.ts +12 -6
  418. package/dist/types/model/geoPoint.d.ts.map +1 -0
  419. package/dist/types/model/group.d.cts +29 -0
  420. package/dist/types/model/group.d.cts.map +1 -0
  421. package/dist/types/model/group.d.ts +14 -8
  422. package/dist/types/model/group.d.ts.map +1 -0
  423. package/dist/types/model/image.d.cts +37 -0
  424. package/dist/types/model/image.d.cts.map +1 -0
  425. package/dist/types/model/image.d.ts +19 -13
  426. package/dist/types/model/image.d.ts.map +1 -0
  427. package/dist/types/model/integration.d.cts +20 -0
  428. package/dist/types/model/integration.d.cts.map +1 -0
  429. package/dist/types/model/integration.d.ts +14 -8
  430. package/dist/types/model/integration.d.ts.map +1 -0
  431. package/dist/types/model/keyText.d.cts +19 -0
  432. package/dist/types/model/keyText.d.cts.map +1 -0
  433. package/dist/types/model/keyText.d.ts +13 -7
  434. package/dist/types/model/keyText.d.ts.map +1 -0
  435. package/dist/types/model/link.cjs +13 -6
  436. package/dist/types/model/link.cjs.map +1 -1
  437. package/dist/types/model/link.d.cts +34 -0
  438. package/dist/types/model/link.d.cts.map +1 -0
  439. package/dist/types/model/link.d.ts +22 -16
  440. package/dist/types/model/link.d.ts.map +1 -0
  441. package/dist/types/model/link.js +13 -7
  442. package/dist/types/model/link.js.map +1 -1
  443. package/dist/types/model/linkToMedia.d.cts +23 -0
  444. package/dist/types/model/linkToMedia.d.cts.map +1 -0
  445. package/dist/types/model/linkToMedia.d.ts +17 -11
  446. package/dist/types/model/linkToMedia.d.ts.map +1 -0
  447. package/dist/types/model/number.d.cts +21 -0
  448. package/dist/types/model/number.d.cts.map +1 -0
  449. package/dist/types/model/number.d.ts +15 -9
  450. package/dist/types/model/number.d.ts.map +1 -0
  451. package/dist/types/model/range.d.cts +20 -0
  452. package/dist/types/model/range.d.cts.map +1 -0
  453. package/dist/types/model/range.d.ts +16 -10
  454. package/dist/types/model/range.d.ts.map +1 -0
  455. package/dist/types/model/richText.d.cts +43 -0
  456. package/dist/types/model/richText.d.cts.map +1 -0
  457. package/dist/types/model/richText.d.ts +26 -20
  458. package/dist/types/model/richText.d.ts.map +1 -0
  459. package/dist/types/model/select.d.cts +24 -0
  460. package/dist/types/model/select.d.cts.map +1 -0
  461. package/dist/types/model/select.d.ts +15 -9
  462. package/dist/types/model/select.d.ts.map +1 -0
  463. package/dist/types/model/separator.d.cts +16 -0
  464. package/dist/types/model/separator.d.cts.map +1 -0
  465. package/dist/types/model/separator.d.ts +12 -6
  466. package/dist/types/model/separator.d.ts.map +1 -0
  467. package/dist/types/model/sharedSlice.d.cts +22 -0
  468. package/dist/types/model/sharedSlice.d.cts.map +1 -0
  469. package/dist/types/model/sharedSlice.d.ts +14 -8
  470. package/dist/types/model/sharedSlice.d.ts.map +1 -0
  471. package/dist/types/model/sharedSliceVariation.d.cts +25 -0
  472. package/dist/types/model/sharedSliceVariation.d.cts.map +1 -0
  473. package/dist/types/model/sharedSliceVariation.d.ts +16 -10
  474. package/dist/types/model/sharedSliceVariation.d.ts.map +1 -0
  475. package/dist/types/model/slice.cjs +12 -5
  476. package/dist/types/model/slice.cjs.map +1 -1
  477. package/dist/types/model/slice.d.cts +39 -0
  478. package/dist/types/model/slice.d.cts.map +1 -0
  479. package/dist/types/model/slice.d.ts +21 -15
  480. package/dist/types/model/slice.d.ts.map +1 -0
  481. package/dist/types/model/slice.js +12 -6
  482. package/dist/types/model/slice.js.map +1 -1
  483. package/dist/types/model/sliceZone.cjs +12 -5
  484. package/dist/types/model/sliceZone.cjs.map +1 -1
  485. package/dist/types/model/sliceZone.d.cts +47 -0
  486. package/dist/types/model/sliceZone.d.cts.map +1 -0
  487. package/dist/types/model/sliceZone.d.ts +23 -17
  488. package/dist/types/model/sliceZone.d.ts.map +1 -0
  489. package/dist/types/model/sliceZone.js +12 -6
  490. package/dist/types/model/sliceZone.js.map +1 -1
  491. package/dist/types/model/table.d.cts +18 -0
  492. package/dist/types/model/table.d.cts.map +1 -0
  493. package/dist/types/model/table.d.ts +12 -6
  494. package/dist/types/model/table.d.ts.map +1 -0
  495. package/dist/types/model/timestamp.d.cts +20 -0
  496. package/dist/types/model/timestamp.d.cts.map +1 -0
  497. package/dist/types/model/timestamp.d.ts +14 -8
  498. package/dist/types/model/timestamp.d.ts.map +1 -0
  499. package/dist/types/model/title.d.cts +13 -0
  500. package/dist/types/model/title.d.cts.map +1 -0
  501. package/dist/types/model/title.d.ts +8 -2
  502. package/dist/types/model/title.d.ts.map +1 -0
  503. package/dist/types/model/types.cjs +29 -36
  504. package/dist/types/model/types.cjs.map +1 -1
  505. package/dist/types/model/types.d.cts +82 -0
  506. package/dist/types/model/types.d.cts.map +1 -0
  507. package/dist/types/model/types.d.ts +66 -61
  508. package/dist/types/model/types.d.ts.map +1 -0
  509. package/dist/types/model/types.js +29 -37
  510. package/dist/types/model/types.js.map +1 -1
  511. package/dist/types/model/uid.d.cts +19 -0
  512. package/dist/types/model/uid.d.cts.map +1 -0
  513. package/dist/types/model/uid.d.ts +13 -7
  514. package/dist/types/model/uid.d.ts.map +1 -0
  515. package/dist/types/value/boolean.d.cts +10 -0
  516. package/dist/types/value/boolean.d.cts.map +1 -0
  517. package/dist/types/value/boolean.d.ts +5 -1
  518. package/dist/types/value/boolean.d.ts.map +1 -0
  519. package/dist/types/value/color.d.cts +15 -0
  520. package/dist/types/value/color.d.cts.map +1 -0
  521. package/dist/types/value/color.d.ts +8 -2
  522. package/dist/types/value/color.d.ts.map +1 -0
  523. package/dist/types/value/contentRelationship.d.cts +37 -0
  524. package/dist/types/value/contentRelationship.d.cts.map +1 -0
  525. package/dist/types/value/contentRelationship.d.ts +23 -17
  526. package/dist/types/value/contentRelationship.d.ts.map +1 -0
  527. package/dist/types/value/date.d.cts +15 -0
  528. package/dist/types/value/date.d.cts.map +1 -0
  529. package/dist/types/value/date.d.ts +8 -2
  530. package/dist/types/value/date.d.ts.map +1 -0
  531. package/dist/types/value/document.d.cts +120 -0
  532. package/dist/types/value/document.d.cts.map +1 -0
  533. package/dist/types/value/document.d.ts +90 -84
  534. package/dist/types/value/document.d.ts.map +1 -0
  535. package/dist/types/value/embed.cjs +14 -7
  536. package/dist/types/value/embed.cjs.map +1 -1
  537. package/dist/types/value/embed.d.cts +173 -0
  538. package/dist/types/value/embed.d.cts.map +1 -0
  539. package/dist/types/value/embed.d.ts +110 -105
  540. package/dist/types/value/embed.d.ts.map +1 -0
  541. package/dist/types/value/embed.js +14 -8
  542. package/dist/types/value/embed.js.map +1 -1
  543. package/dist/types/value/geoPoint.d.cts +18 -0
  544. package/dist/types/value/geoPoint.d.cts.map +1 -0
  545. package/dist/types/value/geoPoint.d.ts +10 -4
  546. package/dist/types/value/geoPoint.d.ts.map +1 -0
  547. package/dist/types/value/group.d.cts +19 -0
  548. package/dist/types/value/group.d.cts.map +1 -0
  549. package/dist/types/value/group.d.ts +9 -3
  550. package/dist/types/value/group.d.ts.map +1 -0
  551. package/dist/types/value/image.d.cts +53 -0
  552. package/dist/types/value/image.d.cts.map +1 -0
  553. package/dist/types/value/image.d.ts +31 -25
  554. package/dist/types/value/image.d.ts.map +1 -0
  555. package/dist/types/value/integration.d.cts +22 -0
  556. package/dist/types/value/integration.d.cts.map +1 -0
  557. package/dist/types/value/integration.d.ts +9 -3
  558. package/dist/types/value/integration.d.ts.map +1 -0
  559. package/dist/types/value/keyText.d.cts +15 -0
  560. package/dist/types/value/keyText.d.cts.map +1 -0
  561. package/dist/types/value/keyText.d.ts +8 -2
  562. package/dist/types/value/keyText.d.ts.map +1 -0
  563. package/dist/types/value/link.cjs +12 -7
  564. package/dist/types/value/link.cjs.map +1 -1
  565. package/dist/types/value/link.d.cts +74 -0
  566. package/dist/types/value/link.d.cts.map +1 -0
  567. package/dist/types/value/link.d.ts +27 -21
  568. package/dist/types/value/link.d.ts.map +1 -0
  569. package/dist/types/value/link.js +12 -8
  570. package/dist/types/value/link.js.map +1 -1
  571. package/dist/types/value/linkToMedia.d.cts +33 -0
  572. package/dist/types/value/linkToMedia.d.cts.map +1 -0
  573. package/dist/types/value/linkToMedia.d.ts +19 -14
  574. package/dist/types/value/linkToMedia.d.ts.map +1 -0
  575. package/dist/types/value/number.d.cts +15 -0
  576. package/dist/types/value/number.d.cts.map +1 -0
  577. package/dist/types/value/number.d.ts +8 -2
  578. package/dist/types/value/number.d.ts.map +1 -0
  579. package/dist/types/value/richText.cjs +29 -22
  580. package/dist/types/value/richText.cjs.map +1 -1
  581. package/dist/types/value/richText.d.cts +221 -0
  582. package/dist/types/value/richText.d.cts.map +1 -0
  583. package/dist/types/value/richText.d.ts +103 -97
  584. package/dist/types/value/richText.d.ts.map +1 -0
  585. package/dist/types/value/richText.js +29 -23
  586. package/dist/types/value/richText.js.map +1 -1
  587. package/dist/types/value/select.d.cts +16 -0
  588. package/dist/types/value/select.d.cts.map +1 -0
  589. package/dist/types/value/select.d.ts +8 -2
  590. package/dist/types/value/select.d.ts.map +1 -0
  591. package/dist/types/value/sharedSlice.d.cts +17 -0
  592. package/dist/types/value/sharedSlice.d.cts.map +1 -0
  593. package/dist/types/value/sharedSlice.d.ts +11 -5
  594. package/dist/types/value/sharedSlice.d.ts.map +1 -0
  595. package/dist/types/value/sharedSliceVariation.d.cts +16 -0
  596. package/dist/types/value/sharedSliceVariation.d.cts.map +1 -0
  597. package/dist/types/value/sharedSliceVariation.d.ts +12 -6
  598. package/dist/types/value/sharedSliceVariation.d.ts.map +1 -0
  599. package/dist/types/value/slice.d.cts +19 -0
  600. package/dist/types/value/slice.d.cts.map +1 -0
  601. package/dist/types/value/slice.d.ts +13 -7
  602. package/dist/types/value/slice.d.ts.map +1 -0
  603. package/dist/types/value/sliceZone.d.cts +18 -0
  604. package/dist/types/value/sliceZone.d.cts.map +1 -0
  605. package/dist/types/value/sliceZone.d.ts +10 -4
  606. package/dist/types/value/sliceZone.d.ts.map +1 -0
  607. package/dist/types/value/table.d.cts +97 -0
  608. package/dist/types/value/table.d.cts.map +1 -0
  609. package/dist/types/value/table.d.ts +65 -59
  610. package/dist/types/value/table.d.ts.map +1 -0
  611. package/dist/types/value/timestamp.d.cts +13 -0
  612. package/dist/types/value/timestamp.d.cts.map +1 -0
  613. package/dist/types/value/timestamp.d.ts +8 -3
  614. package/dist/types/value/timestamp.d.ts.map +1 -0
  615. package/dist/types/value/title.d.cts +16 -0
  616. package/dist/types/value/title.d.cts.map +1 -0
  617. package/dist/types/value/title.d.ts +11 -7
  618. package/dist/types/value/title.d.ts.map +1 -0
  619. package/dist/types/value/types.d.cts +61 -0
  620. package/dist/types/value/types.d.cts.map +1 -0
  621. package/dist/types/value/types.d.ts +31 -28
  622. package/dist/types/value/types.d.ts.map +1 -0
  623. package/dist/types/webhook/apiUpdate.d.cts +57 -0
  624. package/dist/types/webhook/apiUpdate.d.cts.map +1 -0
  625. package/dist/types/webhook/apiUpdate.d.ts +28 -23
  626. package/dist/types/webhook/apiUpdate.d.ts.map +1 -0
  627. package/dist/types/webhook/testTrigger.d.cts +15 -0
  628. package/dist/types/webhook/testTrigger.d.cts.map +1 -0
  629. package/dist/types/webhook/testTrigger.d.ts +9 -3
  630. package/dist/types/webhook/testTrigger.d.ts.map +1 -0
  631. package/dist/types/webhook/types.cjs +12 -5
  632. package/dist/types/webhook/types.cjs.map +1 -1
  633. package/dist/types/webhook/types.d.cts +23 -0
  634. package/dist/types/webhook/types.d.cts.map +1 -0
  635. package/dist/types/webhook/types.d.ts +16 -11
  636. package/dist/types/webhook/types.d.ts.map +1 -0
  637. package/dist/types/webhook/types.js +12 -6
  638. package/dist/types/webhook/types.js.map +1 -1
  639. package/package.json +20 -49
  640. package/src/Client.ts +682 -1028
  641. package/src/WriteClient.ts +44 -46
  642. package/src/buildQueryURL.ts +41 -39
  643. package/src/createClient.ts +11 -8
  644. package/src/errors.ts +94 -0
  645. package/src/getGraphQLEndpoint.ts +1 -1
  646. package/src/getRepositoryEndpoint.ts +10 -3
  647. package/src/getRepositoryName.ts +1 -1
  648. package/src/getToolbarSrc.ts +1 -1
  649. package/src/helpers/asDate.ts +11 -4
  650. package/src/helpers/asHTML.ts +38 -30
  651. package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
  652. package/src/helpers/asImageSrc.ts +11 -10
  653. package/src/helpers/asImageWidthSrcSet.ts +19 -22
  654. package/src/helpers/asLink.ts +33 -35
  655. package/src/helpers/asLinkAttrs.ts +6 -13
  656. package/src/helpers/asText.ts +20 -10
  657. package/src/helpers/isFilled.ts +15 -14
  658. package/src/helpers/mapSliceZone.ts +15 -15
  659. package/src/index.ts +13 -10
  660. package/src/isRepositoryEndpoint.ts +2 -2
  661. package/src/lib/isValue.ts +0 -6
  662. package/src/lib/pLimit.ts +1 -1
  663. package/src/lib/request.ts +3 -3
  664. package/src/lib/{throttledLog.ts → throttledWarn.ts} +3 -14
  665. package/src/lib/validateAssetMetadata.ts +1 -1
  666. package/src/richtext/asText.ts +5 -5
  667. package/src/richtext/serialize.ts +8 -8
  668. package/src/richtext/types.ts +6 -6
  669. package/src/types/migration/Asset.ts +10 -2
  670. package/src/types/migration/Document.ts +1 -1
  671. package/src/types/model/contentRelationship.ts +1 -0
  672. package/src/types/model/types.ts +0 -2
  673. package/src/types/value/date.ts +1 -1
  674. package/src/types/value/document.ts +3 -3
  675. package/src/types/value/timestamp.ts +1 -5
  676. package/dist/errors/ForbiddenError.cjs +0 -7
  677. package/dist/errors/ForbiddenError.cjs.map +0 -1
  678. package/dist/errors/ForbiddenError.d.ts +0 -11
  679. package/dist/errors/ForbiddenError.js +0 -7
  680. package/dist/errors/ForbiddenError.js.map +0 -1
  681. package/dist/errors/InvalidDataError.cjs +0 -7
  682. package/dist/errors/InvalidDataError.cjs.map +0 -1
  683. package/dist/errors/InvalidDataError.d.ts +0 -3
  684. package/dist/errors/InvalidDataError.js +0 -7
  685. package/dist/errors/InvalidDataError.js.map +0 -1
  686. package/dist/errors/NotFoundError.cjs +0 -7
  687. package/dist/errors/NotFoundError.cjs.map +0 -1
  688. package/dist/errors/NotFoundError.d.ts +0 -3
  689. package/dist/errors/NotFoundError.js +0 -7
  690. package/dist/errors/NotFoundError.js.map +0 -1
  691. package/dist/errors/ParsingError.cjs +0 -7
  692. package/dist/errors/ParsingError.cjs.map +0 -1
  693. package/dist/errors/ParsingError.d.ts +0 -14
  694. package/dist/errors/ParsingError.js +0 -7
  695. package/dist/errors/ParsingError.js.map +0 -1
  696. package/dist/errors/PreviewTokenExpired.cjs +0 -7
  697. package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
  698. package/dist/errors/PreviewTokenExpired.d.ts +0 -8
  699. package/dist/errors/PreviewTokenExpired.js +0 -7
  700. package/dist/errors/PreviewTokenExpired.js.map +0 -1
  701. package/dist/errors/PrismicError.cjs +0 -16
  702. package/dist/errors/PrismicError.cjs.map +0 -1
  703. package/dist/errors/PrismicError.d.ts +0 -5
  704. package/dist/errors/PrismicError.js +0 -16
  705. package/dist/errors/PrismicError.js.map +0 -1
  706. package/dist/errors/RefExpiredError.cjs +0 -7
  707. package/dist/errors/RefExpiredError.cjs.map +0 -1
  708. package/dist/errors/RefExpiredError.d.ts +0 -8
  709. package/dist/errors/RefExpiredError.js +0 -7
  710. package/dist/errors/RefExpiredError.js.map +0 -1
  711. package/dist/errors/RefNotFoundError.cjs +0 -7
  712. package/dist/errors/RefNotFoundError.cjs.map +0 -1
  713. package/dist/errors/RefNotFoundError.d.ts +0 -8
  714. package/dist/errors/RefNotFoundError.js +0 -7
  715. package/dist/errors/RefNotFoundError.js.map +0 -1
  716. package/dist/errors/RepositoryNotFoundError.cjs +0 -7
  717. package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
  718. package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
  719. package/dist/errors/RepositoryNotFoundError.js +0 -7
  720. package/dist/errors/RepositoryNotFoundError.js.map +0 -1
  721. package/dist/lib/appendFilters.cjs +0 -11
  722. package/dist/lib/appendFilters.cjs.map +0 -1
  723. package/dist/lib/appendFilters.d.ts +0 -18
  724. package/dist/lib/appendFilters.js +0 -11
  725. package/dist/lib/appendFilters.js.map +0 -1
  726. package/dist/lib/castArray.cjs +0 -7
  727. package/dist/lib/castArray.cjs.map +0 -1
  728. package/dist/lib/castArray.d.ts +0 -12
  729. package/dist/lib/castArray.js +0 -7
  730. package/dist/lib/castArray.js.map +0 -1
  731. package/dist/lib/castThunk.cjs +0 -7
  732. package/dist/lib/castThunk.cjs.map +0 -1
  733. package/dist/lib/castThunk.d.ts +0 -11
  734. package/dist/lib/castThunk.js +0 -7
  735. package/dist/lib/castThunk.js.map +0 -1
  736. package/dist/lib/devMsg.d.ts +0 -16
  737. package/dist/lib/escapeHTML.d.ts +0 -1
  738. package/dist/lib/everyTagFilter.cjs +0 -9
  739. package/dist/lib/everyTagFilter.cjs.map +0 -1
  740. package/dist/lib/everyTagFilter.d.ts +0 -9
  741. package/dist/lib/everyTagFilter.js +0 -9
  742. package/dist/lib/everyTagFilter.js.map +0 -1
  743. package/dist/lib/findMasterRef.cjs +0 -8
  744. package/dist/lib/findMasterRef.cjs.map +0 -1
  745. package/dist/lib/findMasterRef.d.ts +0 -11
  746. package/dist/lib/findMasterRef.js +0 -8
  747. package/dist/lib/findMasterRef.js.map +0 -1
  748. package/dist/lib/findRef.cjs +0 -12
  749. package/dist/lib/findRef.cjs.map +0 -1
  750. package/dist/lib/findRef.d.ts +0 -14
  751. package/dist/lib/findRef.js +0 -12
  752. package/dist/lib/findRef.js.map +0 -1
  753. package/dist/lib/findRefByID.cjs +0 -8
  754. package/dist/lib/findRefByID.cjs.map +0 -1
  755. package/dist/lib/findRefByID.d.ts +0 -12
  756. package/dist/lib/findRefByID.js +0 -8
  757. package/dist/lib/findRefByID.js.map +0 -1
  758. package/dist/lib/findRefByLabel.cjs +0 -8
  759. package/dist/lib/findRefByLabel.cjs.map +0 -1
  760. package/dist/lib/findRefByLabel.d.ts +0 -12
  761. package/dist/lib/findRefByLabel.js +0 -8
  762. package/dist/lib/findRefByLabel.js.map +0 -1
  763. package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
  764. package/dist/lib/getPreviewCookie.d.ts +0 -9
  765. package/dist/lib/isInternalURL.d.ts +0 -8
  766. package/dist/lib/isMigrationValue.d.ts +0 -71
  767. package/dist/lib/isValue.d.ts +0 -78
  768. package/dist/lib/minifyGraphQLQuery.cjs +0 -7
  769. package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
  770. package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
  771. package/dist/lib/minifyGraphQLQuery.js +0 -7
  772. package/dist/lib/minifyGraphQLQuery.js.map +0 -1
  773. package/dist/lib/pLimit.d.ts +0 -22
  774. package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
  775. package/dist/lib/serializerHelpers.d.ts +0 -9
  776. package/dist/lib/someTagsFilter.cjs +0 -9
  777. package/dist/lib/someTagsFilter.cjs.map +0 -1
  778. package/dist/lib/someTagsFilter.d.ts +0 -9
  779. package/dist/lib/someTagsFilter.js +0 -9
  780. package/dist/lib/someTagsFilter.js.map +0 -1
  781. package/dist/lib/throttledLog.cjs +0 -17
  782. package/dist/lib/throttledLog.cjs.map +0 -1
  783. package/dist/lib/throttledLog.d.ts +0 -15
  784. package/dist/lib/throttledLog.js +0 -17
  785. package/dist/lib/throttledLog.js.map +0 -1
  786. package/dist/lib/typeFilter.cjs +0 -8
  787. package/dist/lib/typeFilter.cjs.map +0 -1
  788. package/dist/lib/typeFilter.d.ts +0 -8
  789. package/dist/lib/typeFilter.js +0 -8
  790. package/dist/lib/typeFilter.js.map +0 -1
  791. package/dist/lib/validateAssetMetadata.d.ts +0 -10
  792. package/dist/package.json.cjs +0 -7
  793. package/dist/package.json.cjs.map +0 -1
  794. package/dist/package.json.js +0 -7
  795. package/dist/package.json.js.map +0 -1
  796. package/dist/richtext/index.d.ts +0 -7
  797. package/dist/richtext.cjs.map +0 -1
  798. package/dist/richtext.js.map +0 -1
  799. package/dist/types/api/migration/document.d.ts +0 -60
  800. package/dist/types/migration/Link.d.ts +0 -19
  801. package/src/errors/ForbiddenError.ts +0 -16
  802. package/src/errors/InvalidDataError.ts +0 -5
  803. package/src/errors/NotFoundError.ts +0 -5
  804. package/src/errors/ParsingError.ts +0 -16
  805. package/src/errors/PreviewTokenExpired.ts +0 -12
  806. package/src/errors/PrismicError.ts +0 -15
  807. package/src/errors/RefExpiredError.ts +0 -14
  808. package/src/errors/RefNotFoundError.ts +0 -14
  809. package/src/errors/RepositoryNotFoundError.ts +0 -5
  810. package/src/lib/appendFilters.ts +0 -26
  811. package/src/lib/castArray.ts +0 -14
  812. package/src/lib/castThunk.ts +0 -13
  813. package/src/lib/everyTagFilter.ts +0 -15
  814. package/src/lib/findMasterRef.ts +0 -16
  815. package/src/lib/findRef.ts +0 -25
  816. package/src/lib/findRefByID.ts +0 -17
  817. package/src/lib/findRefByLabel.ts +0 -17
  818. package/src/lib/minifyGraphQLQuery.ts +0 -13
  819. package/src/lib/someTagsFilter.ts +0 -15
  820. package/src/lib/typeFilter.ts +0 -12
package/dist/Client.d.ts CHANGED
@@ -1,981 +1,704 @@
1
- import { type AbortSignalLike, type FetchLike, type RequestInitLike } from "./lib/request";
2
- import type { Query } from "./types/api/query";
3
- import type { Ref } from "./types/api/ref";
4
- import type { Repository } from "./types/api/repository";
5
- import type { PrismicDocument } from "./types/value/document";
6
- import type { LinkResolverFunction } from "./helpers/asLink";
7
- import type { BuildQueryURLArgs } from "./buildQueryURL";
1
+ import { PrismicDocument } from "./types/value/document.js";
2
+ import { LinkResolverFunction } from "./helpers/asLink.js";
3
+ import { AbortSignalLike, FetchLike, RequestInitLike } from "./lib/request.js";
4
+ import { Query } from "./types/api/query.js";
5
+ import { Ref } from "./types/api/ref.js";
6
+ import { Repository } from "./types/api/repository.js";
7
+ import { BuildQueryURLArgs } from "./buildQueryURL.js";
8
+
9
+ //#region src/Client.d.ts
10
+
8
11
  /**
9
- * The number of milliseconds in which repository metadata is considered valid.
10
- * A ref can be invalidated quickly depending on how frequently content is
11
- * updated in the Prismic repository. As such, repository's metadata can only be
12
- * considered valid for a short amount of time.
13
- */
14
- export declare const REPOSITORY_CACHE_TTL = 5000;
15
- /**
16
- * The number of milliseconds in which a multi-page `getAll` (e.g. `getAll`,
17
- * `getAllByType`, `getAllByTag`) will wait between individual page requests.
18
- *
19
- * This is done to ensure API performance is sustainable and reduces the chance
20
- * of a failed API request due to overloading.
21
- */
22
- export declare const GET_ALL_QUERY_DELAY = 500;
23
- /**
24
- * Extracts one or more Prismic document types that match a given Prismic
25
- * document type. If no matches are found, no extraction is performed and the
26
- * union of all provided Prismic document types are returned.
27
- *
28
- * @typeParam TDocuments - Prismic document types from which to extract.
29
- * @typeParam TDocumentType - Type(s) to match `TDocuments` against.
12
+ * Extracts a document type with a matching `type` property from a union of
13
+ * document types.
30
14
  */
31
15
  type ExtractDocumentType<TDocuments extends PrismicDocument, TDocumentType extends TDocuments["type"]> = Extract<TDocuments, {
32
- type: TDocumentType;
16
+ type: TDocumentType;
33
17
  }> extends never ? TDocuments : Extract<TDocuments, {
34
- type: TDocumentType;
18
+ type: TDocumentType;
35
19
  }>;
36
20
  /**
37
21
  * The minimum required properties to treat as an HTTP Request for automatic
38
22
  * Prismic preview support.
39
23
  */
40
- export type HttpRequestLike = /**
41
- * Web API Request
42
- *
43
- * @see http://developer.mozilla.org/en-US/docs/Web/API/Request
44
- */ {
45
- headers?: {
46
- get(name: string): string | null;
47
- };
48
- url?: string;
49
- }
50
- /**
51
- * Express-style Request
52
- */
53
- | {
54
- headers?: {
55
- cookie?: string;
56
- };
57
- query?: Record<string, unknown>;
24
+ type HttpRequestLike =
25
+ // Web API Request
26
+ {
27
+ headers?: {
28
+ get(name: string): string | null;
29
+ };
30
+ url?: string;
31
+ } | {
32
+ headers?: {
33
+ cookie?: string;
34
+ };
35
+ query?: Record<string, unknown>;
58
36
  };
59
37
  /**
60
- * A ref or a function that returns a ref. If a static ref is known, one can be
61
- * given. If the ref must be fetched on-demand, a function can be provided. This
62
- * function can optionally be asynchronous.
63
- */
64
- type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
65
- /**
66
- * Parameters for any client method that use `fetch()`.
38
+ * A function that returns a ref string. Used to configure which ref the client
39
+ * queries content from.
67
40
  */
68
- export type FetchParams = {
69
- /**
70
- * Options provided to the client's `fetch()` on all network requests. These
71
- * options will be merged with internally required options. They can also be
72
- * overriden on a per-query basis using the query's `fetchOptions` parameter.
73
- */
74
- fetchOptions?: RequestInitLike;
75
- /**
76
- * An `AbortSignal` provided by an `AbortController`. This allows the network
77
- * request to be cancelled if necessary.
78
- *
79
- * @deprecated Move the `signal` parameter into `fetchOptions.signal`:
80
- *
81
- * @see \<https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\>
82
- */
83
- signal?: AbortSignalLike;
41
+ type GetRef = (params?: Pick<BuildQueryURLArgs, "accessToken"> & FetchParams) => string | undefined | Promise<string | undefined>;
42
+ /** Parameters for client methods that use `fetch()`. */
43
+ type FetchParams = {
44
+ /**
45
+ * Options provided to the client's `fetch()` on all network requests. These
46
+ * options will be merged with internally required options. They can also be
47
+ * overriden on a per-query basis using the query's `fetchOptions` parameter.
48
+ */
49
+ fetchOptions?: RequestInitLike;
50
+ /** @deprecated Move to `fetchOptions.signal`: */
51
+ signal?: AbortSignalLike;
84
52
  };
85
- /**
86
- * Configuration for clients that determine how content is queried.
87
- */
88
- export type ClientConfig = {
89
- /**
90
- * The full Rest API V2 endpoint for the repository. This is only helpful if
91
- * you're using Prismic behind a proxy which we do not recommend.
92
- *
93
- * @defaultValue `getRepositoryEndpoint(repositoryNameOrEndpoint)`
94
- */
95
- documentAPIEndpoint?: string;
96
- /**
97
- * The secure token for accessing the Prismic repository. This is only
98
- * required if the repository is set to private.
99
- */
100
- accessToken?: string;
101
- /**
102
- * A string representing a version of the Prismic repository's content. This
103
- * may point to the latest version (called the "master ref"), or a preview
104
- * with draft content.
105
- */
106
- ref?: RefStringOrThunk;
107
- /**
108
- * A list of route resolver objects that define how a document's `url`
109
- * property is resolved.
110
- *
111
- * {@link https://prismic.io/docs/route-resolver}
112
- */
113
- routes?: NonNullable<BuildQueryURLArgs["routes"]>;
114
- /**
115
- * The `brokenRoute` option allows you to define the route populated in the
116
- * `url` property for broken link or content relationship fields. A broken
117
- * link is a link or content relationship field whose linked document has been
118
- * unpublished or deleted.
119
- *
120
- * {@link https://prismic.io/docs/route-resolver}
121
- */
122
- brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
123
- /**
124
- * Default parameters that will be sent with each query. These parameters can
125
- * be overridden on each query if needed.
126
- */
127
- defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute">;
128
- /**
129
- * The function used to make network requests to the Prismic REST API. In
130
- * environments where a global `fetch` function does not exist, such as
131
- * Node.js, this function must be provided.
132
- */
133
- fetch?: FetchLike;
134
- /**
135
- * Options provided to the client's `fetch()` on all network requests. These
136
- * options will be merged with internally required options. They can also be
137
- * overriden on a per-query basis using the query's `fetchOptions` parameter.
138
- */
139
- fetchOptions?: RequestInitLike;
53
+ /** Prismic client configuration. */
54
+ type ClientConfig = {
55
+ /**
56
+ * The client's Content API endpoint.
57
+ *
58
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
59
+ */
60
+ documentAPIEndpoint?: string;
61
+ /**
62
+ * The secure token used for the Content API.
63
+ *
64
+ * @see {@link https://prismic.io/docs/fetch-content#content-visibility}
65
+ */
66
+ accessToken?: string;
67
+ /**
68
+ * The version of the repository's content. It can optionally be a function
69
+ * that returns a ref.
70
+ *
71
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
72
+ */
73
+ ref?: string | GetRef;
74
+ /**
75
+ * A list of route resolver objects that define how a document's `url`
76
+ * property is resolved.
77
+ *
78
+ * @see {@link https://prismic.io/docs/routes}
79
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
80
+ */
81
+ routes?: NonNullable<BuildQueryURLArgs["routes"]>;
82
+ /**
83
+ * The URL used for link or content relationship fields that point to an
84
+ * archived or deleted page.
85
+ *
86
+ * @see {@link https://prismic.io/docs/routes}
87
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
88
+ */
89
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
90
+ /**
91
+ * Default parameters sent with each Content API request. These parameters can
92
+ * be overridden on each method.
93
+ *
94
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
95
+ */
96
+ defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute">;
97
+ /**
98
+ * The `fetch` function used to make network requests.
99
+ *
100
+ * @default The global `fetch` function.
101
+ *
102
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
103
+ */
104
+ fetch?: FetchLike;
105
+ /**
106
+ * The default `fetch` options sent with each Content API request. These
107
+ * parameters can be overriden on each method.
108
+ *
109
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
110
+ */
111
+ fetchOptions?: RequestInitLike;
140
112
  };
141
113
  /**
142
114
  * Parameters specific to client methods that fetch all documents. These methods
143
- * start with `getAll` (for example, `getAllByType`).
115
+ * start with `getAll` (e.g. `getAllByType`).
144
116
  */
145
117
  type GetAllParams = {
146
- /**
147
- * Limit the number of documents queried. If a number is not provided, there
148
- * will be no limit and all matching documents will be returned.
149
- */
150
- limit?: number;
118
+ /**
119
+ * Limit the number of documents queried.
120
+ *
121
+ * @default No limit.
122
+ */
123
+ limit?: number;
151
124
  };
152
125
  /**
153
- * Arguments to determine how the URL for a preview session is resolved.
126
+ * A client for fetching content from a Prismic repository.
127
+ *
128
+ * @see {@link https://prismic.io/docs/fetch-content}
129
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}
154
130
  */
155
- type ResolvePreviewArgs<LinkResolverReturnType> = {
156
- /**
157
- * A function that maps a Prismic document to a URL within your app.
158
- */
131
+ declare class Client<TDocuments extends PrismicDocument = PrismicDocument> {
132
+ #private;
133
+ /**
134
+ * The client's Content API endpoint.
135
+ *
136
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
137
+ */
138
+ documentAPIEndpoint: string;
139
+ /**
140
+ * The secure token used for the Content API.
141
+ *
142
+ * @see {@link https://prismic.io/docs/fetch-content#content-visibility}
143
+ */
144
+ accessToken?: string;
145
+ /**
146
+ * A list of route resolver objects that define how a document's `url`
147
+ * property is resolved.
148
+ *
149
+ * @see {@link https://prismic.io/docs/routes}
150
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
151
+ */
152
+ routes?: NonNullable<BuildQueryURLArgs["routes"]>;
153
+ /**
154
+ * The URL used for link or content relationship fields that point to an
155
+ * archived or deleted page.
156
+ *
157
+ * @see {@link https://prismic.io/docs/routes}
158
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
159
+ */
160
+ brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
161
+ /**
162
+ * Default parameters sent with each Content API request. These parameters can
163
+ * be overridden on each method.
164
+ *
165
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
166
+ */
167
+ defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
168
+ /**
169
+ * The `fetch` function used to make network requests.
170
+ *
171
+ * @default The global `fetch` function.
172
+ *
173
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
174
+ */
175
+ fetchFn: FetchLike;
176
+ /**
177
+ * The default `fetch` options sent with each Content API request. These
178
+ * parameters can be overriden on each method.
179
+ *
180
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
181
+ */
182
+ fetchOptions: RequestInitLike;
183
+ /**
184
+ * @param repositoryNameOrEndpoint - The Prismic repository name or full
185
+ * Content API endpoint for the repository.
186
+ * @param config - Client configuration.
187
+ */
188
+ constructor(repositoryNameOrEndpoint: string, config?: ClientConfig);
189
+ /** The Prismic repository's name. */
190
+ set repositoryName(value: string);
191
+ /** The Prismic repository's name. */
192
+ get repositoryName(): string;
193
+ /** @deprecated Replace with `documentAPIEndpoint`. */
194
+ set endpoint(value: string);
195
+ /** @deprecated Replace with `documentAPIEndpoint`. */
196
+ get endpoint(): string;
197
+ /**
198
+ * Enables the client to automatically query content from a preview session.
199
+ *
200
+ * @example
201
+ *
202
+ * ```ts
203
+ * client.enableAutoPreviews()
204
+ * ```
205
+ *
206
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}
207
+ */
208
+ enableAutoPreviews(): void;
209
+ /**
210
+ * Enables the client to automatically query content from a preview session
211
+ * using an HTTP request object.
212
+ *
213
+ * @example
214
+ *
215
+ * ```ts
216
+ * client.enableAutoPreviewsFromReq(req)
217
+ * ```
218
+ *
219
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}
220
+ */
221
+ enableAutoPreviewsFromReq(request: HttpRequestLike): void;
222
+ /**
223
+ * Disables the client from automatically querying content from a preview
224
+ * session.
225
+ *
226
+ * @example
227
+ *
228
+ * ```ts
229
+ * client.disableAutoPreviews()
230
+ * ```
231
+ *
232
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}
233
+ */
234
+ disableAutoPreviews(): void;
235
+ /**
236
+ * Fetches pages based on the `params` argument. Results are paginated.
237
+ *
238
+ * @example
239
+ *
240
+ * ```ts
241
+ * const response = await client.get({ pageSize: 10 })
242
+ * ```
243
+ *
244
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}
245
+ */
246
+ get<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
247
+ /**
248
+ * Fetches the first page returned based on the `params` argument.
249
+ *
250
+ * @example
251
+ *
252
+ * ```ts
253
+ * const page = await client.getFirst()
254
+ * ```
255
+ *
256
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}
257
+ */
258
+ getFirst<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
259
+ /**
260
+ * Fetches all pages based on the `params` argument. This method may make
261
+ * multiple network requests to fetch all matching pages.
262
+ *
263
+ * @example
264
+ *
265
+ * ```ts
266
+ * const pages = await client.dangerouslyGetAll()
267
+ * ```
268
+ *
269
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}
270
+ */
271
+ dangerouslyGetAll<TDocument extends TDocuments>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
272
+ /**
273
+ * Fetches a page with a specific ID.
274
+ *
275
+ * @example
276
+ *
277
+ * ```ts
278
+ * const page = await client.getByID("WW4bKScAAMAqmluX")
279
+ * ```
280
+ *
281
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}
282
+ */
283
+ getByID<TDocument extends TDocuments>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
284
+ /**
285
+ * Fetches pages with specific IDs. Results are paginated.
286
+ *
287
+ * @example
288
+ *
289
+ * ```ts
290
+ * const response = await client.getByIDs([
291
+ * "WW4bKScAAMAqmluX",
292
+ * "U1kTRgEAAC8A5ldS",
293
+ * ])
294
+ * ```
295
+ *
296
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}
297
+ */
298
+ getByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
299
+ /**
300
+ * Fetches pages with specific IDs. This method may make multiple network
301
+ * requests to fetch all matching pages.
302
+ *
303
+ * @example
304
+ *
305
+ * ```ts
306
+ * const pages = await client.getAllByIDs([
307
+ * "WW4bKScAAMAqmluX",
308
+ * "U1kTRgEAAC8A5ldS",
309
+ * ])
310
+ * ```
311
+ *
312
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}
313
+ */
314
+ getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
315
+ /**
316
+ * Fetches a page with a specific UID and type.
317
+ *
318
+ * @example
319
+ *
320
+ * ```ts
321
+ * const page = await client.getByUID("blog_post", "my-first-post")
322
+ * ```
323
+ *
324
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}
325
+ */
326
+ getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
327
+ /**
328
+ * Fetches pages with specific UIDs and a specific type. Results are
329
+ * paginated.
330
+ *
331
+ * @example
332
+ *
333
+ * ```ts
334
+ * const response = await client.getByUIDs("blog_post", [
335
+ * "my-first-post",
336
+ * "my-second-post",
337
+ * ])
338
+ * ```
339
+ *
340
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}
341
+ */
342
+ getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
343
+ /**
344
+ * Fetches pages with specific UIDs and a specific type. This method may make
345
+ * multiple network requests to fetch all matching pages.
346
+ *
347
+ * @example
348
+ *
349
+ * ```ts
350
+ * const pages = await client.getAllByUIDs("blog_post", [
351
+ * "my-first-post",
352
+ * "my-second-post",
353
+ * ])
354
+ * ```
355
+ *
356
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}
357
+ */
358
+ getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
359
+ /**
360
+ * Fetches a specific single type page.
361
+ *
362
+ * @example
363
+ *
364
+ * ```ts
365
+ * const page = await client.getSingle("settings")
366
+ * ```
367
+ *
368
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}
369
+ */
370
+ getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
371
+ /**
372
+ * Fetches pages with a specific type. Results are paginated.
373
+ *
374
+ * @example
375
+ *
376
+ * ```ts
377
+ * const response = await client.getByType("blog_post")
378
+ * ```
379
+ *
380
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}
381
+ */
382
+ getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
383
+ /**
384
+ * Fetches pages with a specific type. This method may make multiple network
385
+ * requests to fetch all matching documents.
386
+ *
387
+ * @example
388
+ *
389
+ * ```ts
390
+ * const pages = await client.getAllByType("blog_post")
391
+ * ```
392
+ *
393
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}
394
+ */
395
+ getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
396
+ /**
397
+ * Fetches pages with a specific tag. Results are paginated.
398
+ *
399
+ * @example
400
+ *
401
+ * ```ts
402
+ * const response = await client.getByTag("featured")
403
+ * ```
404
+ *
405
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}
406
+ */
407
+ getByTag<TDocument extends TDocuments>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
408
+ /**
409
+ * Fetches pages with a specific tag. This method may make multiple network
410
+ * requests to fetch all matching documents.
411
+ *
412
+ * @example
413
+ *
414
+ * ```ts
415
+ * const pages = await client.getAllByTag("featured")
416
+ * ```
417
+ *
418
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}
419
+ */
420
+ getAllByTag<TDocument extends TDocuments>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
421
+ /**
422
+ * Fetches pages with every tag from a list of tags. Results are paginated.
423
+ *
424
+ * @example
425
+ *
426
+ * ```ts
427
+ * const response = await client.getByEveryTag(["featured", "homepage"])
428
+ * ```
429
+ *
430
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}
431
+ */
432
+ getByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
433
+ /**
434
+ * Fetches pages with every tag from a list of tags. This method may make
435
+ * multiple network requests to fetch all matching pages.
436
+ *
437
+ * @example
438
+ *
439
+ * ```ts
440
+ * const pages = await client.getAllByEveryTag(["featured", "homepage"])
441
+ * ```
442
+ *
443
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}
444
+ */
445
+ getAllByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
446
+ /**
447
+ * Fetches pages with at least one tag from a list of tags. Results are
448
+ * paginated.
449
+ *
450
+ * @example
451
+ *
452
+ * ```ts
453
+ * const response = await client.getBySomeTags(["featured", "homepage"])
454
+ * ```
455
+ *
456
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}
457
+ */
458
+ getBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
459
+ /**
460
+ * Fetches pages with at least one tag from a list of tags. This method may
461
+ * make multiple network requests to fetch all matching documents.
462
+ *
463
+ * @example
464
+ *
465
+ * ```ts
466
+ * const pages = await client.getAllBySomeTags(["featured", "homepage"])
467
+ * ```
468
+ *
469
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}
470
+ */
471
+ getAllBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
472
+ /**
473
+ * Fetches metadata about the client's Prismic repository.
474
+ *
475
+ * @example
476
+ *
477
+ * ```ts
478
+ * const repository = await client.getRepository()
479
+ * ```
480
+ *
481
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}
482
+ */
483
+ getRepository(params?: Pick<BuildQueryURLArgs, "accessToken"> & FetchParams): Promise<Repository>;
484
+ /**
485
+ * Fetches the repository's active refs.
486
+ *
487
+ * @example
488
+ *
489
+ * ```ts
490
+ * const refs = await client.getRefs()
491
+ * ```
492
+ *
493
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}
494
+ */
495
+ getRefs(params?: FetchParams): Promise<Ref[]>;
496
+ /**
497
+ * Fetches a ref by its ID.
498
+ *
499
+ * @example
500
+ *
501
+ * ```ts
502
+ * const ref = await client.getRefByID("YhE3YhEAACIA4321")
503
+ * ```
504
+ *
505
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}
506
+ */
507
+ getRefByID(id: string, params?: FetchParams): Promise<Ref>;
508
+ /**
509
+ * Fetches a ref by its label. A release ref's label is its name shown in the
510
+ * Page Builder.
511
+ *
512
+ * @example
513
+ *
514
+ * ```ts
515
+ * const ref = await client.getRefByLabel("My Release")
516
+ * ```
517
+ *
518
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}
519
+ */
520
+ getRefByLabel(label: string, params?: FetchParams): Promise<Ref>;
521
+ /**
522
+ * Fetches the repository's master ref.
523
+ *
524
+ * @example
525
+ *
526
+ * ```ts
527
+ * const masterRef = await client.getMasterRef()
528
+ * ```
529
+ *
530
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}
531
+ */
532
+ getMasterRef(params?: FetchParams): Promise<Ref>;
533
+ /**
534
+ * Fetches the repository's active releases.
535
+ *
536
+ * @example
537
+ *
538
+ * ```ts
539
+ * const releases = await client.getReleases()
540
+ * ```
541
+ *
542
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}
543
+ */
544
+ getReleases(params?: FetchParams): Promise<Ref[]>;
545
+ /**
546
+ * Fetches a release with a specific ID.
547
+ *
548
+ * @example
549
+ *
550
+ * ```ts
551
+ * const release = await client.getReleaseByID("YhE3YhEAACIA4321")
552
+ * ```
553
+ *
554
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}
555
+ */
556
+ getReleaseByID(id: string, params?: FetchParams): Promise<Ref>;
557
+ /**
558
+ * Fetches a release by its label. A release ref's label is its name shown in
559
+ * the Page Builder.
560
+ *
561
+ * @example
562
+ *
563
+ * ```ts
564
+ * const release = await client.getReleaseByLabel("My Release")
565
+ * ```
566
+ *
567
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}
568
+ */
569
+ getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref>;
570
+ /**
571
+ * Fetches the repository's page tags.
572
+ *
573
+ * @example
574
+ *
575
+ * ```ts
576
+ * const tags = await client.getTags()
577
+ * ```
578
+ *
579
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}
580
+ */
581
+ getTags(params?: FetchParams): Promise<string[]>;
582
+ /**
583
+ * Builds a Content API query URL with a set of parameters.
584
+ *
585
+ * @example
586
+ *
587
+ * ```ts
588
+ * const url = await client.buildQueryURL({
589
+ * filters: [filter.at("document.type", "blog_post")],
590
+ * })
591
+ * ```
592
+ *
593
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}
594
+ */
595
+ buildQueryURL({
596
+ signal,
597
+ fetchOptions,
598
+ ...params
599
+ }?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
600
+ /**
601
+ * Fetches a previewed page's URL using a preview token and page ID.
602
+ *
603
+ * @example
604
+ *
605
+ * ```ts
606
+ * const url = await client.resolvePreviewURL({
607
+ * linkResolver,
608
+ * defaultURL: "/",
609
+ * })
610
+ * ```
611
+ *
612
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}
613
+ */
614
+ resolvePreviewURL<LinkResolverReturnType>(args: {
615
+ /** A function converts a document to a URL in your website. */
159
616
  linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
160
- /**
161
- * A fallback URL if the link resolver does not return a value.
162
- */
617
+ /** A fallback URL used when the document does not have a URL. */
163
618
  defaultURL: string;
164
- /**
165
- * The preview token (also known as a ref) that will be used to query preview
166
- * content from the Prismic repository.
167
- */
619
+ /** The preview token for the preview session. */
168
620
  previewToken?: string;
169
- /**
170
- * The previewed document that will be used to determine the destination URL.
171
- */
621
+ /** The previewed document's ID. */
172
622
  documentID?: string;
173
- };
174
- /**
175
- * A client that allows querying content from a Prismic repository.
176
- *
177
- * If used in an environment where a global `fetch` function is unavailable,
178
- * such as Node.js, the `fetch` option must be provided as part of the `options`
179
- * parameter.
180
- *
181
- * @typeParam TDocuments - Document types that are registered for the Prismic
182
- * repository. Query methods will automatically be typed based on this type.
183
- */
184
- export declare class Client<TDocuments extends PrismicDocument = PrismicDocument> {
185
- #private;
186
- /**
187
- * The function used to make network requests to the Prismic REST API. In
188
- * environments where a global `fetch` function does not exist, such as
189
- * Node.js, this function must be provided.
190
- */
191
- fetchFn: FetchLike;
192
- fetchOptions?: RequestInitLike;
193
- /**
194
- * The Prismic repository's name.
195
- */
196
- set repositoryName(value: string);
197
- /**
198
- * The Prismic repository's name.
199
- */
200
- get repositoryName(): string;
201
- /**
202
- * The Prismic REST API V2 endpoint for the repository (use
203
- * `prismic.getRepositoryEndpoint` for the default endpoint).
204
- */
205
- documentAPIEndpoint: string;
206
- /**
207
- * The Prismic REST API V2 endpoint for the repository (use
208
- * `prismic.getRepositoryEndpoint` for the default endpoint).
209
- *
210
- * @deprecated Use `documentAPIEndpoint` instead.
211
- */
212
- set endpoint(value: string);
213
- /**
214
- * The Prismic REST API V2 endpoint for the repository (use
215
- * `prismic.getRepositoryEndpoint` for the default endpoint).
216
- *
217
- * @deprecated Use `documentAPIEndpoint` instead.
218
- */
219
- get endpoint(): string;
220
- /**
221
- * The secure token for accessing the API (only needed if your repository is
222
- * set to private).
223
- *
224
- * {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
225
- */
226
- accessToken?: string;
227
- /**
228
- * A list of route resolver objects that define how a document's `url` field
229
- * is resolved.
230
- *
231
- * {@link https://prismic.io/docs/route-resolver}
232
- */
233
- routes?: NonNullable<BuildQueryURLArgs["routes"]>;
234
- /**
235
- * The `brokenRoute` option allows you to define the route populated in the
236
- * `url` property for broken link or content relationship fields. A broken
237
- * link is a link or content relationship field whose linked document has been
238
- * unpublished or deleted.
239
- *
240
- * {@link https://prismic.io/docs/route-resolver}
241
- */
242
- brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
243
- /**
244
- * Default parameters that will be sent with each query. These parameters can
245
- * be overridden on each query if needed.
246
- */
247
- defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
248
- /**
249
- * The client's ref mode state. This determines which ref is used during
250
- * queries.
251
- */
252
- private refState;
253
- /**
254
- * Cached repository value.
255
- */
256
- private cachedRepository;
257
- /**
258
- * Timestamp at which the cached repository data is considered stale.
259
- */
260
- private cachedRepositoryExpiration;
261
- /**
262
- * Creates a Prismic client that can be used to query a repository.
263
- *
264
- * If used in an environment where a global `fetch` function is unavailable,
265
- * such as in some Node.js versions, the `fetch` option must be provided as
266
- * part of the `options` parameter.
267
- *
268
- * @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
269
- * API V2 endpoint for the repository.
270
- * @param options - Configuration that determines how content will be queried
271
- * from the Prismic repository.
272
- *
273
- * @returns A client that can query content from the repository.
274
- */
275
- constructor(repositoryNameOrEndpoint: string, options?: ClientConfig);
276
- /**
277
- * Enables the client to automatically query content from a preview session if
278
- * one is active in browser environments. This is enabled by default in the
279
- * browser.
280
- *
281
- * For server environments, use `enableAutoPreviewsFromReq`.
282
- *
283
- * @example
284
- *
285
- * ```ts
286
- * client.enableAutoPreviews()
287
- * ```
288
- *
289
- * @see enableAutoPreviewsFromReq
290
- */
291
- enableAutoPreviews(): void;
292
- /**
293
- * Enables the client to automatically query content from a preview session if
294
- * one is active in server environments. This is disabled by default on the
295
- * server.
296
- *
297
- * For browser environments, use `enableAutoPreviews`.
298
- *
299
- * @example
300
- *
301
- * ```ts
302
- * // In an express app
303
- * app.get("/", function (req, res) {
304
- * client.enableAutoPreviewsFromReq(req)
305
- * })
306
- * ```
307
- *
308
- * @param req - An HTTP server request object containing the request's
309
- * cookies.
310
- */
311
- enableAutoPreviewsFromReq<R extends HttpRequestLike>(req: R): void;
312
- /**
313
- * Disables the client from automatically querying content from a preview
314
- * session if one is active.
315
- *
316
- * Automatic preview content querying is enabled by default unless this method
317
- * is called.
318
- *
319
- * @example
320
- *
321
- * ```ts
322
- * client.disableAutoPreviews()
323
- * ```
324
- */
325
- disableAutoPreviews(): void;
326
- /**
327
- * Queries content from the Prismic repository.
328
- *
329
- * @example
330
- *
331
- * ```ts
332
- * const response = await client.get()
333
- * ```
334
- *
335
- * @typeParam TDocument - Type of Prismic documents returned.
336
- *
337
- * @param params - Parameters to filter, sort, and paginate results.
338
- *
339
- * @returns A paginated response containing the result of the query.
340
- */
341
- get<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
342
- /**
343
- * Queries content from the Prismic repository and returns only the first
344
- * result, if any.
345
- *
346
- * @example
347
- *
348
- * ```ts
349
- * const document = await client.getFirst()
350
- * ```
351
- *
352
- * @typeParam TDocument - Type of the Prismic document returned.
353
- *
354
- * @param params - Parameters to filter, sort, and paginate results.
355
- *
356
- * @returns The first result of the query, if any.
357
- */
358
- getFirst<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
359
- /**
360
- * **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
361
- * require more resources than other methods. Prefer using other methods that
362
- * filter by filters such as `getAllByType`.
363
- *
364
- * Queries content from the Prismic repository and returns all matching
365
- * content. If no filters are provided, all documents will be fetched.
366
- *
367
- * This method may make multiple network requests to query all matching
368
- * content.
369
- *
370
- * @example
371
- *
372
- * ```ts
373
- * const response = await client.dangerouslyGetAll()
374
- * ```
375
- *
376
- * @typeParam TDocument - Type of Prismic documents returned.
377
- *
378
- * @param params - Parameters to filter, sort, and paginate results.
379
- *
380
- * @returns A list of documents matching the query.
381
- */
382
- dangerouslyGetAll<TDocument extends TDocuments>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
383
- /**
384
- * Queries a document from the Prismic repository with a specific ID.
385
- *
386
- * @remarks
387
- * A document's UID is different from its ID. An ID is automatically generated
388
- * for all documents and is made available on its `id` property. A UID is
389
- * provided in the Prismic editor and is unique among all documents of its
390
- * custom type.
391
- *
392
- * @example
393
- *
394
- * ```ts
395
- * const document = await client.getByID("WW4bKScAAMAqmluX")
396
- * ```
397
- *
398
- * @typeParam TDocument- Type of the Prismic document returned.
399
- *
400
- * @param id - ID of the document.
401
- * @param params - Parameters to filter, sort, and paginate the results.
402
- *
403
- * @returns The document with an ID matching the `id` parameter, if a matching
404
- * document exists.
405
- */
406
- getByID<TDocument extends TDocuments>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
407
- /**
408
- * Queries documents from the Prismic repository with specific IDs.
409
- *
410
- * @remarks
411
- * A document's UID is different from its ID. An ID is automatically generated
412
- * for all documents and is made available on its `id` property. A UID is
413
- * provided in the Prismic editor and is unique among all documents of its
414
- * custom type.
415
- *
416
- * @example
417
- *
418
- * ```ts
419
- * const response = await client.getByIDs([
420
- * "WW4bKScAAMAqmluX",
421
- * "U1kTRgEAAC8A5ldS",
422
- * ])
423
- * ```
424
- *
425
- * @typeParam TDocument - Type of Prismic documents returned.
426
- *
427
- * @param ids - A list of document IDs.
428
- * @param params - Parameters to filter, sort, and paginate the results.
429
- *
430
- * @returns A paginated response containing documents with IDs matching the
431
- * `ids` parameter.
432
- */
433
- getByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
434
- /**
435
- * Queries all documents from the Prismic repository with specific IDs.
436
- *
437
- * This method may make multiple network requests to query all matching
438
- * content.
439
- *
440
- * @remarks
441
- * A document's UID is different from its ID. An ID is automatically generated
442
- * for all documents and is made available on its `id` property. A UID is
443
- * provided in the Prismic editor and is unique among all documents of its
444
- * custom type.
445
- *
446
- * @example
447
- *
448
- * ```ts
449
- * const response = await client.getAllByIDs([
450
- * "WW4bKScAAMAqmluX",
451
- * "U1kTRgEAAC8A5ldS",
452
- * ])
453
- * ```
454
- *
455
- * @typeParam TDocument - Type of Prismic documents returned.
456
- *
457
- * @param ids - A list of document IDs.
458
- * @param params - Parameters to filter, sort, and paginate the results.
459
- *
460
- * @returns A list of documents with IDs matching the `ids` parameter.
461
- */
462
- getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
463
- /**
464
- * Queries a document from the Prismic repository with a specific UID and
465
- * custom type.
466
- *
467
- * @remarks
468
- * A document's UID is different from its ID. An ID is automatically generated
469
- * for all documents and is made available on its `id` property. A UID is
470
- * provided in the Prismic editor and is unique among all documents of its
471
- * custom type.
472
- *
473
- * @example
474
- *
475
- * ```ts
476
- * const document = await client.getByUID("blog_post", "my-first-post")
477
- * ```
478
- *
479
- * @typeParam TDocument - Type of the Prismic document returned.
480
- *
481
- * @param documentType - The API ID of the document's custom type.
482
- * @param uid - UID of the document.
483
- * @param params - Parameters to filter, sort, and paginate the results.
484
- *
485
- * @returns The document with a UID matching the `uid` parameter, if a
486
- * matching document exists.
487
- */
488
- getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
489
- /**
490
- * Queries document from the Prismic repository with specific UIDs and Custom
491
- * Type.
492
- *
493
- * @remarks
494
- * A document's UID is different from its ID. An ID is automatically generated
495
- * for all documents and is made available on its `id` property. A UID is
496
- * provided in the Prismic editor and is unique among all documents of its
497
- * custom type.
498
- *
499
- * @example
500
- *
501
- * ```ts
502
- * const document = await client.getByUIDs("blog_post", [
503
- * "my-first-post",
504
- * "my-second-post",
505
- * ])
506
- * ```
507
- *
508
- * @typeParam TDocument - Type of the Prismic document returned.
509
- *
510
- * @param documentType - The API ID of the document's custom type.
511
- * @param uids - A list of document UIDs.
512
- * @param params - Parameters to filter, sort, and paginate the results.
513
- *
514
- * @returns A paginated response containing documents with UIDs matching the
515
- * `uids` parameter.
516
- */
517
- getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
518
- /**
519
- * Queries all documents from the Prismic repository with specific UIDs and
520
- * custom type.
521
- *
522
- * This method may make multiple network requests to query all matching
523
- * content.
524
- *
525
- * @remarks
526
- * A document's UID is different from its ID. An ID is automatically generated
527
- * for all documents and is made available on its `id` property. A UID is
528
- * provided in the Prismic editor and is unique among all documents of its
529
- * custom type.
530
- *
531
- * @example
532
- *
533
- * ```ts
534
- * const response = await client.getAllByUIDs([
535
- * "my-first-post",
536
- * "my-second-post",
537
- * ])
538
- * ```
539
- *
540
- * @typeParam TDocument - Type of Prismic documents returned.
541
- *
542
- * @param documentType - The API ID of the document's custom type.
543
- * @param uids - A list of document UIDs.
544
- * @param params - Parameters to filter, sort, and paginate the results.
545
- *
546
- * @returns A list of documents with UIDs matching the `uids` parameter.
547
- */
548
- getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
549
- /**
550
- * Queries a singleton document from the Prismic repository for a specific
551
- * custom type.
552
- *
553
- * @remarks
554
- * A singleton document is one that is configured in Prismic to only allow one
555
- * instance. For example, a repository may be configured to contain just one
556
- * Settings document. This is in contrast to a repeatable custom type which
557
- * allows multiple instances of itself.
558
- *
559
- * @example
560
- *
561
- * ```ts
562
- * const document = await client.getSingle("settings")
563
- * ```
564
- *
565
- * @typeParam TDocument - Type of the Prismic document returned.
566
- *
567
- * @param documentType - The API ID of the singleton custom type.
568
- * @param params - Parameters to filter, sort, and paginate the results.
569
- *
570
- * @returns The singleton document for the custom type, if a matching document
571
- * exists.
572
- */
573
- getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
574
- /**
575
- * Queries documents from the Prismic repository for a specific custom type.
576
- *
577
- * Use `getAllByType` instead if you need to query all documents for a
578
- * specific custom type.
579
- *
580
- * @example
581
- *
582
- * ```ts
583
- * const response = await client.getByType("blog_post")
584
- * ```
585
- *
586
- * @typeParam TDocument - Type of Prismic documents returned.
587
- *
588
- * @param documentType - The API ID of the custom type.
589
- * @param params - Parameters to filter, sort, and paginate the results.
590
- *
591
- * @returns A paginated response containing documents of the custom type.
592
- */
593
- getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
594
- /**
595
- * Queries all documents from the Prismic repository for a specific Custom
596
- * Type.
597
- *
598
- * This method may make multiple network requests to query all matching
599
- * content.
600
- *
601
- * @example
602
- *
603
- * ```ts
604
- * const response = await client.getByType("blog_post")
605
- * ```
606
- *
607
- * @typeParam TDocument - Type of Prismic documents returned.
608
- *
609
- * @param documentType - The API ID of the custom type.
610
- * @param params - Parameters to filter, sort, and paginate the results.
611
- *
612
- * @returns A list of all documents of the custom type.
613
- */
614
- getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
615
- /**
616
- * Queries documents from the Prismic repository with a specific tag.
617
- *
618
- * Use `getAllByTag` instead if you need to query all documents with a
619
- * specific tag.
620
- *
621
- * @example
622
- *
623
- * ```ts
624
- * const response = await client.getByTag("food")
625
- * ```
626
- *
627
- * @typeParam TDocument - Type of Prismic documents returned.
628
- *
629
- * @param tag - The tag that must be included on a document.
630
- * @param params - Parameters to filter, sort, and paginate the results.
631
- *
632
- * @returns A paginated response containing documents with the tag.
633
- */
634
- getByTag<TDocument extends TDocuments>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
635
- /**
636
- * Queries all documents from the Prismic repository with a specific tag.
637
- *
638
- * This method may make multiple network requests to query all matching
639
- * content.
640
- *
641
- * @example
642
- *
643
- * ```ts
644
- * const response = await client.getAllByTag("food")
645
- * ```
646
- *
647
- * @typeParam TDocument - Type of Prismic documents returned.
648
- *
649
- * @param tag - The tag that must be included on a document.
650
- * @param params - Parameters to filter, sort, and paginate the results.
651
- *
652
- * @returns A list of all documents with the tag.
653
- */
654
- getAllByTag<TDocument extends TDocuments>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
655
- /**
656
- * Queries documents from the Prismic repository with specific tags. A
657
- * document must be tagged with all of the queried tags to be included.
658
- *
659
- * @example
660
- *
661
- * ```ts
662
- * const response = await client.getByEveryTag(["food", "fruit"])
663
- * ```
664
- *
665
- * @typeParam TDocument - Type of Prismic documents returned.
666
- *
667
- * @param tags - A list of tags that must be included on a document.
668
- * @param params - Parameters to filter, sort, and paginate the results.
669
- *
670
- * @returns A paginated response containing documents with the tags.
671
- */
672
- getByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
673
- /**
674
- * Queries documents from the Prismic repository with specific tags. A
675
- * document must be tagged with all of the queried tags to be included.
676
- *
677
- * This method may make multiple network requests to query all matching
678
- * content.
679
- *
680
- * @example
681
- *
682
- * ```ts
683
- * const response = await client.getAllByEveryTag(["food", "fruit"])
684
- * ```
685
- *
686
- * @typeParam TDocument - Type of Prismic documents returned.
687
- *
688
- * @param tags - A list of tags that must be included on a document.
689
- * @param params - Parameters to filter, sort, and paginate the results.
690
- *
691
- * @returns A list of all documents with the tags.
692
- */
693
- getAllByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
694
- /**
695
- * Queries documents from the Prismic repository with specific tags. A
696
- * document must be tagged with at least one of the queried tags to be
697
- * included.
698
- *
699
- * @example
700
- *
701
- * ```ts
702
- * const response = await client.getByEveryTag(["food", "fruit"])
703
- * ```
704
- *
705
- * @typeParam TDocument - Type of Prismic documents returned.
706
- *
707
- * @param tags - A list of tags that must be included on a document.
708
- * @param params - Parameters to filter, sort, and paginate the results.
709
- *
710
- * @returns A paginated response containing documents with at least one of the
711
- * tags.
712
- */
713
- getBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
714
- /**
715
- * Queries documents from the Prismic repository with specific tags. A
716
- * document must be tagged with at least one of the queried tags to be
717
- * included.
718
- *
719
- * This method may make multiple network requests to query all matching
720
- * content.
721
- *
722
- * @example
723
- *
724
- * ```ts
725
- * const response = await client.getAllBySomeTags(["food", "fruit"])
726
- * ```
727
- *
728
- * @typeParam TDocument - Type of Prismic documents returned.
729
- *
730
- * @param tags - A list of tags that must be included on a document.
731
- * @param params - Parameters to filter, sort, and paginate the results.
732
- *
733
- * @returns A list of all documents with at least one of the tags.
734
- */
735
- getAllBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
736
- /**
737
- * Returns metadata about the Prismic repository, such as its refs, releases,
738
- * and custom types.
739
- *
740
- * @returns Repository metadata.
741
- */
742
- getRepository(params?: FetchParams): Promise<Repository>;
743
- /**
744
- * Returns a list of all refs for the Prismic repository.
745
- *
746
- * Refs are used to identify which version of the repository's content should
747
- * be queried. All repositories will have at least one ref pointing to the
748
- * latest published content called the "master ref".
749
- *
750
- * @returns A list of all refs for the Prismic repository.
751
- */
752
- getRefs(params?: FetchParams): Promise<Ref[]>;
753
- /**
754
- * Returns a ref for the Prismic repository with a matching ID.
755
- *
756
- * @param id - ID of the ref.
757
- *
758
- * @returns The ref with a matching ID, if it exists.
759
- */
760
- getRefByID(id: string, params?: FetchParams): Promise<Ref>;
761
- /**
762
- * Returns a ref for the Prismic repository with a matching label.
763
- *
764
- * @param label - Label of the ref.
765
- *
766
- * @returns The ref with a matching label, if it exists.
767
- */
768
- getRefByLabel(label: string, params?: FetchParams): Promise<Ref>;
769
- /**
770
- * Returns the master ref for the Prismic repository. The master ref points to
771
- * the repository's latest published content.
772
- *
773
- * @returns The repository's master ref.
774
- */
775
- getMasterRef(params?: FetchParams): Promise<Ref>;
776
- /**
777
- * Returns a list of all Releases for the Prismic repository. Releases are
778
- * used to group content changes before publishing.
779
- *
780
- * @returns A list of all Releases for the Prismic repository.
781
- */
782
- getReleases(params?: FetchParams): Promise<Ref[]>;
783
- /**
784
- * Returns a Release for the Prismic repository with a matching ID.
785
- *
786
- * @param id - ID of the Release.
787
- *
788
- * @returns The Release with a matching ID, if it exists.
789
- */
790
- getReleaseByID(id: string, params?: FetchParams): Promise<Ref>;
791
- /**
792
- * Returns a Release for the Prismic repository with a matching label.
793
- *
794
- * @param label - Label of the ref.
795
- *
796
- * @returns The ref with a matching label, if it exists.
797
- */
798
- getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref>;
799
- /**
800
- * Returns a list of all tags used in the Prismic repository.
801
- *
802
- * @returns A list of all tags used in the repository.
803
- */
804
- getTags(params?: FetchParams): Promise<string[]>;
805
- /**
806
- * Builds a URL used to query content from the Prismic repository.
807
- *
808
- * @param params - Parameters to filter, sort, and paginate the results.
809
- *
810
- * @returns A URL string that can be requested to query content.
811
- */
812
- buildQueryURL({ signal, fetchOptions, ...params }?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
813
- /**
814
- * Determines the URL for a previewed document during an active preview
815
- * session. The result of this method should be used to redirect the user to
816
- * the document's URL.
817
- *
818
- * @example
819
- *
820
- * ```ts
821
- * const url = client.resolvePreviewURL({
822
- * linkResolver: (document) => `/${document.uid}`
823
- * defaultURL: '/'
824
- * })
825
- * ```
826
- *
827
- * @param args - Arguments to configure the URL resolving.
828
- *
829
- * @returns The URL for the previewed document during an active preview
830
- * session. The user should be redirected to this URL.
831
- */
832
- resolvePreviewURL<LinkResolverReturnType>(args: ResolvePreviewArgs<LinkResolverReturnType> & FetchParams): Promise<string>;
833
- /**
834
- * Configures the client to query the latest published content for all future
835
- * queries.
836
- *
837
- * If the `ref` parameter is provided during a query, it takes priority for
838
- * that query.
839
- *
840
- * @example
841
- *
842
- * ```ts
843
- * await client.queryLatestContent()
844
- * const document = await client.getByID("WW4bKScAAMAqmluX")
845
- * ```
846
- */
847
- queryLatestContent(): void;
848
- /**
849
- * Configures the client to query content from a specific Release identified
850
- * by its ID for all future queries.
851
- *
852
- * If the `ref` parameter is provided during a query, it takes priority for
853
- * that query.
854
- *
855
- * @example
856
- *
857
- * ```ts
858
- * await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa")
859
- * const document = await client.getByID("WW4bKScAAMAqmluX")
860
- * ```
861
- *
862
- * @param releaseID - The ID of the Release.
863
- */
864
- queryContentFromReleaseByID(releaseID: string): void;
865
- /**
866
- * Configures the client to query content from a specific Release identified
867
- * by its label for all future queries.
868
- *
869
- * If the `ref` parameter is provided during a query, it takes priority for
870
- * that query.
871
- *
872
- * @example
873
- *
874
- * ```ts
875
- * await client.queryContentFromReleaseByLabel("My Release")
876
- * const document = await client.getByID("WW4bKScAAMAqmluX")
877
- * ```
878
- *
879
- * @param releaseLabel - The label of the Release.
880
- */
881
- queryContentFromReleaseByLabel(releaseLabel: string): void;
882
- /**
883
- * Configures the client to query content from a specific ref. The ref can be
884
- * provided as a string or a function.
885
- *
886
- * If a function is provided, the ref is fetched lazily before each query. The
887
- * function may also be asynchronous.
888
- *
889
- * @example
890
- *
891
- * ```ts
892
- * await client.queryContentFromRef("my-ref")
893
- * const document = await client.getByID("WW4bKScAAMAqmluX")
894
- * ```
895
- *
896
- * @param ref - The ref or a function that returns the ref from which to query
897
- * content.
898
- */
899
- queryContentFromRef(ref: RefStringOrThunk): void;
900
- /**
901
- * A `fetch()` function to be used with GraphQL clients configured for
902
- * Prismic's GraphQL API. It automatically applies the necessary `prismic-ref`
903
- * and Authorization headers. Queries will automatically be minified by
904
- * removing whitespace where possible.
905
- *
906
- * @example
907
- *
908
- * ```ts
909
- * const graphQLClient = new ApolloClient({
910
- * link: new HttpLink({
911
- * uri: prismic.getGraphQLEndpoint(repositoryName),
912
- * // Provide `client.graphQLFetch` as the fetch implementation.
913
- * fetch: client.graphQLFetch,
914
- * // Using GET is required.
915
- * useGETForQueries: true,
916
- * }),
917
- * cache: new InMemoryCache(),
918
- * })
919
- * ```
920
- *
921
- * @param input - The `fetch()` `input` parameter. Only strings are supported.
922
- * @param init - The `fetch()` `init` parameter. Only plain objects are
923
- * supported.
924
- *
925
- * @returns The `fetch()` Response for the request.
926
- *
927
- * @experimental
928
- */
929
- graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
930
- signal?: AbortSignalLike;
931
- }): Promise<Response>;
932
- /**
933
- * Returns a cached version of `getRepository` with a TTL.
934
- *
935
- * @returns Cached repository metadata.
936
- */
937
- private getCachedRepository;
938
- /**
939
- * Returns the ref needed to query based on the client's current state. This
940
- * method may make a network request to fetch a ref or resolve the user's ref
941
- * thunk.
942
- *
943
- * If auto previews are enabled, the preview ref takes priority if available.
944
- *
945
- * The following strategies are used depending on the client's state:
946
- *
947
- * - If the user called `queryLatestContent`: Use the repository's master ref.
948
- * The ref is cached for 5 seconds. After 5 seconds, a new master ref is
949
- * fetched.
950
- * - If the user called `queryContentFromReleaseByID`: Use the release's ref.
951
- * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
952
- * release is fetched.
953
- * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref.
954
- * The ref is cached for 5 seconds. After 5 seconds, a new ref for the
955
- * release is fetched.
956
- * - If the user called `queryContentFromRef`: Use the provided ref. Fall back
957
- * to the master ref if the ref is not a string.
958
- *
959
- * @returns The ref to use during a query.
960
- */
961
- private getResolvedRefString;
962
- /**
963
- * The private implementation of `this.get`. It returns the API response and
964
- * the URL used to make the request. The URL is sometimes used in the public
965
- * method to include in thrown errors.
966
- *
967
- * This method retries requests that throw `RefNotFoundError` or
968
- * `RefExpiredError`. It contains special logic to retry with the latest
969
- * master ref, provided in the API's error message.
970
- *
971
- * @typeParam TDocument - Type of Prismic documents returned.
972
- *
973
- * @param params - Parameters to filter, sort, and paginate results.
974
- *
975
- * @returns An object containing the paginated response containing the result
976
- * of the query and the URL used to make the API request.
977
- */
978
- private _get;
979
- protected _buildRequestInit(params?: FetchParams): RequestInitLike;
623
+ } & FetchParams): Promise<string>;
624
+ /**
625
+ * Configures the client to query the latest published content. This is the
626
+ * client's default mode.
627
+ *
628
+ * @example
629
+ *
630
+ * ```ts
631
+ * client.queryLatestContent()
632
+ * ```
633
+ *
634
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}
635
+ */
636
+ queryLatestContent(): void;
637
+ /**
638
+ * Configures the client to query content from a release with a specific ID.
639
+ *
640
+ * @example
641
+ *
642
+ * ```ts
643
+ * client.queryContentFromReleaseByID("YhE3YhEAACIA4321")
644
+ * ```
645
+ *
646
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}
647
+ */
648
+ queryContentFromReleaseByID(id: string): void;
649
+ /**
650
+ * Configures the client to query content from a release with a specific
651
+ * label.
652
+ *
653
+ * @example
654
+ *
655
+ * ```ts
656
+ * client.queryContentFromReleaseByLabel("My Release")
657
+ * ```
658
+ *
659
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}
660
+ */
661
+ queryContentFromReleaseByLabel(label: string): void;
662
+ /**
663
+ * Configures the client to query content from a specific ref.
664
+ *
665
+ * @example
666
+ *
667
+ * ```ts
668
+ * client.queryContentFromRef("my-ref")
669
+ * ```
670
+ *
671
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}
672
+ */
673
+ queryContentFromRef(ref: string | GetRef): void;
674
+ /**
675
+ * A preconfigured `fetch()` function for Prismic's GraphQL API that can be
676
+ * provided to GraphQL clients.
677
+ *
678
+ * @example
679
+ *
680
+ * ```ts
681
+ * import { createClient, getGraphQLEndpoint } from "@prismicio/client"
682
+ *
683
+ * const client = createClient("example-prismic-repo")
684
+ * const graphQLClient = new ApolloClient({
685
+ * link: new HttpLink({
686
+ * uri: getGraphQLEndpoint(client.repositoryName),
687
+ * // Provide `client.graphQLFetch` as the fetch implementation.
688
+ * fetch: client.graphQLFetch,
689
+ * // Using GET is required.
690
+ * useGETForQueries: true,
691
+ * }),
692
+ * cache: new InMemoryCache(),
693
+ * })
694
+ * ```
695
+ *
696
+ * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}
697
+ */
698
+ graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
699
+ signal?: AbortSignalLike;
700
+ }): Promise<Response>;
980
701
  }
981
- export {};
702
+ //#endregion
703
+ export { Client, ClientConfig, FetchParams, HttpRequestLike };
704
+ //# sourceMappingURL=Client.d.ts.map