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