@prismicio/client 7.21.0-alpha.2 → 7.21.0-pr.414.8f3ed35

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 (468) hide show
  1. package/dist/Client.cjs +1271 -0
  2. package/dist/Client.cjs.map +1 -0
  3. package/dist/Client.d.ts +981 -0
  4. package/dist/Client.js +1271 -0
  5. package/dist/Client.js.map +1 -0
  6. package/dist/Migration.cjs +297 -0
  7. package/dist/Migration.cjs.map +1 -0
  8. package/dist/Migration.d.ts +213 -0
  9. package/dist/Migration.js +297 -0
  10. package/dist/Migration.js.map +1 -0
  11. package/dist/WriteClient.cjs +575 -0
  12. package/dist/WriteClient.cjs.map +1 -0
  13. package/dist/WriteClient.d.ts +281 -0
  14. package/dist/WriteClient.js +575 -0
  15. package/dist/WriteClient.js.map +1 -0
  16. package/dist/buildQueryURL.cjs +69 -0
  17. package/dist/buildQueryURL.cjs.map +1 -0
  18. package/dist/buildQueryURL.d.ts +217 -0
  19. package/dist/buildQueryURL.js +69 -0
  20. package/dist/buildQueryURL.js.map +1 -0
  21. package/dist/cookie.cjs +5 -0
  22. package/dist/cookie.cjs.map +1 -0
  23. package/dist/cookie.d.ts +5 -0
  24. package/dist/cookie.js +5 -0
  25. package/dist/cookie.js.map +1 -0
  26. package/dist/createClient.cjs +6 -0
  27. package/dist/createClient.cjs.map +1 -0
  28. package/dist/createClient.d.ts +35 -0
  29. package/dist/createClient.js +6 -0
  30. package/dist/createClient.js.map +1 -0
  31. package/dist/createMigration.cjs +6 -0
  32. package/dist/createMigration.cjs.map +1 -0
  33. package/dist/createMigration.d.ts +24 -0
  34. package/dist/createMigration.js +6 -0
  35. package/dist/createMigration.js.map +1 -0
  36. package/dist/createWriteClient.cjs +6 -0
  37. package/dist/createWriteClient.cjs.map +1 -0
  38. package/dist/createWriteClient.d.ts +32 -0
  39. package/dist/createWriteClient.js +6 -0
  40. package/dist/createWriteClient.js.map +1 -0
  41. package/dist/errors/ForbiddenError.cjs +7 -0
  42. package/dist/errors/ForbiddenError.cjs.map +1 -0
  43. package/dist/errors/ForbiddenError.d.ts +11 -0
  44. package/dist/errors/ForbiddenError.js +7 -0
  45. package/dist/errors/ForbiddenError.js.map +1 -0
  46. package/dist/errors/InvalidDataError.cjs +7 -0
  47. package/dist/errors/InvalidDataError.cjs.map +1 -0
  48. package/dist/errors/InvalidDataError.d.ts +3 -0
  49. package/dist/errors/InvalidDataError.js +7 -0
  50. package/dist/errors/InvalidDataError.js.map +1 -0
  51. package/dist/errors/NotFoundError.cjs +7 -0
  52. package/dist/errors/NotFoundError.cjs.map +1 -0
  53. package/dist/errors/NotFoundError.d.ts +3 -0
  54. package/dist/errors/NotFoundError.js +7 -0
  55. package/dist/errors/NotFoundError.js.map +1 -0
  56. package/dist/errors/ParsingError.cjs +7 -0
  57. package/dist/errors/ParsingError.cjs.map +1 -0
  58. package/dist/errors/ParsingError.d.ts +14 -0
  59. package/dist/errors/ParsingError.js +7 -0
  60. package/dist/errors/ParsingError.js.map +1 -0
  61. package/dist/errors/PreviewTokenExpired.cjs +7 -0
  62. package/dist/errors/PreviewTokenExpired.cjs.map +1 -0
  63. package/dist/errors/PreviewTokenExpired.d.ts +8 -0
  64. package/dist/errors/PreviewTokenExpired.js +7 -0
  65. package/dist/errors/PreviewTokenExpired.js.map +1 -0
  66. package/dist/errors/PrismicError.cjs +13 -0
  67. package/dist/errors/PrismicError.cjs.map +1 -0
  68. package/dist/errors/PrismicError.d.ts +5 -0
  69. package/dist/errors/PrismicError.js +13 -0
  70. package/dist/errors/PrismicError.js.map +1 -0
  71. package/dist/errors/RefExpiredError.cjs +7 -0
  72. package/dist/errors/RefExpiredError.cjs.map +1 -0
  73. package/dist/errors/RefExpiredError.d.ts +8 -0
  74. package/dist/errors/RefExpiredError.js +7 -0
  75. package/dist/errors/RefExpiredError.js.map +1 -0
  76. package/dist/errors/RefNotFoundError.cjs +7 -0
  77. package/dist/errors/RefNotFoundError.cjs.map +1 -0
  78. package/dist/errors/RefNotFoundError.d.ts +8 -0
  79. package/dist/errors/RefNotFoundError.js +7 -0
  80. package/dist/errors/RefNotFoundError.js.map +1 -0
  81. package/dist/errors/RepositoryNotFoundError.cjs +7 -0
  82. package/dist/errors/RepositoryNotFoundError.cjs.map +1 -0
  83. package/dist/errors/RepositoryNotFoundError.d.ts +3 -0
  84. package/dist/errors/RepositoryNotFoundError.js +7 -0
  85. package/dist/errors/RepositoryNotFoundError.js.map +1 -0
  86. package/dist/filter.cjs +247 -0
  87. package/dist/filter.cjs.map +1 -0
  88. package/dist/filter.d.ts +209 -0
  89. package/dist/filter.js +247 -0
  90. package/dist/filter.js.map +1 -0
  91. package/dist/getGraphQLEndpoint.cjs +13 -0
  92. package/dist/getGraphQLEndpoint.cjs.map +1 -0
  93. package/dist/getGraphQLEndpoint.d.ts +10 -0
  94. package/dist/getGraphQLEndpoint.js +13 -0
  95. package/dist/getGraphQLEndpoint.js.map +1 -0
  96. package/dist/getRepositoryEndpoint.cjs +13 -0
  97. package/dist/getRepositoryEndpoint.cjs.map +1 -0
  98. package/dist/getRepositoryEndpoint.d.ts +19 -0
  99. package/dist/getRepositoryEndpoint.js +13 -0
  100. package/dist/getRepositoryEndpoint.js.map +1 -0
  101. package/dist/getRepositoryName.cjs +17 -0
  102. package/dist/getRepositoryName.cjs.map +1 -0
  103. package/dist/getRepositoryName.d.ts +12 -0
  104. package/dist/getRepositoryName.js +17 -0
  105. package/dist/getRepositoryName.js.map +1 -0
  106. package/dist/getToolbarSrc.cjs +13 -0
  107. package/dist/getToolbarSrc.cjs.map +1 -0
  108. package/dist/getToolbarSrc.d.ts +34 -0
  109. package/dist/getToolbarSrc.js +13 -0
  110. package/dist/getToolbarSrc.js.map +1 -0
  111. package/dist/helpers/asDate.cjs +14 -0
  112. package/dist/helpers/asDate.cjs.map +1 -0
  113. package/dist/helpers/asDate.d.ts +24 -0
  114. package/dist/helpers/asDate.js +14 -0
  115. package/dist/helpers/asDate.js.map +1 -0
  116. package/dist/helpers/asHTML.cjs +86 -0
  117. package/dist/helpers/asHTML.cjs.map +1 -0
  118. package/dist/helpers/asHTML.d.ts +149 -0
  119. package/dist/helpers/asHTML.js +86 -0
  120. package/dist/helpers/asHTML.js.map +1 -0
  121. package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
  122. package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
  123. package/dist/helpers/asImagePixelDensitySrcSet.d.ts +54 -0
  124. package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
  125. package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
  126. package/dist/helpers/asImageSrc.cjs +13 -0
  127. package/dist/helpers/asImageSrc.cjs.map +1 -0
  128. package/dist/helpers/asImageSrc.d.ts +29 -0
  129. package/dist/helpers/asImageSrc.js +13 -0
  130. package/dist/helpers/asImageSrc.js.map +1 -0
  131. package/dist/helpers/asImageWidthSrcSet.cjs +45 -0
  132. package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
  133. package/dist/helpers/asImageWidthSrcSet.d.ts +62 -0
  134. package/dist/helpers/asImageWidthSrcSet.js +45 -0
  135. package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
  136. package/dist/helpers/asLink.cjs +47 -0
  137. package/dist/helpers/asLink.cjs.map +1 -0
  138. package/dist/helpers/asLink.d.ts +78 -0
  139. package/dist/helpers/asLink.js +47 -0
  140. package/dist/helpers/asLink.js.map +1 -0
  141. package/dist/helpers/asLinkAttrs.cjs +28 -0
  142. package/dist/helpers/asLinkAttrs.cjs.map +1 -0
  143. package/dist/helpers/asLinkAttrs.d.ts +47 -0
  144. package/dist/helpers/asLinkAttrs.js +28 -0
  145. package/dist/helpers/asLinkAttrs.js.map +1 -0
  146. package/dist/helpers/asText.cjs +21 -0
  147. package/dist/helpers/asText.cjs.map +1 -0
  148. package/dist/helpers/asText.d.ts +57 -0
  149. package/dist/helpers/asText.js +21 -0
  150. package/dist/helpers/asText.js.map +1 -0
  151. package/dist/helpers/documentToLinkField.cjs +26 -0
  152. package/dist/helpers/documentToLinkField.cjs.map +1 -0
  153. package/dist/helpers/documentToLinkField.d.ts +17 -0
  154. package/dist/helpers/documentToLinkField.js +26 -0
  155. package/dist/helpers/documentToLinkField.js.map +1 -0
  156. package/dist/helpers/isFilled.cjs +77 -0
  157. package/dist/helpers/isFilled.cjs.map +1 -0
  158. package/dist/helpers/isFilled.d.ts +191 -0
  159. package/dist/helpers/isFilled.js +77 -0
  160. package/dist/helpers/isFilled.js.map +1 -0
  161. package/dist/helpers/mapSliceZone.cjs +42 -0
  162. package/dist/helpers/mapSliceZone.cjs.map +1 -0
  163. package/dist/helpers/mapSliceZone.d.ts +136 -0
  164. package/dist/helpers/mapSliceZone.js +42 -0
  165. package/dist/helpers/mapSliceZone.js.map +1 -0
  166. package/dist/index.cjs +94 -3880
  167. package/dist/index.cjs.map +1 -1
  168. package/dist/index.d.ts +129 -4349
  169. package/dist/index.js +99 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/isRepositoryEndpoint.cjs +12 -0
  172. package/dist/isRepositoryEndpoint.cjs.map +1 -0
  173. package/dist/isRepositoryEndpoint.d.ts +10 -0
  174. package/dist/isRepositoryEndpoint.js +12 -0
  175. package/dist/isRepositoryEndpoint.js.map +1 -0
  176. package/dist/isRepositoryName.cjs +7 -0
  177. package/dist/isRepositoryName.cjs.map +1 -0
  178. package/dist/isRepositoryName.d.ts +9 -0
  179. package/dist/isRepositoryName.js +7 -0
  180. package/dist/isRepositoryName.js.map +1 -0
  181. package/dist/lib/appendFilters.cjs +11 -0
  182. package/dist/lib/appendFilters.cjs.map +1 -0
  183. package/dist/lib/appendFilters.d.ts +18 -0
  184. package/dist/lib/appendFilters.js +11 -0
  185. package/dist/lib/appendFilters.js.map +1 -0
  186. package/dist/lib/castArray.cjs +7 -0
  187. package/dist/lib/castArray.cjs.map +1 -0
  188. package/dist/lib/castArray.d.ts +12 -0
  189. package/dist/lib/castArray.js +7 -0
  190. package/dist/lib/castArray.js.map +1 -0
  191. package/dist/lib/castThunk.cjs +7 -0
  192. package/dist/lib/castThunk.cjs.map +1 -0
  193. package/dist/lib/castThunk.d.ts +11 -0
  194. package/dist/lib/castThunk.js +7 -0
  195. package/dist/lib/castThunk.js.map +1 -0
  196. package/dist/lib/devMsg.cjs +8 -0
  197. package/dist/lib/devMsg.cjs.map +1 -0
  198. package/dist/lib/devMsg.d.ts +16 -0
  199. package/dist/lib/devMsg.js +8 -0
  200. package/dist/lib/devMsg.js.map +1 -0
  201. package/dist/lib/escapeHTML.cjs +43 -0
  202. package/dist/lib/escapeHTML.cjs.map +1 -0
  203. package/dist/lib/escapeHTML.d.ts +1 -0
  204. package/dist/lib/escapeHTML.js +43 -0
  205. package/dist/lib/escapeHTML.js.map +1 -0
  206. package/dist/lib/everyTagFilter.cjs +9 -0
  207. package/dist/lib/everyTagFilter.cjs.map +1 -0
  208. package/dist/lib/everyTagFilter.d.ts +9 -0
  209. package/dist/lib/everyTagFilter.js +9 -0
  210. package/dist/lib/everyTagFilter.js.map +1 -0
  211. package/dist/lib/findMasterRef.cjs +8 -0
  212. package/dist/lib/findMasterRef.cjs.map +1 -0
  213. package/dist/lib/findMasterRef.d.ts +11 -0
  214. package/dist/lib/findMasterRef.js +8 -0
  215. package/dist/lib/findMasterRef.js.map +1 -0
  216. package/dist/lib/findRef.cjs +12 -0
  217. package/dist/lib/findRef.cjs.map +1 -0
  218. package/dist/lib/findRef.d.ts +14 -0
  219. package/dist/lib/findRef.js +12 -0
  220. package/dist/lib/findRef.js.map +1 -0
  221. package/dist/lib/findRefByID.cjs +8 -0
  222. package/dist/lib/findRefByID.cjs.map +1 -0
  223. package/dist/lib/findRefByID.d.ts +12 -0
  224. package/dist/lib/findRefByID.js +8 -0
  225. package/dist/lib/findRefByID.js.map +1 -0
  226. package/dist/lib/findRefByLabel.cjs +8 -0
  227. package/dist/lib/findRefByLabel.cjs.map +1 -0
  228. package/dist/lib/findRefByLabel.d.ts +12 -0
  229. package/dist/lib/findRefByLabel.js +8 -0
  230. package/dist/lib/findRefByLabel.js.map +1 -0
  231. package/dist/lib/getOptionalLinkProperties.cjs +14 -0
  232. package/dist/lib/getOptionalLinkProperties.cjs.map +1 -0
  233. package/dist/lib/getOptionalLinkProperties.d.ts +12 -0
  234. package/dist/lib/getOptionalLinkProperties.js +14 -0
  235. package/dist/lib/getOptionalLinkProperties.js.map +1 -0
  236. package/dist/lib/getPreviewCookie.cjs +21 -0
  237. package/dist/lib/getPreviewCookie.cjs.map +1 -0
  238. package/dist/lib/getPreviewCookie.d.ts +9 -0
  239. package/dist/lib/getPreviewCookie.js +21 -0
  240. package/dist/lib/getPreviewCookie.js.map +1 -0
  241. package/dist/lib/isInternalURL.cjs +9 -0
  242. package/dist/lib/isInternalURL.cjs.map +1 -0
  243. package/dist/lib/isInternalURL.d.ts +8 -0
  244. package/dist/lib/isInternalURL.js +9 -0
  245. package/dist/lib/isInternalURL.js.map +1 -0
  246. package/dist/lib/isMigrationValue.cjs +24 -0
  247. package/dist/lib/isMigrationValue.cjs.map +1 -0
  248. package/dist/lib/isMigrationValue.d.ts +71 -0
  249. package/dist/lib/isMigrationValue.js +24 -0
  250. package/dist/lib/isMigrationValue.js.map +1 -0
  251. package/dist/lib/isValue.cjs +53 -0
  252. package/dist/lib/isValue.cjs.map +1 -0
  253. package/dist/lib/isValue.d.ts +78 -0
  254. package/dist/lib/isValue.js +53 -0
  255. package/dist/lib/isValue.js.map +1 -0
  256. package/dist/lib/minifyGraphQLQuery.cjs +7 -0
  257. package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
  258. package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
  259. package/dist/lib/minifyGraphQLQuery.js +7 -0
  260. package/dist/lib/minifyGraphQLQuery.js.map +1 -0
  261. package/dist/lib/pLimit.cjs +48 -0
  262. package/dist/lib/pLimit.cjs.map +1 -0
  263. package/dist/lib/pLimit.d.ts +22 -0
  264. package/dist/lib/pLimit.js +48 -0
  265. package/dist/lib/pLimit.js.map +1 -0
  266. package/dist/lib/request.cjs +41 -0
  267. package/dist/lib/request.cjs.map +1 -0
  268. package/dist/lib/request.d.ts +73 -0
  269. package/dist/lib/request.js +41 -0
  270. package/dist/lib/request.js.map +1 -0
  271. package/dist/lib/resolveMigrationDocumentData.cjs +132 -0
  272. package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
  273. package/dist/lib/resolveMigrationDocumentData.d.ts +54 -0
  274. package/dist/lib/resolveMigrationDocumentData.js +132 -0
  275. package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
  276. package/dist/lib/serializerHelpers.cjs +113 -0
  277. package/dist/lib/serializerHelpers.cjs.map +1 -0
  278. package/dist/lib/serializerHelpers.d.ts +9 -0
  279. package/dist/lib/serializerHelpers.js +113 -0
  280. package/dist/lib/serializerHelpers.js.map +1 -0
  281. package/dist/lib/someTagsFilter.cjs +9 -0
  282. package/dist/lib/someTagsFilter.cjs.map +1 -0
  283. package/dist/lib/someTagsFilter.d.ts +9 -0
  284. package/dist/lib/someTagsFilter.js +9 -0
  285. package/dist/lib/someTagsFilter.js.map +1 -0
  286. package/dist/lib/throttledLog.cjs +17 -0
  287. package/dist/lib/throttledLog.cjs.map +1 -0
  288. package/dist/lib/throttledLog.d.ts +15 -0
  289. package/dist/lib/throttledLog.js +17 -0
  290. package/dist/lib/throttledLog.js.map +1 -0
  291. package/dist/lib/typeFilter.cjs +8 -0
  292. package/dist/lib/typeFilter.cjs.map +1 -0
  293. package/dist/lib/typeFilter.d.ts +8 -0
  294. package/dist/lib/typeFilter.js +8 -0
  295. package/dist/lib/typeFilter.js.map +1 -0
  296. package/dist/lib/validateAssetMetadata.cjs +28 -0
  297. package/dist/lib/validateAssetMetadata.cjs.map +1 -0
  298. package/dist/lib/validateAssetMetadata.d.ts +10 -0
  299. package/dist/lib/validateAssetMetadata.js +28 -0
  300. package/dist/lib/validateAssetMetadata.js.map +1 -0
  301. package/dist/package.json.cjs +7 -0
  302. package/dist/package.json.cjs.map +1 -0
  303. package/dist/package.json.js +7 -0
  304. package/dist/package.json.js.map +1 -0
  305. package/dist/richtext/asText.cjs +13 -0
  306. package/dist/richtext/asText.cjs.map +1 -0
  307. package/dist/richtext/asText.d.ts +12 -0
  308. package/dist/richtext/asText.js +13 -0
  309. package/dist/richtext/asText.js.map +1 -0
  310. package/dist/richtext/asTree.cjs +123 -0
  311. package/dist/richtext/asTree.cjs.map +1 -0
  312. package/dist/richtext/asTree.d.ts +14 -0
  313. package/dist/richtext/asTree.js +123 -0
  314. package/dist/richtext/asTree.js.map +1 -0
  315. package/dist/richtext/composeSerializers.cjs +17 -0
  316. package/dist/richtext/composeSerializers.cjs.map +1 -0
  317. package/dist/richtext/composeSerializers.d.ts +16 -0
  318. package/dist/richtext/composeSerializers.js +17 -0
  319. package/dist/richtext/composeSerializers.js.map +1 -0
  320. package/dist/richtext/index.d.ts +7 -78
  321. package/dist/richtext/serialize.cjs +19 -0
  322. package/dist/richtext/serialize.cjs.map +1 -0
  323. package/dist/richtext/serialize.d.ts +19 -0
  324. package/dist/richtext/serialize.js +19 -0
  325. package/dist/richtext/serialize.js.map +1 -0
  326. package/dist/richtext/types.cjs +11 -0
  327. package/dist/richtext/types.cjs.map +1 -0
  328. package/dist/richtext/types.d.ts +71 -0
  329. package/dist/richtext/types.js +11 -0
  330. package/dist/richtext/types.js.map +1 -0
  331. package/dist/richtext/wrapMapSerializer.cjs +24 -0
  332. package/dist/richtext/wrapMapSerializer.cjs.map +1 -0
  333. package/dist/richtext/wrapMapSerializer.d.ts +15 -0
  334. package/dist/richtext/wrapMapSerializer.js +24 -0
  335. package/dist/richtext/wrapMapSerializer.js.map +1 -0
  336. package/dist/richtext.cjs +15 -0
  337. package/dist/richtext.cjs.map +1 -0
  338. package/dist/richtext.js +15 -0
  339. package/dist/richtext.js.map +1 -0
  340. package/dist/types/api/asset/asset.d.ts +177 -0
  341. package/dist/types/api/asset/tag.d.ts +53 -0
  342. package/dist/types/api/integration.d.ts +28 -0
  343. package/dist/types/api/migration/document.d.ts +60 -0
  344. package/dist/types/api/query.d.ts +43 -0
  345. package/dist/types/api/ref.d.ts +32 -0
  346. package/dist/types/api/release.d.ts +11 -0
  347. package/dist/types/api/repository.d.ts +109 -0
  348. package/dist/types/api/tags.d.ts +9 -0
  349. package/dist/types/migration/Asset.cjs +30 -0
  350. package/dist/types/migration/Asset.cjs.map +1 -0
  351. package/dist/types/migration/Asset.d.ts +108 -0
  352. package/dist/types/migration/Asset.js +30 -0
  353. package/dist/types/migration/Asset.js.map +1 -0
  354. package/dist/types/migration/ContentRelationship.d.ts +16 -0
  355. package/dist/types/migration/Document.cjs +44 -0
  356. package/dist/types/migration/Document.cjs.map +1 -0
  357. package/dist/types/migration/Document.d.ts +94 -0
  358. package/dist/types/migration/Document.js +44 -0
  359. package/dist/types/migration/Document.js.map +1 -0
  360. package/dist/types/migration/Link.d.ts +19 -0
  361. package/dist/types/model/boolean.d.ts +15 -0
  362. package/dist/types/model/color.d.ts +13 -0
  363. package/dist/types/model/contentRelationship.d.ts +53 -0
  364. package/dist/types/model/customType.d.ts +48 -0
  365. package/dist/types/model/date.d.ts +14 -0
  366. package/dist/types/model/embed.d.ts +13 -0
  367. package/dist/types/model/geoPoint.d.ts +12 -0
  368. package/dist/types/model/group.d.ts +23 -0
  369. package/dist/types/model/image.d.ts +31 -0
  370. package/dist/types/model/integration.d.ts +14 -0
  371. package/dist/types/model/keyText.d.ts +13 -0
  372. package/dist/types/model/link.cjs +9 -0
  373. package/dist/types/model/link.cjs.map +1 -0
  374. package/dist/types/model/link.d.ts +28 -0
  375. package/dist/types/model/link.js +9 -0
  376. package/dist/types/model/link.js.map +1 -0
  377. package/dist/types/model/linkToMedia.d.ts +17 -0
  378. package/dist/types/model/number.d.ts +15 -0
  379. package/dist/types/model/range.d.ts +14 -0
  380. package/dist/types/model/richText.d.ts +37 -0
  381. package/dist/types/model/select.d.ts +18 -0
  382. package/dist/types/model/separator.d.ts +10 -0
  383. package/dist/types/model/sharedSlice.d.ts +16 -0
  384. package/dist/types/model/sharedSliceVariation.d.ts +19 -0
  385. package/dist/types/model/slice.cjs +8 -0
  386. package/dist/types/model/slice.cjs.map +1 -0
  387. package/dist/types/model/slice.d.ts +33 -0
  388. package/dist/types/model/slice.js +8 -0
  389. package/dist/types/model/slice.js.map +1 -0
  390. package/dist/types/model/sliceZone.cjs +8 -0
  391. package/dist/types/model/sliceZone.cjs.map +1 -0
  392. package/dist/types/model/sliceZone.d.ts +41 -0
  393. package/dist/types/model/sliceZone.js +8 -0
  394. package/dist/types/model/sliceZone.js.map +1 -0
  395. package/dist/types/model/table.d.ts +12 -0
  396. package/dist/types/model/timestamp.d.ts +14 -0
  397. package/dist/types/model/title.d.ts +7 -0
  398. package/dist/types/model/types.cjs +39 -0
  399. package/dist/types/model/types.cjs.map +1 -0
  400. package/dist/types/model/types.d.ts +76 -0
  401. package/dist/types/model/types.js +39 -0
  402. package/dist/types/model/types.js.map +1 -0
  403. package/dist/types/model/uid.d.ts +13 -0
  404. package/dist/types/value/boolean.d.ts +6 -0
  405. package/dist/types/value/color.d.ts +9 -0
  406. package/dist/types/value/contentRelationship.d.ts +31 -0
  407. package/dist/types/value/date.d.ts +9 -0
  408. package/dist/types/value/document.d.ts +114 -0
  409. package/dist/types/value/embed.cjs +10 -0
  410. package/dist/types/value/embed.cjs.map +1 -0
  411. package/dist/types/value/embed.d.ts +168 -0
  412. package/dist/types/value/embed.js +10 -0
  413. package/dist/types/value/embed.js.map +1 -0
  414. package/dist/types/value/geoPoint.d.ts +12 -0
  415. package/dist/types/value/group.d.ts +13 -0
  416. package/dist/types/value/image.d.ts +47 -0
  417. package/dist/types/value/integration.d.ts +16 -0
  418. package/dist/types/value/keyText.d.ts +9 -0
  419. package/dist/types/value/link.cjs +10 -0
  420. package/dist/types/value/link.cjs.map +1 -0
  421. package/dist/types/value/link.d.ts +68 -0
  422. package/dist/types/value/link.js +10 -0
  423. package/dist/types/value/link.js.map +1 -0
  424. package/dist/types/value/linkToMedia.d.ts +28 -0
  425. package/dist/types/value/number.d.ts +9 -0
  426. package/dist/types/value/richText.cjs +25 -0
  427. package/dist/types/value/richText.cjs.map +1 -0
  428. package/dist/types/value/richText.d.ts +215 -0
  429. package/dist/types/value/richText.js +25 -0
  430. package/dist/types/value/richText.js.map +1 -0
  431. package/dist/types/value/select.d.ts +10 -0
  432. package/dist/types/value/sharedSlice.d.ts +11 -0
  433. package/dist/types/value/sharedSliceVariation.d.ts +10 -0
  434. package/dist/types/value/slice.d.ts +13 -0
  435. package/dist/types/value/sliceZone.d.ts +12 -0
  436. package/dist/types/value/table.d.ts +91 -0
  437. package/dist/types/value/timestamp.d.ts +7 -0
  438. package/dist/types/value/title.d.ts +12 -0
  439. package/dist/types/value/types.d.ts +58 -0
  440. package/dist/types/webhook/apiUpdate.d.ts +52 -0
  441. package/dist/types/webhook/testTrigger.d.ts +9 -0
  442. package/dist/types/webhook/types.cjs +8 -0
  443. package/dist/types/webhook/types.cjs.map +1 -0
  444. package/dist/types/webhook/types.d.ts +18 -0
  445. package/dist/types/webhook/types.js +8 -0
  446. package/dist/types/webhook/types.js.map +1 -0
  447. package/package.json +39 -23
  448. package/src/Client.ts +25 -8
  449. package/src/WriteClient.ts +22 -33
  450. package/src/buildQueryURL.ts +4 -1
  451. package/src/createClient.ts +1 -1
  452. package/src/index.ts +1 -0
  453. package/src/types/model/contentRelationship.ts +1 -0
  454. package/src/types/value/date.ts +1 -1
  455. package/src/types/value/timestamp.ts +1 -5
  456. package/dist/index.d.cts +0 -4424
  457. package/dist/index.d.mts +0 -4424
  458. package/dist/index.mjs +0 -3837
  459. package/dist/index.mjs.map +0 -1
  460. package/dist/richtext/index.cjs +0 -244
  461. package/dist/richtext/index.cjs.map +0 -1
  462. package/dist/richtext/index.d.cts +0 -78
  463. package/dist/richtext/index.d.mts +0 -78
  464. package/dist/richtext/index.mjs +0 -237
  465. package/dist/richtext/index.mjs.map +0 -1
  466. package/dist/shared/client.TSGr56lO.d.cts +0 -899
  467. package/dist/shared/client.TSGr56lO.d.mts +0 -899
  468. package/dist/shared/client.TSGr56lO.d.ts +0 -899
@@ -0,0 +1,12 @@
1
+ import { PrismicError } from "../errors/PrismicError.js";
2
+ const findRef = (refs, filter) => {
3
+ const ref = refs.find((ref2) => filter(ref2));
4
+ if (!ref) {
5
+ throw new PrismicError("Ref could not be found.", void 0, void 0);
6
+ }
7
+ return ref;
8
+ };
9
+ export {
10
+ findRef
11
+ };
12
+ //# sourceMappingURL=findRef.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRef.js","sources":["../../../src/lib/findRef.ts"],"sourcesContent":["import type { Ref } from \"../types/api/ref\"\n\nimport { PrismicError } from \"../errors/PrismicError\"\n\n/**\n * Returns the first ref from a list that passes a filter (a function that\n * returns true).\n *\n * @param refs - A list of refs to search.\n * @param filter - A function that determines if a ref from the list matches the\n * criteria.\n *\n * @returns The first matching ref.\n *\n * @throws If a matching ref cannot be found.\n */\nexport const findRef = (refs: Ref[], filter: (ref: Ref) => boolean): Ref => {\n\tconst ref = refs.find((ref) => filter(ref))\n\n\tif (!ref) {\n\t\tthrow new PrismicError(\"Ref could not be found.\", undefined, undefined)\n\t}\n\n\treturn ref\n}\n"],"names":["ref"],"mappings":";AAgBO,MAAM,UAAU,CAAC,MAAa,WAAsC;AAC1E,QAAM,MAAM,KAAK,KAAK,CAACA,SAAQ,OAAOA,IAAG,CAAC;AAE1C,MAAI,CAAC,KAAK;AACT,UAAM,IAAI,aAAa,2BAA2B,QAAW,MAAS;AAAA,EACvE;AAEA,SAAO;AACR;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const findRef = require("./findRef.cjs");
4
+ const findRefByID = (refs, id) => {
5
+ return findRef.findRef(refs, (ref) => ref.id === id);
6
+ };
7
+ exports.findRefByID = findRefByID;
8
+ //# sourceMappingURL=findRefByID.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRefByID.cjs","sources":["../../../src/lib/findRefByID.ts"],"sourcesContent":["import type { Ref } from \"../types/api/ref\"\n\nimport { findRef } from \"./findRef\"\n\n/**\n * Returns the ref from a list of given refs with a matching ID.\n *\n * @param refs - A list of refs to search.\n * @param id - The ID of the ref to find.\n *\n * @returns The ref with a matching ID from the list.\n *\n * @throws If a matching ref cannot be found.\n */\nexport const findRefByID = (refs: Ref[], id: string): Ref => {\n\treturn findRef(refs, (ref) => ref.id === id)\n}\n"],"names":["findRef"],"mappings":";;;AAcO,MAAM,cAAc,CAAC,MAAa,OAAmB;AAC3D,SAAOA,QAAAA,QAAQ,MAAM,CAAC,QAAQ,IAAI,OAAO,EAAE;AAC5C;;"}
@@ -0,0 +1,12 @@
1
+ import type { Ref } from "../types/api/ref.js";
2
+ /**
3
+ * Returns the ref from a list of given refs with a matching ID.
4
+ *
5
+ * @param refs - A list of refs to search.
6
+ * @param id - The ID of the ref to find.
7
+ *
8
+ * @returns The ref with a matching ID from the list.
9
+ *
10
+ * @throws If a matching ref cannot be found.
11
+ */
12
+ export declare const findRefByID: (refs: Ref[], id: string) => Ref;
@@ -0,0 +1,8 @@
1
+ import { findRef } from "./findRef.js";
2
+ const findRefByID = (refs, id) => {
3
+ return findRef(refs, (ref) => ref.id === id);
4
+ };
5
+ export {
6
+ findRefByID
7
+ };
8
+ //# sourceMappingURL=findRefByID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRefByID.js","sources":["../../../src/lib/findRefByID.ts"],"sourcesContent":["import type { Ref } from \"../types/api/ref\"\n\nimport { findRef } from \"./findRef\"\n\n/**\n * Returns the ref from a list of given refs with a matching ID.\n *\n * @param refs - A list of refs to search.\n * @param id - The ID of the ref to find.\n *\n * @returns The ref with a matching ID from the list.\n *\n * @throws If a matching ref cannot be found.\n */\nexport const findRefByID = (refs: Ref[], id: string): Ref => {\n\treturn findRef(refs, (ref) => ref.id === id)\n}\n"],"names":[],"mappings":";AAcO,MAAM,cAAc,CAAC,MAAa,OAAmB;AAC3D,SAAO,QAAQ,MAAM,CAAC,QAAQ,IAAI,OAAO,EAAE;AAC5C;"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const findRef = require("./findRef.cjs");
4
+ const findRefByLabel = (refs, label) => {
5
+ return findRef.findRef(refs, (ref) => ref.label === label);
6
+ };
7
+ exports.findRefByLabel = findRefByLabel;
8
+ //# sourceMappingURL=findRefByLabel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRefByLabel.cjs","sources":["../../../src/lib/findRefByLabel.ts"],"sourcesContent":["import type { Ref } from \"../types/api/ref\"\n\nimport { findRef } from \"./findRef\"\n\n/**\n * Returns the ref from a list of given refs with a matching label.\n *\n * @param refs - A list of refs to search.\n * @param id - The label of the ref to find.\n *\n * @returns The ref with a matching label from the list.\n *\n * @throws If a matching ref cannot be found.\n */\nexport const findRefByLabel = (refs: Ref[], label: string): Ref => {\n\treturn findRef(refs, (ref) => ref.label === label)\n}\n"],"names":["findRef"],"mappings":";;;AAcO,MAAM,iBAAiB,CAAC,MAAa,UAAsB;AACjE,SAAOA,QAAAA,QAAQ,MAAM,CAAC,QAAQ,IAAI,UAAU,KAAK;AAClD;;"}
@@ -0,0 +1,12 @@
1
+ import type { Ref } from "../types/api/ref.js";
2
+ /**
3
+ * Returns the ref from a list of given refs with a matching label.
4
+ *
5
+ * @param refs - A list of refs to search.
6
+ * @param id - The label of the ref to find.
7
+ *
8
+ * @returns The ref with a matching label from the list.
9
+ *
10
+ * @throws If a matching ref cannot be found.
11
+ */
12
+ export declare const findRefByLabel: (refs: Ref[], label: string) => Ref;
@@ -0,0 +1,8 @@
1
+ import { findRef } from "./findRef.js";
2
+ const findRefByLabel = (refs, label) => {
3
+ return findRef(refs, (ref) => ref.label === label);
4
+ };
5
+ export {
6
+ findRefByLabel
7
+ };
8
+ //# sourceMappingURL=findRefByLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findRefByLabel.js","sources":["../../../src/lib/findRefByLabel.ts"],"sourcesContent":["import type { Ref } from \"../types/api/ref\"\n\nimport { findRef } from \"./findRef\"\n\n/**\n * Returns the ref from a list of given refs with a matching label.\n *\n * @param refs - A list of refs to search.\n * @param id - The label of the ref to find.\n *\n * @returns The ref with a matching label from the list.\n *\n * @throws If a matching ref cannot be found.\n */\nexport const findRefByLabel = (refs: Ref[], label: string): Ref => {\n\treturn findRef(refs, (ref) => ref.label === label)\n}\n"],"names":[],"mappings":";AAcO,MAAM,iBAAiB,CAAC,MAAa,UAAsB;AACjE,SAAO,QAAQ,MAAM,CAAC,QAAQ,IAAI,UAAU,KAAK;AAClD;"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getOptionalLinkProperties = (input) => {
4
+ const res = {};
5
+ if ("text" in input) {
6
+ res.text = input.text;
7
+ }
8
+ if ("variant" in input) {
9
+ res.variant = input.variant;
10
+ }
11
+ return res;
12
+ };
13
+ exports.getOptionalLinkProperties = getOptionalLinkProperties;
14
+ //# sourceMappingURL=getOptionalLinkProperties.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOptionalLinkProperties.cjs","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\n * have the same shape as content relationship and link to media fields,\n * requiring special treatment to extract link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the\n * link properties will be extracted.\n *\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"],"names":[],"mappings":";;AAYO,MAAM,4BAA4B,CACxC,UAC2B;AAC3B,QAAM,MAA8B,CAAA;AAEpC,MAAI,UAAU,OAAO;AACpB,QAAI,OAAO,MAAM;AAAA,EAClB;AAEA,MAAI,aAAa,OAAO;AACvB,QAAI,UAAU,MAAM;AAAA,EACrB;AAEA,SAAO;AACR;;"}
@@ -0,0 +1,12 @@
1
+ import type { OptionalLinkProperties } from "../types/value/link.js";
2
+ /**
3
+ * Returns optional properties only available to link fields. Link fields can
4
+ * have the same shape as content relationship and link to media fields,
5
+ * requiring special treatment to extract link-specific properties.
6
+ *
7
+ * @param input - The content relationship or link to media field from which the
8
+ * link properties will be extracted.
9
+ *
10
+ * @returns Optional link properties that `input` might have.
11
+ */
12
+ export declare const getOptionalLinkProperties: (input: OptionalLinkProperties) => OptionalLinkProperties;
@@ -0,0 +1,14 @@
1
+ const getOptionalLinkProperties = (input) => {
2
+ const res = {};
3
+ if ("text" in input) {
4
+ res.text = input.text;
5
+ }
6
+ if ("variant" in input) {
7
+ res.variant = input.variant;
8
+ }
9
+ return res;
10
+ };
11
+ export {
12
+ getOptionalLinkProperties
13
+ };
14
+ //# sourceMappingURL=getOptionalLinkProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOptionalLinkProperties.js","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\n * have the same shape as content relationship and link to media fields,\n * requiring special treatment to extract link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the\n * link properties will be extracted.\n *\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"],"names":[],"mappings":"AAYO,MAAM,4BAA4B,CACxC,UAC2B;AAC3B,QAAM,MAA8B,CAAA;AAEpC,MAAI,UAAU,OAAO;AACpB,QAAI,OAAO,MAAM;AAAA,EAClB;AAEA,MAAI,aAAa,OAAO;AACvB,QAAI,UAAU,MAAM;AAAA,EACrB;AAEA,SAAO;AACR;"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const cookie = require("../cookie.cjs");
4
+ const readValue = (value) => {
5
+ return value.replace(/%3B/g, ";");
6
+ };
7
+ const getPreviewCookie = (cookieJar) => {
8
+ const cookies = cookieJar.split("; ");
9
+ let value;
10
+ for (const cookie$1 of cookies) {
11
+ const parts = cookie$1.split("=");
12
+ const name = readValue(parts[0]).replace(/%3D/g, "=");
13
+ if (name === cookie.preview) {
14
+ value = readValue(parts.slice(1).join("="));
15
+ break;
16
+ }
17
+ }
18
+ return value;
19
+ };
20
+ exports.getPreviewCookie = getPreviewCookie;
21
+ //# sourceMappingURL=getPreviewCookie.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPreviewCookie.cjs","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\n * cookie.\n *\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"],"names":["cookie","previewCookieName"],"mappings":";;;AAEA,MAAM,YAAY,CAAC,UAAyB;AAC3C,SAAO,MAAM,QAAQ,QAAQ,GAAG;AACjC;AAUO,MAAM,mBAAmB,CAAC,cAAyC;AACzE,QAAM,UAAU,UAAU,MAAM,IAAI;AAEpC,MAAI;AAEJ,aAAWA,YAAU,SAAS;AAC7B,UAAM,QAAQA,SAAO,MAAM,GAAG;AAC9B,UAAM,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,QAAQ,QAAQ,GAAG;AAEpD,QAAI,SAASC,OAAAA,SAAmB;AAC/B,cAAQ,UAAU,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAC1C;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;;"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the value of a cookie from a given cookie store.
3
+ *
4
+ * @param cookieJar - The stringified cookie store from which to read the
5
+ * cookie.
6
+ *
7
+ * @returns The value of the cookie, if it exists.
8
+ */
9
+ export declare const getPreviewCookie: (cookieJar: string) => string | undefined;
@@ -0,0 +1,21 @@
1
+ import { preview } from "../cookie.js";
2
+ const readValue = (value) => {
3
+ return value.replace(/%3B/g, ";");
4
+ };
5
+ const getPreviewCookie = (cookieJar) => {
6
+ const cookies = cookieJar.split("; ");
7
+ let value;
8
+ for (const cookie of cookies) {
9
+ const parts = cookie.split("=");
10
+ const name = readValue(parts[0]).replace(/%3D/g, "=");
11
+ if (name === preview) {
12
+ value = readValue(parts.slice(1).join("="));
13
+ break;
14
+ }
15
+ }
16
+ return value;
17
+ };
18
+ export {
19
+ getPreviewCookie
20
+ };
21
+ //# sourceMappingURL=getPreviewCookie.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPreviewCookie.js","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\n * cookie.\n *\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"],"names":["previewCookieName"],"mappings":";AAEA,MAAM,YAAY,CAAC,UAAyB;AAC3C,SAAO,MAAM,QAAQ,QAAQ,GAAG;AACjC;AAUO,MAAM,mBAAmB,CAAC,cAAyC;AACzE,QAAM,UAAU,UAAU,MAAM,IAAI;AAEpC,MAAI;AAEJ,aAAW,UAAU,SAAS;AAC7B,UAAM,QAAQ,OAAO,MAAM,GAAG;AAC9B,UAAM,OAAO,UAAU,MAAM,CAAC,CAAC,EAAE,QAAQ,QAAQ,GAAG;AAEpD,QAAI,SAASA,SAAmB;AAC/B,cAAQ,UAAU,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;AAC1C;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const isInternalURL = (url) => {
4
+ const isInternal = /^(\/(?!\/)|#)/.test(url);
5
+ const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
6
+ return isInternal && !isSpecialLink;
7
+ };
8
+ exports.isInternalURL = isInternalURL;
9
+ //# sourceMappingURL=isInternalURL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInternalURL.cjs","sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"names":[],"mappings":";;AAQO,MAAM,gBAAgB,CAAC,QAAwB;AACrD,QAAM,aAAa,gBAAgB,KAAK,GAAG;AAC3C,QAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,GAAG;AAE7D,SAAO,cAAc,CAAC;AACvB;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Determines if a URL is internal or external.
3
+ *
4
+ * @param url - The URL to check if internal or external.
5
+ *
6
+ * @returns `true` if `url` is internal, `false` otherwise.
7
+ */
8
+ export declare const isInternalURL: (url: string) => boolean;
@@ -0,0 +1,9 @@
1
+ const isInternalURL = (url) => {
2
+ const isInternal = /^(\/(?!\/)|#)/.test(url);
3
+ const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
4
+ return isInternal && !isSpecialLink;
5
+ };
6
+ export {
7
+ isInternalURL
8
+ };
9
+ //# sourceMappingURL=isInternalURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isInternalURL.js","sources":["../../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"names":[],"mappings":"AAQO,MAAM,gBAAgB,CAAC,QAAwB;AACrD,QAAM,aAAa,gBAAgB,KAAK,GAAG;AAC3C,QAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,GAAG;AAE7D,SAAO,cAAc,CAAC;AACvB;"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const Asset = require("../types/migration/Asset.cjs");
4
+ const Document = require("../types/migration/Document.cjs");
5
+ const link = require("../types/value/link.cjs");
6
+ const richText = require("../types/value/richText.cjs");
7
+ const isValue = require("./isValue.cjs");
8
+ const contentRelationship = (value) => {
9
+ return value instanceof Document.PrismicMigrationDocument || isValue.prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === link.LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
10
+ };
11
+ const image = (value) => {
12
+ return value instanceof Asset.PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof Asset.PrismicMigrationAsset);
13
+ };
14
+ const linkToMedia = (value) => {
15
+ return typeof value === "object" && value !== null && "id" in value && value.id instanceof Asset.PrismicMigrationAsset && "link_type" in value && value.link_type === link.LinkType.Media;
16
+ };
17
+ const rtImageNode = (value) => {
18
+ return typeof value === "object" && value !== null && "id" in value && value.id instanceof Asset.PrismicMigrationAsset && "type" in value && value.type === richText.RichTextNodeType.image;
19
+ };
20
+ exports.contentRelationship = contentRelationship;
21
+ exports.image = image;
22
+ exports.linkToMedia = linkToMedia;
23
+ exports.rtImageNode = rtImageNode;
24
+ //# sourceMappingURL=isMigrationValue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMigrationValue.cjs","sources":["../../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"names":["PrismicMigrationDocument","is.prismicDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"mappings":";;;;;;;AA+CO,MAAM,sBAAsB,CAClC,UACmE;AACnE,SACC,iBAAiBA,SAAAA,4BACjBC,QAAAA,gBAAmB,KAAK,KACvB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,cAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,EAAE,KAAK,OAAO,MAAM,OAAO;AAEzD;AAYO,MAAM,QAAQ,CAAC,UAAgD;AACrE,SACC,iBAAiBC,MAAAA,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,EAAE,MACpB,CAAC,mBAAmB,0BAA0BA,2BAAqB;AAGvE;AAiBO,MAAM,cAAc,CAC1B,UAC2D;AAC3D,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,MAAAA,yBACpB,eAAe,SACf,MAAM,cAAcD,KAAAA,SAAS;AAE/B;AAaO,MAAM,cAAc,CAC1B,UACkC;AAClC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,MAAAA,yBACpB,UAAU,SACV,MAAM,SAASC,SAAAA,iBAAiB;AAElC;;;;;"}
@@ -0,0 +1,71 @@
1
+ import type { MigrationImage, MigrationLinkToMedia, MigrationRTImageNode } from "../types/migration/Asset.js";
2
+ import type { MigrationContentRelationship } from "../types/migration/ContentRelationship.js";
3
+ import { type InjectMigrationSpecificTypes } from "../types/migration/Document.js";
4
+ import type { PrismicDocument } from "../types/value/document.js";
5
+ import type { GroupField } from "../types/value/group.js";
6
+ import type { OptionalLinkProperties } from "../types/value/link.js";
7
+ import type { SliceZone } from "../types/value/sliceZone.js";
8
+ import type { AnyRegularField } from "../types/value/types.js";
9
+ /**
10
+ * Unknown value to check if it's a specific field type.
11
+ *
12
+ * @remarks
13
+ * Explicit types are added to help ensure narrowing is done effectively.
14
+ */
15
+ type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown;
16
+ /**
17
+ * Checks if a value is a migration content relationship field.
18
+ *
19
+ * @remarks
20
+ * `OptionalLinkProperties` is included because `MigrationContentRelationship`
21
+ * may be a link field, not strictly a content relationship field.
22
+ *
23
+ * @param value - Value to check.
24
+ *
25
+ * @returns `true` if `value` is a migration content relationship field, `false`
26
+ * otherwise.
27
+ *
28
+ * @internal
29
+ * This is not an official helper function and it's only designed to work with internal processes.
30
+ */
31
+ export declare const contentRelationship: (value: UnknownValue) => value is MigrationContentRelationship & OptionalLinkProperties;
32
+ /**
33
+ * Checks if a value is a migration image field.
34
+ *
35
+ * @param value - Value to check.
36
+ *
37
+ * @returns `true` if `value` is a migration image field, `false` otherwise.
38
+ *
39
+ * @internal
40
+ * This is not an official helper function and it's only designed to work with internal processes.
41
+ */
42
+ export declare const image: (value: UnknownValue) => value is MigrationImage;
43
+ /**
44
+ * Checks if a value is a migration link to media field.
45
+ *
46
+ * - @remarks `OptionalLinkProperties` is included because
47
+ * `MigrationContentRelationship` may be a link field, not strictly a content
48
+ * relationship field.
49
+ *
50
+ * @param value - Value to check.
51
+ *
52
+ * @returns `true` if `value` is a migration link to media field, `false`
53
+ * otherwise.
54
+ *
55
+ * @internal
56
+ * This is not an official helper function and it's only designed to work with internal processes.
57
+ */
58
+ export declare const linkToMedia: (value: UnknownValue) => value is MigrationLinkToMedia & OptionalLinkProperties;
59
+ /**
60
+ * Checks if a value is a migration rich text image node.
61
+ *
62
+ * @param value - Value to check.
63
+ *
64
+ * @returns `true` if `value` is a migration rich text image node, `false`
65
+ * otherwise.
66
+ *
67
+ * @internal
68
+ * This is not an official helper function and it's only designed to work with internal processes.
69
+ */
70
+ export declare const rtImageNode: (value: UnknownValue) => value is MigrationRTImageNode;
71
+ export {};
@@ -0,0 +1,24 @@
1
+ import { PrismicMigrationAsset } from "../types/migration/Asset.js";
2
+ import { PrismicMigrationDocument } from "../types/migration/Document.js";
3
+ import { LinkType } from "../types/value/link.js";
4
+ import { RichTextNodeType } from "../types/value/richText.js";
5
+ import { prismicDocument } from "./isValue.js";
6
+ const contentRelationship = (value) => {
7
+ return value instanceof PrismicMigrationDocument || prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
8
+ };
9
+ const image = (value) => {
10
+ return value instanceof PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset);
11
+ };
12
+ const linkToMedia = (value) => {
13
+ return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "link_type" in value && value.link_type === LinkType.Media;
14
+ };
15
+ const rtImageNode = (value) => {
16
+ return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "type" in value && value.type === RichTextNodeType.image;
17
+ };
18
+ export {
19
+ contentRelationship,
20
+ image,
21
+ linkToMedia,
22
+ rtImageNode
23
+ };
24
+ //# sourceMappingURL=isMigrationValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isMigrationValue.js","sources":["../../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"names":["is.prismicDocument"],"mappings":";;;;;AA+CO,MAAM,sBAAsB,CAClC,UACmE;AACnE,SACC,iBAAiB,4BACjBA,gBAAmB,KAAK,KACvB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,EAAE,KAAK,OAAO,MAAM,OAAO;AAEzD;AAYO,MAAM,QAAQ,CAAC,UAAgD;AACrE,SACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,EAAE,MACpB,CAAC,mBAAmB,0BAA0B,qBAAqB;AAGvE;AAiBO,MAAM,cAAc,CAC1B,UAC2D;AAC3D,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;AAE/B;AAaO,MAAM,cAAc,CAC1B,UACkC;AAClC,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB;AAElC;"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const link = require("../types/value/link.cjs");
4
+ const richText = require("../types/value/richText.cjs");
5
+ const filledLinkToMedia = (value) => {
6
+ if (value && typeof value === "object" && !("version" in value)) {
7
+ if ("link_type" in value && value.link_type === link.LinkType.Media && "id" in value && "name" in value && "kind" in value && "url" in value && "size" in value) {
8
+ return true;
9
+ }
10
+ }
11
+ return false;
12
+ };
13
+ const imageLike = (value) => {
14
+ if (value && typeof value === "object" && (!("version" in value) || typeof value.version === "object")) {
15
+ if ("id" in value && "url" in value && typeof value.url === "string" && "dimensions" in value && "edit" in value && "alt" in value && "copyright" in value) {
16
+ return true;
17
+ }
18
+ }
19
+ return false;
20
+ };
21
+ const filledImage = (value) => {
22
+ if (imageLike(value) && (!("type" in value) || value.type !== richText.RichTextNodeType.image)) {
23
+ return true;
24
+ }
25
+ return false;
26
+ };
27
+ const rtImageNode = (value) => {
28
+ if (imageLike(value) && "type" in value && value.type === richText.RichTextNodeType.image) {
29
+ return true;
30
+ }
31
+ return false;
32
+ };
33
+ const filledContentRelationship = (value) => {
34
+ if (value && typeof value === "object" && !("version" in value)) {
35
+ if ("link_type" in value && value.link_type === link.LinkType.Document && "id" in value && "type" in value && "tags" in value && "lang" in value) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ };
41
+ const prismicDocument = (value) => {
42
+ try {
43
+ return typeof value === "object" && value !== null && "id" in value && "href" in value && typeof value.href === "string" && new URL(value.href) && "type" in value && "lang" in value && "tags" in value && Array.isArray(value.tags);
44
+ } catch {
45
+ return false;
46
+ }
47
+ };
48
+ exports.filledContentRelationship = filledContentRelationship;
49
+ exports.filledImage = filledImage;
50
+ exports.filledLinkToMedia = filledLinkToMedia;
51
+ exports.prismicDocument = prismicDocument;
52
+ exports.rtImageNode = rtImageNode;
53
+ //# sourceMappingURL=isValue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isValue.cjs","sources":["../../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\tvalue\n\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\tvalue\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\tvalue\n\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"names":["LinkType","RichTextNodeType"],"mappings":";;;;AAiCO,MAAM,oBAAoB,CAChC,UACoC;AACpC,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAcA,KAAAA,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,OACT;AAGD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAYA,MAAM,YAAY,CACjB,UACwD;AACxD,MACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAClD;AACD,QACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,OACd;AACD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAYO,MAAM,cAAc,CAC1B,UAC0C;AAC1C,MACC,UAAU,KAAK,MACd,EAAE,UAAU,UAAU,MAAM,SAASC,0BAAiB,QACtD;AAGD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAYO,MAAM,cAAc,CAAC,UAA6C;AACxE,MACC,UAAU,KAAK,KACf,UAAU,SACV,MAAM,SAASA,SAAAA,iBAAiB,OAC/B;AAGD,WAAO;AAAA,EACR;AAEA,SAAO;AACR;AAiBO,MAAM,4BAA4B,CACxC,UACqE;AACrE,MAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QAAQ;AAChE,QACC,eAAe,SACf,MAAM,cAAcD,KAAAA,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,OACT;AACD,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;AAYO,MAAM,kBAAkB,CAC9B,UAC6B;AAC7B,MAAI;AACH,WACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,IAAI,KAClB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,IAAI;AAAA,EAE1B,QAAQ;AACP,WAAO;AAAA,EACR;AACD;;;;;;"}
@@ -0,0 +1,78 @@
1
+ import type { InjectMigrationSpecificTypes } from "../types/migration/Document.js";
2
+ import type { FilledContentRelationshipField } from "../types/value/contentRelationship.js";
3
+ import type { PrismicDocument } from "../types/value/document.js";
4
+ import type { GroupField } from "../types/value/group.js";
5
+ import type { ImageField } from "../types/value/image.js";
6
+ import type { OptionalLinkProperties } from "../types/value/link.js";
7
+ import type { FilledLinkToMediaField } from "../types/value/linkToMedia.js";
8
+ import { type RTImageNode } from "../types/value/richText.js";
9
+ import type { SliceZone } from "../types/value/sliceZone.js";
10
+ import type { AnyRegularField } from "../types/value/types.js";
11
+ /**
12
+ * Unknown value to check if it's a specific field type.
13
+ *
14
+ * @remarks
15
+ * Explicit types are added to help ensure narrowing is done effectively.
16
+ */
17
+ type UnknownValue = PrismicDocument | InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone> | unknown;
18
+ /**
19
+ * Checks if a value is a link to media field.
20
+ *
21
+ * @param value - Value to check.
22
+ *
23
+ * @returns `true` if `value` is a link to media field, `false` otherwise.
24
+ *
25
+ * @internal
26
+ * This is not an official helper function and it's only designed to work with internal processes.
27
+ */
28
+ export declare const filledLinkToMedia: (value: UnknownValue) => value is FilledLinkToMediaField;
29
+ /**
30
+ * Checks if a value is an image field.
31
+ *
32
+ * @param value - Value to check.
33
+ *
34
+ * @returns `true` if `value` is an image field, `false` otherwise.
35
+ *
36
+ * @internal
37
+ * This is not an official helper function and it's only designed to work with internal processes.
38
+ */
39
+ export declare const filledImage: (value: UnknownValue) => value is ImageField<string, "filled">;
40
+ /**
41
+ * Checks if a value is a rich text image node.
42
+ *
43
+ * @param value - Value to check.
44
+ *
45
+ * @returns `true` if `value` is a rich text image node, `false` otherwise.
46
+ *
47
+ * @internal
48
+ * This is not an official helper function and it's only designed to work with internal processes.
49
+ */
50
+ export declare const rtImageNode: (value: UnknownValue) => value is RTImageNode;
51
+ /**
52
+ * Checks if a value is a content relationship field.
53
+ *
54
+ * @remarks
55
+ * The return value includes `OptionalLinkProperties` because
56
+ * `FilledContentRelationshipField` may be a link field, not strictly a content
57
+ * relationship field.
58
+ *
59
+ * @param value - Value to check.
60
+ *
61
+ * @returns `true` if `value` is a content relationship, `false` otherwise.
62
+ *
63
+ * @internal
64
+ * This is not an official helper function and it's only designed to work with internal processes.
65
+ */
66
+ export declare const filledContentRelationship: (value: UnknownValue) => value is FilledContentRelationshipField & OptionalLinkProperties;
67
+ /**
68
+ * Checks if a value is a Prismic document.
69
+ *
70
+ * @param value - Value to check.
71
+ *
72
+ * @returns `true` if `value` is a Prismic document, `false` otherwise.
73
+ *
74
+ * @internal
75
+ * This is not an official helper function and it's only designed to work with internal processes.
76
+ */
77
+ export declare const prismicDocument: (value: UnknownValue) => value is PrismicDocument;
78
+ export {};
@@ -0,0 +1,53 @@
1
+ import { LinkType } from "../types/value/link.js";
2
+ import { RichTextNodeType } from "../types/value/richText.js";
3
+ const filledLinkToMedia = (value) => {
4
+ if (value && typeof value === "object" && !("version" in value)) {
5
+ if ("link_type" in value && value.link_type === LinkType.Media && "id" in value && "name" in value && "kind" in value && "url" in value && "size" in value) {
6
+ return true;
7
+ }
8
+ }
9
+ return false;
10
+ };
11
+ const imageLike = (value) => {
12
+ if (value && typeof value === "object" && (!("version" in value) || typeof value.version === "object")) {
13
+ if ("id" in value && "url" in value && typeof value.url === "string" && "dimensions" in value && "edit" in value && "alt" in value && "copyright" in value) {
14
+ return true;
15
+ }
16
+ }
17
+ return false;
18
+ };
19
+ const filledImage = (value) => {
20
+ if (imageLike(value) && (!("type" in value) || value.type !== RichTextNodeType.image)) {
21
+ return true;
22
+ }
23
+ return false;
24
+ };
25
+ const rtImageNode = (value) => {
26
+ if (imageLike(value) && "type" in value && value.type === RichTextNodeType.image) {
27
+ return true;
28
+ }
29
+ return false;
30
+ };
31
+ const filledContentRelationship = (value) => {
32
+ if (value && typeof value === "object" && !("version" in value)) {
33
+ if ("link_type" in value && value.link_type === LinkType.Document && "id" in value && "type" in value && "tags" in value && "lang" in value) {
34
+ return true;
35
+ }
36
+ }
37
+ return false;
38
+ };
39
+ const prismicDocument = (value) => {
40
+ try {
41
+ return typeof value === "object" && value !== null && "id" in value && "href" in value && typeof value.href === "string" && new URL(value.href) && "type" in value && "lang" in value && "tags" in value && Array.isArray(value.tags);
42
+ } catch {
43
+ return false;
44
+ }
45
+ };
46
+ export {
47
+ filledContentRelationship,
48
+ filledImage,
49
+ filledLinkToMedia,
50
+ prismicDocument,
51
+ rtImageNode
52
+ };
53
+ //# sourceMappingURL=isValue.js.map