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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (480) hide show
  1. package/dist/index.cjs +3880 -92
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +4424 -0
  4. package/dist/index.d.mts +4424 -0
  5. package/dist/index.d.ts +4349 -128
  6. package/dist/index.mjs +3837 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/dist/richtext/index.cjs +244 -0
  9. package/dist/richtext/index.cjs.map +1 -0
  10. package/dist/richtext/index.d.cts +78 -0
  11. package/dist/richtext/index.d.mts +78 -0
  12. package/dist/richtext/index.d.ts +78 -7
  13. package/dist/richtext/index.mjs +237 -0
  14. package/dist/richtext/index.mjs.map +1 -0
  15. package/dist/shared/client.TSGr56lO.d.cts +899 -0
  16. package/dist/shared/client.TSGr56lO.d.mts +899 -0
  17. package/dist/shared/client.TSGr56lO.d.ts +899 -0
  18. package/package.json +19 -42
  19. package/src/buildQueryURL.ts +29 -21
  20. package/src/createClient.ts +11 -8
  21. package/src/getRepositoryEndpoint.ts +9 -2
  22. package/src/helpers/asDate.ts +11 -4
  23. package/src/helpers/asHTML.ts +34 -26
  24. package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
  25. package/src/helpers/asImageSrc.ts +11 -10
  26. package/src/helpers/asImageWidthSrcSet.ts +18 -17
  27. package/src/helpers/asLink.ts +33 -32
  28. package/src/helpers/asLinkAttrs.ts +6 -9
  29. package/src/helpers/asText.ts +20 -10
  30. package/src/helpers/isFilled.ts +15 -14
  31. package/src/helpers/mapSliceZone.ts +10 -10
  32. package/src/index.ts +2 -2
  33. package/src/isRepositoryEndpoint.ts +2 -2
  34. package/src/richtext/asText.ts +5 -5
  35. package/src/richtext/serialize.ts +8 -8
  36. package/src/richtext/types.ts +6 -6
  37. package/src/types/migration/Asset.ts +10 -2
  38. package/src/types/model/types.ts +0 -2
  39. package/dist/Client.cjs +0 -1274
  40. package/dist/Client.cjs.map +0 -1
  41. package/dist/Client.d.ts +0 -981
  42. package/dist/Client.js +0 -1274
  43. package/dist/Client.js.map +0 -1
  44. package/dist/Migration.cjs +0 -315
  45. package/dist/Migration.cjs.map +0 -1
  46. package/dist/Migration.d.ts +0 -213
  47. package/dist/Migration.js +0 -315
  48. package/dist/Migration.js.map +0 -1
  49. package/dist/WriteClient.cjs +0 -560
  50. package/dist/WriteClient.cjs.map +0 -1
  51. package/dist/WriteClient.d.ts +0 -281
  52. package/dist/WriteClient.js +0 -560
  53. package/dist/WriteClient.js.map +0 -1
  54. package/dist/buildQueryURL.cjs +0 -66
  55. package/dist/buildQueryURL.cjs.map +0 -1
  56. package/dist/buildQueryURL.d.ts +0 -209
  57. package/dist/buildQueryURL.js +0 -66
  58. package/dist/buildQueryURL.js.map +0 -1
  59. package/dist/cookie.cjs +0 -5
  60. package/dist/cookie.cjs.map +0 -1
  61. package/dist/cookie.d.ts +0 -5
  62. package/dist/cookie.js +0 -5
  63. package/dist/cookie.js.map +0 -1
  64. package/dist/createClient.cjs +0 -6
  65. package/dist/createClient.cjs.map +0 -1
  66. package/dist/createClient.d.ts +0 -32
  67. package/dist/createClient.js +0 -6
  68. package/dist/createClient.js.map +0 -1
  69. package/dist/createMigration.cjs +0 -6
  70. package/dist/createMigration.cjs.map +0 -1
  71. package/dist/createMigration.d.ts +0 -24
  72. package/dist/createMigration.js +0 -6
  73. package/dist/createMigration.js.map +0 -1
  74. package/dist/createWriteClient.cjs +0 -6
  75. package/dist/createWriteClient.cjs.map +0 -1
  76. package/dist/createWriteClient.d.ts +0 -32
  77. package/dist/createWriteClient.js +0 -6
  78. package/dist/createWriteClient.js.map +0 -1
  79. package/dist/errors/ForbiddenError.cjs +0 -7
  80. package/dist/errors/ForbiddenError.cjs.map +0 -1
  81. package/dist/errors/ForbiddenError.d.ts +0 -11
  82. package/dist/errors/ForbiddenError.js +0 -7
  83. package/dist/errors/ForbiddenError.js.map +0 -1
  84. package/dist/errors/InvalidDataError.cjs +0 -7
  85. package/dist/errors/InvalidDataError.cjs.map +0 -1
  86. package/dist/errors/InvalidDataError.d.ts +0 -3
  87. package/dist/errors/InvalidDataError.js +0 -7
  88. package/dist/errors/InvalidDataError.js.map +0 -1
  89. package/dist/errors/NotFoundError.cjs +0 -7
  90. package/dist/errors/NotFoundError.cjs.map +0 -1
  91. package/dist/errors/NotFoundError.d.ts +0 -3
  92. package/dist/errors/NotFoundError.js +0 -7
  93. package/dist/errors/NotFoundError.js.map +0 -1
  94. package/dist/errors/ParsingError.cjs +0 -7
  95. package/dist/errors/ParsingError.cjs.map +0 -1
  96. package/dist/errors/ParsingError.d.ts +0 -14
  97. package/dist/errors/ParsingError.js +0 -7
  98. package/dist/errors/ParsingError.js.map +0 -1
  99. package/dist/errors/PreviewTokenExpired.cjs +0 -7
  100. package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
  101. package/dist/errors/PreviewTokenExpired.d.ts +0 -8
  102. package/dist/errors/PreviewTokenExpired.js +0 -7
  103. package/dist/errors/PreviewTokenExpired.js.map +0 -1
  104. package/dist/errors/PrismicError.cjs +0 -16
  105. package/dist/errors/PrismicError.cjs.map +0 -1
  106. package/dist/errors/PrismicError.d.ts +0 -5
  107. package/dist/errors/PrismicError.js +0 -16
  108. package/dist/errors/PrismicError.js.map +0 -1
  109. package/dist/errors/RefExpiredError.cjs +0 -7
  110. package/dist/errors/RefExpiredError.cjs.map +0 -1
  111. package/dist/errors/RefExpiredError.d.ts +0 -8
  112. package/dist/errors/RefExpiredError.js +0 -7
  113. package/dist/errors/RefExpiredError.js.map +0 -1
  114. package/dist/errors/RefNotFoundError.cjs +0 -7
  115. package/dist/errors/RefNotFoundError.cjs.map +0 -1
  116. package/dist/errors/RefNotFoundError.d.ts +0 -8
  117. package/dist/errors/RefNotFoundError.js +0 -7
  118. package/dist/errors/RefNotFoundError.js.map +0 -1
  119. package/dist/errors/RepositoryNotFoundError.cjs +0 -7
  120. package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
  121. package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
  122. package/dist/errors/RepositoryNotFoundError.js +0 -7
  123. package/dist/errors/RepositoryNotFoundError.js.map +0 -1
  124. package/dist/filter.cjs +0 -247
  125. package/dist/filter.cjs.map +0 -1
  126. package/dist/filter.d.ts +0 -209
  127. package/dist/filter.js +0 -247
  128. package/dist/filter.js.map +0 -1
  129. package/dist/getGraphQLEndpoint.cjs +0 -13
  130. package/dist/getGraphQLEndpoint.cjs.map +0 -1
  131. package/dist/getGraphQLEndpoint.d.ts +0 -10
  132. package/dist/getGraphQLEndpoint.js +0 -13
  133. package/dist/getGraphQLEndpoint.js.map +0 -1
  134. package/dist/getRepositoryEndpoint.cjs +0 -13
  135. package/dist/getRepositoryEndpoint.cjs.map +0 -1
  136. package/dist/getRepositoryEndpoint.d.ts +0 -12
  137. package/dist/getRepositoryEndpoint.js +0 -13
  138. package/dist/getRepositoryEndpoint.js.map +0 -1
  139. package/dist/getRepositoryName.cjs +0 -17
  140. package/dist/getRepositoryName.cjs.map +0 -1
  141. package/dist/getRepositoryName.d.ts +0 -12
  142. package/dist/getRepositoryName.js +0 -17
  143. package/dist/getRepositoryName.js.map +0 -1
  144. package/dist/getToolbarSrc.cjs +0 -13
  145. package/dist/getToolbarSrc.cjs.map +0 -1
  146. package/dist/getToolbarSrc.d.ts +0 -34
  147. package/dist/getToolbarSrc.js +0 -13
  148. package/dist/getToolbarSrc.js.map +0 -1
  149. package/dist/helpers/asDate.cjs +0 -14
  150. package/dist/helpers/asDate.cjs.map +0 -1
  151. package/dist/helpers/asDate.d.ts +0 -17
  152. package/dist/helpers/asDate.js +0 -14
  153. package/dist/helpers/asDate.js.map +0 -1
  154. package/dist/helpers/asHTML.cjs +0 -86
  155. package/dist/helpers/asHTML.cjs.map +0 -1
  156. package/dist/helpers/asHTML.d.ts +0 -141
  157. package/dist/helpers/asHTML.js +0 -86
  158. package/dist/helpers/asHTML.js.map +0 -1
  159. package/dist/helpers/asImagePixelDensitySrcSet.cjs +0 -21
  160. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +0 -1
  161. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +0 -53
  162. package/dist/helpers/asImagePixelDensitySrcSet.js +0 -21
  163. package/dist/helpers/asImagePixelDensitySrcSet.js.map +0 -1
  164. package/dist/helpers/asImageSrc.cjs +0 -13
  165. package/dist/helpers/asImageSrc.cjs.map +0 -1
  166. package/dist/helpers/asImageSrc.d.ts +0 -28
  167. package/dist/helpers/asImageSrc.js +0 -13
  168. package/dist/helpers/asImageSrc.js.map +0 -1
  169. package/dist/helpers/asImageWidthSrcSet.cjs +0 -45
  170. package/dist/helpers/asImageWidthSrcSet.cjs.map +0 -1
  171. package/dist/helpers/asImageWidthSrcSet.d.ts +0 -61
  172. package/dist/helpers/asImageWidthSrcSet.js +0 -45
  173. package/dist/helpers/asImageWidthSrcSet.js.map +0 -1
  174. package/dist/helpers/asLink.cjs +0 -47
  175. package/dist/helpers/asLink.cjs.map +0 -1
  176. package/dist/helpers/asLink.d.ts +0 -77
  177. package/dist/helpers/asLink.js +0 -47
  178. package/dist/helpers/asLink.js.map +0 -1
  179. package/dist/helpers/asLinkAttrs.cjs +0 -28
  180. package/dist/helpers/asLinkAttrs.cjs.map +0 -1
  181. package/dist/helpers/asLinkAttrs.d.ts +0 -50
  182. package/dist/helpers/asLinkAttrs.js +0 -28
  183. package/dist/helpers/asLinkAttrs.js.map +0 -1
  184. package/dist/helpers/asText.cjs +0 -21
  185. package/dist/helpers/asText.cjs.map +0 -1
  186. package/dist/helpers/asText.d.ts +0 -47
  187. package/dist/helpers/asText.js +0 -21
  188. package/dist/helpers/asText.js.map +0 -1
  189. package/dist/helpers/documentToLinkField.cjs +0 -27
  190. package/dist/helpers/documentToLinkField.cjs.map +0 -1
  191. package/dist/helpers/documentToLinkField.d.ts +0 -17
  192. package/dist/helpers/documentToLinkField.js +0 -27
  193. package/dist/helpers/documentToLinkField.js.map +0 -1
  194. package/dist/helpers/isFilled.cjs +0 -77
  195. package/dist/helpers/isFilled.cjs.map +0 -1
  196. package/dist/helpers/isFilled.d.ts +0 -190
  197. package/dist/helpers/isFilled.js +0 -77
  198. package/dist/helpers/isFilled.js.map +0 -1
  199. package/dist/helpers/mapSliceZone.cjs +0 -42
  200. package/dist/helpers/mapSliceZone.cjs.map +0 -1
  201. package/dist/helpers/mapSliceZone.d.ts +0 -136
  202. package/dist/helpers/mapSliceZone.js +0 -42
  203. package/dist/helpers/mapSliceZone.js.map +0 -1
  204. package/dist/index.js +0 -97
  205. package/dist/index.js.map +0 -1
  206. package/dist/isRepositoryEndpoint.cjs +0 -12
  207. package/dist/isRepositoryEndpoint.cjs.map +0 -1
  208. package/dist/isRepositoryEndpoint.d.ts +0 -10
  209. package/dist/isRepositoryEndpoint.js +0 -12
  210. package/dist/isRepositoryEndpoint.js.map +0 -1
  211. package/dist/isRepositoryName.cjs +0 -7
  212. package/dist/isRepositoryName.cjs.map +0 -1
  213. package/dist/isRepositoryName.d.ts +0 -9
  214. package/dist/isRepositoryName.js +0 -7
  215. package/dist/isRepositoryName.js.map +0 -1
  216. package/dist/lib/appendFilters.cjs +0 -11
  217. package/dist/lib/appendFilters.cjs.map +0 -1
  218. package/dist/lib/appendFilters.d.ts +0 -18
  219. package/dist/lib/appendFilters.js +0 -11
  220. package/dist/lib/appendFilters.js.map +0 -1
  221. package/dist/lib/castArray.cjs +0 -7
  222. package/dist/lib/castArray.cjs.map +0 -1
  223. package/dist/lib/castArray.d.ts +0 -12
  224. package/dist/lib/castArray.js +0 -7
  225. package/dist/lib/castArray.js.map +0 -1
  226. package/dist/lib/castThunk.cjs +0 -7
  227. package/dist/lib/castThunk.cjs.map +0 -1
  228. package/dist/lib/castThunk.d.ts +0 -11
  229. package/dist/lib/castThunk.js +0 -7
  230. package/dist/lib/castThunk.js.map +0 -1
  231. package/dist/lib/devMsg.cjs +0 -8
  232. package/dist/lib/devMsg.cjs.map +0 -1
  233. package/dist/lib/devMsg.d.ts +0 -16
  234. package/dist/lib/devMsg.js +0 -8
  235. package/dist/lib/devMsg.js.map +0 -1
  236. package/dist/lib/escapeHTML.cjs +0 -43
  237. package/dist/lib/escapeHTML.cjs.map +0 -1
  238. package/dist/lib/escapeHTML.d.ts +0 -1
  239. package/dist/lib/escapeHTML.js +0 -43
  240. package/dist/lib/escapeHTML.js.map +0 -1
  241. package/dist/lib/everyTagFilter.cjs +0 -9
  242. package/dist/lib/everyTagFilter.cjs.map +0 -1
  243. package/dist/lib/everyTagFilter.d.ts +0 -9
  244. package/dist/lib/everyTagFilter.js +0 -9
  245. package/dist/lib/everyTagFilter.js.map +0 -1
  246. package/dist/lib/findMasterRef.cjs +0 -8
  247. package/dist/lib/findMasterRef.cjs.map +0 -1
  248. package/dist/lib/findMasterRef.d.ts +0 -11
  249. package/dist/lib/findMasterRef.js +0 -8
  250. package/dist/lib/findMasterRef.js.map +0 -1
  251. package/dist/lib/findRef.cjs +0 -12
  252. package/dist/lib/findRef.cjs.map +0 -1
  253. package/dist/lib/findRef.d.ts +0 -14
  254. package/dist/lib/findRef.js +0 -12
  255. package/dist/lib/findRef.js.map +0 -1
  256. package/dist/lib/findRefByID.cjs +0 -8
  257. package/dist/lib/findRefByID.cjs.map +0 -1
  258. package/dist/lib/findRefByID.d.ts +0 -12
  259. package/dist/lib/findRefByID.js +0 -8
  260. package/dist/lib/findRefByID.js.map +0 -1
  261. package/dist/lib/findRefByLabel.cjs +0 -8
  262. package/dist/lib/findRefByLabel.cjs.map +0 -1
  263. package/dist/lib/findRefByLabel.d.ts +0 -12
  264. package/dist/lib/findRefByLabel.js +0 -8
  265. package/dist/lib/findRefByLabel.js.map +0 -1
  266. package/dist/lib/getOptionalLinkProperties.cjs +0 -14
  267. package/dist/lib/getOptionalLinkProperties.cjs.map +0 -1
  268. package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
  269. package/dist/lib/getOptionalLinkProperties.js +0 -14
  270. package/dist/lib/getOptionalLinkProperties.js.map +0 -1
  271. package/dist/lib/getPreviewCookie.cjs +0 -21
  272. package/dist/lib/getPreviewCookie.cjs.map +0 -1
  273. package/dist/lib/getPreviewCookie.d.ts +0 -9
  274. package/dist/lib/getPreviewCookie.js +0 -21
  275. package/dist/lib/getPreviewCookie.js.map +0 -1
  276. package/dist/lib/isInternalURL.cjs +0 -9
  277. package/dist/lib/isInternalURL.cjs.map +0 -1
  278. package/dist/lib/isInternalURL.d.ts +0 -8
  279. package/dist/lib/isInternalURL.js +0 -9
  280. package/dist/lib/isInternalURL.js.map +0 -1
  281. package/dist/lib/isMigrationValue.cjs +0 -24
  282. package/dist/lib/isMigrationValue.cjs.map +0 -1
  283. package/dist/lib/isMigrationValue.d.ts +0 -71
  284. package/dist/lib/isMigrationValue.js +0 -24
  285. package/dist/lib/isMigrationValue.js.map +0 -1
  286. package/dist/lib/isValue.cjs +0 -53
  287. package/dist/lib/isValue.cjs.map +0 -1
  288. package/dist/lib/isValue.d.ts +0 -78
  289. package/dist/lib/isValue.js +0 -53
  290. package/dist/lib/isValue.js.map +0 -1
  291. package/dist/lib/minifyGraphQLQuery.cjs +0 -7
  292. package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
  293. package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
  294. package/dist/lib/minifyGraphQLQuery.js +0 -7
  295. package/dist/lib/minifyGraphQLQuery.js.map +0 -1
  296. package/dist/lib/pLimit.cjs +0 -49
  297. package/dist/lib/pLimit.cjs.map +0 -1
  298. package/dist/lib/pLimit.d.ts +0 -22
  299. package/dist/lib/pLimit.js +0 -49
  300. package/dist/lib/pLimit.js.map +0 -1
  301. package/dist/lib/request.cjs +0 -43
  302. package/dist/lib/request.cjs.map +0 -1
  303. package/dist/lib/request.d.ts +0 -73
  304. package/dist/lib/request.js +0 -43
  305. package/dist/lib/request.js.map +0 -1
  306. package/dist/lib/resolveMigrationDocumentData.cjs +0 -134
  307. package/dist/lib/resolveMigrationDocumentData.cjs.map +0 -1
  308. package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
  309. package/dist/lib/resolveMigrationDocumentData.js +0 -134
  310. package/dist/lib/resolveMigrationDocumentData.js.map +0 -1
  311. package/dist/lib/serializerHelpers.cjs +0 -113
  312. package/dist/lib/serializerHelpers.cjs.map +0 -1
  313. package/dist/lib/serializerHelpers.d.ts +0 -9
  314. package/dist/lib/serializerHelpers.js +0 -113
  315. package/dist/lib/serializerHelpers.js.map +0 -1
  316. package/dist/lib/someTagsFilter.cjs +0 -9
  317. package/dist/lib/someTagsFilter.cjs.map +0 -1
  318. package/dist/lib/someTagsFilter.d.ts +0 -9
  319. package/dist/lib/someTagsFilter.js +0 -9
  320. package/dist/lib/someTagsFilter.js.map +0 -1
  321. package/dist/lib/throttledLog.cjs +0 -17
  322. package/dist/lib/throttledLog.cjs.map +0 -1
  323. package/dist/lib/throttledLog.d.ts +0 -15
  324. package/dist/lib/throttledLog.js +0 -17
  325. package/dist/lib/throttledLog.js.map +0 -1
  326. package/dist/lib/typeFilter.cjs +0 -8
  327. package/dist/lib/typeFilter.cjs.map +0 -1
  328. package/dist/lib/typeFilter.d.ts +0 -8
  329. package/dist/lib/typeFilter.js +0 -8
  330. package/dist/lib/typeFilter.js.map +0 -1
  331. package/dist/lib/validateAssetMetadata.cjs +0 -28
  332. package/dist/lib/validateAssetMetadata.cjs.map +0 -1
  333. package/dist/lib/validateAssetMetadata.d.ts +0 -10
  334. package/dist/lib/validateAssetMetadata.js +0 -28
  335. package/dist/lib/validateAssetMetadata.js.map +0 -1
  336. package/dist/package.json.cjs +0 -7
  337. package/dist/package.json.cjs.map +0 -1
  338. package/dist/package.json.js +0 -7
  339. package/dist/package.json.js.map +0 -1
  340. package/dist/richtext/asText.cjs +0 -13
  341. package/dist/richtext/asText.cjs.map +0 -1
  342. package/dist/richtext/asText.d.ts +0 -12
  343. package/dist/richtext/asText.js +0 -13
  344. package/dist/richtext/asText.js.map +0 -1
  345. package/dist/richtext/asTree.cjs +0 -123
  346. package/dist/richtext/asTree.cjs.map +0 -1
  347. package/dist/richtext/asTree.d.ts +0 -14
  348. package/dist/richtext/asTree.js +0 -123
  349. package/dist/richtext/asTree.js.map +0 -1
  350. package/dist/richtext/composeSerializers.cjs +0 -17
  351. package/dist/richtext/composeSerializers.cjs.map +0 -1
  352. package/dist/richtext/composeSerializers.d.ts +0 -16
  353. package/dist/richtext/composeSerializers.js +0 -17
  354. package/dist/richtext/composeSerializers.js.map +0 -1
  355. package/dist/richtext/serialize.cjs +0 -19
  356. package/dist/richtext/serialize.cjs.map +0 -1
  357. package/dist/richtext/serialize.d.ts +0 -19
  358. package/dist/richtext/serialize.js +0 -19
  359. package/dist/richtext/serialize.js.map +0 -1
  360. package/dist/richtext/types.cjs +0 -11
  361. package/dist/richtext/types.cjs.map +0 -1
  362. package/dist/richtext/types.d.ts +0 -71
  363. package/dist/richtext/types.js +0 -11
  364. package/dist/richtext/types.js.map +0 -1
  365. package/dist/richtext/wrapMapSerializer.cjs +0 -24
  366. package/dist/richtext/wrapMapSerializer.cjs.map +0 -1
  367. package/dist/richtext/wrapMapSerializer.d.ts +0 -15
  368. package/dist/richtext/wrapMapSerializer.js +0 -24
  369. package/dist/richtext/wrapMapSerializer.js.map +0 -1
  370. package/dist/richtext.cjs +0 -15
  371. package/dist/richtext.cjs.map +0 -1
  372. package/dist/richtext.js +0 -15
  373. package/dist/richtext.js.map +0 -1
  374. package/dist/types/api/asset/asset.d.ts +0 -177
  375. package/dist/types/api/asset/tag.d.ts +0 -53
  376. package/dist/types/api/integration.d.ts +0 -28
  377. package/dist/types/api/migration/document.d.ts +0 -60
  378. package/dist/types/api/query.d.ts +0 -43
  379. package/dist/types/api/ref.d.ts +0 -32
  380. package/dist/types/api/release.d.ts +0 -11
  381. package/dist/types/api/repository.d.ts +0 -109
  382. package/dist/types/api/tags.d.ts +0 -9
  383. package/dist/types/migration/Asset.cjs +0 -33
  384. package/dist/types/migration/Asset.cjs.map +0 -1
  385. package/dist/types/migration/Asset.d.ts +0 -108
  386. package/dist/types/migration/Asset.js +0 -33
  387. package/dist/types/migration/Asset.js.map +0 -1
  388. package/dist/types/migration/ContentRelationship.d.ts +0 -16
  389. package/dist/types/migration/Document.cjs +0 -47
  390. package/dist/types/migration/Document.cjs.map +0 -1
  391. package/dist/types/migration/Document.d.ts +0 -94
  392. package/dist/types/migration/Document.js +0 -47
  393. package/dist/types/migration/Document.js.map +0 -1
  394. package/dist/types/migration/Link.d.ts +0 -19
  395. package/dist/types/model/boolean.d.ts +0 -15
  396. package/dist/types/model/color.d.ts +0 -13
  397. package/dist/types/model/contentRelationship.d.ts +0 -52
  398. package/dist/types/model/customType.d.ts +0 -48
  399. package/dist/types/model/date.d.ts +0 -14
  400. package/dist/types/model/embed.d.ts +0 -13
  401. package/dist/types/model/geoPoint.d.ts +0 -12
  402. package/dist/types/model/group.d.ts +0 -23
  403. package/dist/types/model/image.d.ts +0 -31
  404. package/dist/types/model/integration.d.ts +0 -14
  405. package/dist/types/model/keyText.d.ts +0 -13
  406. package/dist/types/model/link.cjs +0 -9
  407. package/dist/types/model/link.cjs.map +0 -1
  408. package/dist/types/model/link.d.ts +0 -28
  409. package/dist/types/model/link.js +0 -9
  410. package/dist/types/model/link.js.map +0 -1
  411. package/dist/types/model/linkToMedia.d.ts +0 -17
  412. package/dist/types/model/number.d.ts +0 -15
  413. package/dist/types/model/range.d.ts +0 -14
  414. package/dist/types/model/richText.d.ts +0 -37
  415. package/dist/types/model/select.d.ts +0 -18
  416. package/dist/types/model/separator.d.ts +0 -10
  417. package/dist/types/model/sharedSlice.d.ts +0 -16
  418. package/dist/types/model/sharedSliceVariation.d.ts +0 -19
  419. package/dist/types/model/slice.cjs +0 -8
  420. package/dist/types/model/slice.cjs.map +0 -1
  421. package/dist/types/model/slice.d.ts +0 -33
  422. package/dist/types/model/slice.js +0 -8
  423. package/dist/types/model/slice.js.map +0 -1
  424. package/dist/types/model/sliceZone.cjs +0 -8
  425. package/dist/types/model/sliceZone.cjs.map +0 -1
  426. package/dist/types/model/sliceZone.d.ts +0 -41
  427. package/dist/types/model/sliceZone.js +0 -8
  428. package/dist/types/model/sliceZone.js.map +0 -1
  429. package/dist/types/model/table.d.ts +0 -12
  430. package/dist/types/model/timestamp.d.ts +0 -14
  431. package/dist/types/model/title.d.ts +0 -7
  432. package/dist/types/model/types.cjs +0 -39
  433. package/dist/types/model/types.cjs.map +0 -1
  434. package/dist/types/model/types.d.ts +0 -77
  435. package/dist/types/model/types.js +0 -39
  436. package/dist/types/model/types.js.map +0 -1
  437. package/dist/types/model/uid.d.ts +0 -13
  438. package/dist/types/value/boolean.d.ts +0 -6
  439. package/dist/types/value/color.d.ts +0 -9
  440. package/dist/types/value/contentRelationship.d.ts +0 -31
  441. package/dist/types/value/date.d.ts +0 -9
  442. package/dist/types/value/document.d.ts +0 -114
  443. package/dist/types/value/embed.cjs +0 -10
  444. package/dist/types/value/embed.cjs.map +0 -1
  445. package/dist/types/value/embed.d.ts +0 -168
  446. package/dist/types/value/embed.js +0 -10
  447. package/dist/types/value/embed.js.map +0 -1
  448. package/dist/types/value/geoPoint.d.ts +0 -12
  449. package/dist/types/value/group.d.ts +0 -13
  450. package/dist/types/value/image.d.ts +0 -47
  451. package/dist/types/value/integration.d.ts +0 -16
  452. package/dist/types/value/keyText.d.ts +0 -9
  453. package/dist/types/value/link.cjs +0 -10
  454. package/dist/types/value/link.cjs.map +0 -1
  455. package/dist/types/value/link.d.ts +0 -68
  456. package/dist/types/value/link.js +0 -10
  457. package/dist/types/value/link.js.map +0 -1
  458. package/dist/types/value/linkToMedia.d.ts +0 -28
  459. package/dist/types/value/number.d.ts +0 -9
  460. package/dist/types/value/richText.cjs +0 -25
  461. package/dist/types/value/richText.cjs.map +0 -1
  462. package/dist/types/value/richText.d.ts +0 -215
  463. package/dist/types/value/richText.js +0 -25
  464. package/dist/types/value/richText.js.map +0 -1
  465. package/dist/types/value/select.d.ts +0 -10
  466. package/dist/types/value/sharedSlice.d.ts +0 -11
  467. package/dist/types/value/sharedSliceVariation.d.ts +0 -10
  468. package/dist/types/value/slice.d.ts +0 -13
  469. package/dist/types/value/sliceZone.d.ts +0 -12
  470. package/dist/types/value/table.d.ts +0 -91
  471. package/dist/types/value/timestamp.d.ts +0 -8
  472. package/dist/types/value/title.d.ts +0 -12
  473. package/dist/types/value/types.d.ts +0 -58
  474. package/dist/types/webhook/apiUpdate.d.ts +0 -52
  475. package/dist/types/webhook/testTrigger.d.ts +0 -9
  476. package/dist/types/webhook/types.cjs +0 -8
  477. package/dist/types/webhook/types.cjs.map +0 -1
  478. package/dist/types/webhook/types.d.ts +0 -18
  479. package/dist/types/webhook/types.js +0 -8
  480. package/dist/types/webhook/types.js.map +0 -1
@@ -1,77 +0,0 @@
1
- const isNonNullish = (input) => {
2
- return input != null;
3
- };
4
- const isNonEmptyArray = (input) => {
5
- return !!input.length;
6
- };
7
- const richText = (field) => {
8
- if (!isNonNullish(field)) {
9
- return false;
10
- } else if (field.length === 1 && "text" in field[0]) {
11
- return !!field[0].text;
12
- } else {
13
- return !!field.length;
14
- }
15
- };
16
- const title = richText;
17
- const imageThumbnail = (thumbnail) => {
18
- return isNonNullish(thumbnail) && !!thumbnail.url;
19
- };
20
- const image = imageThumbnail;
21
- const link = (field) => {
22
- return isNonNullish(field) && ("id" in field || "url" in field);
23
- };
24
- const linkToMedia = link;
25
- const contentRelationship = link;
26
- const date = isNonNullish;
27
- const timestamp = isNonNullish;
28
- const color = isNonNullish;
29
- const number = isNonNullish;
30
- const keyText = (field) => {
31
- return isNonNullish(keyText) && !!field;
32
- };
33
- const select = isNonNullish;
34
- const embed = (field) => {
35
- return isNonNullish(field) && !!field.embed_url;
36
- };
37
- const geoPoint = (field) => {
38
- return isNonNullish(field) && "longitude" in field;
39
- };
40
- const table = isNonNullish;
41
- const integration = isNonNullish;
42
- const integrationField = integration;
43
- const integrationFields = integration;
44
- const repeatable = (repeatable2) => {
45
- return isNonNullish(repeatable2) && isNonEmptyArray(repeatable2);
46
- };
47
- const group = (group2) => {
48
- return isNonNullish(group2) && isNonEmptyArray(group2);
49
- };
50
- const sliceZone = (slices) => {
51
- return isNonNullish(slices) && isNonEmptyArray(slices);
52
- };
53
- export {
54
- color,
55
- contentRelationship,
56
- date,
57
- embed,
58
- geoPoint,
59
- group,
60
- image,
61
- imageThumbnail,
62
- integration,
63
- integrationField,
64
- integrationFields,
65
- keyText,
66
- link,
67
- linkToMedia,
68
- number,
69
- repeatable,
70
- richText,
71
- select,
72
- sliceZone,
73
- table,
74
- timestamp,
75
- title
76
- };
77
- //# sourceMappingURL=isFilled.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isFilled.js","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 {\n\tIntegrationField,\n\tIntegrationFieldData,\n} 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\n * is used to check if nullable field values are filled.\n *\n * @param input - The value to check.\n *\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\n * fields are filled.\n *\n * @param input - The array to check.\n *\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 *\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 *\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 *\n * @returns `true` if `field` 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 *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <\n\tThumbnailNames extends string | null = never,\n>(\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 *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\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 *\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 *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <\n\tField extends ContentRelationshipField,\n>(\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 *\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 *\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 *\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 *\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 *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn isNonNullish(keyText) && !!field\n}\n\n/**\n * Determines if a select field is filled.\n *\n * @param field - Select field to check.\n *\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 *\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 *\n * @returns `true` if `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 *\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 *\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/**\n * @deprecated Renamed to `integration`.\n */\n// TODO: Remove when we remove support for deprecated `integrationField` export.\nexport const integrationField = integration\n/**\n * @deprecated Renamed to `integrationField`.\n */\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 *\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 *\n * @returns `true` if `group` contains at least one item, `false` otherwise.\n */\nexport const group = <\n\tFields extends Record<string, AnyRegularField | NestedGroupField>,\n>(\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 *\n * @returns `true` if `slices` contains at least one Slice, `false` 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"],"names":["repeatable","group"],"mappings":"AAoCA,MAAM,eAAe,CAAI,UAAqC;AAC7D,SAAO,SAAS;AACjB;AAUA,MAAM,kBAAkB,CAAI,UAAoC;AACxD,SAAA,CAAC,CAAC,MAAM;AAChB;AASa,MAAA,WAAW,CACvB,UACqC;AACjC,MAAA,CAAC,aAAa,KAAK,GAAG;AAClB,WAAA;AAAA,EAAA,WACG,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACpD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EAAA,OACZ;AACC,WAAA,CAAC,CAAC,MAAM;AAAA,EAAA;AAEjB;AASO,MAAM,QAAQ;AAWR,MAAA,iBAAiB,CAC7B,cAC2C;AAC3C,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAC/C;AASO,MAAM,QAAQ;AAaR,MAAA,OAAO,CAOnB,UACoE;AACpE,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC1D;AASO,MAAM,cAAc;AAWpB,MAAM,sBAAsB;AAa5B,MAAM,OAAO;AAWb,MAAM,YAAY;AAWlB,MAAM,QAAQ;AAWd,MAAM,SAAS;AAWT,MAAA,UAAU,CACtB,UACoC;AACpC,SAAO,aAAa,OAAO,KAAK,CAAC,CAAC;AACnC;AASO,MAAM,SAAS;AAWT,MAAA,QAAQ,CACpB,UAC6D;AAC7D,SAAO,aAAa,KAAK,KAAK,CAAC,CAAC,MAAM;AACvC;AASa,MAAA,WAAW,CACvB,UACqC;AAC9B,SAAA,aAAa,KAAK,KAAK,eAAe;AAC9C;AASO,MAAM,QAAQ;AAWd,MAAM,cAAc;AAOpB,MAAM,mBAAmB;AAKzB,MAAM,oBAAoB;AAUpB,MAAA,aAAa,CACzBA,gBAC0C;AAC1C,SAAO,aAAaA,WAAU,KAAK,gBAAgBA,WAAU;AAC9D;AASa,MAAA,QAAQ,CAGpBC,WAC0C;AAC1C,SAAO,aAAaA,MAAK,KAAK,gBAAgBA,MAAK;AACpD;AASa,MAAA,YAAY,CACxB,WAC0C;AAC1C,SAAO,aAAa,MAAM,KAAK,gBAAgB,MAAM;AACtD;"}
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- function mapSliceZone(sliceZone, mappers, context) {
4
- return Promise.all(sliceZone.map(async (slice, index, slices) => {
5
- const isRestSliceType = "slice_type" in slice;
6
- const sliceType = isRestSliceType ? slice.slice_type : slice.type;
7
- const mapper = mappers[sliceType];
8
- if (!mapper) {
9
- return slice;
10
- }
11
- const mapperArgs = { slice, slices, index, context };
12
- let result = await mapper(
13
- // @ts-expect-error - I don't know how to fix this type
14
- mapperArgs
15
- );
16
- if (
17
- // `mapper.length < 1` ensures the given
18
- // function is something of the form:
19
- // `() => import(...)`
20
- mapper.length < 1 && (typeof result === "function" || typeof result === "object" && "default" in result)
21
- ) {
22
- result = "default" in result ? result.default : result;
23
- result = await result(mapperArgs);
24
- }
25
- if (isRestSliceType) {
26
- return {
27
- __mapped: true,
28
- id: slice.id,
29
- slice_type: sliceType,
30
- ...result
31
- };
32
- } else {
33
- return {
34
- __mapped: true,
35
- type: sliceType,
36
- ...result
37
- };
38
- }
39
- }));
40
- }
41
- exports.mapSliceZone = mapSliceZone;
42
- //# sourceMappingURL=mapSliceZone.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapSliceZone.cjs","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\n * functions like `() => import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/**\n * Mark a type as potentially lazy-loaded via a module.\n */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// eslint-disable-next-line @typescript-eslint/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\n * Rest API V2 for the `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\n * GraphQL API for the `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\n * `mapSliceZone()` helper.\n *\n * If using Prismic's Rest API V2, use the `Slice` export from\n * `@prismicio/client` for a full 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\n * `SliceLike`.\n *\n * If using Prismic's Rest API V2, use the `SliceZone` export from\n * `@prismicio/client` for the full 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\n * the mapped Slice Zone can use these properties to detect and specially handle\n * mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a\n\t * 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\n * `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made\n * available to all Slice mappers.\n */\ntype SliceMapperArgs<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * Slice data.\n\t */\n\tslice: TSlice\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\tindex: number\n\n\t/**\n\t * All Slices from the Slice Zone to which the Slice belongs.\n\t */\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<\n\t\tTSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2\n\t>\n\n\t/**\n\t * Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n\t * mappers.\n\t */\n\tcontext: TContext\n}\n\n/**\n * A record of mappers.\n */\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// eslint-disable-next-line @typescript-eslint/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\n * return value will 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> = (\n\targs: SliceMapperArgs<TSlice, TContext>,\n) => TMappedSlice | Promise<TMappedSlice>\n\n/**\n * Unwraps a lazily loaded mapper module.\n */\ntype ResolveLazySliceMapperModule<\n\t// eslint-disable-next-line @typescript-eslint/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/**\n * Transforms a Slice into its mapped version.\n */\ntype MapSliceLike<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// eslint-disable-next-line @typescript-eslint/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<\n\t\t\t\t\t\tReturnType<\n\t\t\t\t\t\t\tResolveLazySliceMapperModule<\n\t\t\t\t\t\t\t\tTSliceMappers[TSliceLike[\"slice_type\"]]\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>\n\t\t\t\t\t>\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<\n\t\t\t\t\t\t\tReturnType<\n\t\t\t\t\t\t\t\tResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>\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\n * of Slice. Mapping functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side\n * processing.\n *\n * @example\n *\n * ```typescript\n * const mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \t\tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * });\n * ```\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\" ||\n\t\t\t\t\t(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"],"names":[],"mappings":";;AAmOgB,SAAA,aAKf,WACA,SACA,SAAkB;AAElB,SAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAU;AAC5C,UAAM,kBAAkB,gBAAgB;AACxC,UAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;AAEvD,UAAA,SAAS,QAAQ,SAAiC;AAExD,QAAI,CAAC,QAAQ;AACL,aAAA;AAAA,IAAA;AAGR,UAAM,aAAa,EAAE,OAAO,QAAQ,OAAO,QAAO;AAIlD,QAAI,SAAS,MAAM;AAAA;AAAA,MAElB;AAAA,IAAU;AAMX;AAAA;AAAA;AAAA;AAAA,MAIC,OAAO,SAAS,MACf,OAAO,WAAW,cACjB,OAAO,WAAW,YAAY,aAAa;AAAA,MAC5C;AACQ,eAAA,aAAa,SAAS,OAAO,UAAU;AACvC,eAAA,MAAM,OAAO,UAAU;AAAA,IAAA;AAGjC,QAAI,iBAAiB;AACb,aAAA;AAAA,QACN,UAAU;AAAA,QACV,IAAI,MAAM;AAAA,QACV,YAAY;AAAA,QACZ,GAAG;AAAA;WAEE;AACC,aAAA;AAAA,QACN,UAAU;AAAA,QACV,MAAM;AAAA,QACN,GAAG;AAAA;;EAEL,CACA,CAAC;AAEJ;;"}
@@ -1,136 +0,0 @@
1
- import type { Slice } from "../types/value/slice";
2
- /**
3
- * Convert a value to a lazyily loaded module. This is useful when using
4
- * functions like `() => import("...")`.
5
- */
6
- type LazyModule<T> = () => Promise<T | {
7
- default: T;
8
- }>;
9
- /**
10
- * Mark a type as potentially lazy-loaded via a module.
11
- */
12
- type MaybeLazyModule<T> = T | LazyModule<T>;
13
- type AnyFunction = (...args: any[]) => any;
14
- /**
15
- * Returns the type of a `SliceLike` type.
16
- *
17
- * @typeParam Slice - The Slice from which the type will be extracted.
18
- */
19
- type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2 ? TSlice["slice_type"] : TSlice extends SliceLikeGraphQL ? TSlice["type"] : never;
20
- /**
21
- * The minimum required properties to represent a Prismic Slice from the Prismic
22
- * Rest API V2 for the `mapSliceZone()` helper.
23
- *
24
- * @typeParam SliceType - Type name of the Slice.
25
- */
26
- type SliceLikeRestV2<TSliceType extends string = string> = Pick<Slice<TSliceType>, "id" | "slice_type">;
27
- /**
28
- * The minimum required properties to represent a Prismic Slice from the Prismic
29
- * GraphQL API for the `mapSliceZone()` helper.
30
- *
31
- * @typeParam SliceType - Type name of the Slice.
32
- */
33
- type SliceLikeGraphQL<TSliceType extends string = string> = {
34
- type: Slice<TSliceType>["slice_type"];
35
- };
36
- /**
37
- * The minimum required properties to represent a Prismic Slice for the
38
- * `mapSliceZone()` helper.
39
- *
40
- * If using Prismic's Rest API V2, use the `Slice` export from
41
- * `@prismicio/client` for a full interface.
42
- *
43
- * @typeParam SliceType - Type name of the Slice.
44
- */
45
- type SliceLike<TSliceType extends string = string> = SliceLikeRestV2<TSliceType> | SliceLikeGraphQL<TSliceType>;
46
- /**
47
- * A looser version of the `SliceZone` type from `@prismicio/client` using
48
- * `SliceLike`.
49
- *
50
- * If using Prismic's Rest API V2, use the `SliceZone` export from
51
- * `@prismicio/client` for the full type.
52
- *
53
- * @typeParam TSlice - The type(s) of a Slice in the Slice Zone.
54
- */
55
- type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
56
- /**
57
- * A set of properties that identify a Slice as having been mapped. Consumers of
58
- * the mapped Slice Zone can use these properties to detect and specially handle
59
- * mapped Slices.
60
- */
61
- type MappedSliceLike = {
62
- /**
63
- * If `true`, this Slice has been modified from its original value using a
64
- * mapper.
65
- *
66
- * @internal
67
- */
68
- __mapped: true;
69
- };
70
- /**
71
- * Arguments for a function mapping content from a Prismic Slice using the
72
- * `mapSliceZone()` helper.
73
- *
74
- * @typeParam TSlice - The Slice passed as a prop.
75
- * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made
76
- * available to all Slice mappers.
77
- */
78
- type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
79
- /**
80
- * Slice data.
81
- */
82
- slice: TSlice;
83
- /**
84
- * The index of the Slice in the Slice Zone.
85
- */
86
- index: number;
87
- /**
88
- * All Slices from the Slice Zone to which the Slice belongs.
89
- */
90
- slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
91
- /**
92
- * Arbitrary data passed to `mapSliceZone()` and made available to all Slice
93
- * mappers.
94
- */
95
- context: TContext;
96
- };
97
- /**
98
- * A record of mappers.
99
- */
100
- type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
101
- [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>;
102
- };
103
- /**
104
- * A function that maps a Slice and its metadata to a modified version. The
105
- * return value will replace the Slice in the Slice Zone.
106
- */
107
- 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>;
108
- /**
109
- * Unwraps a lazily loaded mapper module.
110
- */
111
- type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
112
- default: unknown;
113
- } ? Awaited<ReturnType<TSliceMapper>>["default"] : Awaited<ReturnType<TSliceMapper>> : TSliceMapper;
114
- /**
115
- * Transforms a Slice into its mapped version.
116
- */
117
- type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends SliceMappers<TSliceLike, any>> = TSliceLike extends Slice ? TSliceLike["slice_type"] extends keyof TSliceMappers ? TSliceMappers[TSliceLike["slice_type"]] extends AnyFunction ? SliceLikeRestV2<TSliceLike["slice_type"]> & MappedSliceLike & Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["slice_type"]]>>> : TSliceLike : TSliceLike : TSliceLike extends SliceLikeGraphQL ? TSliceLike["type"] extends keyof TSliceMappers ? TSliceMappers[TSliceLike["type"]] extends AnyFunction ? SliceLikeGraphQL<TSliceLike["type"]> & MappedSliceLike & Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>>> : TSliceLike : TSliceLike : never;
118
- /**
119
- * Transforms a Slice Zone using a set of mapping functions, one for each type
120
- * of Slice. Mapping functions can be async.
121
- *
122
- * Whenever possible, use this function on the server to minimize client-side
123
- * processing.
124
- *
125
- * @example
126
- *
127
- * ```typescript
128
- * const mappedSliceZone = await mapSliceZone(page.data.slices, {
129
- * code_block: ({ slice }) => ({
130
- * codeHTML: await highlight(slice.primary.code),
131
- * }),
132
- * });
133
- * ```
134
- */
135
- 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>[]>;
136
- export {};
@@ -1,42 +0,0 @@
1
- function mapSliceZone(sliceZone, mappers, context) {
2
- return Promise.all(sliceZone.map(async (slice, index, slices) => {
3
- const isRestSliceType = "slice_type" in slice;
4
- const sliceType = isRestSliceType ? slice.slice_type : slice.type;
5
- const mapper = mappers[sliceType];
6
- if (!mapper) {
7
- return slice;
8
- }
9
- const mapperArgs = { slice, slices, index, context };
10
- let result = await mapper(
11
- // @ts-expect-error - I don't know how to fix this type
12
- mapperArgs
13
- );
14
- if (
15
- // `mapper.length < 1` ensures the given
16
- // function is something of the form:
17
- // `() => import(...)`
18
- mapper.length < 1 && (typeof result === "function" || typeof result === "object" && "default" in result)
19
- ) {
20
- result = "default" in result ? result.default : result;
21
- result = await result(mapperArgs);
22
- }
23
- if (isRestSliceType) {
24
- return {
25
- __mapped: true,
26
- id: slice.id,
27
- slice_type: sliceType,
28
- ...result
29
- };
30
- } else {
31
- return {
32
- __mapped: true,
33
- type: sliceType,
34
- ...result
35
- };
36
- }
37
- }));
38
- }
39
- export {
40
- mapSliceZone
41
- };
42
- //# sourceMappingURL=mapSliceZone.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapSliceZone.js","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\n * functions like `() => import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/**\n * Mark a type as potentially lazy-loaded via a module.\n */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// eslint-disable-next-line @typescript-eslint/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\n * Rest API V2 for the `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\n * GraphQL API for the `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\n * `mapSliceZone()` helper.\n *\n * If using Prismic's Rest API V2, use the `Slice` export from\n * `@prismicio/client` for a full 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\n * `SliceLike`.\n *\n * If using Prismic's Rest API V2, use the `SliceZone` export from\n * `@prismicio/client` for the full 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\n * the mapped Slice Zone can use these properties to detect and specially handle\n * mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a\n\t * 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\n * `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made\n * available to all Slice mappers.\n */\ntype SliceMapperArgs<\n\tTSlice extends SliceLike = SliceLike,\n\tTContext = unknown,\n> = {\n\t/**\n\t * Slice data.\n\t */\n\tslice: TSlice\n\n\t/**\n\t * The index of the Slice in the Slice Zone.\n\t */\n\tindex: number\n\n\t/**\n\t * All Slices from the Slice Zone to which the Slice belongs.\n\t */\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<\n\t\tTSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2\n\t>\n\n\t/**\n\t * Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n\t * mappers.\n\t */\n\tcontext: TContext\n}\n\n/**\n * A record of mappers.\n */\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// eslint-disable-next-line @typescript-eslint/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\n * return value will 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> = (\n\targs: SliceMapperArgs<TSlice, TContext>,\n) => TMappedSlice | Promise<TMappedSlice>\n\n/**\n * Unwraps a lazily loaded mapper module.\n */\ntype ResolveLazySliceMapperModule<\n\t// eslint-disable-next-line @typescript-eslint/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/**\n * Transforms a Slice into its mapped version.\n */\ntype MapSliceLike<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// eslint-disable-next-line @typescript-eslint/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<\n\t\t\t\t\t\tReturnType<\n\t\t\t\t\t\t\tResolveLazySliceMapperModule<\n\t\t\t\t\t\t\t\tTSliceMappers[TSliceLike[\"slice_type\"]]\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>\n\t\t\t\t\t>\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<\n\t\t\t\t\t\t\tReturnType<\n\t\t\t\t\t\t\t\tResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t>\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\n * of Slice. Mapping functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side\n * processing.\n *\n * @example\n *\n * ```typescript\n * const mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \t\tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * });\n * ```\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\" ||\n\t\t\t\t\t(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"],"names":[],"mappings":"AAmOgB,SAAA,aAKf,WACA,SACA,SAAkB;AAElB,SAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAU;AAC5C,UAAM,kBAAkB,gBAAgB;AACxC,UAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;AAEvD,UAAA,SAAS,QAAQ,SAAiC;AAExD,QAAI,CAAC,QAAQ;AACL,aAAA;AAAA,IAAA;AAGR,UAAM,aAAa,EAAE,OAAO,QAAQ,OAAO,QAAO;AAIlD,QAAI,SAAS,MAAM;AAAA;AAAA,MAElB;AAAA,IAAU;AAMX;AAAA;AAAA;AAAA;AAAA,MAIC,OAAO,SAAS,MACf,OAAO,WAAW,cACjB,OAAO,WAAW,YAAY,aAAa;AAAA,MAC5C;AACQ,eAAA,aAAa,SAAS,OAAO,UAAU;AACvC,eAAA,MAAM,OAAO,UAAU;AAAA,IAAA;AAGjC,QAAI,iBAAiB;AACb,aAAA;AAAA,QACN,UAAU;AAAA,QACV,IAAI,MAAM;AAAA,QACV,YAAY;AAAA,QACZ,GAAG;AAAA;WAEE;AACC,aAAA;AAAA,QACN,UAAU;AAAA,QACV,MAAM;AAAA,QACN,GAAG;AAAA;;EAEL,CACA,CAAC;AAEJ;"}
package/dist/index.js DELETED
@@ -1,97 +0,0 @@
1
- import { RichTextNodeType } from "./types/value/richText.js";
2
- import { mapSliceZone } from "./helpers/mapSliceZone.js";
3
- import { filter } from "./filter.js";
4
- import { createClient } from "./createClient.js";
5
- import { Client } from "./Client.js";
6
- import { createWriteClient } from "./createWriteClient.js";
7
- import { WriteClient } from "./WriteClient.js";
8
- import { createMigration } from "./createMigration.js";
9
- import { Migration } from "./Migration.js";
10
- import { getRepositoryEndpoint } from "./getRepositoryEndpoint.js";
11
- import { getRepositoryName } from "./getRepositoryName.js";
12
- import { getGraphQLEndpoint } from "./getGraphQLEndpoint.js";
13
- import { isRepositoryName } from "./isRepositoryName.js";
14
- import { isRepositoryEndpoint } from "./isRepositoryEndpoint.js";
15
- import { buildQueryURL } from "./buildQueryURL.js";
16
- import { getToolbarSrc } from "./getToolbarSrc.js";
17
- import * as cookie from "./cookie.js";
18
- import { asDate } from "./helpers/asDate.js";
19
- import { asLink } from "./helpers/asLink.js";
20
- import { asLinkAttrs } from "./helpers/asLinkAttrs.js";
21
- import { asText } from "./helpers/asText.js";
22
- import { asHTML } from "./helpers/asHTML.js";
23
- import { asImageSrc } from "./helpers/asImageSrc.js";
24
- import { asImageWidthSrcSet } from "./helpers/asImageWidthSrcSet.js";
25
- import { asImagePixelDensitySrcSet } from "./helpers/asImagePixelDensitySrcSet.js";
26
- import * as isFilled from "./helpers/isFilled.js";
27
- import { documentToLinkField } from "./helpers/documentToLinkField.js";
28
- import { PrismicError } from "./errors/PrismicError.js";
29
- import { ForbiddenError } from "./errors/ForbiddenError.js";
30
- import { NotFoundError } from "./errors/NotFoundError.js";
31
- import { RefNotFoundError } from "./errors/RefNotFoundError.js";
32
- import { RefExpiredError } from "./errors/RefExpiredError.js";
33
- import { PreviewTokenExpiredError } from "./errors/PreviewTokenExpired.js";
34
- import { ParsingError } from "./errors/ParsingError.js";
35
- import { RepositoryNotFoundError } from "./errors/RepositoryNotFoundError.js";
36
- import { LinkType } from "./types/value/link.js";
37
- import { OEmbedType } from "./types/value/embed.js";
38
- import { CustomTypeModelFieldType } from "./types/model/types.js";
39
- import { CustomTypeModelLinkSelectType } from "./types/model/link.js";
40
- import { CustomTypeModelSliceType } from "./types/model/sliceZone.js";
41
- import { CustomTypeModelSliceDisplay } from "./types/model/slice.js";
42
- import { PrismicMigrationDocument } from "./types/migration/Document.js";
43
- import { PrismicMigrationAsset } from "./types/migration/Asset.js";
44
- import { WebhookType } from "./types/webhook/types.js";
45
- const predicate = filter;
46
- const unstable_mapSliceZone = mapSliceZone;
47
- const Element = RichTextNodeType;
48
- export {
49
- Client,
50
- CustomTypeModelFieldType,
51
- CustomTypeModelLinkSelectType,
52
- CustomTypeModelSliceDisplay,
53
- CustomTypeModelSliceType,
54
- Element,
55
- ForbiddenError,
56
- LinkType,
57
- Migration,
58
- NotFoundError,
59
- OEmbedType,
60
- ParsingError,
61
- PreviewTokenExpiredError,
62
- PrismicError,
63
- PrismicMigrationAsset,
64
- PrismicMigrationDocument,
65
- RefExpiredError,
66
- RefNotFoundError,
67
- RepositoryNotFoundError,
68
- RichTextNodeType,
69
- WebhookType,
70
- WriteClient,
71
- asDate,
72
- asHTML,
73
- asImagePixelDensitySrcSet,
74
- asImageSrc,
75
- asImageWidthSrcSet,
76
- asLink,
77
- asLinkAttrs,
78
- asText,
79
- buildQueryURL,
80
- cookie,
81
- createClient,
82
- createMigration,
83
- createWriteClient,
84
- documentToLinkField,
85
- filter,
86
- getGraphQLEndpoint,
87
- getRepositoryEndpoint,
88
- getRepositoryName,
89
- getToolbarSrc,
90
- isFilled,
91
- isRepositoryEndpoint,
92
- isRepositoryName,
93
- mapSliceZone,
94
- predicate,
95
- unstable_mapSliceZone
96
- };
97
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\"\nimport type { IntegrationField } from \"./types/value/integration\"\nimport { RichTextNodeType } from \"./types/value/richText\"\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\"\nimport { mapSliceZone } from \"./helpers/mapSliceZone\"\n\nimport { filter } from \"./filter\"\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient } from \"./createClient\"\nexport { Client } from \"./Client\"\n\n// Write Client API.\nexport { createWriteClient } from \"./createWriteClient\"\nexport { WriteClient } from \"./WriteClient\"\n\n// Migration helper.\nexport { createMigration } from \"./createMigration\"\nexport { Migration } from \"./Migration\"\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\"\nexport { getRepositoryName } from \"./getRepositoryName\"\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\"\nexport { isRepositoryName } from \"./isRepositoryName\"\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\"\nexport { buildQueryURL } from \"./buildQueryURL\"\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\"\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter\nexport { filter, predicate }\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\"\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type { CreateClient } from \"./createClient\"\nexport type { ClientConfig, HttpRequestLike } from \"./Client\"\nexport type { CreateWriteClient } from \"./createWriteClient\"\nexport type { WriteClientConfig, MigrateReporterEvents } from \"./WriteClient\"\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\"\nexport type { CreateMigration } from \"./createMigration\"\nexport type {\n\tAbortSignalLike,\n\tFetchLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./lib/request\"\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\"\nexport { asLink } from \"./helpers/asLink\"\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\"\nexport { asText } from \"./helpers/asText\"\nexport { asHTML } from \"./helpers/asHTML\"\nexport { asImageSrc } from \"./helpers/asImageSrc\"\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\"\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\"\nexport * as isFilled from \"./helpers/isFilled\"\n\n/**\n * @deprecated Renamed to `mapSliceZone`\n */\nconst unstable_mapSliceZone = mapSliceZone\nexport { mapSliceZone, unstable_mapSliceZone }\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\"\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\"\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\"\nexport type { SliceMapper } from \"./helpers/mapSliceZone\"\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n}\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\"\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\n// Client Errors\nexport { PrismicError } from \"./errors/PrismicError\"\nexport { ForbiddenError } from \"./errors/ForbiddenError\"\nexport { NotFoundError } from \"./errors/NotFoundError\"\nexport { RefNotFoundError } from \"./errors/RefNotFoundError\"\nexport { RefExpiredError } from \"./errors/RefExpiredError\"\nexport { PreviewTokenExpiredError } from \"./errors/PreviewTokenExpired\"\nexport { ParsingError } from \"./errors/ParsingError\"\nexport { RepositoryNotFoundError } from \"./errors/RepositoryNotFoundError\"\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\n/**\n * @deprecated Use {@link RichTextNodeType} instead.\n */\n// TODO: Remove in v8.\nconst Element = RichTextNodeType\nexport { RichTextNodeType, Element }\nexport { LinkType } from \"./types/value/link\"\nexport { OEmbedType } from \"./types/value/embed\"\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\"\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n\tRichTextNodeTypes,\n} from \"./types/value/richText\"\nexport type { TitleField } from \"./types/value/title\"\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\"\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\"\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\"\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\"\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\"\n\nexport type {\n\tTableField,\n\tTableFieldHead,\n\tTableFieldHeadRow,\n\tTableFieldBody,\n\tTableFieldBodyRow,\n\tTableFieldHeaderCell,\n\tTableFieldDataCell,\n} from \"./types/value/table\"\n\nexport type { BooleanField } from \"./types/value/boolean\"\nexport type { ColorField } from \"./types/value/color\"\nexport type { DateField } from \"./types/value/date\"\nexport type { KeyTextField } from \"./types/value/keyText\"\nexport type { NumberField } from \"./types/value/number\"\nexport type { SelectField } from \"./types/value/select\"\nexport type { TimestampField } from \"./types/value/timestamp\"\nexport type { GeoPointField } from \"./types/value/geoPoint\"\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField\nexport type { IntegrationField, IntegrationFields }\nexport type { IntegrationFieldData } from \"./types/value/integration\"\n\nexport type { GroupField, NestedGroupField } from \"./types/value/group\"\n\nexport type { SliceZone } from \"./types/value/sliceZone\"\nexport type { Slice } from \"./types/value/slice\"\nexport type { SharedSlice } from \"./types/value/sharedSlice\"\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\"\n\nexport type {\n\tFieldState,\n\tAnyRegularField,\n\tAnySlicePrimaryField,\n\tRepeatable,\n} from \"./types/value/types\"\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\"\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\"\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\"\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\"\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\"\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\"\nexport type { CustomTypeModelTitleField } from \"./types/model/title\"\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\"\n\nexport type {\n\tCustomTypeModelFetchCustomTypeLevel1,\n\tCustomTypeModelFetchContentRelationshipLevel1,\n\tCustomTypeModelFetchGroupLevel1,\n\tCustomTypeModelFetchCustomTypeLevel2,\n\tCustomTypeModelFetchGroupLevel2,\n\tCustomTypeModelContentRelationshipField,\n} from \"./types/model/contentRelationship\"\nexport type { CustomTypeModelLinkField } from \"./types/model/link\"\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\"\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\"\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\"\nexport type { CustomTypeModelColorField } from \"./types/model/color\"\nexport type { CustomTypeModelDateField } from \"./types/model/date\"\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\"\nexport type { CustomTypeModelNumberField } from \"./types/model/number\"\nexport type { CustomTypeModelSelectField } from \"./types/model/select\"\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\"\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\"\nexport type { CustomTypeModelTableField } from \"./types/model/table\"\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n}\nexport type {\n\tCustomTypeModelGroupField,\n\tCustomTypeModelNestedGroupField,\n} from \"./types/model/group\"\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\"\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\"\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\"\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\"\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\"\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\"\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\"\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n\tCustomTypeModelFieldForNestedGroup,\n\tCustomTypeModelFieldForSlicePrimary,\n} from \"./types/model/types\"\n\n// Migrations - Types representing Prismic Migration API content values.\nexport { PrismicMigrationDocument } from \"./types/migration/Document\"\nexport type {\n\tPendingPrismicDocument,\n\tExistingPrismicDocument,\n\tInjectMigrationSpecificTypes,\n} from \"./types/migration/Document\"\n\nexport { PrismicMigrationAsset } from \"./types/migration/Asset\"\nexport type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./types/migration/Asset\"\nexport type { MigrationContentRelationship } from \"./types/migration/ContentRelationship\"\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\"\n\nexport type { Ref } from \"./types/api/ref\"\n\nexport type { Release } from \"./types/api/release\"\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\"\n\nexport type { Tags } from \"./types/api/tags\"\n\n// Integration - Types representing Prismic's integration API.\nexport {\n\tIntegrationAPIItem,\n\tIntegrationAPIResults,\n} from \"./types/api/integration\"\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\"\n\nexport type { WebhookBody } from \"./types/webhook/types\"\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\"\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\"\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,YAAY;AA2ClB,MAAM,wBAAwB;AAiD9B,MAAM,UAAU;"}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isRepositoryEndpoint = (input) => {
4
- try {
5
- new URL(input);
6
- return true;
7
- } catch {
8
- return false;
9
- }
10
- };
11
- exports.isRepositoryEndpoint = isRepositoryEndpoint;
12
- //# sourceMappingURL=isRepositoryEndpoint.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRepositoryEndpoint.cjs","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 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"],"names":[],"mappings":";;AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,QACA;AACA,WAAA;AAAA,EAAA;AAET;;"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid
3
- * URL is a valid endpoint to support network proxies.
4
- *
5
- * @param input - Input to test.
6
- *
7
- * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`
8
- * otherwise.
9
- */
10
- export declare const isRepositoryEndpoint: (input: string) => boolean;
@@ -1,12 +0,0 @@
1
- const isRepositoryEndpoint = (input) => {
2
- try {
3
- new URL(input);
4
- return true;
5
- } catch {
6
- return false;
7
- }
8
- };
9
- export {
10
- isRepositoryEndpoint
11
- };
12
- //# sourceMappingURL=isRepositoryEndpoint.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRepositoryEndpoint.js","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 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"],"names":[],"mappings":"AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,QACA;AACA,WAAA;AAAA,EAAA;AAET;"}
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isRepositoryName = (input) => {
4
- return /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input);
5
- };
6
- exports.isRepositoryName = isRepositoryName;
7
- //# sourceMappingURL=isRepositoryName.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRepositoryName.cjs","sources":["../../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n *\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"],"names":[],"mappings":";;AAQa,MAAA,mBAAmB,CAAC,UAA0B;AACnD,SAAA,2CAA2C,KAAK,KAAK;AAC7D;;"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Determines if an input is a valid Prismic repository name.
3
- *
4
- * @param input - Input to test.
5
- *
6
- * @returns `true` if `input` is a valid Prismic repository name, `false`
7
- * otherwise.
8
- */
9
- export declare const isRepositoryName: (input: string) => boolean;
@@ -1,7 +0,0 @@
1
- const isRepositoryName = (input) => {
2
- return /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input);
3
- };
4
- export {
5
- isRepositoryName
6
- };
7
- //# sourceMappingURL=isRepositoryName.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isRepositoryName.js","sources":["../../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n *\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"],"names":[],"mappings":"AAQa,MAAA,mBAAmB,CAAC,UAA0B;AACnD,SAAA,2CAA2C,KAAK,KAAK;AAC7D;"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const castArray = require("./castArray.cjs");
4
- const appendFilters = (objWithFilters = {}, filters) => {
5
- return {
6
- ...objWithFilters,
7
- filters: [...objWithFilters.filters || [], ...castArray.castArray(filters)]
8
- };
9
- };
10
- exports.appendFilters = appendFilters;
11
- //# sourceMappingURL=appendFilters.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appendFilters.cjs","sources":["../../../src/lib/appendFilters.ts"],"sourcesContent":["import { castArray } from \"./castArray\"\n\ninterface WithFilters {\n\tfilters?: string | string[]\n}\n\n/**\n * Adds one or more filters to an object with a `filters` property. Appended\n * filters are added to the end of the existing list.\n *\n * @typeParam T - Object to which filters will be append.\n *\n * @param objWithFilters - Object to append filters on the `filters` property.\n * @param filters - One or more filters to append.\n *\n * @returns The object with the appended filters.\n */\nexport const appendFilters = <T extends WithFilters>(\n\tobjWithFilters: T = {} as T,\n\tfilters: string | string[],\n): T & { filters: string[] } => {\n\treturn {\n\t\t...objWithFilters,\n\t\tfilters: [...(objWithFilters.filters || []), ...castArray(filters)],\n\t}\n}\n"],"names":["castArray"],"mappings":";;;AAiBO,MAAM,gBAAgB,CAC5B,iBAAoB,IACpB,YAC8B;AACvB,SAAA;AAAA,IACN,GAAG;AAAA,IACH,SAAS,CAAC,GAAI,eAAe,WAAW,CAAA,GAAK,GAAGA,UAAU,UAAA,OAAO,CAAC;AAAA;AAEpE;;"}
@@ -1,18 +0,0 @@
1
- interface WithFilters {
2
- filters?: string | string[];
3
- }
4
- /**
5
- * Adds one or more filters to an object with a `filters` property. Appended
6
- * filters are added to the end of the existing list.
7
- *
8
- * @typeParam T - Object to which filters will be append.
9
- *
10
- * @param objWithFilters - Object to append filters on the `filters` property.
11
- * @param filters - One or more filters to append.
12
- *
13
- * @returns The object with the appended filters.
14
- */
15
- export declare const appendFilters: <T extends WithFilters>(objWithFilters: T | undefined, filters: string | string[]) => T & {
16
- filters: string[];
17
- };
18
- export {};