@prismicio/client 7.22.0 → 7.22.1-canary.06ee513
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.
- package/README.md +6 -0
- package/dist/Client.cjs +8 -4
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +14 -16
- package/dist/Client.d.cts.map +1 -1
- package/dist/Client.d.ts +14 -16
- package/dist/Client.d.ts.map +1 -1
- package/dist/Client.js +8 -4
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +24 -23
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +1 -3
- package/dist/Migration.d.cts.map +1 -1
- package/dist/Migration.d.ts +1 -3
- package/dist/Migration.d.ts.map +1 -1
- package/dist/Migration.js +24 -23
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +21 -19
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +18 -22
- package/dist/WriteClient.d.cts.map +1 -1
- package/dist/WriteClient.d.ts +18 -22
- package/dist/WriteClient.d.ts.map +1 -1
- package/dist/WriteClient.js +21 -19
- package/dist/WriteClient.js.map +1 -1
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +5 -6
- package/dist/buildQueryURL.d.cts.map +1 -1
- package/dist/buildQueryURL.d.ts +5 -6
- package/dist/buildQueryURL.d.ts.map +1 -1
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.d.cts +1 -1
- package/dist/cookie.d.cts.map +1 -1
- package/dist/cookie.d.ts +1 -1
- package/dist/cookie.d.ts.map +1 -1
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +2 -4
- package/dist/createClient.d.cts.map +1 -1
- package/dist/createClient.d.ts +2 -4
- package/dist/createClient.d.ts.map +1 -1
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +2 -4
- package/dist/createMigration.d.cts.map +1 -1
- package/dist/createMigration.d.ts +2 -4
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +2 -4
- package/dist/createWriteClient.d.cts.map +1 -1
- package/dist/createWriteClient.d.ts +2 -4
- package/dist/createWriteClient.d.ts.map +1 -1
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +9 -10
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts +9 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/filter.cjs +175 -0
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +3 -4
- package/dist/filter.d.cts.map +1 -1
- package/dist/filter.d.ts +3 -4
- package/dist/filter.d.ts.map +1 -1
- package/dist/filter.js +175 -0
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +1 -2
- package/dist/getGraphQLEndpoint.d.cts.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +1 -2
- package/dist/getGraphQLEndpoint.d.ts.map +1 -1
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +1 -2
- package/dist/getRepositoryEndpoint.d.cts.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +1 -2
- package/dist/getRepositoryEndpoint.d.ts.map +1 -1
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +1 -2
- package/dist/getRepositoryName.d.cts.map +1 -1
- package/dist/getRepositoryName.d.ts +1 -2
- package/dist/getRepositoryName.d.ts.map +1 -1
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +1 -2
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +1 -2
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +1 -3
- package/dist/helpers/asDate.d.cts.map +1 -1
- package/dist/helpers/asDate.d.ts +1 -3
- package/dist/helpers/asDate.d.ts.map +1 -1
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +7 -5
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +12 -11
- package/dist/helpers/asHTML.d.cts.map +1 -1
- package/dist/helpers/asHTML.d.ts +12 -11
- package/dist/helpers/asHTML.d.ts.map +1 -1
- package/dist/helpers/asHTML.js +7 -5
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +3 -4
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +3 -4
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +1 -3
- package/dist/helpers/asImageSrc.d.cts.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +1 -3
- package/dist/helpers/asImageSrc.d.ts.map +1 -1
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +3 -4
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +3 -4
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +3 -5
- package/dist/helpers/asLink.d.cts.map +1 -1
- package/dist/helpers/asLink.d.ts +3 -5
- package/dist/helpers/asLink.d.ts.map +1 -1
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +2 -4
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +2 -4
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +1 -3
- package/dist/helpers/asText.d.cts.map +1 -1
- package/dist/helpers/asText.d.ts +1 -3
- package/dist/helpers/asText.d.ts.map +1 -1
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +1 -3
- package/dist/helpers/documentToLinkField.d.cts.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +1 -3
- package/dist/helpers/documentToLinkField.d.ts.map +1 -1
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +20 -0
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +22 -24
- package/dist/helpers/isFilled.d.cts.map +1 -1
- package/dist/helpers/isFilled.d.ts +22 -24
- package/dist/helpers/isFilled.d.ts.map +1 -1
- package/dist/helpers/isFilled.js +1 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +10 -8
- package/dist/helpers/mapSliceZone.d.cts.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +10 -8
- package/dist/helpers/mapSliceZone.d.ts.map +1 -1
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +1 -2
- package/dist/isRepositoryEndpoint.d.cts.map +1 -1
- package/dist/isRepositoryEndpoint.d.ts +1 -2
- package/dist/isRepositoryEndpoint.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.d.cts +1 -2
- package/dist/isRepositoryName.d.cts.map +1 -1
- package/dist/isRepositoryName.d.ts +1 -2
- package/dist/isRepositoryName.d.ts.map +1 -1
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +1 -0
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +5 -6
- package/dist/lib/request.d.cts.map +1 -1
- package/dist/lib/request.d.ts +5 -6
- package/dist/lib/request.d.ts.map +1 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +3 -0
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +1 -1
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs +10 -6
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js +10 -6
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/throttledWarn.cjs.map +1 -1
- package/dist/lib/throttledWarn.js.map +1 -1
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +1 -3
- package/dist/richtext/asText.d.cts.map +1 -1
- package/dist/richtext/asText.d.ts +1 -3
- package/dist/richtext/asText.d.ts.map +1 -1
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +1 -3
- package/dist/richtext/asTree.d.cts.map +1 -1
- package/dist/richtext/asTree.d.ts +1 -3
- package/dist/richtext/asTree.d.ts.map +1 -1
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +1 -3
- package/dist/richtext/composeSerializers.d.cts.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +1 -3
- package/dist/richtext/composeSerializers.d.ts.map +1 -1
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +1 -3
- package/dist/richtext/serialize.d.cts.map +1 -1
- package/dist/richtext/serialize.d.ts +1 -3
- package/dist/richtext/serialize.d.ts.map +1 -1
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +5 -7
- package/dist/richtext/types.d.cts.map +1 -1
- package/dist/richtext/types.d.ts +5 -7
- package/dist/richtext/types.d.ts.map +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +1 -3
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +1 -3
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/asset/asset.d.cts +35 -20
- package/dist/types/api/asset/asset.d.cts.map +1 -1
- package/dist/types/api/asset/asset.d.ts +35 -20
- package/dist/types/api/asset/asset.d.ts.map +1 -1
- package/dist/types/api/asset/tag.d.cts +12 -7
- package/dist/types/api/asset/tag.d.cts.map +1 -1
- package/dist/types/api/asset/tag.d.ts +12 -7
- package/dist/types/api/asset/tag.d.ts.map +1 -1
- package/dist/types/api/integration.d.cts +2 -4
- package/dist/types/api/integration.d.cts.map +1 -1
- package/dist/types/api/integration.d.ts +2 -4
- package/dist/types/api/integration.d.ts.map +1 -1
- package/dist/types/api/migration/release.d.cts +3 -7
- package/dist/types/api/migration/release.d.cts.map +1 -1
- package/dist/types/api/migration/release.d.ts +3 -7
- package/dist/types/api/migration/release.d.ts.map +1 -1
- package/dist/types/api/query.d.cts +1 -3
- package/dist/types/api/query.d.cts.map +1 -1
- package/dist/types/api/query.d.ts +1 -3
- package/dist/types/api/query.d.ts.map +1 -1
- package/dist/types/api/ref.d.cts +1 -2
- package/dist/types/api/ref.d.cts.map +1 -1
- package/dist/types/api/ref.d.ts +1 -2
- package/dist/types/api/ref.d.ts.map +1 -1
- package/dist/types/api/release.d.cts +1 -3
- package/dist/types/api/release.d.cts.map +1 -1
- package/dist/types/api/release.d.ts +1 -3
- package/dist/types/api/release.d.ts.map +1 -1
- package/dist/types/api/repository.d.cts +4 -6
- package/dist/types/api/repository.d.cts.map +1 -1
- package/dist/types/api/repository.d.ts +4 -6
- package/dist/types/api/repository.d.ts.map +1 -1
- package/dist/types/api/tags.d.cts +1 -2
- package/dist/types/api/tags.d.cts.map +1 -1
- package/dist/types/api/tags.d.ts +1 -2
- package/dist/types/api/tags.d.ts.map +1 -1
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +21 -15
- package/dist/types/migration/Asset.d.cts.map +1 -1
- package/dist/types/migration/Asset.d.ts +21 -15
- package/dist/types/migration/Asset.d.ts.map +1 -1
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +1 -3
- package/dist/types/migration/ContentRelationship.d.cts.map +1 -1
- package/dist/types/migration/ContentRelationship.d.ts +1 -3
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -1
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +8 -8
- package/dist/types/migration/Document.d.cts.map +1 -1
- package/dist/types/migration/Document.d.ts +8 -8
- package/dist/types/migration/Document.d.ts.map +1 -1
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/boolean.d.cts +1 -3
- package/dist/types/model/boolean.d.cts.map +1 -1
- package/dist/types/model/boolean.d.ts +1 -3
- package/dist/types/model/boolean.d.ts.map +1 -1
- package/dist/types/model/color.d.cts +1 -3
- package/dist/types/model/color.d.cts.map +1 -1
- package/dist/types/model/color.d.ts +1 -3
- package/dist/types/model/color.d.ts.map +1 -1
- package/dist/types/model/contentRelationship.d.cts +6 -8
- package/dist/types/model/contentRelationship.d.cts.map +1 -1
- package/dist/types/model/contentRelationship.d.ts +6 -8
- package/dist/types/model/contentRelationship.d.ts.map +1 -1
- package/dist/types/model/customType.d.cts +3 -5
- package/dist/types/model/customType.d.cts.map +1 -1
- package/dist/types/model/customType.d.ts +3 -5
- package/dist/types/model/customType.d.ts.map +1 -1
- package/dist/types/model/date.d.cts +1 -3
- package/dist/types/model/date.d.cts.map +1 -1
- package/dist/types/model/date.d.ts +1 -3
- package/dist/types/model/date.d.ts.map +1 -1
- package/dist/types/model/embed.d.cts +1 -3
- package/dist/types/model/embed.d.cts.map +1 -1
- package/dist/types/model/embed.d.ts +1 -3
- package/dist/types/model/embed.d.ts.map +1 -1
- package/dist/types/model/geoPoint.d.cts +1 -3
- package/dist/types/model/geoPoint.d.cts.map +1 -1
- package/dist/types/model/geoPoint.d.ts +1 -3
- package/dist/types/model/geoPoint.d.ts.map +1 -1
- package/dist/types/model/group.d.cts +2 -4
- package/dist/types/model/group.d.cts.map +1 -1
- package/dist/types/model/group.d.ts +2 -4
- package/dist/types/model/group.d.ts.map +1 -1
- package/dist/types/model/image.d.cts +3 -5
- package/dist/types/model/image.d.cts.map +1 -1
- package/dist/types/model/image.d.ts +3 -5
- package/dist/types/model/image.d.ts.map +1 -1
- package/dist/types/model/integration.d.cts +1 -3
- package/dist/types/model/integration.d.cts.map +1 -1
- package/dist/types/model/integration.d.ts +1 -3
- package/dist/types/model/integration.d.ts.map +1 -1
- package/dist/types/model/keyText.d.cts +1 -3
- package/dist/types/model/keyText.d.cts.map +1 -1
- package/dist/types/model/keyText.d.ts +1 -3
- package/dist/types/model/keyText.d.ts.map +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.cts +2 -4
- package/dist/types/model/link.d.cts.map +1 -1
- package/dist/types/model/link.d.ts +2 -4
- package/dist/types/model/link.d.ts.map +1 -1
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.cts +1 -3
- package/dist/types/model/linkToMedia.d.cts.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -3
- package/dist/types/model/linkToMedia.d.ts.map +1 -1
- package/dist/types/model/number.d.cts +1 -3
- package/dist/types/model/number.d.cts.map +1 -1
- package/dist/types/model/number.d.ts +1 -3
- package/dist/types/model/number.d.ts.map +1 -1
- package/dist/types/model/range.d.cts +1 -3
- package/dist/types/model/range.d.cts.map +1 -1
- package/dist/types/model/range.d.ts +1 -3
- package/dist/types/model/range.d.ts.map +1 -1
- package/dist/types/model/richText.d.cts +3 -5
- package/dist/types/model/richText.d.cts.map +1 -1
- package/dist/types/model/richText.d.ts +3 -5
- package/dist/types/model/richText.d.ts.map +1 -1
- package/dist/types/model/select.d.cts +1 -3
- package/dist/types/model/select.d.cts.map +1 -1
- package/dist/types/model/select.d.ts +1 -3
- package/dist/types/model/select.d.ts.map +1 -1
- package/dist/types/model/separator.d.cts +1 -3
- package/dist/types/model/separator.d.cts.map +1 -1
- package/dist/types/model/separator.d.ts +1 -3
- package/dist/types/model/separator.d.ts.map +1 -1
- package/dist/types/model/sharedSlice.d.cts +1 -3
- package/dist/types/model/sharedSlice.d.cts.map +1 -1
- package/dist/types/model/sharedSlice.d.ts +1 -3
- package/dist/types/model/sharedSlice.d.ts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.cts +1 -3
- package/dist/types/model/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.ts +1 -3
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.cts +3 -5
- package/dist/types/model/slice.d.cts.map +1 -1
- package/dist/types/model/slice.d.ts +3 -5
- package/dist/types/model/slice.d.ts.map +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.cts +4 -6
- package/dist/types/model/sliceZone.d.cts.map +1 -1
- package/dist/types/model/sliceZone.d.ts +4 -6
- package/dist/types/model/sliceZone.d.ts.map +1 -1
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/table.d.cts +1 -3
- package/dist/types/model/table.d.cts.map +1 -1
- package/dist/types/model/table.d.ts +1 -3
- package/dist/types/model/table.d.ts.map +1 -1
- package/dist/types/model/timestamp.d.cts +1 -3
- package/dist/types/model/timestamp.d.cts.map +1 -1
- package/dist/types/model/timestamp.d.ts +1 -3
- package/dist/types/model/timestamp.d.ts.map +1 -1
- package/dist/types/model/title.d.cts +1 -3
- package/dist/types/model/title.d.cts.map +1 -1
- package/dist/types/model/title.d.ts +1 -3
- package/dist/types/model/title.d.ts.map +1 -1
- package/dist/types/model/types.cjs +4 -0
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +13 -11
- package/dist/types/model/types.d.cts.map +1 -1
- package/dist/types/model/types.d.ts +13 -11
- package/dist/types/model/types.d.ts.map +1 -1
- package/dist/types/model/types.js +4 -0
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.cts +1 -3
- package/dist/types/model/uid.d.cts.map +1 -1
- package/dist/types/model/uid.d.ts +1 -3
- package/dist/types/model/uid.d.ts.map +1 -1
- package/dist/types/value/boolean.d.cts +1 -2
- package/dist/types/value/boolean.d.cts.map +1 -1
- package/dist/types/value/boolean.d.ts +1 -2
- package/dist/types/value/boolean.d.ts.map +1 -1
- package/dist/types/value/color.d.cts +1 -3
- package/dist/types/value/color.d.cts.map +1 -1
- package/dist/types/value/color.d.ts +1 -3
- package/dist/types/value/color.d.ts.map +1 -1
- package/dist/types/value/contentRelationship.d.cts +3 -5
- package/dist/types/value/contentRelationship.d.cts.map +1 -1
- package/dist/types/value/contentRelationship.d.ts +3 -5
- package/dist/types/value/contentRelationship.d.ts.map +1 -1
- package/dist/types/value/date.d.cts +1 -3
- package/dist/types/value/date.d.cts.map +1 -1
- package/dist/types/value/date.d.ts +1 -3
- package/dist/types/value/date.d.ts.map +1 -1
- package/dist/types/value/document.d.cts +5 -7
- package/dist/types/value/document.d.cts.map +1 -1
- package/dist/types/value/document.d.ts +5 -7
- package/dist/types/value/document.d.ts.map +1 -1
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +43 -25
- package/dist/types/value/embed.d.cts.map +1 -1
- package/dist/types/value/embed.d.ts +43 -25
- package/dist/types/value/embed.d.ts.map +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +1 -3
- package/dist/types/value/geoPoint.d.cts.map +1 -1
- package/dist/types/value/geoPoint.d.ts +1 -3
- package/dist/types/value/geoPoint.d.ts.map +1 -1
- package/dist/types/value/group.d.cts +2 -4
- package/dist/types/value/group.d.cts.map +1 -1
- package/dist/types/value/group.d.ts +2 -4
- package/dist/types/value/group.d.ts.map +1 -1
- package/dist/types/value/image.d.cts +4 -6
- package/dist/types/value/image.d.cts.map +1 -1
- package/dist/types/value/image.d.ts +4 -6
- package/dist/types/value/image.d.ts.map +1 -1
- package/dist/types/value/integration.d.cts +2 -4
- package/dist/types/value/integration.d.cts.map +1 -1
- package/dist/types/value/integration.d.ts +2 -4
- package/dist/types/value/integration.d.ts.map +1 -1
- package/dist/types/value/keyText.d.cts +1 -3
- package/dist/types/value/keyText.d.cts.map +1 -1
- package/dist/types/value/keyText.d.ts +1 -3
- package/dist/types/value/keyText.d.ts.map +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +6 -8
- package/dist/types/value/link.d.cts.map +1 -1
- package/dist/types/value/link.d.ts +6 -8
- package/dist/types/value/link.d.ts.map +1 -1
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts +2 -4
- package/dist/types/value/linkToMedia.d.cts.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +2 -4
- package/dist/types/value/linkToMedia.d.ts.map +1 -1
- package/dist/types/value/number.d.cts +1 -3
- package/dist/types/value/number.d.cts.map +1 -1
- package/dist/types/value/number.d.ts +1 -3
- package/dist/types/value/number.d.ts.map +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.cts +29 -31
- package/dist/types/value/richText.d.cts.map +1 -1
- package/dist/types/value/richText.d.ts +29 -31
- package/dist/types/value/richText.d.ts.map +1 -1
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.cts +1 -3
- package/dist/types/value/select.d.cts.map +1 -1
- package/dist/types/value/select.d.ts +1 -3
- package/dist/types/value/select.d.ts.map +1 -1
- package/dist/types/value/sharedSlice.d.cts +1 -3
- package/dist/types/value/sharedSlice.d.cts.map +1 -1
- package/dist/types/value/sharedSlice.d.ts +1 -3
- package/dist/types/value/sharedSlice.d.ts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.cts +1 -3
- package/dist/types/value/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +1 -3
- package/dist/types/value/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/value/slice.d.cts +1 -3
- package/dist/types/value/slice.d.cts.map +1 -1
- package/dist/types/value/slice.d.ts +1 -3
- package/dist/types/value/slice.d.ts.map +1 -1
- package/dist/types/value/sliceZone.d.cts +1 -3
- package/dist/types/value/sliceZone.d.cts.map +1 -1
- package/dist/types/value/sliceZone.d.ts +1 -3
- package/dist/types/value/sliceZone.d.ts.map +1 -1
- package/dist/types/value/table.d.cts +26 -16
- package/dist/types/value/table.d.cts.map +1 -1
- package/dist/types/value/table.d.ts +26 -16
- package/dist/types/value/table.d.ts.map +1 -1
- package/dist/types/value/timestamp.d.cts +1 -3
- package/dist/types/value/timestamp.d.cts.map +1 -1
- package/dist/types/value/timestamp.d.ts +1 -3
- package/dist/types/value/timestamp.d.ts.map +1 -1
- package/dist/types/value/title.d.cts +1 -3
- package/dist/types/value/title.d.cts.map +1 -1
- package/dist/types/value/title.d.ts +1 -3
- package/dist/types/value/title.d.ts.map +1 -1
- package/dist/types/value/types.d.cts +6 -8
- package/dist/types/value/types.d.cts.map +1 -1
- package/dist/types/value/types.d.ts +6 -8
- package/dist/types/value/types.d.ts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.cts +1 -3
- package/dist/types/webhook/apiUpdate.d.cts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.ts +1 -3
- package/dist/types/webhook/apiUpdate.d.ts.map +1 -1
- package/dist/types/webhook/testTrigger.d.cts +1 -3
- package/dist/types/webhook/testTrigger.d.cts.map +1 -1
- package/dist/types/webhook/testTrigger.d.ts +1 -3
- package/dist/types/webhook/testTrigger.d.ts.map +1 -1
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.cts +3 -5
- package/dist/types/webhook/types.d.cts.map +1 -1
- package/dist/types/webhook/types.d.ts +3 -5
- package/dist/types/webhook/types.d.ts.map +1 -1
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +10 -10
- package/src/WriteClient.ts +14 -19
- package/src/lib/resolveMigrationDocumentData.ts +1 -1
- package/src/types/api/migration/release.ts +2 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSliceZone.cjs","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;
|
|
1
|
+
{"version":3,"file":"mapSliceZone.cjs","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;CACrD,OAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;EAEvB,IAAI,CAAC,QACJ,OAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;EAAQ;EAInD,IAAI,SAAS,MAAM,OAElB,UACD;EAKA,IAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;GACD,SAAS,aAAa,SAAS,OAAO,UAAU;GAChD,SAAS,MAAM,OAAO,UAAU;EACjC;EAEA,IAAI,iBACH,OAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;EACJ;OAEA,OAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;EACJ;CAEF,CAAC,CACF;AACD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Slice } from "../types/value/slice.cjs";
|
|
2
|
-
|
|
3
2
|
//#region src/helpers/mapSliceZone.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Convert a value to a lazyily loaded module. This is useful when using functions like `() =>
|
|
@@ -71,18 +70,22 @@ type MappedSliceLike = {
|
|
|
71
70
|
* mappers.
|
|
72
71
|
*/
|
|
73
72
|
type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
74
|
-
/** Slice data. */
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
/** Slice data. */
|
|
74
|
+
slice: TSlice;
|
|
75
|
+
/** The index of the Slice in the Slice Zone. */
|
|
76
|
+
index: number;
|
|
77
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
78
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
79
|
+
/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
|
|
77
80
|
context: TContext;
|
|
78
81
|
};
|
|
79
82
|
/** A record of mappers. */
|
|
80
|
-
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext
|
|
83
|
+
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>; };
|
|
81
84
|
/**
|
|
82
85
|
* A function that maps a Slice and its metadata to a modified version. The return value will
|
|
83
86
|
* replace the Slice in the Slice Zone.
|
|
84
87
|
*/
|
|
85
|
-
type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
|
|
88
|
+
export type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
|
|
86
89
|
/** Unwraps a lazily loaded mapper module. */
|
|
87
90
|
type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
|
|
88
91
|
default: unknown;
|
|
@@ -104,7 +107,6 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
|
|
|
104
107
|
* });
|
|
105
108
|
* ```
|
|
106
109
|
*/
|
|
107
|
-
declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
110
|
+
export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
108
111
|
//#endregion
|
|
109
|
-
export { SliceMapper, mapSliceZone };
|
|
110
112
|
//# sourceMappingURL=mapSliceZone.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSliceZone.d.cts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapSliceZone.d.cts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;;KAMK,WAAW,WAAW,QAAQ;EAAM,SAAS;;;KAG7C,gBAAgB,KAAK,IAAI,WAAW;KAGpC,kBAAkB;;;;;;KAOlB,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASC,gBAAgB,sCAAsC,KAC1D,MAAM;;;;;;;KAUF,iBAAiB;EACrB,MAAM,MAAM;;;;;;;;;;KAWR,UAAU,sCACZ,gBAAgB,cAChB,iBAAiB;;;;;;;;;KAUf,cAAc,eAAe,YAAY,sBAAsB;;;;;KAM/D;;;;;;EAMJ;;;;;;;;;KAUI,gBAAgB,eAAe,YAAY,WAAW;;EAE1D,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;KAIL,aAAa,eAAe,YAAY,WAAW,yBACtD,KAAK,iBAAiB,WAAW,gBACjC,YACC,QAAQ,QAAQ,UAAU,UAG1B;;;;;YASS,YACX,eAAe,YAAY,WAC3B,qBAAqB,6CAClB,4CAGH,uBACI,MAAM,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;;KAGnE,6BAEJ,qBAAqB,wBAAwB,WAAW,gBAExD,qBAAqB,WAAW,eAC7B,QAAQ,WAAW;EACnB;IAEC,QAAQ,WAAW,4BACnB,QAAQ,WAAW,iBACpB;;KAGC,aAEJ,mBAAmB,gBACnB,sBAAsB,aACrB,oBAIE,mBAAmB,QACpB,uCAAuC,gBACtC,cAAc,kCAAkC,cAC/C,gBAAgB,4BAChB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,+BAC9D,aACD,aACD,mBAAmB,mBAClB,iCAAiC,gBAChC,cAAc,4BAA4B,cACzC,iBAAiB,sBACjB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,yBAC9D,aACD;;;;;;;;;;;;;;;;wBAkBW,aACf,mBAAmB,WACnB,sBAAsB,aAAa,YAAY,WAC/C,oBAEA,WAAW,cAAc,aACzB,SAAS,eACT,UAAU,WACR,QAAQ,aAAa,YAAY"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Slice } from "../types/value/slice.js";
|
|
2
|
-
|
|
3
2
|
//#region src/helpers/mapSliceZone.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Convert a value to a lazyily loaded module. This is useful when using functions like `() =>
|
|
@@ -71,18 +70,22 @@ type MappedSliceLike = {
|
|
|
71
70
|
* mappers.
|
|
72
71
|
*/
|
|
73
72
|
type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
74
|
-
/** Slice data. */
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
/** Slice data. */
|
|
74
|
+
slice: TSlice;
|
|
75
|
+
/** The index of the Slice in the Slice Zone. */
|
|
76
|
+
index: number;
|
|
77
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
78
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
79
|
+
/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
|
|
77
80
|
context: TContext;
|
|
78
81
|
};
|
|
79
82
|
/** A record of mappers. */
|
|
80
|
-
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext
|
|
83
|
+
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = { [P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>; };
|
|
81
84
|
/**
|
|
82
85
|
* A function that maps a Slice and its metadata to a modified version. The return value will
|
|
83
86
|
* replace the Slice in the Slice Zone.
|
|
84
87
|
*/
|
|
85
|
-
type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
|
|
88
|
+
export type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
|
|
86
89
|
/** Unwraps a lazily loaded mapper module. */
|
|
87
90
|
type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
|
|
88
91
|
default: unknown;
|
|
@@ -104,7 +107,6 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
|
|
|
104
107
|
* });
|
|
105
108
|
* ```
|
|
106
109
|
*/
|
|
107
|
-
declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
110
|
+
export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
108
111
|
//#endregion
|
|
109
|
-
export { SliceMapper, mapSliceZone };
|
|
110
112
|
//# sourceMappingURL=mapSliceZone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSliceZone.d.ts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"mapSliceZone.d.ts","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"mappings":";;;;;;KAMK,WAAW,WAAW,QAAQ;EAAM,SAAS;;;KAG7C,gBAAgB,KAAK,IAAI,WAAW;KAGpC,kBAAkB;;;;;;KAOlB,iBAAiB,eAAe,aAAa,eAAe,kBAC9D,uBACA,eAAe,mBACd;;;;;;;KASC,gBAAgB,sCAAsC,KAC1D,MAAM;;;;;;;KAUF,iBAAiB;EACrB,MAAM,MAAM;;;;;;;;;;KAWR,UAAU,sCACZ,gBAAgB,cAChB,iBAAiB;;;;;;;;;KAUf,cAAc,eAAe,YAAY,sBAAsB;;;;;KAM/D;;;;;;EAMJ;;;;;;;;;KAUI,gBAAgB,eAAe,YAAY,WAAW;;EAE1D,OAAO;;EAGP;;EAOA,QAAQ,cAAc,eAAe,mBAAmB,mBAAmB;;EAG3E,SAAS;;;KAIL,aAAa,eAAe,YAAY,WAAW,yBACtD,KAAK,iBAAiB,WAAW,gBACjC,YACC,QAAQ,QAAQ,UAAU,UAG1B;;;;;YASS,YACX,eAAe,YAAY,WAC3B,qBAAqB,6CAClB,4CAGH,uBACI,MAAM,gBAAgB,QAAQ,cAAc,eAAe,QAAQ;;KAGnE,6BAEJ,qBAAqB,wBAAwB,WAAW,gBAExD,qBAAqB,WAAW,eAC7B,QAAQ,WAAW;EACnB;IAEC,QAAQ,WAAW,4BACnB,QAAQ,WAAW,iBACpB;;KAGC,aAEJ,mBAAmB,gBACnB,sBAAsB,aACrB,oBAIE,mBAAmB,QACpB,uCAAuC,gBACtC,cAAc,kCAAkC,cAC/C,gBAAgB,4BAChB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,+BAC9D,aACD,aACD,mBAAmB,mBAClB,iCAAiC,gBAChC,cAAc,4BAA4B,cACzC,iBAAiB,sBACjB,kBACA,QAAQ,WAAW,6BAA6B,cAAc,yBAC9D,aACD;;;;;;;;;;;;;;;;wBAkBW,aACf,mBAAmB,WACnB,sBAAsB,aAAa,YAAY,WAC/C,oBAEA,WAAW,cAAc,aACzB,SAAS,eACT,UAAU,WACR,QAAQ,aAAa,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSliceZone.js","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;
|
|
1
|
+
{"version":3,"file":"mapSliceZone.js","names":[],"sources":["../../src/helpers/mapSliceZone.ts"],"sourcesContent":["import type { Slice } from \"../types/value/slice\"\n\n/**\n * Convert a value to a lazyily loaded module. This is useful when using functions like `() =>\n * import(\"...\")`.\n */\ntype LazyModule<T> = () => Promise<T | { default: T }>\n\n/** Mark a type as potentially lazy-loaded via a module. */\ntype MaybeLazyModule<T> = T | LazyModule<T>\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\n/**\n * Returns the type of a `SliceLike` type.\n *\n * @typeParam Slice - The Slice from which the type will be extracted.\n */\ntype ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2\n\t? TSlice[\"slice_type\"]\n\t: TSlice extends SliceLikeGraphQL\n\t\t? TSlice[\"type\"]\n\t\t: never\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic Content API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeRestV2<TSliceType extends string = string> = Pick<\n\tSlice<TSliceType>,\n\t\"id\" | \"slice_type\"\n>\n\n/**\n * The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the\n * `mapSliceZone()` helper.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLikeGraphQL<TSliceType extends string = string> = {\n\ttype: Slice<TSliceType>[\"slice_type\"]\n}\n\n/**\n * The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.\n *\n * If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full\n * interface.\n *\n * @typeParam SliceType - Type name of the slice.\n */\ntype SliceLike<TSliceType extends string = string> =\n\t| SliceLikeRestV2<TSliceType>\n\t| SliceLikeGraphQL<TSliceType>\n\n/**\n * A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.\n *\n * If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full\n * type.\n *\n * @typeParam TSlice - The type(s) of a slice in the slice zone.\n */\ntype SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]\n\n/**\n * A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice\n * Zone can use these properties to detect and specially handle mapped Slices.\n */\ntype MappedSliceLike = {\n\t/**\n\t * If `true`, this Slice has been modified from its original value using a mapper.\n\t *\n\t * @internal\n\t */\n\t__mapped: true\n}\n\n/**\n * Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.\n *\n * @typeParam TSlice - The Slice passed as a prop.\n * @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice\n * mappers.\n */\ntype SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t/** Slice data. */\n\tslice: TSlice\n\n\t/** The index of the Slice in the Slice Zone. */\n\tindex: number\n\n\t/** All Slices from the Slice Zone to which the Slice belongs. */\n\t// TODO: We have to keep this list of Slices general due to circular\n\t// reference limtiations. If we had another generic to determine the full\n\t// union of Slice types, it would include TSlice. This causes TypeScript to\n\t// throw a compilation error.\n\tslices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>\n\n\t/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */\n\tcontext: TContext\n}\n\n/** A record of mappers. */\ntype SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {\n\t[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<\n\t\tSliceMapper<\n\t\t\tExtract<TSlice, SliceLike<P>>,\n\t\t\t// oxlint-disable-next-line no-explicit-any\n\t\t\tany,\n\t\t\tTContext\n\t\t>\n\t>\n}\n\n/**\n * A function that maps a Slice and its metadata to a modified version. The return value will\n * replace the Slice in the Slice Zone.\n */\nexport type SliceMapper<\n\tTSlice extends SliceLike = SliceLike,\n\tTMappedSlice extends Record<string, unknown> | undefined | void =\n\t\t| Record<string, unknown>\n\t\t| undefined\n\t\t| void,\n\tTContext = unknown,\n> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>\n\n/** Unwraps a lazily loaded mapper module. */\ntype ResolveLazySliceMapperModule<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,\n> =\n\tTSliceMapper extends LazyModule<SliceMapper>\n\t\t? Awaited<ReturnType<TSliceMapper>> extends {\n\t\t\t\tdefault: unknown\n\t\t\t}\n\t\t\t? Awaited<ReturnType<TSliceMapper>>[\"default\"]\n\t\t\t: Awaited<ReturnType<TSliceMapper>>\n\t\t: TSliceMapper\n\n/** Transforms a Slice into its mapped version. */\ntype MapSliceLike<\n\t// oxlint-disable-next-line no-explicit-any\n\tTSliceLike extends SliceLike<any>,\n\tTSliceMappers extends SliceMappers<\n\t\tTSliceLike,\n\t\t// oxlint-disable-next-line no-explicit-any\n\t\tany\n\t>,\n> = TSliceLike extends Slice\n\t? TSliceLike[\"slice_type\"] extends keyof TSliceMappers\n\t\t? TSliceMappers[TSliceLike[\"slice_type\"]] extends AnyFunction\n\t\t\t? SliceLikeRestV2<TSliceLike[\"slice_type\"]> &\n\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"slice_type\"]]>>>\n\t\t\t: TSliceLike\n\t\t: TSliceLike\n\t: TSliceLike extends SliceLikeGraphQL\n\t\t? TSliceLike[\"type\"] extends keyof TSliceMappers\n\t\t\t? TSliceMappers[TSliceLike[\"type\"]] extends AnyFunction\n\t\t\t\t? SliceLikeGraphQL<TSliceLike[\"type\"]> &\n\t\t\t\t\t\tMappedSliceLike &\n\t\t\t\t\t\tAwaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike[\"type\"]]>>>\n\t\t\t\t: TSliceLike\n\t\t\t: TSliceLike\n\t\t: never\n\n/**\n * Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping\n * functions can be async.\n *\n * Whenever possible, use this function on the server to minimize client-side processing.\n *\n * @example\n * \t;```typescript\n * \tconst mappedSliceZone = await mapSliceZone(page.data.slices, {\n * \tcode_block: ({ slice }) => ({\n * \tcodeHTML: await highlight(slice.primary.code),\n * \t}),\n * \t});\n * \t```\n */\nexport function mapSliceZone<\n\tTSliceLike extends SliceLike,\n\tTSliceMappers extends SliceMappers<TSliceLike, TContext>,\n\tTContext = unknown,\n>(\n\tsliceZone: SliceZoneLike<TSliceLike>,\n\tmappers: TSliceMappers,\n\tcontext?: TContext,\n): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]> {\n\treturn Promise.all(\n\t\tsliceZone.map(async (slice, index, slices) => {\n\t\t\tconst isRestSliceType = \"slice_type\" in slice\n\t\t\tconst sliceType = isRestSliceType ? slice.slice_type : slice.type\n\n\t\t\tconst mapper = mappers[sliceType as keyof typeof mappers]\n\n\t\t\tif (!mapper) {\n\t\t\t\treturn slice\n\t\t\t}\n\n\t\t\tconst mapperArgs = { slice, slices, index, context }\n\n\t\t\t// `result` may be a mapper function OR a module\n\t\t\t// containing a mapper function.\n\t\t\tlet result = await mapper(\n\t\t\t\t// @ts-expect-error - I don't know how to fix this type\n\t\t\t\tmapperArgs,\n\t\t\t)\n\n\t\t\t// `result` is a module containing a mapper function,\n\t\t\t// we need to dig out the mapper function. `result`\n\t\t\t// will be reassigned with the mapper function's value.\n\t\t\tif (\n\t\t\t\t// `mapper.length < 1` ensures the given\n\t\t\t\t// function is something of the form:\n\t\t\t\t// `() => import(...)`\n\t\t\t\tmapper.length < 1 &&\n\t\t\t\t(typeof result === \"function\" || (typeof result === \"object\" && \"default\" in result))\n\t\t\t) {\n\t\t\t\tresult = \"default\" in result ? result.default : result\n\t\t\t\tresult = await result(mapperArgs)\n\t\t\t}\n\n\t\t\tif (isRestSliceType) {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\tid: slice.id,\n\t\t\t\t\tslice_type: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\t__mapped: true,\n\t\t\t\t\ttype: sliceType,\n\t\t\t\t\t...result,\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0LA,SAAgB,aAKf,WACA,SACA,SACqD;CACrD,OAAO,QAAQ,IACd,UAAU,IAAI,OAAO,OAAO,OAAO,WAAW;EAC7C,MAAM,kBAAkB,gBAAgB;EACxC,MAAM,YAAY,kBAAkB,MAAM,aAAa,MAAM;EAE7D,MAAM,SAAS,QAAQ;EAEvB,IAAI,CAAC,QACJ,OAAO;EAGR,MAAM,aAAa;GAAE;GAAO;GAAQ;GAAO;EAAQ;EAInD,IAAI,SAAS,MAAM,OAElB,UACD;EAKA,IAIC,OAAO,SAAS,MACf,OAAO,WAAW,cAAe,OAAO,WAAW,YAAY,aAAa,SAC5E;GACD,SAAS,aAAa,SAAS,OAAO,UAAU;GAChD,SAAS,MAAM,OAAO,UAAU;EACjC;EAEA,IAAI,iBACH,OAAO;GACN,UAAU;GACV,IAAI,MAAM;GACV,YAAY;GACZ,GAAG;EACJ;OAEA,OAAO;GACN,UAAU;GACV,MAAM;GACN,GAAG;EACJ;CAEF,CAAC,CACF;AACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -90,12 +90,11 @@ import { IntegrationAPIItem, IntegrationAPIResults } from "./types/api/integrati
|
|
|
90
90
|
import { WebhookBodyAPIUpdate } from "./types/webhook/apiUpdate.cjs";
|
|
91
91
|
import { WebhookBodyTestTrigger } from "./types/webhook/testTrigger.cjs";
|
|
92
92
|
import { WebhookBody, WebhookType } from "./types/webhook/types.cjs";
|
|
93
|
-
|
|
94
93
|
//#region src/index.d.ts
|
|
95
94
|
/** @deprecated Renamed to `filter` */
|
|
96
95
|
declare const predicate: {
|
|
97
|
-
at: (path: string, value: string | number | boolean |
|
|
98
|
-
not: (path: string, value: string | number | boolean |
|
|
96
|
+
at: (path: string, value: string | number | boolean | string[] | Date) => string;
|
|
97
|
+
not: (path: string, value: string | number | boolean | string[] | Date) => string;
|
|
99
98
|
any: (path: string, values: (string | number | boolean | Date)[]) => string;
|
|
100
99
|
in: (path: string, values: string[]) => string;
|
|
101
100
|
fulltext: (path: string, searchTerms: string) => string;
|
|
@@ -156,5 +155,5 @@ type IntegrationFields = IntegrationField;
|
|
|
156
155
|
/** @deprecated Renamed to `CustomTypeModelIntegrationField`. */
|
|
157
156
|
type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
|
|
158
157
|
//#endregion
|
|
159
|
-
export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
|
|
158
|
+
export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, type CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
|
|
160
159
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,8BAAqB;;KAWtB,oBAAoB;;KAEpB,yBAAyB;;cAiCxB;;;;;;;;;;;;;;;;;;;;;;KAiGD,oBAAoB;;KAoEpB,wCAAwC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -90,12 +90,11 @@ import { IntegrationAPIItem, IntegrationAPIResults } from "./types/api/integrati
|
|
|
90
90
|
import { WebhookBodyAPIUpdate } from "./types/webhook/apiUpdate.js";
|
|
91
91
|
import { WebhookBodyTestTrigger } from "./types/webhook/testTrigger.js";
|
|
92
92
|
import { WebhookBody, WebhookType } from "./types/webhook/types.js";
|
|
93
|
-
|
|
94
93
|
//#region src/index.d.ts
|
|
95
94
|
/** @deprecated Renamed to `filter` */
|
|
96
95
|
declare const predicate: {
|
|
97
|
-
at: (path: string, value: string | number | boolean |
|
|
98
|
-
not: (path: string, value: string | number | boolean |
|
|
96
|
+
at: (path: string, value: string | number | boolean | string[] | Date) => string;
|
|
97
|
+
not: (path: string, value: string | number | boolean | string[] | Date) => string;
|
|
99
98
|
any: (path: string, values: (string | number | boolean | Date)[]) => string;
|
|
100
99
|
in: (path: string, values: string[]) => string;
|
|
101
100
|
fulltext: (path: string, searchTerms: string) => string;
|
|
@@ -156,5 +155,5 @@ type IntegrationFields = IntegrationField;
|
|
|
156
155
|
/** @deprecated Renamed to `CustomTypeModelIntegrationField`. */
|
|
157
156
|
type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
|
|
158
157
|
//#endregion
|
|
159
|
-
export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
|
|
158
|
+
export { type AbortSignalLike, type AlternateLanguage, type AnyOEmbed, type AnyRegularField, type AnySlicePrimaryField, type AsLinkAttrsConfig, type BooleanField, type BuildQueryURLArgs, Client, type ClientConfig, type ColorField, type ContentRelationshipField, type CreateClient, type CreateMigration, type CreateWriteClient, type CustomTypeModel, type CustomTypeModelBooleanField, type CustomTypeModelColorField, type CustomTypeModelContentRelationshipField, type CustomTypeModelDateField, type CustomTypeModelDefinition, type CustomTypeModelEmbedField, type CustomTypeModelFetchContentRelationshipLevel1, type CustomTypeModelFetchCustomTypeLevel1, type CustomTypeModelFetchCustomTypeLevel2, type CustomTypeModelFetchGroupLevel1, type CustomTypeModelFetchGroupLevel2, type CustomTypeModelField, type CustomTypeModelFieldForGroup, type CustomTypeModelFieldForNestedGroup, type CustomTypeModelFieldForSlicePrimary, CustomTypeModelFieldType, type CustomTypeModelGeoPointField, type CustomTypeModelGroupField, type CustomTypeModelImageConstraint, type CustomTypeModelImageField, type CustomTypeModelImageThumbnail, type CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, type CustomTypeModelKeyTextField, type CustomTypeModelLegacySlice, type CustomTypeModelLinkField, CustomTypeModelLinkSelectType, type CustomTypeModelLinkToMediaField, type CustomTypeModelNestedGroupField, type CustomTypeModelNumberField, type CustomTypeModelRangeField, type CustomTypeModelRichTextField, type CustomTypeModelRichTextMultiField, type CustomTypeModelRichTextSingleField, type CustomTypeModelSelectField, type CustomTypeModelSeparatorField, type CustomTypeModelSharedSlice, type CustomTypeModelSlice, CustomTypeModelSliceDisplay, type CustomTypeModelSliceLabel, CustomTypeModelSliceType, type CustomTypeModelSliceZoneField, type CustomTypeModelTab, type CustomTypeModelTableField, type CustomTypeModelTimestampField, type CustomTypeModelTitleField, type CustomTypeModelUIDField, type DateField, Element, type EmbedField, type EmptyImageFieldImage, type EmptyLinkField, type ExistingPrismicDocument, type FetchLike, type FieldState, type FilledContentRelationshipField, type FilledImageFieldImage, type FilledLinkToMediaField, type FilledLinkToWebField, ForbiddenError, type Form, type FormField, type GeoPointField, type GroupField, type HTMLFunctionSerializer, type HTMLMapSerializer, type HTMLRichTextFunctionSerializer, type HTMLRichTextMapSerializer, type HTMLRichTextSerializer, type HttpRequestLike, type ImageField, type ImageFieldImage, type InjectMigrationSpecificTypes, type IntegrationAPIItem, type IntegrationAPIResults, type IntegrationField, type IntegrationFieldData, type IntegrationFields, InvalidDataError, type KeyTextField, type Language, type LinkField, type LinkOEmbed, type LinkResolverFunction, type LinkToMediaField, LinkType, type MigrateReporterEvents, Migration, type MigrationContentRelationship, type MigrationImage, type MigrationLinkToMedia, type MigrationRTImageNode, type NestedGroupField, NotFoundError, type NumberField, type OEmbedExtra, OEmbedType, type Ordering, ParsingError, type PendingPrismicDocument, type PhotoOEmbed, PreviewTokenExpiredError, type PrismicDocument, type PrismicDocumentHeader, type PrismicDocumentWithUID, type PrismicDocumentWithoutUID, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, type PublishMigrationReleaseResult, type Query, type QueryParams, type RTAnyNode, type RTBlockNode, type RTEmNode, type RTEmbedNode, type RTHeading1Node, type RTHeading2Node, type RTHeading3Node, type RTHeading4Node, type RTHeading5Node, type RTHeading6Node, type RTImageNode, type RTInlineNode, type RTLabelNode, type RTLinkNode, type RTListItemNode, type RTListNode, type RTNode, type RTOListItemNode, type RTOListNode, type RTParagraphNode, type RTPreformattedNode, type RTSpanNode, type RTSpanNodeBase, type RTStrongNode, type RTTextNode, type RTTextNodeBase, type Ref, RefExpiredError, RefNotFoundError, type Release, type Repeatable, type Repository, RepositoryNotFoundError, type RequestInitLike, type ResponseLike, type RichOEmbed, type RichTextField, RichTextNodeType, type RichTextNodeTypes, type Route, type SelectField, type SharedSlice, type SharedSliceModel, type SharedSliceModelVariation, type SharedSliceVariation, type Slice, type SliceMapper, type SliceZone, type TableField, type TableFieldBody, type TableFieldBodyRow, type TableFieldDataCell, type TableFieldHead, type TableFieldHeadRow, type TableFieldHeaderCell, type Tags, type TimestampField, type TitleField, type VideoOEmbed, type WebhookBody, type WebhookBodyAPIUpdate, type WebhookBodyTestTrigger, WebhookType, WriteClient, type WriteClientConfig, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie_d_exports as cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled_d_exports as isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
|
|
160
159
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsCM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BA,8BAAqB;;KAWtB,oBAAoB;;KAEpB,yBAAyB;;cAiCxB;;;;;;;;;;;;;;;;;;;;;;KAiGD,oBAAoB;;KAoEpB,wCAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.cjs","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.cjs","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;CAC/D,IAAI;EACH,IAAI,IAAI,KAAK;EAEb,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD"}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
|
|
8
8
|
* otherwise.
|
|
9
9
|
*/
|
|
10
|
-
declare const isRepositoryEndpoint: (input: string) => boolean;
|
|
10
|
+
export declare const isRepositoryEndpoint: (input: string) => boolean;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { isRepositoryEndpoint };
|
|
13
12
|
//# sourceMappingURL=isRepositoryEndpoint.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.d.cts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.d.cts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;;;;;;;;qBAQa,uBAAoB"}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
|
|
8
8
|
* otherwise.
|
|
9
9
|
*/
|
|
10
|
-
declare const isRepositoryEndpoint: (input: string) => boolean;
|
|
10
|
+
export declare const isRepositoryEndpoint: (input: string) => boolean;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { isRepositoryEndpoint };
|
|
13
12
|
//# sourceMappingURL=isRepositoryEndpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.d.ts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.d.ts","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"mappings":";;;;;;;;;qBAQa,uBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.js","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.js","names":[],"sources":["../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid\n * endpoint to support network proxies.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic Content API endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input)\n\n\t\treturn true\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,wBAAwB,UAA2B;CAC/D,IAAI;EACH,IAAI,IAAI,KAAK;EAEb,OAAO;CACR,QAAQ;EACP,OAAO;CACR;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryName.cjs","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;
|
|
1
|
+
{"version":3,"file":"isRepositoryName.cjs","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;CAC3D,OAAO,2CAA2C,KAAK,KAAK;AAC7D"}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @returns `true` if `input` is a valid Prismic repository name, `false`
|
|
7
7
|
* otherwise.
|
|
8
8
|
*/
|
|
9
|
-
declare const isRepositoryName: (input: string) => boolean;
|
|
9
|
+
export declare const isRepositoryName: (input: string) => boolean;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { isRepositoryName };
|
|
12
11
|
//# sourceMappingURL=isRepositoryName.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryName.d.cts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isRepositoryName.d.cts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;;;;;;;qBAOa,mBAAgB"}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @returns `true` if `input` is a valid Prismic repository name, `false`
|
|
7
7
|
* otherwise.
|
|
8
8
|
*/
|
|
9
|
-
declare const isRepositoryName: (input: string) => boolean;
|
|
9
|
+
export declare const isRepositoryName: (input: string) => boolean;
|
|
10
10
|
//#endregion
|
|
11
|
-
export { isRepositoryName };
|
|
12
11
|
//# sourceMappingURL=isRepositoryName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryName.d.ts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"isRepositoryName.d.ts","names":[],"sources":["../src/isRepositoryName.ts"],"mappings":";;;;;;;;qBAOa,mBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryName.js","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;
|
|
1
|
+
{"version":3,"file":"isRepositoryName.js","names":[],"sources":["../src/isRepositoryName.ts"],"sourcesContent":["/**\n * Determines if an input is a valid Prismic repository name.\n *\n * @param input - Input to test.\n * @returns `true` if `input` is a valid Prismic repository name, `false`\n * otherwise.\n */\nexport const isRepositoryName = (input: string): boolean => {\n\treturn /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)\n}\n"],"mappings":";;;;;;;;AAOA,MAAa,oBAAoB,UAA2B;CAC3D,OAAO,2CAA2C,KAAK,KAAK;AAC7D"}
|
package/dist/lib/devMsg.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;
|
|
1
|
+
{"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,mCAAmCA,gBAAAA,QAAQ,GAAG;AACtD"}
|
package/dist/lib/devMsg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;
|
|
1
|
+
{"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,mCAAmC,QAAQ,GAAG;AACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escapeHTML.cjs","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \""\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"'\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"<\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \">\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"escapeHTML.cjs","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \""\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"'\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"<\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \">\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,GAAG;CAEtC,IAAI,CAAC,OACJ,OAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;CAEhB,KAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;EACtD,QAAQ,IAAI,WAAW,KAAK,GAA5B;GACC,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,SACC;EACF;EAEA,IAAI,cAAc,OACjB,QAAQ,IAAI,UAAU,WAAW,KAAK;EAGvC,YAAY,QAAQ;EACpB,QAAQ;CACT;CAEA,OAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,KAAK,IAAI;AACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escapeHTML.js","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \""\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"'\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"<\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \">\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"escapeHTML.js","names":[],"sources":["../../src/lib/escapeHTML.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/component/escape-html\n ** Many thanks to @component\n */\n\nconst matchHtmlRegExp = /[\"'&<>]/\n\nexport const escapeHTML = (string?: string | null): string => {\n\tconst str = \"\" + string\n\tconst match = matchHtmlRegExp.exec(str)\n\n\tif (!match) {\n\t\treturn str\n\t}\n\n\tlet escape\n\tlet html = \"\"\n\tlet index = 0\n\tlet lastIndex = 0\n\n\tfor (index = match.index; index < str.length; index++) {\n\t\tswitch (str.charCodeAt(index)) {\n\t\t\tcase 34: // \"\n\t\t\t\tescape = \""\"\n\t\t\t\tbreak\n\t\t\tcase 38: // &\n\t\t\t\tescape = \"&\"\n\t\t\t\tbreak\n\t\t\tcase 39: // '\n\t\t\t\tescape = \"'\"\n\t\t\t\tbreak\n\t\t\tcase 60: // <\n\t\t\t\tescape = \"<\"\n\t\t\t\tbreak\n\t\t\tcase 62: // >\n\t\t\t\tescape = \">\"\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t}\n\n\t\tif (lastIndex !== index) {\n\t\t\thtml += str.substring(lastIndex, index)\n\t\t}\n\n\t\tlastIndex = index + 1\n\t\thtml += escape\n\t}\n\n\treturn lastIndex !== index ? html + str.substring(lastIndex, index) : html\n}\n"],"mappings":";AAKA,MAAM,kBAAkB;AAExB,MAAa,cAAc,WAAmC;CAC7D,MAAM,MAAM,KAAK;CACjB,MAAM,QAAQ,gBAAgB,KAAK,GAAG;CAEtC,IAAI,CAAC,OACJ,OAAO;CAGR,IAAI;CACJ,IAAI,OAAO;CACX,IAAI,QAAQ;CACZ,IAAI,YAAY;CAEhB,KAAK,QAAQ,MAAM,OAAO,QAAQ,IAAI,QAAQ,SAAS;EACtD,QAAQ,IAAI,WAAW,KAAK,GAA5B;GACC,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,KAAK;IACJ,SAAS;IACT;GACD,SACC;EACF;EAEA,IAAI,cAAc,OACjB,QAAQ,IAAI,UAAU,WAAW,KAAK;EAGvC,YAAY,QAAQ;EACpB,QAAQ;CACT;CAEA,OAAO,cAAc,QAAQ,OAAO,IAAI,UAAU,WAAW,KAAK,IAAI;AACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptionalLinkProperties.cjs","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,
|
|
1
|
+
{"version":3,"file":"getOptionalLinkProperties.cjs","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,CAAC;CAErC,IAAI,UAAU,OACb,IAAI,OAAO,MAAM;CAGlB,IAAI,aAAa,OAChB,IAAI,UAAU,MAAM;CAGrB,OAAO;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOptionalLinkProperties.js","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,
|
|
1
|
+
{"version":3,"file":"getOptionalLinkProperties.js","names":[],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can have the same shape as\n * content relationship and link to media fields, requiring special treatment to extract\n * link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the link properties\n * will be extracted.\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,6BACZ,UAC4B;CAC5B,MAAM,MAA8B,CAAC;CAErC,IAAI,UAAU,OACb,IAAI,OAAO,MAAM;CAGlB,IAAI,aAAa,OAChB,IAAI,UAAU,MAAM;CAGrB,OAAO;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;
|
|
1
|
+
{"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;CAC5C,OAAO,MAAM,QAAQ,QAAQ,GAAG;AACjC;;;;;;;AAQA,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,IAAI;CAEpC,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,GAAG;EAG9B,IAFa,UAAU,MAAM,EAAE,CAAC,CAAC,QAAQ,QAAQ,GAE1C,MAAA,sBAAyB;GAC/B,QAAQ,UAAU,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;GAC1C;EACD;CACD;CAEA,OAAO;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviewCookie.js","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;
|
|
1
|
+
{"version":3,"file":"getPreviewCookie.js","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;CAC5C,OAAO,MAAM,QAAQ,QAAQ,GAAG;AACjC;;;;;;;AAQA,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,IAAI;CAEpC,IAAI;CAEJ,KAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,GAAG;EAG9B,IAFa,UAAU,MAAM,EAAE,CAAC,CAAC,QAAQ,QAAQ,GAE1C,MAAA,sBAAyB;GAC/B,QAAQ,UAAU,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;GAC1C;EACD;CACD;CAEA,OAAO;AACR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,GAAG;CAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,GAAG;CAE7D,OAAO,cAAc,CAAC;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.js","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,
|
|
1
|
+
{"version":3,"file":"isInternalURL.js","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,GAAG;CAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,GAAG;CAE7D,OAAO,cAAc,CAAC;AACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\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` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration image field, `false` otherwise.\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 `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\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 MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;
|
|
1
|
+
{"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\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` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration image field, `false` otherwise.\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 `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\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 MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;CACpE,OACC,iBAAiBA,iBAAAA,4BAAAA,gBAAAA,gBACE,KAAK,KACvB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,aAAAA,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,EAAE,KAAK,OAAO,MAAM,OAAO;AAEzD;;;;;;;;;AAUA,MAAa,SAAS,UAAiD;CACtE,OACC,iBAAiBC,cAAAA,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,CAAC,CAAC,OACnB,mBAAmB,0BAA0BA,cAAAA,qBAC/C;AAEH;;;;;;;;;;;;;AAcA,MAAa,eACZ,UAC4D;CAC5D,OACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,cAAAA,yBACpB,eAAe,SACf,MAAM,cAAcD,aAAAA,SAAS;AAE/B;;;;;;;;;;AAWA,MAAa,eAAe,UAAuD;CAClF,OACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,cAAAA,yBACpB,UAAU,SACV,MAAM,SAASC,iBAAAA,iBAAiB;AAElC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\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` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration image field, `false` otherwise.\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 `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\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 MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;
|
|
1
|
+
{"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\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` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration image field, `false` otherwise.\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 `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\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 * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\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 MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;CACpE,OACC,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;;;;;;;;;AAUA,MAAa,SAAS,UAAiD;CACtE,OACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,KAAK,CAAC,CAAC,OACnB,mBAAmB,0BAA0B,qBAC/C;AAEH;;;;;;;;;;;;;AAcA,MAAa,eACZ,UAC4D;CAC5D,OACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;AAE/B;;;;;;;;;;AAWA,MAAa,eAAe,UAAuD;CAClF,OACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB;AAElC"}
|