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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (480) hide show
  1. package/dist/index.cjs +3880 -92
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +4424 -0
  4. package/dist/index.d.mts +4424 -0
  5. package/dist/index.d.ts +4349 -128
  6. package/dist/index.mjs +3837 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/richtext/index.cjs +244 -0
  9. package/dist/richtext/index.cjs.map +1 -0
  10. package/dist/richtext/index.d.cts +78 -0
  11. package/dist/richtext/index.d.mts +78 -0
  12. package/dist/richtext/index.d.ts +78 -7
  13. package/dist/richtext/index.mjs +237 -0
  14. package/dist/richtext/index.mjs.map +1 -0
  15. package/dist/shared/client.TSGr56lO.d.cts +899 -0
  16. package/dist/shared/client.TSGr56lO.d.mts +899 -0
  17. package/dist/shared/client.TSGr56lO.d.ts +899 -0
  18. package/package.json +19 -42
  19. package/src/buildQueryURL.ts +29 -21
  20. package/src/createClient.ts +11 -8
  21. package/src/getRepositoryEndpoint.ts +9 -2
  22. package/src/helpers/asDate.ts +11 -4
  23. package/src/helpers/asHTML.ts +34 -26
  24. package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
  25. package/src/helpers/asImageSrc.ts +11 -10
  26. package/src/helpers/asImageWidthSrcSet.ts +18 -17
  27. package/src/helpers/asLink.ts +33 -32
  28. package/src/helpers/asLinkAttrs.ts +6 -9
  29. package/src/helpers/asText.ts +20 -10
  30. package/src/helpers/isFilled.ts +15 -14
  31. package/src/helpers/mapSliceZone.ts +10 -10
  32. package/src/index.ts +2 -2
  33. package/src/isRepositoryEndpoint.ts +2 -2
  34. package/src/richtext/asText.ts +5 -5
  35. package/src/richtext/serialize.ts +8 -8
  36. package/src/richtext/types.ts +6 -6
  37. package/src/types/migration/Asset.ts +10 -2
  38. package/src/types/model/types.ts +0 -2
  39. package/dist/Client.cjs +0 -1274
  40. package/dist/Client.cjs.map +0 -1
  41. package/dist/Client.d.ts +0 -981
  42. package/dist/Client.js +0 -1274
  43. package/dist/Client.js.map +0 -1
  44. package/dist/Migration.cjs +0 -315
  45. package/dist/Migration.cjs.map +0 -1
  46. package/dist/Migration.d.ts +0 -213
  47. package/dist/Migration.js +0 -315
  48. package/dist/Migration.js.map +0 -1
  49. package/dist/WriteClient.cjs +0 -560
  50. package/dist/WriteClient.cjs.map +0 -1
  51. package/dist/WriteClient.d.ts +0 -281
  52. package/dist/WriteClient.js +0 -560
  53. package/dist/WriteClient.js.map +0 -1
  54. package/dist/buildQueryURL.cjs +0 -66
  55. package/dist/buildQueryURL.cjs.map +0 -1
  56. package/dist/buildQueryURL.d.ts +0 -209
  57. package/dist/buildQueryURL.js +0 -66
  58. package/dist/buildQueryURL.js.map +0 -1
  59. package/dist/cookie.cjs +0 -5
  60. package/dist/cookie.cjs.map +0 -1
  61. package/dist/cookie.d.ts +0 -5
  62. package/dist/cookie.js +0 -5
  63. package/dist/cookie.js.map +0 -1
  64. package/dist/createClient.cjs +0 -6
  65. package/dist/createClient.cjs.map +0 -1
  66. package/dist/createClient.d.ts +0 -32
  67. package/dist/createClient.js +0 -6
  68. package/dist/createClient.js.map +0 -1
  69. package/dist/createMigration.cjs +0 -6
  70. package/dist/createMigration.cjs.map +0 -1
  71. package/dist/createMigration.d.ts +0 -24
  72. package/dist/createMigration.js +0 -6
  73. package/dist/createMigration.js.map +0 -1
  74. package/dist/createWriteClient.cjs +0 -6
  75. package/dist/createWriteClient.cjs.map +0 -1
  76. package/dist/createWriteClient.d.ts +0 -32
  77. package/dist/createWriteClient.js +0 -6
  78. package/dist/createWriteClient.js.map +0 -1
  79. package/dist/errors/ForbiddenError.cjs +0 -7
  80. package/dist/errors/ForbiddenError.cjs.map +0 -1
  81. package/dist/errors/ForbiddenError.d.ts +0 -11
  82. package/dist/errors/ForbiddenError.js +0 -7
  83. package/dist/errors/ForbiddenError.js.map +0 -1
  84. package/dist/errors/InvalidDataError.cjs +0 -7
  85. package/dist/errors/InvalidDataError.cjs.map +0 -1
  86. package/dist/errors/InvalidDataError.d.ts +0 -3
  87. package/dist/errors/InvalidDataError.js +0 -7
  88. package/dist/errors/InvalidDataError.js.map +0 -1
  89. package/dist/errors/NotFoundError.cjs +0 -7
  90. package/dist/errors/NotFoundError.cjs.map +0 -1
  91. package/dist/errors/NotFoundError.d.ts +0 -3
  92. package/dist/errors/NotFoundError.js +0 -7
  93. package/dist/errors/NotFoundError.js.map +0 -1
  94. package/dist/errors/ParsingError.cjs +0 -7
  95. package/dist/errors/ParsingError.cjs.map +0 -1
  96. package/dist/errors/ParsingError.d.ts +0 -14
  97. package/dist/errors/ParsingError.js +0 -7
  98. package/dist/errors/ParsingError.js.map +0 -1
  99. package/dist/errors/PreviewTokenExpired.cjs +0 -7
  100. package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
  101. package/dist/errors/PreviewTokenExpired.d.ts +0 -8
  102. package/dist/errors/PreviewTokenExpired.js +0 -7
  103. package/dist/errors/PreviewTokenExpired.js.map +0 -1
  104. package/dist/errors/PrismicError.cjs +0 -16
  105. package/dist/errors/PrismicError.cjs.map +0 -1
  106. package/dist/errors/PrismicError.d.ts +0 -5
  107. package/dist/errors/PrismicError.js +0 -16
  108. package/dist/errors/PrismicError.js.map +0 -1
  109. package/dist/errors/RefExpiredError.cjs +0 -7
  110. package/dist/errors/RefExpiredError.cjs.map +0 -1
  111. package/dist/errors/RefExpiredError.d.ts +0 -8
  112. package/dist/errors/RefExpiredError.js +0 -7
  113. package/dist/errors/RefExpiredError.js.map +0 -1
  114. package/dist/errors/RefNotFoundError.cjs +0 -7
  115. package/dist/errors/RefNotFoundError.cjs.map +0 -1
  116. package/dist/errors/RefNotFoundError.d.ts +0 -8
  117. package/dist/errors/RefNotFoundError.js +0 -7
  118. package/dist/errors/RefNotFoundError.js.map +0 -1
  119. package/dist/errors/RepositoryNotFoundError.cjs +0 -7
  120. package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
  121. package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
  122. package/dist/errors/RepositoryNotFoundError.js +0 -7
  123. package/dist/errors/RepositoryNotFoundError.js.map +0 -1
  124. package/dist/filter.cjs +0 -247
  125. package/dist/filter.cjs.map +0 -1
  126. package/dist/filter.d.ts +0 -209
  127. package/dist/filter.js +0 -247
  128. package/dist/filter.js.map +0 -1
  129. package/dist/getGraphQLEndpoint.cjs +0 -13
  130. package/dist/getGraphQLEndpoint.cjs.map +0 -1
  131. package/dist/getGraphQLEndpoint.d.ts +0 -10
  132. package/dist/getGraphQLEndpoint.js +0 -13
  133. package/dist/getGraphQLEndpoint.js.map +0 -1
  134. package/dist/getRepositoryEndpoint.cjs +0 -13
  135. package/dist/getRepositoryEndpoint.cjs.map +0 -1
  136. package/dist/getRepositoryEndpoint.d.ts +0 -12
  137. package/dist/getRepositoryEndpoint.js +0 -13
  138. package/dist/getRepositoryEndpoint.js.map +0 -1
  139. package/dist/getRepositoryName.cjs +0 -17
  140. package/dist/getRepositoryName.cjs.map +0 -1
  141. package/dist/getRepositoryName.d.ts +0 -12
  142. package/dist/getRepositoryName.js +0 -17
  143. package/dist/getRepositoryName.js.map +0 -1
  144. package/dist/getToolbarSrc.cjs +0 -13
  145. package/dist/getToolbarSrc.cjs.map +0 -1
  146. package/dist/getToolbarSrc.d.ts +0 -34
  147. package/dist/getToolbarSrc.js +0 -13
  148. package/dist/getToolbarSrc.js.map +0 -1
  149. package/dist/helpers/asDate.cjs +0 -14
  150. package/dist/helpers/asDate.cjs.map +0 -1
  151. package/dist/helpers/asDate.d.ts +0 -17
  152. package/dist/helpers/asDate.js +0 -14
  153. package/dist/helpers/asDate.js.map +0 -1
  154. package/dist/helpers/asHTML.cjs +0 -86
  155. package/dist/helpers/asHTML.cjs.map +0 -1
  156. package/dist/helpers/asHTML.d.ts +0 -141
  157. package/dist/helpers/asHTML.js +0 -86
  158. package/dist/helpers/asHTML.js.map +0 -1
  159. package/dist/helpers/asImagePixelDensitySrcSet.cjs +0 -21
  160. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +0 -1
  161. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +0 -53
  162. package/dist/helpers/asImagePixelDensitySrcSet.js +0 -21
  163. package/dist/helpers/asImagePixelDensitySrcSet.js.map +0 -1
  164. package/dist/helpers/asImageSrc.cjs +0 -13
  165. package/dist/helpers/asImageSrc.cjs.map +0 -1
  166. package/dist/helpers/asImageSrc.d.ts +0 -28
  167. package/dist/helpers/asImageSrc.js +0 -13
  168. package/dist/helpers/asImageSrc.js.map +0 -1
  169. package/dist/helpers/asImageWidthSrcSet.cjs +0 -45
  170. package/dist/helpers/asImageWidthSrcSet.cjs.map +0 -1
  171. package/dist/helpers/asImageWidthSrcSet.d.ts +0 -61
  172. package/dist/helpers/asImageWidthSrcSet.js +0 -45
  173. package/dist/helpers/asImageWidthSrcSet.js.map +0 -1
  174. package/dist/helpers/asLink.cjs +0 -47
  175. package/dist/helpers/asLink.cjs.map +0 -1
  176. package/dist/helpers/asLink.d.ts +0 -77
  177. package/dist/helpers/asLink.js +0 -47
  178. package/dist/helpers/asLink.js.map +0 -1
  179. package/dist/helpers/asLinkAttrs.cjs +0 -28
  180. package/dist/helpers/asLinkAttrs.cjs.map +0 -1
  181. package/dist/helpers/asLinkAttrs.d.ts +0 -50
  182. package/dist/helpers/asLinkAttrs.js +0 -28
  183. package/dist/helpers/asLinkAttrs.js.map +0 -1
  184. package/dist/helpers/asText.cjs +0 -21
  185. package/dist/helpers/asText.cjs.map +0 -1
  186. package/dist/helpers/asText.d.ts +0 -47
  187. package/dist/helpers/asText.js +0 -21
  188. package/dist/helpers/asText.js.map +0 -1
  189. package/dist/helpers/documentToLinkField.cjs +0 -27
  190. package/dist/helpers/documentToLinkField.cjs.map +0 -1
  191. package/dist/helpers/documentToLinkField.d.ts +0 -17
  192. package/dist/helpers/documentToLinkField.js +0 -27
  193. package/dist/helpers/documentToLinkField.js.map +0 -1
  194. package/dist/helpers/isFilled.cjs +0 -77
  195. package/dist/helpers/isFilled.cjs.map +0 -1
  196. package/dist/helpers/isFilled.d.ts +0 -190
  197. package/dist/helpers/isFilled.js +0 -77
  198. package/dist/helpers/isFilled.js.map +0 -1
  199. package/dist/helpers/mapSliceZone.cjs +0 -42
  200. package/dist/helpers/mapSliceZone.cjs.map +0 -1
  201. package/dist/helpers/mapSliceZone.d.ts +0 -136
  202. package/dist/helpers/mapSliceZone.js +0 -42
  203. package/dist/helpers/mapSliceZone.js.map +0 -1
  204. package/dist/index.js +0 -97
  205. package/dist/index.js.map +0 -1
  206. package/dist/isRepositoryEndpoint.cjs +0 -12
  207. package/dist/isRepositoryEndpoint.cjs.map +0 -1
  208. package/dist/isRepositoryEndpoint.d.ts +0 -10
  209. package/dist/isRepositoryEndpoint.js +0 -12
  210. package/dist/isRepositoryEndpoint.js.map +0 -1
  211. package/dist/isRepositoryName.cjs +0 -7
  212. package/dist/isRepositoryName.cjs.map +0 -1
  213. package/dist/isRepositoryName.d.ts +0 -9
  214. package/dist/isRepositoryName.js +0 -7
  215. package/dist/isRepositoryName.js.map +0 -1
  216. package/dist/lib/appendFilters.cjs +0 -11
  217. package/dist/lib/appendFilters.cjs.map +0 -1
  218. package/dist/lib/appendFilters.d.ts +0 -18
  219. package/dist/lib/appendFilters.js +0 -11
  220. package/dist/lib/appendFilters.js.map +0 -1
  221. package/dist/lib/castArray.cjs +0 -7
  222. package/dist/lib/castArray.cjs.map +0 -1
  223. package/dist/lib/castArray.d.ts +0 -12
  224. package/dist/lib/castArray.js +0 -7
  225. package/dist/lib/castArray.js.map +0 -1
  226. package/dist/lib/castThunk.cjs +0 -7
  227. package/dist/lib/castThunk.cjs.map +0 -1
  228. package/dist/lib/castThunk.d.ts +0 -11
  229. package/dist/lib/castThunk.js +0 -7
  230. package/dist/lib/castThunk.js.map +0 -1
  231. package/dist/lib/devMsg.cjs +0 -8
  232. package/dist/lib/devMsg.cjs.map +0 -1
  233. package/dist/lib/devMsg.d.ts +0 -16
  234. package/dist/lib/devMsg.js +0 -8
  235. package/dist/lib/devMsg.js.map +0 -1
  236. package/dist/lib/escapeHTML.cjs +0 -43
  237. package/dist/lib/escapeHTML.cjs.map +0 -1
  238. package/dist/lib/escapeHTML.d.ts +0 -1
  239. package/dist/lib/escapeHTML.js +0 -43
  240. package/dist/lib/escapeHTML.js.map +0 -1
  241. package/dist/lib/everyTagFilter.cjs +0 -9
  242. package/dist/lib/everyTagFilter.cjs.map +0 -1
  243. package/dist/lib/everyTagFilter.d.ts +0 -9
  244. package/dist/lib/everyTagFilter.js +0 -9
  245. package/dist/lib/everyTagFilter.js.map +0 -1
  246. package/dist/lib/findMasterRef.cjs +0 -8
  247. package/dist/lib/findMasterRef.cjs.map +0 -1
  248. package/dist/lib/findMasterRef.d.ts +0 -11
  249. package/dist/lib/findMasterRef.js +0 -8
  250. package/dist/lib/findMasterRef.js.map +0 -1
  251. package/dist/lib/findRef.cjs +0 -12
  252. package/dist/lib/findRef.cjs.map +0 -1
  253. package/dist/lib/findRef.d.ts +0 -14
  254. package/dist/lib/findRef.js +0 -12
  255. package/dist/lib/findRef.js.map +0 -1
  256. package/dist/lib/findRefByID.cjs +0 -8
  257. package/dist/lib/findRefByID.cjs.map +0 -1
  258. package/dist/lib/findRefByID.d.ts +0 -12
  259. package/dist/lib/findRefByID.js +0 -8
  260. package/dist/lib/findRefByID.js.map +0 -1
  261. package/dist/lib/findRefByLabel.cjs +0 -8
  262. package/dist/lib/findRefByLabel.cjs.map +0 -1
  263. package/dist/lib/findRefByLabel.d.ts +0 -12
  264. package/dist/lib/findRefByLabel.js +0 -8
  265. package/dist/lib/findRefByLabel.js.map +0 -1
  266. package/dist/lib/getOptionalLinkProperties.cjs +0 -14
  267. package/dist/lib/getOptionalLinkProperties.cjs.map +0 -1
  268. package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
  269. package/dist/lib/getOptionalLinkProperties.js +0 -14
  270. package/dist/lib/getOptionalLinkProperties.js.map +0 -1
  271. package/dist/lib/getPreviewCookie.cjs +0 -21
  272. package/dist/lib/getPreviewCookie.cjs.map +0 -1
  273. package/dist/lib/getPreviewCookie.d.ts +0 -9
  274. package/dist/lib/getPreviewCookie.js +0 -21
  275. package/dist/lib/getPreviewCookie.js.map +0 -1
  276. package/dist/lib/isInternalURL.cjs +0 -9
  277. package/dist/lib/isInternalURL.cjs.map +0 -1
  278. package/dist/lib/isInternalURL.d.ts +0 -8
  279. package/dist/lib/isInternalURL.js +0 -9
  280. package/dist/lib/isInternalURL.js.map +0 -1
  281. package/dist/lib/isMigrationValue.cjs +0 -24
  282. package/dist/lib/isMigrationValue.cjs.map +0 -1
  283. package/dist/lib/isMigrationValue.d.ts +0 -71
  284. package/dist/lib/isMigrationValue.js +0 -24
  285. package/dist/lib/isMigrationValue.js.map +0 -1
  286. package/dist/lib/isValue.cjs +0 -53
  287. package/dist/lib/isValue.cjs.map +0 -1
  288. package/dist/lib/isValue.d.ts +0 -78
  289. package/dist/lib/isValue.js +0 -53
  290. package/dist/lib/isValue.js.map +0 -1
  291. package/dist/lib/minifyGraphQLQuery.cjs +0 -7
  292. package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
  293. package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
  294. package/dist/lib/minifyGraphQLQuery.js +0 -7
  295. package/dist/lib/minifyGraphQLQuery.js.map +0 -1
  296. package/dist/lib/pLimit.cjs +0 -49
  297. package/dist/lib/pLimit.cjs.map +0 -1
  298. package/dist/lib/pLimit.d.ts +0 -22
  299. package/dist/lib/pLimit.js +0 -49
  300. package/dist/lib/pLimit.js.map +0 -1
  301. package/dist/lib/request.cjs +0 -43
  302. package/dist/lib/request.cjs.map +0 -1
  303. package/dist/lib/request.d.ts +0 -73
  304. package/dist/lib/request.js +0 -43
  305. package/dist/lib/request.js.map +0 -1
  306. package/dist/lib/resolveMigrationDocumentData.cjs +0 -134
  307. package/dist/lib/resolveMigrationDocumentData.cjs.map +0 -1
  308. package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
  309. package/dist/lib/resolveMigrationDocumentData.js +0 -134
  310. package/dist/lib/resolveMigrationDocumentData.js.map +0 -1
  311. package/dist/lib/serializerHelpers.cjs +0 -113
  312. package/dist/lib/serializerHelpers.cjs.map +0 -1
  313. package/dist/lib/serializerHelpers.d.ts +0 -9
  314. package/dist/lib/serializerHelpers.js +0 -113
  315. package/dist/lib/serializerHelpers.js.map +0 -1
  316. package/dist/lib/someTagsFilter.cjs +0 -9
  317. package/dist/lib/someTagsFilter.cjs.map +0 -1
  318. package/dist/lib/someTagsFilter.d.ts +0 -9
  319. package/dist/lib/someTagsFilter.js +0 -9
  320. package/dist/lib/someTagsFilter.js.map +0 -1
  321. package/dist/lib/throttledLog.cjs +0 -17
  322. package/dist/lib/throttledLog.cjs.map +0 -1
  323. package/dist/lib/throttledLog.d.ts +0 -15
  324. package/dist/lib/throttledLog.js +0 -17
  325. package/dist/lib/throttledLog.js.map +0 -1
  326. package/dist/lib/typeFilter.cjs +0 -8
  327. package/dist/lib/typeFilter.cjs.map +0 -1
  328. package/dist/lib/typeFilter.d.ts +0 -8
  329. package/dist/lib/typeFilter.js +0 -8
  330. package/dist/lib/typeFilter.js.map +0 -1
  331. package/dist/lib/validateAssetMetadata.cjs +0 -28
  332. package/dist/lib/validateAssetMetadata.cjs.map +0 -1
  333. package/dist/lib/validateAssetMetadata.d.ts +0 -10
  334. package/dist/lib/validateAssetMetadata.js +0 -28
  335. package/dist/lib/validateAssetMetadata.js.map +0 -1
  336. package/dist/package.json.cjs +0 -7
  337. package/dist/package.json.cjs.map +0 -1
  338. package/dist/package.json.js +0 -7
  339. package/dist/package.json.js.map +0 -1
  340. package/dist/richtext/asText.cjs +0 -13
  341. package/dist/richtext/asText.cjs.map +0 -1
  342. package/dist/richtext/asText.d.ts +0 -12
  343. package/dist/richtext/asText.js +0 -13
  344. package/dist/richtext/asText.js.map +0 -1
  345. package/dist/richtext/asTree.cjs +0 -123
  346. package/dist/richtext/asTree.cjs.map +0 -1
  347. package/dist/richtext/asTree.d.ts +0 -14
  348. package/dist/richtext/asTree.js +0 -123
  349. package/dist/richtext/asTree.js.map +0 -1
  350. package/dist/richtext/composeSerializers.cjs +0 -17
  351. package/dist/richtext/composeSerializers.cjs.map +0 -1
  352. package/dist/richtext/composeSerializers.d.ts +0 -16
  353. package/dist/richtext/composeSerializers.js +0 -17
  354. package/dist/richtext/composeSerializers.js.map +0 -1
  355. package/dist/richtext/serialize.cjs +0 -19
  356. package/dist/richtext/serialize.cjs.map +0 -1
  357. package/dist/richtext/serialize.d.ts +0 -19
  358. package/dist/richtext/serialize.js +0 -19
  359. package/dist/richtext/serialize.js.map +0 -1
  360. package/dist/richtext/types.cjs +0 -11
  361. package/dist/richtext/types.cjs.map +0 -1
  362. package/dist/richtext/types.d.ts +0 -71
  363. package/dist/richtext/types.js +0 -11
  364. package/dist/richtext/types.js.map +0 -1
  365. package/dist/richtext/wrapMapSerializer.cjs +0 -24
  366. package/dist/richtext/wrapMapSerializer.cjs.map +0 -1
  367. package/dist/richtext/wrapMapSerializer.d.ts +0 -15
  368. package/dist/richtext/wrapMapSerializer.js +0 -24
  369. package/dist/richtext/wrapMapSerializer.js.map +0 -1
  370. package/dist/richtext.cjs +0 -15
  371. package/dist/richtext.cjs.map +0 -1
  372. package/dist/richtext.js +0 -15
  373. package/dist/richtext.js.map +0 -1
  374. package/dist/types/api/asset/asset.d.ts +0 -177
  375. package/dist/types/api/asset/tag.d.ts +0 -53
  376. package/dist/types/api/integration.d.ts +0 -28
  377. package/dist/types/api/migration/document.d.ts +0 -60
  378. package/dist/types/api/query.d.ts +0 -43
  379. package/dist/types/api/ref.d.ts +0 -32
  380. package/dist/types/api/release.d.ts +0 -11
  381. package/dist/types/api/repository.d.ts +0 -109
  382. package/dist/types/api/tags.d.ts +0 -9
  383. package/dist/types/migration/Asset.cjs +0 -33
  384. package/dist/types/migration/Asset.cjs.map +0 -1
  385. package/dist/types/migration/Asset.d.ts +0 -108
  386. package/dist/types/migration/Asset.js +0 -33
  387. package/dist/types/migration/Asset.js.map +0 -1
  388. package/dist/types/migration/ContentRelationship.d.ts +0 -16
  389. package/dist/types/migration/Document.cjs +0 -47
  390. package/dist/types/migration/Document.cjs.map +0 -1
  391. package/dist/types/migration/Document.d.ts +0 -94
  392. package/dist/types/migration/Document.js +0 -47
  393. package/dist/types/migration/Document.js.map +0 -1
  394. package/dist/types/migration/Link.d.ts +0 -19
  395. package/dist/types/model/boolean.d.ts +0 -15
  396. package/dist/types/model/color.d.ts +0 -13
  397. package/dist/types/model/contentRelationship.d.ts +0 -52
  398. package/dist/types/model/customType.d.ts +0 -48
  399. package/dist/types/model/date.d.ts +0 -14
  400. package/dist/types/model/embed.d.ts +0 -13
  401. package/dist/types/model/geoPoint.d.ts +0 -12
  402. package/dist/types/model/group.d.ts +0 -23
  403. package/dist/types/model/image.d.ts +0 -31
  404. package/dist/types/model/integration.d.ts +0 -14
  405. package/dist/types/model/keyText.d.ts +0 -13
  406. package/dist/types/model/link.cjs +0 -9
  407. package/dist/types/model/link.cjs.map +0 -1
  408. package/dist/types/model/link.d.ts +0 -28
  409. package/dist/types/model/link.js +0 -9
  410. package/dist/types/model/link.js.map +0 -1
  411. package/dist/types/model/linkToMedia.d.ts +0 -17
  412. package/dist/types/model/number.d.ts +0 -15
  413. package/dist/types/model/range.d.ts +0 -14
  414. package/dist/types/model/richText.d.ts +0 -37
  415. package/dist/types/model/select.d.ts +0 -18
  416. package/dist/types/model/separator.d.ts +0 -10
  417. package/dist/types/model/sharedSlice.d.ts +0 -16
  418. package/dist/types/model/sharedSliceVariation.d.ts +0 -19
  419. package/dist/types/model/slice.cjs +0 -8
  420. package/dist/types/model/slice.cjs.map +0 -1
  421. package/dist/types/model/slice.d.ts +0 -33
  422. package/dist/types/model/slice.js +0 -8
  423. package/dist/types/model/slice.js.map +0 -1
  424. package/dist/types/model/sliceZone.cjs +0 -8
  425. package/dist/types/model/sliceZone.cjs.map +0 -1
  426. package/dist/types/model/sliceZone.d.ts +0 -41
  427. package/dist/types/model/sliceZone.js +0 -8
  428. package/dist/types/model/sliceZone.js.map +0 -1
  429. package/dist/types/model/table.d.ts +0 -12
  430. package/dist/types/model/timestamp.d.ts +0 -14
  431. package/dist/types/model/title.d.ts +0 -7
  432. package/dist/types/model/types.cjs +0 -39
  433. package/dist/types/model/types.cjs.map +0 -1
  434. package/dist/types/model/types.d.ts +0 -77
  435. package/dist/types/model/types.js +0 -39
  436. package/dist/types/model/types.js.map +0 -1
  437. package/dist/types/model/uid.d.ts +0 -13
  438. package/dist/types/value/boolean.d.ts +0 -6
  439. package/dist/types/value/color.d.ts +0 -9
  440. package/dist/types/value/contentRelationship.d.ts +0 -31
  441. package/dist/types/value/date.d.ts +0 -9
  442. package/dist/types/value/document.d.ts +0 -114
  443. package/dist/types/value/embed.cjs +0 -10
  444. package/dist/types/value/embed.cjs.map +0 -1
  445. package/dist/types/value/embed.d.ts +0 -168
  446. package/dist/types/value/embed.js +0 -10
  447. package/dist/types/value/embed.js.map +0 -1
  448. package/dist/types/value/geoPoint.d.ts +0 -12
  449. package/dist/types/value/group.d.ts +0 -13
  450. package/dist/types/value/image.d.ts +0 -47
  451. package/dist/types/value/integration.d.ts +0 -16
  452. package/dist/types/value/keyText.d.ts +0 -9
  453. package/dist/types/value/link.cjs +0 -10
  454. package/dist/types/value/link.cjs.map +0 -1
  455. package/dist/types/value/link.d.ts +0 -68
  456. package/dist/types/value/link.js +0 -10
  457. package/dist/types/value/link.js.map +0 -1
  458. package/dist/types/value/linkToMedia.d.ts +0 -28
  459. package/dist/types/value/number.d.ts +0 -9
  460. package/dist/types/value/richText.cjs +0 -25
  461. package/dist/types/value/richText.cjs.map +0 -1
  462. package/dist/types/value/richText.d.ts +0 -215
  463. package/dist/types/value/richText.js +0 -25
  464. package/dist/types/value/richText.js.map +0 -1
  465. package/dist/types/value/select.d.ts +0 -10
  466. package/dist/types/value/sharedSlice.d.ts +0 -11
  467. package/dist/types/value/sharedSliceVariation.d.ts +0 -10
  468. package/dist/types/value/slice.d.ts +0 -13
  469. package/dist/types/value/sliceZone.d.ts +0 -12
  470. package/dist/types/value/table.d.ts +0 -91
  471. package/dist/types/value/timestamp.d.ts +0 -8
  472. package/dist/types/value/title.d.ts +0 -12
  473. package/dist/types/value/types.d.ts +0 -58
  474. package/dist/types/webhook/apiUpdate.d.ts +0 -52
  475. package/dist/types/webhook/testTrigger.d.ts +0 -9
  476. package/dist/types/webhook/types.cjs +0 -8
  477. package/dist/types/webhook/types.cjs.map +0 -1
  478. package/dist/types/webhook/types.d.ts +0 -18
  479. package/dist/types/webhook/types.js +0 -8
  480. package/dist/types/webhook/types.js.map +0 -1
@@ -1,9 +0,0 @@
1
- const isInternalURL = (url) => {
2
- const isInternal = /^(\/(?!\/)|#)/.test(url);
3
- const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
4
- return isInternal && !isSpecialLink;
5
- };
6
- export {
7
- isInternalURL
8
- };
9
- //# sourceMappingURL=isInternalURL.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isInternalURL.js","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"],"names":[],"mappings":"AAQa,MAAA,gBAAgB,CAAC,QAAwB;AAC/C,QAAA,aAAa,gBAAgB,KAAK,GAAG;AAC3C,QAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,GAAG;AAE7D,SAAO,cAAc,CAAC;AACvB;"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const Asset = require("../types/migration/Asset.cjs");
4
- const Document = require("../types/migration/Document.cjs");
5
- const link = require("../types/value/link.cjs");
6
- const richText = require("../types/value/richText.cjs");
7
- const isValue = require("./isValue.cjs");
8
- const contentRelationship = (value) => {
9
- return value instanceof Document.PrismicMigrationDocument || isValue.prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === link.LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
10
- };
11
- const image = (value) => {
12
- return value instanceof Asset.PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof Asset.PrismicMigrationAsset);
13
- };
14
- const linkToMedia = (value) => {
15
- return typeof value === "object" && value !== null && "id" in value && value.id instanceof Asset.PrismicMigrationAsset && "link_type" in value && value.link_type === link.LinkType.Media;
16
- };
17
- const rtImageNode = (value) => {
18
- return typeof value === "object" && value !== null && "id" in value && value.id instanceof Asset.PrismicMigrationAsset && "type" in value && value.type === richText.RichTextNodeType.image;
19
- };
20
- exports.contentRelationship = contentRelationship;
21
- exports.image = image;
22
- exports.linkToMedia = linkToMedia;
23
- exports.rtImageNode = rtImageNode;
24
- //# sourceMappingURL=isMigrationValue.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isMigrationValue.cjs","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"],"names":["PrismicMigrationDocument","is.prismicDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"mappings":";;;;;;;AA+Ca,MAAA,sBAAsB,CAClC,UACmE;AAElE,SAAA,iBAAiBA,SAAAA,4BACjBC,QAAmB,gBAAA,KAAK,KACvB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,cAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,EAAE,KAAK,OAAO,MAAM,OAAO;AAEzD;AAYa,MAAA,QAAQ,CAAC,UAAgD;AACrE,SACC,iBAAiBC,MAAAA,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,EAAE,MACpB,CAAC,mBAAmB,0BAA0BA,2BAAqB;AAGvE;AAiBa,MAAA,cAAc,CAC1B,UAC2D;AAC3D,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,MAAAA,yBACpB,eAAe,SACf,MAAM,cAAcD,KAAAA,SAAS;AAE/B;AAaa,MAAA,cAAc,CAC1B,UACkC;AAClC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,MAAAA,yBACpB,UAAU,SACV,MAAM,SAASC,SAAAA,iBAAiB;AAElC;;;;;"}
@@ -1,71 +0,0 @@
1
- import type { MigrationImage, MigrationLinkToMedia, MigrationRTImageNode } from "../types/migration/Asset";
2
- import type { MigrationContentRelationship } from "../types/migration/ContentRelationship";
3
- import { type InjectMigrationSpecificTypes } from "../types/migration/Document";
4
- import type { PrismicDocument } from "../types/value/document";
5
- import type { GroupField } from "../types/value/group";
6
- import type { OptionalLinkProperties } from "../types/value/link";
7
- import type { SliceZone } from "../types/value/sliceZone";
8
- import type { AnyRegularField } from "../types/value/types";
9
- /**
10
- * Unknown value to check if it's a specific field type.
11
- *
12
- * @remarks
13
- * Explicit types are added to help ensure narrowing is done effectively.
14
- */
15
- type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown;
16
- /**
17
- * Checks if a value is a migration content relationship field.
18
- *
19
- * @remarks
20
- * `OptionalLinkProperties` is included because `MigrationContentRelationship`
21
- * may be a link field, not strictly a content relationship field.
22
- *
23
- * @param value - Value to check.
24
- *
25
- * @returns `true` if `value` is a migration content relationship field, `false`
26
- * otherwise.
27
- *
28
- * @internal
29
- * This is not an official helper function and it's only designed to work with internal processes.
30
- */
31
- export declare const contentRelationship: (value: UnknownValue) => value is MigrationContentRelationship & OptionalLinkProperties;
32
- /**
33
- * Checks if a value is a migration image field.
34
- *
35
- * @param value - Value to check.
36
- *
37
- * @returns `true` if `value` is a migration image field, `false` otherwise.
38
- *
39
- * @internal
40
- * This is not an official helper function and it's only designed to work with internal processes.
41
- */
42
- export declare const image: (value: UnknownValue) => value is MigrationImage;
43
- /**
44
- * Checks if a value is a migration link to media field.
45
- *
46
- * - @remarks `OptionalLinkProperties` is included because
47
- * `MigrationContentRelationship` may be a link field, not strictly a content
48
- * relationship field.
49
- *
50
- * @param value - Value to check.
51
- *
52
- * @returns `true` if `value` is a migration link to media field, `false`
53
- * otherwise.
54
- *
55
- * @internal
56
- * This is not an official helper function and it's only designed to work with internal processes.
57
- */
58
- export declare const linkToMedia: (value: UnknownValue) => value is MigrationLinkToMedia & OptionalLinkProperties;
59
- /**
60
- * Checks if a value is a migration rich text image node.
61
- *
62
- * @param value - Value to check.
63
- *
64
- * @returns `true` if `value` is a migration rich text image node, `false`
65
- * otherwise.
66
- *
67
- * @internal
68
- * This is not an official helper function and it's only designed to work with internal processes.
69
- */
70
- export declare const rtImageNode: (value: UnknownValue) => value is MigrationRTImageNode;
71
- export {};
@@ -1,24 +0,0 @@
1
- import { PrismicMigrationAsset } from "../types/migration/Asset.js";
2
- import { PrismicMigrationDocument } from "../types/migration/Document.js";
3
- import { LinkType } from "../types/value/link.js";
4
- import { RichTextNodeType } from "../types/value/richText.js";
5
- import { prismicDocument } from "./isValue.js";
6
- const contentRelationship = (value) => {
7
- return value instanceof PrismicMigrationDocument || prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
8
- };
9
- const image = (value) => {
10
- return value instanceof PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset);
11
- };
12
- const linkToMedia = (value) => {
13
- return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "link_type" in value && value.link_type === LinkType.Media;
14
- };
15
- const rtImageNode = (value) => {
16
- return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "type" in value && value.type === RichTextNodeType.image;
17
- };
18
- export {
19
- contentRelationship,
20
- image,
21
- linkToMedia,
22
- rtImageNode
23
- };
24
- //# sourceMappingURL=isMigrationValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isMigrationValue.js","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"],"names":["is.prismicDocument"],"mappings":";;;;;AA+Ca,MAAA,sBAAsB,CAClC,UACmE;AAElE,SAAA,iBAAiB,4BACjBA,gBAAmB,KAAK,KACvB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,EAAE,KAAK,OAAO,MAAM,OAAO;AAEzD;AAYa,MAAA,QAAQ,CAAC,UAAgD;AACrE,SACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,EAAE,MACpB,CAAC,mBAAmB,0BAA0B,qBAAqB;AAGvE;AAiBa,MAAA,cAAc,CAC1B,UAC2D;AAC3D,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;AAE/B;AAaa,MAAA,cAAc,CAC1B,UACkC;AAClC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB;AAElC;"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const link = require("../types/value/link.cjs");
4
- const richText = require("../types/value/richText.cjs");
5
- const filledLinkToMedia = (value) => {
6
- if (value && typeof value === "object" && !("version" in value)) {
7
- if ("link_type" in value && value.link_type === link.LinkType.Media && "id" in value && "name" in value && "kind" in value && "url" in value && "size" in value) {
8
- return true;
9
- }
10
- }
11
- return false;
12
- };
13
- const imageLike = (value) => {
14
- if (value && typeof value === "object" && (!("version" in value) || typeof value.version === "object")) {
15
- if ("id" in value && "url" in value && typeof value.url === "string" && "dimensions" in value && "edit" in value && "alt" in value && "copyright" in value) {
16
- return true;
17
- }
18
- }
19
- return false;
20
- };
21
- const filledImage = (value) => {
22
- if (imageLike(value) && (!("type" in value) || value.type !== richText.RichTextNodeType.image)) {
23
- return true;
24
- }
25
- return false;
26
- };
27
- const rtImageNode = (value) => {
28
- if (imageLike(value) && "type" in value && value.type === richText.RichTextNodeType.image) {
29
- return true;
30
- }
31
- return false;
32
- };
33
- const filledContentRelationship = (value) => {
34
- if (value && typeof value === "object" && !("version" in value)) {
35
- if ("link_type" in value && value.link_type === link.LinkType.Document && "id" in value && "type" in value && "tags" in value && "lang" in value) {
36
- return true;
37
- }
38
- }
39
- return false;
40
- };
41
- const prismicDocument = (value) => {
42
- try {
43
- return typeof value === "object" && value !== null && "id" in value && "href" in value && typeof value.href === "string" && new URL(value.href) && "type" in value && "lang" in value && "tags" in value && Array.isArray(value.tags);
44
- } catch {
45
- return false;
46
- }
47
- };
48
- exports.filledContentRelationship = filledContentRelationship;
49
- exports.filledImage = filledImage;
50
- exports.filledLinkToMedia = filledLinkToMedia;
51
- exports.prismicDocument = prismicDocument;
52
- exports.rtImageNode = rtImageNode;
53
- //# sourceMappingURL=isValue.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValue.cjs","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\tvalue\n\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\tvalue\n\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\tvalue\n\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"],"names":["LinkType","RichTextNodeType"],"mappings":";;;;AAiCa,MAAA,oBAAoB,CAChC,UACoC;AACpC,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAcA,cAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,OACT;AAGM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYA,MAAM,YAAY,CACjB,UACwD;AAEvD,MAAA,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAClD;AACD,QACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,OACd;AACM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYa,MAAA,cAAc,CAC1B,UAC0C;AAEzC,MAAA,UAAU,KAAK,MACd,EAAE,UAAU,UAAU,MAAM,SAASC,0BAAiB,QACtD;AAGM,WAAA;AAAA,EAAA;AAGD,SAAA;AACR;AAYa,MAAA,cAAc,CAAC,UAA6C;AAEvE,MAAA,UAAU,KAAK,KACf,UAAU,SACV,MAAM,SAASA,0BAAiB,OAC/B;AAGM,WAAA;AAAA,EAAA;AAGD,SAAA;AACR;AAiBa,MAAA,4BAA4B,CACxC,UACqE;AACrE,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAcD,KAAAA,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,OACT;AACM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYa,MAAA,kBAAkB,CAC9B,UAC6B;AACzB,MAAA;AAEF,WAAA,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,IAAI,KAClB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,IAAI;AAAA,EAAA,QAElB;AACA,WAAA;AAAA,EAAA;AAET;;;;;;"}
@@ -1,78 +0,0 @@
1
- import type { InjectMigrationSpecificTypes } from "../types/migration/Document";
2
- import type { FilledContentRelationshipField } from "../types/value/contentRelationship";
3
- import type { PrismicDocument } from "../types/value/document";
4
- import type { GroupField } from "../types/value/group";
5
- import type { ImageField } from "../types/value/image";
6
- import type { OptionalLinkProperties } from "../types/value/link";
7
- import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
8
- import { type RTImageNode } from "../types/value/richText";
9
- import type { SliceZone } from "../types/value/sliceZone";
10
- import type { AnyRegularField } from "../types/value/types";
11
- /**
12
- * Unknown value to check if it's a specific field type.
13
- *
14
- * @remarks
15
- * Explicit types are added to help ensure narrowing is done effectively.
16
- */
17
- type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown;
18
- /**
19
- * Checks if a value is a link to media field.
20
- *
21
- * @param value - Value to check.
22
- *
23
- * @returns `true` if `value` is a link to media field, `false` otherwise.
24
- *
25
- * @internal
26
- * This is not an official helper function and it's only designed to work with internal processes.
27
- */
28
- export declare const filledLinkToMedia: (value: UnknownValue) => value is FilledLinkToMediaField;
29
- /**
30
- * Checks if a value is an image field.
31
- *
32
- * @param value - Value to check.
33
- *
34
- * @returns `true` if `value` is an image field, `false` otherwise.
35
- *
36
- * @internal
37
- * This is not an official helper function and it's only designed to work with internal processes.
38
- */
39
- export declare const filledImage: (value: UnknownValue) => value is ImageField<string, "filled">;
40
- /**
41
- * Checks if a value is a rich text image node.
42
- *
43
- * @param value - Value to check.
44
- *
45
- * @returns `true` if `value` is a rich text image node, `false` otherwise.
46
- *
47
- * @internal
48
- * This is not an official helper function and it's only designed to work with internal processes.
49
- */
50
- export declare const rtImageNode: (value: UnknownValue) => value is RTImageNode;
51
- /**
52
- * Checks if a value is a content relationship field.
53
- *
54
- * @remarks
55
- * The return value includes `OptionalLinkProperties` because
56
- * `FilledContentRelationshipField` may be a link field, not strictly a content
57
- * relationship field.
58
- *
59
- * @param value - Value to check.
60
- *
61
- * @returns `true` if `value` is a content relationship, `false` otherwise.
62
- *
63
- * @internal
64
- * This is not an official helper function and it's only designed to work with internal processes.
65
- */
66
- export declare const filledContentRelationship: (value: UnknownValue) => value is FilledContentRelationshipField & OptionalLinkProperties;
67
- /**
68
- * Checks if a value is a Prismic document.
69
- *
70
- * @param value - Value to check.
71
- *
72
- * @returns `true` if `value` is a Prismic document, `false` otherwise.
73
- *
74
- * @internal
75
- * This is not an official helper function and it's only designed to work with internal processes.
76
- */
77
- export declare const prismicDocument: (value: UnknownValue) => value is PrismicDocument;
78
- export {};
@@ -1,53 +0,0 @@
1
- import { LinkType } from "../types/value/link.js";
2
- import { RichTextNodeType } from "../types/value/richText.js";
3
- const filledLinkToMedia = (value) => {
4
- if (value && typeof value === "object" && !("version" in value)) {
5
- if ("link_type" in value && value.link_type === LinkType.Media && "id" in value && "name" in value && "kind" in value && "url" in value && "size" in value) {
6
- return true;
7
- }
8
- }
9
- return false;
10
- };
11
- const imageLike = (value) => {
12
- if (value && typeof value === "object" && (!("version" in value) || typeof value.version === "object")) {
13
- if ("id" in value && "url" in value && typeof value.url === "string" && "dimensions" in value && "edit" in value && "alt" in value && "copyright" in value) {
14
- return true;
15
- }
16
- }
17
- return false;
18
- };
19
- const filledImage = (value) => {
20
- if (imageLike(value) && (!("type" in value) || value.type !== RichTextNodeType.image)) {
21
- return true;
22
- }
23
- return false;
24
- };
25
- const rtImageNode = (value) => {
26
- if (imageLike(value) && "type" in value && value.type === RichTextNodeType.image) {
27
- return true;
28
- }
29
- return false;
30
- };
31
- const filledContentRelationship = (value) => {
32
- if (value && typeof value === "object" && !("version" in value)) {
33
- if ("link_type" in value && value.link_type === LinkType.Document && "id" in value && "type" in value && "tags" in value && "lang" in value) {
34
- return true;
35
- }
36
- }
37
- return false;
38
- };
39
- const prismicDocument = (value) => {
40
- try {
41
- return typeof value === "object" && value !== null && "id" in value && "href" in value && typeof value.href === "string" && new URL(value.href) && "type" in value && "lang" in value && "tags" in value && Array.isArray(value.tags);
42
- } catch {
43
- return false;
44
- }
45
- };
46
- export {
47
- filledContentRelationship,
48
- filledImage,
49
- filledLinkToMedia,
50
- prismicDocument,
51
- rtImageNode
52
- };
53
- //# sourceMappingURL=isValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValue.js","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\tvalue\n\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\tvalue\n\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\tvalue\n\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"],"names":[],"mappings":";;AAiCa,MAAA,oBAAoB,CAChC,UACoC;AACpC,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAc,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,OACT;AAGM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYA,MAAM,YAAY,CACjB,UACwD;AAEvD,MAAA,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAClD;AACD,QACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,OACd;AACM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYa,MAAA,cAAc,CAC1B,UAC0C;AAEzC,MAAA,UAAU,KAAK,MACd,EAAE,UAAU,UAAU,MAAM,SAAS,iBAAiB,QACtD;AAGM,WAAA;AAAA,EAAA;AAGD,SAAA;AACR;AAYa,MAAA,cAAc,CAAC,UAA6C;AAEvE,MAAA,UAAU,KAAK,KACf,UAAU,SACV,MAAM,SAAS,iBAAiB,OAC/B;AAGM,WAAA;AAAA,EAAA;AAGD,SAAA;AACR;AAiBa,MAAA,4BAA4B,CACxC,UACqE;AACrE,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,OACT;AACM,aAAA;AAAA,IAAA;AAAA,EACR;AAGM,SAAA;AACR;AAYa,MAAA,kBAAkB,CAC9B,UAC6B;AACzB,MAAA;AAEF,WAAA,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,IAAI,KAClB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,IAAI;AAAA,EAAA,QAElB;AACA,WAAA;AAAA,EAAA;AAET;"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const minifyGraphQLQuery = (query) => {
4
- return query.replace(/(\n| )*( |{|})(\n| )*/gm, (_chars, _spaces, brackets) => brackets);
5
- };
6
- exports.minifyGraphQLQuery = minifyGraphQLQuery;
7
- //# sourceMappingURL=minifyGraphQLQuery.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"minifyGraphQLQuery.cjs","sources":["../../../src/lib/minifyGraphQLQuery.ts"],"sourcesContent":["/**\n * Minifies a GraphQL query by removing whitespace where possible.\n *\n * @param query - GraphQL query to minify.\n *\n * @returns A minified version of `query`.\n */\nexport const minifyGraphQLQuery = (query: string): string => {\n\treturn query.replace(\n\t\t/(\\n| )*( |{|})(\\n| )*/gm,\n\t\t(_chars, _spaces, brackets) => brackets,\n\t)\n}\n"],"names":[],"mappings":";;AAOa,MAAA,qBAAqB,CAAC,UAAyB;AAC3D,SAAO,MAAM,QACZ,2BACA,CAAC,QAAQ,SAAS,aAAa,QAAQ;AAEzC;;"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Minifies a GraphQL query by removing whitespace where possible.
3
- *
4
- * @param query - GraphQL query to minify.
5
- *
6
- * @returns A minified version of `query`.
7
- */
8
- export declare const minifyGraphQLQuery: (query: string) => string;
@@ -1,7 +0,0 @@
1
- const minifyGraphQLQuery = (query) => {
2
- return query.replace(/(\n| )*( |{|})(\n| )*/gm, (_chars, _spaces, brackets) => brackets);
3
- };
4
- export {
5
- minifyGraphQLQuery
6
- };
7
- //# sourceMappingURL=minifyGraphQLQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"minifyGraphQLQuery.js","sources":["../../../src/lib/minifyGraphQLQuery.ts"],"sourcesContent":["/**\n * Minifies a GraphQL query by removing whitespace where possible.\n *\n * @param query - GraphQL query to minify.\n *\n * @returns A minified version of `query`.\n */\nexport const minifyGraphQLQuery = (query: string): string => {\n\treturn query.replace(\n\t\t/(\\n| )*( |{|})(\\n| )*/gm,\n\t\t(_chars, _spaces, brackets) => brackets,\n\t)\n}\n"],"names":[],"mappings":"AAOa,MAAA,qBAAqB,CAAC,UAAyB;AAC3D,SAAO,MAAM,QACZ,2BACA,CAAC,QAAQ,SAAS,aAAa,QAAQ;AAEzC;"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
4
- const pLimit = ({ interval } = {}) => {
5
- const queue = [];
6
- let busy = false;
7
- let lastCompletion = 0;
8
- const resumeNext = () => {
9
- var _a;
10
- if (!busy && queue.length > 0) {
11
- (_a = queue.shift()) == null ? void 0 : _a();
12
- busy = true;
13
- }
14
- };
15
- const next = () => {
16
- busy = false;
17
- resumeNext();
18
- };
19
- const run = async (function_, resolve, arguments_) => {
20
- const timeSinceLastCompletion = Date.now() - lastCompletion;
21
- if (interval && timeSinceLastCompletion < interval) {
22
- await sleep(interval - timeSinceLastCompletion);
23
- }
24
- const result = (async () => function_(...arguments_))();
25
- resolve(result);
26
- try {
27
- await result;
28
- } catch {
29
- }
30
- lastCompletion = Date.now();
31
- next();
32
- };
33
- const enqueue = (function_, resolve, arguments_) => {
34
- new Promise((internalResolve) => {
35
- queue.push(internalResolve);
36
- }).then(run.bind(void 0, function_, resolve, arguments_));
37
- (async () => {
38
- await Promise.resolve();
39
- if (!busy) {
40
- resumeNext();
41
- }
42
- })();
43
- };
44
- return (function_, ...arguments_) => new Promise((resolve) => {
45
- enqueue(function_, resolve, arguments_);
46
- });
47
- };
48
- exports.pLimit = pLimit;
49
- //# sourceMappingURL=pLimit.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pLimit.cjs","sources":["../../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// eslint-disable-next-line @typescript-eslint/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"],"names":[],"mappings":";;AAQA,MAAM,QAAQ,CAAC,OAAe,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AA2BvE,MAAM,SAAS,CAAC,EACtB,SAAQ,IACkB,OAAqB;AAC/C,QAAM,QAAuB,CAAA;AAC7B,MAAI,OAAO;AACX,MAAI,iBAAiB;AAErB,QAAM,aAAa,MAAK;;AACvB,QAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,kBAAM,YAAN;AACO,aAAA;AAAA,IAAA;AAAA,EAET;AAEA,QAAM,OAAO,MAAK;AACV,WAAA;;EAGR;AAEA,QAAM,MAAM,OACX,WACA,SACA,eACG;AACG,UAAA,0BAA0B,KAAK,IAAA,IAAQ;AAEzC,QAAA,YAAY,0BAA0B,UAAU;AAC7C,YAAA,MAAM,WAAW,uBAAuB;AAAA,IAAA;AAE/C,UAAM,UAAU,YAAY,UAAU,GAAG,UAAU;AAEnD,YAAQ,MAAM;AAEV,QAAA;AACG,YAAA;AAAA,IAAA,QACC;AAAA,IAAA;AAER,qBAAiB,KAAK;;EAGvB;AAEA,QAAM,UAAU,CACf,WACA,SACA,eACG;AAGC,QAAA,QAAQ,CAAC,oBAAmB;AAC/B,YAAM,KAAK,eAAe;AAAA,IAAA,CAC1B,EAAE,KAAK,IAAI,KAAK,QAAW,WAAW,SAAS,UAAU,CAAC;AAC1D,KAAC,YAAW;AAKZ,YAAM,QAAQ,QAAO;AAErB,UAAI,CAAC,MAAM;;;IAEX;EAEF;AAEA,SAAQ,CAAC,cAA2B,eACnC,IAAI,QAAiB,CAAC,YAAW;AACxB,YAAA,WAAW,SAAS,UAAU;AAAA,EAAA,CACtC;AACH;;"}
@@ -1,22 +0,0 @@
1
- /**
2
- * @param fn - Promise-returning/async function.
3
- * @param arguments - Any arguments to pass through to `fn`. Support for passing
4
- * arguments on to the `fn` is provided in order to be able to avoid creating
5
- * unnecessary closures. You probably don't need this optimization unless
6
- * you're pushing a lot of functions.
7
- *
8
- * @returns The promise returned by calling `fn(...arguments)`.
9
- */
10
- export type LimitFunction = <TArguments extends unknown[], TReturnType>(function_: (...arguments_: TArguments) => PromiseLike<TReturnType> | TReturnType, ...arguments_: TArguments) => Promise<TReturnType>;
11
- /**
12
- * Creates a limiting function that will only execute one promise at a time and
13
- * respect a given interval between each call.
14
- *
15
- * @param args - Options for the function, `interval` is the minimum time to
16
- * wait between each promise execution.
17
- *
18
- * @returns A limiting function as per configuration, see {@link LimitFunction}.
19
- */
20
- export declare const pLimit: ({ interval, }?: {
21
- interval?: number;
22
- }) => LimitFunction;
@@ -1,49 +0,0 @@
1
- const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
2
- const pLimit = ({ interval } = {}) => {
3
- const queue = [];
4
- let busy = false;
5
- let lastCompletion = 0;
6
- const resumeNext = () => {
7
- var _a;
8
- if (!busy && queue.length > 0) {
9
- (_a = queue.shift()) == null ? void 0 : _a();
10
- busy = true;
11
- }
12
- };
13
- const next = () => {
14
- busy = false;
15
- resumeNext();
16
- };
17
- const run = async (function_, resolve, arguments_) => {
18
- const timeSinceLastCompletion = Date.now() - lastCompletion;
19
- if (interval && timeSinceLastCompletion < interval) {
20
- await sleep(interval - timeSinceLastCompletion);
21
- }
22
- const result = (async () => function_(...arguments_))();
23
- resolve(result);
24
- try {
25
- await result;
26
- } catch {
27
- }
28
- lastCompletion = Date.now();
29
- next();
30
- };
31
- const enqueue = (function_, resolve, arguments_) => {
32
- new Promise((internalResolve) => {
33
- queue.push(internalResolve);
34
- }).then(run.bind(void 0, function_, resolve, arguments_));
35
- (async () => {
36
- await Promise.resolve();
37
- if (!busy) {
38
- resumeNext();
39
- }
40
- })();
41
- };
42
- return (function_, ...arguments_) => new Promise((resolve) => {
43
- enqueue(function_, resolve, arguments_);
44
- });
45
- };
46
- export {
47
- pLimit
48
- };
49
- //# sourceMappingURL=pLimit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pLimit.js","sources":["../../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// eslint-disable-next-line @typescript-eslint/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"],"names":[],"mappings":"AAQA,MAAM,QAAQ,CAAC,OAAe,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AA2BvE,MAAM,SAAS,CAAC,EACtB,SAAQ,IACkB,OAAqB;AAC/C,QAAM,QAAuB,CAAA;AAC7B,MAAI,OAAO;AACX,MAAI,iBAAiB;AAErB,QAAM,aAAa,MAAK;AAlCzB;AAmCE,QAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,kBAAM,YAAN;AACO,aAAA;AAAA,IAAA;AAAA,EAET;AAEA,QAAM,OAAO,MAAK;AACV,WAAA;;EAGR;AAEA,QAAM,MAAM,OACX,WACA,SACA,eACG;AACG,UAAA,0BAA0B,KAAK,IAAA,IAAQ;AAEzC,QAAA,YAAY,0BAA0B,UAAU;AAC7C,YAAA,MAAM,WAAW,uBAAuB;AAAA,IAAA;AAE/C,UAAM,UAAU,YAAY,UAAU,GAAG,UAAU;AAEnD,YAAQ,MAAM;AAEV,QAAA;AACG,YAAA;AAAA,IAAA,QACC;AAAA,IAAA;AAER,qBAAiB,KAAK;;EAGvB;AAEA,QAAM,UAAU,CACf,WACA,SACA,eACG;AAGC,QAAA,QAAQ,CAAC,oBAAmB;AAC/B,YAAM,KAAK,eAAe;AAAA,IAAA,CAC1B,EAAE,KAAK,IAAI,KAAK,QAAW,WAAW,SAAS,UAAU,CAAC;AAC1D,KAAC,YAAW;AAKZ,YAAM,QAAQ,QAAO;AAErB,UAAI,CAAC,MAAM;;;IAEX;EAEF;AAEA,SAAQ,CAAC,cAA2B,eACnC,IAAI,QAAiB,CAAC,YAAW;AACxB,YAAA,WAAW,SAAS,UAAU;AAAA,EAAA,CACtC;AACH;"}
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const pLimit = require("./pLimit.cjs");
4
- const DEFAULT_RETRY_AFTER = 1500;
5
- const THROTTLED_RUNNERS = {};
6
- const DEDUPLICATED_JOBS = {};
7
- async function request(url, init, fetchFn) {
8
- var _a, _b;
9
- const stringURL = url.toString();
10
- let job;
11
- if (init == null ? void 0 : init.body) {
12
- const runner = THROTTLED_RUNNERS[_a = url.hostname] || (THROTTLED_RUNNERS[_a] = pLimit.pLimit({
13
- interval: DEFAULT_RETRY_AFTER
14
- }));
15
- job = runner(() => fetchFn(stringURL, init));
16
- } else {
17
- const existingJob = (_b = DEDUPLICATED_JOBS[stringURL]) == null ? void 0 : _b.get(init == null ? void 0 : init.signal);
18
- if (existingJob) {
19
- job = existingJob;
20
- } else {
21
- job = fetchFn(stringURL, init).finally(() => {
22
- var _a2, _b2;
23
- (_a2 = DEDUPLICATED_JOBS[stringURL]) == null ? void 0 : _a2.delete(init == null ? void 0 : init.signal);
24
- if (((_b2 = DEDUPLICATED_JOBS[stringURL]) == null ? void 0 : _b2.size) === 0) {
25
- delete DEDUPLICATED_JOBS[stringURL];
26
- }
27
- });
28
- const map = DEDUPLICATED_JOBS[stringURL] || (DEDUPLICATED_JOBS[stringURL] = /* @__PURE__ */ new Map());
29
- map.set(init == null ? void 0 : init.signal, job);
30
- }
31
- }
32
- const response = await job;
33
- if (response.status === 429) {
34
- const retryAfter = Number(response.headers.get("retry-after"));
35
- const resolvedRetryAfter = Number.isNaN(retryAfter) ? DEFAULT_RETRY_AFTER : retryAfter * 1e3;
36
- await new Promise((resolve) => setTimeout(resolve, resolvedRetryAfter));
37
- return request(url, init, fetchFn);
38
- }
39
- return response.clone();
40
- }
41
- exports.DEFAULT_RETRY_AFTER = DEFAULT_RETRY_AFTER;
42
- exports.request = request;
43
- //# sourceMappingURL=request.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.cjs","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// eslint-disable-next-line @typescript-eslint/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// eslint-disable-next-line @typescript-eslint/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// eslint-disable-next-line @typescript-eslint/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\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).finally(() => {\n\t\t\t\tDEDUPLICATED_JOBS[stringURL]?.delete(init?.signal)\n\t\t\t\tif (DEDUPLICATED_JOBS[stringURL]?.size === 0) {\n\t\t\t\t\tdelete DEDUPLICATED_JOBS[stringURL]\n\t\t\t\t}\n\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.clone()\n}\n"],"names":["pLimit","_a","_b"],"mappings":";;;AAOO,MAAM,sBAAsB;AAKnC,MAAM,oBAA4D,CAAA;AAMlE,MAAM,oBAEF,CAAA;AAgGkB,eAAA,QACrB,KACA,MACA,SAAkB;;AAEZ,QAAA,YAAY,IAAI;AAElB,MAAA;AAGJ,MAAI,6BAAM,MAAM;AAEf,UAAM,SAAU,uBAAkB,IAAI,cAAtB,wBAAoCA,OAAAA,OAAO;AAAA,MAC1D,UAAU;AAAA,IAAA,CACV;AAED,UAAM,OAAO,MAAM,QAAQ,WAAW,IAAI,CAAC;AAAA,EAAA,OACrC;AAEN,UAAM,eAAc,uBAAkB,SAAS,MAA3B,mBAA8B,IAAI,6BAAM;AAC5D,QAAI,aAAa;AACV,YAAA;AAAA,IAAA,OACA;AACN,YAAM,QAAQ,WAAW,IAAI,EAAE,QAAQ,MAAK;;AAC3C,SAAAC,MAAA,kBAAkB,SAAS,MAA3B,gBAAAA,IAA8B,OAAO,6BAAM;AAC3C,cAAIC,MAAA,kBAAkB,SAAS,MAA3B,gBAAAA,IAA8B,UAAS,GAAG;AAC7C,iBAAO,kBAAkB,SAAS;AAAA,QAAA;AAAA,MACnC,CACA;AACD,YAAM,MAAO,oFAAqC,IAAK;AACnD,UAAA,IAAI,6BAAM,QAAQ,GAAG;AAAA,IAAA;AAAA,EAC1B;AAGD,QAAM,WAAW,MAAM;AAGnB,MAAA,SAAS,WAAW,KAAK;AAC5B,UAAM,aAAa,OAAO,SAAS,QAAQ,IAAI,aAAa,CAAC;AAC7D,UAAM,qBAAqB,OAAO,MAAM,UAAU,IAC/C,sBACA,aAAa;AAEhB,UAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,kBAAkB,CAAC;AAE/D,WAAA,QAAQ,KAAK,MAAM,OAAO;AAAA,EAAA;AAGlC,SAAO,SAAS,MAAK;AACtB;;;"}