@prismicio/client 7.22.1 → 7.22.2-pr.467.c01b275

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 (541) hide show
  1. package/dist/Client.cjs +22 -6
  2. package/dist/Client.cjs.map +1 -1
  3. package/dist/Client.d.cts +14 -16
  4. package/dist/Client.d.cts.map +1 -1
  5. package/dist/Client.d.ts +14 -16
  6. package/dist/Client.d.ts.map +1 -1
  7. package/dist/Client.js +22 -6
  8. package/dist/Client.js.map +1 -1
  9. package/dist/Migration.cjs +24 -23
  10. package/dist/Migration.cjs.map +1 -1
  11. package/dist/Migration.d.cts +1 -3
  12. package/dist/Migration.d.cts.map +1 -1
  13. package/dist/Migration.d.ts +1 -3
  14. package/dist/Migration.d.ts.map +1 -1
  15. package/dist/Migration.js +24 -23
  16. package/dist/Migration.js.map +1 -1
  17. package/dist/WriteClient.cjs +21 -19
  18. package/dist/WriteClient.cjs.map +1 -1
  19. package/dist/WriteClient.d.cts +18 -22
  20. package/dist/WriteClient.d.cts.map +1 -1
  21. package/dist/WriteClient.d.ts +18 -22
  22. package/dist/WriteClient.d.ts.map +1 -1
  23. package/dist/WriteClient.js +21 -19
  24. package/dist/WriteClient.js.map +1 -1
  25. package/dist/buildQueryURL.cjs.map +1 -1
  26. package/dist/buildQueryURL.d.cts +5 -6
  27. package/dist/buildQueryURL.d.cts.map +1 -1
  28. package/dist/buildQueryURL.d.ts +5 -6
  29. package/dist/buildQueryURL.d.ts.map +1 -1
  30. package/dist/buildQueryURL.js.map +1 -1
  31. package/dist/cookie.d.cts +1 -1
  32. package/dist/cookie.d.cts.map +1 -1
  33. package/dist/cookie.d.ts +1 -1
  34. package/dist/cookie.d.ts.map +1 -1
  35. package/dist/createClient.cjs.map +1 -1
  36. package/dist/createClient.d.cts +2 -4
  37. package/dist/createClient.d.cts.map +1 -1
  38. package/dist/createClient.d.ts +2 -4
  39. package/dist/createClient.d.ts.map +1 -1
  40. package/dist/createClient.js.map +1 -1
  41. package/dist/createMigration.cjs.map +1 -1
  42. package/dist/createMigration.d.cts +2 -4
  43. package/dist/createMigration.d.cts.map +1 -1
  44. package/dist/createMigration.d.ts +2 -4
  45. package/dist/createMigration.d.ts.map +1 -1
  46. package/dist/createMigration.js.map +1 -1
  47. package/dist/createWriteClient.cjs.map +1 -1
  48. package/dist/createWriteClient.d.cts +2 -4
  49. package/dist/createWriteClient.d.cts.map +1 -1
  50. package/dist/createWriteClient.d.ts +2 -4
  51. package/dist/createWriteClient.d.ts.map +1 -1
  52. package/dist/createWriteClient.js.map +1 -1
  53. package/dist/errors.cjs.map +1 -1
  54. package/dist/errors.d.cts +9 -10
  55. package/dist/errors.d.cts.map +1 -1
  56. package/dist/errors.d.ts +9 -10
  57. package/dist/errors.d.ts.map +1 -1
  58. package/dist/errors.js.map +1 -1
  59. package/dist/filter.cjs +175 -0
  60. package/dist/filter.cjs.map +1 -1
  61. package/dist/filter.d.cts +3 -4
  62. package/dist/filter.d.cts.map +1 -1
  63. package/dist/filter.d.ts +3 -4
  64. package/dist/filter.d.ts.map +1 -1
  65. package/dist/filter.js +175 -0
  66. package/dist/filter.js.map +1 -1
  67. package/dist/getGraphQLEndpoint.cjs.map +1 -1
  68. package/dist/getGraphQLEndpoint.d.cts +1 -2
  69. package/dist/getGraphQLEndpoint.d.cts.map +1 -1
  70. package/dist/getGraphQLEndpoint.d.ts +1 -2
  71. package/dist/getGraphQLEndpoint.d.ts.map +1 -1
  72. package/dist/getGraphQLEndpoint.js.map +1 -1
  73. package/dist/getRepositoryEndpoint.cjs.map +1 -1
  74. package/dist/getRepositoryEndpoint.d.cts +1 -2
  75. package/dist/getRepositoryEndpoint.d.cts.map +1 -1
  76. package/dist/getRepositoryEndpoint.d.ts +1 -2
  77. package/dist/getRepositoryEndpoint.d.ts.map +1 -1
  78. package/dist/getRepositoryEndpoint.js.map +1 -1
  79. package/dist/getRepositoryName.cjs.map +1 -1
  80. package/dist/getRepositoryName.d.cts +1 -2
  81. package/dist/getRepositoryName.d.cts.map +1 -1
  82. package/dist/getRepositoryName.d.ts +1 -2
  83. package/dist/getRepositoryName.d.ts.map +1 -1
  84. package/dist/getRepositoryName.js.map +1 -1
  85. package/dist/getToolbarSrc.cjs.map +1 -1
  86. package/dist/getToolbarSrc.d.cts +1 -2
  87. package/dist/getToolbarSrc.d.cts.map +1 -1
  88. package/dist/getToolbarSrc.d.ts +1 -2
  89. package/dist/getToolbarSrc.d.ts.map +1 -1
  90. package/dist/getToolbarSrc.js.map +1 -1
  91. package/dist/helpers/asDate.cjs.map +1 -1
  92. package/dist/helpers/asDate.d.cts +1 -3
  93. package/dist/helpers/asDate.d.cts.map +1 -1
  94. package/dist/helpers/asDate.d.ts +1 -3
  95. package/dist/helpers/asDate.d.ts.map +1 -1
  96. package/dist/helpers/asDate.js.map +1 -1
  97. package/dist/helpers/asHTML.cjs +7 -5
  98. package/dist/helpers/asHTML.cjs.map +1 -1
  99. package/dist/helpers/asHTML.d.cts +12 -11
  100. package/dist/helpers/asHTML.d.cts.map +1 -1
  101. package/dist/helpers/asHTML.d.ts +12 -11
  102. package/dist/helpers/asHTML.d.ts.map +1 -1
  103. package/dist/helpers/asHTML.js +7 -5
  104. package/dist/helpers/asHTML.js.map +1 -1
  105. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
  106. package/dist/helpers/asImagePixelDensitySrcSet.d.cts +3 -4
  107. package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
  108. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +3 -4
  109. package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
  110. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
  111. package/dist/helpers/asImageSrc.cjs.map +1 -1
  112. package/dist/helpers/asImageSrc.d.cts +1 -3
  113. package/dist/helpers/asImageSrc.d.cts.map +1 -1
  114. package/dist/helpers/asImageSrc.d.ts +1 -3
  115. package/dist/helpers/asImageSrc.d.ts.map +1 -1
  116. package/dist/helpers/asImageSrc.js.map +1 -1
  117. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
  118. package/dist/helpers/asImageWidthSrcSet.d.cts +3 -4
  119. package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
  120. package/dist/helpers/asImageWidthSrcSet.d.ts +3 -4
  121. package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
  122. package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
  123. package/dist/helpers/asLink.cjs.map +1 -1
  124. package/dist/helpers/asLink.d.cts +3 -5
  125. package/dist/helpers/asLink.d.cts.map +1 -1
  126. package/dist/helpers/asLink.d.ts +3 -5
  127. package/dist/helpers/asLink.d.ts.map +1 -1
  128. package/dist/helpers/asLink.js.map +1 -1
  129. package/dist/helpers/asLinkAttrs.cjs.map +1 -1
  130. package/dist/helpers/asLinkAttrs.d.cts +2 -4
  131. package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
  132. package/dist/helpers/asLinkAttrs.d.ts +2 -4
  133. package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
  134. package/dist/helpers/asLinkAttrs.js.map +1 -1
  135. package/dist/helpers/asText.cjs.map +1 -1
  136. package/dist/helpers/asText.d.cts +1 -3
  137. package/dist/helpers/asText.d.cts.map +1 -1
  138. package/dist/helpers/asText.d.ts +1 -3
  139. package/dist/helpers/asText.d.ts.map +1 -1
  140. package/dist/helpers/asText.js.map +1 -1
  141. package/dist/helpers/documentToLinkField.cjs.map +1 -1
  142. package/dist/helpers/documentToLinkField.d.cts +1 -3
  143. package/dist/helpers/documentToLinkField.d.cts.map +1 -1
  144. package/dist/helpers/documentToLinkField.d.ts +1 -3
  145. package/dist/helpers/documentToLinkField.d.ts.map +1 -1
  146. package/dist/helpers/documentToLinkField.js.map +1 -1
  147. package/dist/helpers/isFilled.cjs +20 -0
  148. package/dist/helpers/isFilled.cjs.map +1 -1
  149. package/dist/helpers/isFilled.d.cts +22 -24
  150. package/dist/helpers/isFilled.d.cts.map +1 -1
  151. package/dist/helpers/isFilled.d.ts +22 -24
  152. package/dist/helpers/isFilled.d.ts.map +1 -1
  153. package/dist/helpers/isFilled.js +1 -1
  154. package/dist/helpers/isFilled.js.map +1 -1
  155. package/dist/helpers/mapSliceZone.cjs.map +1 -1
  156. package/dist/helpers/mapSliceZone.d.cts +10 -8
  157. package/dist/helpers/mapSliceZone.d.cts.map +1 -1
  158. package/dist/helpers/mapSliceZone.d.ts +10 -8
  159. package/dist/helpers/mapSliceZone.d.ts.map +1 -1
  160. package/dist/helpers/mapSliceZone.js.map +1 -1
  161. package/dist/index.d.cts +3 -4
  162. package/dist/index.d.cts.map +1 -1
  163. package/dist/index.d.ts +3 -4
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/isRepositoryEndpoint.cjs.map +1 -1
  166. package/dist/isRepositoryEndpoint.d.cts +1 -2
  167. package/dist/isRepositoryEndpoint.d.cts.map +1 -1
  168. package/dist/isRepositoryEndpoint.d.ts +1 -2
  169. package/dist/isRepositoryEndpoint.d.ts.map +1 -1
  170. package/dist/isRepositoryEndpoint.js.map +1 -1
  171. package/dist/isRepositoryName.cjs.map +1 -1
  172. package/dist/isRepositoryName.d.cts +1 -2
  173. package/dist/isRepositoryName.d.cts.map +1 -1
  174. package/dist/isRepositoryName.d.ts +1 -2
  175. package/dist/isRepositoryName.d.ts.map +1 -1
  176. package/dist/isRepositoryName.js.map +1 -1
  177. package/dist/lib/devMsg.cjs.map +1 -1
  178. package/dist/lib/devMsg.js.map +1 -1
  179. package/dist/lib/escapeHTML.cjs.map +1 -1
  180. package/dist/lib/escapeHTML.js.map +1 -1
  181. package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
  182. package/dist/lib/getOptionalLinkProperties.js.map +1 -1
  183. package/dist/lib/getPreviewCookie.cjs.map +1 -1
  184. package/dist/lib/getPreviewCookie.js.map +1 -1
  185. package/dist/lib/isInternalURL.cjs.map +1 -1
  186. package/dist/lib/isInternalURL.js.map +1 -1
  187. package/dist/lib/isMigrationValue.cjs.map +1 -1
  188. package/dist/lib/isMigrationValue.js.map +1 -1
  189. package/dist/lib/isValue.cjs.map +1 -1
  190. package/dist/lib/isValue.js.map +1 -1
  191. package/dist/lib/pLimit.cjs.map +1 -1
  192. package/dist/lib/pLimit.js.map +1 -1
  193. package/dist/lib/request.cjs +1 -0
  194. package/dist/lib/request.cjs.map +1 -1
  195. package/dist/lib/request.d.cts +5 -6
  196. package/dist/lib/request.d.cts.map +1 -1
  197. package/dist/lib/request.d.ts +5 -6
  198. package/dist/lib/request.d.ts.map +1 -1
  199. package/dist/lib/request.js +1 -1
  200. package/dist/lib/request.js.map +1 -1
  201. package/dist/lib/resolveMigrationDocumentData.cjs +3 -0
  202. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
  203. package/dist/lib/resolveMigrationDocumentData.js +1 -1
  204. package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
  205. package/dist/lib/serializerHelpers.cjs +10 -6
  206. package/dist/lib/serializerHelpers.cjs.map +1 -1
  207. package/dist/lib/serializerHelpers.js +10 -6
  208. package/dist/lib/serializerHelpers.js.map +1 -1
  209. package/dist/lib/throttledWarn.cjs.map +1 -1
  210. package/dist/lib/throttledWarn.js.map +1 -1
  211. package/dist/lib/validateAssetMetadata.cjs.map +1 -1
  212. package/dist/lib/validateAssetMetadata.js.map +1 -1
  213. package/dist/package.cjs +1 -1
  214. package/dist/package.js +1 -1
  215. package/dist/richtext/asText.cjs.map +1 -1
  216. package/dist/richtext/asText.d.cts +1 -3
  217. package/dist/richtext/asText.d.cts.map +1 -1
  218. package/dist/richtext/asText.d.ts +1 -3
  219. package/dist/richtext/asText.d.ts.map +1 -1
  220. package/dist/richtext/asText.js.map +1 -1
  221. package/dist/richtext/asTree.cjs.map +1 -1
  222. package/dist/richtext/asTree.d.cts +1 -3
  223. package/dist/richtext/asTree.d.cts.map +1 -1
  224. package/dist/richtext/asTree.d.ts +1 -3
  225. package/dist/richtext/asTree.d.ts.map +1 -1
  226. package/dist/richtext/asTree.js.map +1 -1
  227. package/dist/richtext/composeSerializers.cjs.map +1 -1
  228. package/dist/richtext/composeSerializers.d.cts +1 -3
  229. package/dist/richtext/composeSerializers.d.cts.map +1 -1
  230. package/dist/richtext/composeSerializers.d.ts +1 -3
  231. package/dist/richtext/composeSerializers.d.ts.map +1 -1
  232. package/dist/richtext/composeSerializers.js.map +1 -1
  233. package/dist/richtext/serialize.cjs.map +1 -1
  234. package/dist/richtext/serialize.d.cts +1 -3
  235. package/dist/richtext/serialize.d.cts.map +1 -1
  236. package/dist/richtext/serialize.d.ts +1 -3
  237. package/dist/richtext/serialize.d.ts.map +1 -1
  238. package/dist/richtext/serialize.js.map +1 -1
  239. package/dist/richtext/types.cjs.map +1 -1
  240. package/dist/richtext/types.d.cts +5 -7
  241. package/dist/richtext/types.d.cts.map +1 -1
  242. package/dist/richtext/types.d.ts +5 -7
  243. package/dist/richtext/types.d.ts.map +1 -1
  244. package/dist/richtext/types.js.map +1 -1
  245. package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
  246. package/dist/richtext/wrapMapSerializer.d.cts +1 -3
  247. package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
  248. package/dist/richtext/wrapMapSerializer.d.ts +1 -3
  249. package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
  250. package/dist/richtext/wrapMapSerializer.js.map +1 -1
  251. package/dist/types/api/asset/asset.d.cts +35 -20
  252. package/dist/types/api/asset/asset.d.cts.map +1 -1
  253. package/dist/types/api/asset/asset.d.ts +35 -20
  254. package/dist/types/api/asset/asset.d.ts.map +1 -1
  255. package/dist/types/api/asset/tag.d.cts +12 -7
  256. package/dist/types/api/asset/tag.d.cts.map +1 -1
  257. package/dist/types/api/asset/tag.d.ts +12 -7
  258. package/dist/types/api/asset/tag.d.ts.map +1 -1
  259. package/dist/types/api/integration.d.cts +2 -4
  260. package/dist/types/api/integration.d.cts.map +1 -1
  261. package/dist/types/api/integration.d.ts +2 -4
  262. package/dist/types/api/integration.d.ts.map +1 -1
  263. package/dist/types/api/migration/release.d.cts +3 -7
  264. package/dist/types/api/migration/release.d.cts.map +1 -1
  265. package/dist/types/api/migration/release.d.ts +3 -7
  266. package/dist/types/api/migration/release.d.ts.map +1 -1
  267. package/dist/types/api/query.d.cts +1 -3
  268. package/dist/types/api/query.d.cts.map +1 -1
  269. package/dist/types/api/query.d.ts +1 -3
  270. package/dist/types/api/query.d.ts.map +1 -1
  271. package/dist/types/api/ref.d.cts +1 -2
  272. package/dist/types/api/ref.d.cts.map +1 -1
  273. package/dist/types/api/ref.d.ts +1 -2
  274. package/dist/types/api/ref.d.ts.map +1 -1
  275. package/dist/types/api/release.d.cts +1 -3
  276. package/dist/types/api/release.d.cts.map +1 -1
  277. package/dist/types/api/release.d.ts +1 -3
  278. package/dist/types/api/release.d.ts.map +1 -1
  279. package/dist/types/api/repository.d.cts +4 -6
  280. package/dist/types/api/repository.d.cts.map +1 -1
  281. package/dist/types/api/repository.d.ts +4 -6
  282. package/dist/types/api/repository.d.ts.map +1 -1
  283. package/dist/types/api/tags.d.cts +1 -2
  284. package/dist/types/api/tags.d.cts.map +1 -1
  285. package/dist/types/api/tags.d.ts +1 -2
  286. package/dist/types/api/tags.d.ts.map +1 -1
  287. package/dist/types/migration/Asset.cjs.map +1 -1
  288. package/dist/types/migration/Asset.d.cts +21 -15
  289. package/dist/types/migration/Asset.d.cts.map +1 -1
  290. package/dist/types/migration/Asset.d.ts +21 -15
  291. package/dist/types/migration/Asset.d.ts.map +1 -1
  292. package/dist/types/migration/Asset.js.map +1 -1
  293. package/dist/types/migration/ContentRelationship.d.cts +1 -3
  294. package/dist/types/migration/ContentRelationship.d.cts.map +1 -1
  295. package/dist/types/migration/ContentRelationship.d.ts +1 -3
  296. package/dist/types/migration/ContentRelationship.d.ts.map +1 -1
  297. package/dist/types/migration/Document.cjs.map +1 -1
  298. package/dist/types/migration/Document.d.cts +8 -8
  299. package/dist/types/migration/Document.d.cts.map +1 -1
  300. package/dist/types/migration/Document.d.ts +8 -8
  301. package/dist/types/migration/Document.d.ts.map +1 -1
  302. package/dist/types/migration/Document.js.map +1 -1
  303. package/dist/types/model/boolean.d.cts +1 -3
  304. package/dist/types/model/boolean.d.cts.map +1 -1
  305. package/dist/types/model/boolean.d.ts +1 -3
  306. package/dist/types/model/boolean.d.ts.map +1 -1
  307. package/dist/types/model/color.d.cts +1 -3
  308. package/dist/types/model/color.d.cts.map +1 -1
  309. package/dist/types/model/color.d.ts +1 -3
  310. package/dist/types/model/color.d.ts.map +1 -1
  311. package/dist/types/model/contentRelationship.d.cts +6 -8
  312. package/dist/types/model/contentRelationship.d.cts.map +1 -1
  313. package/dist/types/model/contentRelationship.d.ts +6 -8
  314. package/dist/types/model/contentRelationship.d.ts.map +1 -1
  315. package/dist/types/model/customType.d.cts +3 -5
  316. package/dist/types/model/customType.d.cts.map +1 -1
  317. package/dist/types/model/customType.d.ts +3 -5
  318. package/dist/types/model/customType.d.ts.map +1 -1
  319. package/dist/types/model/date.d.cts +1 -3
  320. package/dist/types/model/date.d.cts.map +1 -1
  321. package/dist/types/model/date.d.ts +1 -3
  322. package/dist/types/model/date.d.ts.map +1 -1
  323. package/dist/types/model/embed.d.cts +1 -3
  324. package/dist/types/model/embed.d.cts.map +1 -1
  325. package/dist/types/model/embed.d.ts +1 -3
  326. package/dist/types/model/embed.d.ts.map +1 -1
  327. package/dist/types/model/geoPoint.d.cts +1 -3
  328. package/dist/types/model/geoPoint.d.cts.map +1 -1
  329. package/dist/types/model/geoPoint.d.ts +1 -3
  330. package/dist/types/model/geoPoint.d.ts.map +1 -1
  331. package/dist/types/model/group.d.cts +2 -4
  332. package/dist/types/model/group.d.cts.map +1 -1
  333. package/dist/types/model/group.d.ts +2 -4
  334. package/dist/types/model/group.d.ts.map +1 -1
  335. package/dist/types/model/image.d.cts +3 -5
  336. package/dist/types/model/image.d.cts.map +1 -1
  337. package/dist/types/model/image.d.ts +3 -5
  338. package/dist/types/model/image.d.ts.map +1 -1
  339. package/dist/types/model/integration.d.cts +1 -3
  340. package/dist/types/model/integration.d.cts.map +1 -1
  341. package/dist/types/model/integration.d.ts +1 -3
  342. package/dist/types/model/integration.d.ts.map +1 -1
  343. package/dist/types/model/keyText.d.cts +1 -3
  344. package/dist/types/model/keyText.d.cts.map +1 -1
  345. package/dist/types/model/keyText.d.ts +1 -3
  346. package/dist/types/model/keyText.d.ts.map +1 -1
  347. package/dist/types/model/link.cjs.map +1 -1
  348. package/dist/types/model/link.d.cts +2 -4
  349. package/dist/types/model/link.d.cts.map +1 -1
  350. package/dist/types/model/link.d.ts +2 -4
  351. package/dist/types/model/link.d.ts.map +1 -1
  352. package/dist/types/model/link.js.map +1 -1
  353. package/dist/types/model/linkToMedia.d.cts +1 -3
  354. package/dist/types/model/linkToMedia.d.cts.map +1 -1
  355. package/dist/types/model/linkToMedia.d.ts +1 -3
  356. package/dist/types/model/linkToMedia.d.ts.map +1 -1
  357. package/dist/types/model/number.d.cts +1 -3
  358. package/dist/types/model/number.d.cts.map +1 -1
  359. package/dist/types/model/number.d.ts +1 -3
  360. package/dist/types/model/number.d.ts.map +1 -1
  361. package/dist/types/model/range.d.cts +1 -3
  362. package/dist/types/model/range.d.cts.map +1 -1
  363. package/dist/types/model/range.d.ts +1 -3
  364. package/dist/types/model/range.d.ts.map +1 -1
  365. package/dist/types/model/richText.d.cts +3 -5
  366. package/dist/types/model/richText.d.cts.map +1 -1
  367. package/dist/types/model/richText.d.ts +3 -5
  368. package/dist/types/model/richText.d.ts.map +1 -1
  369. package/dist/types/model/select.d.cts +1 -3
  370. package/dist/types/model/select.d.cts.map +1 -1
  371. package/dist/types/model/select.d.ts +1 -3
  372. package/dist/types/model/select.d.ts.map +1 -1
  373. package/dist/types/model/separator.d.cts +1 -3
  374. package/dist/types/model/separator.d.cts.map +1 -1
  375. package/dist/types/model/separator.d.ts +1 -3
  376. package/dist/types/model/separator.d.ts.map +1 -1
  377. package/dist/types/model/sharedSlice.d.cts +1 -3
  378. package/dist/types/model/sharedSlice.d.cts.map +1 -1
  379. package/dist/types/model/sharedSlice.d.ts +1 -3
  380. package/dist/types/model/sharedSlice.d.ts.map +1 -1
  381. package/dist/types/model/sharedSliceVariation.d.cts +1 -3
  382. package/dist/types/model/sharedSliceVariation.d.cts.map +1 -1
  383. package/dist/types/model/sharedSliceVariation.d.ts +1 -3
  384. package/dist/types/model/sharedSliceVariation.d.ts.map +1 -1
  385. package/dist/types/model/slice.cjs.map +1 -1
  386. package/dist/types/model/slice.d.cts +3 -5
  387. package/dist/types/model/slice.d.cts.map +1 -1
  388. package/dist/types/model/slice.d.ts +3 -5
  389. package/dist/types/model/slice.d.ts.map +1 -1
  390. package/dist/types/model/slice.js.map +1 -1
  391. package/dist/types/model/sliceZone.cjs.map +1 -1
  392. package/dist/types/model/sliceZone.d.cts +4 -6
  393. package/dist/types/model/sliceZone.d.cts.map +1 -1
  394. package/dist/types/model/sliceZone.d.ts +4 -6
  395. package/dist/types/model/sliceZone.d.ts.map +1 -1
  396. package/dist/types/model/sliceZone.js.map +1 -1
  397. package/dist/types/model/table.d.cts +1 -3
  398. package/dist/types/model/table.d.cts.map +1 -1
  399. package/dist/types/model/table.d.ts +1 -3
  400. package/dist/types/model/table.d.ts.map +1 -1
  401. package/dist/types/model/timestamp.d.cts +1 -3
  402. package/dist/types/model/timestamp.d.cts.map +1 -1
  403. package/dist/types/model/timestamp.d.ts +1 -3
  404. package/dist/types/model/timestamp.d.ts.map +1 -1
  405. package/dist/types/model/title.d.cts +1 -3
  406. package/dist/types/model/title.d.cts.map +1 -1
  407. package/dist/types/model/title.d.ts +1 -3
  408. package/dist/types/model/title.d.ts.map +1 -1
  409. package/dist/types/model/types.cjs +4 -0
  410. package/dist/types/model/types.cjs.map +1 -1
  411. package/dist/types/model/types.d.cts +13 -11
  412. package/dist/types/model/types.d.cts.map +1 -1
  413. package/dist/types/model/types.d.ts +13 -11
  414. package/dist/types/model/types.d.ts.map +1 -1
  415. package/dist/types/model/types.js +4 -0
  416. package/dist/types/model/types.js.map +1 -1
  417. package/dist/types/model/uid.d.cts +1 -3
  418. package/dist/types/model/uid.d.cts.map +1 -1
  419. package/dist/types/model/uid.d.ts +1 -3
  420. package/dist/types/model/uid.d.ts.map +1 -1
  421. package/dist/types/value/boolean.d.cts +1 -2
  422. package/dist/types/value/boolean.d.cts.map +1 -1
  423. package/dist/types/value/boolean.d.ts +1 -2
  424. package/dist/types/value/boolean.d.ts.map +1 -1
  425. package/dist/types/value/color.d.cts +1 -3
  426. package/dist/types/value/color.d.cts.map +1 -1
  427. package/dist/types/value/color.d.ts +1 -3
  428. package/dist/types/value/color.d.ts.map +1 -1
  429. package/dist/types/value/contentRelationship.d.cts +3 -5
  430. package/dist/types/value/contentRelationship.d.cts.map +1 -1
  431. package/dist/types/value/contentRelationship.d.ts +3 -5
  432. package/dist/types/value/contentRelationship.d.ts.map +1 -1
  433. package/dist/types/value/date.d.cts +1 -3
  434. package/dist/types/value/date.d.cts.map +1 -1
  435. package/dist/types/value/date.d.ts +1 -3
  436. package/dist/types/value/date.d.ts.map +1 -1
  437. package/dist/types/value/document.d.cts +5 -7
  438. package/dist/types/value/document.d.cts.map +1 -1
  439. package/dist/types/value/document.d.ts +5 -7
  440. package/dist/types/value/document.d.ts.map +1 -1
  441. package/dist/types/value/embed.cjs.map +1 -1
  442. package/dist/types/value/embed.d.cts +43 -25
  443. package/dist/types/value/embed.d.cts.map +1 -1
  444. package/dist/types/value/embed.d.ts +43 -25
  445. package/dist/types/value/embed.d.ts.map +1 -1
  446. package/dist/types/value/embed.js.map +1 -1
  447. package/dist/types/value/geoPoint.d.cts +1 -3
  448. package/dist/types/value/geoPoint.d.cts.map +1 -1
  449. package/dist/types/value/geoPoint.d.ts +1 -3
  450. package/dist/types/value/geoPoint.d.ts.map +1 -1
  451. package/dist/types/value/group.d.cts +2 -4
  452. package/dist/types/value/group.d.cts.map +1 -1
  453. package/dist/types/value/group.d.ts +2 -4
  454. package/dist/types/value/group.d.ts.map +1 -1
  455. package/dist/types/value/image.d.cts +4 -6
  456. package/dist/types/value/image.d.cts.map +1 -1
  457. package/dist/types/value/image.d.ts +4 -6
  458. package/dist/types/value/image.d.ts.map +1 -1
  459. package/dist/types/value/integration.d.cts +2 -4
  460. package/dist/types/value/integration.d.cts.map +1 -1
  461. package/dist/types/value/integration.d.ts +2 -4
  462. package/dist/types/value/integration.d.ts.map +1 -1
  463. package/dist/types/value/keyText.d.cts +1 -3
  464. package/dist/types/value/keyText.d.cts.map +1 -1
  465. package/dist/types/value/keyText.d.ts +1 -3
  466. package/dist/types/value/keyText.d.ts.map +1 -1
  467. package/dist/types/value/link.cjs.map +1 -1
  468. package/dist/types/value/link.d.cts +6 -8
  469. package/dist/types/value/link.d.cts.map +1 -1
  470. package/dist/types/value/link.d.ts +6 -8
  471. package/dist/types/value/link.d.ts.map +1 -1
  472. package/dist/types/value/link.js.map +1 -1
  473. package/dist/types/value/linkToMedia.d.cts +2 -4
  474. package/dist/types/value/linkToMedia.d.cts.map +1 -1
  475. package/dist/types/value/linkToMedia.d.ts +2 -4
  476. package/dist/types/value/linkToMedia.d.ts.map +1 -1
  477. package/dist/types/value/number.d.cts +1 -3
  478. package/dist/types/value/number.d.cts.map +1 -1
  479. package/dist/types/value/number.d.ts +1 -3
  480. package/dist/types/value/number.d.ts.map +1 -1
  481. package/dist/types/value/richText.cjs.map +1 -1
  482. package/dist/types/value/richText.d.cts +29 -31
  483. package/dist/types/value/richText.d.cts.map +1 -1
  484. package/dist/types/value/richText.d.ts +29 -31
  485. package/dist/types/value/richText.d.ts.map +1 -1
  486. package/dist/types/value/richText.js.map +1 -1
  487. package/dist/types/value/select.d.cts +1 -3
  488. package/dist/types/value/select.d.cts.map +1 -1
  489. package/dist/types/value/select.d.ts +1 -3
  490. package/dist/types/value/select.d.ts.map +1 -1
  491. package/dist/types/value/sharedSlice.d.cts +1 -3
  492. package/dist/types/value/sharedSlice.d.cts.map +1 -1
  493. package/dist/types/value/sharedSlice.d.ts +1 -3
  494. package/dist/types/value/sharedSlice.d.ts.map +1 -1
  495. package/dist/types/value/sharedSliceVariation.d.cts +1 -3
  496. package/dist/types/value/sharedSliceVariation.d.cts.map +1 -1
  497. package/dist/types/value/sharedSliceVariation.d.ts +1 -3
  498. package/dist/types/value/sharedSliceVariation.d.ts.map +1 -1
  499. package/dist/types/value/slice.d.cts +1 -3
  500. package/dist/types/value/slice.d.cts.map +1 -1
  501. package/dist/types/value/slice.d.ts +1 -3
  502. package/dist/types/value/slice.d.ts.map +1 -1
  503. package/dist/types/value/sliceZone.d.cts +1 -3
  504. package/dist/types/value/sliceZone.d.cts.map +1 -1
  505. package/dist/types/value/sliceZone.d.ts +1 -3
  506. package/dist/types/value/sliceZone.d.ts.map +1 -1
  507. package/dist/types/value/table.d.cts +26 -16
  508. package/dist/types/value/table.d.cts.map +1 -1
  509. package/dist/types/value/table.d.ts +26 -16
  510. package/dist/types/value/table.d.ts.map +1 -1
  511. package/dist/types/value/timestamp.d.cts +1 -3
  512. package/dist/types/value/timestamp.d.cts.map +1 -1
  513. package/dist/types/value/timestamp.d.ts +1 -3
  514. package/dist/types/value/timestamp.d.ts.map +1 -1
  515. package/dist/types/value/title.d.cts +1 -3
  516. package/dist/types/value/title.d.cts.map +1 -1
  517. package/dist/types/value/title.d.ts +1 -3
  518. package/dist/types/value/title.d.ts.map +1 -1
  519. package/dist/types/value/types.d.cts +6 -8
  520. package/dist/types/value/types.d.cts.map +1 -1
  521. package/dist/types/value/types.d.ts +6 -8
  522. package/dist/types/value/types.d.ts.map +1 -1
  523. package/dist/types/webhook/apiUpdate.d.cts +1 -3
  524. package/dist/types/webhook/apiUpdate.d.cts.map +1 -1
  525. package/dist/types/webhook/apiUpdate.d.ts +1 -3
  526. package/dist/types/webhook/apiUpdate.d.ts.map +1 -1
  527. package/dist/types/webhook/testTrigger.d.cts +1 -3
  528. package/dist/types/webhook/testTrigger.d.cts.map +1 -1
  529. package/dist/types/webhook/testTrigger.d.ts +1 -3
  530. package/dist/types/webhook/testTrigger.d.ts.map +1 -1
  531. package/dist/types/webhook/types.cjs.map +1 -1
  532. package/dist/types/webhook/types.d.cts +3 -5
  533. package/dist/types/webhook/types.d.cts.map +1 -1
  534. package/dist/types/webhook/types.d.ts +3 -5
  535. package/dist/types/webhook/types.d.ts.map +1 -1
  536. package/dist/types/webhook/types.js.map +1 -1
  537. package/package.json +11 -11
  538. package/src/Client.ts +20 -2
  539. package/src/WriteClient.ts +14 -19
  540. package/src/lib/resolveMigrationDocumentData.ts +1 -1
  541. package/src/types/api/migration/release.ts +2 -5
@@ -1 +1 @@
1
- {"version":3,"file":"isFilled.d.ts","names":[],"sources":["../../src/helpers/isFilled.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAoDa,QAAA,GACZ,KAAA,EAAO,aAAA,wBACL,KAAA,IAAS,aAAA;;;;;;;cAgBC,KAAA,GACZ,KAAA,EAAO,UAAA,wBACH,KAAA,IAAS,UAAA;;;;;;;cAQD,cAAA,GACZ,SAAA,EAAW,eAAA,wBACT,SAAA,IAAa,eAAA;;;;;;;cAUH,KAAA,iDACZ,KAAA,EAAO,UAAA,CAAW,cAAA,yBACd,KAAA,IAAS,UAAA,CAAW,cAAA;;;;;;;cAQZ,IAAA,+DAGU,MAAA,SAAe,eAAA,GAAkB,UAAA,GAAa,SAAA,uBAGpE,KAAA,EAAO,SAAA,CAAU,QAAA,EAAU,QAAA,EAAU,aAAA,yBACnC,KAAA,IAAS,SAAA,CAAU,QAAA,EAAU,QAAA,EAAU,aAAA;;;AAvC1C;;;;cAiDa,WAAA,GACZ,KAAA,EAAO,gBAAA,wBACH,KAAA,IAAS,gBAAA;;;;;;AAzCd;cAiDa,mBAAA,iBAA6C,wBAAA,EACzD,KAAA,EAAO,KAAA,wBACH,KAAA,IAAS,OAAA,CAAQ,KAAA,EAAO,6BAAA;;;;;;;cAQhB,IAAA,GACZ,KAAA,EAAO,SAAA,wBACH,KAAA,IAAS,SAAA;;AAjDd;;;;;cAyDa,SAAA,GACZ,KAAA,EAAO,cAAA,wBACH,KAAA,IAAS,cAAA;;;;;;;cAQD,KAAA,GACZ,KAAA,EAAO,UAAA,wBACH,KAAA,IAAS,UAAA;;;;;;AA3Dd;cAmEa,MAAA,GACZ,KAAA,EAAO,WAAA,wBACH,KAAA,IAAS,WAAA;;;;;;;cAQD,OAAA,GACZ,KAAA,EAAO,YAAA,wBACL,KAAA,IAAS,YAAA;;;;;;;cAUC,MAAA,wBACZ,KAAA,EAAO,WAAA,CAAY,IAAA,yBACf,KAAA,IAAS,WAAA,CAAY,IAAA;;;;;;;cAQb,KAAA,iBAAuB,UAAA,CAAW,SAAA,GAC9C,KAAA,EAAO,KAAA,wBACL,KAAA,IAAS,OAAA,CAAQ,KAAA,EAAO,UAAA,CAAW,SAAA;;;;;;;cAUzB,QAAA,GACZ,KAAA,EAAO,aAAA,wBACL,KAAA,IAAS,aAAA;;;;;;;cAUC,KAAA,GACZ,KAAA,EAAO,UAAA,wBACH,KAAA,IAAS,UAAA;;;;;;;cAQD,WAAA,gBAA4C,oBAAA,EACxD,KAAA,EAAO,gBAAA,CAAiB,IAAA,yBACpB,KAAA,IAAS,gBAAA,CAAiB,IAAA;;cAGlB,gBAAA,gBAL4C,oBAAA,EAAoB,KAAA,EACrE,gBAAA,CAAiB,IAAA,yBACpB,KAAA,IAAS,gBAAA,CAAiB,IAAA;AA5G/B;AAAA,cAkHa,iBAAA,gBAR4C,oBAAA,EAAoB,KAAA,EACrE,gBAAA,CAAiB,IAAA,yBACpB,KAAA,IAAS,gBAAA,CAAiB,IAAA;;;;;;;;cAelB,UAAA,aAAwB,SAAA,EACpC,UAAA,EAAY,UAAA,CAAW,CAAA,yBACrB,UAAA,IAAc,UAAA,CAAW,CAAA;;;;;;;cAUf,KAAA,kBAAwB,MAAA,SAAe,eAAA,GAAkB,gBAAA,GACrE,KAAA,EAAO,UAAA,CAAW,MAAA,yBAChB,KAAA,IAAS,UAAA,CAAW,MAAA;;;;AA/HvB;;;;cA0Ia,SAAA,kBAA4B,KAAA,GAAQ,WAAA,EAChD,MAAA,EAAQ,SAAA,CAAU,MAAA,yBAChB,MAAA,IAAU,SAAA,CAAU,MAAA"}
1
+ {"version":3,"file":"isFilled.d.ts","names":[],"sources":["../../src/helpers/isFilled.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoDa,WAAQ,OACb,qCACL,SAAS;;;;;;;qBAgBC,QACZ,OAAO,kCACH,SAAS;;;;;;;qBAQD,iBAAc,WACf,uCACT,aAAa;;;;;;;qBAUH,QAA2B,8CACvC,OAAO,WAAW,uCACd,SAAS,WAAW;;;;;;;qBAQZ,OACZ,mBACA,mBACA,sBAAsB,eAAe,kBAAkB,aAAa,gCAC5D,OAED,UAAU,UAAU,UAAU,sCACnC,SAAS,UAAU,UAAU,UAAU;;;;;;;qBAU7B,cACZ,OAAO,wCACH,SAAS;;;;;;;qBAQD,sBAA+B,cAAc,0BACzD,OAAO,6BACH,SAAS,QAAQ,OAAO;;;;;;;qBAQhB,OACZ,OAAO,iCACH,SAAS;;;;;;;qBAQD,YACZ,OAAO,sCACH,SAAS;;;;;;;qBAQD,QACZ,OAAO,kCACH,SAAS;;;;;;;qBAQD,SACZ,OAAO,mCACH,SAAS;;;;;;;qBAQD,UAAO,OACZ,oCACL,SAAS;;;;;;;qBAUC,SAA0B,qBACtC,OAAO,YAAY,6BACf,SAAS,YAAY;;;;;;;qBAQb,QAAS,cAAc,WAAW,YAAU,OACjD,6BACL,SAAS,QAAQ,OAAO,WAAW;;;;;;;qBAUzB,WAAQ,OACb,qCACL,SAAS;;;;;;;qBAUC,QACZ,OAAO,kCACH,SAAS;;;;;;;qBAQD,cAA+B,aAAa,sBACxD,OAAO,iBAAiB,6BACpB,SAAS,iBAAiB;;qBAGlB,mBAL+B,aAAa,sBAAoB,OACrE,iBAAiB,6BACpB,SAAS,iBAAiB;;qBAMlB,oBAR+B,aAAa,sBAAoB,OACrE,iBAAiB,6BACpB,SAAS,iBAAiB;;;;;;;;qBAelB,aAAc,UAAU,WAAS,YACjC,WAAW,0BACrB,cAAc,WAAW;;;;;;;qBAUf,QAAS,eAAe,eAAe,kBAAkB,mBAAiB,OAC/E,WAAW,+BAChB,SAAS,WAAW;;;;;;;;qBAWV,YAAa,eAAe,QAAQ,aAAW,QACnD,UAAU,+BAChB,UAAU,UAAU"}
@@ -210,6 +210,6 @@ const sliceZone = (slices) => {
210
210
  return isNonNullish(slices) && isNonEmptyArray(slices);
211
211
  };
212
212
  //#endregion
213
- export { imageThumbnail, isFilled_exports, link };
213
+ export { color, contentRelationship, date, embed, geoPoint, group, image, imageThumbnail, integration, integrationField, integrationFields, isFilled_exports, keyText, link, linkToMedia, number, repeatable, richText, select, sliceZone, table, timestamp, title };
214
214
 
215
215
  //# sourceMappingURL=isFilled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isFilled.js","names":[],"sources":["../../src/helpers/isFilled.ts"],"sourcesContent":["import type { ColorField } from \"../types/value/color\"\nimport type {\n\tContentRelationshipField,\n\tEmptyContentRelationshipField,\n} from \"../types/value/contentRelationship\"\nimport type { DateField } from \"../types/value/date\"\nimport type { AnyOEmbed, EmbedField } from \"../types/value/embed\"\nimport type { GeoPointField } from \"../types/value/geoPoint\"\nimport type { GroupField, NestedGroupField } from \"../types/value/group\"\nimport type { ImageField, ImageFieldImage } from \"../types/value/image\"\nimport type { IntegrationField, IntegrationFieldData } from \"../types/value/integration\"\nimport type { KeyTextField } from \"../types/value/keyText\"\nimport type { LinkField } from \"../types/value/link\"\nimport type { LinkToMediaField } from \"../types/value/linkToMedia\"\nimport type { NumberField } from \"../types/value/number\"\nimport type { RichTextField } from \"../types/value/richText\"\nimport type { SelectField } from \"../types/value/select\"\nimport type { SharedSlice } from \"../types/value/sharedSlice\"\nimport type { Slice } from \"../types/value/slice\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { TableField } from \"../types/value/table\"\nimport type { TimestampField } from \"../types/value/timestamp\"\nimport type { TitleField } from \"../types/value/title\"\nimport type { AnyRegularField, Repeatable } from \"../types/value/types\"\n\n/**\n * Determines if a value is not nullish (i.e. not `null` or `undefined`). This is used to check if\n * nullable field values are filled.\n *\n * @param input - The value to check.\n * @returns `true` if `input` is not nullish, `false` otherwise.\n */\nconst isNonNullish = <T>(input: T): input is NonNullable<T> => {\n\treturn input != null\n}\n\n/**\n * Determines if an array is not empty. This is used to check if array-based fields are filled.\n *\n * @param input - The array to check.\n * @returns `true` if `input` has at least one element, `false` otherwise.\n */\nconst isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {\n\treturn !!input.length\n}\n\n/**\n * Determines if a rich text field is filled.\n *\n * @param field - Rich text field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const richText = (\n\tfield: RichTextField | null | undefined,\n): field is RichTextField<\"filled\"> => {\n\tif (!isNonNullish(field)) {\n\t\treturn false\n\t} else if (field.length === 1 && \"text\" in field[0]) {\n\t\treturn !!field[0].text\n\t} else {\n\t\treturn !!field.length\n\t}\n}\n\n/**\n * Determines if a title field is filled.\n *\n * @param field - Title field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const title = richText as (\n\tfield: TitleField | null | undefined,\n) => field is TitleField<\"filled\">\n\n/**\n * Determines if an image thumbnail is filled.\n *\n * @param thumbnail - Image thumbnail to check.\n * @returns `true` if the thumbnail is filled, `false` otherwise.\n */\nexport const imageThumbnail = (\n\tthumbnail: ImageFieldImage | null | undefined,\n): thumbnail is ImageFieldImage<\"filled\"> => {\n\treturn isNonNullish(thumbnail) && !!thumbnail.url\n}\n\n/**\n * Determines if an image field is filled.\n *\n * @param field - Image field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <ThumbnailNames extends string | null = never>(\n\tfield: ImageField<ThumbnailNames> | null | undefined,\n) => field is ImageField<ThumbnailNames, \"filled\">\n\n/**\n * Determines if a link field is filled.\n *\n * @param field - Link field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown =\n\t\tunknown,\n>(\n\tfield: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined,\n): field is LinkField<TypeEnum, LangEnum, DataInterface, \"filled\"> => {\n\treturn isNonNullish(field) && (\"id\" in field || \"url\" in field)\n}\n\n/**\n * Determines if a link to media field is filled.\n *\n * @param field - Link to media field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const linkToMedia = link as (\n\tfield: LinkToMediaField | null | undefined,\n) => field is LinkToMediaField<\"filled\">\n\n/**\n * Determines if a content relationship field is filled.\n *\n * @param field - Content relationship field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <Field extends ContentRelationshipField>(\n\tfield: Field | null | undefined,\n) => field is Exclude<Field, EmptyContentRelationshipField>\n\n/**\n * Determines if a date field is filled.\n *\n * @param field - Date field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const date = isNonNullish as (\n\tfield: DateField | null | undefined,\n) => field is DateField<\"filled\">\n\n/**\n * Determines if a timestamp field is filled.\n *\n * @param field - Timestamp field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const timestamp = isNonNullish as (\n\tfield: TimestampField | null | undefined,\n) => field is TimestampField<\"filled\">\n\n/**\n * Determines if a color field is filled.\n *\n * @param field - Color field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const color = isNonNullish as (\n\tfield: ColorField | null | undefined,\n) => field is ColorField<\"filled\">\n\n/**\n * Determines if a number field is filled.\n *\n * @param field - Number field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const number = isNonNullish as (\n\tfield: NumberField | null | undefined,\n) => field is NumberField<\"filled\">\n\n/**\n * Determines if a key text field is filled.\n *\n * @param field - Key text field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn !!field\n}\n\n/**\n * Determines if a select field is filled.\n *\n * @param field - Select field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const select = isNonNullish as <Enum extends string>(\n\tfield: SelectField<Enum> | null | undefined,\n) => field is SelectField<Enum, \"filled\">\n\n/**\n * Determines if an embed field is filled.\n *\n * @param field - Embed field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const embed = <Field extends EmbedField<AnyOEmbed>>(\n\tfield: Field | null | undefined,\n): field is Extract<Field, EmbedField<AnyOEmbed, \"filled\">> => {\n\treturn isNonNullish(field) && !!field.embed_url\n}\n\n/**\n * Determines if a geopoint field is filled.\n *\n * @param field - Geopoint field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const geoPoint = (\n\tfield: GeoPointField | null | undefined,\n): field is GeoPointField<\"filled\"> => {\n\treturn isNonNullish(field) && \"longitude\" in field\n}\n\n/**\n * Determines if a table field is filled.\n *\n * @param field - Table field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const table = isNonNullish as (\n\tfield: TableField | null | undefined,\n) => field is TableField<\"filled\">\n\n/**\n * Determines if an integration field is filled.\n *\n * @param field - Integration field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const integration = isNonNullish as <Data extends IntegrationFieldData>(\n\tfield: IntegrationField<Data> | null | undefined,\n) => field is IntegrationField<Data, \"filled\">\n/** @deprecated Renamed to `integration`. */\n// TODO: Remove when we remove support for deprecated `integrationField` export.\nexport const integrationField = integration\n/** @deprecated Renamed to `integrationField`. */\n// TODO: Remove when we remove support for deprecated `integrationFields` export.\nexport const integrationFields = integration\n\n/**\n * Determines if a repeatable field has at least one item.\n *\n * @param repeatable - Repeatable to check.\n * @returns `true` if `repeatable` contains at least one item, `false`\n * otherwise.\n */\nexport const repeatable = <T extends LinkField>(\n\trepeatable: Repeatable<T> | null | undefined,\n): repeatable is Repeatable<T, \"filled\"> => {\n\treturn isNonNullish(repeatable) && isNonEmptyArray(repeatable)\n}\n\n/**\n * Determines if a group has at least one item.\n *\n * @param group - Group to check.\n * @returns `true` if the group contains at least one item, `false` otherwise.\n */\nexport const group = <Fields extends Record<string, AnyRegularField | NestedGroupField>>(\n\tgroup: GroupField<Fields> | null | undefined,\n): group is GroupField<Fields, \"filled\"> => {\n\treturn isNonNullish(group) && isNonEmptyArray(group)\n}\n\n/**\n * Determines if a slice zone has at least one slice.\n *\n * @param slices - Slice zone to check.\n * @returns `true` if the slice zone contains at least one slice, `false`\n * otherwise.\n */\nexport const sliceZone = <Slices extends Slice | SharedSlice>(\n\tslices: SliceZone<Slices> | null | undefined,\n): slices is SliceZone<Slices, \"filled\"> => {\n\treturn isNonNullish(slices) && isNonEmptyArray(slices)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,gBAAmB,UAAsC;AAC9D,QAAO,SAAS;;;;;;;;AASjB,MAAM,mBAAsB,UAAqC;AAChE,QAAO,CAAC,CAAC,MAAM;;;;;;;;AAShB,MAAa,YACZ,UACsC;AACtC,KAAI,CAAC,aAAa,MAAM,CACvB,QAAO;UACG,MAAM,WAAW,KAAK,UAAU,MAAM,GAChD,QAAO,CAAC,CAAC,MAAM,GAAG;KAElB,QAAO,CAAC,CAAC,MAAM;;;;;;;;AAUjB,MAAa,QAAQ;;;;;;;AAUrB,MAAa,kBACZ,cAC4C;AAC5C,QAAO,aAAa,UAAU,IAAI,CAAC,CAAC,UAAU;;;;;;;;AAS/C,MAAa,QAAQ;;;;;;;AAUrB,MAAa,QAMZ,UACqE;AACrE,QAAO,aAAa,MAAM,KAAK,QAAQ,SAAS,SAAS;;;;;;;;AAS1D,MAAa,cAAc;;;;;;;AAU3B,MAAa,sBAAsB;;;;;;;AAUnC,MAAa,OAAO;;;;;;;AAUpB,MAAa,YAAY;;;;;;;AAUzB,MAAa,QAAQ;;;;;;;AAUrB,MAAa,SAAS;;;;;;;AAUtB,MAAa,WACZ,UACqC;AACrC,QAAO,CAAC,CAAC;;;;;;;;AASV,MAAa,SAAS;;;;;;;AAUtB,MAAa,SACZ,UAC8D;AAC9D,QAAO,aAAa,MAAM,IAAI,CAAC,CAAC,MAAM;;;;;;;;AASvC,MAAa,YACZ,UACsC;AACtC,QAAO,aAAa,MAAM,IAAI,eAAe;;;;;;;;AAS9C,MAAa,QAAQ;;;;;;;AAUrB,MAAa,cAAc;;AAK3B,MAAa,mBAAmB;;AAGhC,MAAa,oBAAoB;;;;;;;;AASjC,MAAa,cACZ,eAC2C;AAC3C,QAAO,aAAa,WAAW,IAAI,gBAAgB,WAAW;;;;;;;;AAS/D,MAAa,SACZ,UAC2C;AAC3C,QAAO,aAAa,MAAM,IAAI,gBAAgB,MAAM;;;;;;;;;AAUrD,MAAa,aACZ,WAC2C;AAC3C,QAAO,aAAa,OAAO,IAAI,gBAAgB,OAAO"}
1
+ {"version":3,"file":"isFilled.js","names":[],"sources":["../../src/helpers/isFilled.ts"],"sourcesContent":["import type { ColorField } from \"../types/value/color\"\nimport type {\n\tContentRelationshipField,\n\tEmptyContentRelationshipField,\n} from \"../types/value/contentRelationship\"\nimport type { DateField } from \"../types/value/date\"\nimport type { AnyOEmbed, EmbedField } from \"../types/value/embed\"\nimport type { GeoPointField } from \"../types/value/geoPoint\"\nimport type { GroupField, NestedGroupField } from \"../types/value/group\"\nimport type { ImageField, ImageFieldImage } from \"../types/value/image\"\nimport type { IntegrationField, IntegrationFieldData } from \"../types/value/integration\"\nimport type { KeyTextField } from \"../types/value/keyText\"\nimport type { LinkField } from \"../types/value/link\"\nimport type { LinkToMediaField } from \"../types/value/linkToMedia\"\nimport type { NumberField } from \"../types/value/number\"\nimport type { RichTextField } from \"../types/value/richText\"\nimport type { SelectField } from \"../types/value/select\"\nimport type { SharedSlice } from \"../types/value/sharedSlice\"\nimport type { Slice } from \"../types/value/slice\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { TableField } from \"../types/value/table\"\nimport type { TimestampField } from \"../types/value/timestamp\"\nimport type { TitleField } from \"../types/value/title\"\nimport type { AnyRegularField, Repeatable } from \"../types/value/types\"\n\n/**\n * Determines if a value is not nullish (i.e. not `null` or `undefined`). This is used to check if\n * nullable field values are filled.\n *\n * @param input - The value to check.\n * @returns `true` if `input` is not nullish, `false` otherwise.\n */\nconst isNonNullish = <T>(input: T): input is NonNullable<T> => {\n\treturn input != null\n}\n\n/**\n * Determines if an array is not empty. This is used to check if array-based fields are filled.\n *\n * @param input - The array to check.\n * @returns `true` if `input` has at least one element, `false` otherwise.\n */\nconst isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {\n\treturn !!input.length\n}\n\n/**\n * Determines if a rich text field is filled.\n *\n * @param field - Rich text field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const richText = (\n\tfield: RichTextField | null | undefined,\n): field is RichTextField<\"filled\"> => {\n\tif (!isNonNullish(field)) {\n\t\treturn false\n\t} else if (field.length === 1 && \"text\" in field[0]) {\n\t\treturn !!field[0].text\n\t} else {\n\t\treturn !!field.length\n\t}\n}\n\n/**\n * Determines if a title field is filled.\n *\n * @param field - Title field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const title = richText as (\n\tfield: TitleField | null | undefined,\n) => field is TitleField<\"filled\">\n\n/**\n * Determines if an image thumbnail is filled.\n *\n * @param thumbnail - Image thumbnail to check.\n * @returns `true` if the thumbnail is filled, `false` otherwise.\n */\nexport const imageThumbnail = (\n\tthumbnail: ImageFieldImage | null | undefined,\n): thumbnail is ImageFieldImage<\"filled\"> => {\n\treturn isNonNullish(thumbnail) && !!thumbnail.url\n}\n\n/**\n * Determines if an image field is filled.\n *\n * @param field - Image field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <ThumbnailNames extends string | null = never>(\n\tfield: ImageField<ThumbnailNames> | null | undefined,\n) => field is ImageField<ThumbnailNames, \"filled\">\n\n/**\n * Determines if a link field is filled.\n *\n * @param field - Link field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown =\n\t\tunknown,\n>(\n\tfield: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined,\n): field is LinkField<TypeEnum, LangEnum, DataInterface, \"filled\"> => {\n\treturn isNonNullish(field) && (\"id\" in field || \"url\" in field)\n}\n\n/**\n * Determines if a link to media field is filled.\n *\n * @param field - Link to media field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const linkToMedia = link as (\n\tfield: LinkToMediaField | null | undefined,\n) => field is LinkToMediaField<\"filled\">\n\n/**\n * Determines if a content relationship field is filled.\n *\n * @param field - Content relationship field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <Field extends ContentRelationshipField>(\n\tfield: Field | null | undefined,\n) => field is Exclude<Field, EmptyContentRelationshipField>\n\n/**\n * Determines if a date field is filled.\n *\n * @param field - Date field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const date = isNonNullish as (\n\tfield: DateField | null | undefined,\n) => field is DateField<\"filled\">\n\n/**\n * Determines if a timestamp field is filled.\n *\n * @param field - Timestamp field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const timestamp = isNonNullish as (\n\tfield: TimestampField | null | undefined,\n) => field is TimestampField<\"filled\">\n\n/**\n * Determines if a color field is filled.\n *\n * @param field - Color field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const color = isNonNullish as (\n\tfield: ColorField | null | undefined,\n) => field is ColorField<\"filled\">\n\n/**\n * Determines if a number field is filled.\n *\n * @param field - Number field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const number = isNonNullish as (\n\tfield: NumberField | null | undefined,\n) => field is NumberField<\"filled\">\n\n/**\n * Determines if a key text field is filled.\n *\n * @param field - Key text field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn !!field\n}\n\n/**\n * Determines if a select field is filled.\n *\n * @param field - Select field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const select = isNonNullish as <Enum extends string>(\n\tfield: SelectField<Enum> | null | undefined,\n) => field is SelectField<Enum, \"filled\">\n\n/**\n * Determines if an embed field is filled.\n *\n * @param field - Embed field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const embed = <Field extends EmbedField<AnyOEmbed>>(\n\tfield: Field | null | undefined,\n): field is Extract<Field, EmbedField<AnyOEmbed, \"filled\">> => {\n\treturn isNonNullish(field) && !!field.embed_url\n}\n\n/**\n * Determines if a geopoint field is filled.\n *\n * @param field - Geopoint field to check.\n * @returns `true` if the field is filled, `false` otherwise.\n */\nexport const geoPoint = (\n\tfield: GeoPointField | null | undefined,\n): field is GeoPointField<\"filled\"> => {\n\treturn isNonNullish(field) && \"longitude\" in field\n}\n\n/**\n * Determines if a table field is filled.\n *\n * @param field - Table field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const table = isNonNullish as (\n\tfield: TableField | null | undefined,\n) => field is TableField<\"filled\">\n\n/**\n * Determines if an integration field is filled.\n *\n * @param field - Integration field to check.\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const integration = isNonNullish as <Data extends IntegrationFieldData>(\n\tfield: IntegrationField<Data> | null | undefined,\n) => field is IntegrationField<Data, \"filled\">\n/** @deprecated Renamed to `integration`. */\n// TODO: Remove when we remove support for deprecated `integrationField` export.\nexport const integrationField = integration\n/** @deprecated Renamed to `integrationField`. */\n// TODO: Remove when we remove support for deprecated `integrationFields` export.\nexport const integrationFields = integration\n\n/**\n * Determines if a repeatable field has at least one item.\n *\n * @param repeatable - Repeatable to check.\n * @returns `true` if `repeatable` contains at least one item, `false`\n * otherwise.\n */\nexport const repeatable = <T extends LinkField>(\n\trepeatable: Repeatable<T> | null | undefined,\n): repeatable is Repeatable<T, \"filled\"> => {\n\treturn isNonNullish(repeatable) && isNonEmptyArray(repeatable)\n}\n\n/**\n * Determines if a group has at least one item.\n *\n * @param group - Group to check.\n * @returns `true` if the group contains at least one item, `false` otherwise.\n */\nexport const group = <Fields extends Record<string, AnyRegularField | NestedGroupField>>(\n\tgroup: GroupField<Fields> | null | undefined,\n): group is GroupField<Fields, \"filled\"> => {\n\treturn isNonNullish(group) && isNonEmptyArray(group)\n}\n\n/**\n * Determines if a slice zone has at least one slice.\n *\n * @param slices - Slice zone to check.\n * @returns `true` if the slice zone contains at least one slice, `false`\n * otherwise.\n */\nexport const sliceZone = <Slices extends Slice | SharedSlice>(\n\tslices: SliceZone<Slices> | null | undefined,\n): slices is SliceZone<Slices, \"filled\"> => {\n\treturn isNonNullish(slices) && isNonEmptyArray(slices)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,gBAAmB,UAAsC;CAC9D,OAAO,SAAS;AACjB;;;;;;;AAQA,MAAM,mBAAsB,UAAqC;CAChE,OAAO,CAAC,CAAC,MAAM;AAChB;;;;;;;AAQA,MAAa,YACZ,UACsC;CACtC,IAAI,CAAC,aAAa,KAAK,GACtB,OAAO;MACD,IAAI,MAAM,WAAW,KAAK,UAAU,MAAM,IAChD,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;MAElB,OAAO,CAAC,CAAC,MAAM;AAEjB;;;;;;;AAQA,MAAa,QAAQ;;;;;;;AAUrB,MAAa,kBACZ,cAC4C;CAC5C,OAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAC/C;;;;;;;AAQA,MAAa,QAAQ;;;;;;;AAUrB,MAAa,QAMZ,UACqE;CACrE,OAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC1D;;;;;;;AAQA,MAAa,cAAc;;;;;;;AAU3B,MAAa,sBAAsB;;;;;;;AAUnC,MAAa,OAAO;;;;;;;AAUpB,MAAa,YAAY;;;;;;;AAUzB,MAAa,QAAQ;;;;;;;AAUrB,MAAa,SAAS;;;;;;;AAUtB,MAAa,WACZ,UACqC;CACrC,OAAO,CAAC,CAAC;AACV;;;;;;;AAQA,MAAa,SAAS;;;;;;;AAUtB,MAAa,SACZ,UAC8D;CAC9D,OAAO,aAAa,KAAK,KAAK,CAAC,CAAC,MAAM;AACvC;;;;;;;AAQA,MAAa,YACZ,UACsC;CACtC,OAAO,aAAa,KAAK,KAAK,eAAe;AAC9C;;;;;;;AAQA,MAAa,QAAQ;;;;;;;AAUrB,MAAa,cAAc;;AAK3B,MAAa,mBAAmB;;AAGhC,MAAa,oBAAoB;;;;;;;;AASjC,MAAa,cACZ,eAC2C;CAC3C,OAAO,aAAa,UAAU,KAAK,gBAAgB,UAAU;AAC9D;;;;;;;AAQA,MAAa,SACZ,UAC2C;CAC3C,OAAO,aAAa,KAAK,KAAK,gBAAgB,KAAK;AACpD;;;;;;;;AASA,MAAa,aACZ,WAC2C;CAC3C,OAAO,aAAa,MAAM,KAAK,gBAAgB,MAAM;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"mapSliceZone.cjs","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;AACrD,QAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;AAEvB,MAAI,CAAC,OACJ,QAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;GAAS;EAIpD,IAAI,SAAS,MAAM,OAElB,WACA;AAKD,MAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;AACD,YAAS,aAAa,SAAS,OAAO,UAAU;AAChD,YAAS,MAAM,OAAO,WAAW;;AAGlC,MAAI,gBACH,QAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;GACH;MAED,QAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;GACH;GAED,CACF"}
1
+ {"version":3,"file":"mapSliceZone.cjs","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;CACrD,OAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;EAEvB,IAAI,CAAC,QACJ,OAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;EAAQ;EAInD,IAAI,SAAS,MAAM,OAElB,UACD;EAKA,IAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;GACD,SAAS,aAAa,SAAS,OAAO,UAAU;GAChD,SAAS,MAAM,OAAO,UAAU;EACjC;EAEA,IAAI,iBACH,OAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;EACJ;OAEA,OAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;EACJ;CAEF,CAAC,CACF;AACD"}
@@ -1,5 +1,4 @@
1
1
  import { Slice } from "../types/value/slice.cjs";
2
-
3
2
  //#region src/helpers/mapSliceZone.d.ts
4
3
  /**
5
4
  * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>
@@ -71,18 +70,22 @@ type MappedSliceLike = {
71
70
  * mappers.
72
71
  */
73
72
  type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
74
- /** Slice data. */slice: TSlice; /** The index of the Slice in the Slice Zone. */
75
- index: number; /** All Slices from the Slice Zone to which the Slice belongs. */
76
- slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>; /** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
73
+ /** Slice data. */
74
+ slice: TSlice;
75
+ /** The index of the Slice in the Slice Zone. */
76
+ index: number;
77
+ /** All Slices from the Slice Zone to which the Slice belongs. */
78
+ slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
79
+ /** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
77
80
  context: TContext;
78
81
  };
79
82
  /** A record of mappers. */
80
- type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>> };
83
+ type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>; };
81
84
  /**
82
85
  * A function that maps a Slice and its metadata to a modified version. The return value will
83
86
  * replace the Slice in the Slice Zone.
84
87
  */
85
- type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
88
+ export type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
86
89
  /** Unwraps a lazily loaded mapper module. */
87
90
  type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
88
91
  default: unknown;
@@ -104,7 +107,6 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
104
107
  * });
105
108
  * ```
106
109
  */
107
- declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
110
+ export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
108
111
  //#endregion
109
- export { SliceMapper, mapSliceZone };
110
112
  //# sourceMappingURL=mapSliceZone.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapSliceZone.d.cts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;AAAiD;;KAM5C,UAAA,YAAsB,OAAA,CAAQ,CAAA;EAAM,OAAA,EAAS,CAAA;AAAA;;KAG7C,eAAA,MAAqB,CAAA,GAAI,UAAA,CAAW,CAAA;AAAA,KAGpC,WAAA,OAAkB,IAAA;;;;;;KAOlB,gBAAA,gBAAgC,SAAA,IAAa,MAAA,SAAe,eAAA,GAC9D,MAAA,iBACA,MAAA,SAAe,gBAAA,GACd,MAAA;;AAhB+C;;;;;KAyB9C,eAAA,uCAAsD,IAAA,CAC1D,KAAA,CAAM,UAAA;;;;;;;KAUF,gBAAA;EACJ,IAAA,EAAM,KAAA,CAAM,UAAA;AAAA;;;;;AA/Bc;;;;KA0CtB,SAAA,uCACF,eAAA,CAAgB,UAAA,IAChB,gBAAA,CAAiB,UAAA;;;;;;;;;KAUf,aAAA,gBAA6B,SAAA,GAAY,SAAA,aAAsB,MAAA;;;;;KAM/D,eAAA;EAlDD;;;AAAM;;EAwDT,QAAA;AAAA;;;;;;;;KAUI,eAAA,gBAA+B,SAAA,GAAY,SAAA;EAxD/B,kBA0DhB,KAAA,EAAO,MAAA,EAhDH;EAmDJ,KAAA,UAnDoB;EA0DpB,MAAA,EAAQ,aAAA,CAAc,MAAA,SAAe,gBAAA,GAAmB,gBAAA,GAAmB,eAAA,GA1DtD;EA6DrB,OAAA,EAAS,QAAA;AAAA;;KAIL,YAAA,gBAA4B,SAAA,GAAY,SAAA,gCACtC,gBAAA,CAAiB,MAAA,KAAW,eAAA,CACjC,WAAA,CACC,OAAA,CAAQ,MAAA,EAAQ,SAAA,CAAU,CAAA,SAG1B,QAAA;;;;;KASS,WAAA,gBACI,SAAA,GAAY,SAAA,uBACN,MAAA,uCAClB,MAAA,6DAIC,IAAA,EAAM,eAAA,CAAgB,MAAA,EAAQ,QAAA,MAAc,YAAA,GAAe,OAAA,CAAQ,YAAA;;KAGnE,4BAAA,sBAEiB,WAAA,aAAwB,UAAA,CAAW,WAAA,KAExD,YAAA,SAAqB,UAAA,CAAW,WAAA,IAC7B,OAAA,CAAQ,UAAA,CAAW,YAAA;EACnB,OAAA;AAAA,IAEC,OAAA,CAAQ,UAAA,CAAW,YAAA,gBACnB,OAAA,CAAQ,UAAA,CAAW,YAAA,KACpB,YAAA;;KAGC,YAAA,oBAEe,SAAA,6BACG,YAAA,CACrB,UAAA,UAIE,UAAA,SAAmB,KAAA,GACpB,UAAA,6BAAuC,aAAA,GACtC,aAAA,CAAc,UAAA,wBAAkC,WAAA,GAC/C,eAAA,CAAgB,UAAA,kBAChB,eAAA,GACA,OAAA,CAAQ,UAAA,CAAW,4BAAA,CAA6B,aAAA,CAAc,UAAA,qBAC9D,UAAA,GACD,UAAA,GACD,UAAA,SAAmB,gBAAA,GAClB,UAAA,uBAAiC,aAAA,GAChC,aAAA,CAAc,UAAA,kBAA4B,WAAA,GACzC,gBAAA,CAAiB,UAAA,YACjB,eAAA,GACA,OAAA,CAAQ,UAAA,CAAW,4BAAA,CAA6B,aAAA,CAAc,UAAA,eAC9D,UAAA,GACD,UAAA;;;;;AAhHyB;;;;;;;;;;;iBAkId,YAAA,oBACI,SAAA,wBACG,YAAA,CAAa,UAAA,EAAY,QAAA,sBAAA,CAG/C,SAAA,EAAW,aAAA,CAAc,UAAA,GACzB,OAAA,EAAS,aAAA,EACT,OAAA,GAAU,QAAA,GACR,OAAA,CAAQ,YAAA,CAAa,UAAA,EAAY,aAAA"}
1
+ {"version":3,"file":"mapSliceZone.d.cts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;;KAMK,WAAW,WAAW,QAAQ;EAAM,SAAS;;;KAG7C,gBAAgB,KAAK,IAAI,WAAW;KAGpC,kBAAkB;;;;;;KAOlB,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASC,gBAAgB,sCAAsC,KAC1D,MAAM;;;;;;;KAUF,iBAAiB;EACrB,MAAM,MAAM;;;;;;;;;;KAWR,UAAU,sCACZ,gBAAgB,cAChB,iBAAiB;;;;;;;;;KAUf,cAAc,eAAe,YAAY,sBAAsB;;;;;KAM/D;;;;;;EAMJ;;;;;;;;;KAUI,gBAAgB,eAAe,YAAY,WAAW;;EAE1D,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;KAIL,aAAa,eAAe,YAAY,WAAW,yBACtD,KAAK,iBAAiB,WAAW,gBACjC,YACC,QAAQ,QAAQ,UAAU,UAG1B;;;;;YASS,YACX,eAAe,YAAY,WAC3B,qBAAqB,6CAClB,4CAGH,uBACI,MAAM,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;;KAGnE,6BAEJ,qBAAqB,wBAAwB,WAAW,gBAExD,qBAAqB,WAAW,eAC7B,QAAQ,WAAW;EACnB;IAEC,QAAQ,WAAW,4BACnB,QAAQ,WAAW,iBACpB;;KAGC,aAEJ,mBAAmB,gBACnB,sBAAsB,aACrB,oBAIE,mBAAmB,QACpB,uCAAuC,gBACtC,cAAc,kCAAkC,cAC/C,gBAAgB,4BAChB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,+BAC9D,aACD,aACD,mBAAmB,mBAClB,iCAAiC,gBAChC,cAAc,4BAA4B,cACzC,iBAAiB,sBACjB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,yBAC9D,aACD;;;;;;;;;;;;;;;;wBAkBW,aACf,mBAAmB,WACnB,sBAAsB,aAAa,YAAY,WAC/C,oBAEA,WAAW,cAAc,aACzB,SAAS,eACT,UAAU,WACR,QAAQ,aAAa,YAAY"}
@@ -1,5 +1,4 @@
1
1
  import { Slice } from "../types/value/slice.js";
2
-
3
2
  //#region src/helpers/mapSliceZone.d.ts
4
3
  /**
5
4
  * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>
@@ -71,18 +70,22 @@ type MappedSliceLike = {
71
70
  * mappers.
72
71
  */
73
72
  type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
74
- /** Slice data. */slice: TSlice; /** The index of the Slice in the Slice Zone. */
75
- index: number; /** All Slices from the Slice Zone to which the Slice belongs. */
76
- slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>; /** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
73
+ /** Slice data. */
74
+ slice: TSlice;
75
+ /** The index of the Slice in the Slice Zone. */
76
+ index: number;
77
+ /** All Slices from the Slice Zone to which the Slice belongs. */
78
+ slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
79
+ /** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
77
80
  context: TContext;
78
81
  };
79
82
  /** A record of mappers. */
80
- type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>> };
83
+ type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>; };
81
84
  /**
82
85
  * A function that maps a Slice and its metadata to a modified version. The return value will
83
86
  * replace the Slice in the Slice Zone.
84
87
  */
85
- type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
88
+ export type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
86
89
  /** Unwraps a lazily loaded mapper module. */
87
90
  type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
88
91
  default: unknown;
@@ -104,7 +107,6 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
104
107
  * });
105
108
  * ```
106
109
  */
107
- declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
110
+ export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
108
111
  //#endregion
109
- export { SliceMapper, mapSliceZone };
110
112
  //# sourceMappingURL=mapSliceZone.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapSliceZone.d.ts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;AAAiD;;KAM5C,UAAA,YAAsB,OAAA,CAAQ,CAAA;EAAM,OAAA,EAAS,CAAA;AAAA;;KAG7C,eAAA,MAAqB,CAAA,GAAI,UAAA,CAAW,CAAA;AAAA,KAGpC,WAAA,OAAkB,IAAA;;;;;;KAOlB,gBAAA,gBAAgC,SAAA,IAAa,MAAA,SAAe,eAAA,GAC9D,MAAA,iBACA,MAAA,SAAe,gBAAA,GACd,MAAA;;AAhB+C;;;;;KAyB9C,eAAA,uCAAsD,IAAA,CAC1D,KAAA,CAAM,UAAA;;;;;;;KAUF,gBAAA;EACJ,IAAA,EAAM,KAAA,CAAM,UAAA;AAAA;;;;;AA/Bc;;;;KA0CtB,SAAA,uCACF,eAAA,CAAgB,UAAA,IAChB,gBAAA,CAAiB,UAAA;;;;;;;;;KAUf,aAAA,gBAA6B,SAAA,GAAY,SAAA,aAAsB,MAAA;;;;;KAM/D,eAAA;EAlDD;;;AAAM;;EAwDT,QAAA;AAAA;;;;;;;;KAUI,eAAA,gBAA+B,SAAA,GAAY,SAAA;EAxD/B,kBA0DhB,KAAA,EAAO,MAAA,EAhDH;EAmDJ,KAAA,UAnDoB;EA0DpB,MAAA,EAAQ,aAAA,CAAc,MAAA,SAAe,gBAAA,GAAmB,gBAAA,GAAmB,eAAA,GA1DtD;EA6DrB,OAAA,EAAS,QAAA;AAAA;;KAIL,YAAA,gBAA4B,SAAA,GAAY,SAAA,gCACtC,gBAAA,CAAiB,MAAA,KAAW,eAAA,CACjC,WAAA,CACC,OAAA,CAAQ,MAAA,EAAQ,SAAA,CAAU,CAAA,SAG1B,QAAA;;;;;KASS,WAAA,gBACI,SAAA,GAAY,SAAA,uBACN,MAAA,uCAClB,MAAA,6DAIC,IAAA,EAAM,eAAA,CAAgB,MAAA,EAAQ,QAAA,MAAc,YAAA,GAAe,OAAA,CAAQ,YAAA;;KAGnE,4BAAA,sBAEiB,WAAA,aAAwB,UAAA,CAAW,WAAA,KAExD,YAAA,SAAqB,UAAA,CAAW,WAAA,IAC7B,OAAA,CAAQ,UAAA,CAAW,YAAA;EACnB,OAAA;AAAA,IAEC,OAAA,CAAQ,UAAA,CAAW,YAAA,gBACnB,OAAA,CAAQ,UAAA,CAAW,YAAA,KACpB,YAAA;;KAGC,YAAA,oBAEe,SAAA,6BACG,YAAA,CACrB,UAAA,UAIE,UAAA,SAAmB,KAAA,GACpB,UAAA,6BAAuC,aAAA,GACtC,aAAA,CAAc,UAAA,wBAAkC,WAAA,GAC/C,eAAA,CAAgB,UAAA,kBAChB,eAAA,GACA,OAAA,CAAQ,UAAA,CAAW,4BAAA,CAA6B,aAAA,CAAc,UAAA,qBAC9D,UAAA,GACD,UAAA,GACD,UAAA,SAAmB,gBAAA,GAClB,UAAA,uBAAiC,aAAA,GAChC,aAAA,CAAc,UAAA,kBAA4B,WAAA,GACzC,gBAAA,CAAiB,UAAA,YACjB,eAAA,GACA,OAAA,CAAQ,UAAA,CAAW,4BAAA,CAA6B,aAAA,CAAc,UAAA,eAC9D,UAAA,GACD,UAAA;;;;;AAhHyB;;;;;;;;;;;iBAkId,YAAA,oBACI,SAAA,wBACG,YAAA,CAAa,UAAA,EAAY,QAAA,sBAAA,CAG/C,SAAA,EAAW,aAAA,CAAc,UAAA,GACzB,OAAA,EAAS,aAAA,EACT,OAAA,GAAU,QAAA,GACR,OAAA,CAAQ,YAAA,CAAa,UAAA,EAAY,aAAA"}
1
+ {"version":3,"file":"mapSliceZone.d.ts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;;KAMK,WAAW,WAAW,QAAQ;EAAM,SAAS;;;KAG7C,gBAAgB,KAAK,IAAI,WAAW;KAGpC,kBAAkB;;;;;;KAOlB,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASC,gBAAgB,sCAAsC,KAC1D,MAAM;;;;;;;KAUF,iBAAiB;EACrB,MAAM,MAAM;;;;;;;;;;KAWR,UAAU,sCACZ,gBAAgB,cAChB,iBAAiB;;;;;;;;;KAUf,cAAc,eAAe,YAAY,sBAAsB;;;;;KAM/D;;;;;;EAMJ;;;;;;;;;KAUI,gBAAgB,eAAe,YAAY,WAAW;;EAE1D,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;KAIL,aAAa,eAAe,YAAY,WAAW,yBACtD,KAAK,iBAAiB,WAAW,gBACjC,YACC,QAAQ,QAAQ,UAAU,UAG1B;;;;;YASS,YACX,eAAe,YAAY,WAC3B,qBAAqB,6CAClB,4CAGH,uBACI,MAAM,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;;KAGnE,6BAEJ,qBAAqB,wBAAwB,WAAW,gBAExD,qBAAqB,WAAW,eAC7B,QAAQ,WAAW;EACnB;IAEC,QAAQ,WAAW,4BACnB,QAAQ,WAAW,iBACpB;;KAGC,aAEJ,mBAAmB,gBACnB,sBAAsB,aACrB,oBAIE,mBAAmB,QACpB,uCAAuC,gBACtC,cAAc,kCAAkC,cAC/C,gBAAgB,4BAChB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,+BAC9D,aACD,aACD,mBAAmB,mBAClB,iCAAiC,gBAChC,cAAc,4BAA4B,cACzC,iBAAiB,sBACjB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,yBAC9D,aACD;;;;;;;;;;;;;;;;wBAkBW,aACf,mBAAmB,WACnB,sBAAsB,aAAa,YAAY,WAC/C,oBAEA,WAAW,cAAc,aACzB,SAAS,eACT,UAAU,WACR,QAAQ,aAAa,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"mapSliceZone.js","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;AACrD,QAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;AAEvB,MAAI,CAAC,OACJ,QAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;GAAS;EAIpD,IAAI,SAAS,MAAM,OAElB,WACA;AAKD,MAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;AACD,YAAS,aAAa,SAAS,OAAO,UAAU;AAChD,YAAS,MAAM,OAAO,WAAW;;AAGlC,MAAI,gBACH,QAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;GACH;MAED,QAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;GACH;GAED,CACF"}
1
+ {"version":3,"file":"mapSliceZone.js","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;CACrD,OAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;EAEvB,IAAI,CAAC,QACJ,OAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;EAAQ;EAInD,IAAI,SAAS,MAAM,OAElB,UACD;EAKA,IAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;GACD,SAAS,aAAa,SAAS,OAAO,UAAU;GAChD,SAAS,MAAM,OAAO,UAAU;EACjC;EAEA,IAAI,iBACH,OAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;EACJ;OAEA,OAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;EACJ;CAEF,CAAC,CACF;AACD"}
package/dist/index.d.cts CHANGED
@@ -90,12 +90,11 @@ import { IntegrationAPIItem, IntegrationAPIResults } from "./types/api/integrati
90
90
  import { WebhookBodyAPIUpdate } from "./types/webhook/apiUpdate.cjs";
91
91
  import { WebhookBodyTestTrigger } from "./types/webhook/testTrigger.cjs";
92
92
  import { WebhookBody, WebhookType } from "./types/webhook/types.cjs";
93
-
94
93
  //#region src/index.d.ts
95
94
  /** @deprecated Renamed to `filter` */
96
95
  declare const predicate: {
97
- at: (path: string, value: string | number | boolean | Date | string[]) => string;
98
- not: (path: string, value: string | number | boolean | Date | string[]) => string;
96
+ at: (path: string, value: string | number | boolean | string[] | Date) => string;
97
+ not: (path: string, value: string | number | boolean | string[] | Date) => string;
99
98
  any: (path: string, values: (string | number | boolean | Date)[]) => string;
100
99
  in: (path: string, values: string[]) => string;
101
100
  fulltext: (path: string, searchTerms: string) => string;
@@ -156,5 +155,5 @@ type IntegrationFields = IntegrationField;
156
155
  /** @deprecated Renamed to `CustomTypeModelIntegrationField`. */
157
156
  type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
158
157
  //#endregion
159
- export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
158
+ export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, type CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
160
159
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,qBAAA,SAAqB,YAAA;;KAWtB,iBAAA,GAAoB,yBAAA;;KAEpB,sBAAA,GAAyB,8BAAA;;cAiCxB,OAAA;EAAA;;;;;;;;;;;;;;;;;;;;;KAiGD,iBAAA,GAAoB,gBAAA;;KAoEpB,qCAAA,GAAwC,+BAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,8BAAqB;;KAWtB,oBAAoB;;KAEpB,yBAAyB;;cAiCxB;;;;;;;;;;;;;;;;;;;;;;KAiGD,oBAAoB;;KAoEpB,wCAAwC"}
package/dist/index.d.ts CHANGED
@@ -90,12 +90,11 @@ import { IntegrationAPIItem, IntegrationAPIResults } from "./types/api/integrati
90
90
  import { WebhookBodyAPIUpdate } from "./types/webhook/apiUpdate.js";
91
91
  import { WebhookBodyTestTrigger } from "./types/webhook/testTrigger.js";
92
92
  import { WebhookBody, WebhookType } from "./types/webhook/types.js";
93
-
94
93
  //#region src/index.d.ts
95
94
  /** @deprecated Renamed to `filter` */
96
95
  declare const predicate: {
97
- at: (path: string, value: string | number | boolean | Date | string[]) => string;
98
- not: (path: string, value: string | number | boolean | Date | string[]) => string;
96
+ at: (path: string, value: string | number | boolean | string[] | Date) => string;
97
+ not: (path: string, value: string | number | boolean | string[] | Date) => string;
99
98
  any: (path: string, values: (string | number | boolean | Date)[]) => string;
100
99
  in: (path: string, values: string[]) => string;
101
100
  fulltext: (path: string, searchTerms: string) => string;
@@ -156,5 +155,5 @@ type IntegrationFields = IntegrationField;
156
155
  /** @deprecated Renamed to `CustomTypeModelIntegrationField`. */
157
156
  type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
158
157
  //#endregion
159
- export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
158
+ export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, type CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
160
159
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,qBAAA,SAAqB,YAAA;;KAWtB,iBAAA,GAAoB,yBAAA;;KAEpB,sBAAA,GAAyB,8BAAA;;cAiCxB,OAAA;EAAA;;;;;;;;;;;;;;;;;;;;;KAiGD,iBAAA,GAAoB,gBAAA;;KAoEpB,qCAAA,GAAwC,+BAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,8BAAqB;;KAWtB,oBAAoB;;KAEpB,yBAAyB;;cAiCxB;;;;;;;;;;;;;;;;;;;;;;KAiGD,oBAAoB;;KAoEpB,wCAAwC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryEndpoint.cjs","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;AAC/D,KAAI;AACH,MAAI,IAAI,MAAM;AAEd,SAAO;SACA;AACP,SAAO"}
1
+ {"version":3,"file":"isRepositoryEndpoint.cjs","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;CAC/D,IAAI;EACH,IAAI,IAAI,KAAK;EAEb,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD"}
@@ -7,7 +7,6 @@
7
7
  * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
8
8
  * otherwise.
9
9
  */
10
- declare const isRepositoryEndpoint: (input: string) => boolean;
10
+ export declare const isRepositoryEndpoint: (input: string) => boolean;
11
11
  //#endregion
12
- export { isRepositoryEndpoint };
13
12
  //# sourceMappingURL=isRepositoryEndpoint.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryEndpoint.d.cts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;AAQA;;;;;;;cAAa,oBAAA,GAAwB,KAAA"}
1
+ {"version":3,"file":"isRepositoryEndpoint.d.cts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;;;;;;;;qBAQa,uBAAoB"}
@@ -7,7 +7,6 @@
7
7
  * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
8
8
  * otherwise.
9
9
  */
10
- declare const isRepositoryEndpoint: (input: string) => boolean;
10
+ export declare const isRepositoryEndpoint: (input: string) => boolean;
11
11
  //#endregion
12
- export { isRepositoryEndpoint };
13
12
  //# sourceMappingURL=isRepositoryEndpoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryEndpoint.d.ts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;AAQA;;;;;;;cAAa,oBAAA,GAAwB,KAAA"}
1
+ {"version":3,"file":"isRepositoryEndpoint.d.ts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;;;;;;;;qBAQa,uBAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryEndpoint.js","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;AAC/D,KAAI;AACH,MAAI,IAAI,MAAM;AAEd,SAAO;SACA;AACP,SAAO"}
1
+ {"version":3,"file":"isRepositoryEndpoint.js","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;CAC/D,IAAI;EACH,IAAI,IAAI,KAAK;EAEb,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryName.cjs","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;AAC3D,QAAO,2CAA2C,KAAK,MAAM"}
1
+ {"version":3,"file":"isRepositoryName.cjs","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;CAC3D,OAAO,2CAA2C,KAAK,KAAK;AAC7D"}
@@ -6,7 +6,6 @@
6
6
  * @returns `true` if `input` is a valid Prismic repository name, `false`
7
7
  * otherwise.
8
8
  */
9
- declare const isRepositoryName: (input: string) => boolean;
9
+ export declare const isRepositoryName: (input: string) => boolean;
10
10
  //#endregion
11
- export { isRepositoryName };
12
11
  //# sourceMappingURL=isRepositoryName.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryName.d.cts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;AAOA;;;;;;cAAa,gBAAA,GAAoB,KAAA"}
1
+ {"version":3,"file":"isRepositoryName.d.cts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;;;;;;;qBAOa,mBAAgB"}
@@ -6,7 +6,6 @@
6
6
  * @returns `true` if `input` is a valid Prismic repository name, `false`
7
7
  * otherwise.
8
8
  */
9
- declare const isRepositoryName: (input: string) => boolean;
9
+ export declare const isRepositoryName: (input: string) => boolean;
10
10
  //#endregion
11
- export { isRepositoryName };
12
11
  //# sourceMappingURL=isRepositoryName.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryName.d.ts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;AAOA;;;;;;cAAa,gBAAA,GAAoB,KAAA"}
1
+ {"version":3,"file":"isRepositoryName.d.ts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;;;;;;;qBAOa,mBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"isRepositoryName.js","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;AAC3D,QAAO,2CAA2C,KAAK,MAAM"}
1
+ {"version":3,"file":"isRepositoryName.js","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;CAC3D,OAAO,2CAA2C,KAAK,KAAK;AAC7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,mCAAmCA,gBAAAA,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,mCAAmCA,gBAAAA,QAAQ,GAAG;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,mCAAmC,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,mCAAmC,QAAQ,GAAG;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"escapeHTML.cjs","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \"&quot;\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&amp;\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"&#39;\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"&lt;\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \"&gt;\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,IAAI;AAEvC,KAAI,CAAC,MACJ,QAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;AAEhB,MAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;AACtD,UAAQ,IAAI,WAAW,MAAM,EAA7B;GACC,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,QACC;;AAGF,MAAI,cAAc,MACjB,SAAQ,IAAI,UAAU,WAAW,MAAM;AAGxC,cAAY,QAAQ;AACpB,UAAQ;;AAGT,QAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,MAAM,GAAG"}
1
+ {"version":3,"file":"escapeHTML.cjs","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \"&quot;\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&amp;\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"&#39;\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"&lt;\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \"&gt;\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,GAAG;CAEtC,IAAI,CAAC,OACJ,OAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;CAEhB,KAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;EACtD,QAAQ,IAAI,WAAW,KAAK,GAA5B;GACC,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,SACC;EACF;EAEA,IAAI,cAAc,OACjB,QAAQ,IAAI,UAAU,WAAW,KAAK;EAGvC,YAAY,QAAQ;EACpB,QAAQ;CACT;CAEA,OAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,KAAK,IAAI;AACvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"escapeHTML.js","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \"&quot;\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&amp;\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"&#39;\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"&lt;\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \"&gt;\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,IAAI;AAEvC,KAAI,CAAC,MACJ,QAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;AAEhB,MAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;AACtD,UAAQ,IAAI,WAAW,MAAM,EAA7B;GACC,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,KAAK;AACJ,aAAS;AACT;GACD,QACC;;AAGF,MAAI,cAAc,MACjB,SAAQ,IAAI,UAAU,WAAW,MAAM;AAGxC,cAAY,QAAQ;AACpB,UAAQ;;AAGT,QAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,MAAM,GAAG"}
1
+ {"version":3,"file":"escapeHTML.js","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \"&quot;\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&amp;\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"&#39;\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"&lt;\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \"&gt;\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,GAAG;CAEtC,IAAI,CAAC,OACJ,OAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;CAEhB,KAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;EACtD,QAAQ,IAAI,WAAW,KAAK,GAA5B;GACC,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,SACC;EACF;EAEA,IAAI,cAAc,OACjB,QAAQ,IAAI,UAAU,WAAW,KAAK;EAGvC,YAAY,QAAQ;EACpB,QAAQ;CACT;CAEA,OAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,KAAK,IAAI;AACvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"getOptionalLinkProperties.cjs","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,EAAE;AAEtC,KAAI,UAAU,MACb,KAAI,OAAO,MAAM;AAGlB,KAAI,aAAa,MAChB,KAAI,UAAU,MAAM;AAGrB,QAAO"}
1
+ {"version":3,"file":"getOptionalLinkProperties.cjs","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,CAAC;CAErC,IAAI,UAAU,OACb,IAAI,OAAO,MAAM;CAGlB,IAAI,aAAa,OAChB,IAAI,UAAU,MAAM;CAGrB,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"getOptionalLinkProperties.js","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,EAAE;AAEtC,KAAI,UAAU,MACb,KAAI,OAAO,MAAM;AAGlB,KAAI,aAAa,MAChB,KAAI,UAAU,MAAM;AAGrB,QAAO"}
1
+ {"version":3,"file":"getOptionalLinkProperties.js","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,CAAC;CAErC,IAAI,UAAU,OACb,IAAI,OAAO,MAAM;CAGlB,IAAI,aAAa,OAChB,IAAI,UAAU,MAAM;CAGrB,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;AAC5C,QAAO,MAAM,QAAQ,QAAQ,IAAI;;;;;;;;AASlC,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAI;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAAA,sBAErB;AAC/B,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
1
+ {"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;CAC5C,OAAO,MAAM,QAAQ,QAAQ,GAAG;AACjC;;;;;;;AAQA,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,IAAI;CAEpC,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,GAAG;EAG9B,IAFa,UAAU,MAAM,EAAE,CAAC,CAAC,QAAQ,QAAQ,GAE1C,MAAA,sBAAyB;GAC/B,QAAQ,UAAU,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;GAC1C;EACD;CACD;CAEA,OAAO;AACR"}