@prismicio/client 7.21.6 → 7.21.7-canary.673a207

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 (582) hide show
  1. package/dist/Client.cjs +19 -20
  2. package/dist/Client.cjs.map +1 -1
  3. package/dist/Client.d.cts +5 -12
  4. package/dist/Client.d.cts.map +1 -1
  5. package/dist/Client.d.ts +5 -12
  6. package/dist/Client.d.ts.map +1 -1
  7. package/dist/Client.js +8 -9
  8. package/dist/Client.js.map +1 -1
  9. package/dist/Migration.cjs +18 -19
  10. package/dist/Migration.cjs.map +1 -1
  11. package/dist/Migration.d.cts +0 -1
  12. package/dist/Migration.d.cts.map +1 -1
  13. package/dist/Migration.d.ts +0 -1
  14. package/dist/Migration.d.ts.map +1 -1
  15. package/dist/Migration.js +11 -12
  16. package/dist/Migration.js.map +1 -1
  17. package/dist/WriteClient.cjs +19 -23
  18. package/dist/WriteClient.cjs.map +1 -1
  19. package/dist/WriteClient.d.cts +0 -1
  20. package/dist/WriteClient.d.cts.map +1 -1
  21. package/dist/WriteClient.d.ts +0 -1
  22. package/dist/WriteClient.d.ts.map +1 -1
  23. package/dist/WriteClient.js +12 -16
  24. package/dist/WriteClient.js.map +1 -1
  25. package/dist/_virtual/_rolldown/runtime.cjs +13 -0
  26. package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.js} +4 -5
  27. package/dist/buildQueryURL.cjs +4 -5
  28. package/dist/buildQueryURL.cjs.map +1 -1
  29. package/dist/buildQueryURL.d.cts.map +1 -1
  30. package/dist/buildQueryURL.d.ts.map +1 -1
  31. package/dist/buildQueryURL.js +2 -3
  32. package/dist/buildQueryURL.js.map +1 -1
  33. package/dist/cookie.cjs +7 -9
  34. package/dist/cookie.cjs.map +1 -1
  35. package/dist/cookie.d.cts.map +1 -1
  36. package/dist/cookie.d.ts.map +1 -1
  37. package/dist/cookie.js +3 -4
  38. package/dist/cookie.js.map +1 -1
  39. package/dist/createClient.cjs +2 -3
  40. package/dist/createClient.cjs.map +1 -1
  41. package/dist/createClient.d.cts +0 -1
  42. package/dist/createClient.d.cts.map +1 -1
  43. package/dist/createClient.d.ts +0 -1
  44. package/dist/createClient.d.ts.map +1 -1
  45. package/dist/createClient.js +1 -2
  46. package/dist/createClient.js.map +1 -1
  47. package/dist/createMigration.cjs +2 -3
  48. package/dist/createMigration.cjs.map +1 -1
  49. package/dist/createMigration.d.cts +0 -1
  50. package/dist/createMigration.d.cts.map +1 -1
  51. package/dist/createMigration.d.ts +0 -1
  52. package/dist/createMigration.d.ts.map +1 -1
  53. package/dist/createMigration.js +1 -2
  54. package/dist/createMigration.js.map +1 -1
  55. package/dist/createWriteClient.cjs +2 -3
  56. package/dist/createWriteClient.cjs.map +1 -1
  57. package/dist/createWriteClient.d.cts +0 -1
  58. package/dist/createWriteClient.d.cts.map +1 -1
  59. package/dist/createWriteClient.d.ts +0 -1
  60. package/dist/createWriteClient.d.ts.map +1 -1
  61. package/dist/createWriteClient.js +1 -2
  62. package/dist/createWriteClient.js.map +1 -1
  63. package/dist/errors.cjs +1 -2
  64. package/dist/errors.cjs.map +1 -1
  65. package/dist/errors.d.cts.map +1 -1
  66. package/dist/errors.d.ts.map +1 -1
  67. package/dist/errors.js +1 -1
  68. package/dist/filter.cjs +1 -2
  69. package/dist/filter.cjs.map +1 -1
  70. package/dist/filter.d.cts.map +1 -1
  71. package/dist/filter.d.ts.map +1 -1
  72. package/dist/filter.js +1 -1
  73. package/dist/getGraphQLEndpoint.cjs +3 -4
  74. package/dist/getGraphQLEndpoint.cjs.map +1 -1
  75. package/dist/getGraphQLEndpoint.d.cts.map +1 -1
  76. package/dist/getGraphQLEndpoint.d.ts.map +1 -1
  77. package/dist/getGraphQLEndpoint.js +1 -2
  78. package/dist/getGraphQLEndpoint.js.map +1 -1
  79. package/dist/getRepositoryEndpoint.cjs +3 -4
  80. package/dist/getRepositoryEndpoint.cjs.map +1 -1
  81. package/dist/getRepositoryEndpoint.d.cts.map +1 -1
  82. package/dist/getRepositoryEndpoint.d.ts.map +1 -1
  83. package/dist/getRepositoryEndpoint.js +1 -2
  84. package/dist/getRepositoryEndpoint.js.map +1 -1
  85. package/dist/getRepositoryName.cjs +2 -3
  86. package/dist/getRepositoryName.cjs.map +1 -1
  87. package/dist/getRepositoryName.d.cts.map +1 -1
  88. package/dist/getRepositoryName.d.ts.map +1 -1
  89. package/dist/getRepositoryName.js +1 -2
  90. package/dist/getRepositoryName.js.map +1 -1
  91. package/dist/getToolbarSrc.cjs +3 -4
  92. package/dist/getToolbarSrc.cjs.map +1 -1
  93. package/dist/getToolbarSrc.d.cts.map +1 -1
  94. package/dist/getToolbarSrc.d.ts.map +1 -1
  95. package/dist/getToolbarSrc.js +1 -2
  96. package/dist/getToolbarSrc.js.map +1 -1
  97. package/dist/helpers/asDate.cjs +1 -2
  98. package/dist/helpers/asDate.cjs.map +1 -1
  99. package/dist/helpers/asDate.d.cts +0 -1
  100. package/dist/helpers/asDate.d.cts.map +1 -1
  101. package/dist/helpers/asDate.d.ts +0 -1
  102. package/dist/helpers/asDate.d.ts.map +1 -1
  103. package/dist/helpers/asDate.js +1 -1
  104. package/dist/helpers/asHTML.cjs +5 -6
  105. package/dist/helpers/asHTML.cjs.map +1 -1
  106. package/dist/helpers/asHTML.d.cts +0 -1
  107. package/dist/helpers/asHTML.d.cts.map +1 -1
  108. package/dist/helpers/asHTML.d.ts +0 -1
  109. package/dist/helpers/asHTML.d.ts.map +1 -1
  110. package/dist/helpers/asHTML.js +1 -2
  111. package/dist/helpers/asHTML.js.map +1 -1
  112. package/dist/helpers/asImagePixelDensitySrcSet.cjs +3 -4
  113. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  114. package/dist/helpers/asImagePixelDensitySrcSet.d.cts +0 -1
  115. package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
  116. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +0 -1
  117. package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
  118. package/dist/helpers/asImagePixelDensitySrcSet.js +2 -3
  119. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  120. package/dist/helpers/asImageSrc.cjs +2 -3
  121. package/dist/helpers/asImageSrc.cjs.map +1 -1
  122. package/dist/helpers/asImageSrc.d.cts +0 -1
  123. package/dist/helpers/asImageSrc.d.cts.map +1 -1
  124. package/dist/helpers/asImageSrc.d.ts +0 -1
  125. package/dist/helpers/asImageSrc.d.ts.map +1 -1
  126. package/dist/helpers/asImageSrc.js +1 -2
  127. package/dist/helpers/asImageSrc.js.map +1 -1
  128. package/dist/helpers/asImageWidthSrcSet.cjs +4 -5
  129. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  130. package/dist/helpers/asImageWidthSrcSet.d.cts +0 -1
  131. package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
  132. package/dist/helpers/asImageWidthSrcSet.d.ts +0 -1
  133. package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
  134. package/dist/helpers/asImageWidthSrcSet.js +3 -4
  135. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  136. package/dist/helpers/asLink.cjs +3 -4
  137. package/dist/helpers/asLink.cjs.map +1 -1
  138. package/dist/helpers/asLink.d.cts +0 -1
  139. package/dist/helpers/asLink.d.cts.map +1 -1
  140. package/dist/helpers/asLink.d.ts +0 -1
  141. package/dist/helpers/asLink.d.ts.map +1 -1
  142. package/dist/helpers/asLink.js +1 -2
  143. package/dist/helpers/asLink.js.map +1 -1
  144. package/dist/helpers/asLinkAttrs.cjs +4 -5
  145. package/dist/helpers/asLinkAttrs.cjs.map +1 -1
  146. package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
  147. package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
  148. package/dist/helpers/asLinkAttrs.js +1 -2
  149. package/dist/helpers/asLinkAttrs.js.map +1 -1
  150. package/dist/helpers/asText.cjs +4 -5
  151. package/dist/helpers/asText.cjs.map +1 -1
  152. package/dist/helpers/asText.d.cts +0 -1
  153. package/dist/helpers/asText.d.cts.map +1 -1
  154. package/dist/helpers/asText.d.ts +0 -1
  155. package/dist/helpers/asText.d.ts.map +1 -1
  156. package/dist/helpers/asText.js +5 -6
  157. package/dist/helpers/asText.js.map +1 -1
  158. package/dist/helpers/documentToLinkField.cjs +2 -3
  159. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  160. package/dist/helpers/documentToLinkField.d.cts.map +1 -1
  161. package/dist/helpers/documentToLinkField.d.ts.map +1 -1
  162. package/dist/helpers/documentToLinkField.js +1 -2
  163. package/dist/helpers/documentToLinkField.js.map +1 -1
  164. package/dist/helpers/isFilled.cjs +11 -13
  165. package/dist/helpers/isFilled.cjs.map +1 -1
  166. package/dist/helpers/isFilled.d.cts.map +1 -1
  167. package/dist/helpers/isFilled.d.ts.map +1 -1
  168. package/dist/helpers/isFilled.js +7 -8
  169. package/dist/helpers/isFilled.js.map +1 -1
  170. package/dist/helpers/mapSliceZone.cjs +1 -2
  171. package/dist/helpers/mapSliceZone.cjs.map +1 -1
  172. package/dist/helpers/mapSliceZone.d.cts +0 -1
  173. package/dist/helpers/mapSliceZone.d.cts.map +1 -1
  174. package/dist/helpers/mapSliceZone.d.ts +0 -1
  175. package/dist/helpers/mapSliceZone.d.ts.map +1 -1
  176. package/dist/helpers/mapSliceZone.js +1 -1
  177. package/dist/index.cjs +49 -49
  178. package/dist/index.cjs.map +1 -1
  179. package/dist/index.d.cts.map +1 -1
  180. package/dist/index.d.ts.map +1 -1
  181. package/dist/index.js +1 -2
  182. package/dist/index.js.map +1 -1
  183. package/dist/isRepositoryEndpoint.cjs +1 -2
  184. package/dist/isRepositoryEndpoint.cjs.map +1 -1
  185. package/dist/isRepositoryEndpoint.d.cts.map +1 -1
  186. package/dist/isRepositoryEndpoint.d.ts.map +1 -1
  187. package/dist/isRepositoryEndpoint.js +1 -1
  188. package/dist/isRepositoryName.cjs +1 -2
  189. package/dist/isRepositoryName.cjs.map +1 -1
  190. package/dist/isRepositoryName.d.cts.map +1 -1
  191. package/dist/isRepositoryName.d.ts.map +1 -1
  192. package/dist/isRepositoryName.js +1 -1
  193. package/dist/lib/devMsg.cjs +2 -3
  194. package/dist/lib/devMsg.cjs.map +1 -1
  195. package/dist/lib/devMsg.js +1 -2
  196. package/dist/lib/devMsg.js.map +1 -1
  197. package/dist/lib/escapeHTML.cjs +1 -2
  198. package/dist/lib/escapeHTML.cjs.map +1 -1
  199. package/dist/lib/escapeHTML.js +1 -1
  200. package/dist/lib/getOptionalLinkProperties.cjs +1 -2
  201. package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
  202. package/dist/lib/getOptionalLinkProperties.js +1 -1
  203. package/dist/lib/getOptionalLinkProperties.js.map +1 -1
  204. package/dist/lib/getPreviewCookie.cjs +3 -4
  205. package/dist/lib/getPreviewCookie.cjs.map +1 -1
  206. package/dist/lib/getPreviewCookie.js +3 -4
  207. package/dist/lib/getPreviewCookie.js.map +1 -1
  208. package/dist/lib/isInternalURL.cjs +1 -2
  209. package/dist/lib/isInternalURL.cjs.map +1 -1
  210. package/dist/lib/isInternalURL.js +1 -1
  211. package/dist/lib/isMigrationValue.cjs +6 -7
  212. package/dist/lib/isMigrationValue.cjs.map +1 -1
  213. package/dist/lib/isMigrationValue.js +1 -2
  214. package/dist/lib/isMigrationValue.js.map +1 -1
  215. package/dist/lib/isValue.cjs +3 -4
  216. package/dist/lib/isValue.cjs.map +1 -1
  217. package/dist/lib/isValue.js +1 -2
  218. package/dist/lib/isValue.js.map +1 -1
  219. package/dist/lib/pLimit.cjs +1 -2
  220. package/dist/lib/pLimit.cjs.map +1 -1
  221. package/dist/lib/pLimit.js +1 -1
  222. package/dist/lib/pLimit.js.map +1 -1
  223. package/dist/lib/request.cjs +8 -8
  224. package/dist/lib/request.cjs.map +1 -1
  225. package/dist/lib/request.d.cts +1 -1
  226. package/dist/lib/request.d.cts.map +1 -1
  227. package/dist/lib/request.d.ts +1 -1
  228. package/dist/lib/request.d.ts.map +1 -1
  229. package/dist/lib/request.js +7 -7
  230. package/dist/lib/request.js.map +1 -1
  231. package/dist/lib/resolveMigrationDocumentData.cjs +18 -19
  232. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
  233. package/dist/lib/resolveMigrationDocumentData.js +11 -12
  234. package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
  235. package/dist/lib/serializerHelpers.cjs +4 -5
  236. package/dist/lib/serializerHelpers.cjs.map +1 -1
  237. package/dist/lib/serializerHelpers.js +1 -2
  238. package/dist/lib/serializerHelpers.js.map +1 -1
  239. package/dist/lib/throttledWarn.cjs +1 -2
  240. package/dist/lib/throttledWarn.cjs.map +1 -1
  241. package/dist/lib/throttledWarn.js +1 -1
  242. package/dist/lib/throttledWarn.js.map +1 -1
  243. package/dist/lib/validateAssetMetadata.cjs +2 -3
  244. package/dist/lib/validateAssetMetadata.cjs.map +1 -1
  245. package/dist/lib/validateAssetMetadata.js +1 -2
  246. package/dist/lib/validateAssetMetadata.js.map +1 -1
  247. package/dist/package.cjs +12 -13
  248. package/dist/package.cjs.map +1 -1
  249. package/dist/package.js +2 -2
  250. package/dist/package.js.map +1 -1
  251. package/dist/richtext/asText.cjs +1 -2
  252. package/dist/richtext/asText.cjs.map +1 -1
  253. package/dist/richtext/asText.d.cts +0 -1
  254. package/dist/richtext/asText.d.cts.map +1 -1
  255. package/dist/richtext/asText.d.ts +0 -1
  256. package/dist/richtext/asText.d.ts.map +1 -1
  257. package/dist/richtext/asText.js +1 -1
  258. package/dist/richtext/asTree.cjs +2 -3
  259. package/dist/richtext/asTree.cjs.map +1 -1
  260. package/dist/richtext/asTree.d.cts +0 -1
  261. package/dist/richtext/asTree.d.cts.map +1 -1
  262. package/dist/richtext/asTree.d.ts +0 -1
  263. package/dist/richtext/asTree.d.ts.map +1 -1
  264. package/dist/richtext/asTree.js +1 -2
  265. package/dist/richtext/asTree.js.map +1 -1
  266. package/dist/richtext/composeSerializers.cjs +1 -2
  267. package/dist/richtext/composeSerializers.cjs.map +1 -1
  268. package/dist/richtext/composeSerializers.d.cts +0 -1
  269. package/dist/richtext/composeSerializers.d.cts.map +1 -1
  270. package/dist/richtext/composeSerializers.d.ts +0 -1
  271. package/dist/richtext/composeSerializers.d.ts.map +1 -1
  272. package/dist/richtext/composeSerializers.js +1 -1
  273. package/dist/richtext/serialize.cjs +2 -3
  274. package/dist/richtext/serialize.cjs.map +1 -1
  275. package/dist/richtext/serialize.d.cts +0 -1
  276. package/dist/richtext/serialize.d.cts.map +1 -1
  277. package/dist/richtext/serialize.d.ts +0 -1
  278. package/dist/richtext/serialize.d.ts.map +1 -1
  279. package/dist/richtext/serialize.js +1 -2
  280. package/dist/richtext/serialize.js.map +1 -1
  281. package/dist/richtext/types.cjs +2 -3
  282. package/dist/richtext/types.cjs.map +1 -1
  283. package/dist/richtext/types.d.cts +0 -1
  284. package/dist/richtext/types.d.cts.map +1 -1
  285. package/dist/richtext/types.d.ts +0 -1
  286. package/dist/richtext/types.d.ts.map +1 -1
  287. package/dist/richtext/types.js +1 -2
  288. package/dist/richtext/types.js.map +1 -1
  289. package/dist/richtext/wrapMapSerializer.cjs +2 -3
  290. package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
  291. package/dist/richtext/wrapMapSerializer.d.cts +0 -1
  292. package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
  293. package/dist/richtext/wrapMapSerializer.d.ts +0 -1
  294. package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
  295. package/dist/richtext/wrapMapSerializer.js +1 -2
  296. package/dist/richtext/wrapMapSerializer.js.map +1 -1
  297. package/dist/richtext.cjs +8 -8
  298. package/dist/richtext.js +1 -2
  299. package/dist/types/api/asset/asset.d.cts +0 -1
  300. package/dist/types/api/asset/asset.d.cts.map +1 -1
  301. package/dist/types/api/asset/asset.d.ts +0 -1
  302. package/dist/types/api/asset/asset.d.ts.map +1 -1
  303. package/dist/types/api/asset/tag.d.cts.map +1 -1
  304. package/dist/types/api/asset/tag.d.ts.map +1 -1
  305. package/dist/types/api/integration.d.cts +0 -1
  306. package/dist/types/api/integration.d.cts.map +1 -1
  307. package/dist/types/api/integration.d.ts +0 -1
  308. package/dist/types/api/integration.d.ts.map +1 -1
  309. package/dist/types/api/query.d.cts +0 -1
  310. package/dist/types/api/query.d.cts.map +1 -1
  311. package/dist/types/api/query.d.ts +0 -1
  312. package/dist/types/api/query.d.ts.map +1 -1
  313. package/dist/types/api/ref.d.cts.map +1 -1
  314. package/dist/types/api/ref.d.ts.map +1 -1
  315. package/dist/types/api/release.d.cts +0 -1
  316. package/dist/types/api/release.d.cts.map +1 -1
  317. package/dist/types/api/release.d.ts +0 -1
  318. package/dist/types/api/release.d.ts.map +1 -1
  319. package/dist/types/api/repository.d.cts +0 -1
  320. package/dist/types/api/repository.d.cts.map +1 -1
  321. package/dist/types/api/repository.d.ts +0 -1
  322. package/dist/types/api/repository.d.ts.map +1 -1
  323. package/dist/types/api/tags.d.cts.map +1 -1
  324. package/dist/types/api/tags.d.ts.map +1 -1
  325. package/dist/types/migration/Asset.cjs +1 -2
  326. package/dist/types/migration/Asset.cjs.map +1 -1
  327. package/dist/types/migration/Asset.d.cts +0 -1
  328. package/dist/types/migration/Asset.d.cts.map +1 -1
  329. package/dist/types/migration/Asset.d.ts +0 -1
  330. package/dist/types/migration/Asset.d.ts.map +1 -1
  331. package/dist/types/migration/Asset.js +1 -1
  332. package/dist/types/migration/ContentRelationship.d.cts.map +1 -1
  333. package/dist/types/migration/ContentRelationship.d.ts.map +1 -1
  334. package/dist/types/migration/Document.cjs +1 -2
  335. package/dist/types/migration/Document.cjs.map +1 -1
  336. package/dist/types/migration/Document.d.cts +0 -1
  337. package/dist/types/migration/Document.d.cts.map +1 -1
  338. package/dist/types/migration/Document.d.ts +0 -1
  339. package/dist/types/migration/Document.d.ts.map +1 -1
  340. package/dist/types/migration/Document.js +1 -1
  341. package/dist/types/migration/Document.js.map +1 -1
  342. package/dist/types/model/boolean.d.cts +0 -1
  343. package/dist/types/model/boolean.d.cts.map +1 -1
  344. package/dist/types/model/boolean.d.ts +0 -1
  345. package/dist/types/model/boolean.d.ts.map +1 -1
  346. package/dist/types/model/color.d.cts +0 -1
  347. package/dist/types/model/color.d.cts.map +1 -1
  348. package/dist/types/model/color.d.ts +0 -1
  349. package/dist/types/model/color.d.ts.map +1 -1
  350. package/dist/types/model/contentRelationship.d.cts +0 -1
  351. package/dist/types/model/contentRelationship.d.cts.map +1 -1
  352. package/dist/types/model/contentRelationship.d.ts +0 -1
  353. package/dist/types/model/contentRelationship.d.ts.map +1 -1
  354. package/dist/types/model/customType.d.cts +0 -1
  355. package/dist/types/model/customType.d.cts.map +1 -1
  356. package/dist/types/model/customType.d.ts +0 -1
  357. package/dist/types/model/customType.d.ts.map +1 -1
  358. package/dist/types/model/date.d.cts +0 -1
  359. package/dist/types/model/date.d.cts.map +1 -1
  360. package/dist/types/model/date.d.ts +0 -1
  361. package/dist/types/model/date.d.ts.map +1 -1
  362. package/dist/types/model/embed.d.cts +0 -1
  363. package/dist/types/model/embed.d.cts.map +1 -1
  364. package/dist/types/model/embed.d.ts +0 -1
  365. package/dist/types/model/embed.d.ts.map +1 -1
  366. package/dist/types/model/geoPoint.d.cts +0 -1
  367. package/dist/types/model/geoPoint.d.cts.map +1 -1
  368. package/dist/types/model/geoPoint.d.ts +0 -1
  369. package/dist/types/model/geoPoint.d.ts.map +1 -1
  370. package/dist/types/model/group.d.cts +0 -1
  371. package/dist/types/model/group.d.cts.map +1 -1
  372. package/dist/types/model/group.d.ts +0 -1
  373. package/dist/types/model/group.d.ts.map +1 -1
  374. package/dist/types/model/image.d.cts +0 -1
  375. package/dist/types/model/image.d.cts.map +1 -1
  376. package/dist/types/model/image.d.ts +0 -1
  377. package/dist/types/model/image.d.ts.map +1 -1
  378. package/dist/types/model/integration.d.cts +0 -1
  379. package/dist/types/model/integration.d.cts.map +1 -1
  380. package/dist/types/model/integration.d.ts +0 -1
  381. package/dist/types/model/integration.d.ts.map +1 -1
  382. package/dist/types/model/keyText.d.cts +0 -1
  383. package/dist/types/model/keyText.d.cts.map +1 -1
  384. package/dist/types/model/keyText.d.ts +0 -1
  385. package/dist/types/model/keyText.d.ts.map +1 -1
  386. package/dist/types/model/link.cjs +1 -2
  387. package/dist/types/model/link.cjs.map +1 -1
  388. package/dist/types/model/link.d.cts +0 -1
  389. package/dist/types/model/link.d.cts.map +1 -1
  390. package/dist/types/model/link.d.ts +0 -1
  391. package/dist/types/model/link.d.ts.map +1 -1
  392. package/dist/types/model/link.js +1 -1
  393. package/dist/types/model/linkToMedia.d.cts +0 -1
  394. package/dist/types/model/linkToMedia.d.cts.map +1 -1
  395. package/dist/types/model/linkToMedia.d.ts +0 -1
  396. package/dist/types/model/linkToMedia.d.ts.map +1 -1
  397. package/dist/types/model/number.d.cts +0 -1
  398. package/dist/types/model/number.d.cts.map +1 -1
  399. package/dist/types/model/number.d.ts +0 -1
  400. package/dist/types/model/number.d.ts.map +1 -1
  401. package/dist/types/model/range.d.cts +0 -1
  402. package/dist/types/model/range.d.cts.map +1 -1
  403. package/dist/types/model/range.d.ts +0 -1
  404. package/dist/types/model/range.d.ts.map +1 -1
  405. package/dist/types/model/richText.d.cts +0 -1
  406. package/dist/types/model/richText.d.cts.map +1 -1
  407. package/dist/types/model/richText.d.ts +0 -1
  408. package/dist/types/model/richText.d.ts.map +1 -1
  409. package/dist/types/model/select.d.cts +0 -1
  410. package/dist/types/model/select.d.cts.map +1 -1
  411. package/dist/types/model/select.d.ts +0 -1
  412. package/dist/types/model/select.d.ts.map +1 -1
  413. package/dist/types/model/separator.d.cts +0 -1
  414. package/dist/types/model/separator.d.cts.map +1 -1
  415. package/dist/types/model/separator.d.ts +0 -1
  416. package/dist/types/model/separator.d.ts.map +1 -1
  417. package/dist/types/model/sharedSlice.d.cts +0 -1
  418. package/dist/types/model/sharedSlice.d.cts.map +1 -1
  419. package/dist/types/model/sharedSlice.d.ts +0 -1
  420. package/dist/types/model/sharedSlice.d.ts.map +1 -1
  421. package/dist/types/model/sharedSliceVariation.d.cts +0 -1
  422. package/dist/types/model/sharedSliceVariation.d.cts.map +1 -1
  423. package/dist/types/model/sharedSliceVariation.d.ts +0 -1
  424. package/dist/types/model/sharedSliceVariation.d.ts.map +1 -1
  425. package/dist/types/model/slice.cjs +1 -2
  426. package/dist/types/model/slice.cjs.map +1 -1
  427. package/dist/types/model/slice.d.cts +0 -1
  428. package/dist/types/model/slice.d.cts.map +1 -1
  429. package/dist/types/model/slice.d.ts +0 -1
  430. package/dist/types/model/slice.d.ts.map +1 -1
  431. package/dist/types/model/slice.js +1 -1
  432. package/dist/types/model/sliceZone.cjs +1 -2
  433. package/dist/types/model/sliceZone.cjs.map +1 -1
  434. package/dist/types/model/sliceZone.d.cts +0 -1
  435. package/dist/types/model/sliceZone.d.cts.map +1 -1
  436. package/dist/types/model/sliceZone.d.ts +0 -1
  437. package/dist/types/model/sliceZone.d.ts.map +1 -1
  438. package/dist/types/model/sliceZone.js +1 -1
  439. package/dist/types/model/table.d.cts +0 -1
  440. package/dist/types/model/table.d.cts.map +1 -1
  441. package/dist/types/model/table.d.ts +0 -1
  442. package/dist/types/model/table.d.ts.map +1 -1
  443. package/dist/types/model/timestamp.d.cts +0 -1
  444. package/dist/types/model/timestamp.d.cts.map +1 -1
  445. package/dist/types/model/timestamp.d.ts +0 -1
  446. package/dist/types/model/timestamp.d.ts.map +1 -1
  447. package/dist/types/model/title.d.cts +0 -1
  448. package/dist/types/model/title.d.cts.map +1 -1
  449. package/dist/types/model/title.d.ts +0 -1
  450. package/dist/types/model/title.d.ts.map +1 -1
  451. package/dist/types/model/types.cjs +1 -2
  452. package/dist/types/model/types.cjs.map +1 -1
  453. package/dist/types/model/types.d.cts +0 -1
  454. package/dist/types/model/types.d.cts.map +1 -1
  455. package/dist/types/model/types.d.ts +0 -1
  456. package/dist/types/model/types.d.ts.map +1 -1
  457. package/dist/types/model/types.js +1 -1
  458. package/dist/types/model/uid.d.cts +0 -1
  459. package/dist/types/model/uid.d.cts.map +1 -1
  460. package/dist/types/model/uid.d.ts +0 -1
  461. package/dist/types/model/uid.d.ts.map +1 -1
  462. package/dist/types/value/boolean.d.cts.map +1 -1
  463. package/dist/types/value/boolean.d.ts.map +1 -1
  464. package/dist/types/value/color.d.cts +0 -1
  465. package/dist/types/value/color.d.cts.map +1 -1
  466. package/dist/types/value/color.d.ts +0 -1
  467. package/dist/types/value/color.d.ts.map +1 -1
  468. package/dist/types/value/contentRelationship.d.cts +0 -1
  469. package/dist/types/value/contentRelationship.d.cts.map +1 -1
  470. package/dist/types/value/contentRelationship.d.ts +0 -1
  471. package/dist/types/value/contentRelationship.d.ts.map +1 -1
  472. package/dist/types/value/date.d.cts +0 -1
  473. package/dist/types/value/date.d.cts.map +1 -1
  474. package/dist/types/value/date.d.ts +0 -1
  475. package/dist/types/value/date.d.ts.map +1 -1
  476. package/dist/types/value/document.d.cts +0 -1
  477. package/dist/types/value/document.d.cts.map +1 -1
  478. package/dist/types/value/document.d.ts +0 -1
  479. package/dist/types/value/document.d.ts.map +1 -1
  480. package/dist/types/value/embed.cjs +1 -2
  481. package/dist/types/value/embed.cjs.map +1 -1
  482. package/dist/types/value/embed.d.cts +0 -1
  483. package/dist/types/value/embed.d.cts.map +1 -1
  484. package/dist/types/value/embed.d.ts +0 -1
  485. package/dist/types/value/embed.d.ts.map +1 -1
  486. package/dist/types/value/embed.js +1 -1
  487. package/dist/types/value/geoPoint.d.cts +0 -1
  488. package/dist/types/value/geoPoint.d.cts.map +1 -1
  489. package/dist/types/value/geoPoint.d.ts +0 -1
  490. package/dist/types/value/geoPoint.d.ts.map +1 -1
  491. package/dist/types/value/group.d.cts +0 -1
  492. package/dist/types/value/group.d.cts.map +1 -1
  493. package/dist/types/value/group.d.ts +0 -1
  494. package/dist/types/value/group.d.ts.map +1 -1
  495. package/dist/types/value/image.d.cts +0 -1
  496. package/dist/types/value/image.d.cts.map +1 -1
  497. package/dist/types/value/image.d.ts +0 -1
  498. package/dist/types/value/image.d.ts.map +1 -1
  499. package/dist/types/value/integration.d.cts +0 -1
  500. package/dist/types/value/integration.d.cts.map +1 -1
  501. package/dist/types/value/integration.d.ts +0 -1
  502. package/dist/types/value/integration.d.ts.map +1 -1
  503. package/dist/types/value/keyText.d.cts +0 -1
  504. package/dist/types/value/keyText.d.cts.map +1 -1
  505. package/dist/types/value/keyText.d.ts +0 -1
  506. package/dist/types/value/keyText.d.ts.map +1 -1
  507. package/dist/types/value/link.cjs +1 -2
  508. package/dist/types/value/link.cjs.map +1 -1
  509. package/dist/types/value/link.d.cts +0 -1
  510. package/dist/types/value/link.d.cts.map +1 -1
  511. package/dist/types/value/link.d.ts +0 -1
  512. package/dist/types/value/link.d.ts.map +1 -1
  513. package/dist/types/value/link.js +1 -1
  514. package/dist/types/value/linkToMedia.d.cts +0 -1
  515. package/dist/types/value/linkToMedia.d.cts.map +1 -1
  516. package/dist/types/value/linkToMedia.d.ts +0 -1
  517. package/dist/types/value/linkToMedia.d.ts.map +1 -1
  518. package/dist/types/value/number.d.cts +0 -1
  519. package/dist/types/value/number.d.cts.map +1 -1
  520. package/dist/types/value/number.d.ts +0 -1
  521. package/dist/types/value/number.d.ts.map +1 -1
  522. package/dist/types/value/richText.cjs +1 -2
  523. package/dist/types/value/richText.cjs.map +1 -1
  524. package/dist/types/value/richText.d.cts +0 -1
  525. package/dist/types/value/richText.d.cts.map +1 -1
  526. package/dist/types/value/richText.d.ts +0 -1
  527. package/dist/types/value/richText.d.ts.map +1 -1
  528. package/dist/types/value/richText.js +1 -1
  529. package/dist/types/value/select.d.cts +0 -1
  530. package/dist/types/value/select.d.cts.map +1 -1
  531. package/dist/types/value/select.d.ts +0 -1
  532. package/dist/types/value/select.d.ts.map +1 -1
  533. package/dist/types/value/sharedSlice.d.cts +0 -1
  534. package/dist/types/value/sharedSlice.d.cts.map +1 -1
  535. package/dist/types/value/sharedSlice.d.ts +0 -1
  536. package/dist/types/value/sharedSlice.d.ts.map +1 -1
  537. package/dist/types/value/sharedSliceVariation.d.cts +0 -1
  538. package/dist/types/value/sharedSliceVariation.d.cts.map +1 -1
  539. package/dist/types/value/sharedSliceVariation.d.ts +0 -1
  540. package/dist/types/value/sharedSliceVariation.d.ts.map +1 -1
  541. package/dist/types/value/slice.d.cts +0 -1
  542. package/dist/types/value/slice.d.cts.map +1 -1
  543. package/dist/types/value/slice.d.ts +0 -1
  544. package/dist/types/value/slice.d.ts.map +1 -1
  545. package/dist/types/value/sliceZone.d.cts +0 -1
  546. package/dist/types/value/sliceZone.d.cts.map +1 -1
  547. package/dist/types/value/sliceZone.d.ts +0 -1
  548. package/dist/types/value/sliceZone.d.ts.map +1 -1
  549. package/dist/types/value/table.d.cts +0 -1
  550. package/dist/types/value/table.d.cts.map +1 -1
  551. package/dist/types/value/table.d.ts +0 -1
  552. package/dist/types/value/table.d.ts.map +1 -1
  553. package/dist/types/value/timestamp.d.cts +0 -1
  554. package/dist/types/value/timestamp.d.cts.map +1 -1
  555. package/dist/types/value/timestamp.d.ts +0 -1
  556. package/dist/types/value/timestamp.d.ts.map +1 -1
  557. package/dist/types/value/title.d.cts +0 -1
  558. package/dist/types/value/title.d.cts.map +1 -1
  559. package/dist/types/value/title.d.ts +0 -1
  560. package/dist/types/value/title.d.ts.map +1 -1
  561. package/dist/types/value/types.d.cts +0 -1
  562. package/dist/types/value/types.d.cts.map +1 -1
  563. package/dist/types/value/types.d.ts +0 -1
  564. package/dist/types/value/types.d.ts.map +1 -1
  565. package/dist/types/webhook/apiUpdate.d.cts +0 -1
  566. package/dist/types/webhook/apiUpdate.d.cts.map +1 -1
  567. package/dist/types/webhook/apiUpdate.d.ts +0 -1
  568. package/dist/types/webhook/apiUpdate.d.ts.map +1 -1
  569. package/dist/types/webhook/testTrigger.d.cts +0 -1
  570. package/dist/types/webhook/testTrigger.d.cts.map +1 -1
  571. package/dist/types/webhook/testTrigger.d.ts +0 -1
  572. package/dist/types/webhook/testTrigger.d.ts.map +1 -1
  573. package/dist/types/webhook/types.cjs +1 -2
  574. package/dist/types/webhook/types.cjs.map +1 -1
  575. package/dist/types/webhook/types.d.cts.map +1 -1
  576. package/dist/types/webhook/types.d.ts.map +1 -1
  577. package/dist/types/webhook/types.js +1 -1
  578. package/package.json +12 -12
  579. package/src/WriteClient.ts +2 -2
  580. package/src/helpers/asImageWidthSrcSet.ts +1 -0
  581. package/src/lib/request.ts +7 -5
  582. package/dist/_virtual/rolldown_runtime.js +0 -13
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/lib/isInternalURL.ts
3
2
  /**
4
3
  * Determines if a URL is internal or external.
@@ -12,7 +11,7 @@ const isInternalURL = (url) => {
12
11
  const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
13
12
  return isInternal && !isSpecialLink;
14
13
  };
15
-
16
14
  //#endregion
17
15
  exports.isInternalURL = isInternalURL;
16
+
18
17
  //# sourceMappingURL=isInternalURL.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
@@ -11,7 +11,7 @@ const isInternalURL = (url) => {
11
11
  const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
12
12
  return isInternal && !isSpecialLink;
13
13
  };
14
-
15
14
  //#endregion
16
15
  export { isInternalURL };
16
+
17
17
  //# sourceMappingURL=isInternalURL.js.map
@@ -1,9 +1,8 @@
1
- const require_richText = require('../types/value/richText.cjs');
2
- const require_link = require('../types/value/link.cjs');
3
- const require_Asset = require('../types/migration/Asset.cjs');
4
- const require_Document = require('../types/migration/Document.cjs');
5
- const require_isValue = require('./isValue.cjs');
6
-
1
+ const require_richText = require("../types/value/richText.cjs");
2
+ const require_link = require("../types/value/link.cjs");
3
+ const require_Asset = require("../types/migration/Asset.cjs");
4
+ const require_Document = require("../types/migration/Document.cjs");
5
+ const require_isValue = require("./isValue.cjs");
7
6
  //#region src/lib/isMigrationValue.ts
8
7
  /**
9
8
  * Checks if a value is a migration content relationship field.
@@ -68,10 +67,10 @@ const linkToMedia = (value) => {
68
67
  const rtImageNode = (value) => {
69
68
  return typeof value === "object" && value !== null && "id" in value && value.id instanceof require_Asset.PrismicMigrationAsset && "type" in value && value.type === require_richText.RichTextNodeType.image;
70
69
  };
71
-
72
70
  //#endregion
73
71
  exports.contentRelationship = contentRelationship;
74
72
  exports.image = image;
75
73
  exports.linkToMedia = linkToMedia;
76
74
  exports.rtImageNode = rtImageNode;
75
+
77
76
  //# sourceMappingURL=isMigrationValue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiBA,6EACE,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,sBAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiBC,uCAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0BA,oCAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,uCACpB,eAAe,SACf,MAAM,cAAcD,sBAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,uCACpB,UAAU,SACV,MAAM,SAASC,kCAAiB"}
1
+ {"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiBA,iBAAAA,4BAAAA,gBAAAA,gBACE,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,aAAAA,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiBC,cAAAA,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0BA,cAAAA,sBAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,cAAAA,yBACpB,eAAe,SACf,MAAM,cAAcD,aAAAA,SAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,cAAAA,yBACpB,UAAU,SACV,MAAM,SAASC,iBAAAA,iBAAiB"}
@@ -3,7 +3,6 @@ import { LinkType } from "../types/value/link.js";
3
3
  import { PrismicMigrationAsset } from "../types/migration/Asset.js";
4
4
  import { PrismicMigrationDocument } from "../types/migration/Document.js";
5
5
  import { prismicDocument } from "./isValue.js";
6
-
7
6
  //#region src/lib/isMigrationValue.ts
8
7
  /**
9
8
  * Checks if a value is a migration content relationship field.
@@ -68,7 +67,7 @@ const linkToMedia = (value) => {
68
67
  const rtImageNode = (value) => {
69
68
  return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "type" in value && value.type === RichTextNodeType.image;
70
69
  };
71
-
72
70
  //#endregion
73
71
  export { contentRelationship, image, linkToMedia, rtImageNode };
72
+
74
73
  //# sourceMappingURL=isMigrationValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiB,4BACjBA,gBAAmB,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0B,sBAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB"}
1
+ {"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiB,4BACjBA,gBAAmB,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0B,sBAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB"}
@@ -1,6 +1,5 @@
1
- const require_richText = require('../types/value/richText.cjs');
2
- const require_link = require('../types/value/link.cjs');
3
-
1
+ const require_richText = require("../types/value/richText.cjs");
2
+ const require_link = require("../types/value/link.cjs");
4
3
  //#region src/lib/isValue.ts
5
4
  /**
6
5
  * Checks if a value is a link to media field.
@@ -100,11 +99,11 @@ const prismicDocument = (value) => {
100
99
  return false;
101
100
  }
102
101
  };
103
-
104
102
  //#endregion
105
103
  exports.filledContentRelationship = filledContentRelationship;
106
104
  exports.filledImage = filledImage;
107
105
  exports.filledLinkToMedia = filledLinkToMedia;
108
106
  exports.prismicDocument = prismicDocument;
109
107
  exports.rtImageNode = rtImageNode;
108
+
110
109
  //# sourceMappingURL=isValue.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"isValue.cjs","names":["LinkType","RichTextNodeType"],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAa,qBACZ,UACqC;AACrC,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAcA,sBAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAM,aACL,UACyD;AACzD,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAEnD;MACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,eACZ,UAC2C;AAC3C,KACC,UAAU,MAAM,KACf,EAAE,UAAU,UAAU,MAAM,SAASC,kCAAiB,OAEvD,QAAO;AAGR,QAAO;;;;;;;;;;;;AAaR,MAAa,eAAe,UAA8C;AACzE,KACC,UAAU,MAAM,IAChB,UAAU,SACV,MAAM,SAASA,kCAAiB,MAEhC,QAAO;AAGR,QAAO;;;;;;;;;;;;;;;;;AAkBR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAcD,sBAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,mBACZ,UAC8B;AAC9B,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
1
+ {"version":3,"file":"isValue.cjs","names":["LinkType","RichTextNodeType"],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAa,qBACZ,UACqC;AACrC,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAcA,aAAAA,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAM,aACL,UACyD;AACzD,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY;MAGlD,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,eACZ,UAC2C;AAC3C,KACC,UAAU,MAAM,KACf,EAAE,UAAU,UAAU,MAAM,SAASC,iBAAAA,iBAAiB,OAEvD,QAAO;AAGR,QAAO;;;;;;;;;;;;AAaR,MAAa,eAAe,UAA8C;AACzE,KACC,UAAU,MAAM,IAChB,UAAU,SACV,MAAM,SAASA,iBAAAA,iBAAiB,MAEhC,QAAO;AAGR,QAAO;;;;;;;;;;;;;;;;;AAkBR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAcD,aAAAA,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,mBACZ,UAC8B;AAC9B,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
@@ -1,6 +1,5 @@
1
1
  import { RichTextNodeType } from "../types/value/richText.js";
2
2
  import { LinkType } from "../types/value/link.js";
3
-
4
3
  //#region src/lib/isValue.ts
5
4
  /**
6
5
  * Checks if a value is a link to media field.
@@ -100,7 +99,7 @@ const prismicDocument = (value) => {
100
99
  return false;
101
100
  }
102
101
  };
103
-
104
102
  //#endregion
105
103
  export { filledContentRelationship, filledImage, filledLinkToMedia, prismicDocument, rtImageNode };
104
+
106
105
  //# sourceMappingURL=isValue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isValue.js","names":[],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAa,qBACZ,UACqC;AACrC,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAc,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAM,aACL,UACyD;AACzD,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAEnD;MACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,eACZ,UAC2C;AAC3C,KACC,UAAU,MAAM,KACf,EAAE,UAAU,UAAU,MAAM,SAAS,iBAAiB,OAEvD,QAAO;AAGR,QAAO;;;;;;;;;;;;AAaR,MAAa,eAAe,UAA8C;AACzE,KACC,UAAU,MAAM,IAChB,UAAU,SACV,MAAM,SAAS,iBAAiB,MAEhC,QAAO;AAGR,QAAO;;;;;;;;;;;;;;;;;AAkBR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,mBACZ,UAC8B;AAC9B,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
1
+ {"version":3,"file":"isValue.js","names":[],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,MAAa,qBACZ,UACqC;AACrC,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAc,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAM,aACL,UACyD;AACzD,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY;MAGlD,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,eACZ,UAC2C;AAC3C,KACC,UAAU,MAAM,KACf,EAAE,UAAU,UAAU,MAAM,SAAS,iBAAiB,OAEvD,QAAO;AAGR,QAAO;;;;;;;;;;;;AAaR,MAAa,eAAe,UAA8C;AACzE,KACC,UAAU,MAAM,IAChB,UAAU,SACV,MAAM,SAAS,iBAAiB,MAEhC,QAAO;AAGR,QAAO;;;;;;;;;;;;;;;;;AAkBR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,mBACZ,UAC8B;AAC9B,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/lib/pLimit.ts
3
2
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
4
3
  /**
@@ -49,7 +48,7 @@ const pLimit = ({ interval } = {}) => {
49
48
  enqueue(function_, resolve, arguments_);
50
49
  }));
51
50
  };
52
-
53
51
  //#endregion
54
52
  exports.pLimit = pLimit;
53
+
55
54
  //# sourceMappingURL=pLimit.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"pLimit.cjs","names":["queue: AnyFunction[]"],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing\n * arguments on to the `fn` is provided in order to be able to avoid creating\n * unnecessary closures. You probably don't need this optimization unless\n * you're pushing a lot of functions.\n *\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (\n\t\t...arguments_: TArguments\n\t) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and\n * respect a given interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to\n * wait between each promise execution.\n *\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({\n\tinterval,\n}: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";;AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;AA2B/E,MAAa,UAAU,EACtB,aAC0B,EAAE,KAAoB;CAChD,MAAMA,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;;AAC9B,yBAAM,OAAO,uDAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,QAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
1
+ {"version":3,"file":"pLimit.cjs","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing\n * arguments on to the `fn` is provided in order to be able to avoid creating\n * unnecessary closures. You probably don't need this optimization unless\n * you're pushing a lot of functions.\n *\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (\n\t\t...arguments_: TArguments\n\t) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and\n * respect a given interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to\n * wait between each promise execution.\n *\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({\n\tinterval,\n}: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;AA2B/E,MAAa,UAAU,EACtB,aAC0B,EAAE,KAAoB;CAChD,MAAM,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;;AAC9B,IAAA,eAAA,MAAM,OAAO,MAAA,QAAA,iBAAA,KAAA,KAAA,cAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,KAAA,GAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
@@ -48,7 +48,7 @@ const pLimit = ({ interval } = {}) => {
48
48
  enqueue(function_, resolve, arguments_);
49
49
  }));
50
50
  };
51
-
52
51
  //#endregion
53
52
  export { pLimit };
53
+
54
54
  //# sourceMappingURL=pLimit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pLimit.js","names":["queue: AnyFunction[]"],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing\n * arguments on to the `fn` is provided in order to be able to avoid creating\n * unnecessary closures. You probably don't need this optimization unless\n * you're pushing a lot of functions.\n *\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (\n\t\t...arguments_: TArguments\n\t) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and\n * respect a given interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to\n * wait between each promise execution.\n *\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({\n\tinterval,\n}: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;AA2B/E,MAAa,UAAU,EACtB,aAC0B,EAAE,KAAoB;CAChD,MAAMA,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;;AAC9B,yBAAM,OAAO,uDAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,QAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
1
+ {"version":3,"file":"pLimit.js","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing\n * arguments on to the `fn` is provided in order to be able to avoid creating\n * unnecessary closures. You probably don't need this optimization unless\n * you're pushing a lot of functions.\n *\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (\n\t\t...arguments_: TArguments\n\t) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and\n * respect a given interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to\n * wait between each promise execution.\n *\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({\n\tinterval,\n}: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;;AA2B/E,MAAa,UAAU,EACtB,aAC0B,EAAE,KAAoB;CAChD,MAAM,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;;AAC9B,IAAA,eAAA,MAAM,OAAO,MAAA,QAAA,iBAAA,KAAA,KAAA,cAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,KAAA,GAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
@@ -1,5 +1,4 @@
1
- const require_pLimit = require('./pLimit.cjs');
2
-
1
+ const require_pLimit = require("./pLimit.cjs");
3
2
  //#region src/lib/request.ts
4
3
  /**
5
4
  * The default number of milliseconds to wait before retrying a rate-limited
@@ -17,15 +16,16 @@ const THROTTLED_RUNNERS = {};
17
16
  */
18
17
  const DEDUPLICATED_JOBS = {};
19
18
  async function memoizeResponse(response) {
20
- const blob = await response.blob();
19
+ const buffer = await response.arrayBuffer();
21
20
  const memoized = {
22
21
  ok: response.ok,
23
22
  status: response.status,
24
23
  headers: response.headers,
25
24
  url: response.url,
26
- text: async () => blob.text(),
27
- json: async () => JSON.parse(await blob.text()),
28
- blob: async () => blob,
25
+ text: async () => new TextDecoder().decode(buffer),
26
+ json: async () => JSON.parse(new TextDecoder().decode(buffer)),
27
+ arrayBuffer: async () => buffer,
28
+ blob: async () => new Blob([buffer]),
29
29
  clone: () => memoized
30
30
  };
31
31
  return memoized;
@@ -45,7 +45,7 @@ async function request(url, init, fetchFn) {
45
45
  let job;
46
46
  if (init === null || init === void 0 ? void 0 : init.body) {
47
47
  var _url$hostname;
48
- job = (THROTTLED_RUNNERS[_url$hostname = url.hostname] || (THROTTLED_RUNNERS[_url$hostname] = require_pLimit.pLimit({ interval: DEFAULT_RETRY_AFTER })))(() => fetchFn(stringURL, init));
48
+ job = (THROTTLED_RUNNERS[_url$hostname = url.hostname] || (THROTTLED_RUNNERS[_url$hostname] = require_pLimit.pLimit({ interval: 1500 })))(() => fetchFn(stringURL, init));
49
49
  } else {
50
50
  var _DEDUPLICATED_JOBS$st;
51
51
  const existingJob = (_DEDUPLICATED_JOBS$st = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st === void 0 ? void 0 : _DEDUPLICATED_JOBS$st.get(init === null || init === void 0 ? void 0 : init.signal);
@@ -68,7 +68,7 @@ async function request(url, init, fetchFn) {
68
68
  }
69
69
  return response;
70
70
  }
71
-
72
71
  //#endregion
73
72
  exports.request = request;
73
+
74
74
  //# sourceMappingURL=request.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.cjs","names":["THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>>","DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n>","memoized: ResponseLike","job: Promise<ResponseLike>","pLimit"],"sources":["../../src/lib/request.ts"],"sourcesContent":["import { type LimitFunction, pLimit } from \"./pLimit\"\n\n/**\n * The default number of milliseconds to wait before retrying a rate-limited\n * `fetch()` request (429 response code). The default value is only used if the\n * response does not include a `retry-after` header.\n */\nexport const DEFAULT_RETRY_AFTER = 1500 // ms\n\n/**\n * A record of URLs mapped to throttled task runners.\n */\nconst THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>> = {}\n\n/**\n * A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their\n * optional signal.\n */\nconst DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n> = {}\n\n/**\n * A universal API to make network requests. A subset of the `fetch()` API.\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}\n */\nexport type FetchLike = (\n\tinput: string,\n\tinit?: RequestInitLike,\n) => Promise<ResponseLike>\n\n/**\n * An object that allows you to abort a `fetch()` request if needed via an\n * `AbortController` object\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}\n */\n// `any` is used often here to ensure this type is universally valid among\n// different AbortSignal implementations. The types of each property are not\n// important to validate since it is blindly passed to a given `fetch()`\n// function.\n// oxlint-disable-next-line no-explicit-any\nexport type AbortSignalLike = any\n\n/**\n * A subset of RequestInit properties to configure a `fetch()` request.\n */\n// Only options relevant to the client are included. Extending from the full\n// RequestInit would cause issues, such as accepting Header objects.\n//\n// An interface is used to allow other libraries to augment the type with\n// environment-specific types.\nexport interface RequestInitLike extends Pick<RequestInit, \"cache\"> {\n\t/**\n\t * The HTTP method to use for the request.\n\t */\n\tmethod?: string\n\n\t/**\n\t * The request body to send with the request.\n\t */\n\t// We want to keep the body type as compatible as possible, so\n\t// we only declare the type we need and accept anything else.\n\t// oxlint-disable-next-line no-explicit-any\n\tbody?: any | FormData | string\n\n\t/**\n\t * An object literal to set the `fetch()` request's headers.\n\t */\n\theaders?: Record<string, string>\n\n\t/**\n\t * An AbortSignal to set the `fetch()` request's signal.\n\t *\n\t * See:\n\t * [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)\n\t */\n\t// NOTE: `AbortSignalLike` is `any`! It is left as `AbortSignalLike`\n\t// for backwards compatibility (the type is exported) and to signal to\n\t// other readers that this should be an AbortSignal-like object.\n\tsignal?: AbortSignalLike\n}\n\n/**\n * The minimum required properties from Response.\n */\nexport interface ResponseLike {\n\tok: boolean\n\tstatus: number\n\theaders: HeadersLike\n\turl: string\n\t// oxlint-disable-next-line no-explicit-any\n\tjson(): Promise<any>\n\ttext(): Promise<string>\n\tblob(): Promise<Blob>\n\tclone(): ResponseLike\n}\n\n/**\n * The minimum required properties from Headers.\n */\nexport interface HeadersLike {\n\tget(name: string): string | null\n}\n\nasync function memoizeResponse(response: ResponseLike): Promise<ResponseLike> {\n\t// Deduplicated responses are shared across multiple callers. Calling\n\t// response.clone() on a shared response can cause backpressure hangs\n\t// in Node.js, so we buffer the body as a blob upfront instead.\n\tconst blob = await response.blob()\n\n\tconst memoized: ResponseLike = {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\theaders: response.headers,\n\t\turl: response.url,\n\t\ttext: async () => blob.text(),\n\t\tjson: async () => JSON.parse(await blob.text()),\n\t\tblob: async () => blob,\n\t\tclone: () => memoized,\n\t}\n\n\treturn memoized\n}\n\n/**\n * Makes an HTTP request with automatic retry for rate limits and request\n * deduplication.\n *\n * @param url - The URL to request.\n * @param init - Fetch options.\n * @param fetchFn - The fetch function to use.\n *\n * @returns The response from the fetch request.\n */\nexport async function request(\n\turl: URL,\n\tinit: RequestInitLike | undefined,\n\tfetchFn: FetchLike,\n): Promise<ResponseLike> {\n\tconst stringURL = url.toString()\n\n\tlet job: Promise<ResponseLike>\n\n\t// Throttle requests with a body.\n\tif (init?.body) {\n\t\t// Rate limiting is done per hostname.\n\t\tconst runner = (THROTTLED_RUNNERS[url.hostname] ||= pLimit({\n\t\t\tinterval: DEFAULT_RETRY_AFTER,\n\t\t}))\n\n\t\tjob = runner(() => fetchFn(stringURL, init))\n\t} else {\n\t\t// Deduplicate all other requests.\n\t\tconst existingJob = DEDUPLICATED_JOBS[stringURL]?.get(init?.signal)\n\t\tif (existingJob) {\n\t\t\tjob = existingJob\n\t\t} else {\n\t\t\tjob = fetchFn(stringURL, init)\n\t\t\t\t.then(memoizeResponse)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tDEDUPLICATED_JOBS[stringURL]?.delete(init?.signal)\n\t\t\t\t\tif (DEDUPLICATED_JOBS[stringURL]?.size === 0) {\n\t\t\t\t\t\tdelete DEDUPLICATED_JOBS[stringURL]\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst map = (DEDUPLICATED_JOBS[stringURL] ||= new Map())\n\t\t\tmap.set(init?.signal, job)\n\t\t}\n\t}\n\n\tconst response = await job\n\n\t// Retry rate limited requests.\n\tif (response.status === 429) {\n\t\tconst retryAfter = Number(response.headers.get(\"retry-after\"))\n\t\tconst resolvedRetryAfter = Number.isNaN(retryAfter)\n\t\t\t? DEFAULT_RETRY_AFTER\n\t\t\t: retryAfter * 1000\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter))\n\n\t\treturn request(url, init, fetchFn)\n\t}\n\n\treturn response\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,sBAAsB;;;;AAKnC,MAAMA,oBAA4D,EAAE;;;;;AAMpE,MAAMC,oBAEF,EAAE;AAsFN,eAAe,gBAAgB,UAA+C;CAI7E,MAAM,OAAO,MAAM,SAAS,MAAM;CAElC,MAAMC,WAAyB;EAC9B,IAAI,SAAS;EACb,QAAQ,SAAS;EACjB,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,MAAM,YAAY,KAAK,MAAM;EAC7B,MAAM,YAAY,KAAK,MAAM,MAAM,KAAK,MAAM,CAAC;EAC/C,MAAM,YAAY;EAClB,aAAa;EACb;AAED,QAAO;;;;;;;;;;;;AAaR,eAAsB,QACrB,KACA,MACA,SACwB;CACxB,MAAM,YAAY,IAAI,UAAU;CAEhC,IAAIC;AAGJ,iDAAI,KAAM,MAAM;;AAMf,SAJgB,kCAAkB,IAAI,cAAtB,mCAAoCC,sBAAO,EAC1D,UAAU,qBACV,CAAC,SAEiB,QAAQ,WAAW,KAAK,CAAC;QACtC;;EAEN,MAAM,uCAAc,kBAAkB,0FAAY,gDAAI,KAAM,OAAO;AACnE,MAAI,YACH,OAAM;OACA;AACN,SAAM,QAAQ,WAAW,KAAK,CAC5B,KAAK,gBAAgB,CACrB,cAAc;;AACd,gDAAkB,oFAAY,mDAAO,KAAM,OAAO;AAClD,mCAAI,kBAAkB,4FAAY,UAAS,EAC1C,QAAO,kBAAkB;KAEzB;AAEH,IADa,kBAAkB,eAAlB,kBAAkB,6BAAe,IAAI,KAAK,GACnD,gDAAI,KAAM,QAAQ,IAAI;;;CAI5B,MAAM,WAAW,MAAM;AAGvB,KAAI,SAAS,WAAW,KAAK;EAC5B,MAAM,aAAa,OAAO,SAAS,QAAQ,IAAI,cAAc,CAAC;EAC9D,MAAM,qBAAqB,OAAO,MAAM,WAAW,GAChD,sBACA,aAAa;AAEhB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,mBAAmB,CAAC;AAEvE,SAAO,QAAQ,KAAK,MAAM,QAAQ;;AAGnC,QAAO"}
1
+ {"version":3,"file":"request.cjs","names":["pLimit"],"sources":["../../src/lib/request.ts"],"sourcesContent":["import { type LimitFunction, pLimit } from \"./pLimit\"\n\n/**\n * The default number of milliseconds to wait before retrying a rate-limited\n * `fetch()` request (429 response code). The default value is only used if the\n * response does not include a `retry-after` header.\n */\nexport const DEFAULT_RETRY_AFTER = 1500 // ms\n\n/**\n * A record of URLs mapped to throttled task runners.\n */\nconst THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>> = {}\n\n/**\n * A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their\n * optional signal.\n */\nconst DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n> = {}\n\n/**\n * A universal API to make network requests. A subset of the `fetch()` API.\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}\n */\nexport type FetchLike = (\n\tinput: string,\n\tinit?: RequestInitLike,\n) => Promise<ResponseLike>\n\n/**\n * An object that allows you to abort a `fetch()` request if needed via an\n * `AbortController` object\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}\n */\n// `any` is used often here to ensure this type is universally valid among\n// different AbortSignal implementations. The types of each property are not\n// important to validate since it is blindly passed to a given `fetch()`\n// function.\n// oxlint-disable-next-line no-explicit-any\nexport type AbortSignalLike = any\n\n/**\n * A subset of RequestInit properties to configure a `fetch()` request.\n */\n// Only options relevant to the client are included. Extending from the full\n// RequestInit would cause issues, such as accepting Header objects.\n//\n// An interface is used to allow other libraries to augment the type with\n// environment-specific types.\nexport interface RequestInitLike extends Pick<RequestInit, \"cache\"> {\n\t/**\n\t * The HTTP method to use for the request.\n\t */\n\tmethod?: string\n\n\t/**\n\t * The request body to send with the request.\n\t */\n\t// We want to keep the body type as compatible as possible, so\n\t// we only declare the type we need and accept anything else.\n\t// oxlint-disable-next-line no-explicit-any\n\tbody?: any | FormData | string\n\n\t/**\n\t * An object literal to set the `fetch()` request's headers.\n\t */\n\theaders?: Record<string, string>\n\n\t/**\n\t * An AbortSignal to set the `fetch()` request's signal.\n\t *\n\t * See:\n\t * [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)\n\t */\n\t// NOTE: `AbortSignalLike` is `any`! It is left as `AbortSignalLike`\n\t// for backwards compatibility (the type is exported) and to signal to\n\t// other readers that this should be an AbortSignal-like object.\n\tsignal?: AbortSignalLike\n}\n\n/**\n * The minimum required properties from Response.\n */\nexport interface ResponseLike {\n\tok: boolean\n\tstatus: number\n\theaders: HeadersLike\n\turl: string\n\t// oxlint-disable-next-line no-explicit-any\n\tjson(): Promise<any>\n\ttext(): Promise<string>\n\tarrayBuffer(): Promise<ArrayBuffer>\n\tblob(): Promise<Blob>\n\tclone(): ResponseLike\n}\n\n/**\n * The minimum required properties from Headers.\n */\nexport interface HeadersLike {\n\tget(name: string): string | null\n}\n\nasync function memoizeResponse(response: ResponseLike): Promise<ResponseLike> {\n\t// Deduplicated responses are shared across multiple callers. Calling\n\t// response.clone() on a shared response can cause backpressure hangs\n\t// in Node.js, so we buffer the body as an ArrayBuffer upfront instead.\n\tconst buffer = await response.arrayBuffer()\n\n\tconst memoized: ResponseLike = {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\theaders: response.headers,\n\t\turl: response.url,\n\t\ttext: async () => new TextDecoder().decode(buffer),\n\t\tjson: async () => JSON.parse(new TextDecoder().decode(buffer)),\n\t\tarrayBuffer: async () => buffer,\n\t\tblob: async () => new Blob([buffer]),\n\t\tclone: () => memoized,\n\t}\n\n\treturn memoized\n}\n\n/**\n * Makes an HTTP request with automatic retry for rate limits and request\n * deduplication.\n *\n * @param url - The URL to request.\n * @param init - Fetch options.\n * @param fetchFn - The fetch function to use.\n *\n * @returns The response from the fetch request.\n */\nexport async function request(\n\turl: URL,\n\tinit: RequestInitLike | undefined,\n\tfetchFn: FetchLike,\n): Promise<ResponseLike> {\n\tconst stringURL = url.toString()\n\n\tlet job: Promise<ResponseLike>\n\n\t// Throttle requests with a body.\n\tif (init?.body) {\n\t\t// Rate limiting is done per hostname.\n\t\tconst runner = (THROTTLED_RUNNERS[url.hostname] ||= pLimit({\n\t\t\tinterval: DEFAULT_RETRY_AFTER,\n\t\t}))\n\n\t\tjob = runner(() => fetchFn(stringURL, init))\n\t} else {\n\t\t// Deduplicate all other requests.\n\t\tconst existingJob = DEDUPLICATED_JOBS[stringURL]?.get(init?.signal)\n\t\tif (existingJob) {\n\t\t\tjob = existingJob\n\t\t} else {\n\t\t\tjob = fetchFn(stringURL, init)\n\t\t\t\t.then(memoizeResponse)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tDEDUPLICATED_JOBS[stringURL]?.delete(init?.signal)\n\t\t\t\t\tif (DEDUPLICATED_JOBS[stringURL]?.size === 0) {\n\t\t\t\t\t\tdelete DEDUPLICATED_JOBS[stringURL]\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst map = (DEDUPLICATED_JOBS[stringURL] ||= new Map())\n\t\t\tmap.set(init?.signal, job)\n\t\t}\n\t}\n\n\tconst response = await job\n\n\t// Retry rate limited requests.\n\tif (response.status === 429) {\n\t\tconst retryAfter = Number(response.headers.get(\"retry-after\"))\n\t\tconst resolvedRetryAfter = Number.isNaN(retryAfter)\n\t\t\t? DEFAULT_RETRY_AFTER\n\t\t\t: retryAfter * 1000\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter))\n\n\t\treturn request(url, init, fetchFn)\n\t}\n\n\treturn response\n}\n"],"mappings":";;;;;;;AAOA,MAAa,sBAAsB;;;;AAKnC,MAAM,oBAA4D,EAAE;;;;;AAMpE,MAAM,oBAEF,EAAE;AAuFN,eAAe,gBAAgB,UAA+C;CAI7E,MAAM,SAAS,MAAM,SAAS,aAAa;CAE3C,MAAM,WAAyB;EAC9B,IAAI,SAAS;EACb,QAAQ,SAAS;EACjB,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,MAAM,YAAY,IAAI,aAAa,CAAC,OAAO,OAAO;EAClD,MAAM,YAAY,KAAK,MAAM,IAAI,aAAa,CAAC,OAAO,OAAO,CAAC;EAC9D,aAAa,YAAY;EACzB,MAAM,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC;EACpC,aAAa;EACb;AAED,QAAO;;;;;;;;;;;;AAaR,eAAsB,QACrB,KACA,MACA,SACwB;CACxB,MAAM,YAAY,IAAI,UAAU;CAEhC,IAAI;AAGJ,KAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,MAAM;;AAMf,SAJgB,kBAAA,gBAAkB,IAAI,cAAtB,kBAAA,iBAAoCA,eAAAA,OAAO,EAC1D,UAAA,MACA,CAAC,SAEiB,QAAQ,WAAW,KAAK,CAAC;QACtC;;EAEN,MAAM,eAAA,wBAAc,kBAAkB,gBAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAY,IAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,OAAO;AACnE,MAAI,YACH,OAAM;OACA;AACN,SAAM,QAAQ,WAAW,KAAK,CAC5B,KAAK,gBAAgB,CACrB,cAAc;;AACd,KAAA,yBAAA,kBAAkB,gBAAA,QAAA,2BAAA,KAAA,KAAA,uBAAY,OAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAO,KAAM,OAAO;AAClD,UAAA,yBAAI,kBAAkB,gBAAA,QAAA,2BAAA,KAAA,IAAA,KAAA,IAAA,uBAAY,UAAS,EAC1C,QAAO,kBAAkB;KAEzB;AAEH,IADa,kBAAkB,eAAlB,kBAAkB,6BAAe,IAAI,KAAK,GACnD,IAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,QAAQ,IAAI;;;CAI5B,MAAM,WAAW,MAAM;AAGvB,KAAI,SAAS,WAAW,KAAK;EAC5B,MAAM,aAAa,OAAO,SAAS,QAAQ,IAAI,cAAc,CAAC;EAC9D,MAAM,qBAAqB,OAAO,MAAM,WAAW,GAChD,sBACA,aAAa;AAEhB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,mBAAmB,CAAC;AAEvE,SAAO,QAAQ,KAAK,MAAM,QAAQ;;AAGnC,QAAO"}
@@ -1,5 +1,4 @@
1
1
  //#region src/lib/request.d.ts
2
-
3
2
  /**
4
3
  * A universal API to make network requests. A subset of the `fetch()` API.
5
4
  *
@@ -47,6 +46,7 @@ interface ResponseLike {
47
46
  url: string;
48
47
  json(): Promise<any>;
49
48
  text(): Promise<string>;
49
+ arrayBuffer(): Promise<ArrayBuffer>;
50
50
  blob(): Promise<Blob>;
51
51
  clone(): ResponseLike;
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.cts","names":[],"sources":["../../src/lib/request.ts"],"sourcesContent":[],"mappings":";;AA2CA;AAUA;;;;AA4BU,KAtDE,SAAA,GAsDF,CAAA,KAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EApDF,eAoDE,EAAA,GAnDL,OAmDK,CAnDG,YAmDH,CAAA;;;AAMV;;;;AAQiB,KApDL,eAAA,GAoDK,GAAA;;;;AAOA,UAjDA,eAAA,SAAwB,IAiDb,CAjDkB,WAiDlB,EAAA,OAAA,CAAA,CAAA;;;;;;;;eArCd;;;;YAKH;;;;;;;WAWD;;;;;UAMO,YAAA;;;WAGP;;UAGD;UACA;UACA,QAAQ;WACP;;;;;UAMO,WAAA"}
1
+ {"version":3,"file":"request.d.cts","names":[],"sources":["../../src/lib/request.ts"],"mappings":";;;;;;KA2BY,SAAA,IACX,KAAA,UACA,IAAA,GAAO,eAAA,KACH,OAAA,CAAQ,YAAA;;;;;AAab;;KAAY,eAAA;;;AAUZ;UAAiB,eAAA,SAAwB,IAAA,CAAK,WAAA;;;;EAI7C,MAAA;EAwBS;;;EAhBT,IAAA,SAAa,QAAA;EAZ2B;;;EAiBxC,OAAA,GAAU,MAAA;EALG;;;;;;EAgBb,MAAA,GAAS,eAAA;AAAA;;;;UAMO,YAAA;EAChB,EAAA;EACA,MAAA;EACA,OAAA,EAAS,WAAA;EACT,GAAA;EAEA,IAAA,IAAQ,OAAA;EACR,IAAA,IAAQ,OAAA;EACR,WAAA,IAAe,OAAA,CAAQ,WAAA;EACvB,IAAA,IAAQ,OAAA,CAAQ,IAAA;EAChB,KAAA,IAAS,YAAA;AAAA;;;;UAMO,WAAA;EAChB,GAAA,CAAI,IAAA;AAAA"}
@@ -1,5 +1,4 @@
1
1
  //#region src/lib/request.d.ts
2
-
3
2
  /**
4
3
  * A universal API to make network requests. A subset of the `fetch()` API.
5
4
  *
@@ -47,6 +46,7 @@ interface ResponseLike {
47
46
  url: string;
48
47
  json(): Promise<any>;
49
48
  text(): Promise<string>;
49
+ arrayBuffer(): Promise<ArrayBuffer>;
50
50
  blob(): Promise<Blob>;
51
51
  clone(): ResponseLike;
52
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","names":[],"sources":["../../src/lib/request.ts"],"sourcesContent":[],"mappings":";;AA2CA;AAUA;;;;AA4BU,KAtDE,SAAA,GAsDF,CAAA,KAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EApDF,eAoDE,EAAA,GAnDL,OAmDK,CAnDG,YAmDH,CAAA;;;AAMV;;;;AAQiB,KApDL,eAAA,GAoDK,GAAA;;;;AAOA,UAjDA,eAAA,SAAwB,IAiDb,CAjDkB,WAiDlB,EAAA,OAAA,CAAA,CAAA;;;;;;;;eArCd;;;;YAKH;;;;;;;WAWD;;;;;UAMO,YAAA;;;WAGP;;UAGD;UACA;UACA,QAAQ;WACP;;;;;UAMO,WAAA"}
1
+ {"version":3,"file":"request.d.ts","names":[],"sources":["../../src/lib/request.ts"],"mappings":";;;;;;KA2BY,SAAA,IACX,KAAA,UACA,IAAA,GAAO,eAAA,KACH,OAAA,CAAQ,YAAA;;;;;AAab;;KAAY,eAAA;;;AAUZ;UAAiB,eAAA,SAAwB,IAAA,CAAK,WAAA;;;;EAI7C,MAAA;EAwBS;;;EAhBT,IAAA,SAAa,QAAA;EAZ2B;;;EAiBxC,OAAA,GAAU,MAAA;EALG;;;;;;EAgBb,MAAA,GAAS,eAAA;AAAA;;;;UAMO,YAAA;EAChB,EAAA;EACA,MAAA;EACA,OAAA,EAAS,WAAA;EACT,GAAA;EAEA,IAAA,IAAQ,OAAA;EACR,IAAA,IAAQ,OAAA;EACR,WAAA,IAAe,OAAA,CAAQ,WAAA;EACvB,IAAA,IAAQ,OAAA,CAAQ,IAAA;EAChB,KAAA,IAAS,YAAA;AAAA;;;;UAMO,WAAA;EAChB,GAAA,CAAI,IAAA;AAAA"}
@@ -1,5 +1,4 @@
1
1
  import { pLimit } from "./pLimit.js";
2
-
3
2
  //#region src/lib/request.ts
4
3
  /**
5
4
  * The default number of milliseconds to wait before retrying a rate-limited
@@ -17,15 +16,16 @@ const THROTTLED_RUNNERS = {};
17
16
  */
18
17
  const DEDUPLICATED_JOBS = {};
19
18
  async function memoizeResponse(response) {
20
- const blob = await response.blob();
19
+ const buffer = await response.arrayBuffer();
21
20
  const memoized = {
22
21
  ok: response.ok,
23
22
  status: response.status,
24
23
  headers: response.headers,
25
24
  url: response.url,
26
- text: async () => blob.text(),
27
- json: async () => JSON.parse(await blob.text()),
28
- blob: async () => blob,
25
+ text: async () => new TextDecoder().decode(buffer),
26
+ json: async () => JSON.parse(new TextDecoder().decode(buffer)),
27
+ arrayBuffer: async () => buffer,
28
+ blob: async () => new Blob([buffer]),
29
29
  clone: () => memoized
30
30
  };
31
31
  return memoized;
@@ -45,7 +45,7 @@ async function request(url, init, fetchFn) {
45
45
  let job;
46
46
  if (init === null || init === void 0 ? void 0 : init.body) {
47
47
  var _url$hostname;
48
- job = (THROTTLED_RUNNERS[_url$hostname = url.hostname] || (THROTTLED_RUNNERS[_url$hostname] = pLimit({ interval: DEFAULT_RETRY_AFTER })))(() => fetchFn(stringURL, init));
48
+ job = (THROTTLED_RUNNERS[_url$hostname = url.hostname] || (THROTTLED_RUNNERS[_url$hostname] = pLimit({ interval: 1500 })))(() => fetchFn(stringURL, init));
49
49
  } else {
50
50
  var _DEDUPLICATED_JOBS$st;
51
51
  const existingJob = (_DEDUPLICATED_JOBS$st = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st === void 0 ? void 0 : _DEDUPLICATED_JOBS$st.get(init === null || init === void 0 ? void 0 : init.signal);
@@ -68,7 +68,7 @@ async function request(url, init, fetchFn) {
68
68
  }
69
69
  return response;
70
70
  }
71
-
72
71
  //#endregion
73
72
  export { request };
73
+
74
74
  //# sourceMappingURL=request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","names":["THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>>","DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n>","memoized: ResponseLike","job: Promise<ResponseLike>"],"sources":["../../src/lib/request.ts"],"sourcesContent":["import { type LimitFunction, pLimit } from \"./pLimit\"\n\n/**\n * The default number of milliseconds to wait before retrying a rate-limited\n * `fetch()` request (429 response code). The default value is only used if the\n * response does not include a `retry-after` header.\n */\nexport const DEFAULT_RETRY_AFTER = 1500 // ms\n\n/**\n * A record of URLs mapped to throttled task runners.\n */\nconst THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>> = {}\n\n/**\n * A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their\n * optional signal.\n */\nconst DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n> = {}\n\n/**\n * A universal API to make network requests. A subset of the `fetch()` API.\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}\n */\nexport type FetchLike = (\n\tinput: string,\n\tinit?: RequestInitLike,\n) => Promise<ResponseLike>\n\n/**\n * An object that allows you to abort a `fetch()` request if needed via an\n * `AbortController` object\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}\n */\n// `any` is used often here to ensure this type is universally valid among\n// different AbortSignal implementations. The types of each property are not\n// important to validate since it is blindly passed to a given `fetch()`\n// function.\n// oxlint-disable-next-line no-explicit-any\nexport type AbortSignalLike = any\n\n/**\n * A subset of RequestInit properties to configure a `fetch()` request.\n */\n// Only options relevant to the client are included. Extending from the full\n// RequestInit would cause issues, such as accepting Header objects.\n//\n// An interface is used to allow other libraries to augment the type with\n// environment-specific types.\nexport interface RequestInitLike extends Pick<RequestInit, \"cache\"> {\n\t/**\n\t * The HTTP method to use for the request.\n\t */\n\tmethod?: string\n\n\t/**\n\t * The request body to send with the request.\n\t */\n\t// We want to keep the body type as compatible as possible, so\n\t// we only declare the type we need and accept anything else.\n\t// oxlint-disable-next-line no-explicit-any\n\tbody?: any | FormData | string\n\n\t/**\n\t * An object literal to set the `fetch()` request's headers.\n\t */\n\theaders?: Record<string, string>\n\n\t/**\n\t * An AbortSignal to set the `fetch()` request's signal.\n\t *\n\t * See:\n\t * [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)\n\t */\n\t// NOTE: `AbortSignalLike` is `any`! It is left as `AbortSignalLike`\n\t// for backwards compatibility (the type is exported) and to signal to\n\t// other readers that this should be an AbortSignal-like object.\n\tsignal?: AbortSignalLike\n}\n\n/**\n * The minimum required properties from Response.\n */\nexport interface ResponseLike {\n\tok: boolean\n\tstatus: number\n\theaders: HeadersLike\n\turl: string\n\t// oxlint-disable-next-line no-explicit-any\n\tjson(): Promise<any>\n\ttext(): Promise<string>\n\tblob(): Promise<Blob>\n\tclone(): ResponseLike\n}\n\n/**\n * The minimum required properties from Headers.\n */\nexport interface HeadersLike {\n\tget(name: string): string | null\n}\n\nasync function memoizeResponse(response: ResponseLike): Promise<ResponseLike> {\n\t// Deduplicated responses are shared across multiple callers. Calling\n\t// response.clone() on a shared response can cause backpressure hangs\n\t// in Node.js, so we buffer the body as a blob upfront instead.\n\tconst blob = await response.blob()\n\n\tconst memoized: ResponseLike = {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\theaders: response.headers,\n\t\turl: response.url,\n\t\ttext: async () => blob.text(),\n\t\tjson: async () => JSON.parse(await blob.text()),\n\t\tblob: async () => blob,\n\t\tclone: () => memoized,\n\t}\n\n\treturn memoized\n}\n\n/**\n * Makes an HTTP request with automatic retry for rate limits and request\n * deduplication.\n *\n * @param url - The URL to request.\n * @param init - Fetch options.\n * @param fetchFn - The fetch function to use.\n *\n * @returns The response from the fetch request.\n */\nexport async function request(\n\turl: URL,\n\tinit: RequestInitLike | undefined,\n\tfetchFn: FetchLike,\n): Promise<ResponseLike> {\n\tconst stringURL = url.toString()\n\n\tlet job: Promise<ResponseLike>\n\n\t// Throttle requests with a body.\n\tif (init?.body) {\n\t\t// Rate limiting is done per hostname.\n\t\tconst runner = (THROTTLED_RUNNERS[url.hostname] ||= pLimit({\n\t\t\tinterval: DEFAULT_RETRY_AFTER,\n\t\t}))\n\n\t\tjob = runner(() => fetchFn(stringURL, init))\n\t} else {\n\t\t// Deduplicate all other requests.\n\t\tconst existingJob = DEDUPLICATED_JOBS[stringURL]?.get(init?.signal)\n\t\tif (existingJob) {\n\t\t\tjob = existingJob\n\t\t} else {\n\t\t\tjob = fetchFn(stringURL, init)\n\t\t\t\t.then(memoizeResponse)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tDEDUPLICATED_JOBS[stringURL]?.delete(init?.signal)\n\t\t\t\t\tif (DEDUPLICATED_JOBS[stringURL]?.size === 0) {\n\t\t\t\t\t\tdelete DEDUPLICATED_JOBS[stringURL]\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst map = (DEDUPLICATED_JOBS[stringURL] ||= new Map())\n\t\t\tmap.set(init?.signal, job)\n\t\t}\n\t}\n\n\tconst response = await job\n\n\t// Retry rate limited requests.\n\tif (response.status === 429) {\n\t\tconst retryAfter = Number(response.headers.get(\"retry-after\"))\n\t\tconst resolvedRetryAfter = Number.isNaN(retryAfter)\n\t\t\t? DEFAULT_RETRY_AFTER\n\t\t\t: retryAfter * 1000\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter))\n\n\t\treturn request(url, init, fetchFn)\n\t}\n\n\treturn response\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,sBAAsB;;;;AAKnC,MAAMA,oBAA4D,EAAE;;;;;AAMpE,MAAMC,oBAEF,EAAE;AAsFN,eAAe,gBAAgB,UAA+C;CAI7E,MAAM,OAAO,MAAM,SAAS,MAAM;CAElC,MAAMC,WAAyB;EAC9B,IAAI,SAAS;EACb,QAAQ,SAAS;EACjB,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,MAAM,YAAY,KAAK,MAAM;EAC7B,MAAM,YAAY,KAAK,MAAM,MAAM,KAAK,MAAM,CAAC;EAC/C,MAAM,YAAY;EAClB,aAAa;EACb;AAED,QAAO;;;;;;;;;;;;AAaR,eAAsB,QACrB,KACA,MACA,SACwB;CACxB,MAAM,YAAY,IAAI,UAAU;CAEhC,IAAIC;AAGJ,iDAAI,KAAM,MAAM;;AAMf,SAJgB,kCAAkB,IAAI,cAAtB,mCAAoC,OAAO,EAC1D,UAAU,qBACV,CAAC,SAEiB,QAAQ,WAAW,KAAK,CAAC;QACtC;;EAEN,MAAM,uCAAc,kBAAkB,0FAAY,gDAAI,KAAM,OAAO;AACnE,MAAI,YACH,OAAM;OACA;AACN,SAAM,QAAQ,WAAW,KAAK,CAC5B,KAAK,gBAAgB,CACrB,cAAc;;AACd,gDAAkB,oFAAY,mDAAO,KAAM,OAAO;AAClD,mCAAI,kBAAkB,4FAAY,UAAS,EAC1C,QAAO,kBAAkB;KAEzB;AAEH,IADa,kBAAkB,eAAlB,kBAAkB,6BAAe,IAAI,KAAK,GACnD,gDAAI,KAAM,QAAQ,IAAI;;;CAI5B,MAAM,WAAW,MAAM;AAGvB,KAAI,SAAS,WAAW,KAAK;EAC5B,MAAM,aAAa,OAAO,SAAS,QAAQ,IAAI,cAAc,CAAC;EAC9D,MAAM,qBAAqB,OAAO,MAAM,WAAW,GAChD,sBACA,aAAa;AAEhB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,mBAAmB,CAAC;AAEvE,SAAO,QAAQ,KAAK,MAAM,QAAQ;;AAGnC,QAAO"}
1
+ {"version":3,"file":"request.js","names":[],"sources":["../../src/lib/request.ts"],"sourcesContent":["import { type LimitFunction, pLimit } from \"./pLimit\"\n\n/**\n * The default number of milliseconds to wait before retrying a rate-limited\n * `fetch()` request (429 response code). The default value is only used if the\n * response does not include a `retry-after` header.\n */\nexport const DEFAULT_RETRY_AFTER = 1500 // ms\n\n/**\n * A record of URLs mapped to throttled task runners.\n */\nconst THROTTLED_RUNNERS: Partial<Record<string, LimitFunction>> = {}\n\n/**\n * A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their\n * optional signal.\n */\nconst DEDUPLICATED_JOBS: Partial<\n\tRecord<string, Map<AbortSignalLike | undefined, Promise<ResponseLike>>>\n> = {}\n\n/**\n * A universal API to make network requests. A subset of the `fetch()` API.\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}\n */\nexport type FetchLike = (\n\tinput: string,\n\tinit?: RequestInitLike,\n) => Promise<ResponseLike>\n\n/**\n * An object that allows you to abort a `fetch()` request if needed via an\n * `AbortController` object\n *\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}\n */\n// `any` is used often here to ensure this type is universally valid among\n// different AbortSignal implementations. The types of each property are not\n// important to validate since it is blindly passed to a given `fetch()`\n// function.\n// oxlint-disable-next-line no-explicit-any\nexport type AbortSignalLike = any\n\n/**\n * A subset of RequestInit properties to configure a `fetch()` request.\n */\n// Only options relevant to the client are included. Extending from the full\n// RequestInit would cause issues, such as accepting Header objects.\n//\n// An interface is used to allow other libraries to augment the type with\n// environment-specific types.\nexport interface RequestInitLike extends Pick<RequestInit, \"cache\"> {\n\t/**\n\t * The HTTP method to use for the request.\n\t */\n\tmethod?: string\n\n\t/**\n\t * The request body to send with the request.\n\t */\n\t// We want to keep the body type as compatible as possible, so\n\t// we only declare the type we need and accept anything else.\n\t// oxlint-disable-next-line no-explicit-any\n\tbody?: any | FormData | string\n\n\t/**\n\t * An object literal to set the `fetch()` request's headers.\n\t */\n\theaders?: Record<string, string>\n\n\t/**\n\t * An AbortSignal to set the `fetch()` request's signal.\n\t *\n\t * See:\n\t * [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)\n\t */\n\t// NOTE: `AbortSignalLike` is `any`! It is left as `AbortSignalLike`\n\t// for backwards compatibility (the type is exported) and to signal to\n\t// other readers that this should be an AbortSignal-like object.\n\tsignal?: AbortSignalLike\n}\n\n/**\n * The minimum required properties from Response.\n */\nexport interface ResponseLike {\n\tok: boolean\n\tstatus: number\n\theaders: HeadersLike\n\turl: string\n\t// oxlint-disable-next-line no-explicit-any\n\tjson(): Promise<any>\n\ttext(): Promise<string>\n\tarrayBuffer(): Promise<ArrayBuffer>\n\tblob(): Promise<Blob>\n\tclone(): ResponseLike\n}\n\n/**\n * The minimum required properties from Headers.\n */\nexport interface HeadersLike {\n\tget(name: string): string | null\n}\n\nasync function memoizeResponse(response: ResponseLike): Promise<ResponseLike> {\n\t// Deduplicated responses are shared across multiple callers. Calling\n\t// response.clone() on a shared response can cause backpressure hangs\n\t// in Node.js, so we buffer the body as an ArrayBuffer upfront instead.\n\tconst buffer = await response.arrayBuffer()\n\n\tconst memoized: ResponseLike = {\n\t\tok: response.ok,\n\t\tstatus: response.status,\n\t\theaders: response.headers,\n\t\turl: response.url,\n\t\ttext: async () => new TextDecoder().decode(buffer),\n\t\tjson: async () => JSON.parse(new TextDecoder().decode(buffer)),\n\t\tarrayBuffer: async () => buffer,\n\t\tblob: async () => new Blob([buffer]),\n\t\tclone: () => memoized,\n\t}\n\n\treturn memoized\n}\n\n/**\n * Makes an HTTP request with automatic retry for rate limits and request\n * deduplication.\n *\n * @param url - The URL to request.\n * @param init - Fetch options.\n * @param fetchFn - The fetch function to use.\n *\n * @returns The response from the fetch request.\n */\nexport async function request(\n\turl: URL,\n\tinit: RequestInitLike | undefined,\n\tfetchFn: FetchLike,\n): Promise<ResponseLike> {\n\tconst stringURL = url.toString()\n\n\tlet job: Promise<ResponseLike>\n\n\t// Throttle requests with a body.\n\tif (init?.body) {\n\t\t// Rate limiting is done per hostname.\n\t\tconst runner = (THROTTLED_RUNNERS[url.hostname] ||= pLimit({\n\t\t\tinterval: DEFAULT_RETRY_AFTER,\n\t\t}))\n\n\t\tjob = runner(() => fetchFn(stringURL, init))\n\t} else {\n\t\t// Deduplicate all other requests.\n\t\tconst existingJob = DEDUPLICATED_JOBS[stringURL]?.get(init?.signal)\n\t\tif (existingJob) {\n\t\t\tjob = existingJob\n\t\t} else {\n\t\t\tjob = fetchFn(stringURL, init)\n\t\t\t\t.then(memoizeResponse)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tDEDUPLICATED_JOBS[stringURL]?.delete(init?.signal)\n\t\t\t\t\tif (DEDUPLICATED_JOBS[stringURL]?.size === 0) {\n\t\t\t\t\t\tdelete DEDUPLICATED_JOBS[stringURL]\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst map = (DEDUPLICATED_JOBS[stringURL] ||= new Map())\n\t\t\tmap.set(init?.signal, job)\n\t\t}\n\t}\n\n\tconst response = await job\n\n\t// Retry rate limited requests.\n\tif (response.status === 429) {\n\t\tconst retryAfter = Number(response.headers.get(\"retry-after\"))\n\t\tconst resolvedRetryAfter = Number.isNaN(retryAfter)\n\t\t\t? DEFAULT_RETRY_AFTER\n\t\t\t: retryAfter * 1000\n\n\t\tawait new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter))\n\n\t\treturn request(url, init, fetchFn)\n\t}\n\n\treturn response\n}\n"],"mappings":";;;;;;;AAOA,MAAa,sBAAsB;;;;AAKnC,MAAM,oBAA4D,EAAE;;;;;AAMpE,MAAM,oBAEF,EAAE;AAuFN,eAAe,gBAAgB,UAA+C;CAI7E,MAAM,SAAS,MAAM,SAAS,aAAa;CAE3C,MAAM,WAAyB;EAC9B,IAAI,SAAS;EACb,QAAQ,SAAS;EACjB,SAAS,SAAS;EAClB,KAAK,SAAS;EACd,MAAM,YAAY,IAAI,aAAa,CAAC,OAAO,OAAO;EAClD,MAAM,YAAY,KAAK,MAAM,IAAI,aAAa,CAAC,OAAO,OAAO,CAAC;EAC9D,aAAa,YAAY;EACzB,MAAM,YAAY,IAAI,KAAK,CAAC,OAAO,CAAC;EACpC,aAAa;EACb;AAED,QAAO;;;;;;;;;;;;AAaR,eAAsB,QACrB,KACA,MACA,SACwB;CACxB,MAAM,YAAY,IAAI,UAAU;CAEhC,IAAI;AAGJ,KAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,MAAM;;AAMf,SAJgB,kBAAA,gBAAkB,IAAI,cAAtB,kBAAA,iBAAoC,OAAO,EAC1D,UAAA,MACA,CAAC,SAEiB,QAAQ,WAAW,KAAK,CAAC;QACtC;;EAEN,MAAM,eAAA,wBAAc,kBAAkB,gBAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAY,IAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,OAAO;AACnE,MAAI,YACH,OAAM;OACA;AACN,SAAM,QAAQ,WAAW,KAAK,CAC5B,KAAK,gBAAgB,CACrB,cAAc;;AACd,KAAA,yBAAA,kBAAkB,gBAAA,QAAA,2BAAA,KAAA,KAAA,uBAAY,OAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAO,KAAM,OAAO;AAClD,UAAA,yBAAI,kBAAkB,gBAAA,QAAA,2BAAA,KAAA,IAAA,KAAA,IAAA,uBAAY,UAAS,EAC1C,QAAO,kBAAkB;KAEzB;AAEH,IADa,kBAAkB,eAAlB,kBAAkB,6BAAe,IAAI,KAAK,GACnD,IAAA,SAAA,QAAA,SAAA,KAAA,IAAA,KAAA,IAAI,KAAM,QAAQ,IAAI;;;CAI5B,MAAM,WAAW,MAAM;AAGvB,KAAI,SAAS,WAAW,KAAK;EAC5B,MAAM,aAAa,OAAO,SAAS,QAAQ,IAAI,cAAc,CAAC;EAC9D,MAAM,qBAAqB,OAAO,MAAM,WAAW,GAChD,sBACA,aAAa;AAEhB,QAAM,IAAI,SAAS,YAAY,WAAW,SAAS,mBAAmB,CAAC;AAEvE,SAAO,QAAQ,KAAK,MAAM,QAAQ;;AAGnC,QAAO"}