@prismicio/client 7.21.0-alpha.1 → 7.21.0-alpha.2
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/index.cjs +3880 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4424 -0
- package/dist/index.d.mts +4424 -0
- package/dist/index.d.ts +4349 -128
- package/dist/index.mjs +3837 -0
- package/dist/index.mjs.map +1 -0
- package/dist/richtext/index.cjs +244 -0
- package/dist/richtext/index.cjs.map +1 -0
- package/dist/richtext/index.d.cts +78 -0
- package/dist/richtext/index.d.mts +78 -0
- package/dist/richtext/index.d.ts +78 -7
- package/dist/richtext/index.mjs +237 -0
- package/dist/richtext/index.mjs.map +1 -0
- package/dist/shared/client.TSGr56lO.d.cts +899 -0
- package/dist/shared/client.TSGr56lO.d.mts +899 -0
- package/dist/shared/client.TSGr56lO.d.ts +899 -0
- package/package.json +19 -42
- package/src/buildQueryURL.ts +29 -21
- package/src/createClient.ts +11 -8
- package/src/getRepositoryEndpoint.ts +9 -2
- package/src/helpers/asDate.ts +11 -4
- package/src/helpers/asHTML.ts +34 -26
- package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
- package/src/helpers/asImageSrc.ts +11 -10
- package/src/helpers/asImageWidthSrcSet.ts +18 -17
- package/src/helpers/asLink.ts +33 -32
- package/src/helpers/asLinkAttrs.ts +6 -9
- package/src/helpers/asText.ts +20 -10
- package/src/helpers/isFilled.ts +15 -14
- package/src/helpers/mapSliceZone.ts +10 -10
- package/src/index.ts +2 -2
- package/src/isRepositoryEndpoint.ts +2 -2
- package/src/richtext/asText.ts +5 -5
- package/src/richtext/serialize.ts +8 -8
- package/src/richtext/types.ts +6 -6
- package/src/types/migration/Asset.ts +10 -2
- package/src/types/model/types.ts +0 -2
- package/dist/Client.cjs +0 -1274
- package/dist/Client.cjs.map +0 -1
- package/dist/Client.d.ts +0 -981
- package/dist/Client.js +0 -1274
- package/dist/Client.js.map +0 -1
- package/dist/Migration.cjs +0 -315
- package/dist/Migration.cjs.map +0 -1
- package/dist/Migration.d.ts +0 -213
- package/dist/Migration.js +0 -315
- package/dist/Migration.js.map +0 -1
- package/dist/WriteClient.cjs +0 -560
- package/dist/WriteClient.cjs.map +0 -1
- package/dist/WriteClient.d.ts +0 -281
- package/dist/WriteClient.js +0 -560
- package/dist/WriteClient.js.map +0 -1
- package/dist/buildQueryURL.cjs +0 -66
- package/dist/buildQueryURL.cjs.map +0 -1
- package/dist/buildQueryURL.d.ts +0 -209
- package/dist/buildQueryURL.js +0 -66
- package/dist/buildQueryURL.js.map +0 -1
- package/dist/cookie.cjs +0 -5
- package/dist/cookie.cjs.map +0 -1
- package/dist/cookie.d.ts +0 -5
- package/dist/cookie.js +0 -5
- package/dist/cookie.js.map +0 -1
- package/dist/createClient.cjs +0 -6
- package/dist/createClient.cjs.map +0 -1
- package/dist/createClient.d.ts +0 -32
- package/dist/createClient.js +0 -6
- package/dist/createClient.js.map +0 -1
- package/dist/createMigration.cjs +0 -6
- package/dist/createMigration.cjs.map +0 -1
- package/dist/createMigration.d.ts +0 -24
- package/dist/createMigration.js +0 -6
- package/dist/createMigration.js.map +0 -1
- package/dist/createWriteClient.cjs +0 -6
- package/dist/createWriteClient.cjs.map +0 -1
- package/dist/createWriteClient.d.ts +0 -32
- package/dist/createWriteClient.js +0 -6
- package/dist/createWriteClient.js.map +0 -1
- package/dist/errors/ForbiddenError.cjs +0 -7
- package/dist/errors/ForbiddenError.cjs.map +0 -1
- package/dist/errors/ForbiddenError.d.ts +0 -11
- package/dist/errors/ForbiddenError.js +0 -7
- package/dist/errors/ForbiddenError.js.map +0 -1
- package/dist/errors/InvalidDataError.cjs +0 -7
- package/dist/errors/InvalidDataError.cjs.map +0 -1
- package/dist/errors/InvalidDataError.d.ts +0 -3
- package/dist/errors/InvalidDataError.js +0 -7
- package/dist/errors/InvalidDataError.js.map +0 -1
- package/dist/errors/NotFoundError.cjs +0 -7
- package/dist/errors/NotFoundError.cjs.map +0 -1
- package/dist/errors/NotFoundError.d.ts +0 -3
- package/dist/errors/NotFoundError.js +0 -7
- package/dist/errors/NotFoundError.js.map +0 -1
- package/dist/errors/ParsingError.cjs +0 -7
- package/dist/errors/ParsingError.cjs.map +0 -1
- package/dist/errors/ParsingError.d.ts +0 -14
- package/dist/errors/ParsingError.js +0 -7
- package/dist/errors/ParsingError.js.map +0 -1
- package/dist/errors/PreviewTokenExpired.cjs +0 -7
- package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
- package/dist/errors/PreviewTokenExpired.d.ts +0 -8
- package/dist/errors/PreviewTokenExpired.js +0 -7
- package/dist/errors/PreviewTokenExpired.js.map +0 -1
- package/dist/errors/PrismicError.cjs +0 -16
- package/dist/errors/PrismicError.cjs.map +0 -1
- package/dist/errors/PrismicError.d.ts +0 -5
- package/dist/errors/PrismicError.js +0 -16
- package/dist/errors/PrismicError.js.map +0 -1
- package/dist/errors/RefExpiredError.cjs +0 -7
- package/dist/errors/RefExpiredError.cjs.map +0 -1
- package/dist/errors/RefExpiredError.d.ts +0 -8
- package/dist/errors/RefExpiredError.js +0 -7
- package/dist/errors/RefExpiredError.js.map +0 -1
- package/dist/errors/RefNotFoundError.cjs +0 -7
- package/dist/errors/RefNotFoundError.cjs.map +0 -1
- package/dist/errors/RefNotFoundError.d.ts +0 -8
- package/dist/errors/RefNotFoundError.js +0 -7
- package/dist/errors/RefNotFoundError.js.map +0 -1
- package/dist/errors/RepositoryNotFoundError.cjs +0 -7
- package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
- package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
- package/dist/errors/RepositoryNotFoundError.js +0 -7
- package/dist/errors/RepositoryNotFoundError.js.map +0 -1
- package/dist/filter.cjs +0 -247
- package/dist/filter.cjs.map +0 -1
- package/dist/filter.d.ts +0 -209
- package/dist/filter.js +0 -247
- package/dist/filter.js.map +0 -1
- package/dist/getGraphQLEndpoint.cjs +0 -13
- package/dist/getGraphQLEndpoint.cjs.map +0 -1
- package/dist/getGraphQLEndpoint.d.ts +0 -10
- package/dist/getGraphQLEndpoint.js +0 -13
- package/dist/getGraphQLEndpoint.js.map +0 -1
- package/dist/getRepositoryEndpoint.cjs +0 -13
- package/dist/getRepositoryEndpoint.cjs.map +0 -1
- package/dist/getRepositoryEndpoint.d.ts +0 -12
- package/dist/getRepositoryEndpoint.js +0 -13
- package/dist/getRepositoryEndpoint.js.map +0 -1
- package/dist/getRepositoryName.cjs +0 -17
- package/dist/getRepositoryName.cjs.map +0 -1
- package/dist/getRepositoryName.d.ts +0 -12
- package/dist/getRepositoryName.js +0 -17
- package/dist/getRepositoryName.js.map +0 -1
- package/dist/getToolbarSrc.cjs +0 -13
- package/dist/getToolbarSrc.cjs.map +0 -1
- package/dist/getToolbarSrc.d.ts +0 -34
- package/dist/getToolbarSrc.js +0 -13
- package/dist/getToolbarSrc.js.map +0 -1
- package/dist/helpers/asDate.cjs +0 -14
- package/dist/helpers/asDate.cjs.map +0 -1
- package/dist/helpers/asDate.d.ts +0 -17
- package/dist/helpers/asDate.js +0 -14
- package/dist/helpers/asDate.js.map +0 -1
- package/dist/helpers/asHTML.cjs +0 -86
- package/dist/helpers/asHTML.cjs.map +0 -1
- package/dist/helpers/asHTML.d.ts +0 -141
- package/dist/helpers/asHTML.js +0 -86
- package/dist/helpers/asHTML.js.map +0 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +0 -21
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +0 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +0 -53
- package/dist/helpers/asImagePixelDensitySrcSet.js +0 -21
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +0 -1
- package/dist/helpers/asImageSrc.cjs +0 -13
- package/dist/helpers/asImageSrc.cjs.map +0 -1
- package/dist/helpers/asImageSrc.d.ts +0 -28
- package/dist/helpers/asImageSrc.js +0 -13
- package/dist/helpers/asImageSrc.js.map +0 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +0 -45
- package/dist/helpers/asImageWidthSrcSet.cjs.map +0 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +0 -61
- package/dist/helpers/asImageWidthSrcSet.js +0 -45
- package/dist/helpers/asImageWidthSrcSet.js.map +0 -1
- package/dist/helpers/asLink.cjs +0 -47
- package/dist/helpers/asLink.cjs.map +0 -1
- package/dist/helpers/asLink.d.ts +0 -77
- package/dist/helpers/asLink.js +0 -47
- package/dist/helpers/asLink.js.map +0 -1
- package/dist/helpers/asLinkAttrs.cjs +0 -28
- package/dist/helpers/asLinkAttrs.cjs.map +0 -1
- package/dist/helpers/asLinkAttrs.d.ts +0 -50
- package/dist/helpers/asLinkAttrs.js +0 -28
- package/dist/helpers/asLinkAttrs.js.map +0 -1
- package/dist/helpers/asText.cjs +0 -21
- package/dist/helpers/asText.cjs.map +0 -1
- package/dist/helpers/asText.d.ts +0 -47
- package/dist/helpers/asText.js +0 -21
- package/dist/helpers/asText.js.map +0 -1
- package/dist/helpers/documentToLinkField.cjs +0 -27
- package/dist/helpers/documentToLinkField.cjs.map +0 -1
- package/dist/helpers/documentToLinkField.d.ts +0 -17
- package/dist/helpers/documentToLinkField.js +0 -27
- package/dist/helpers/documentToLinkField.js.map +0 -1
- package/dist/helpers/isFilled.cjs +0 -77
- package/dist/helpers/isFilled.cjs.map +0 -1
- package/dist/helpers/isFilled.d.ts +0 -190
- package/dist/helpers/isFilled.js +0 -77
- package/dist/helpers/isFilled.js.map +0 -1
- package/dist/helpers/mapSliceZone.cjs +0 -42
- package/dist/helpers/mapSliceZone.cjs.map +0 -1
- package/dist/helpers/mapSliceZone.d.ts +0 -136
- package/dist/helpers/mapSliceZone.js +0 -42
- package/dist/helpers/mapSliceZone.js.map +0 -1
- package/dist/index.js +0 -97
- package/dist/index.js.map +0 -1
- package/dist/isRepositoryEndpoint.cjs +0 -12
- package/dist/isRepositoryEndpoint.cjs.map +0 -1
- package/dist/isRepositoryEndpoint.d.ts +0 -10
- package/dist/isRepositoryEndpoint.js +0 -12
- package/dist/isRepositoryEndpoint.js.map +0 -1
- package/dist/isRepositoryName.cjs +0 -7
- package/dist/isRepositoryName.cjs.map +0 -1
- package/dist/isRepositoryName.d.ts +0 -9
- package/dist/isRepositoryName.js +0 -7
- package/dist/isRepositoryName.js.map +0 -1
- package/dist/lib/appendFilters.cjs +0 -11
- package/dist/lib/appendFilters.cjs.map +0 -1
- package/dist/lib/appendFilters.d.ts +0 -18
- package/dist/lib/appendFilters.js +0 -11
- package/dist/lib/appendFilters.js.map +0 -1
- package/dist/lib/castArray.cjs +0 -7
- package/dist/lib/castArray.cjs.map +0 -1
- package/dist/lib/castArray.d.ts +0 -12
- package/dist/lib/castArray.js +0 -7
- package/dist/lib/castArray.js.map +0 -1
- package/dist/lib/castThunk.cjs +0 -7
- package/dist/lib/castThunk.cjs.map +0 -1
- package/dist/lib/castThunk.d.ts +0 -11
- package/dist/lib/castThunk.js +0 -7
- package/dist/lib/castThunk.js.map +0 -1
- package/dist/lib/devMsg.cjs +0 -8
- package/dist/lib/devMsg.cjs.map +0 -1
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/devMsg.js +0 -8
- package/dist/lib/devMsg.js.map +0 -1
- package/dist/lib/escapeHTML.cjs +0 -43
- package/dist/lib/escapeHTML.cjs.map +0 -1
- package/dist/lib/escapeHTML.d.ts +0 -1
- package/dist/lib/escapeHTML.js +0 -43
- package/dist/lib/escapeHTML.js.map +0 -1
- package/dist/lib/everyTagFilter.cjs +0 -9
- package/dist/lib/everyTagFilter.cjs.map +0 -1
- package/dist/lib/everyTagFilter.d.ts +0 -9
- package/dist/lib/everyTagFilter.js +0 -9
- package/dist/lib/everyTagFilter.js.map +0 -1
- package/dist/lib/findMasterRef.cjs +0 -8
- package/dist/lib/findMasterRef.cjs.map +0 -1
- package/dist/lib/findMasterRef.d.ts +0 -11
- package/dist/lib/findMasterRef.js +0 -8
- package/dist/lib/findMasterRef.js.map +0 -1
- package/dist/lib/findRef.cjs +0 -12
- package/dist/lib/findRef.cjs.map +0 -1
- package/dist/lib/findRef.d.ts +0 -14
- package/dist/lib/findRef.js +0 -12
- package/dist/lib/findRef.js.map +0 -1
- package/dist/lib/findRefByID.cjs +0 -8
- package/dist/lib/findRefByID.cjs.map +0 -1
- package/dist/lib/findRefByID.d.ts +0 -12
- package/dist/lib/findRefByID.js +0 -8
- package/dist/lib/findRefByID.js.map +0 -1
- package/dist/lib/findRefByLabel.cjs +0 -8
- package/dist/lib/findRefByLabel.cjs.map +0 -1
- package/dist/lib/findRefByLabel.d.ts +0 -12
- package/dist/lib/findRefByLabel.js +0 -8
- package/dist/lib/findRefByLabel.js.map +0 -1
- package/dist/lib/getOptionalLinkProperties.cjs +0 -14
- package/dist/lib/getOptionalLinkProperties.cjs.map +0 -1
- package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
- package/dist/lib/getOptionalLinkProperties.js +0 -14
- package/dist/lib/getOptionalLinkProperties.js.map +0 -1
- package/dist/lib/getPreviewCookie.cjs +0 -21
- package/dist/lib/getPreviewCookie.cjs.map +0 -1
- package/dist/lib/getPreviewCookie.d.ts +0 -9
- package/dist/lib/getPreviewCookie.js +0 -21
- package/dist/lib/getPreviewCookie.js.map +0 -1
- package/dist/lib/isInternalURL.cjs +0 -9
- package/dist/lib/isInternalURL.cjs.map +0 -1
- package/dist/lib/isInternalURL.d.ts +0 -8
- package/dist/lib/isInternalURL.js +0 -9
- package/dist/lib/isInternalURL.js.map +0 -1
- package/dist/lib/isMigrationValue.cjs +0 -24
- package/dist/lib/isMigrationValue.cjs.map +0 -1
- package/dist/lib/isMigrationValue.d.ts +0 -71
- package/dist/lib/isMigrationValue.js +0 -24
- package/dist/lib/isMigrationValue.js.map +0 -1
- package/dist/lib/isValue.cjs +0 -53
- package/dist/lib/isValue.cjs.map +0 -1
- package/dist/lib/isValue.d.ts +0 -78
- package/dist/lib/isValue.js +0 -53
- package/dist/lib/isValue.js.map +0 -1
- package/dist/lib/minifyGraphQLQuery.cjs +0 -7
- package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
- package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
- package/dist/lib/minifyGraphQLQuery.js +0 -7
- package/dist/lib/minifyGraphQLQuery.js.map +0 -1
- package/dist/lib/pLimit.cjs +0 -49
- package/dist/lib/pLimit.cjs.map +0 -1
- package/dist/lib/pLimit.d.ts +0 -22
- package/dist/lib/pLimit.js +0 -49
- package/dist/lib/pLimit.js.map +0 -1
- package/dist/lib/request.cjs +0 -43
- package/dist/lib/request.cjs.map +0 -1
- package/dist/lib/request.d.ts +0 -73
- package/dist/lib/request.js +0 -43
- package/dist/lib/request.js.map +0 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +0 -134
- package/dist/lib/resolveMigrationDocumentData.cjs.map +0 -1
- package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
- package/dist/lib/resolveMigrationDocumentData.js +0 -134
- package/dist/lib/resolveMigrationDocumentData.js.map +0 -1
- package/dist/lib/serializerHelpers.cjs +0 -113
- package/dist/lib/serializerHelpers.cjs.map +0 -1
- package/dist/lib/serializerHelpers.d.ts +0 -9
- package/dist/lib/serializerHelpers.js +0 -113
- package/dist/lib/serializerHelpers.js.map +0 -1
- package/dist/lib/someTagsFilter.cjs +0 -9
- package/dist/lib/someTagsFilter.cjs.map +0 -1
- package/dist/lib/someTagsFilter.d.ts +0 -9
- package/dist/lib/someTagsFilter.js +0 -9
- package/dist/lib/someTagsFilter.js.map +0 -1
- package/dist/lib/throttledLog.cjs +0 -17
- package/dist/lib/throttledLog.cjs.map +0 -1
- package/dist/lib/throttledLog.d.ts +0 -15
- package/dist/lib/throttledLog.js +0 -17
- package/dist/lib/throttledLog.js.map +0 -1
- package/dist/lib/typeFilter.cjs +0 -8
- package/dist/lib/typeFilter.cjs.map +0 -1
- package/dist/lib/typeFilter.d.ts +0 -8
- package/dist/lib/typeFilter.js +0 -8
- package/dist/lib/typeFilter.js.map +0 -1
- package/dist/lib/validateAssetMetadata.cjs +0 -28
- package/dist/lib/validateAssetMetadata.cjs.map +0 -1
- package/dist/lib/validateAssetMetadata.d.ts +0 -10
- package/dist/lib/validateAssetMetadata.js +0 -28
- package/dist/lib/validateAssetMetadata.js.map +0 -1
- package/dist/package.json.cjs +0 -7
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -7
- package/dist/package.json.js.map +0 -1
- package/dist/richtext/asText.cjs +0 -13
- package/dist/richtext/asText.cjs.map +0 -1
- package/dist/richtext/asText.d.ts +0 -12
- package/dist/richtext/asText.js +0 -13
- package/dist/richtext/asText.js.map +0 -1
- package/dist/richtext/asTree.cjs +0 -123
- package/dist/richtext/asTree.cjs.map +0 -1
- package/dist/richtext/asTree.d.ts +0 -14
- package/dist/richtext/asTree.js +0 -123
- package/dist/richtext/asTree.js.map +0 -1
- package/dist/richtext/composeSerializers.cjs +0 -17
- package/dist/richtext/composeSerializers.cjs.map +0 -1
- package/dist/richtext/composeSerializers.d.ts +0 -16
- package/dist/richtext/composeSerializers.js +0 -17
- package/dist/richtext/composeSerializers.js.map +0 -1
- package/dist/richtext/serialize.cjs +0 -19
- package/dist/richtext/serialize.cjs.map +0 -1
- package/dist/richtext/serialize.d.ts +0 -19
- package/dist/richtext/serialize.js +0 -19
- package/dist/richtext/serialize.js.map +0 -1
- package/dist/richtext/types.cjs +0 -11
- package/dist/richtext/types.cjs.map +0 -1
- package/dist/richtext/types.d.ts +0 -71
- package/dist/richtext/types.js +0 -11
- package/dist/richtext/types.js.map +0 -1
- package/dist/richtext/wrapMapSerializer.cjs +0 -24
- package/dist/richtext/wrapMapSerializer.cjs.map +0 -1
- package/dist/richtext/wrapMapSerializer.d.ts +0 -15
- package/dist/richtext/wrapMapSerializer.js +0 -24
- package/dist/richtext/wrapMapSerializer.js.map +0 -1
- package/dist/richtext.cjs +0 -15
- package/dist/richtext.cjs.map +0 -1
- package/dist/richtext.js +0 -15
- package/dist/richtext.js.map +0 -1
- package/dist/types/api/asset/asset.d.ts +0 -177
- package/dist/types/api/asset/tag.d.ts +0 -53
- package/dist/types/api/integration.d.ts +0 -28
- package/dist/types/api/migration/document.d.ts +0 -60
- package/dist/types/api/query.d.ts +0 -43
- package/dist/types/api/ref.d.ts +0 -32
- package/dist/types/api/release.d.ts +0 -11
- package/dist/types/api/repository.d.ts +0 -109
- package/dist/types/api/tags.d.ts +0 -9
- package/dist/types/migration/Asset.cjs +0 -33
- package/dist/types/migration/Asset.cjs.map +0 -1
- package/dist/types/migration/Asset.d.ts +0 -108
- package/dist/types/migration/Asset.js +0 -33
- package/dist/types/migration/Asset.js.map +0 -1
- package/dist/types/migration/ContentRelationship.d.ts +0 -16
- package/dist/types/migration/Document.cjs +0 -47
- package/dist/types/migration/Document.cjs.map +0 -1
- package/dist/types/migration/Document.d.ts +0 -94
- package/dist/types/migration/Document.js +0 -47
- package/dist/types/migration/Document.js.map +0 -1
- package/dist/types/migration/Link.d.ts +0 -19
- package/dist/types/model/boolean.d.ts +0 -15
- package/dist/types/model/color.d.ts +0 -13
- package/dist/types/model/contentRelationship.d.ts +0 -52
- package/dist/types/model/customType.d.ts +0 -48
- package/dist/types/model/date.d.ts +0 -14
- package/dist/types/model/embed.d.ts +0 -13
- package/dist/types/model/geoPoint.d.ts +0 -12
- package/dist/types/model/group.d.ts +0 -23
- package/dist/types/model/image.d.ts +0 -31
- package/dist/types/model/integration.d.ts +0 -14
- package/dist/types/model/keyText.d.ts +0 -13
- package/dist/types/model/link.cjs +0 -9
- package/dist/types/model/link.cjs.map +0 -1
- package/dist/types/model/link.d.ts +0 -28
- package/dist/types/model/link.js +0 -9
- package/dist/types/model/link.js.map +0 -1
- package/dist/types/model/linkToMedia.d.ts +0 -17
- package/dist/types/model/number.d.ts +0 -15
- package/dist/types/model/range.d.ts +0 -14
- package/dist/types/model/richText.d.ts +0 -37
- package/dist/types/model/select.d.ts +0 -18
- package/dist/types/model/separator.d.ts +0 -10
- package/dist/types/model/sharedSlice.d.ts +0 -16
- package/dist/types/model/sharedSliceVariation.d.ts +0 -19
- package/dist/types/model/slice.cjs +0 -8
- package/dist/types/model/slice.cjs.map +0 -1
- package/dist/types/model/slice.d.ts +0 -33
- package/dist/types/model/slice.js +0 -8
- package/dist/types/model/slice.js.map +0 -1
- package/dist/types/model/sliceZone.cjs +0 -8
- package/dist/types/model/sliceZone.cjs.map +0 -1
- package/dist/types/model/sliceZone.d.ts +0 -41
- package/dist/types/model/sliceZone.js +0 -8
- package/dist/types/model/sliceZone.js.map +0 -1
- package/dist/types/model/table.d.ts +0 -12
- package/dist/types/model/timestamp.d.ts +0 -14
- package/dist/types/model/title.d.ts +0 -7
- package/dist/types/model/types.cjs +0 -39
- package/dist/types/model/types.cjs.map +0 -1
- package/dist/types/model/types.d.ts +0 -77
- package/dist/types/model/types.js +0 -39
- package/dist/types/model/types.js.map +0 -1
- package/dist/types/model/uid.d.ts +0 -13
- package/dist/types/value/boolean.d.ts +0 -6
- package/dist/types/value/color.d.ts +0 -9
- package/dist/types/value/contentRelationship.d.ts +0 -31
- package/dist/types/value/date.d.ts +0 -9
- package/dist/types/value/document.d.ts +0 -114
- package/dist/types/value/embed.cjs +0 -10
- package/dist/types/value/embed.cjs.map +0 -1
- package/dist/types/value/embed.d.ts +0 -168
- package/dist/types/value/embed.js +0 -10
- package/dist/types/value/embed.js.map +0 -1
- package/dist/types/value/geoPoint.d.ts +0 -12
- package/dist/types/value/group.d.ts +0 -13
- package/dist/types/value/image.d.ts +0 -47
- package/dist/types/value/integration.d.ts +0 -16
- package/dist/types/value/keyText.d.ts +0 -9
- package/dist/types/value/link.cjs +0 -10
- package/dist/types/value/link.cjs.map +0 -1
- package/dist/types/value/link.d.ts +0 -68
- package/dist/types/value/link.js +0 -10
- package/dist/types/value/link.js.map +0 -1
- package/dist/types/value/linkToMedia.d.ts +0 -28
- package/dist/types/value/number.d.ts +0 -9
- package/dist/types/value/richText.cjs +0 -25
- package/dist/types/value/richText.cjs.map +0 -1
- package/dist/types/value/richText.d.ts +0 -215
- package/dist/types/value/richText.js +0 -25
- package/dist/types/value/richText.js.map +0 -1
- package/dist/types/value/select.d.ts +0 -10
- package/dist/types/value/sharedSlice.d.ts +0 -11
- package/dist/types/value/sharedSliceVariation.d.ts +0 -10
- package/dist/types/value/slice.d.ts +0 -13
- package/dist/types/value/sliceZone.d.ts +0 -12
- package/dist/types/value/table.d.ts +0 -91
- package/dist/types/value/timestamp.d.ts +0 -8
- package/dist/types/value/title.d.ts +0 -12
- package/dist/types/value/types.d.ts +0 -58
- package/dist/types/webhook/apiUpdate.d.ts +0 -52
- package/dist/types/webhook/testTrigger.d.ts +0 -9
- package/dist/types/webhook/types.cjs +0 -8
- package/dist/types/webhook/types.cjs.map +0 -1
- package/dist/types/webhook/types.d.ts +0 -18
- package/dist/types/webhook/types.js +0 -8
- package/dist/types/webhook/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.21.0-alpha.
|
|
3
|
+
"version": "7.21.0-alpha.2",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -23,48 +23,26 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
".": {
|
|
26
|
-
"require":
|
|
27
|
-
|
|
28
|
-
"default": "./dist/index.cjs"
|
|
29
|
-
},
|
|
30
|
-
"import": {
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
32
|
-
"default": "./dist/index.js"
|
|
33
|
-
}
|
|
26
|
+
"require": "./dist/index.cjs",
|
|
27
|
+
"import": "./dist/index.mjs"
|
|
34
28
|
},
|
|
35
29
|
"./richtext": {
|
|
36
|
-
"require":
|
|
37
|
-
|
|
38
|
-
"default": "./dist/richtext.cjs"
|
|
39
|
-
},
|
|
40
|
-
"import": {
|
|
41
|
-
"types": "./dist/richtext/index.d.ts",
|
|
42
|
-
"default": "./dist/richtext.js"
|
|
43
|
-
}
|
|
30
|
+
"require": "./dist/richtext/index.cjs",
|
|
31
|
+
"import": "./dist/richtext/index.mjs"
|
|
44
32
|
},
|
|
45
33
|
"./package.json": "./package.json"
|
|
46
34
|
},
|
|
47
35
|
"main": "./dist/index.cjs",
|
|
48
|
-
"module": "./dist/index.
|
|
49
|
-
"react-native": "./dist/index.
|
|
36
|
+
"module": "./dist/index.mjs",
|
|
37
|
+
"react-native": "./dist/index.mjs",
|
|
50
38
|
"types": "./dist/index.d.ts",
|
|
51
|
-
"typesVersions": {
|
|
52
|
-
"*": {
|
|
53
|
-
"*": [
|
|
54
|
-
"dist/index.d.ts"
|
|
55
|
-
],
|
|
56
|
-
"richtext": [
|
|
57
|
-
"dist/richtext/index.d.ts"
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
39
|
"files": [
|
|
62
40
|
"dist",
|
|
63
41
|
"src"
|
|
64
42
|
],
|
|
65
43
|
"scripts": {
|
|
66
|
-
"build": "
|
|
67
|
-
"dev": "
|
|
44
|
+
"build": "unbuild",
|
|
45
|
+
"dev": "unbuild watch",
|
|
68
46
|
"format": "prettier --write .",
|
|
69
47
|
"prepare": "npm run build",
|
|
70
48
|
"release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
|
|
@@ -83,28 +61,27 @@
|
|
|
83
61
|
},
|
|
84
62
|
"devDependencies": {
|
|
85
63
|
"@prismicio/mock": "0.7.1",
|
|
86
|
-
"@prismicio/types-internal": "^3.
|
|
64
|
+
"@prismicio/types-internal": "^3.16.1",
|
|
87
65
|
"@size-limit/preset-small-lib": "^11.2.0",
|
|
88
|
-
"@trivago/prettier-plugin-sort-imports": "^
|
|
66
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
89
67
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
90
68
|
"@typescript-eslint/parser": "^6.21.0",
|
|
91
|
-
"@vitest/coverage-v8": "^2.
|
|
69
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
92
70
|
"abort-controller": "^3.0.0",
|
|
93
71
|
"eslint": "^8.57.1",
|
|
94
|
-
"eslint-config-prettier": "^9.1.
|
|
95
|
-
"eslint-plugin-prettier": "^5.
|
|
72
|
+
"eslint-config-prettier": "^9.1.2",
|
|
73
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
96
74
|
"eslint-plugin-tsdoc": "^0.3.0",
|
|
97
75
|
"msw": "^1.3.5",
|
|
98
76
|
"node-fetch": "^3.3.2",
|
|
99
|
-
"prettier": "^3.
|
|
100
|
-
"prettier-plugin-jsdoc": "1.3.
|
|
77
|
+
"prettier": "^3.6.2",
|
|
78
|
+
"prettier-plugin-jsdoc": "1.3.3",
|
|
101
79
|
"size-limit": "^11.2.0",
|
|
102
80
|
"standard-version": "^9.5.0",
|
|
103
81
|
"ts-expect": "^1.3.0",
|
|
104
|
-
"typescript": "^5.
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"vitest": "^2.1.9"
|
|
82
|
+
"typescript": "^5.9.3",
|
|
83
|
+
"unbuild": "^3.6.1",
|
|
84
|
+
"vitest": "^3.2.4"
|
|
108
85
|
},
|
|
109
86
|
"engines": {
|
|
110
87
|
"node": ">=14.15.0"
|
package/src/buildQueryURL.ts
CHANGED
|
@@ -39,11 +39,11 @@ export interface Ordering {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* A `routes` parameter that determines how a
|
|
42
|
+
* A `routes` parameter that determines how a page's URL field is resolved.
|
|
43
43
|
*
|
|
44
44
|
* {@link https://prismic.io/docs/route-resolver}
|
|
45
45
|
*
|
|
46
|
-
* @example With a
|
|
46
|
+
* @example With a page's UID field.
|
|
47
47
|
*
|
|
48
48
|
* ```ts
|
|
49
49
|
* {
|
|
@@ -66,24 +66,24 @@ export interface Ordering {
|
|
|
66
66
|
*/
|
|
67
67
|
export interface Route {
|
|
68
68
|
/**
|
|
69
|
-
* The custom type of the
|
|
69
|
+
* The custom type of the page.
|
|
70
70
|
*/
|
|
71
71
|
type: string
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* A specific UID to which this route definition is scoped. The route is only
|
|
75
|
-
* defined for the
|
|
75
|
+
* defined for the page whose UID matches the given UID.
|
|
76
76
|
*/
|
|
77
77
|
uid?: string
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* A specific language to which this route definition is scoped. The route is
|
|
81
|
-
* only defined for
|
|
81
|
+
* only defined for pages whose language matches the given language.
|
|
82
82
|
*/
|
|
83
83
|
lang?: string
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* The resolved path of the
|
|
86
|
+
* The resolved path of the page with optional placeholders.
|
|
87
87
|
*/
|
|
88
88
|
path: string
|
|
89
89
|
|
|
@@ -94,9 +94,9 @@ export interface Route {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
|
-
* Parameters for the Prismic
|
|
97
|
+
* Parameters for the Prismic Content API.
|
|
98
98
|
*
|
|
99
|
-
* {@link https://prismic.io/docs/
|
|
99
|
+
* @see Learn how to fetch content from Prismic: {@link https://prismic.io/docs/fetch-content}
|
|
100
100
|
*/
|
|
101
101
|
export interface QueryParams {
|
|
102
102
|
/**
|
|
@@ -108,8 +108,8 @@ export interface QueryParams {
|
|
|
108
108
|
accessToken?: string
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
* The `pageSize` parameter defines the maximum number of
|
|
112
|
-
*
|
|
111
|
+
* The `pageSize` parameter defines the maximum number of pages that the API
|
|
112
|
+
* will return for your query.
|
|
113
113
|
*
|
|
114
114
|
* {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}
|
|
115
115
|
*/
|
|
@@ -124,8 +124,8 @@ export interface QueryParams {
|
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
126
|
* The `after` parameter can be used along with the orderings option. It will
|
|
127
|
-
* remove all the
|
|
128
|
-
*
|
|
127
|
+
* remove all the pages except for those after the specified page in the
|
|
128
|
+
* list.
|
|
129
129
|
*
|
|
130
130
|
* {@link https://prismic.io/docs/rest-api-technical-reference#after}
|
|
131
131
|
*/
|
|
@@ -141,7 +141,7 @@ export interface QueryParams {
|
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* The `fetchLinks` parameter allows you to retrieve a specific content field
|
|
144
|
-
* from a linked
|
|
144
|
+
* from a linked page and add it to the page response object.
|
|
145
145
|
*
|
|
146
146
|
* {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}
|
|
147
147
|
*/
|
|
@@ -189,7 +189,7 @@ export interface QueryParams {
|
|
|
189
189
|
orderings?: string | Ordering | (string | Ordering)[]
|
|
190
190
|
|
|
191
191
|
/**
|
|
192
|
-
* The `routes` option allows you to define how a
|
|
192
|
+
* The `routes` option allows you to define how a page's `url` field is
|
|
193
193
|
* resolved.
|
|
194
194
|
*
|
|
195
195
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -199,7 +199,7 @@ export interface QueryParams {
|
|
|
199
199
|
/**
|
|
200
200
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
201
201
|
* `url` property for broken link or content relationship fields. A broken
|
|
202
|
-
* link is a link or content relationship field whose linked
|
|
202
|
+
* link is a link or content relationship field whose linked page has been
|
|
203
203
|
* unpublished or deleted.
|
|
204
204
|
*
|
|
205
205
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -296,21 +296,29 @@ const castOrderingToString = (ordering: Ordering | string): string => {
|
|
|
296
296
|
export type BuildQueryURLArgs = QueryParams & BuildQueryURLParams
|
|
297
297
|
|
|
298
298
|
/**
|
|
299
|
-
*
|
|
300
|
-
* paginated response for this URL includes
|
|
299
|
+
* Builds a Prismic Content API URL to request pages from a repository. The
|
|
300
|
+
* paginated response for this URL includes pages matching the parameters.
|
|
301
301
|
*
|
|
302
302
|
* A ref is required to make a request. Request the `endpoint` URL to retrieve a
|
|
303
303
|
* list of available refs.
|
|
304
304
|
*
|
|
305
305
|
* Type the JSON response with `Query`.
|
|
306
306
|
*
|
|
307
|
-
*
|
|
308
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference}
|
|
307
|
+
* @example
|
|
309
308
|
*
|
|
310
|
-
*
|
|
309
|
+
* ```ts
|
|
310
|
+
* const url = buildQueryURL("https://my-repo.cdn.prismic.io/api/v2", {
|
|
311
|
+
* ref: "my-ref",
|
|
312
|
+
* filters: [filter.at("document.type", "blog_post")],
|
|
313
|
+
* })
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
316
|
+
* @param endpoint - URL to the repository's Content API.
|
|
311
317
|
* @param args - Arguments to filter and scope the query.
|
|
312
318
|
*
|
|
313
|
-
* @returns URL that can be used to request
|
|
319
|
+
* @returns URL that can be used to request pages from the repository.
|
|
320
|
+
*
|
|
321
|
+
* @see Prismic Content API technical reference: {@link https://prismic.io/docs/content-api}
|
|
314
322
|
*/
|
|
315
323
|
export const buildQueryURL = (
|
|
316
324
|
endpoint: string,
|
package/src/createClient.ts
CHANGED
|
@@ -14,26 +14,29 @@ export interface CreateClient {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Creates a Prismic client that can be used to query a repository.
|
|
17
|
+
* Creates a Prismic client that can be used to query content from a repository.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
*
|
|
21
21
|
* ```ts
|
|
22
|
-
* // With a repository name
|
|
23
|
-
* createClient("
|
|
22
|
+
* // With a repository name
|
|
23
|
+
* createClient("my-repo")
|
|
24
24
|
*
|
|
25
|
-
* //
|
|
26
|
-
* createClient("https://
|
|
25
|
+
* // With a full Prismic Content API endpoint
|
|
26
|
+
* createClient("https://my-repo.cdn.prismic.io/api/v2")
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
|
-
* @typeParam TDocuments - A union of Prismic
|
|
29
|
+
* @typeParam TDocuments - A union of Prismic page and custom types for the
|
|
30
|
+
* repository.
|
|
30
31
|
*
|
|
31
|
-
* @param repositoryNameOrEndpoint - The Prismic repository name or full
|
|
32
|
-
* API
|
|
32
|
+
* @param repositoryNameOrEndpoint - The Prismic repository name or full Content
|
|
33
|
+
* API endpoint for the repository.
|
|
33
34
|
* @param options - Configuration that determines how content will be queried
|
|
34
35
|
* from the Prismic repository.
|
|
35
36
|
*
|
|
36
37
|
* @returns A client that can query content from the repository.
|
|
38
|
+
*
|
|
39
|
+
* @see @prismicio/client technical reference: {@link https://prismic.io/docs/technical-reference/prismicio-client/v7}
|
|
37
40
|
*/
|
|
38
41
|
export const createClient: CreateClient = <TDocuments extends PrismicDocument>(
|
|
39
42
|
repositoryNameOrEndpoint: string,
|
|
@@ -3,13 +3,20 @@ import { PrismicError } from "./errors/PrismicError"
|
|
|
3
3
|
import { isRepositoryName } from "./isRepositoryName"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Get a repository's Prismic
|
|
6
|
+
* Get a repository's Prismic Content API endpoint.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* getRepositoryEndpoint("my-repo")
|
|
12
|
+
* // => "https://my-repo.cdn.prismic.io/api/v2"
|
|
13
|
+
* ```
|
|
7
14
|
*
|
|
8
15
|
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
9
16
|
*
|
|
10
17
|
* @param repositoryName - Name of the repository.
|
|
11
18
|
*
|
|
12
|
-
* @returns The repository's Prismic
|
|
19
|
+
* @returns The repository's Prismic Content API endpoint.
|
|
13
20
|
*
|
|
14
21
|
* @throws {@link Error} Thrown if an invalid repository name is provided.
|
|
15
22
|
*/
|
package/src/helpers/asDate.ts
CHANGED
|
@@ -9,13 +9,20 @@ type AsDateReturnType<
|
|
|
9
9
|
> = Field extends DateField<"filled"> | TimestampField<"filled"> ? Date : null
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Converts a date or timestamp field to a JavaScript Date object.
|
|
13
13
|
*
|
|
14
|
-
* @
|
|
14
|
+
* @example
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const date = asDate(document.data.release_date)
|
|
18
|
+
* // => Date object or null
|
|
19
|
+
* ```
|
|
17
20
|
*
|
|
18
|
-
* @
|
|
21
|
+
* @param dateOrTimestampField - A date or timestamp field from Prismic.
|
|
22
|
+
*
|
|
23
|
+
* @returns A Date object, or `null` if the field is empty.
|
|
24
|
+
*
|
|
25
|
+
* @see Learn about date and timestamp fields: {@link https://prismic.io/docs/fields/date}
|
|
19
26
|
*/
|
|
20
27
|
export const asDate = <
|
|
21
28
|
Field extends DateField | TimestampField | null | undefined,
|
package/src/helpers/asHTML.ts
CHANGED
|
@@ -19,13 +19,13 @@ import { composeSerializers, serialize, wrapMapSerializer } from "../richtext"
|
|
|
19
19
|
import type { LinkResolverFunction } from "./asLink"
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Serializes a node from a rich text
|
|
22
|
+
* Serializes a node from a rich text field with a function to HTML.
|
|
23
23
|
*
|
|
24
24
|
* Unlike a typical `@prismicio/client/richtext` function serializer, this
|
|
25
25
|
* serializer converts the `children` argument to a single string rather than an
|
|
26
26
|
* array of strings.
|
|
27
27
|
*
|
|
28
|
-
* @see
|
|
28
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
29
29
|
*/
|
|
30
30
|
export type HTMLRichTextFunctionSerializer = (
|
|
31
31
|
type: Parameters<RichTextFunctionSerializer<string>>[0],
|
|
@@ -36,13 +36,13 @@ export type HTMLRichTextFunctionSerializer = (
|
|
|
36
36
|
) => string | null | undefined
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
* Serializes a node from a rich text
|
|
39
|
+
* Serializes a node from a rich text field with a map to HTML.
|
|
40
40
|
*
|
|
41
41
|
* Unlike a typical `@prismicio/client/richtext` map serializer, this serializer
|
|
42
42
|
* converts the `children` property to a single string rather than an array of
|
|
43
43
|
* strings and accepts shorthand declarations.
|
|
44
44
|
*
|
|
45
|
-
* @see
|
|
45
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
46
46
|
*/
|
|
47
47
|
export type HTMLRichTextMapSerializer = {
|
|
48
48
|
[P in keyof RichTextMapSerializer<string>]: P extends RichTextMapSerializer<string>["span"]
|
|
@@ -51,13 +51,13 @@ export type HTMLRichTextMapSerializer = {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Serializes a node from a rich text
|
|
54
|
+
* Serializes a node from a rich text field with a map to HTML.
|
|
55
55
|
*
|
|
56
56
|
* Unlike a typical `@prismicio/client/richtext` map serializer, this serializer
|
|
57
57
|
* converts the `children` property to a single string rather than an array of
|
|
58
58
|
* strings but doesn't accept shorthand declarations.
|
|
59
59
|
*
|
|
60
|
-
* @see
|
|
60
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
61
61
|
*/
|
|
62
62
|
export type HTMLStrictRichTextMapSerializer = {
|
|
63
63
|
[P in keyof RichTextMapSerializer<string>]: (payload: {
|
|
@@ -135,11 +135,10 @@ export type HTMLRichTextMapSerializerShorthand = {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* Serializes a node from a rich text
|
|
139
|
-
* HTML
|
|
138
|
+
* Serializes a node from a rich text field with a map or a function to HTML.
|
|
140
139
|
*
|
|
141
140
|
* @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
|
|
142
|
-
* @see
|
|
141
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
143
142
|
*/
|
|
144
143
|
export type HTMLRichTextSerializer =
|
|
145
144
|
| HTMLRichTextMapSerializer
|
|
@@ -291,14 +290,14 @@ const wrapMapSerializerWithStringChildren = (
|
|
|
291
290
|
*/
|
|
292
291
|
type AsHTMLConfig = {
|
|
293
292
|
/**
|
|
294
|
-
* An optional link resolver function to resolve links. Without it you're
|
|
295
|
-
* expected to use the `routes`
|
|
293
|
+
* An optional link resolver function to resolve links. Without it, you're
|
|
294
|
+
* expected to use the `routes` option from the API.
|
|
296
295
|
*/
|
|
297
296
|
linkResolver?: LinkResolverFunction | null
|
|
298
297
|
|
|
299
298
|
/**
|
|
300
|
-
* An optional rich text serializer
|
|
301
|
-
* default serializer
|
|
299
|
+
* An optional rich text serializer. Unhandled cases will fall back to the
|
|
300
|
+
* default serializer.
|
|
302
301
|
*/
|
|
303
302
|
serializer?: HTMLRichTextSerializer | null
|
|
304
303
|
}
|
|
@@ -321,14 +320,22 @@ type AsHTMLReturnType<Field extends RichTextField | null | undefined> =
|
|
|
321
320
|
// TODO: Remove overload when we remove support for deprecated tuple-style configuration.
|
|
322
321
|
export const asHTML: {
|
|
323
322
|
/**
|
|
324
|
-
*
|
|
323
|
+
* Converts a rich text field to an HTML string.
|
|
325
324
|
*
|
|
326
|
-
* @
|
|
327
|
-
* @param config - Configuration that determines the output of `asHTML()`
|
|
325
|
+
* @example
|
|
328
326
|
*
|
|
329
|
-
*
|
|
327
|
+
* ```ts
|
|
328
|
+
* const html = asHTML(document.data.content)
|
|
329
|
+
* // => "<p>Hello world</p>"
|
|
330
|
+
* ```
|
|
330
331
|
*
|
|
331
|
-
* @
|
|
332
|
+
* @param richTextField - A rich text field from Prismic.
|
|
333
|
+
* @param config - Configuration that determines the output of `asHTML()`.
|
|
334
|
+
*
|
|
335
|
+
* @returns HTML equivalent of the rich text field, or `null` if the field is
|
|
336
|
+
* empty.
|
|
337
|
+
*
|
|
338
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
332
339
|
*/
|
|
333
340
|
<Field extends RichTextField | null | undefined>(
|
|
334
341
|
richTextField: Field,
|
|
@@ -336,19 +343,20 @@ export const asHTML: {
|
|
|
336
343
|
): AsHTMLReturnType<Field>
|
|
337
344
|
|
|
338
345
|
/**
|
|
339
|
-
*
|
|
346
|
+
* Converts a rich text field to an HTML string.
|
|
340
347
|
*
|
|
341
348
|
* @deprecated Use object-style configuration instead.
|
|
342
349
|
*
|
|
343
|
-
* @param richTextField - A rich text
|
|
344
|
-
* @param linkResolver - An optional link resolver function to resolve links
|
|
345
|
-
*
|
|
346
|
-
* @param serializer - An optional rich text serializer
|
|
347
|
-
*
|
|
350
|
+
* @param richTextField - A rich text field from Prismic.
|
|
351
|
+
* @param linkResolver - An optional link resolver function to resolve links.
|
|
352
|
+
* Without it, you're expected to use the `routes` option from the API.
|
|
353
|
+
* @param serializer - An optional rich text serializer. Unhandled cases will
|
|
354
|
+
* fall back to the default serializer.
|
|
348
355
|
*
|
|
349
|
-
* @returns HTML equivalent of the
|
|
356
|
+
* @returns HTML equivalent of the rich text field, or `null` if the field is
|
|
357
|
+
* empty.
|
|
350
358
|
*
|
|
351
|
-
* @see
|
|
359
|
+
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
352
360
|
*/
|
|
353
361
|
<Field extends RichTextField | null | undefined>(
|
|
354
362
|
richTextField: Field,
|
|
@@ -28,13 +28,13 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
28
28
|
Field extends ImageFieldImage<"filled">
|
|
29
29
|
? {
|
|
30
30
|
/**
|
|
31
|
-
* The image field's
|
|
31
|
+
* The image field's URL with imgix URL parameters (if given).
|
|
32
32
|
*/
|
|
33
33
|
src: string
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* A pixel-
|
|
37
|
-
*
|
|
36
|
+
* A pixel-density-based `srcset` attribute value for the image field
|
|
37
|
+
* with imgix URL parameters (if given).
|
|
38
38
|
*/
|
|
39
39
|
srcset: string
|
|
40
40
|
}
|
|
@@ -42,7 +42,7 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* Creates a pixel-density-based `srcset` from an image field with optional
|
|
45
|
-
* image transformations
|
|
45
|
+
* image transformations via imgix URL parameters.
|
|
46
46
|
*
|
|
47
47
|
* If a `pixelDensities` parameter is not given, the following pixel densities
|
|
48
48
|
* will be used by default: 1, 2, 3.
|
|
@@ -50,26 +50,27 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
50
50
|
* @example
|
|
51
51
|
*
|
|
52
52
|
* ```ts
|
|
53
|
-
* const srcset = asImagePixelDensitySrcSet(document.data.
|
|
53
|
+
* const srcset = asImagePixelDensitySrcSet(document.data.photo, {
|
|
54
54
|
* pixelDensities: [1, 2],
|
|
55
55
|
* sat: -100,
|
|
56
56
|
* })
|
|
57
57
|
* // => {
|
|
58
|
-
* // src:
|
|
59
|
-
* // srcset:
|
|
60
|
-
* //
|
|
58
|
+
* // src: "https://images.prismic.io/repo/image.png?sat=-100",
|
|
59
|
+
* // srcset: "https://images.prismic.io/repo/image.png?sat=-100&dpr=1 1x, " +
|
|
60
|
+
* // "https://images.prismic.io/repo/image.png?sat=-100&dpr=2 2x"
|
|
61
61
|
* // }
|
|
62
62
|
* ```
|
|
63
63
|
*
|
|
64
|
-
* @param field -
|
|
65
|
-
* an image URL.
|
|
66
|
-
* @param config - An object of
|
|
67
|
-
* parameter defines the resulting `srcset`
|
|
64
|
+
* @param field - An image field (or one of its responsive views) from which to
|
|
65
|
+
* get an image URL.
|
|
66
|
+
* @param config - An object of imgix URL API parameters. The `pixelDensities`
|
|
67
|
+
* parameter defines the resulting `srcset` pixel densities.
|
|
68
68
|
*
|
|
69
|
-
* @returns A `srcset` attribute value for the image field with
|
|
70
|
-
* parameters
|
|
69
|
+
* @returns A `srcset` attribute value for the image field with imgix URL
|
|
70
|
+
* parameters, or `null` if the field is empty.
|
|
71
71
|
*
|
|
72
|
-
* @see
|
|
72
|
+
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
73
|
+
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
73
74
|
*/
|
|
74
75
|
export const asImagePixelDensitySrcSet = <
|
|
75
76
|
Field extends ImageFieldImage | null | undefined,
|
|
@@ -12,24 +12,25 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
|
|
|
12
12
|
Field extends ImageFieldImage<"filled"> ? string : null
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Returns the URL of an image field with optional image transformations
|
|
16
|
-
*
|
|
15
|
+
* Returns the URL of an image field with optional image transformations via
|
|
16
|
+
* imgix URL parameters.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
*
|
|
20
20
|
* ```ts
|
|
21
|
-
* const src = asImageSrc(document.data.
|
|
22
|
-
* // => https://images.prismic.io/repo/image.png?sat=-100
|
|
21
|
+
* const src = asImageSrc(document.data.photo, { sat: -100 })
|
|
22
|
+
* // => "https://images.prismic.io/repo/image.png?sat=-100"
|
|
23
23
|
* ```
|
|
24
24
|
*
|
|
25
|
-
* @param field -
|
|
26
|
-
* an image URL.
|
|
27
|
-
* @param config - An object of
|
|
25
|
+
* @param field - An image field (or one of its responsive views) from which to
|
|
26
|
+
* get an image URL.
|
|
27
|
+
* @param config - An object of imgix URL API parameters to transform the image.
|
|
28
28
|
*
|
|
29
|
-
* @returns The image field's
|
|
30
|
-
*
|
|
29
|
+
* @returns The image field's URL with transformations applied, or `null` if the
|
|
30
|
+
* field is empty.
|
|
31
31
|
*
|
|
32
|
-
* @see
|
|
32
|
+
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
33
|
+
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
33
34
|
*/
|
|
34
35
|
export const asImageSrc = <Field extends ImageFieldImage | null | undefined>(
|
|
35
36
|
field: Field,
|
|
@@ -19,13 +19,13 @@ type AsImageWidthSrcSetReturnType<
|
|
|
19
19
|
Field extends ImageFieldImage<"filled">
|
|
20
20
|
? {
|
|
21
21
|
/**
|
|
22
|
-
* The image field's
|
|
22
|
+
* The image field's URL with imgix URL parameters (if given).
|
|
23
23
|
*/
|
|
24
24
|
src: string
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* A width-based `srcset` attribute value for the image field
|
|
28
|
-
*
|
|
27
|
+
* A width-based `srcset` attribute value for the image field with imgix
|
|
28
|
+
* URL parameters (if given).
|
|
29
29
|
*/
|
|
30
30
|
srcset: string
|
|
31
31
|
}
|
|
@@ -40,10 +40,10 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* Creates a width-based `srcset` from an image field with optional image
|
|
43
|
-
* transformations
|
|
43
|
+
* transformations via imgix URL parameters.
|
|
44
44
|
*
|
|
45
|
-
* If a `widths` parameter is not given, the following widths
|
|
46
|
-
* default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
|
|
45
|
+
* If a `widths` parameter is not given, the following widths (in pixels) will
|
|
46
|
+
* be used by default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
|
|
47
47
|
*
|
|
48
48
|
* If the image field contains responsive views, each responsive view can be
|
|
49
49
|
* used as a width in the resulting `srcset` by passing `"thumbnails"` as the
|
|
@@ -52,28 +52,29 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
52
52
|
* @example
|
|
53
53
|
*
|
|
54
54
|
* ```ts
|
|
55
|
-
* const srcset = asImageWidthSrcSet(document.data.
|
|
55
|
+
* const srcset = asImageWidthSrcSet(document.data.photo, {
|
|
56
56
|
* widths: [400, 800, 1600],
|
|
57
57
|
* sat: -100,
|
|
58
58
|
* })
|
|
59
59
|
* // => {
|
|
60
|
-
* // src:
|
|
61
|
-
* // srcset:
|
|
62
|
-
* //
|
|
63
|
-
* //
|
|
60
|
+
* // src: "https://images.prismic.io/repo/image.png?sat=-100",
|
|
61
|
+
* // srcset: "https://images.prismic.io/repo/image.png?sat=-100&width=400 400w, " +
|
|
62
|
+
* // "https://images.prismic.io/repo/image.png?sat=-100&width=800 800w, " +
|
|
63
|
+
* // "https://images.prismic.io/repo/image.png?sat=-100&width=1600 1600w"
|
|
64
64
|
* // }
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
67
|
-
* @param field -
|
|
68
|
-
* an image URL.
|
|
69
|
-
* @param config - An object of
|
|
67
|
+
* @param field - An image field (or one of its responsive views) from which to
|
|
68
|
+
* get an image URL.
|
|
69
|
+
* @param config - An object of imgix URL API parameters. The `widths` parameter
|
|
70
70
|
* defines the resulting `srcset` widths. Pass `"thumbnails"` to automatically
|
|
71
71
|
* use the field's responsive views.
|
|
72
72
|
*
|
|
73
|
-
* @returns A `srcset` attribute value for the image field with
|
|
74
|
-
* parameters
|
|
73
|
+
* @returns A `srcset` attribute value for the image field with imgix URL
|
|
74
|
+
* parameters, or `null` if the field is empty.
|
|
75
75
|
*
|
|
76
|
-
* @see
|
|
76
|
+
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
77
|
+
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
77
78
|
*/
|
|
78
79
|
export const asImageWidthSrcSet = <
|
|
79
80
|
Field extends ImageFieldImage | null | undefined,
|