@prismicio/client 7.21.7 → 7.21.8
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 +39 -77
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +24 -63
- package/dist/WriteClient.d.cts.map +1 -1
- package/dist/WriteClient.d.ts +24 -63
- package/dist/WriteClient.d.ts.map +1 -1
- package/dist/WriteClient.js +39 -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 +36 -50
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +36 -50
- 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/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 +64 -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 +18 -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/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
|
@@ -3,22 +3,19 @@ const require_isFilled = require("./isFilled.cjs");
|
|
|
3
3
|
const require_isInternalURL = require("../lib/isInternalURL.cjs");
|
|
4
4
|
//#region src/helpers/asLinkAttrs.ts
|
|
5
5
|
/**
|
|
6
|
-
* Resolves any type of link field or Prismic page to a set of link attributes.
|
|
7
|
-
*
|
|
6
|
+
* Resolves any type of link field or Prismic page to a set of link attributes. The attributes are
|
|
7
|
+
* designed to be passed to link HTML elements, like `<a>`.
|
|
8
8
|
*
|
|
9
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
10
|
-
* `
|
|
9
|
+
* If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as
|
|
10
|
+
* `"noreferrer"`.
|
|
11
11
|
*
|
|
12
|
-
* @typeParam LinkResolverFunctionReturnType -
|
|
13
|
-
*
|
|
12
|
+
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
13
|
+
* type
|
|
14
14
|
* @typeParam Field - Link field or Prismic page to resolve to link attributes
|
|
15
|
-
*
|
|
16
15
|
* @param linkFieldOrDocument - Any kind of link field or a page to resolve
|
|
17
16
|
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* page is empty, and empty object
|
|
21
|
-
*
|
|
17
|
+
* @returns Resolved set of link attributes or, if the provided link field or page is empty, and
|
|
18
|
+
* empty object
|
|
22
19
|
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
23
20
|
*/
|
|
24
21
|
const asLinkAttrs = (linkFieldOrDocument, config = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLinkAttrs.cjs","names":["isFilledLink","asLink","isInternalURL"],"sources":["../../src/helpers/asLinkAttrs.ts"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL\"\
|
|
1
|
+
{"version":3,"file":"asLinkAttrs.cjs","names":["isFilledLink","asLink","isInternalURL"],"sources":["../../src/helpers/asLinkAttrs.ts"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { FilledLinkToWebField, LinkField } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport type { AsLinkReturnType, LinkResolverFunction } from \"./asLink\"\nimport { asLink } from \"./asLink\"\nimport { link as isFilledLink } from \"./isFilled\"\n\ntype AsLinkAttrsConfigRelArgs<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\thref: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined\n\tisExternal: boolean\n\ttarget?: string\n}\n\nexport type AsLinkAttrsConfig<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>\n\trel?: (\n\t\targs: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>,\n\t) => string | undefined | void\n}\n\n/** The return type of `asLinkAttrs()`. */\ntype AsLinkAttrsReturnType<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = Field extends\n\t| FilledLinkToWebField\n\t| FilledLinkToMediaField\n\t| FilledContentRelationshipField\n\t| PrismicDocument\n\t? {\n\t\t\thref: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined\n\t\t\ttarget?: string\n\t\t\trel?: string\n\t\t}\n\t: {\n\t\t\thref?: undefined\n\t\t\ttarget?: undefined\n\t\t\trel?: undefined\n\t\t}\n\n/**\n * Resolves any type of link field or Prismic page to a set of link attributes. The attributes are\n * designed to be passed to link HTML elements, like `<a>`.\n *\n * If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as\n * `\"noreferrer\"`.\n *\n * @typeParam LinkResolverFunctionReturnType - Link resolver function return\n * type\n * @typeParam Field - Link field or Prismic page to resolve to link attributes\n * @param linkFieldOrDocument - Any kind of link field or a page to resolve\n * @param config - Configuration that determines the output of `asLinkAttrs()`\n * @returns Resolved set of link attributes or, if the provided link field or page is empty, and\n * empty object\n * @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}\n */\nexport const asLinkAttrs = <\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n>(\n\tlinkFieldOrDocument: Field,\n\tconfig: AsLinkAttrsConfig<LinkResolverFunctionReturnType> = {},\n): AsLinkAttrsReturnType<LinkResolverFunctionReturnType> => {\n\tif (\n\t\tlinkFieldOrDocument &&\n\t\t(\"link_type\" in linkFieldOrDocument ? isFilledLink(linkFieldOrDocument) : linkFieldOrDocument)\n\t) {\n\t\tconst target = \"target\" in linkFieldOrDocument ? linkFieldOrDocument.target : undefined\n\n\t\tconst rawHref = asLink(linkFieldOrDocument, config.linkResolver)\n\t\tconst href = rawHref == null ? undefined : (rawHref as NonNullable<typeof rawHref>)\n\n\t\tconst isExternal = typeof href === \"string\" ? !isInternalURL(href) : false\n\n\t\tconst rel = config.rel\n\t\t\t? config.rel({ href, isExternal, target })\n\t\t\t: isExternal\n\t\t\t\t? \"noreferrer\"\n\t\t\t\t: undefined\n\n\t\treturn {\n\t\t\thref,\n\t\t\ttarget,\n\t\t\trel: rel == null ? undefined : rel,\n\t\t}\n\t}\n\n\treturn {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4EA,MAAa,eAQZ,qBACA,SAA4D,EAAE,KACH;AAC3D,KACC,wBACC,eAAe,sBAAsBA,iBAAAA,KAAa,oBAAoB,GAAG,sBACzE;EACD,MAAM,SAAS,YAAY,sBAAsB,oBAAoB,SAAS,KAAA;EAE9E,MAAM,UAAUC,eAAAA,OAAO,qBAAqB,OAAO,aAAa;EAChE,MAAM,OAAO,WAAW,OAAO,KAAA,IAAa;EAE5C,MAAM,aAAa,OAAO,SAAS,WAAW,CAACC,sBAAAA,cAAc,KAAK,GAAG;EAErE,MAAM,MAAM,OAAO,MAChB,OAAO,IAAI;GAAE;GAAM;GAAY;GAAQ,CAAC,GACxC,aACC,eACA,KAAA;AAEJ,SAAO;GACN;GACA;GACA,KAAK,OAAO,OAAO,KAAA,IAAY;GAC/B;;AAGF,QAAO,EAAE"}
|
|
@@ -14,9 +14,7 @@ type AsLinkAttrsConfig<LinkResolverFunctionReturnType = ReturnType<LinkResolverF
|
|
|
14
14
|
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>;
|
|
15
15
|
rel?: (args: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>) => string | undefined | void;
|
|
16
16
|
};
|
|
17
|
-
/**
|
|
18
|
-
* The return type of `asLinkAttrs()`.
|
|
19
|
-
*/
|
|
17
|
+
/** The return type of `asLinkAttrs()`. */
|
|
20
18
|
type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? {
|
|
21
19
|
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
22
20
|
target?: string;
|
|
@@ -27,22 +25,19 @@ type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResol
|
|
|
27
25
|
rel?: undefined;
|
|
28
26
|
};
|
|
29
27
|
/**
|
|
30
|
-
* Resolves any type of link field or Prismic page to a set of link attributes.
|
|
31
|
-
*
|
|
28
|
+
* Resolves any type of link field or Prismic page to a set of link attributes. The attributes are
|
|
29
|
+
* designed to be passed to link HTML elements, like `<a>`.
|
|
32
30
|
*
|
|
33
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
34
|
-
* `
|
|
31
|
+
* If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as
|
|
32
|
+
* `"noreferrer"`.
|
|
35
33
|
*
|
|
36
|
-
* @typeParam LinkResolverFunctionReturnType -
|
|
37
|
-
*
|
|
34
|
+
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
35
|
+
* type
|
|
38
36
|
* @typeParam Field - Link field or Prismic page to resolve to link attributes
|
|
39
|
-
*
|
|
40
37
|
* @param linkFieldOrDocument - Any kind of link field or a page to resolve
|
|
41
38
|
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* page is empty, and empty object
|
|
45
|
-
*
|
|
39
|
+
* @returns Resolved set of link attributes or, if the provided link field or page is empty, and
|
|
40
|
+
* empty object
|
|
46
41
|
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
47
42
|
*/
|
|
48
43
|
declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLinkAttrs.d.cts","names":[],"sources":["../../src/helpers/asLinkAttrs.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"asLinkAttrs.d.cts","names":[],"sources":["../../src/helpers/asLinkAttrs.ts"],"mappings":";;;;;;;KASK,wBAAA,kCAC6B,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA;EAIH,IAAA,EAAM,WAAA,CAAY,gBAAA,CAAiB,8BAAA,EAAgC,KAAA;EACnE,UAAA;EACA,MAAA;AAAA;AAAA,KAGW,iBAAA,kCACsB,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA;EAIH,YAAA,GAAe,oBAAA,CAAqB,8BAAA;EACpC,GAAA,IACC,IAAA,EAAM,wBAAA,CAAyB,8BAAA,EAAgC,KAAA;AAAA;;KAK5D,qBAAA,kCAC6B,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA,uBAGA,KAAA,SACD,oBAAA,GACA,sBAAA,GACA,8BAAA,GACA,eAAA;EAEA,IAAA,EAAM,WAAA,CAAY,gBAAA,CAAiB,8BAAA,EAAgC,KAAA;EACnE,MAAA;EACA,GAAA;AAAA;EAGA,IAAA;EACA,MAAA;EACA,GAAA;AAAA;;;;;;;;;;;;;;;;AAnCH;cAsDa,WAAA,oCACqB,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA,qBAIH,mBAAA,EAAqB,KAAA,EACrB,MAAA,GAAQ,iBAAA,CAAkB,8BAAA,MACxB,qBAAA,CAAsB,8BAAA"}
|
|
@@ -14,9 +14,7 @@ type AsLinkAttrsConfig<LinkResolverFunctionReturnType = ReturnType<LinkResolverF
|
|
|
14
14
|
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>;
|
|
15
15
|
rel?: (args: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>) => string | undefined | void;
|
|
16
16
|
};
|
|
17
|
-
/**
|
|
18
|
-
* The return type of `asLinkAttrs()`.
|
|
19
|
-
*/
|
|
17
|
+
/** The return type of `asLinkAttrs()`. */
|
|
20
18
|
type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? {
|
|
21
19
|
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
22
20
|
target?: string;
|
|
@@ -27,22 +25,19 @@ type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResol
|
|
|
27
25
|
rel?: undefined;
|
|
28
26
|
};
|
|
29
27
|
/**
|
|
30
|
-
* Resolves any type of link field or Prismic page to a set of link attributes.
|
|
31
|
-
*
|
|
28
|
+
* Resolves any type of link field or Prismic page to a set of link attributes. The attributes are
|
|
29
|
+
* designed to be passed to link HTML elements, like `<a>`.
|
|
32
30
|
*
|
|
33
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
34
|
-
* `
|
|
31
|
+
* If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as
|
|
32
|
+
* `"noreferrer"`.
|
|
35
33
|
*
|
|
36
|
-
* @typeParam LinkResolverFunctionReturnType -
|
|
37
|
-
*
|
|
34
|
+
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
35
|
+
* type
|
|
38
36
|
* @typeParam Field - Link field or Prismic page to resolve to link attributes
|
|
39
|
-
*
|
|
40
37
|
* @param linkFieldOrDocument - Any kind of link field or a page to resolve
|
|
41
38
|
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* page is empty, and empty object
|
|
45
|
-
*
|
|
39
|
+
* @returns Resolved set of link attributes or, if the provided link field or page is empty, and
|
|
40
|
+
* empty object
|
|
46
41
|
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
47
42
|
*/
|
|
48
43
|
declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLinkAttrs.d.ts","names":[],"sources":["../../src/helpers/asLinkAttrs.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"asLinkAttrs.d.ts","names":[],"sources":["../../src/helpers/asLinkAttrs.ts"],"mappings":";;;;;;;KASK,wBAAA,kCAC6B,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA;EAIH,IAAA,EAAM,WAAA,CAAY,gBAAA,CAAiB,8BAAA,EAAgC,KAAA;EACnE,UAAA;EACA,MAAA;AAAA;AAAA,KAGW,iBAAA,kCACsB,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA;EAIH,YAAA,GAAe,oBAAA,CAAqB,8BAAA;EACpC,GAAA,IACC,IAAA,EAAM,wBAAA,CAAyB,8BAAA,EAAgC,KAAA;AAAA;;KAK5D,qBAAA,kCAC6B,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA,uBAGA,KAAA,SACD,oBAAA,GACA,sBAAA,GACA,8BAAA,GACA,eAAA;EAEA,IAAA,EAAM,WAAA,CAAY,gBAAA,CAAiB,8BAAA,EAAgC,KAAA;EACnE,MAAA;EACA,GAAA;AAAA;EAGA,IAAA;EACA,MAAA;EACA,GAAA;AAAA;;;;;;;;;;;;;;;;AAnCH;cAsDa,WAAA,oCACqB,UAAA,CAAW,oBAAA,iBAC9B,SAAA,GAAY,eAAA,sBACvB,SAAA,GACA,eAAA,qBAIH,mBAAA,EAAqB,KAAA,EACrB,MAAA,GAAQ,iBAAA,CAAkB,8BAAA,MACxB,qBAAA,CAAsB,8BAAA"}
|
|
@@ -3,22 +3,19 @@ import { link } from "./isFilled.js";
|
|
|
3
3
|
import { isInternalURL } from "../lib/isInternalURL.js";
|
|
4
4
|
//#region src/helpers/asLinkAttrs.ts
|
|
5
5
|
/**
|
|
6
|
-
* Resolves any type of link field or Prismic page to a set of link attributes.
|
|
7
|
-
*
|
|
6
|
+
* Resolves any type of link field or Prismic page to a set of link attributes. The attributes are
|
|
7
|
+
* designed to be passed to link HTML elements, like `<a>`.
|
|
8
8
|
*
|
|
9
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
10
|
-
* `
|
|
9
|
+
* If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as
|
|
10
|
+
* `"noreferrer"`.
|
|
11
11
|
*
|
|
12
|
-
* @typeParam LinkResolverFunctionReturnType -
|
|
13
|
-
*
|
|
12
|
+
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
13
|
+
* type
|
|
14
14
|
* @typeParam Field - Link field or Prismic page to resolve to link attributes
|
|
15
|
-
*
|
|
16
15
|
* @param linkFieldOrDocument - Any kind of link field or a page to resolve
|
|
17
16
|
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* page is empty, and empty object
|
|
21
|
-
*
|
|
17
|
+
* @returns Resolved set of link attributes or, if the provided link field or page is empty, and
|
|
18
|
+
* empty object
|
|
22
19
|
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
23
20
|
*/
|
|
24
21
|
const asLinkAttrs = (linkFieldOrDocument, config = {}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asLinkAttrs.js","names":["isFilledLink"],"sources":["../../src/helpers/asLinkAttrs.ts"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL\"\
|
|
1
|
+
{"version":3,"file":"asLinkAttrs.js","names":["isFilledLink"],"sources":["../../src/helpers/asLinkAttrs.ts"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { FilledLinkToWebField, LinkField } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport type { AsLinkReturnType, LinkResolverFunction } from \"./asLink\"\nimport { asLink } from \"./asLink\"\nimport { link as isFilledLink } from \"./isFilled\"\n\ntype AsLinkAttrsConfigRelArgs<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\thref: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined\n\tisExternal: boolean\n\ttarget?: string\n}\n\nexport type AsLinkAttrsConfig<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>\n\trel?: (\n\t\targs: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>,\n\t) => string | undefined | void\n}\n\n/** The return type of `asLinkAttrs()`. */\ntype AsLinkAttrsReturnType<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = Field extends\n\t| FilledLinkToWebField\n\t| FilledLinkToMediaField\n\t| FilledContentRelationshipField\n\t| PrismicDocument\n\t? {\n\t\t\thref: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined\n\t\t\ttarget?: string\n\t\t\trel?: string\n\t\t}\n\t: {\n\t\t\thref?: undefined\n\t\t\ttarget?: undefined\n\t\t\trel?: undefined\n\t\t}\n\n/**\n * Resolves any type of link field or Prismic page to a set of link attributes. The attributes are\n * designed to be passed to link HTML elements, like `<a>`.\n *\n * If a resolved URL is external (i.e. starts with a protocol like `https://`), `rel` is returned as\n * `\"noreferrer\"`.\n *\n * @typeParam LinkResolverFunctionReturnType - Link resolver function return\n * type\n * @typeParam Field - Link field or Prismic page to resolve to link attributes\n * @param linkFieldOrDocument - Any kind of link field or a page to resolve\n * @param config - Configuration that determines the output of `asLinkAttrs()`\n * @returns Resolved set of link attributes or, if the provided link field or page is empty, and\n * empty object\n * @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}\n */\nexport const asLinkAttrs = <\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n>(\n\tlinkFieldOrDocument: Field,\n\tconfig: AsLinkAttrsConfig<LinkResolverFunctionReturnType> = {},\n): AsLinkAttrsReturnType<LinkResolverFunctionReturnType> => {\n\tif (\n\t\tlinkFieldOrDocument &&\n\t\t(\"link_type\" in linkFieldOrDocument ? isFilledLink(linkFieldOrDocument) : linkFieldOrDocument)\n\t) {\n\t\tconst target = \"target\" in linkFieldOrDocument ? linkFieldOrDocument.target : undefined\n\n\t\tconst rawHref = asLink(linkFieldOrDocument, config.linkResolver)\n\t\tconst href = rawHref == null ? undefined : (rawHref as NonNullable<typeof rawHref>)\n\n\t\tconst isExternal = typeof href === \"string\" ? !isInternalURL(href) : false\n\n\t\tconst rel = config.rel\n\t\t\t? config.rel({ href, isExternal, target })\n\t\t\t: isExternal\n\t\t\t\t? \"noreferrer\"\n\t\t\t\t: undefined\n\n\t\treturn {\n\t\t\thref,\n\t\t\ttarget,\n\t\t\trel: rel == null ? undefined : rel,\n\t\t}\n\t}\n\n\treturn {}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4EA,MAAa,eAQZ,qBACA,SAA4D,EAAE,KACH;AAC3D,KACC,wBACC,eAAe,sBAAsBA,KAAa,oBAAoB,GAAG,sBACzE;EACD,MAAM,SAAS,YAAY,sBAAsB,oBAAoB,SAAS,KAAA;EAE9E,MAAM,UAAU,OAAO,qBAAqB,OAAO,aAAa;EAChE,MAAM,OAAO,WAAW,OAAO,KAAA,IAAa;EAE5C,MAAM,aAAa,OAAO,SAAS,WAAW,CAAC,cAAc,KAAK,GAAG;EAErE,MAAM,MAAM,OAAO,MAChB,OAAO,IAAI;GAAE;GAAM;GAAY;GAAQ,CAAC,GACxC,aACC,eACA,KAAA;AAEJ,SAAO;GACN;GACA;GACA,KAAK,OAAO,OAAO,KAAA,IAAY;GAC/B;;AAGF,QAAO,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.cjs","names":["baseAsText"],"sources":["../../src/helpers/asText.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"asText.cjs","names":["baseAsText"],"sources":["../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"../richtext/asText\"\nimport type { RichTextField } from \"../types/value/richText\"\n\n/** Configuration that determines the output of `asText()`. */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string\n}\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/** @deprecated Use object-style configuration instead. */\ntype AsTextDeprecatedTupleConfig = [separator?: string]\n\n/** The return type of `asText()`. */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField\n\t? string\n\t: null\n\nexport const asText: {\n\t/**\n\t * Converts a rich text field to a plain text string.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst text = asText(document.data.content)\n\t * \t// => \"Hello world\"\n\t * \t```\n\t *\n\t * @param richTextField - A rich text field from Prismic.\n\t * @param config - Configuration that determines the output of `asText()`.\n\t * @returns Plain text equivalent of the rich text field, or `null` if the\n\t * field is empty.\n\t * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>\n\n\t/**\n\t * Converts a rich text field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t * @param richTextField - A rich text field from Prismic.\n\t * @param separator - Separator used to join each element. Defaults to a space.\n\t * @returns Plain text equivalent of the rich text field, or `null` if the\n\t * field is empty.\n\t * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple\n\t\tlet config: AsTextConfig\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator }\n\t\t}\n\n\t\treturn baseAsText(richTextField, config.separator) as AsTextReturnType<Field>\n\t} else {\n\t\treturn null as AsTextReturnType<Field>\n\t}\n}\n"],"mappings":";;AAsBA,MAAa,UAoCZ,eAEA,GAAG,wBAC0B;AAC7B,KAAI,eAAe;EAElB,MAAM,CAAC,2BAA2B;EAClC,IAAI;AACJ,MAAI,OAAO,4BAA4B,SACtC,UAAS,EACR,WAAW,yBACX;MAED,UAAS,EAAE,GAAG,yBAAyB;AAGxC,SAAOA,eAAAA,OAAW,eAAe,OAAO,UAAU;OAElD,QAAO"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { RichTextField } from "../types/value/richText.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/helpers/asText.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Configuration that determines the output of `asText()`.
|
|
6
|
-
*/
|
|
4
|
+
/** Configuration that determines the output of `asText()`. */
|
|
7
5
|
type AsTextConfig = {
|
|
8
6
|
/**
|
|
9
7
|
* Separator used to join each element.
|
|
@@ -12,31 +10,24 @@ type AsTextConfig = {
|
|
|
12
10
|
*/
|
|
13
11
|
separator?: string;
|
|
14
12
|
};
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use object-style configuration instead.
|
|
17
|
-
*/
|
|
13
|
+
/** @deprecated Use object-style configuration instead. */
|
|
18
14
|
type AsTextDeprecatedTupleConfig = [separator?: string];
|
|
19
|
-
/**
|
|
20
|
-
* The return type of `asText()`.
|
|
21
|
-
*/
|
|
15
|
+
/** The return type of `asText()`. */
|
|
22
16
|
type AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null;
|
|
23
17
|
declare const asText: {
|
|
24
18
|
/**
|
|
25
19
|
* Converts a rich text field to a plain text string.
|
|
26
20
|
*
|
|
27
21
|
* @example
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* ```
|
|
22
|
+
* ;```ts
|
|
23
|
+
* const text = asText(document.data.content)
|
|
24
|
+
* // => "Hello world"
|
|
25
|
+
* ```
|
|
33
26
|
*
|
|
34
27
|
* @param richTextField - A rich text field from Prismic.
|
|
35
28
|
* @param config - Configuration that determines the output of `asText()`.
|
|
36
|
-
*
|
|
37
29
|
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
30
|
+
* field is empty.
|
|
40
31
|
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
41
32
|
*/
|
|
42
33
|
<Field extends RichTextField | null | undefined>(richTextField: Field, config?: AsTextConfig): AsTextReturnType<Field>;
|
|
@@ -44,14 +35,10 @@ declare const asText: {
|
|
|
44
35
|
* Converts a rich text field to a plain text string.
|
|
45
36
|
*
|
|
46
37
|
* @deprecated Use object-style configuration instead.
|
|
47
|
-
*
|
|
48
38
|
* @param richTextField - A rich text field from Prismic.
|
|
49
|
-
* @param separator - Separator used to join each element. Defaults to a
|
|
50
|
-
* space.
|
|
51
|
-
*
|
|
39
|
+
* @param separator - Separator used to join each element. Defaults to a space.
|
|
52
40
|
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
53
|
-
*
|
|
54
|
-
*
|
|
41
|
+
* field is empty.
|
|
55
42
|
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
56
43
|
*/
|
|
57
44
|
<Field extends RichTextField | null | undefined>(richTextField: Field, ...config: AsTextDeprecatedTupleConfig): AsTextReturnType<Field>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.d.cts","names":[],"sources":["../../src/helpers/asText.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"asText.d.cts","names":[],"sources":["../../src/helpers/asText.ts"],"mappings":";;;;KAIK,YAAA;EAAA;;;;;EAMJ,SAAA;AAAA;;KAKI,2BAAA,IAA+B,SAAA;;KAG/B,gBAAA,eAA+B,aAAA,uBAAoC,KAAA,SAAc,aAAA;AAAA,cAIzE,MAAA;EAJQ;;;;;;;;;;;;AAIrB;;;EAJqB,eAoBL,aAAA,qBACd,aAAA,EAAe,KAAA,EACf,MAAA,GAAS,YAAA,GACP,gBAAA,CAAiB,KAAA;EAFJ;;;;;;;;;;EAAA,eAcD,aAAA,qBACd,aAAA,EAAe,KAAA,KACZ,MAAA,EAAQ,2BAAA,GACT,gBAAA,CAAiB,KAAA;AAAA"}
|
package/dist/helpers/asText.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { RichTextField } from "../types/value/richText.js";
|
|
2
2
|
|
|
3
3
|
//#region src/helpers/asText.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Configuration that determines the output of `asText()`.
|
|
6
|
-
*/
|
|
4
|
+
/** Configuration that determines the output of `asText()`. */
|
|
7
5
|
type AsTextConfig = {
|
|
8
6
|
/**
|
|
9
7
|
* Separator used to join each element.
|
|
@@ -12,31 +10,24 @@ type AsTextConfig = {
|
|
|
12
10
|
*/
|
|
13
11
|
separator?: string;
|
|
14
12
|
};
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use object-style configuration instead.
|
|
17
|
-
*/
|
|
13
|
+
/** @deprecated Use object-style configuration instead. */
|
|
18
14
|
type AsTextDeprecatedTupleConfig = [separator?: string];
|
|
19
|
-
/**
|
|
20
|
-
* The return type of `asText()`.
|
|
21
|
-
*/
|
|
15
|
+
/** The return type of `asText()`. */
|
|
22
16
|
type AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null;
|
|
23
17
|
declare const asText: {
|
|
24
18
|
/**
|
|
25
19
|
* Converts a rich text field to a plain text string.
|
|
26
20
|
*
|
|
27
21
|
* @example
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* ```
|
|
22
|
+
* ;```ts
|
|
23
|
+
* const text = asText(document.data.content)
|
|
24
|
+
* // => "Hello world"
|
|
25
|
+
* ```
|
|
33
26
|
*
|
|
34
27
|
* @param richTextField - A rich text field from Prismic.
|
|
35
28
|
* @param config - Configuration that determines the output of `asText()`.
|
|
36
|
-
*
|
|
37
29
|
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
30
|
+
* field is empty.
|
|
40
31
|
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
41
32
|
*/
|
|
42
33
|
<Field extends RichTextField | null | undefined>(richTextField: Field, config?: AsTextConfig): AsTextReturnType<Field>;
|
|
@@ -44,14 +35,10 @@ declare const asText: {
|
|
|
44
35
|
* Converts a rich text field to a plain text string.
|
|
45
36
|
*
|
|
46
37
|
* @deprecated Use object-style configuration instead.
|
|
47
|
-
*
|
|
48
38
|
* @param richTextField - A rich text field from Prismic.
|
|
49
|
-
* @param separator - Separator used to join each element. Defaults to a
|
|
50
|
-
* space.
|
|
51
|
-
*
|
|
39
|
+
* @param separator - Separator used to join each element. Defaults to a space.
|
|
52
40
|
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
53
|
-
*
|
|
54
|
-
*
|
|
41
|
+
* field is empty.
|
|
55
42
|
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
56
43
|
*/
|
|
57
44
|
<Field extends RichTextField | null | undefined>(richTextField: Field, ...config: AsTextDeprecatedTupleConfig): AsTextReturnType<Field>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.d.ts","names":[],"sources":["../../src/helpers/asText.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"asText.d.ts","names":[],"sources":["../../src/helpers/asText.ts"],"mappings":";;;;KAIK,YAAA;EAAA;;;;;EAMJ,SAAA;AAAA;;KAKI,2BAAA,IAA+B,SAAA;;KAG/B,gBAAA,eAA+B,aAAA,uBAAoC,KAAA,SAAc,aAAA;AAAA,cAIzE,MAAA;EAJQ;;;;;;;;;;;;AAIrB;;;EAJqB,eAoBL,aAAA,qBACd,aAAA,EAAe,KAAA,EACf,MAAA,GAAS,YAAA,GACP,gBAAA,CAAiB,KAAA;EAFJ;;;;;;;;;;EAAA,eAcD,aAAA,qBACd,aAAA,EAAe,KAAA,KACZ,MAAA,EAAQ,2BAAA,GACT,gBAAA,CAAiB,KAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asText.js","names":["baseAsText"],"sources":["../../src/helpers/asText.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"asText.js","names":["baseAsText"],"sources":["../../src/helpers/asText.ts"],"sourcesContent":["import { asText as baseAsText } from \"../richtext/asText\"\nimport type { RichTextField } from \"../types/value/richText\"\n\n/** Configuration that determines the output of `asText()`. */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string\n}\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/** @deprecated Use object-style configuration instead. */\ntype AsTextDeprecatedTupleConfig = [separator?: string]\n\n/** The return type of `asText()`. */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField\n\t? string\n\t: null\n\nexport const asText: {\n\t/**\n\t * Converts a rich text field to a plain text string.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst text = asText(document.data.content)\n\t * \t// => \"Hello world\"\n\t * \t```\n\t *\n\t * @param richTextField - A rich text field from Prismic.\n\t * @param config - Configuration that determines the output of `asText()`.\n\t * @returns Plain text equivalent of the rich text field, or `null` if the\n\t * field is empty.\n\t * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>\n\n\t/**\n\t * Converts a rich text field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t * @param richTextField - A rich text field from Prismic.\n\t * @param separator - Separator used to join each element. Defaults to a space.\n\t * @returns Plain text equivalent of the rich text field, or `null` if the\n\t * field is empty.\n\t * @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple\n\t\tlet config: AsTextConfig\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator }\n\t\t}\n\n\t\treturn baseAsText(richTextField, config.separator) as AsTextReturnType<Field>\n\t} else {\n\t\treturn null as AsTextReturnType<Field>\n\t}\n}\n"],"mappings":";;AAsBA,MAAa,UAoCZ,eAEA,GAAG,wBAC0B;AAC7B,KAAI,eAAe;EAElB,MAAM,CAAC,2BAA2B;EAClC,IAAI;AACJ,MAAI,OAAO,4BAA4B,SACtC,UAAS,EACR,WAAW,yBACX;MAED,UAAS,EAAE,GAAG,yBAAyB;AAGxC,SAAOA,SAAW,eAAe,OAAO,UAAU;OAElD,QAAO"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
const require_link = require("../types/value/link.cjs");
|
|
2
2
|
//#region src/helpers/documentToLinkField.ts
|
|
3
3
|
/**
|
|
4
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
5
|
-
* for document links
|
|
4
|
+
* Converts a document into a link field, this is useful when crawling the API for document links
|
|
6
5
|
*
|
|
7
6
|
* @typeParam TDocument - Specific interface of the provided document
|
|
8
|
-
*
|
|
9
7
|
* @param prismicDocument - A document coming from Prismic
|
|
10
|
-
*
|
|
11
8
|
* @returns The equivalent link field to use with `asLink()`
|
|
12
|
-
*
|
|
13
9
|
* @internal
|
|
14
10
|
*/
|
|
15
11
|
const documentToLinkField = (prismicDocument) => {
|
|
16
|
-
var _prismicDocument$slug;
|
|
17
12
|
return {
|
|
18
13
|
link_type: require_link.LinkType.Document,
|
|
19
14
|
id: prismicDocument.id,
|
|
@@ -22,7 +17,7 @@ const documentToLinkField = (prismicDocument) => {
|
|
|
22
17
|
tags: prismicDocument.tags,
|
|
23
18
|
lang: prismicDocument.lang,
|
|
24
19
|
url: prismicDocument.url == null ? void 0 : prismicDocument.url,
|
|
25
|
-
slug:
|
|
20
|
+
slug: prismicDocument.slugs?.[0],
|
|
26
21
|
...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
|
|
27
22
|
};
|
|
28
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.cjs","names":["LinkType"],"sources":["../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys>
|
|
1
|
+
{"version":3,"file":"documentToLinkField.cjs","names":["LinkType"],"sources":["../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>\n\n/**\n * Converts a document into a link field, this is useful when crawling the API for document links\n *\n * @typeParam TDocument - Specific interface of the provided document\n * @param prismicDocument - A document coming from Prismic\n * @returns The equivalent link field to use with `asLink()`\n * @internal\n */\nexport const documentToLinkField = <TDocument extends SetOptional<PrismicDocument, \"slugs\">>(\n\tprismicDocument: TDocument,\n): FilledContentRelationshipField<TDocument[\"type\"], TDocument[\"lang\"], TDocument[\"data\"]> => {\n\treturn {\n\t\tlink_type: LinkType.Document,\n\t\tid: prismicDocument.id,\n\t\tuid: prismicDocument.uid || undefined,\n\t\ttype: prismicDocument.type,\n\t\ttags: prismicDocument.tags,\n\t\tlang: prismicDocument.lang,\n\t\turl: prismicDocument.url == null ? undefined : prismicDocument.url,\n\t\tslug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL\n\t\t// The REST API does not include a `data` property if the data\n\t\t// object is empty.\n\t\t//\n\t\t// A presence check for `prismicDocument.data` is done to\n\t\t// support partial documents. While `documentToLinkField` is\n\t\t// not typed to accept partial documents, passing a partial\n\t\t// document can happen in untyped projects.\n\t\t...(prismicDocument.data && Object.keys(prismicDocument.data).length > 0\n\t\t\t? { data: prismicDocument.data }\n\t\t\t: {}),\n\t}\n}\n"],"mappings":";;;;;;;;;;AAcA,MAAa,uBACZ,oBAC6F;AAC7F,QAAO;EACN,WAAWA,aAAAA,SAAS;EACpB,IAAI,gBAAgB;EACpB,KAAK,gBAAgB,OAAO,KAAA;EAC5B,MAAM,gBAAgB;EACtB,MAAM,gBAAgB;EACtB,MAAM,gBAAgB;EACtB,KAAK,gBAAgB,OAAO,OAAO,KAAA,IAAY,gBAAgB;EAC/D,MAAM,gBAAgB,QAAQ;EAQ9B,GAAI,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,KAAK,CAAC,SAAS,IACpE,EAAE,MAAM,gBAAgB,MAAM,GAC9B,EAAE;EACL"}
|
|
@@ -4,15 +4,11 @@ import { PrismicDocument } from "../types/value/document.cjs";
|
|
|
4
4
|
//#region src/helpers/documentToLinkField.d.ts
|
|
5
5
|
type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
|
|
6
6
|
/**
|
|
7
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
8
|
-
* for document links
|
|
7
|
+
* Converts a document into a link field, this is useful when crawling the API for document links
|
|
9
8
|
*
|
|
10
9
|
* @typeParam TDocument - Specific interface of the provided document
|
|
11
|
-
*
|
|
12
10
|
* @param prismicDocument - A document coming from Prismic
|
|
13
|
-
*
|
|
14
11
|
* @returns The equivalent link field to use with `asLink()`
|
|
15
|
-
*
|
|
16
12
|
* @internal
|
|
17
13
|
*/
|
|
18
14
|
declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.d.cts","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"mappings":";;;;KAIK,WAAA,uBAAkC,CAAA,IAAK,IAAA,CAAK,CAAA,EAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"documentToLinkField.d.cts","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"mappings":";;;;KAIK,WAAA,uBAAkC,CAAA,IAAK,IAAA,CAAK,CAAA,EAAG,IAAA,IAAQ,OAAA,CAAQ,IAAA,CAAK,CAAA,EAAG,IAAA;;AAHd;;;;;;;cAajD,mBAAA,qBAAyC,WAAA,CAAY,eAAA,YACjE,eAAA,EAAiB,SAAA,KACf,8BAAA,CAA+B,SAAA,UAAmB,SAAA,UAAmB,SAAA"}
|
|
@@ -4,15 +4,11 @@ import { PrismicDocument } from "../types/value/document.js";
|
|
|
4
4
|
//#region src/helpers/documentToLinkField.d.ts
|
|
5
5
|
type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
|
|
6
6
|
/**
|
|
7
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
8
|
-
* for document links
|
|
7
|
+
* Converts a document into a link field, this is useful when crawling the API for document links
|
|
9
8
|
*
|
|
10
9
|
* @typeParam TDocument - Specific interface of the provided document
|
|
11
|
-
*
|
|
12
10
|
* @param prismicDocument - A document coming from Prismic
|
|
13
|
-
*
|
|
14
11
|
* @returns The equivalent link field to use with `asLink()`
|
|
15
|
-
*
|
|
16
12
|
* @internal
|
|
17
13
|
*/
|
|
18
14
|
declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.d.ts","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"mappings":";;;;KAIK,WAAA,uBAAkC,CAAA,IAAK,IAAA,CAAK,CAAA,EAAG,IAAA,
|
|
1
|
+
{"version":3,"file":"documentToLinkField.d.ts","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"mappings":";;;;KAIK,WAAA,uBAAkC,CAAA,IAAK,IAAA,CAAK,CAAA,EAAG,IAAA,IAAQ,OAAA,CAAQ,IAAA,CAAK,CAAA,EAAG,IAAA;;AAHd;;;;;;;cAajD,mBAAA,qBAAyC,WAAA,CAAY,eAAA,YACjE,eAAA,EAAiB,SAAA,KACf,8BAAA,CAA+B,SAAA,UAAmB,SAAA,UAAmB,SAAA"}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { LinkType } from "../types/value/link.js";
|
|
2
2
|
//#region src/helpers/documentToLinkField.ts
|
|
3
3
|
/**
|
|
4
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
5
|
-
* for document links
|
|
4
|
+
* Converts a document into a link field, this is useful when crawling the API for document links
|
|
6
5
|
*
|
|
7
6
|
* @typeParam TDocument - Specific interface of the provided document
|
|
8
|
-
*
|
|
9
7
|
* @param prismicDocument - A document coming from Prismic
|
|
10
|
-
*
|
|
11
8
|
* @returns The equivalent link field to use with `asLink()`
|
|
12
|
-
*
|
|
13
9
|
* @internal
|
|
14
10
|
*/
|
|
15
11
|
const documentToLinkField = (prismicDocument) => {
|
|
16
|
-
var _prismicDocument$slug;
|
|
17
12
|
return {
|
|
18
13
|
link_type: LinkType.Document,
|
|
19
14
|
id: prismicDocument.id,
|
|
@@ -22,7 +17,7 @@ const documentToLinkField = (prismicDocument) => {
|
|
|
22
17
|
tags: prismicDocument.tags,
|
|
23
18
|
lang: prismicDocument.lang,
|
|
24
19
|
url: prismicDocument.url == null ? void 0 : prismicDocument.url,
|
|
25
|
-
slug:
|
|
20
|
+
slug: prismicDocument.slugs?.[0],
|
|
26
21
|
...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
|
|
27
22
|
};
|
|
28
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.js","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys>
|
|
1
|
+
{"version":3,"file":"documentToLinkField.js","names":[],"sources":["../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>\n\n/**\n * Converts a document into a link field, this is useful when crawling the API for document links\n *\n * @typeParam TDocument - Specific interface of the provided document\n * @param prismicDocument - A document coming from Prismic\n * @returns The equivalent link field to use with `asLink()`\n * @internal\n */\nexport const documentToLinkField = <TDocument extends SetOptional<PrismicDocument, \"slugs\">>(\n\tprismicDocument: TDocument,\n): FilledContentRelationshipField<TDocument[\"type\"], TDocument[\"lang\"], TDocument[\"data\"]> => {\n\treturn {\n\t\tlink_type: LinkType.Document,\n\t\tid: prismicDocument.id,\n\t\tuid: prismicDocument.uid || undefined,\n\t\ttype: prismicDocument.type,\n\t\ttags: prismicDocument.tags,\n\t\tlang: prismicDocument.lang,\n\t\turl: prismicDocument.url == null ? undefined : prismicDocument.url,\n\t\tslug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL\n\t\t// The REST API does not include a `data` property if the data\n\t\t// object is empty.\n\t\t//\n\t\t// A presence check for `prismicDocument.data` is done to\n\t\t// support partial documents. While `documentToLinkField` is\n\t\t// not typed to accept partial documents, passing a partial\n\t\t// document can happen in untyped projects.\n\t\t...(prismicDocument.data && Object.keys(prismicDocument.data).length > 0\n\t\t\t? { data: prismicDocument.data }\n\t\t\t: {}),\n\t}\n}\n"],"mappings":";;;;;;;;;;AAcA,MAAa,uBACZ,oBAC6F;AAC7F,QAAO;EACN,WAAW,SAAS;EACpB,IAAI,gBAAgB;EACpB,KAAK,gBAAgB,OAAO,KAAA;EAC5B,MAAM,gBAAgB;EACtB,MAAM,gBAAgB;EACtB,MAAM,gBAAgB;EACtB,KAAK,gBAAgB,OAAO,OAAO,KAAA,IAAY,gBAAgB;EAC/D,MAAM,gBAAgB,QAAQ;EAQ9B,GAAI,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,KAAK,CAAC,SAAS,IACpE,EAAE,MAAM,gBAAgB,MAAM,GAC9B,EAAE;EACL"}
|