@prismicio/client 7.21.7 → 7.21.8-pr.446.d7e6f74
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/dist/Client.cjs +190 -263
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +175 -241
- package/dist/Client.d.cts.map +1 -1
- package/dist/Client.d.ts +175 -241
- package/dist/Client.d.ts.map +1 -1
- package/dist/Client.js +190 -263
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +54 -86
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +50 -84
- package/dist/Migration.d.cts.map +1 -1
- package/dist/Migration.d.ts +50 -84
- package/dist/Migration.d.ts.map +1 -1
- package/dist/Migration.js +54 -86
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +77 -77
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +50 -63
- package/dist/WriteClient.d.cts.map +1 -1
- package/dist/WriteClient.d.ts +50 -63
- package/dist/WriteClient.d.ts.map +1 -1
- package/dist/WriteClient.js +77 -77
- package/dist/WriteClient.js.map +1 -1
- package/dist/buildQueryURL.cjs +15 -22
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +53 -63
- package/dist/buildQueryURL.d.cts.map +1 -1
- package/dist/buildQueryURL.d.ts +53 -63
- package/dist/buildQueryURL.d.ts.map +1 -1
- package/dist/buildQueryURL.js +15 -22
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs +1 -4
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.d.cts +1 -4
- package/dist/cookie.d.cts.map +1 -1
- package/dist/cookie.d.ts +1 -4
- package/dist/cookie.d.ts.map +1 -1
- package/dist/cookie.js +1 -4
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +10 -14
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +11 -18
- package/dist/createClient.d.cts.map +1 -1
- package/dist/createClient.d.ts +11 -18
- package/dist/createClient.d.ts.map +1 -1
- package/dist/createClient.js +10 -14
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs +4 -7
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +5 -11
- package/dist/createMigration.d.cts.map +1 -1
- package/dist/createMigration.d.ts +5 -11
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +4 -7
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs +8 -13
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +10 -15
- package/dist/createWriteClient.d.cts.map +1 -1
- package/dist/createWriteClient.d.ts +10 -15
- package/dist/createWriteClient.d.ts.map +1 -1
- package/dist/createWriteClient.js +8 -13
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/filter.cjs +5 -18
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +59 -63
- package/dist/filter.d.cts.map +1 -1
- package/dist/filter.d.ts +59 -63
- package/dist/filter.d.ts.map +1 -1
- package/dist/filter.js +5 -18
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs +0 -2
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +0 -2
- package/dist/getGraphQLEndpoint.d.cts.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +0 -2
- package/dist/getGraphQLEndpoint.d.ts.map +1 -1
- package/dist/getGraphQLEndpoint.js +0 -2
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs +4 -8
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +4 -8
- package/dist/getRepositoryEndpoint.d.cts.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +4 -8
- package/dist/getRepositoryEndpoint.d.ts.map +1 -1
- package/dist/getRepositoryEndpoint.js +4 -8
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs +2 -5
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +2 -5
- package/dist/getRepositoryName.d.cts.map +1 -1
- package/dist/getRepositoryName.d.ts +2 -5
- package/dist/getRepositoryName.d.ts.map +1 -1
- package/dist/getRepositoryName.js +2 -5
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs +17 -19
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +17 -19
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +17 -19
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js +17 -19
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs +6 -9
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +5 -10
- package/dist/helpers/asDate.d.cts.map +1 -1
- package/dist/helpers/asDate.d.ts +5 -10
- package/dist/helpers/asDate.d.ts.map +1 -1
- package/dist/helpers/asDate.js +6 -9
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +25 -26
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +29 -55
- package/dist/helpers/asHTML.d.cts.map +1 -1
- package/dist/helpers/asHTML.d.ts +29 -55
- package/dist/helpers/asHTML.d.ts.map +1 -1
- package/dist/helpers/asHTML.js +25 -26
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -27
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +25 -36
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +25 -36
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -27
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs +7 -12
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +8 -15
- package/dist/helpers/asImageSrc.d.cts.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +8 -15
- package/dist/helpers/asImageSrc.d.ts.map +1 -1
- package/dist/helpers/asImageSrc.js +7 -12
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +25 -32
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +29 -41
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +29 -41
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.js +25 -32
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +15 -32
- package/dist/helpers/asLink.d.cts.map +1 -1
- package/dist/helpers/asLink.d.ts +15 -32
- package/dist/helpers/asLink.d.ts.map +1 -1
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs +8 -11
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +9 -14
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +9 -14
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
- package/dist/helpers/asLinkAttrs.js +8 -11
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +10 -23
- package/dist/helpers/asText.d.cts.map +1 -1
- package/dist/helpers/asText.d.ts +10 -23
- package/dist/helpers/asText.d.ts.map +1 -1
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs +2 -7
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +1 -5
- package/dist/helpers/documentToLinkField.d.cts.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +1 -5
- package/dist/helpers/documentToLinkField.d.ts.map +1 -1
- package/dist/helpers/documentToLinkField.js +2 -7
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +8 -35
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +8 -32
- package/dist/helpers/isFilled.d.cts.map +1 -1
- package/dist/helpers/isFilled.d.ts +8 -32
- package/dist/helpers/isFilled.d.ts.map +1 -1
- package/dist/helpers/isFilled.js +8 -35
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs +8 -10
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +35 -63
- package/dist/helpers/mapSliceZone.d.cts.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +35 -63
- package/dist/helpers/mapSliceZone.d.ts.map +1 -1
- package/dist/helpers/mapSliceZone.js +8 -10
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.cjs +11 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -51
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +38 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -17
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +3 -4
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +3 -4
- package/dist/isRepositoryEndpoint.d.cts.map +1 -1
- package/dist/isRepositoryEndpoint.d.ts +3 -4
- package/dist/isRepositoryEndpoint.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.js +3 -4
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs +1 -2
- 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 +1 -2
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/devMsg.cjs +6 -8
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +6 -8
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs +5 -6
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js +5 -6
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs +1 -3
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js +1 -3
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs +0 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js +0 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs +7 -17
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js +7 -17
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs +2 -16
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js +2 -16
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/pLimit.cjs +5 -7
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js +5 -7
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +12 -23
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +7 -20
- package/dist/lib/request.d.cts.map +1 -1
- package/dist/lib/request.d.ts +7 -20
- package/dist/lib/request.d.ts.map +1 -1
- package/dist/lib/request.js +12 -23
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +7 -15
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +7 -15
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/throttledWarn.cjs +3 -4
- package/dist/lib/throttledWarn.cjs.map +1 -1
- package/dist/lib/throttledWarn.js +3 -4
- package/dist/lib/throttledWarn.js.map +1 -1
- package/dist/lib/validateAssetMetadata.cjs +6 -18
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js +6 -18
- 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 +0 -2
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +0 -2
- package/dist/richtext/asText.d.cts.map +1 -1
- package/dist/richtext/asText.d.ts +0 -2
- package/dist/richtext/asText.d.ts.map +1 -1
- package/dist/richtext/asText.js +0 -2
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs +2 -4
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +2 -4
- package/dist/richtext/asTree.d.cts.map +1 -1
- package/dist/richtext/asTree.d.ts +2 -4
- package/dist/richtext/asTree.d.ts.map +1 -1
- package/dist/richtext/asTree.js +2 -4
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs +4 -7
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +4 -7
- package/dist/richtext/composeSerializers.d.cts.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +4 -7
- package/dist/richtext/composeSerializers.d.ts.map +1 -1
- package/dist/richtext/composeSerializers.js +4 -7
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs +2 -6
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +2 -6
- package/dist/richtext/serialize.d.cts.map +1 -1
- package/dist/richtext/serialize.d.ts +2 -6
- package/dist/richtext/serialize.d.ts.map +1 -1
- package/dist/richtext/serialize.js +2 -6
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +3 -7
- package/dist/richtext/types.d.cts.map +1 -1
- package/dist/richtext/types.d.ts +3 -7
- package/dist/richtext/types.d.ts.map +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs +2 -5
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +2 -5
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +2 -5
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
- package/dist/richtext/wrapMapSerializer.js +2 -5
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/asset/asset.d.cts +17 -70
- package/dist/types/api/asset/asset.d.cts.map +1 -1
- package/dist/types/api/asset/asset.d.ts +17 -70
- package/dist/types/api/asset/asset.d.ts.map +1 -1
- package/dist/types/api/asset/tag.d.cts +5 -23
- package/dist/types/api/asset/tag.d.cts.map +1 -1
- package/dist/types/api/asset/tag.d.ts +5 -23
- 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 +16 -0
- package/dist/types/api/migration/release.d.cts.map +1 -0
- package/dist/types/api/migration/release.d.ts +16 -0
- package/dist/types/api/migration/release.d.ts.map +1 -0
- package/dist/types/api/query.d.cts +10 -27
- package/dist/types/api/query.d.cts.map +1 -1
- package/dist/types/api/query.d.ts +10 -27
- package/dist/types/api/query.d.ts.map +1 -1
- package/dist/types/api/ref.d.cts +6 -16
- package/dist/types/api/ref.d.cts.map +1 -1
- package/dist/types/api/ref.d.ts +6 -16
- package/dist/types/api/ref.d.ts.map +1 -1
- package/dist/types/api/release.d.cts +1 -2
- package/dist/types/api/release.d.cts.map +1 -1
- package/dist/types/api/release.d.ts +1 -2
- package/dist/types/api/release.d.ts.map +1 -1
- package/dist/types/api/repository.d.cts +18 -45
- package/dist/types/api/repository.d.cts.map +1 -1
- package/dist/types/api/repository.d.ts +18 -45
- package/dist/types/api/repository.d.ts.map +1 -1
- package/dist/types/api/tags.d.cts +2 -3
- package/dist/types/api/tags.d.cts.map +1 -1
- package/dist/types/api/tags.d.ts +2 -3
- package/dist/types/api/tags.d.ts.map +1 -1
- package/dist/types/migration/Asset.cjs +4 -13
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +20 -66
- package/dist/types/migration/Asset.d.cts.map +1 -1
- package/dist/types/migration/Asset.d.ts +20 -66
- package/dist/types/migration/Asset.d.ts.map +1 -1
- package/dist/types/migration/Asset.js +4 -13
- 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 +10 -19
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +12 -31
- package/dist/types/migration/Document.d.cts.map +1 -1
- package/dist/types/migration/Document.d.ts +12 -31
- package/dist/types/migration/Document.d.ts.map +1 -1
- package/dist/types/migration/Document.js +10 -19
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/contentRelationship.d.cts +5 -15
- package/dist/types/model/contentRelationship.d.cts.map +1 -1
- package/dist/types/model/contentRelationship.d.ts +5 -15
- package/dist/types/model/contentRelationship.d.ts.map +1 -1
- package/dist/types/model/customType.d.cts +6 -17
- package/dist/types/model/customType.d.cts.map +1 -1
- package/dist/types/model/customType.d.ts +6 -17
- package/dist/types/model/customType.d.ts.map +1 -1
- package/dist/types/model/image.d.cts.map +1 -1
- package/dist/types/model/image.d.ts.map +1 -1
- package/dist/types/model/linkToMedia.d.cts.map +1 -1
- package/dist/types/model/linkToMedia.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/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/sharedSliceVariation.d.cts.map +1 -1
- 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 +1 -3
- package/dist/types/model/slice.d.cts.map +1 -1
- package/dist/types/model/slice.d.ts +1 -3
- 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.map +1 -1
- package/dist/types/model/sliceZone.d.ts.map +1 -1
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/types.cjs +1 -3
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +9 -31
- package/dist/types/model/types.d.cts.map +1 -1
- package/dist/types/model/types.d.ts +9 -31
- package/dist/types/model/types.d.ts.map +1 -1
- package/dist/types/model/types.js +1 -3
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/value/color.d.cts +0 -1
- package/dist/types/value/color.d.cts.map +1 -1
- package/dist/types/value/color.d.ts +0 -1
- 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 +0 -1
- package/dist/types/value/date.d.cts.map +1 -1
- package/dist/types/value/date.d.ts +0 -1
- package/dist/types/value/date.d.ts.map +1 -1
- package/dist/types/value/document.d.cts +23 -50
- package/dist/types/value/document.d.cts.map +1 -1
- package/dist/types/value/document.d.ts +23 -50
- package/dist/types/value/document.d.ts.map +1 -1
- package/dist/types/value/embed.cjs +1 -1
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +28 -95
- package/dist/types/value/embed.d.cts.map +1 -1
- package/dist/types/value/embed.d.ts +28 -95
- package/dist/types/value/embed.d.ts.map +1 -1
- package/dist/types/value/embed.js +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +0 -1
- package/dist/types/value/geoPoint.d.cts.map +1 -1
- package/dist/types/value/geoPoint.d.ts +0 -1
- package/dist/types/value/geoPoint.d.ts.map +1 -1
- package/dist/types/value/group.d.cts.map +1 -1
- package/dist/types/value/group.d.ts.map +1 -1
- package/dist/types/value/image.d.cts +5 -8
- package/dist/types/value/image.d.cts.map +1 -1
- package/dist/types/value/image.d.ts +5 -8
- package/dist/types/value/image.d.ts.map +1 -1
- package/dist/types/value/integration.d.cts +0 -1
- package/dist/types/value/integration.d.cts.map +1 -1
- package/dist/types/value/integration.d.ts +0 -1
- package/dist/types/value/integration.d.ts.map +1 -1
- package/dist/types/value/keyText.d.cts +0 -1
- package/dist/types/value/keyText.d.cts.map +1 -1
- package/dist/types/value/keyText.d.ts +0 -1
- package/dist/types/value/keyText.d.ts.map +1 -1
- package/dist/types/value/link.cjs +1 -3
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +8 -12
- package/dist/types/value/link.d.cts.map +1 -1
- package/dist/types/value/link.d.ts +8 -12
- package/dist/types/value/link.d.ts.map +1 -1
- package/dist/types/value/link.js +1 -3
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts.map +1 -1
- package/dist/types/value/linkToMedia.d.ts.map +1 -1
- package/dist/types/value/number.d.cts +0 -1
- package/dist/types/value/number.d.cts.map +1 -1
- package/dist/types/value/number.d.ts +0 -1
- 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 +26 -77
- package/dist/types/value/richText.d.cts.map +1 -1
- package/dist/types/value/richText.d.ts +26 -77
- 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 +0 -1
- package/dist/types/value/select.d.cts.map +1 -1
- package/dist/types/value/select.d.ts +0 -1
- package/dist/types/value/select.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.map +1 -1
- package/dist/types/value/slice.d.ts.map +1 -1
- package/dist/types/value/sliceZone.d.cts +3 -4
- package/dist/types/value/sliceZone.d.cts.map +1 -1
- package/dist/types/value/sliceZone.d.ts +3 -4
- package/dist/types/value/sliceZone.d.ts.map +1 -1
- package/dist/types/value/table.d.cts +14 -63
- package/dist/types/value/table.d.cts.map +1 -1
- package/dist/types/value/table.d.ts +14 -63
- package/dist/types/value/table.d.ts.map +1 -1
- package/dist/types/value/timestamp.d.cts.map +1 -1
- package/dist/types/value/timestamp.d.ts.map +1 -1
- package/dist/types/value/title.d.cts +1 -1
- package/dist/types/value/title.d.cts.map +1 -1
- package/dist/types/value/title.d.ts +1 -1
- package/dist/types/value/title.d.ts.map +1 -1
- package/dist/types/value/types.d.cts +11 -24
- package/dist/types/value/types.d.cts.map +1 -1
- package/dist/types/value/types.d.ts +11 -24
- 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/package.json +32 -34
- package/src/Client.ts +236 -399
- package/src/Migration.ts +80 -139
- package/src/WriteClient.ts +113 -174
- package/src/buildQueryURL.ts +68 -100
- package/src/cookie.ts +1 -4
- package/src/createClient.ts +12 -20
- package/src/createMigration.ts +8 -16
- package/src/createWriteClient.ts +11 -19
- package/src/errors.ts +5 -15
- package/src/filter.ts +79 -122
- package/src/getGraphQLEndpoint.ts +0 -3
- package/src/getRepositoryEndpoint.ts +4 -9
- package/src/getRepositoryName.ts +2 -5
- package/src/getToolbarSrc.ts +17 -20
- package/src/helpers/asDate.ts +13 -18
- package/src/helpers/asHTML.ts +55 -102
- package/src/helpers/asImagePixelDensitySrcSet.ts +29 -49
- package/src/helpers/asImageSrc.ts +8 -16
- package/src/helpers/asImageWidthSrcSet.ts +33 -52
- package/src/helpers/asLink.ts +26 -54
- package/src/helpers/asLinkAttrs.ts +14 -29
- package/src/helpers/asText.ts +15 -31
- package/src/helpers/documentToLinkField.ts +4 -15
- package/src/helpers/isFilled.ts +14 -51
- package/src/helpers/mapSliceZone.ts +42 -84
- package/src/index.ts +20 -68
- package/src/isRepositoryEndpoint.ts +3 -4
- package/src/isRepositoryName.ts +1 -2
- package/src/lib/devMsg.ts +6 -8
- package/src/lib/getOptionalLinkProperties.ts +5 -6
- package/src/lib/getPreviewCookie.ts +1 -3
- package/src/lib/isInternalURL.ts +0 -1
- package/src/lib/isMigrationValue.ts +9 -22
- package/src/lib/isValue.ts +9 -38
- package/src/lib/pLimit.ts +9 -16
- package/src/lib/request.ts +15 -40
- package/src/lib/resolveMigrationDocumentData.ts +8 -27
- package/src/lib/serializerHelpers.ts +9 -29
- package/src/lib/throttledWarn.ts +4 -8
- package/src/lib/validateAssetMetadata.ts +17 -43
- package/src/richtext/asText.ts +2 -8
- package/src/richtext/asTree.ts +8 -26
- package/src/richtext/composeSerializers.ts +5 -11
- package/src/richtext/serialize.ts +4 -12
- package/src/richtext/types.ts +13 -57
- package/src/richtext/wrapMapSerializer.ts +4 -8
- package/src/types/api/asset/asset.ts +26 -77
- package/src/types/api/asset/tag.ts +6 -18
- package/src/types/api/integration.ts +4 -10
- package/src/types/api/migration/document.ts +11 -27
- package/src/types/api/migration/release.ts +12 -0
- package/src/types/api/query.ts +10 -27
- package/src/types/api/ref.ts +6 -16
- package/src/types/api/release.ts +1 -2
- package/src/types/api/repository.ts +18 -45
- package/src/types/api/tags.ts +2 -3
- package/src/types/migration/Asset.ts +26 -82
- package/src/types/migration/ContentRelationship.ts +5 -12
- package/src/types/migration/Document.ts +26 -52
- package/src/types/migration/Link.ts +7 -9
- package/src/types/model/contentRelationship.ts +7 -20
- package/src/types/model/customType.ts +7 -21
- package/src/types/model/image.ts +4 -5
- package/src/types/model/linkToMedia.ts +1 -2
- package/src/types/model/range.ts +1 -3
- package/src/types/model/separator.ts +1 -3
- package/src/types/model/sharedSliceVariation.ts +4 -4
- package/src/types/model/slice.ts +7 -12
- package/src/types/model/sliceZone.ts +4 -11
- package/src/types/model/types.ts +10 -31
- package/src/types/value/color.ts +3 -3
- package/src/types/value/contentRelationship.ts +8 -13
- package/src/types/value/date.ts +1 -3
- package/src/types/value/document.ts +24 -52
- package/src/types/value/embed.ts +33 -80
- package/src/types/value/geoPoint.ts +6 -8
- package/src/types/value/group.ts +1 -4
- package/src/types/value/image.ts +10 -14
- package/src/types/value/integration.ts +0 -1
- package/src/types/value/keyText.ts +3 -3
- package/src/types/value/link.ts +14 -22
- package/src/types/value/linkToMedia.ts +2 -5
- package/src/types/value/number.ts +3 -3
- package/src/types/value/richText.ts +30 -82
- package/src/types/value/select.ts +0 -1
- package/src/types/value/sharedSliceVariation.ts +3 -11
- package/src/types/value/slice.ts +2 -8
- package/src/types/value/sliceZone.ts +4 -6
- package/src/types/value/table.ts +25 -64
- package/src/types/value/timestamp.ts +3 -2
- package/src/types/value/title.ts +16 -18
- package/src/types/value/types.ts +8 -21
- package/src/types/webhook/apiUpdate.ts +1 -3
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { Slice } from "../types/value/slice"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Convert a value to a lazyily loaded module. This is useful when using
|
|
5
|
-
*
|
|
4
|
+
* Convert a value to a lazyily loaded module. This is useful when using functions like `() =>
|
|
5
|
+
* import("...")`.
|
|
6
6
|
*/
|
|
7
7
|
type LazyModule<T> = () => Promise<T | { default: T }>
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Mark a type as potentially lazy-loaded via a module.
|
|
11
|
-
*/
|
|
9
|
+
/** Mark a type as potentially lazy-loaded via a module. */
|
|
12
10
|
type MaybeLazyModule<T> = T | LazyModule<T>
|
|
13
11
|
|
|
14
12
|
// oxlint-disable-next-line no-explicit-any
|
|
@@ -26,8 +24,8 @@ type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2
|
|
|
26
24
|
: never
|
|
27
25
|
|
|
28
26
|
/**
|
|
29
|
-
* The minimum required properties to represent a Prismic slice from the Prismic
|
|
30
|
-
*
|
|
27
|
+
* The minimum required properties to represent a Prismic slice from the Prismic Content API for the
|
|
28
|
+
* `mapSliceZone()` helper.
|
|
31
29
|
*
|
|
32
30
|
* @typeParam SliceType - Type name of the slice.
|
|
33
31
|
*/
|
|
@@ -37,8 +35,8 @@ type SliceLikeRestV2<TSliceType extends string = string> = Pick<
|
|
|
37
35
|
>
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
|
-
* The minimum required properties to represent a Prismic slice from the Prismic
|
|
41
|
-
*
|
|
38
|
+
* The minimum required properties to represent a Prismic slice from the Prismic GraphQL API for the
|
|
39
|
+
* `mapSliceZone()` helper.
|
|
42
40
|
*
|
|
43
41
|
* @typeParam SliceType - Type name of the slice.
|
|
44
42
|
*/
|
|
@@ -47,11 +45,10 @@ type SliceLikeGraphQL<TSliceType extends string = string> = {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
|
-
* The minimum required properties to represent a Prismic slice for the
|
|
51
|
-
* `mapSliceZone()` helper.
|
|
48
|
+
* The minimum required properties to represent a Prismic slice for the `mapSliceZone()` helper.
|
|
52
49
|
*
|
|
53
|
-
* If using Prismic's Content API, use the `Slice` export from
|
|
54
|
-
*
|
|
50
|
+
* If using Prismic's Content API, use the `Slice` export from `@prismicio/client` for a full
|
|
51
|
+
* interface.
|
|
55
52
|
*
|
|
56
53
|
* @typeParam SliceType - Type name of the slice.
|
|
57
54
|
*/
|
|
@@ -60,25 +57,22 @@ type SliceLike<TSliceType extends string = string> =
|
|
|
60
57
|
| SliceLikeGraphQL<TSliceType>
|
|
61
58
|
|
|
62
59
|
/**
|
|
63
|
-
* A looser version of the `SliceZone` type from `@prismicio/client` using
|
|
64
|
-
* `SliceLike`.
|
|
60
|
+
* A looser version of the `SliceZone` type from `@prismicio/client` using `SliceLike`.
|
|
65
61
|
*
|
|
66
|
-
* If using Prismic's Content API, use the `SliceZone` export from
|
|
67
|
-
*
|
|
62
|
+
* If using Prismic's Content API, use the `SliceZone` export from `@prismicio/client` for the full
|
|
63
|
+
* type.
|
|
68
64
|
*
|
|
69
65
|
* @typeParam TSlice - The type(s) of a slice in the slice zone.
|
|
70
66
|
*/
|
|
71
67
|
type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[]
|
|
72
68
|
|
|
73
69
|
/**
|
|
74
|
-
* A set of properties that identify a Slice as having been mapped. Consumers of
|
|
75
|
-
*
|
|
76
|
-
* mapped Slices.
|
|
70
|
+
* A set of properties that identify a Slice as having been mapped. Consumers of the mapped Slice
|
|
71
|
+
* Zone can use these properties to detect and specially handle mapped Slices.
|
|
77
72
|
*/
|
|
78
73
|
type MappedSliceLike = {
|
|
79
74
|
/**
|
|
80
|
-
* If `true`, this Slice has been modified from its original value using a
|
|
81
|
-
* mapper.
|
|
75
|
+
* If `true`, this Slice has been modified from its original value using a mapper.
|
|
82
76
|
*
|
|
83
77
|
* @internal
|
|
84
78
|
*/
|
|
@@ -86,48 +80,31 @@ type MappedSliceLike = {
|
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
/**
|
|
89
|
-
* Arguments for a function mapping content from a Prismic Slice using the
|
|
90
|
-
* `mapSliceZone()` helper.
|
|
83
|
+
* Arguments for a function mapping content from a Prismic Slice using the `mapSliceZone()` helper.
|
|
91
84
|
*
|
|
92
85
|
* @typeParam TSlice - The Slice passed as a prop.
|
|
93
|
-
* @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made
|
|
94
|
-
*
|
|
86
|
+
* @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made available to all Slice
|
|
87
|
+
* mappers.
|
|
95
88
|
*/
|
|
96
|
-
type SliceMapperArgs<
|
|
97
|
-
|
|
98
|
-
TContext = unknown,
|
|
99
|
-
> = {
|
|
100
|
-
/**
|
|
101
|
-
* Slice data.
|
|
102
|
-
*/
|
|
89
|
+
type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
90
|
+
/** Slice data. */
|
|
103
91
|
slice: TSlice
|
|
104
92
|
|
|
105
|
-
/**
|
|
106
|
-
* The index of the Slice in the Slice Zone.
|
|
107
|
-
*/
|
|
93
|
+
/** The index of the Slice in the Slice Zone. */
|
|
108
94
|
index: number
|
|
109
95
|
|
|
110
|
-
/**
|
|
111
|
-
* All Slices from the Slice Zone to which the Slice belongs.
|
|
112
|
-
*/
|
|
96
|
+
/** All Slices from the Slice Zone to which the Slice belongs. */
|
|
113
97
|
// TODO: We have to keep this list of Slices general due to circular
|
|
114
98
|
// reference limtiations. If we had another generic to determine the full
|
|
115
99
|
// union of Slice types, it would include TSlice. This causes TypeScript to
|
|
116
100
|
// throw a compilation error.
|
|
117
|
-
slices: SliceZoneLike<
|
|
118
|
-
TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2
|
|
119
|
-
>
|
|
101
|
+
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>
|
|
120
102
|
|
|
121
|
-
/**
|
|
122
|
-
* Arbitrary data passed to `mapSliceZone()` and made available to all Slice
|
|
123
|
-
* mappers.
|
|
124
|
-
*/
|
|
103
|
+
/** Arbitrary data passed to `mapSliceZone()` and made available to all Slice mappers. */
|
|
125
104
|
context: TContext
|
|
126
105
|
}
|
|
127
106
|
|
|
128
|
-
/**
|
|
129
|
-
* A record of mappers.
|
|
130
|
-
*/
|
|
107
|
+
/** A record of mappers. */
|
|
131
108
|
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
132
109
|
[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<
|
|
133
110
|
SliceMapper<
|
|
@@ -140,8 +117,8 @@ type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
|
140
117
|
}
|
|
141
118
|
|
|
142
119
|
/**
|
|
143
|
-
* A function that maps a Slice and its metadata to a modified version. The
|
|
144
|
-
*
|
|
120
|
+
* A function that maps a Slice and its metadata to a modified version. The return value will
|
|
121
|
+
* replace the Slice in the Slice Zone.
|
|
145
122
|
*/
|
|
146
123
|
export type SliceMapper<
|
|
147
124
|
TSlice extends SliceLike = SliceLike,
|
|
@@ -150,13 +127,9 @@ export type SliceMapper<
|
|
|
150
127
|
| undefined
|
|
151
128
|
| void,
|
|
152
129
|
TContext = unknown,
|
|
153
|
-
> = (
|
|
154
|
-
args: SliceMapperArgs<TSlice, TContext>,
|
|
155
|
-
) => TMappedSlice | Promise<TMappedSlice>
|
|
130
|
+
> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>
|
|
156
131
|
|
|
157
|
-
/**
|
|
158
|
-
* Unwraps a lazily loaded mapper module.
|
|
159
|
-
*/
|
|
132
|
+
/** Unwraps a lazily loaded mapper module. */
|
|
160
133
|
type ResolveLazySliceMapperModule<
|
|
161
134
|
// oxlint-disable-next-line no-explicit-any
|
|
162
135
|
TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,
|
|
@@ -169,9 +142,7 @@ type ResolveLazySliceMapperModule<
|
|
|
169
142
|
: Awaited<ReturnType<TSliceMapper>>
|
|
170
143
|
: TSliceMapper
|
|
171
144
|
|
|
172
|
-
/**
|
|
173
|
-
* Transforms a Slice into its mapped version.
|
|
174
|
-
*/
|
|
145
|
+
/** Transforms a Slice into its mapped version. */
|
|
175
146
|
type MapSliceLike<
|
|
176
147
|
// oxlint-disable-next-line no-explicit-any
|
|
177
148
|
TSliceLike extends SliceLike<any>,
|
|
@@ -185,13 +156,7 @@ type MapSliceLike<
|
|
|
185
156
|
? TSliceMappers[TSliceLike["slice_type"]] extends AnyFunction
|
|
186
157
|
? SliceLikeRestV2<TSliceLike["slice_type"]> &
|
|
187
158
|
MappedSliceLike &
|
|
188
|
-
Awaited<
|
|
189
|
-
ReturnType<
|
|
190
|
-
ResolveLazySliceMapperModule<
|
|
191
|
-
TSliceMappers[TSliceLike["slice_type"]]
|
|
192
|
-
>
|
|
193
|
-
>
|
|
194
|
-
>
|
|
159
|
+
Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["slice_type"]]>>>
|
|
195
160
|
: TSliceLike
|
|
196
161
|
: TSliceLike
|
|
197
162
|
: TSliceLike extends SliceLikeGraphQL
|
|
@@ -199,31 +164,25 @@ type MapSliceLike<
|
|
|
199
164
|
? TSliceMappers[TSliceLike["type"]] extends AnyFunction
|
|
200
165
|
? SliceLikeGraphQL<TSliceLike["type"]> &
|
|
201
166
|
MappedSliceLike &
|
|
202
|
-
Awaited<
|
|
203
|
-
ReturnType<
|
|
204
|
-
ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>
|
|
205
|
-
>
|
|
206
|
-
>
|
|
167
|
+
Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>>>
|
|
207
168
|
: TSliceLike
|
|
208
169
|
: TSliceLike
|
|
209
170
|
: never
|
|
210
171
|
|
|
211
172
|
/**
|
|
212
|
-
* Transforms a Slice Zone using a set of mapping functions, one for each type
|
|
213
|
-
*
|
|
173
|
+
* Transforms a Slice Zone using a set of mapping functions, one for each type of Slice. Mapping
|
|
174
|
+
* functions can be async.
|
|
214
175
|
*
|
|
215
|
-
* Whenever possible, use this function on the server to minimize client-side
|
|
216
|
-
* processing.
|
|
176
|
+
* Whenever possible, use this function on the server to minimize client-side processing.
|
|
217
177
|
*
|
|
218
178
|
* @example
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* const mappedSliceZone = await mapSliceZone(page.data.slices, {
|
|
179
|
+
* ;```typescript
|
|
180
|
+
* const mappedSliceZone = await mapSliceZone(page.data.slices, {
|
|
222
181
|
* code_block: ({ slice }) => ({
|
|
223
|
-
*
|
|
182
|
+
* codeHTML: await highlight(slice.primary.code),
|
|
224
183
|
* }),
|
|
225
|
-
*
|
|
226
|
-
*
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
227
186
|
*/
|
|
228
187
|
export function mapSliceZone<
|
|
229
188
|
TSliceLike extends SliceLike,
|
|
@@ -262,8 +221,7 @@ export function mapSliceZone<
|
|
|
262
221
|
// function is something of the form:
|
|
263
222
|
// `() => import(...)`
|
|
264
223
|
mapper.length < 1 &&
|
|
265
|
-
(typeof result === "function" ||
|
|
266
|
-
(typeof result === "object" && "default" in result))
|
|
224
|
+
(typeof result === "function" || (typeof result === "object" && "default" in result))
|
|
267
225
|
) {
|
|
268
226
|
result = "default" in result ? result.default : result
|
|
269
227
|
result = await result(mapperArgs)
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
+
import { filter } from "./filter"
|
|
2
|
+
import type { HTMLRichTextFunctionSerializer, HTMLRichTextMapSerializer } from "./helpers/asHTML"
|
|
3
|
+
import { mapSliceZone } from "./helpers/mapSliceZone"
|
|
1
4
|
// Imports are used for deprecations.
|
|
2
5
|
import type { CustomTypeModelIntegrationField } from "./types/model/integration"
|
|
3
6
|
import type { IntegrationField } from "./types/value/integration"
|
|
4
7
|
import { RichTextNodeType } from "./types/value/richText"
|
|
5
8
|
|
|
6
|
-
import type {
|
|
7
|
-
HTMLRichTextFunctionSerializer,
|
|
8
|
-
HTMLRichTextMapSerializer,
|
|
9
|
-
} from "./helpers/asHTML"
|
|
10
|
-
import { mapSliceZone } from "./helpers/mapSliceZone"
|
|
11
|
-
|
|
12
|
-
import { filter } from "./filter"
|
|
13
|
-
|
|
14
9
|
//=============================================================================
|
|
15
10
|
// Client - Query content from Prismic.
|
|
16
11
|
//=============================================================================
|
|
@@ -39,9 +34,7 @@ export { buildQueryURL } from "./buildQueryURL"
|
|
|
39
34
|
export { getToolbarSrc } from "./getToolbarSrc"
|
|
40
35
|
|
|
41
36
|
// Query filters API.
|
|
42
|
-
/**
|
|
43
|
-
* @deprecated Renamed to `filter`
|
|
44
|
-
*/
|
|
37
|
+
/** @deprecated Renamed to `filter` */
|
|
45
38
|
// TODO: Remove when we remove support for deprecated `predicate` export.
|
|
46
39
|
const predicate = filter
|
|
47
40
|
export { filter, predicate }
|
|
@@ -54,19 +47,9 @@ export type { CreateClient } from "./createClient"
|
|
|
54
47
|
export type { ClientConfig, HttpRequestLike } from "./Client"
|
|
55
48
|
export type { CreateWriteClient } from "./createWriteClient"
|
|
56
49
|
export type { WriteClientConfig, MigrateReporterEvents } from "./WriteClient"
|
|
57
|
-
export type {
|
|
58
|
-
BuildQueryURLArgs,
|
|
59
|
-
Ordering,
|
|
60
|
-
QueryParams,
|
|
61
|
-
Route,
|
|
62
|
-
} from "./buildQueryURL"
|
|
50
|
+
export type { BuildQueryURLArgs, Ordering, QueryParams, Route } from "./buildQueryURL"
|
|
63
51
|
export type { CreateMigration } from "./createMigration"
|
|
64
|
-
export type {
|
|
65
|
-
AbortSignalLike,
|
|
66
|
-
FetchLike,
|
|
67
|
-
RequestInitLike,
|
|
68
|
-
ResponseLike,
|
|
69
|
-
} from "./lib/request"
|
|
52
|
+
export type { AbortSignalLike, FetchLike, RequestInitLike, ResponseLike } from "./lib/request"
|
|
70
53
|
|
|
71
54
|
//=============================================================================
|
|
72
55
|
// Helpers - Manipulate content from Prismic.
|
|
@@ -83,9 +66,7 @@ export { asImageWidthSrcSet } from "./helpers/asImageWidthSrcSet"
|
|
|
83
66
|
export { asImagePixelDensitySrcSet } from "./helpers/asImagePixelDensitySrcSet"
|
|
84
67
|
export * as isFilled from "./helpers/isFilled"
|
|
85
68
|
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Renamed to `mapSliceZone`
|
|
88
|
-
*/
|
|
69
|
+
/** @deprecated Renamed to `mapSliceZone` */
|
|
89
70
|
const unstable_mapSliceZone = mapSliceZone
|
|
90
71
|
export { mapSliceZone, unstable_mapSliceZone }
|
|
91
72
|
|
|
@@ -96,13 +77,9 @@ export type { LinkResolverFunction } from "./helpers/asLink"
|
|
|
96
77
|
export type { AsLinkAttrsConfig } from "./helpers/asLinkAttrs"
|
|
97
78
|
export type { SliceMapper } from "./helpers/mapSliceZone"
|
|
98
79
|
|
|
99
|
-
/**
|
|
100
|
-
* @deprecated Renamed to `HTMLRichTextMapSerializer`
|
|
101
|
-
*/
|
|
80
|
+
/** @deprecated Renamed to `HTMLRichTextMapSerializer` */
|
|
102
81
|
type HTMLMapSerializer = HTMLRichTextMapSerializer
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated Renamed to `HTMLRichTextFunctionSerializer`
|
|
105
|
-
*/
|
|
82
|
+
/** @deprecated Renamed to `HTMLRichTextFunctionSerializer` */
|
|
106
83
|
type HTMLFunctionSerializer = HTMLRichTextFunctionSerializer
|
|
107
84
|
export type {
|
|
108
85
|
HTMLRichTextMapSerializer,
|
|
@@ -134,9 +111,7 @@ export {
|
|
|
134
111
|
//=============================================================================
|
|
135
112
|
|
|
136
113
|
// Values - Types representing Prismic content.
|
|
137
|
-
/**
|
|
138
|
-
* @deprecated Use {@link RichTextNodeType} instead.
|
|
139
|
-
*/
|
|
114
|
+
/** @deprecated Use {@link RichTextNodeType} instead. */
|
|
140
115
|
// TODO: Remove in v8.
|
|
141
116
|
const Element = RichTextNodeType
|
|
142
117
|
export { RichTextNodeType, Element }
|
|
@@ -197,19 +172,12 @@ export type {
|
|
|
197
172
|
EmptyImageFieldImage,
|
|
198
173
|
} from "./types/value/image"
|
|
199
174
|
|
|
200
|
-
export type {
|
|
201
|
-
EmptyLinkField,
|
|
202
|
-
LinkField,
|
|
203
|
-
FilledLinkToWebField,
|
|
204
|
-
} from "./types/value/link"
|
|
175
|
+
export type { EmptyLinkField, LinkField, FilledLinkToWebField } from "./types/value/link"
|
|
205
176
|
export type {
|
|
206
177
|
ContentRelationshipField,
|
|
207
178
|
FilledContentRelationshipField,
|
|
208
179
|
} from "./types/value/contentRelationship"
|
|
209
|
-
export type {
|
|
210
|
-
LinkToMediaField,
|
|
211
|
-
FilledLinkToMediaField,
|
|
212
|
-
} from "./types/value/linkToMedia"
|
|
180
|
+
export type { LinkToMediaField, FilledLinkToMediaField } from "./types/value/linkToMedia"
|
|
213
181
|
|
|
214
182
|
export type {
|
|
215
183
|
OEmbedExtra,
|
|
@@ -240,9 +208,7 @@ export type { SelectField } from "./types/value/select"
|
|
|
240
208
|
export type { TimestampField } from "./types/value/timestamp"
|
|
241
209
|
export type { GeoPointField } from "./types/value/geoPoint"
|
|
242
210
|
|
|
243
|
-
/**
|
|
244
|
-
* @deprecated Renamed to `IntegrationField`
|
|
245
|
-
*/
|
|
211
|
+
/** @deprecated Renamed to `IntegrationField` */
|
|
246
212
|
// TODO: Remove when we remove support for deprecated `IntegrationFields` export.
|
|
247
213
|
type IntegrationFields = IntegrationField
|
|
248
214
|
export type { IntegrationField, IntegrationFields }
|
|
@@ -310,15 +276,10 @@ export type { CustomTypeModelTimestampField } from "./types/model/timestamp"
|
|
|
310
276
|
export type { CustomTypeModelGeoPointField } from "./types/model/geoPoint"
|
|
311
277
|
export type { CustomTypeModelTableField } from "./types/model/table"
|
|
312
278
|
|
|
313
|
-
/**
|
|
314
|
-
* @deprecated Renamed to `CustomTypeModelIntegrationField`.
|
|
315
|
-
*/
|
|
279
|
+
/** @deprecated Renamed to `CustomTypeModelIntegrationField`. */
|
|
316
280
|
// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.
|
|
317
281
|
type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField
|
|
318
|
-
export {
|
|
319
|
-
CustomTypeModelIntegrationField,
|
|
320
|
-
CustomTypeModelIntegrationFieldsField,
|
|
321
|
-
}
|
|
282
|
+
export { CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField }
|
|
322
283
|
export type {
|
|
323
284
|
CustomTypeModelGroupField,
|
|
324
285
|
CustomTypeModelNestedGroupField,
|
|
@@ -328,10 +289,7 @@ export type {
|
|
|
328
289
|
CustomTypeModelSliceLabel,
|
|
329
290
|
CustomTypeModelSharedSlice,
|
|
330
291
|
} from "./types/model/sliceZone"
|
|
331
|
-
export type {
|
|
332
|
-
CustomTypeModelSlice,
|
|
333
|
-
CustomTypeModelLegacySlice,
|
|
334
|
-
} from "./types/model/slice"
|
|
292
|
+
export type { CustomTypeModelSlice, CustomTypeModelLegacySlice } from "./types/model/slice"
|
|
335
293
|
export type { SharedSliceModel } from "./types/model/sharedSlice"
|
|
336
294
|
export type { SharedSliceModelVariation } from "./types/model/sharedSliceVariation"
|
|
337
295
|
|
|
@@ -366,24 +324,18 @@ export type { MigrationContentRelationship } from "./types/migration/ContentRela
|
|
|
366
324
|
// API - Types representing Prismic Content API responses.
|
|
367
325
|
export type { Query } from "./types/api/query"
|
|
368
326
|
|
|
327
|
+
export type { PublishMigrationReleaseResult } from "./types/api/migration/release"
|
|
328
|
+
|
|
369
329
|
export type { Ref } from "./types/api/ref"
|
|
370
330
|
|
|
371
331
|
export type { Release } from "./types/api/release"
|
|
372
332
|
|
|
373
|
-
export type {
|
|
374
|
-
Repository,
|
|
375
|
-
Language,
|
|
376
|
-
Form,
|
|
377
|
-
FormField,
|
|
378
|
-
} from "./types/api/repository"
|
|
333
|
+
export type { Repository, Language, Form, FormField } from "./types/api/repository"
|
|
379
334
|
|
|
380
335
|
export type { Tags } from "./types/api/tags"
|
|
381
336
|
|
|
382
337
|
// Integration - Types representing Prismic's integration API.
|
|
383
|
-
export type {
|
|
384
|
-
IntegrationAPIItem,
|
|
385
|
-
IntegrationAPIResults,
|
|
386
|
-
} from "./types/api/integration"
|
|
338
|
+
export type { IntegrationAPIItem, IntegrationAPIResults } from "./types/api/integration"
|
|
387
339
|
|
|
388
340
|
// Webhook - Types representing Prismic webhooks.
|
|
389
341
|
export { WebhookType } from "./types/webhook/types"
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Determines if a string is a Prismic Content API endpoint. Note that any valid
|
|
3
|
-
*
|
|
2
|
+
* Determines if a string is a Prismic Content API endpoint. Note that any valid URL is a valid
|
|
3
|
+
* endpoint to support network proxies.
|
|
4
4
|
*
|
|
5
5
|
* @param input - Input to test.
|
|
6
|
-
*
|
|
7
6
|
* @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
|
|
8
|
-
*
|
|
7
|
+
* otherwise.
|
|
9
8
|
*/
|
|
10
9
|
export const isRepositoryEndpoint = (input: string): boolean => {
|
|
11
10
|
try {
|
package/src/isRepositoryName.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Determines if an input is a valid Prismic repository name.
|
|
3
3
|
*
|
|
4
4
|
* @param input - Input to test.
|
|
5
|
-
*
|
|
6
5
|
* @returns `true` if `input` is a valid Prismic repository name, `false`
|
|
7
|
-
*
|
|
6
|
+
* otherwise.
|
|
8
7
|
*/
|
|
9
8
|
export const isRepositoryName = (input: string): boolean => {
|
|
10
9
|
return /^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/.test(input)
|
package/src/lib/devMsg.ts
CHANGED
|
@@ -4,15 +4,13 @@ import { version } from "../../package.json"
|
|
|
4
4
|
* Returns a `prismic.dev/msg` URL for a given message slug.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
+
* ;```ts
|
|
8
|
+
* devMsg("missing-param")
|
|
9
|
+
* // => "https://prismic.dev/msg/client/v1.2.3/missing-param.md"
|
|
10
|
+
* ```
|
|
7
11
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* // => "https://prismic.dev/msg/client/v1.2.3/missing-param.md"
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @param slug - Slug for the message. This corresponds to a Markdown file in
|
|
14
|
-
* the Git repository's `/messages` directory.
|
|
15
|
-
*
|
|
12
|
+
* @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
|
|
13
|
+
* `/messages` directory.
|
|
16
14
|
* @returns The `prismic.dev/msg` URL for the given slug.
|
|
17
15
|
*/
|
|
18
16
|
export const devMsg = (slug: string): string => {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { OptionalLinkProperties } from "../types/value/link"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Returns optional properties only available to link fields. Link fields can
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param input - The content relationship or link to media field from which the
|
|
9
|
-
* link properties will be extracted.
|
|
4
|
+
* Returns optional properties only available to link fields. Link fields can have the same shape as
|
|
5
|
+
* content relationship and link to media fields, requiring special treatment to extract
|
|
6
|
+
* link-specific properties.
|
|
10
7
|
*
|
|
8
|
+
* @param input - The content relationship or link to media field from which the link properties
|
|
9
|
+
* will be extracted.
|
|
11
10
|
* @returns Optional link properties that `input` might have.
|
|
12
11
|
*/
|
|
13
12
|
export const getOptionalLinkProperties = (
|
|
@@ -7,9 +7,7 @@ const readValue = (value: string): string => {
|
|
|
7
7
|
/**
|
|
8
8
|
* Returns the value of a cookie from a given cookie store.
|
|
9
9
|
*
|
|
10
|
-
* @param cookieJar - The stringified cookie store from which to read the
|
|
11
|
-
* cookie.
|
|
12
|
-
*
|
|
10
|
+
* @param cookieJar - The stringified cookie store from which to read the cookie.
|
|
13
11
|
* @returns The value of the cookie, if it exists.
|
|
14
12
|
*/
|
|
15
13
|
export const getPreviewCookie = (cookieJar: string): string | undefined => {
|
package/src/lib/isInternalURL.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Determines if a URL is internal or external.
|
|
3
3
|
*
|
|
4
4
|
* @param url - The URL to check if internal or external.
|
|
5
|
-
*
|
|
6
5
|
* @returns `true` if `url` is internal, `false` otherwise.
|
|
7
6
|
*/
|
|
8
7
|
// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a "/" or "#"`.
|
|
@@ -16,14 +16,13 @@ import type { OptionalLinkProperties } from "../types/value/link"
|
|
|
16
16
|
import { RichTextNodeType } from "../types/value/richText"
|
|
17
17
|
import type { SliceZone } from "../types/value/sliceZone"
|
|
18
18
|
import type { AnyRegularField } from "../types/value/types"
|
|
19
|
-
|
|
20
19
|
import * as is from "./isValue"
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Unknown value to check if it's a specific field type.
|
|
24
23
|
*
|
|
25
24
|
* @remarks
|
|
26
|
-
*
|
|
25
|
+
* Explicit types are added to help ensure narrowing is done effectively.
|
|
27
26
|
*/
|
|
28
27
|
type UnknownValue =
|
|
29
28
|
| PrismicDocument
|
|
@@ -34,14 +33,11 @@ type UnknownValue =
|
|
|
34
33
|
* Checks if a value is a migration content relationship field.
|
|
35
34
|
*
|
|
36
35
|
* @remarks
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
36
|
+
* `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a link
|
|
37
|
+
* field, not strictly a content relationship field.
|
|
40
38
|
* @param value - Value to check.
|
|
41
|
-
*
|
|
42
39
|
* @returns `true` if `value` is a migration content relationship field, `false`
|
|
43
|
-
*
|
|
44
|
-
*
|
|
40
|
+
* otherwise.
|
|
45
41
|
* @internal
|
|
46
42
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
47
43
|
*/
|
|
@@ -64,9 +60,7 @@ export const contentRelationship = (
|
|
|
64
60
|
* Checks if a value is a migration image field.
|
|
65
61
|
*
|
|
66
62
|
* @param value - Value to check.
|
|
67
|
-
*
|
|
68
63
|
* @returns `true` if `value` is a migration image field, `false` otherwise.
|
|
69
|
-
*
|
|
70
64
|
* @internal
|
|
71
65
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
72
66
|
*/
|
|
@@ -85,15 +79,12 @@ export const image = (value: UnknownValue): value is MigrationImage => {
|
|
|
85
79
|
/**
|
|
86
80
|
* Checks if a value is a migration link to media field.
|
|
87
81
|
*
|
|
88
|
-
* - @remarks `OptionalLinkProperties` is included because
|
|
89
|
-
*
|
|
90
|
-
* relationship field.
|
|
82
|
+
* - @remarks `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a
|
|
83
|
+
* link field, not strictly a content relationship field.
|
|
91
84
|
*
|
|
92
85
|
* @param value - Value to check.
|
|
93
|
-
*
|
|
94
86
|
* @returns `true` if `value` is a migration link to media field, `false`
|
|
95
|
-
*
|
|
96
|
-
*
|
|
87
|
+
* otherwise.
|
|
97
88
|
* @internal
|
|
98
89
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
99
90
|
*/
|
|
@@ -114,16 +105,12 @@ export const linkToMedia = (
|
|
|
114
105
|
* Checks if a value is a migration rich text image node.
|
|
115
106
|
*
|
|
116
107
|
* @param value - Value to check.
|
|
117
|
-
*
|
|
118
108
|
* @returns `true` if `value` is a migration rich text image node, `false`
|
|
119
|
-
*
|
|
120
|
-
*
|
|
109
|
+
* otherwise.
|
|
121
110
|
* @internal
|
|
122
111
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
123
112
|
*/
|
|
124
|
-
export const rtImageNode = (
|
|
125
|
-
value: UnknownValue,
|
|
126
|
-
): value is MigrationRTImageNode => {
|
|
113
|
+
export const rtImageNode = (value: UnknownValue): value is MigrationRTImageNode => {
|
|
127
114
|
return (
|
|
128
115
|
typeof value === "object" &&
|
|
129
116
|
value !== null &&
|