@prismicio/client 7.21.0-alpha.2 → 7.21.0
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 +1262 -0
- package/dist/Client.cjs.map +1 -0
- package/dist/Client.d.ts +981 -0
- package/dist/Client.js +1262 -0
- package/dist/Client.js.map +1 -0
- package/dist/Migration.cjs +297 -0
- package/dist/Migration.cjs.map +1 -0
- package/dist/Migration.d.ts +213 -0
- package/dist/Migration.js +297 -0
- package/dist/Migration.js.map +1 -0
- package/dist/WriteClient.cjs +575 -0
- package/dist/WriteClient.cjs.map +1 -0
- package/dist/WriteClient.d.ts +281 -0
- package/dist/WriteClient.js +575 -0
- package/dist/WriteClient.js.map +1 -0
- package/dist/buildQueryURL.cjs +66 -0
- package/dist/buildQueryURL.cjs.map +1 -0
- package/dist/buildQueryURL.d.ts +217 -0
- package/dist/buildQueryURL.js +66 -0
- package/dist/buildQueryURL.js.map +1 -0
- package/dist/cookie.cjs +5 -0
- package/dist/cookie.cjs.map +1 -0
- package/dist/cookie.d.ts +5 -0
- package/dist/cookie.js +5 -0
- package/dist/cookie.js.map +1 -0
- package/dist/createClient.cjs +6 -0
- package/dist/createClient.cjs.map +1 -0
- package/dist/createClient.d.ts +35 -0
- package/dist/createClient.js +6 -0
- package/dist/createClient.js.map +1 -0
- package/dist/createMigration.cjs +6 -0
- package/dist/createMigration.cjs.map +1 -0
- package/dist/createMigration.d.ts +24 -0
- package/dist/createMigration.js +6 -0
- package/dist/createMigration.js.map +1 -0
- package/dist/createWriteClient.cjs +6 -0
- package/dist/createWriteClient.cjs.map +1 -0
- package/dist/createWriteClient.d.ts +32 -0
- package/dist/createWriteClient.js +6 -0
- package/dist/createWriteClient.js.map +1 -0
- package/dist/errors/ForbiddenError.cjs +7 -0
- package/dist/errors/ForbiddenError.cjs.map +1 -0
- package/dist/errors/ForbiddenError.d.ts +11 -0
- package/dist/errors/ForbiddenError.js +7 -0
- package/dist/errors/ForbiddenError.js.map +1 -0
- package/dist/errors/InvalidDataError.cjs +7 -0
- package/dist/errors/InvalidDataError.cjs.map +1 -0
- package/dist/errors/InvalidDataError.d.ts +3 -0
- package/dist/errors/InvalidDataError.js +7 -0
- package/dist/errors/InvalidDataError.js.map +1 -0
- package/dist/errors/NotFoundError.cjs +7 -0
- package/dist/errors/NotFoundError.cjs.map +1 -0
- package/dist/errors/NotFoundError.d.ts +3 -0
- package/dist/errors/NotFoundError.js +7 -0
- package/dist/errors/NotFoundError.js.map +1 -0
- package/dist/errors/ParsingError.cjs +7 -0
- package/dist/errors/ParsingError.cjs.map +1 -0
- package/dist/errors/ParsingError.d.ts +14 -0
- package/dist/errors/ParsingError.js +7 -0
- package/dist/errors/ParsingError.js.map +1 -0
- package/dist/errors/PreviewTokenExpired.cjs +7 -0
- package/dist/errors/PreviewTokenExpired.cjs.map +1 -0
- package/dist/errors/PreviewTokenExpired.d.ts +8 -0
- package/dist/errors/PreviewTokenExpired.js +7 -0
- package/dist/errors/PreviewTokenExpired.js.map +1 -0
- package/dist/errors/PrismicError.cjs +13 -0
- package/dist/errors/PrismicError.cjs.map +1 -0
- package/dist/errors/PrismicError.d.ts +5 -0
- package/dist/errors/PrismicError.js +13 -0
- package/dist/errors/PrismicError.js.map +1 -0
- package/dist/errors/RefExpiredError.cjs +7 -0
- package/dist/errors/RefExpiredError.cjs.map +1 -0
- package/dist/errors/RefExpiredError.d.ts +8 -0
- package/dist/errors/RefExpiredError.js +7 -0
- package/dist/errors/RefExpiredError.js.map +1 -0
- package/dist/errors/RefNotFoundError.cjs +7 -0
- package/dist/errors/RefNotFoundError.cjs.map +1 -0
- package/dist/errors/RefNotFoundError.d.ts +8 -0
- package/dist/errors/RefNotFoundError.js +7 -0
- package/dist/errors/RefNotFoundError.js.map +1 -0
- package/dist/errors/RepositoryNotFoundError.cjs +7 -0
- package/dist/errors/RepositoryNotFoundError.cjs.map +1 -0
- package/dist/errors/RepositoryNotFoundError.d.ts +3 -0
- package/dist/errors/RepositoryNotFoundError.js +7 -0
- package/dist/errors/RepositoryNotFoundError.js.map +1 -0
- package/dist/filter.cjs +247 -0
- package/dist/filter.cjs.map +1 -0
- package/dist/filter.d.ts +209 -0
- package/dist/filter.js +247 -0
- package/dist/filter.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +13 -0
- package/dist/getGraphQLEndpoint.cjs.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +10 -0
- package/dist/getGraphQLEndpoint.js +13 -0
- package/dist/getGraphQLEndpoint.js.map +1 -0
- package/dist/getRepositoryEndpoint.cjs +13 -0
- package/dist/getRepositoryEndpoint.cjs.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +19 -0
- package/dist/getRepositoryEndpoint.js +13 -0
- package/dist/getRepositoryEndpoint.js.map +1 -0
- package/dist/getRepositoryName.cjs +17 -0
- package/dist/getRepositoryName.cjs.map +1 -0
- package/dist/getRepositoryName.d.ts +12 -0
- package/dist/getRepositoryName.js +17 -0
- package/dist/getRepositoryName.js.map +1 -0
- package/dist/getToolbarSrc.cjs +13 -0
- package/dist/getToolbarSrc.cjs.map +1 -0
- package/dist/getToolbarSrc.d.ts +34 -0
- package/dist/getToolbarSrc.js +13 -0
- package/dist/getToolbarSrc.js.map +1 -0
- package/dist/helpers/asDate.cjs +14 -0
- package/dist/helpers/asDate.cjs.map +1 -0
- package/dist/helpers/asDate.d.ts +24 -0
- package/dist/helpers/asDate.js +14 -0
- package/dist/helpers/asDate.js.map +1 -0
- package/dist/helpers/asHTML.cjs +86 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.ts +149 -0
- package/dist/helpers/asHTML.js +86 -0
- package/dist/helpers/asHTML.js.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +54 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
- package/dist/helpers/asImageSrc.cjs +13 -0
- package/dist/helpers/asImageSrc.cjs.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +29 -0
- package/dist/helpers/asImageSrc.js +13 -0
- package/dist/helpers/asImageSrc.js.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.cjs +45 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +62 -0
- package/dist/helpers/asImageWidthSrcSet.js +45 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +47 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.ts +78 -0
- package/dist/helpers/asLink.js +47 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asLinkAttrs.cjs +28 -0
- package/dist/helpers/asLinkAttrs.cjs.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +47 -0
- package/dist/helpers/asLinkAttrs.js +28 -0
- package/dist/helpers/asLinkAttrs.js.map +1 -0
- package/dist/helpers/asText.cjs +21 -0
- package/dist/helpers/asText.cjs.map +1 -0
- package/dist/helpers/asText.d.ts +57 -0
- package/dist/helpers/asText.js +21 -0
- package/dist/helpers/asText.js.map +1 -0
- package/dist/helpers/documentToLinkField.cjs +26 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +17 -0
- package/dist/helpers/documentToLinkField.js +26 -0
- package/dist/helpers/documentToLinkField.js.map +1 -0
- package/dist/helpers/isFilled.cjs +77 -0
- package/dist/helpers/isFilled.cjs.map +1 -0
- package/dist/helpers/isFilled.d.ts +191 -0
- package/dist/helpers/isFilled.js +77 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/helpers/mapSliceZone.cjs +42 -0
- package/dist/helpers/mapSliceZone.cjs.map +1 -0
- package/dist/helpers/mapSliceZone.d.ts +136 -0
- package/dist/helpers/mapSliceZone.js +42 -0
- package/dist/helpers/mapSliceZone.js.map +1 -0
- package/dist/index.cjs +94 -3880
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +129 -4349
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/isRepositoryEndpoint.cjs +12 -0
- package/dist/isRepositoryEndpoint.cjs.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +10 -0
- package/dist/isRepositoryEndpoint.js +12 -0
- package/dist/isRepositoryEndpoint.js.map +1 -0
- package/dist/isRepositoryName.cjs +7 -0
- package/dist/isRepositoryName.cjs.map +1 -0
- package/dist/isRepositoryName.d.ts +9 -0
- package/dist/isRepositoryName.js +7 -0
- package/dist/isRepositoryName.js.map +1 -0
- package/dist/lib/appendFilters.cjs +11 -0
- package/dist/lib/appendFilters.cjs.map +1 -0
- package/dist/lib/appendFilters.d.ts +18 -0
- package/dist/lib/appendFilters.js +11 -0
- package/dist/lib/appendFilters.js.map +1 -0
- package/dist/lib/castArray.cjs +7 -0
- package/dist/lib/castArray.cjs.map +1 -0
- package/dist/lib/castArray.d.ts +12 -0
- package/dist/lib/castArray.js +7 -0
- package/dist/lib/castArray.js.map +1 -0
- package/dist/lib/castThunk.cjs +7 -0
- package/dist/lib/castThunk.cjs.map +1 -0
- package/dist/lib/castThunk.d.ts +11 -0
- package/dist/lib/castThunk.js +7 -0
- package/dist/lib/castThunk.js.map +1 -0
- package/dist/lib/devMsg.cjs +8 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.d.ts +16 -0
- package/dist/lib/devMsg.js +8 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/escapeHTML.cjs +43 -0
- package/dist/lib/escapeHTML.cjs.map +1 -0
- package/dist/lib/escapeHTML.d.ts +1 -0
- package/dist/lib/escapeHTML.js +43 -0
- package/dist/lib/escapeHTML.js.map +1 -0
- package/dist/lib/everyTagFilter.cjs +9 -0
- package/dist/lib/everyTagFilter.cjs.map +1 -0
- package/dist/lib/everyTagFilter.d.ts +9 -0
- package/dist/lib/everyTagFilter.js +9 -0
- package/dist/lib/everyTagFilter.js.map +1 -0
- package/dist/lib/findMasterRef.cjs +8 -0
- package/dist/lib/findMasterRef.cjs.map +1 -0
- package/dist/lib/findMasterRef.d.ts +11 -0
- package/dist/lib/findMasterRef.js +8 -0
- package/dist/lib/findMasterRef.js.map +1 -0
- package/dist/lib/findRef.cjs +12 -0
- package/dist/lib/findRef.cjs.map +1 -0
- package/dist/lib/findRef.d.ts +14 -0
- package/dist/lib/findRef.js +12 -0
- package/dist/lib/findRef.js.map +1 -0
- package/dist/lib/findRefByID.cjs +8 -0
- package/dist/lib/findRefByID.cjs.map +1 -0
- package/dist/lib/findRefByID.d.ts +12 -0
- package/dist/lib/findRefByID.js +8 -0
- package/dist/lib/findRefByID.js.map +1 -0
- package/dist/lib/findRefByLabel.cjs +8 -0
- package/dist/lib/findRefByLabel.cjs.map +1 -0
- package/dist/lib/findRefByLabel.d.ts +12 -0
- package/dist/lib/findRefByLabel.js +8 -0
- package/dist/lib/findRefByLabel.js.map +1 -0
- package/dist/lib/getOptionalLinkProperties.cjs +14 -0
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -0
- package/dist/lib/getOptionalLinkProperties.d.ts +12 -0
- package/dist/lib/getOptionalLinkProperties.js +14 -0
- package/dist/lib/getOptionalLinkProperties.js.map +1 -0
- package/dist/lib/getPreviewCookie.cjs +21 -0
- package/dist/lib/getPreviewCookie.cjs.map +1 -0
- package/dist/lib/getPreviewCookie.d.ts +9 -0
- package/dist/lib/getPreviewCookie.js +21 -0
- package/dist/lib/getPreviewCookie.js.map +1 -0
- package/dist/lib/isInternalURL.cjs +9 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.d.ts +8 -0
- package/dist/lib/isInternalURL.js +9 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/isMigrationValue.cjs +24 -0
- package/dist/lib/isMigrationValue.cjs.map +1 -0
- package/dist/lib/isMigrationValue.d.ts +71 -0
- package/dist/lib/isMigrationValue.js +24 -0
- package/dist/lib/isMigrationValue.js.map +1 -0
- package/dist/lib/isValue.cjs +53 -0
- package/dist/lib/isValue.cjs.map +1 -0
- package/dist/lib/isValue.d.ts +78 -0
- package/dist/lib/isValue.js +53 -0
- package/dist/lib/isValue.js.map +1 -0
- package/dist/lib/minifyGraphQLQuery.cjs +7 -0
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
- package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
- package/dist/lib/minifyGraphQLQuery.js +7 -0
- package/dist/lib/minifyGraphQLQuery.js.map +1 -0
- package/dist/lib/pLimit.cjs +48 -0
- package/dist/lib/pLimit.cjs.map +1 -0
- package/dist/lib/pLimit.d.ts +22 -0
- package/dist/lib/pLimit.js +48 -0
- package/dist/lib/pLimit.js.map +1 -0
- package/dist/lib/request.cjs +41 -0
- package/dist/lib/request.cjs.map +1 -0
- package/dist/lib/request.d.ts +73 -0
- package/dist/lib/request.js +41 -0
- package/dist/lib/request.js.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.cjs +132 -0
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.d.ts +54 -0
- package/dist/lib/resolveMigrationDocumentData.js +132 -0
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
- package/dist/lib/serializerHelpers.cjs +113 -0
- package/dist/lib/serializerHelpers.cjs.map +1 -0
- package/dist/lib/serializerHelpers.d.ts +9 -0
- package/dist/lib/serializerHelpers.js +113 -0
- package/dist/lib/serializerHelpers.js.map +1 -0
- package/dist/lib/someTagsFilter.cjs +9 -0
- package/dist/lib/someTagsFilter.cjs.map +1 -0
- package/dist/lib/someTagsFilter.d.ts +9 -0
- package/dist/lib/someTagsFilter.js +9 -0
- package/dist/lib/someTagsFilter.js.map +1 -0
- package/dist/lib/throttledLog.cjs +17 -0
- package/dist/lib/throttledLog.cjs.map +1 -0
- package/dist/lib/throttledLog.d.ts +15 -0
- package/dist/lib/throttledLog.js +17 -0
- package/dist/lib/throttledLog.js.map +1 -0
- package/dist/lib/typeFilter.cjs +8 -0
- package/dist/lib/typeFilter.cjs.map +1 -0
- package/dist/lib/typeFilter.d.ts +8 -0
- package/dist/lib/typeFilter.js +8 -0
- package/dist/lib/typeFilter.js.map +1 -0
- package/dist/lib/validateAssetMetadata.cjs +28 -0
- package/dist/lib/validateAssetMetadata.cjs.map +1 -0
- package/dist/lib/validateAssetMetadata.d.ts +10 -0
- package/dist/lib/validateAssetMetadata.js +28 -0
- package/dist/lib/validateAssetMetadata.js.map +1 -0
- package/dist/package.json.cjs +7 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +7 -0
- package/dist/package.json.js.map +1 -0
- package/dist/richtext/asText.cjs +13 -0
- package/dist/richtext/asText.cjs.map +1 -0
- package/dist/richtext/asText.d.ts +12 -0
- package/dist/richtext/asText.js +13 -0
- package/dist/richtext/asText.js.map +1 -0
- package/dist/richtext/asTree.cjs +123 -0
- package/dist/richtext/asTree.cjs.map +1 -0
- package/dist/richtext/asTree.d.ts +14 -0
- package/dist/richtext/asTree.js +123 -0
- package/dist/richtext/asTree.js.map +1 -0
- package/dist/richtext/composeSerializers.cjs +17 -0
- package/dist/richtext/composeSerializers.cjs.map +1 -0
- package/dist/richtext/composeSerializers.d.ts +16 -0
- package/dist/richtext/composeSerializers.js +17 -0
- package/dist/richtext/composeSerializers.js.map +1 -0
- package/dist/richtext/index.d.ts +7 -78
- package/dist/richtext/serialize.cjs +19 -0
- package/dist/richtext/serialize.cjs.map +1 -0
- package/dist/richtext/serialize.d.ts +19 -0
- package/dist/richtext/serialize.js +19 -0
- package/dist/richtext/serialize.js.map +1 -0
- package/dist/richtext/types.cjs +11 -0
- package/dist/richtext/types.cjs.map +1 -0
- package/dist/richtext/types.d.ts +71 -0
- package/dist/richtext/types.js +11 -0
- package/dist/richtext/types.js.map +1 -0
- package/dist/richtext/wrapMapSerializer.cjs +24 -0
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.ts +15 -0
- package/dist/richtext/wrapMapSerializer.js +24 -0
- package/dist/richtext/wrapMapSerializer.js.map +1 -0
- package/dist/richtext.cjs +15 -0
- package/dist/richtext.cjs.map +1 -0
- package/dist/richtext.js +15 -0
- package/dist/richtext.js.map +1 -0
- package/dist/types/api/asset/asset.d.ts +177 -0
- package/dist/types/api/asset/tag.d.ts +53 -0
- package/dist/types/api/integration.d.ts +28 -0
- package/dist/types/api/migration/document.d.ts +60 -0
- package/dist/types/api/query.d.ts +43 -0
- package/dist/types/api/ref.d.ts +32 -0
- package/dist/types/api/release.d.ts +11 -0
- package/dist/types/api/repository.d.ts +109 -0
- package/dist/types/api/tags.d.ts +9 -0
- package/dist/types/migration/Asset.cjs +30 -0
- package/dist/types/migration/Asset.cjs.map +1 -0
- package/dist/types/migration/Asset.d.ts +108 -0
- package/dist/types/migration/Asset.js +30 -0
- package/dist/types/migration/Asset.js.map +1 -0
- package/dist/types/migration/ContentRelationship.d.ts +16 -0
- package/dist/types/migration/Document.cjs +44 -0
- package/dist/types/migration/Document.cjs.map +1 -0
- package/dist/types/migration/Document.d.ts +94 -0
- package/dist/types/migration/Document.js +44 -0
- package/dist/types/migration/Document.js.map +1 -0
- package/dist/types/migration/Link.d.ts +19 -0
- package/dist/types/model/boolean.d.ts +15 -0
- package/dist/types/model/color.d.ts +13 -0
- package/dist/types/model/contentRelationship.d.ts +53 -0
- package/dist/types/model/customType.d.ts +48 -0
- package/dist/types/model/date.d.ts +14 -0
- package/dist/types/model/embed.d.ts +13 -0
- package/dist/types/model/geoPoint.d.ts +12 -0
- package/dist/types/model/group.d.ts +23 -0
- package/dist/types/model/image.d.ts +31 -0
- package/dist/types/model/integration.d.ts +14 -0
- package/dist/types/model/keyText.d.ts +13 -0
- package/dist/types/model/link.cjs +9 -0
- package/dist/types/model/link.cjs.map +1 -0
- package/dist/types/model/link.d.ts +28 -0
- package/dist/types/model/link.js +9 -0
- package/dist/types/model/link.js.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +17 -0
- package/dist/types/model/number.d.ts +15 -0
- package/dist/types/model/range.d.ts +14 -0
- package/dist/types/model/richText.d.ts +37 -0
- package/dist/types/model/select.d.ts +18 -0
- package/dist/types/model/separator.d.ts +10 -0
- package/dist/types/model/sharedSlice.d.ts +16 -0
- package/dist/types/model/sharedSliceVariation.d.ts +19 -0
- package/dist/types/model/slice.cjs +8 -0
- package/dist/types/model/slice.cjs.map +1 -0
- package/dist/types/model/slice.d.ts +33 -0
- package/dist/types/model/slice.js +8 -0
- package/dist/types/model/slice.js.map +1 -0
- package/dist/types/model/sliceZone.cjs +8 -0
- package/dist/types/model/sliceZone.cjs.map +1 -0
- package/dist/types/model/sliceZone.d.ts +41 -0
- package/dist/types/model/sliceZone.js +8 -0
- package/dist/types/model/sliceZone.js.map +1 -0
- package/dist/types/model/table.d.ts +12 -0
- package/dist/types/model/timestamp.d.ts +14 -0
- package/dist/types/model/title.d.ts +7 -0
- package/dist/types/model/types.cjs +39 -0
- package/dist/types/model/types.cjs.map +1 -0
- package/dist/types/model/types.d.ts +76 -0
- package/dist/types/model/types.js +39 -0
- package/dist/types/model/types.js.map +1 -0
- package/dist/types/model/uid.d.ts +13 -0
- package/dist/types/value/boolean.d.ts +6 -0
- package/dist/types/value/color.d.ts +9 -0
- package/dist/types/value/contentRelationship.d.ts +31 -0
- package/dist/types/value/date.d.ts +9 -0
- package/dist/types/value/document.d.ts +114 -0
- package/dist/types/value/embed.cjs +10 -0
- package/dist/types/value/embed.cjs.map +1 -0
- package/dist/types/value/embed.d.ts +168 -0
- package/dist/types/value/embed.js +10 -0
- package/dist/types/value/embed.js.map +1 -0
- package/dist/types/value/geoPoint.d.ts +12 -0
- package/dist/types/value/group.d.ts +13 -0
- package/dist/types/value/image.d.ts +47 -0
- package/dist/types/value/integration.d.ts +16 -0
- package/dist/types/value/keyText.d.ts +9 -0
- package/dist/types/value/link.cjs +10 -0
- package/dist/types/value/link.cjs.map +1 -0
- package/dist/types/value/link.d.ts +68 -0
- package/dist/types/value/link.js +10 -0
- package/dist/types/value/link.js.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +28 -0
- package/dist/types/value/number.d.ts +9 -0
- package/dist/types/value/richText.cjs +25 -0
- package/dist/types/value/richText.cjs.map +1 -0
- package/dist/types/value/richText.d.ts +215 -0
- package/dist/types/value/richText.js +25 -0
- package/dist/types/value/richText.js.map +1 -0
- package/dist/types/value/select.d.ts +10 -0
- package/dist/types/value/sharedSlice.d.ts +11 -0
- package/dist/types/value/sharedSliceVariation.d.ts +10 -0
- package/dist/types/value/slice.d.ts +13 -0
- package/dist/types/value/sliceZone.d.ts +12 -0
- package/dist/types/value/table.d.ts +91 -0
- package/dist/types/value/timestamp.d.ts +8 -0
- package/dist/types/value/title.d.ts +12 -0
- package/dist/types/value/types.d.ts +58 -0
- package/dist/types/webhook/apiUpdate.d.ts +52 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -0
- package/dist/types/webhook/types.cjs +8 -0
- package/dist/types/webhook/types.cjs.map +1 -0
- package/dist/types/webhook/types.d.ts +18 -0
- package/dist/types/webhook/types.js +8 -0
- package/dist/types/webhook/types.js.map +1 -0
- package/package.json +34 -11
- package/src/WriteClient.ts +21 -32
- package/src/index.ts +1 -0
- package/src/types/model/contentRelationship.ts +1 -0
- package/dist/index.d.cts +0 -4424
- package/dist/index.d.mts +0 -4424
- package/dist/index.mjs +0 -3837
- package/dist/index.mjs.map +0 -1
- package/dist/richtext/index.cjs +0 -244
- package/dist/richtext/index.cjs.map +0 -1
- package/dist/richtext/index.d.cts +0 -78
- package/dist/richtext/index.d.mts +0 -78
- package/dist/richtext/index.mjs +0 -237
- package/dist/richtext/index.mjs.map +0 -1
- package/dist/shared/client.TSGr56lO.d.cts +0 -899
- package/dist/shared/client.TSGr56lO.d.mts +0 -899
- package/dist/shared/client.TSGr56lO.d.ts +0 -899
package/dist/index.d.mts
DELETED
|
@@ -1,4424 +0,0 @@
|
|
|
1
|
-
import { A as AnyRegularField, G as GroupField, S as SliceZone, T as TimestampField, F as FilledContentRelationshipField, L as LinkField, a as FilledLinkToWebField, b as FilledLinkToMediaField, R as RichTextMapSerializer, c as RichTextMapSerializerFunction, d as RichTextFunctionSerializer, e as RichTextField, f as Slice, C as ContentRelationshipField, g as RTImageNode, h as FilledImageFieldImage, E as EmbedField, i as AnyOEmbed, O as OEmbedExtra, j as SharedSlice, k as LinkToMediaField, D as DateField, I as ImageFieldImage, l as TitleField, m as ImageField, n as EmptyContentRelationshipField, o as ColorField, N as NumberField, K as KeyTextField, p as SelectField, q as GeoPointField, r as TableField, s as IntegrationFieldData, t as IntegrationField, u as Repeatable, v as NestedGroupField } from './shared/client.TSGr56lO.mjs';
|
|
2
|
-
export { aq as AnySlicePrimaryField, an as BooleanField, ab as EmptyImageFieldImage, ac as EmptyLinkField, ap as FieldState, af as LinkOEmbed, x as LinkType, y as OEmbedType, ad as PhotoOEmbed, a9 as RTAnyNode, a7 as RTBlockNode, _ as RTEmNode, a0 as RTEmbedNode, B as RTHeading1Node, H as RTHeading2Node, J as RTHeading3Node, M as RTHeading4Node, P as RTHeading5Node, Q as RTHeading6Node, a8 as RTInlineNode, $ as RTLabelNode, a1 as RTLinkNode, W as RTListItemNode, a2 as RTListNode, a5 as RTNode, X as RTOListItemNode, a3 as RTOListNode, U as RTParagraphNode, V as RTPreformattedNode, a4 as RTSpanNode, Y as RTSpanNodeBase, Z as RTStrongNode, a6 as RTTextNode, z as RTTextNodeBase, ag as RichOEmbed, w as RichTextNodeType, aa as RichTextNodeTypes, ao as SharedSliceVariation, aj as TableFieldBody, ak as TableFieldBodyRow, am as TableFieldDataCell, ah as TableFieldHead, ai as TableFieldHeadRow, al as TableFieldHeaderCell, ae as VideoOEmbed } from './shared/client.TSGr56lO.mjs';
|
|
3
|
-
import { ImgixURLParams, BuildWidthSrcSetParams, BuildPixelDensitySrcSetParams } from 'imgix-url-builder';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A boolean custom type field.
|
|
7
|
-
*
|
|
8
|
-
* More details: {@link https://prismic.io/docs/boolean}
|
|
9
|
-
*/
|
|
10
|
-
interface CustomTypeModelBooleanField {
|
|
11
|
-
type: typeof CustomTypeModelFieldType.Boolean;
|
|
12
|
-
config?: {
|
|
13
|
-
label?: string | null;
|
|
14
|
-
default_value?: boolean;
|
|
15
|
-
placeholder_true?: string;
|
|
16
|
-
placeholder_false?: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A color custom type field.
|
|
22
|
-
*
|
|
23
|
-
* More details: {@link https://prismic.io/docs/color}
|
|
24
|
-
*/
|
|
25
|
-
interface CustomTypeModelColorField {
|
|
26
|
-
type: typeof CustomTypeModelFieldType.Color;
|
|
27
|
-
config?: {
|
|
28
|
-
label?: string | null;
|
|
29
|
-
placeholder?: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* A link custom type field.
|
|
35
|
-
*
|
|
36
|
-
* More details: {@link https://prismic.io/docs/link}
|
|
37
|
-
*/
|
|
38
|
-
interface CustomTypeModelLinkField {
|
|
39
|
-
type: typeof CustomTypeModelFieldType.Link;
|
|
40
|
-
config?: {
|
|
41
|
-
label?: string | null;
|
|
42
|
-
placeholder?: string;
|
|
43
|
-
select?: null | (typeof CustomTypeModelLinkSelectType)[keyof typeof CustomTypeModelLinkSelectType];
|
|
44
|
-
allowText?: boolean;
|
|
45
|
-
allowTargetBlank?: boolean;
|
|
46
|
-
repeat?: boolean;
|
|
47
|
-
variants?: string[];
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Type of a link custom type field.
|
|
52
|
-
*
|
|
53
|
-
* More details: {@link https://prismic.io/docs/link}
|
|
54
|
-
*/
|
|
55
|
-
declare const CustomTypeModelLinkSelectType: {
|
|
56
|
-
readonly Document: "document";
|
|
57
|
-
readonly Media: "media";
|
|
58
|
-
readonly Web: "web";
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @internal
|
|
63
|
-
*/
|
|
64
|
-
type CustomTypeModelFetchGroupLevel2 = {
|
|
65
|
-
id: string;
|
|
66
|
-
fields: ReadonlyArray<string>;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
type CustomTypeModelFetchCustomTypeLevel2 = {
|
|
72
|
-
id: string;
|
|
73
|
-
fields: ReadonlyArray<string | CustomTypeModelFetchGroupLevel2>;
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
type CustomTypeModelFetchGroupLevel1 = {
|
|
79
|
-
id: string;
|
|
80
|
-
fields: ReadonlyArray<string | CustomTypeModelFetchContentRelationshipLevel1>;
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* @internal
|
|
84
|
-
*/
|
|
85
|
-
type CustomTypeModelFetchContentRelationshipLevel1 = {
|
|
86
|
-
id: string;
|
|
87
|
-
customtypes: ReadonlyArray<string | CustomTypeModelFetchCustomTypeLevel2>;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* @internal
|
|
91
|
-
*/
|
|
92
|
-
type CustomTypeModelFetchCustomTypeLevel1 = {
|
|
93
|
-
id: string;
|
|
94
|
-
fields: ReadonlyArray<string | CustomTypeModelFetchGroupLevel1 | CustomTypeModelFetchContentRelationshipLevel1>;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* A content relationship custom type field.
|
|
98
|
-
*
|
|
99
|
-
* More details: {@link https://prismic.io/docs/content-relationship}
|
|
100
|
-
*/
|
|
101
|
-
interface CustomTypeModelContentRelationshipField<CustomTypes extends string | CustomTypeModelFetchCustomTypeLevel1 = string | CustomTypeModelFetchCustomTypeLevel1, Tags extends string = string> {
|
|
102
|
-
type: typeof CustomTypeModelFieldType.Link;
|
|
103
|
-
config?: {
|
|
104
|
-
label?: string | null;
|
|
105
|
-
placeholder?: string;
|
|
106
|
-
select: typeof CustomTypeModelLinkSelectType.Document;
|
|
107
|
-
customtypes?: readonly CustomTypes[];
|
|
108
|
-
tags?: readonly Tags[];
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* A date custom type field.
|
|
114
|
-
*
|
|
115
|
-
* More details: {@link https://prismic.io/docs/date}
|
|
116
|
-
*/
|
|
117
|
-
interface CustomTypeModelDateField {
|
|
118
|
-
type: typeof CustomTypeModelFieldType.Date;
|
|
119
|
-
config?: {
|
|
120
|
-
label?: string | null;
|
|
121
|
-
placeholder?: string;
|
|
122
|
-
default?: string;
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* An embed custom type field.
|
|
128
|
-
*
|
|
129
|
-
* More details: {@link https://prismic.io/docs/embed}
|
|
130
|
-
*/
|
|
131
|
-
interface CustomTypeModelEmbedField {
|
|
132
|
-
type: typeof CustomTypeModelFieldType.Embed;
|
|
133
|
-
config?: {
|
|
134
|
-
label?: string | null;
|
|
135
|
-
placeholder?: string;
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* A geopoint custom type field.
|
|
141
|
-
*
|
|
142
|
-
* More details: {@link https://prismic.io/docs/geopoint}
|
|
143
|
-
*/
|
|
144
|
-
interface CustomTypeModelGeoPointField {
|
|
145
|
-
type: typeof CustomTypeModelFieldType.GeoPoint;
|
|
146
|
-
config?: {
|
|
147
|
-
label?: string | null;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* A group custom type field.
|
|
153
|
-
*
|
|
154
|
-
* More details: {@link https://prismic.io/docs/group}
|
|
155
|
-
*
|
|
156
|
-
* @typeParam Fields - A record of fields that can be repeated.
|
|
157
|
-
*/
|
|
158
|
-
interface CustomTypeModelGroupField<Fields extends Record<string, CustomTypeModelFieldForGroup> = Record<string, CustomTypeModelFieldForGroup>> {
|
|
159
|
-
type: typeof CustomTypeModelFieldType.Group;
|
|
160
|
-
config?: {
|
|
161
|
-
label?: string | null;
|
|
162
|
-
fields?: Fields;
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* A nested group custom type field.
|
|
167
|
-
*
|
|
168
|
-
* More details: {@link https://prismic.io/docs/group}
|
|
169
|
-
*
|
|
170
|
-
* @typeParam Fields - A record of fields that can be repeated.
|
|
171
|
-
*/
|
|
172
|
-
type CustomTypeModelNestedGroupField<Fields extends Record<string, CustomTypeModelFieldForNestedGroup> = Record<string, CustomTypeModelFieldForNestedGroup>> = CustomTypeModelGroupField<Fields>;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Dimension constraints for an image custom type field.
|
|
176
|
-
*
|
|
177
|
-
* More details: {@link https://prismic.io/docs/image}
|
|
178
|
-
*/
|
|
179
|
-
interface CustomTypeModelImageConstraint {
|
|
180
|
-
width?: number | null;
|
|
181
|
-
height?: number | null;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* A thumbnail for an image custom type field.
|
|
185
|
-
*
|
|
186
|
-
* More details: {@link https://prismic.io/docs/image}
|
|
187
|
-
*/
|
|
188
|
-
interface CustomTypeModelImageThumbnail<Name extends string = string> extends CustomTypeModelImageConstraint {
|
|
189
|
-
name: Name;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* An image custom type field.
|
|
193
|
-
*
|
|
194
|
-
* More details: {@link https://prismic.io/docs/image}
|
|
195
|
-
*/
|
|
196
|
-
interface CustomTypeModelImageField<ThumbnailNames extends string = string> {
|
|
197
|
-
type: typeof CustomTypeModelFieldType.Image;
|
|
198
|
-
config?: {
|
|
199
|
-
label?: string | null;
|
|
200
|
-
constraint?: CustomTypeModelImageConstraint;
|
|
201
|
-
thumbnails?: readonly CustomTypeModelImageThumbnail<ThumbnailNames>[];
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* A key text custom type field.
|
|
207
|
-
*
|
|
208
|
-
* More details: {@link https://prismic.io/docs/key-text}
|
|
209
|
-
*/
|
|
210
|
-
interface CustomTypeModelKeyTextField {
|
|
211
|
-
type: typeof CustomTypeModelFieldType.Text;
|
|
212
|
-
config?: {
|
|
213
|
-
label?: string | null;
|
|
214
|
-
placeholder?: string;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* A link to media custom type field.
|
|
220
|
-
*
|
|
221
|
-
* More details: {@link https://prismic.io/docs/media}
|
|
222
|
-
*/
|
|
223
|
-
interface CustomTypeModelLinkToMediaField {
|
|
224
|
-
type: typeof CustomTypeModelFieldType.Link;
|
|
225
|
-
config?: {
|
|
226
|
-
label?: string | null;
|
|
227
|
-
placeholder?: string;
|
|
228
|
-
select: typeof CustomTypeModelLinkSelectType.Media;
|
|
229
|
-
allowText?: boolean;
|
|
230
|
-
variants?: string[];
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* A number custom type field.
|
|
236
|
-
*
|
|
237
|
-
* More details: {@link https://prismic.io/docs/number}
|
|
238
|
-
*/
|
|
239
|
-
interface CustomTypeModelNumberField {
|
|
240
|
-
type: typeof CustomTypeModelFieldType.Number;
|
|
241
|
-
config?: {
|
|
242
|
-
label?: string | null;
|
|
243
|
-
placeholder?: string;
|
|
244
|
-
min?: number;
|
|
245
|
-
max?: number;
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* @deprecated - Legacy field. Use `CustomTypeModelNumberField` instead.
|
|
251
|
-
*/
|
|
252
|
-
interface CustomTypeModelRangeField {
|
|
253
|
-
type: typeof CustomTypeModelFieldType.Range;
|
|
254
|
-
config?: {
|
|
255
|
-
label?: string | null;
|
|
256
|
-
placeholder?: string;
|
|
257
|
-
min?: number;
|
|
258
|
-
max?: number;
|
|
259
|
-
step?: number;
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* A rich text custom type field.
|
|
265
|
-
*
|
|
266
|
-
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
267
|
-
*/
|
|
268
|
-
type CustomTypeModelRichTextField = CustomTypeModelRichTextMultiField | CustomTypeModelRichTextSingleField;
|
|
269
|
-
/**
|
|
270
|
-
* A rich text custom type field which supports multiple blocks of content.
|
|
271
|
-
*
|
|
272
|
-
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
273
|
-
*/
|
|
274
|
-
interface CustomTypeModelRichTextMultiField {
|
|
275
|
-
type: typeof CustomTypeModelFieldType.StructuredText;
|
|
276
|
-
config?: {
|
|
277
|
-
label?: string | null;
|
|
278
|
-
placeholder?: string;
|
|
279
|
-
allowTargetBlank?: boolean;
|
|
280
|
-
multi?: string;
|
|
281
|
-
labels?: readonly string[];
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* A rich text custom type field which supports one block of content.
|
|
286
|
-
*
|
|
287
|
-
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
288
|
-
*/
|
|
289
|
-
interface CustomTypeModelRichTextSingleField {
|
|
290
|
-
type: typeof CustomTypeModelFieldType.StructuredText;
|
|
291
|
-
config?: {
|
|
292
|
-
label?: string | null;
|
|
293
|
-
placeholder?: string;
|
|
294
|
-
allowTargetBlank?: boolean;
|
|
295
|
-
single?: string;
|
|
296
|
-
labels?: readonly string[];
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* A select custom type field.
|
|
302
|
-
*
|
|
303
|
-
* More details: {@link https://prismic.io/docs/select}
|
|
304
|
-
*
|
|
305
|
-
* @typeParam Options - Options for the field.
|
|
306
|
-
* @typeParam DefaultValue - Default value for the field.
|
|
307
|
-
*/
|
|
308
|
-
interface CustomTypeModelSelectField<Option extends string = string, DefaultValue extends Option = Option> {
|
|
309
|
-
type: typeof CustomTypeModelFieldType.Select;
|
|
310
|
-
config?: {
|
|
311
|
-
label?: string | null;
|
|
312
|
-
placeholder?: string;
|
|
313
|
-
options?: readonly Option[];
|
|
314
|
-
default_value?: DefaultValue;
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* @deprecated - Legacy field. Do not use.
|
|
320
|
-
*/
|
|
321
|
-
interface CustomTypeModelSeparatorField {
|
|
322
|
-
type: typeof CustomTypeModelFieldType.Separator;
|
|
323
|
-
config?: {
|
|
324
|
-
label?: string | null;
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* A Slice for a custom type.
|
|
330
|
-
*
|
|
331
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
332
|
-
*
|
|
333
|
-
* @typeParam NonRepeatFields - A record of fields that cannnot be repeated.
|
|
334
|
-
* @typeParam RepeatFields - A record of fields that can be repeated.
|
|
335
|
-
*/
|
|
336
|
-
interface CustomTypeModelSlice<NonRepeatFields extends Record<string, CustomTypeModelFieldForNestedGroup> = Record<string, CustomTypeModelFieldForNestedGroup>, RepeatFields extends Record<string, CustomTypeModelFieldForNestedGroup> = Record<string, CustomTypeModelFieldForNestedGroup>> {
|
|
337
|
-
type: typeof CustomTypeModelSliceType.Slice;
|
|
338
|
-
fieldset?: string | null;
|
|
339
|
-
description?: string;
|
|
340
|
-
icon?: string;
|
|
341
|
-
display?: (typeof CustomTypeModelSliceDisplay)[keyof typeof CustomTypeModelSliceDisplay] | string;
|
|
342
|
-
"non-repeat"?: NonRepeatFields;
|
|
343
|
-
repeat?: RepeatFields;
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Display type for a Slice.
|
|
347
|
-
*
|
|
348
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
349
|
-
*/
|
|
350
|
-
declare const CustomTypeModelSliceDisplay: {
|
|
351
|
-
readonly List: "list";
|
|
352
|
-
readonly Grid: "grid";
|
|
353
|
-
};
|
|
354
|
-
/**
|
|
355
|
-
* @deprecated - Legacy slice type. Do not use.
|
|
356
|
-
*/
|
|
357
|
-
type CustomTypeModelLegacySlice = CustomTypeModelNestedGroupField | CustomTypeModelFieldForNestedGroup;
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* A Slice Zone custom type field.
|
|
361
|
-
*
|
|
362
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
363
|
-
*/
|
|
364
|
-
interface CustomTypeModelSliceZoneField<Slices extends Record<string, CustomTypeModelSlice | CustomTypeModelSharedSlice | CustomTypeModelLegacySlice> = Record<string, CustomTypeModelSlice | CustomTypeModelSharedSlice | CustomTypeModelLegacySlice>> {
|
|
365
|
-
type: typeof CustomTypeModelFieldType.Slices | typeof CustomTypeModelFieldType.LegacySlices;
|
|
366
|
-
fieldset?: string | null;
|
|
367
|
-
config?: {
|
|
368
|
-
labels?: Record<string, readonly CustomTypeModelSliceLabel[]> | null;
|
|
369
|
-
choices?: Slices;
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Label for a Slice.
|
|
374
|
-
*
|
|
375
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
376
|
-
*/
|
|
377
|
-
interface CustomTypeModelSliceLabel {
|
|
378
|
-
name: string;
|
|
379
|
-
display?: string;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Type identifier for a Slice.
|
|
383
|
-
*
|
|
384
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
385
|
-
*/
|
|
386
|
-
declare const CustomTypeModelSliceType: {
|
|
387
|
-
readonly Slice: "Slice";
|
|
388
|
-
readonly SharedSlice: "SharedSlice";
|
|
389
|
-
};
|
|
390
|
-
/**
|
|
391
|
-
* A shared Slice for a custom type.
|
|
392
|
-
*
|
|
393
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
394
|
-
*/
|
|
395
|
-
interface CustomTypeModelSharedSlice {
|
|
396
|
-
type: typeof CustomTypeModelSliceType.SharedSlice;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* A table custom type field.
|
|
401
|
-
*
|
|
402
|
-
* More details: {@link https://prismic.io/docs/table}
|
|
403
|
-
*/
|
|
404
|
-
interface CustomTypeModelTableField {
|
|
405
|
-
type: typeof CustomTypeModelFieldType.Table;
|
|
406
|
-
config?: {
|
|
407
|
-
label?: string | null;
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* A timestamp custom type field.
|
|
413
|
-
*
|
|
414
|
-
* More details: {@link https://prismic.io/docs/timestamp}
|
|
415
|
-
*/
|
|
416
|
-
interface CustomTypeModelTimestampField {
|
|
417
|
-
type: typeof CustomTypeModelFieldType.Timestamp;
|
|
418
|
-
config?: {
|
|
419
|
-
label?: string | null;
|
|
420
|
-
placeholder?: string;
|
|
421
|
-
default?: string;
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* A title custom type field.
|
|
427
|
-
*
|
|
428
|
-
* More details: {@link https://prismic.io/docs/rich-text-title}
|
|
429
|
-
*/
|
|
430
|
-
type CustomTypeModelTitleField = CustomTypeModelRichTextSingleField;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* A UID custom type field.
|
|
434
|
-
*
|
|
435
|
-
* More details: {@link https://prismic.io/docs/uid}
|
|
436
|
-
*/
|
|
437
|
-
interface CustomTypeModelUIDField {
|
|
438
|
-
type: typeof CustomTypeModelFieldType.UID;
|
|
439
|
-
config?: {
|
|
440
|
-
label?: string | null;
|
|
441
|
-
placeholder?: string;
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* Type identifier for a custom type field.
|
|
447
|
-
*/
|
|
448
|
-
declare const CustomTypeModelFieldType: {
|
|
449
|
-
readonly Boolean: "Boolean";
|
|
450
|
-
readonly Color: "Color";
|
|
451
|
-
readonly Date: "Date";
|
|
452
|
-
readonly Embed: "Embed";
|
|
453
|
-
readonly GeoPoint: "GeoPoint";
|
|
454
|
-
readonly Group: "Group";
|
|
455
|
-
readonly Image: "Image";
|
|
456
|
-
readonly Integration: "IntegrationFields";
|
|
457
|
-
readonly Link: "Link";
|
|
458
|
-
readonly Number: "Number";
|
|
459
|
-
readonly Select: "Select";
|
|
460
|
-
readonly Slices: "Slices";
|
|
461
|
-
readonly StructuredText: "StructuredText";
|
|
462
|
-
readonly Table: "Table";
|
|
463
|
-
readonly Text: "Text";
|
|
464
|
-
readonly Timestamp: "Timestamp";
|
|
465
|
-
readonly UID: "UID";
|
|
466
|
-
/**
|
|
467
|
-
* @deprecated - Renamed to `Integration`.
|
|
468
|
-
*/
|
|
469
|
-
readonly IntegrationFields: "IntegrationFields";
|
|
470
|
-
/**
|
|
471
|
-
* @deprecated - Legacy field type. Use `Number` instead.
|
|
472
|
-
*/
|
|
473
|
-
readonly Range: "Range";
|
|
474
|
-
/**
|
|
475
|
-
* @deprecated - Legacy field type. Do not use.
|
|
476
|
-
*/
|
|
477
|
-
readonly Separator: "Separator";
|
|
478
|
-
/**
|
|
479
|
-
* @deprecated - Legacy field type. Use `Slices` instead.
|
|
480
|
-
*/
|
|
481
|
-
readonly LegacySlices: "Choice";
|
|
482
|
-
};
|
|
483
|
-
/**
|
|
484
|
-
* A custom type field.
|
|
485
|
-
*/
|
|
486
|
-
type CustomTypeModelField = CustomTypeModelUIDField | CustomTypeModelGroupField | CustomTypeModelSliceZoneField | CustomTypeModelFieldForNestedGroup;
|
|
487
|
-
/**
|
|
488
|
-
* Any custom type field that is valid for a slice's primary section.
|
|
489
|
-
*/
|
|
490
|
-
type CustomTypeModelFieldForSlicePrimary = CustomTypeModelGroupField | CustomTypeModelFieldForNestedGroup;
|
|
491
|
-
/**
|
|
492
|
-
* Any custom type field that is valid for a group field.
|
|
493
|
-
*/
|
|
494
|
-
type CustomTypeModelFieldForGroup = CustomTypeModelNestedGroupField | CustomTypeModelFieldForNestedGroup;
|
|
495
|
-
/**
|
|
496
|
-
* Any custom type field that is valid for a nested group field.
|
|
497
|
-
*/
|
|
498
|
-
type CustomTypeModelFieldForNestedGroup = CustomTypeModelBooleanField | CustomTypeModelColorField | CustomTypeModelDateField | CustomTypeModelEmbedField | CustomTypeModelGeoPointField | CustomTypeModelImageField | CustomTypeModelIntegrationField | CustomTypeModelContentRelationshipField | CustomTypeModelLinkField | CustomTypeModelLinkToMediaField | CustomTypeModelNumberField | CustomTypeModelRangeField | CustomTypeModelSelectField | CustomTypeModelRichTextField | CustomTypeModelTableField | CustomTypeModelTitleField | CustomTypeModelKeyTextField | CustomTypeModelTimestampField | CustomTypeModelSeparatorField;
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* An integration custom type field.
|
|
502
|
-
*
|
|
503
|
-
* More details: {@link https://prismic.io/docs/integration-fields}
|
|
504
|
-
*/
|
|
505
|
-
interface CustomTypeModelIntegrationField {
|
|
506
|
-
type: typeof CustomTypeModelFieldType.Integration;
|
|
507
|
-
config?: {
|
|
508
|
-
label?: string | null;
|
|
509
|
-
placeholder?: string;
|
|
510
|
-
catalog?: string;
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
/**
|
|
515
|
-
* Document metadata for a translation of a Prismic document.
|
|
516
|
-
*/
|
|
517
|
-
interface AlternateLanguage<TypeEnum = string, LangEnum = string> {
|
|
518
|
-
id: string;
|
|
519
|
-
uid?: string;
|
|
520
|
-
type: TypeEnum;
|
|
521
|
-
lang: LangEnum;
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Metadata for Prismic document
|
|
525
|
-
*/
|
|
526
|
-
interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
|
|
527
|
-
/**
|
|
528
|
-
* The unique identifier for the document. Guaranteed to be unique among all
|
|
529
|
-
* documents in the Prismic repository.
|
|
530
|
-
*/
|
|
531
|
-
id: string;
|
|
532
|
-
/**
|
|
533
|
-
* The unique identifier for the document. Guaranteed to be unique among all
|
|
534
|
-
* Prismic documents of the same type.
|
|
535
|
-
*/
|
|
536
|
-
uid: string | null;
|
|
537
|
-
/**
|
|
538
|
-
* Url that refers to document.
|
|
539
|
-
*/
|
|
540
|
-
url: string | null;
|
|
541
|
-
/**
|
|
542
|
-
* Type of the document.
|
|
543
|
-
*/
|
|
544
|
-
type: TypeEnum;
|
|
545
|
-
/**
|
|
546
|
-
* Href for document.
|
|
547
|
-
*/
|
|
548
|
-
href: string;
|
|
549
|
-
/**
|
|
550
|
-
* Tags associated with document.
|
|
551
|
-
*/
|
|
552
|
-
tags: string[];
|
|
553
|
-
/**
|
|
554
|
-
* The timestamp at which the document was first published.
|
|
555
|
-
*/
|
|
556
|
-
first_publication_date: TimestampField<"filled">;
|
|
557
|
-
/**
|
|
558
|
-
* The timestamp at which the document was last published.
|
|
559
|
-
*/
|
|
560
|
-
last_publication_date: TimestampField<"filled">;
|
|
561
|
-
/**
|
|
562
|
-
* Slugs associated with document.
|
|
563
|
-
*
|
|
564
|
-
* @deprecated Slugs are a deprecated feature used before the UID field was
|
|
565
|
-
* introduced. Migrate to the UID field. For more details, see
|
|
566
|
-
* https://community.prismic.io/t/what-are-slugs/6493
|
|
567
|
-
*/
|
|
568
|
-
slugs: string[];
|
|
569
|
-
/**
|
|
570
|
-
* Documents that are related to this document.
|
|
571
|
-
*/
|
|
572
|
-
linked_documents: unknown[];
|
|
573
|
-
/**
|
|
574
|
-
* Language of document.
|
|
575
|
-
*/
|
|
576
|
-
lang: LangEnum;
|
|
577
|
-
/**
|
|
578
|
-
* Array to access alternate language versions for document.
|
|
579
|
-
*/
|
|
580
|
-
alternate_languages: AlternateLanguage<TypeEnum, LangEnum>[];
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* A Prismic document served through REST API v2.
|
|
584
|
-
*
|
|
585
|
-
* @see More details on custom types: {@link https://prismic.io/docs/custom-types}
|
|
586
|
-
*/
|
|
587
|
-
interface PrismicDocument<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocumentHeader<TypeEnum, LangEnum> {
|
|
588
|
-
/**
|
|
589
|
-
* Data contained in the document.
|
|
590
|
-
*/
|
|
591
|
-
data: DataInterface;
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* A Prismic document served through REST API v2. Does not contain a UID (a
|
|
595
|
-
* unique identifier).
|
|
596
|
-
*
|
|
597
|
-
* @see More details on custom types: {@link https://prismic.io/docs/custom-types}
|
|
598
|
-
* @see More details on the UID field: {@link https://prismic.io/docs/uid}
|
|
599
|
-
*/
|
|
600
|
-
interface PrismicDocumentWithoutUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
|
|
601
|
-
/**
|
|
602
|
-
* This document does not have a UID field. This property will always be
|
|
603
|
-
* `null`.
|
|
604
|
-
*
|
|
605
|
-
* The unique identifier for the document. Guaranteed to be unique among all
|
|
606
|
-
* Prismic documents of the same type.
|
|
607
|
-
*/
|
|
608
|
-
uid: null;
|
|
609
|
-
}
|
|
610
|
-
/**
|
|
611
|
-
* A Prismic document served through REST API v2. Contains a UID (a unique
|
|
612
|
-
* identifier).
|
|
613
|
-
*
|
|
614
|
-
* @see More details on custom types: {@link https://prismic.io/docs/custom-types}
|
|
615
|
-
* @see More details on the UID field: {@link https://prismic.io/docs/uid}
|
|
616
|
-
*/
|
|
617
|
-
interface PrismicDocumentWithUID<DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> = Record<string, any>, TypeEnum = string, LangEnum = string> extends PrismicDocument<DataInterface, TypeEnum, LangEnum> {
|
|
618
|
-
/**
|
|
619
|
-
* The unique identifier for the document. Guaranteed to be unique among all
|
|
620
|
-
* Prismic documents of the same type.
|
|
621
|
-
*/
|
|
622
|
-
uid: string;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
/**
|
|
626
|
-
* Resolves a link to a Prismic page to a URL.
|
|
627
|
-
*
|
|
628
|
-
* @typeParam ReturnType - Return type of your link resolver function. Useful if
|
|
629
|
-
* you prefer to return a complex object.
|
|
630
|
-
*
|
|
631
|
-
* @param linkToDocumentField - A page link field to resolve.
|
|
632
|
-
*
|
|
633
|
-
* @returns Resolved URL.
|
|
634
|
-
*
|
|
635
|
-
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
636
|
-
*/
|
|
637
|
-
type LinkResolverFunction<ReturnType = string | null | undefined> = (linkToDocumentField: FilledContentRelationshipField) => ReturnType;
|
|
638
|
-
/**
|
|
639
|
-
* Configuration that determines the output of `asLink()`.
|
|
640
|
-
*/
|
|
641
|
-
type AsLinkConfig<LinkResolverFunctionReturnType = string | null | undefined> = {
|
|
642
|
-
/**
|
|
643
|
-
* An optional link resolver function. Without it, you're expected to use
|
|
644
|
-
* the `routes` option from the API.
|
|
645
|
-
*/
|
|
646
|
-
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null;
|
|
647
|
-
};
|
|
648
|
-
/**
|
|
649
|
-
* @deprecated Use object-style configuration instead.
|
|
650
|
-
*/
|
|
651
|
-
type AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType = string | null | undefined> = [linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType> | null];
|
|
652
|
-
/**
|
|
653
|
-
* The return type of `asLink()`.
|
|
654
|
-
*/
|
|
655
|
-
type AsLinkReturnType<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? LinkResolverFunctionReturnType | string | null : null;
|
|
656
|
-
declare const asLink: {
|
|
657
|
-
/**
|
|
658
|
-
* Converts any type of link field or Prismic page to a URL.
|
|
659
|
-
*
|
|
660
|
-
* @example
|
|
661
|
-
*
|
|
662
|
-
* ```ts
|
|
663
|
-
* const url = asLink(document.data.link)
|
|
664
|
-
* // => "/blog/my-post"
|
|
665
|
-
* ```
|
|
666
|
-
*
|
|
667
|
-
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
668
|
-
* type.
|
|
669
|
-
* @typeParam Field - Link field or Prismic page to resolve to a URL.
|
|
670
|
-
*
|
|
671
|
-
* @param linkFieldOrDocument - Any kind of link field or a page to resolve.
|
|
672
|
-
* @param config - Configuration that determines the output of `asLink()`.
|
|
673
|
-
*
|
|
674
|
-
* @returns Resolved URL, or `null` if the link field or page is empty.
|
|
675
|
-
*
|
|
676
|
-
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
677
|
-
*/
|
|
678
|
-
<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
679
|
-
/**
|
|
680
|
-
* Converts any type of link field or Prismic page to a URL.
|
|
681
|
-
*
|
|
682
|
-
* @deprecated Use object-style configuration instead.
|
|
683
|
-
*
|
|
684
|
-
* @typeParam LinkResolverFunctionReturnType - Link resolver function return
|
|
685
|
-
* type.
|
|
686
|
-
* @typeParam Field - Link field or Prismic page to resolve to a URL.
|
|
687
|
-
*
|
|
688
|
-
* @param linkFieldOrDocument - Any kind of link field or a page to resolve.
|
|
689
|
-
* @param linkResolver - An optional link resolver function. Without it,
|
|
690
|
-
* you're expected to use the `routes` option from the API.
|
|
691
|
-
*
|
|
692
|
-
* @returns Resolved URL, or `null` if the link field or page is empty.
|
|
693
|
-
*
|
|
694
|
-
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
695
|
-
*/
|
|
696
|
-
<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, ...config: AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Serializes a node from a rich text field with a function to HTML.
|
|
701
|
-
*
|
|
702
|
-
* Unlike a typical `@prismicio/client/richtext` function serializer, this
|
|
703
|
-
* serializer converts the `children` argument to a single string rather than an
|
|
704
|
-
* array of strings.
|
|
705
|
-
*
|
|
706
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
707
|
-
*/
|
|
708
|
-
type HTMLRichTextFunctionSerializer = (type: Parameters<RichTextFunctionSerializer<string>>[0], node: Parameters<RichTextFunctionSerializer<string>>[1], text: Parameters<RichTextFunctionSerializer<string>>[2], children: Parameters<RichTextFunctionSerializer<string>>[3][number], key: Parameters<RichTextFunctionSerializer<string>>[4]) => string | null | undefined;
|
|
709
|
-
/**
|
|
710
|
-
* Serializes a node from a rich text field with a map to HTML.
|
|
711
|
-
*
|
|
712
|
-
* Unlike a typical `@prismicio/client/richtext` map serializer, this serializer
|
|
713
|
-
* converts the `children` property to a single string rather than an array of
|
|
714
|
-
* strings and accepts shorthand declarations.
|
|
715
|
-
*
|
|
716
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
717
|
-
*/
|
|
718
|
-
type HTMLRichTextMapSerializer = {
|
|
719
|
-
[P in keyof RichTextMapSerializer<string>]: P extends RichTextMapSerializer<string>["span"] ? HTMLStrictRichTextMapSerializer[P] : HTMLStrictRichTextMapSerializer[P] | HTMLRichTextMapSerializerShorthand;
|
|
720
|
-
};
|
|
721
|
-
/**
|
|
722
|
-
* Serializes a node from a rich text field with a map to HTML.
|
|
723
|
-
*
|
|
724
|
-
* Unlike a typical `@prismicio/client/richtext` map serializer, this serializer
|
|
725
|
-
* converts the `children` property to a single string rather than an array of
|
|
726
|
-
* strings but doesn't accept shorthand declarations.
|
|
727
|
-
*
|
|
728
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
729
|
-
*/
|
|
730
|
-
type HTMLStrictRichTextMapSerializer = {
|
|
731
|
-
[P in keyof RichTextMapSerializer<string>]: (payload: {
|
|
732
|
-
type: Parameters<HTMLRichTextMapSerializerFunction<P>>[0]["type"];
|
|
733
|
-
node: Parameters<HTMLRichTextMapSerializerFunction<P>>[0]["node"];
|
|
734
|
-
text: Parameters<HTMLRichTextMapSerializerFunction<P>>[0]["text"];
|
|
735
|
-
children: Parameters<HTMLRichTextMapSerializerFunction<P>>[0]["children"][number];
|
|
736
|
-
key: Parameters<HTMLRichTextMapSerializerFunction<P>>[0]["key"];
|
|
737
|
-
}) => string | null | undefined;
|
|
738
|
-
};
|
|
739
|
-
/**
|
|
740
|
-
* A {@link RichTextMapSerializerFunction} type specifically for
|
|
741
|
-
* {@link HTMLRichTextMapSerializer}.
|
|
742
|
-
*
|
|
743
|
-
* @typeParam BlockName - The serializer's rich text block type.
|
|
744
|
-
*/
|
|
745
|
-
type HTMLRichTextMapSerializerFunction<BlockType extends keyof RichTextMapSerializer<string>> = RichTextMapSerializerFunction<string, ExtractNodeGeneric<RichTextMapSerializer<string>[BlockType]>, ExtractTextTypeGeneric<RichTextMapSerializer<string>[BlockType]>>;
|
|
746
|
-
/**
|
|
747
|
-
* Returns the `Node` generic from {@link RichTextMapSerializerFunction}.
|
|
748
|
-
*
|
|
749
|
-
* @typeParam T - The `RichTextMapSerializerFunction` containing the needed
|
|
750
|
-
* `Node` generic.
|
|
751
|
-
*/
|
|
752
|
-
type ExtractNodeGeneric<T> = T extends RichTextMapSerializerFunction<any, infer U, any> ? U : never;
|
|
753
|
-
/**
|
|
754
|
-
* Returns the `TextType` generic from {@link RichTextMapSerializerFunction}.
|
|
755
|
-
*
|
|
756
|
-
* @typeParam T - The `RichTextMapSerializerFunction` containing the needed
|
|
757
|
-
* `TextType` generic.
|
|
758
|
-
*/
|
|
759
|
-
type ExtractTextTypeGeneric<T> = T extends RichTextMapSerializerFunction<any, any, infer U> ? U : never;
|
|
760
|
-
/**
|
|
761
|
-
* A shorthand definition for {@link HTMLRichTextMapSerializer} element types.
|
|
762
|
-
*/
|
|
763
|
-
type HTMLRichTextMapSerializerShorthand = {
|
|
764
|
-
/**
|
|
765
|
-
* Classes to apply to the element type.
|
|
766
|
-
*/
|
|
767
|
-
class?: string;
|
|
768
|
-
/**
|
|
769
|
-
* Other attributes to apply to the element type.
|
|
770
|
-
*/
|
|
771
|
-
[Attribute: string]: string | boolean | null | undefined;
|
|
772
|
-
};
|
|
773
|
-
/**
|
|
774
|
-
* Serializes a node from a rich text field with a map or a function to HTML.
|
|
775
|
-
*
|
|
776
|
-
* @see {@link HTMLRichTextMapSerializer} and {@link HTMLRichTextFunctionSerializer}
|
|
777
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
778
|
-
*/
|
|
779
|
-
type HTMLRichTextSerializer = HTMLRichTextMapSerializer | HTMLRichTextFunctionSerializer;
|
|
780
|
-
/**
|
|
781
|
-
* Configuration that determines the output of `asHTML()`.
|
|
782
|
-
*/
|
|
783
|
-
type AsHTMLConfig = {
|
|
784
|
-
/**
|
|
785
|
-
* An optional link resolver function to resolve links. Without it, you're
|
|
786
|
-
* expected to use the `routes` option from the API.
|
|
787
|
-
*/
|
|
788
|
-
linkResolver?: LinkResolverFunction | null;
|
|
789
|
-
/**
|
|
790
|
-
* An optional rich text serializer. Unhandled cases will fall back to the
|
|
791
|
-
* default serializer.
|
|
792
|
-
*/
|
|
793
|
-
serializer?: HTMLRichTextSerializer | null;
|
|
794
|
-
};
|
|
795
|
-
/**
|
|
796
|
-
* @deprecated Use object-style configuration instead.
|
|
797
|
-
*/
|
|
798
|
-
type AsHTMLDeprecatedTupleConfig = [
|
|
799
|
-
linkResolver?: LinkResolverFunction | null,
|
|
800
|
-
serializer?: HTMLRichTextSerializer | null
|
|
801
|
-
];
|
|
802
|
-
/**
|
|
803
|
-
* The return type of `asHTML()`.
|
|
804
|
-
*/
|
|
805
|
-
type AsHTMLReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null;
|
|
806
|
-
declare const asHTML: {
|
|
807
|
-
/**
|
|
808
|
-
* Converts a rich text field to an HTML string.
|
|
809
|
-
*
|
|
810
|
-
* @example
|
|
811
|
-
*
|
|
812
|
-
* ```ts
|
|
813
|
-
* const html = asHTML(document.data.content)
|
|
814
|
-
* // => "<p>Hello world</p>"
|
|
815
|
-
* ```
|
|
816
|
-
*
|
|
817
|
-
* @param richTextField - A rich text field from Prismic.
|
|
818
|
-
* @param config - Configuration that determines the output of `asHTML()`.
|
|
819
|
-
*
|
|
820
|
-
* @returns HTML equivalent of the rich text field, or `null` if the field is
|
|
821
|
-
* empty.
|
|
822
|
-
*
|
|
823
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
824
|
-
*/
|
|
825
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, config?: AsHTMLConfig): AsHTMLReturnType<Field>;
|
|
826
|
-
/**
|
|
827
|
-
* Converts a rich text field to an HTML string.
|
|
828
|
-
*
|
|
829
|
-
* @deprecated Use object-style configuration instead.
|
|
830
|
-
*
|
|
831
|
-
* @param richTextField - A rich text field from Prismic.
|
|
832
|
-
* @param linkResolver - An optional link resolver function to resolve links.
|
|
833
|
-
* Without it, you're expected to use the `routes` option from the API.
|
|
834
|
-
* @param serializer - An optional rich text serializer. Unhandled cases will
|
|
835
|
-
* fall back to the default serializer.
|
|
836
|
-
*
|
|
837
|
-
* @returns HTML equivalent of the rich text field, or `null` if the field is
|
|
838
|
-
* empty.
|
|
839
|
-
*
|
|
840
|
-
* @see Learn how to style rich text and customize rendering: {@link https://prismic.io/docs/fields/rich-text}
|
|
841
|
-
*/
|
|
842
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, ...config: AsHTMLDeprecatedTupleConfig): AsHTMLReturnType<Field>;
|
|
843
|
-
};
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Convert a value to a lazyily loaded module. This is useful when using
|
|
847
|
-
* functions like `() => import("...")`.
|
|
848
|
-
*/
|
|
849
|
-
type LazyModule<T> = () => Promise<T | {
|
|
850
|
-
default: T;
|
|
851
|
-
}>;
|
|
852
|
-
/**
|
|
853
|
-
* Mark a type as potentially lazy-loaded via a module.
|
|
854
|
-
*/
|
|
855
|
-
type MaybeLazyModule<T> = T | LazyModule<T>;
|
|
856
|
-
type AnyFunction = (...args: any[]) => any;
|
|
857
|
-
/**
|
|
858
|
-
* Returns the type of a `SliceLike` type.
|
|
859
|
-
*
|
|
860
|
-
* @typeParam Slice - The Slice from which the type will be extracted.
|
|
861
|
-
*/
|
|
862
|
-
type ExtractSliceType<TSlice extends SliceLike> = TSlice extends SliceLikeRestV2 ? TSlice["slice_type"] : TSlice extends SliceLikeGraphQL ? TSlice["type"] : never;
|
|
863
|
-
/**
|
|
864
|
-
* The minimum required properties to represent a Prismic slice from the Prismic
|
|
865
|
-
* Content API for the `mapSliceZone()` helper.
|
|
866
|
-
*
|
|
867
|
-
* @typeParam SliceType - Type name of the slice.
|
|
868
|
-
*/
|
|
869
|
-
type SliceLikeRestV2<TSliceType extends string = string> = Pick<Slice<TSliceType>, "id" | "slice_type">;
|
|
870
|
-
/**
|
|
871
|
-
* The minimum required properties to represent a Prismic slice from the Prismic
|
|
872
|
-
* GraphQL API for the `mapSliceZone()` helper.
|
|
873
|
-
*
|
|
874
|
-
* @typeParam SliceType - Type name of the slice.
|
|
875
|
-
*/
|
|
876
|
-
type SliceLikeGraphQL<TSliceType extends string = string> = {
|
|
877
|
-
type: Slice<TSliceType>["slice_type"];
|
|
878
|
-
};
|
|
879
|
-
/**
|
|
880
|
-
* The minimum required properties to represent a Prismic slice for the
|
|
881
|
-
* `mapSliceZone()` helper.
|
|
882
|
-
*
|
|
883
|
-
* If using Prismic's Content API, use the `Slice` export from
|
|
884
|
-
* `@prismicio/client` for a full interface.
|
|
885
|
-
*
|
|
886
|
-
* @typeParam SliceType - Type name of the slice.
|
|
887
|
-
*/
|
|
888
|
-
type SliceLike<TSliceType extends string = string> = SliceLikeRestV2<TSliceType> | SliceLikeGraphQL<TSliceType>;
|
|
889
|
-
/**
|
|
890
|
-
* A looser version of the `SliceZone` type from `@prismicio/client` using
|
|
891
|
-
* `SliceLike`.
|
|
892
|
-
*
|
|
893
|
-
* If using Prismic's Content API, use the `SliceZone` export from
|
|
894
|
-
* `@prismicio/client` for the full type.
|
|
895
|
-
*
|
|
896
|
-
* @typeParam TSlice - The type(s) of a slice in the slice zone.
|
|
897
|
-
*/
|
|
898
|
-
type SliceZoneLike<TSlice extends SliceLike = SliceLike> = readonly TSlice[];
|
|
899
|
-
/**
|
|
900
|
-
* A set of properties that identify a Slice as having been mapped. Consumers of
|
|
901
|
-
* the mapped Slice Zone can use these properties to detect and specially handle
|
|
902
|
-
* mapped Slices.
|
|
903
|
-
*/
|
|
904
|
-
type MappedSliceLike = {
|
|
905
|
-
/**
|
|
906
|
-
* If `true`, this Slice has been modified from its original value using a
|
|
907
|
-
* mapper.
|
|
908
|
-
*
|
|
909
|
-
* @internal
|
|
910
|
-
*/
|
|
911
|
-
__mapped: true;
|
|
912
|
-
};
|
|
913
|
-
/**
|
|
914
|
-
* Arguments for a function mapping content from a Prismic Slice using the
|
|
915
|
-
* `mapSliceZone()` helper.
|
|
916
|
-
*
|
|
917
|
-
* @typeParam TSlice - The Slice passed as a prop.
|
|
918
|
-
* @typeParam TContext - Arbitrary data passed to `mapSliceZone()` and made
|
|
919
|
-
* available to all Slice mappers.
|
|
920
|
-
*/
|
|
921
|
-
type SliceMapperArgs<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
922
|
-
/**
|
|
923
|
-
* Slice data.
|
|
924
|
-
*/
|
|
925
|
-
slice: TSlice;
|
|
926
|
-
/**
|
|
927
|
-
* The index of the Slice in the Slice Zone.
|
|
928
|
-
*/
|
|
929
|
-
index: number;
|
|
930
|
-
/**
|
|
931
|
-
* All Slices from the Slice Zone to which the Slice belongs.
|
|
932
|
-
*/
|
|
933
|
-
slices: SliceZoneLike<TSlice extends SliceLikeGraphQL ? SliceLikeGraphQL : SliceLikeRestV2>;
|
|
934
|
-
/**
|
|
935
|
-
* Arbitrary data passed to `mapSliceZone()` and made available to all Slice
|
|
936
|
-
* mappers.
|
|
937
|
-
*/
|
|
938
|
-
context: TContext;
|
|
939
|
-
};
|
|
940
|
-
/**
|
|
941
|
-
* A record of mappers.
|
|
942
|
-
*/
|
|
943
|
-
type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
944
|
-
[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<SliceMapper<Extract<TSlice, SliceLike<P>>, any, TContext>>;
|
|
945
|
-
};
|
|
946
|
-
/**
|
|
947
|
-
* A function that maps a Slice and its metadata to a modified version. The
|
|
948
|
-
* return value will replace the Slice in the Slice Zone.
|
|
949
|
-
*/
|
|
950
|
-
type SliceMapper<TSlice extends SliceLike = SliceLike, TMappedSlice extends Record<string, unknown> | undefined | void = Record<string, unknown> | undefined | void, TContext = unknown> = (args: SliceMapperArgs<TSlice, TContext>) => TMappedSlice | Promise<TMappedSlice>;
|
|
951
|
-
/**
|
|
952
|
-
* Unwraps a lazily loaded mapper module.
|
|
953
|
-
*/
|
|
954
|
-
type ResolveLazySliceMapperModule<TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>> = TSliceMapper extends LazyModule<SliceMapper> ? Awaited<ReturnType<TSliceMapper>> extends {
|
|
955
|
-
default: unknown;
|
|
956
|
-
} ? Awaited<ReturnType<TSliceMapper>>["default"] : Awaited<ReturnType<TSliceMapper>> : TSliceMapper;
|
|
957
|
-
/**
|
|
958
|
-
* Transforms a Slice into its mapped version.
|
|
959
|
-
*/
|
|
960
|
-
type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends SliceMappers<TSliceLike, any>> = TSliceLike extends Slice ? TSliceLike["slice_type"] extends keyof TSliceMappers ? TSliceMappers[TSliceLike["slice_type"]] extends AnyFunction ? SliceLikeRestV2<TSliceLike["slice_type"]> & MappedSliceLike & Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["slice_type"]]>>> : TSliceLike : TSliceLike : TSliceLike extends SliceLikeGraphQL ? TSliceLike["type"] extends keyof TSliceMappers ? TSliceMappers[TSliceLike["type"]] extends AnyFunction ? SliceLikeGraphQL<TSliceLike["type"]> & MappedSliceLike & Awaited<ReturnType<ResolveLazySliceMapperModule<TSliceMappers[TSliceLike["type"]]>>> : TSliceLike : TSliceLike : never;
|
|
961
|
-
/**
|
|
962
|
-
* Transforms a Slice Zone using a set of mapping functions, one for each type
|
|
963
|
-
* of Slice. Mapping functions can be async.
|
|
964
|
-
*
|
|
965
|
-
* Whenever possible, use this function on the server to minimize client-side
|
|
966
|
-
* processing.
|
|
967
|
-
*
|
|
968
|
-
* @example
|
|
969
|
-
*
|
|
970
|
-
* ```typescript
|
|
971
|
-
* const mappedSliceZone = await mapSliceZone(page.data.slices, {
|
|
972
|
-
* code_block: ({ slice }) => ({
|
|
973
|
-
* codeHTML: await highlight(slice.primary.code),
|
|
974
|
-
* }),
|
|
975
|
-
* });
|
|
976
|
-
* ```
|
|
977
|
-
*/
|
|
978
|
-
declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
979
|
-
|
|
980
|
-
declare const filter: {
|
|
981
|
-
/**
|
|
982
|
-
* The `at` filter checks that the path matches the described value exactly.
|
|
983
|
-
* It takes a single value for a field or an array (only for tags).
|
|
984
|
-
*
|
|
985
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#at}
|
|
986
|
-
*/
|
|
987
|
-
at: (path: string, value: string | number | boolean | Date | string[]) => string;
|
|
988
|
-
/**
|
|
989
|
-
* The `not` filter checks that the path doesn't match the provided value
|
|
990
|
-
* exactly. It takes a single value for a field or an array (only for tags).
|
|
991
|
-
*
|
|
992
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#not}
|
|
993
|
-
*/
|
|
994
|
-
not: (path: string, value: string | number | boolean | Date | string[]) => string;
|
|
995
|
-
/**
|
|
996
|
-
* The `any` filter takes an array of values. It works exactly the same way as
|
|
997
|
-
* the `at` operator, but checks whether the fragment matches any of the
|
|
998
|
-
* values in the array.
|
|
999
|
-
*
|
|
1000
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#any}
|
|
1001
|
-
*/
|
|
1002
|
-
any: (path: string, values: (string | number | boolean | Date)[]) => string;
|
|
1003
|
-
/**
|
|
1004
|
-
* The `in` filter is used specifically to retrieve an array of documents by
|
|
1005
|
-
* their IDs or UIDs. This filter is much more efficient at this than the any
|
|
1006
|
-
* filter.
|
|
1007
|
-
*
|
|
1008
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#in}
|
|
1009
|
-
*/
|
|
1010
|
-
in: (path: string, values: string[]) => string;
|
|
1011
|
-
/**
|
|
1012
|
-
* The `fulltext` filter provides two capabilities:
|
|
1013
|
-
*
|
|
1014
|
-
* 1. Checking if a certain string is anywhere inside a document (this is what
|
|
1015
|
-
* you should use to make your project's search engine feature)
|
|
1016
|
-
* 2. Checking if the string is contained inside a specific custom type’s Rich
|
|
1017
|
-
* Text or Key Text fragment.
|
|
1018
|
-
*
|
|
1019
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#fulltext}
|
|
1020
|
-
*/
|
|
1021
|
-
fulltext: (path: string, searchTerms: string) => string;
|
|
1022
|
-
/**
|
|
1023
|
-
* The `has` filter checks whether a fragment has a value. It will return all
|
|
1024
|
-
* the documents of the specified type that contain a value for the specified
|
|
1025
|
-
* field.
|
|
1026
|
-
*
|
|
1027
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#has}
|
|
1028
|
-
*/
|
|
1029
|
-
has: (path: string) => string;
|
|
1030
|
-
/**
|
|
1031
|
-
* The `missing` filter checks if a fragment doesn't have a value. It will
|
|
1032
|
-
* return all the documents of the specified type that do not contain a value
|
|
1033
|
-
* for the specified field.
|
|
1034
|
-
*
|
|
1035
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#missing}
|
|
1036
|
-
*/
|
|
1037
|
-
missing: (path: string) => string;
|
|
1038
|
-
/**
|
|
1039
|
-
* The `similar` filter takes the ID of a document, and returns a list of
|
|
1040
|
-
* documents with similar content. This allows you to build an automated
|
|
1041
|
-
* content discovery feature (for example, a "Related posts" section).
|
|
1042
|
-
*
|
|
1043
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#similar}
|
|
1044
|
-
*/
|
|
1045
|
-
similar: (id: string, value: number) => string;
|
|
1046
|
-
/**
|
|
1047
|
-
* The `geopoint.near` filter checks that the value in the path is within the
|
|
1048
|
-
* radius of the given coordinates.
|
|
1049
|
-
*
|
|
1050
|
-
* This filter will only work for a geopoint field.
|
|
1051
|
-
*
|
|
1052
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
|
|
1053
|
-
*/
|
|
1054
|
-
geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
|
|
1055
|
-
/**
|
|
1056
|
-
* The `number.lt` filter checks that the value in the number field is less
|
|
1057
|
-
* than the value passed into the filter.
|
|
1058
|
-
*
|
|
1059
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#numberlessthan}
|
|
1060
|
-
*/
|
|
1061
|
-
numberLessThan: (path: string, value: number) => string;
|
|
1062
|
-
/**
|
|
1063
|
-
* The `number.gt` filter checks that the value in the number field is greater
|
|
1064
|
-
* than the value passed into the filter.
|
|
1065
|
-
*
|
|
1066
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#numbergreaterthan}
|
|
1067
|
-
*/
|
|
1068
|
-
numberGreaterThan: (path: string, value: number) => string;
|
|
1069
|
-
/**
|
|
1070
|
-
* The `number.inRange` filter checks that the value in the path is within the
|
|
1071
|
-
* two values passed into the filter.
|
|
1072
|
-
*
|
|
1073
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#numberinrange}
|
|
1074
|
-
*/
|
|
1075
|
-
numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
|
|
1076
|
-
/**
|
|
1077
|
-
* The `date.after` filter checks that the value in the path is after the date
|
|
1078
|
-
* value passed into the filter.
|
|
1079
|
-
*
|
|
1080
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1081
|
-
*/
|
|
1082
|
-
dateAfter: (path: string, date: string | number | Date) => string;
|
|
1083
|
-
/**
|
|
1084
|
-
* The `date.before` filter checks that the value in the path is before the
|
|
1085
|
-
* date value passed into the filter.
|
|
1086
|
-
*
|
|
1087
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1088
|
-
*/
|
|
1089
|
-
dateBefore: (path: string, date: string | number | Date) => string;
|
|
1090
|
-
/**
|
|
1091
|
-
* The `date.between` filter checks that the value in the path is within the
|
|
1092
|
-
* date values passed into the filter.
|
|
1093
|
-
*
|
|
1094
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1095
|
-
*/
|
|
1096
|
-
dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
|
|
1097
|
-
/**
|
|
1098
|
-
* The `date.day-of-month` filter checks that the value in the path is equal
|
|
1099
|
-
* to the day of the month passed into the filter.
|
|
1100
|
-
*
|
|
1101
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1102
|
-
*/
|
|
1103
|
-
dateDayOfMonth: (path: string, day: number) => string;
|
|
1104
|
-
/**
|
|
1105
|
-
* The `date.day-of-month-after` filter checks that the value in the path is
|
|
1106
|
-
* after the day of the month passed into the filter.
|
|
1107
|
-
*
|
|
1108
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1109
|
-
*/
|
|
1110
|
-
dateDayOfMonthAfter: (path: string, day: number) => string;
|
|
1111
|
-
/**
|
|
1112
|
-
* The `date.day-of-month-before` filter checks that the value in the path is
|
|
1113
|
-
* before the day of the month passed into the filter.
|
|
1114
|
-
*
|
|
1115
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1116
|
-
*/
|
|
1117
|
-
dateDayOfMonthBefore: (path: string, day: number) => string;
|
|
1118
|
-
/**
|
|
1119
|
-
* The `date.day-of-week` filter checks that the value in the path is equal to
|
|
1120
|
-
* the day of the week passed into the filter.
|
|
1121
|
-
*
|
|
1122
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1123
|
-
*/
|
|
1124
|
-
dateDayOfWeek: (path: string, day: string | number) => string;
|
|
1125
|
-
/**
|
|
1126
|
-
* The `date.day-of-week-after` filter checks that the value in the path is
|
|
1127
|
-
* after the day of the week passed into the filter.
|
|
1128
|
-
*
|
|
1129
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1130
|
-
*/
|
|
1131
|
-
dateDayOfWeekAfter: (path: string, day: string | number) => string;
|
|
1132
|
-
/**
|
|
1133
|
-
* The date.day-of-week-before filter checks that the value in the path is
|
|
1134
|
-
* before the day of the week passed into the filter.
|
|
1135
|
-
*
|
|
1136
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1137
|
-
*/
|
|
1138
|
-
dateDayOfWeekBefore: (path: string, day: string | number) => string;
|
|
1139
|
-
/**
|
|
1140
|
-
* The `date.month` filter checks that the value in the path occurs in the
|
|
1141
|
-
* month value passed into the filter.
|
|
1142
|
-
*
|
|
1143
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1144
|
-
*/
|
|
1145
|
-
dateMonth: (path: string, month: string | number) => string;
|
|
1146
|
-
/**
|
|
1147
|
-
* The `date.month-after` filter checks that the value in the path occurs in
|
|
1148
|
-
* any month after the value passed into the filter.
|
|
1149
|
-
*
|
|
1150
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1151
|
-
*/
|
|
1152
|
-
dateMonthAfter: (path: string, month: string | number) => string;
|
|
1153
|
-
/**
|
|
1154
|
-
* The `date.month-before` filter checks that the value in the path occurs in
|
|
1155
|
-
* any month before the value passed into the filter.
|
|
1156
|
-
*
|
|
1157
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1158
|
-
*/
|
|
1159
|
-
dateMonthBefore: (path: string, month: string | number) => string;
|
|
1160
|
-
/**
|
|
1161
|
-
* The `date.year` filter checks that the value in the path occurs in the year
|
|
1162
|
-
* value passed into the filter.
|
|
1163
|
-
*
|
|
1164
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1165
|
-
*/
|
|
1166
|
-
dateYear: (path: string, year: number) => string;
|
|
1167
|
-
/**
|
|
1168
|
-
* The `date.hour` filter checks that the value in the path occurs within the
|
|
1169
|
-
* hour value passed into the filter.
|
|
1170
|
-
*
|
|
1171
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1172
|
-
*/
|
|
1173
|
-
dateHour: (path: string, hour: number) => string;
|
|
1174
|
-
/**
|
|
1175
|
-
* The `date.hour-after` filter checks that the value in the path occurs after
|
|
1176
|
-
* the hour value passed into the filter.
|
|
1177
|
-
*
|
|
1178
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1179
|
-
*/
|
|
1180
|
-
dateHourAfter: (path: string, hour: number) => string;
|
|
1181
|
-
/**
|
|
1182
|
-
* The `date.hour-before` filter checks that the value in the path occurs
|
|
1183
|
-
* before the hour value passed into the filter.
|
|
1184
|
-
*
|
|
1185
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#date-filters}
|
|
1186
|
-
*/
|
|
1187
|
-
dateHourBefore: (path: string, hour: number) => string;
|
|
1188
|
-
};
|
|
1189
|
-
|
|
1190
|
-
/**
|
|
1191
|
-
* A universal API to make network requests. A subset of the `fetch()` API.
|
|
1192
|
-
*
|
|
1193
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}
|
|
1194
|
-
*/
|
|
1195
|
-
type FetchLike = (input: string, init?: RequestInitLike) => Promise<ResponseLike>;
|
|
1196
|
-
/**
|
|
1197
|
-
* An object that allows you to abort a `fetch()` request if needed via an
|
|
1198
|
-
* `AbortController` object
|
|
1199
|
-
*
|
|
1200
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal}
|
|
1201
|
-
*/
|
|
1202
|
-
type AbortSignalLike = any;
|
|
1203
|
-
/**
|
|
1204
|
-
* A subset of RequestInit properties to configure a `fetch()` request.
|
|
1205
|
-
*/
|
|
1206
|
-
interface RequestInitLike extends Pick<RequestInit, "cache"> {
|
|
1207
|
-
/**
|
|
1208
|
-
* The HTTP method to use for the request.
|
|
1209
|
-
*/
|
|
1210
|
-
method?: string;
|
|
1211
|
-
/**
|
|
1212
|
-
* The request body to send with the request.
|
|
1213
|
-
*/
|
|
1214
|
-
body?: any | FormData | string;
|
|
1215
|
-
/**
|
|
1216
|
-
* An object literal to set the `fetch()` request's headers.
|
|
1217
|
-
*/
|
|
1218
|
-
headers?: Record<string, string>;
|
|
1219
|
-
/**
|
|
1220
|
-
* An AbortSignal to set the `fetch()` request's signal.
|
|
1221
|
-
*
|
|
1222
|
-
* See:
|
|
1223
|
-
* [https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
|
|
1224
|
-
*/
|
|
1225
|
-
signal?: AbortSignalLike;
|
|
1226
|
-
}
|
|
1227
|
-
/**
|
|
1228
|
-
* The minimum required properties from Response.
|
|
1229
|
-
*/
|
|
1230
|
-
interface ResponseLike {
|
|
1231
|
-
ok: boolean;
|
|
1232
|
-
status: number;
|
|
1233
|
-
headers: HeadersLike;
|
|
1234
|
-
url: string;
|
|
1235
|
-
json(): Promise<any>;
|
|
1236
|
-
text(): Promise<string>;
|
|
1237
|
-
blob(): Promise<Blob>;
|
|
1238
|
-
clone(): ResponseLike;
|
|
1239
|
-
}
|
|
1240
|
-
/**
|
|
1241
|
-
* The minimum required properties from Headers.
|
|
1242
|
-
*/
|
|
1243
|
-
interface HeadersLike {
|
|
1244
|
-
get(name: string): string | null;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
/**
|
|
1248
|
-
* A query response from the Prismic REST API V2. The response contains
|
|
1249
|
-
* paginated metadata and a list of matching results for the query.
|
|
1250
|
-
*
|
|
1251
|
-
* @typeParam Document - The type(s) of Prismic document that can be returned.
|
|
1252
|
-
*
|
|
1253
|
-
* @see More details on querying: {@link https://prismic.io/docs/api}
|
|
1254
|
-
*/
|
|
1255
|
-
interface Query<Document extends PrismicDocument = PrismicDocument> {
|
|
1256
|
-
/**
|
|
1257
|
-
* The page number for this page of results.
|
|
1258
|
-
*/
|
|
1259
|
-
page: number;
|
|
1260
|
-
/**
|
|
1261
|
-
* Maximum number of results per page.
|
|
1262
|
-
*/
|
|
1263
|
-
results_per_page: number;
|
|
1264
|
-
/**
|
|
1265
|
-
* Number of results in this page.
|
|
1266
|
-
*/
|
|
1267
|
-
results_size: number;
|
|
1268
|
-
/**
|
|
1269
|
-
* Total number of results within all pages.
|
|
1270
|
-
*/
|
|
1271
|
-
total_results_size: number;
|
|
1272
|
-
/**
|
|
1273
|
-
* Total number of pages.
|
|
1274
|
-
*/
|
|
1275
|
-
total_pages: number;
|
|
1276
|
-
/**
|
|
1277
|
-
* The Prismic REST API V2 URL to the next page, if one exists.
|
|
1278
|
-
*/
|
|
1279
|
-
next_page: string | null;
|
|
1280
|
-
/**
|
|
1281
|
-
* The Prismic REST API V2 URL to the previous page, if one exists.
|
|
1282
|
-
*/
|
|
1283
|
-
prev_page: string | null;
|
|
1284
|
-
/**
|
|
1285
|
-
* A paginated list of documents matching the query.
|
|
1286
|
-
*/
|
|
1287
|
-
results: Document[];
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
/**
|
|
1291
|
-
* Metadata for a reference to a version of a repository's content.
|
|
1292
|
-
*
|
|
1293
|
-
* @see More details on refs: {@link https://prismic.io/docs/api#refs-and-the-entry-api}
|
|
1294
|
-
*/
|
|
1295
|
-
interface Ref {
|
|
1296
|
-
/**
|
|
1297
|
-
* The unique identifier for the ref.
|
|
1298
|
-
*/
|
|
1299
|
-
id: string;
|
|
1300
|
-
/**
|
|
1301
|
-
* The identifier that should be provided to the API to select a content
|
|
1302
|
-
* version.
|
|
1303
|
-
*/
|
|
1304
|
-
ref: string;
|
|
1305
|
-
/**
|
|
1306
|
-
* A human-readable name for the ref. The master ref is always named "Master".
|
|
1307
|
-
*/
|
|
1308
|
-
label: string;
|
|
1309
|
-
/**
|
|
1310
|
-
* Determines if the ref is the master ref. The master ref contains the latest
|
|
1311
|
-
* published content.
|
|
1312
|
-
*/
|
|
1313
|
-
isMasterRef: boolean;
|
|
1314
|
-
/**
|
|
1315
|
-
* If the ref is associated with a Release, this field contains the timestamp
|
|
1316
|
-
* at which the Release will be automatically published, if set.
|
|
1317
|
-
*
|
|
1318
|
-
* @see More details on Releases: {@link https://prismic.io/docs/guides/draft-plan-and-schedule-content#releases}
|
|
1319
|
-
*/
|
|
1320
|
-
scheduledAt?: string;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
|
-
/**
|
|
1324
|
-
* Repository metadata returned from the Prismic REST API V2. This data can be
|
|
1325
|
-
* fetched by sending a `GET` a request to a repository's `/api/v2` endpoint.
|
|
1326
|
-
*
|
|
1327
|
-
* @see More details on the `/api/v2` endpoint: {@link https://prismic.io/docs/api#refs-and-the-entry-api}
|
|
1328
|
-
*/
|
|
1329
|
-
interface Repository {
|
|
1330
|
-
/**
|
|
1331
|
-
* A list of refs for the repository.
|
|
1332
|
-
*
|
|
1333
|
-
* @see {@link Ref}
|
|
1334
|
-
*/
|
|
1335
|
-
refs: Ref[];
|
|
1336
|
-
/**
|
|
1337
|
-
* An identifier used to query content with the latest integration fields
|
|
1338
|
-
* data.
|
|
1339
|
-
*/
|
|
1340
|
-
integrationFieldsRef: string | null;
|
|
1341
|
-
/**
|
|
1342
|
-
* A list of languages for the repository.
|
|
1343
|
-
*
|
|
1344
|
-
* @see {@link Language}
|
|
1345
|
-
*/
|
|
1346
|
-
languages: Language[];
|
|
1347
|
-
/**
|
|
1348
|
-
* A list of the repository's custom type API IDs mapped to their
|
|
1349
|
-
* human-readable name.
|
|
1350
|
-
*/
|
|
1351
|
-
types: Record<string, string>;
|
|
1352
|
-
/**
|
|
1353
|
-
* @deprecated Tags are only available in the forms object.
|
|
1354
|
-
*
|
|
1355
|
-
* @see More details in the blog post "A change to how the Prismic API handles tags": {@link https://prismic.io/blog/a-change-to-how-the-prismic-api-handles-tags}
|
|
1356
|
-
*/
|
|
1357
|
-
tags: string[];
|
|
1358
|
-
/**
|
|
1359
|
-
* An internally-used list of REST API features for the repository.
|
|
1360
|
-
*
|
|
1361
|
-
* @internal
|
|
1362
|
-
*/
|
|
1363
|
-
forms: Record<string, Form>;
|
|
1364
|
-
/**
|
|
1365
|
-
* The URL used to begin the OAuth process for the repository.
|
|
1366
|
-
*/
|
|
1367
|
-
oauth_initiate: string;
|
|
1368
|
-
/**
|
|
1369
|
-
* The token used for the OAuth process for the repository.
|
|
1370
|
-
*/
|
|
1371
|
-
oauth_token: string;
|
|
1372
|
-
/**
|
|
1373
|
-
* The version of the API.
|
|
1374
|
-
*/
|
|
1375
|
-
version: string;
|
|
1376
|
-
/**
|
|
1377
|
-
* Licensing information for the repository content.
|
|
1378
|
-
*/
|
|
1379
|
-
license: string;
|
|
1380
|
-
/**
|
|
1381
|
-
* @deprecated Experiments are no longer part of Prismic.
|
|
1382
|
-
*/
|
|
1383
|
-
experiments: unknown;
|
|
1384
|
-
/**
|
|
1385
|
-
* @deprecated Bookmarks are not longer part of Prismic.
|
|
1386
|
-
*/
|
|
1387
|
-
bookmarks: Record<string, string>;
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* Metadata for a language that has been configured for a repository.
|
|
1391
|
-
*/
|
|
1392
|
-
interface Language {
|
|
1393
|
-
/**
|
|
1394
|
-
* A unique identifier for the language.
|
|
1395
|
-
*/
|
|
1396
|
-
id: string;
|
|
1397
|
-
/**
|
|
1398
|
-
* The name of the language.
|
|
1399
|
-
*/
|
|
1400
|
-
name: string;
|
|
1401
|
-
/**
|
|
1402
|
-
* Whether or not the language is the default language of the repository.
|
|
1403
|
-
*/
|
|
1404
|
-
is_master: boolean;
|
|
1405
|
-
}
|
|
1406
|
-
/**
|
|
1407
|
-
* A Prismic REST API V2 feature supported by the repository. It contains
|
|
1408
|
-
* metadata about the feature and how to interact with it via the API.
|
|
1409
|
-
*
|
|
1410
|
-
* @internal
|
|
1411
|
-
*/
|
|
1412
|
-
interface Form {
|
|
1413
|
-
method: "GET";
|
|
1414
|
-
enctype: string;
|
|
1415
|
-
action: string;
|
|
1416
|
-
name?: string;
|
|
1417
|
-
rel?: string;
|
|
1418
|
-
fields: Record<string, FormField>;
|
|
1419
|
-
}
|
|
1420
|
-
/**
|
|
1421
|
-
* A field for a feature of the Prismic REST API V2. It contains metadata about
|
|
1422
|
-
* the feature's field and how to interact with it via the API.
|
|
1423
|
-
*
|
|
1424
|
-
* @internal
|
|
1425
|
-
*/
|
|
1426
|
-
interface FormField {
|
|
1427
|
-
type: "String" | "Integer";
|
|
1428
|
-
multiple: boolean;
|
|
1429
|
-
default?: string;
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
/**
|
|
1433
|
-
* An `orderings` parameter that orders the results by the specified field.
|
|
1434
|
-
*
|
|
1435
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
|
|
1436
|
-
*/
|
|
1437
|
-
interface Ordering {
|
|
1438
|
-
field: string;
|
|
1439
|
-
direction?: "asc" | "desc";
|
|
1440
|
-
}
|
|
1441
|
-
/**
|
|
1442
|
-
* A `routes` parameter that determines how a page's URL field is resolved.
|
|
1443
|
-
*
|
|
1444
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1445
|
-
*
|
|
1446
|
-
* @example With a page's UID field.
|
|
1447
|
-
*
|
|
1448
|
-
* ```ts
|
|
1449
|
-
* {
|
|
1450
|
-
* "type": "page",
|
|
1451
|
-
* "path": "/:uid"
|
|
1452
|
-
* }
|
|
1453
|
-
* ```
|
|
1454
|
-
*
|
|
1455
|
-
* @example With a Content Relationship `parent` field.
|
|
1456
|
-
*
|
|
1457
|
-
* ```ts
|
|
1458
|
-
* {
|
|
1459
|
-
* "type": "page",
|
|
1460
|
-
* "path": "/:parent?/:uid",
|
|
1461
|
-
* "resolvers": {
|
|
1462
|
-
* "parent": "parent"
|
|
1463
|
-
* }
|
|
1464
|
-
* }
|
|
1465
|
-
* ```
|
|
1466
|
-
*/
|
|
1467
|
-
interface Route {
|
|
1468
|
-
/**
|
|
1469
|
-
* The custom type of the page.
|
|
1470
|
-
*/
|
|
1471
|
-
type: string;
|
|
1472
|
-
/**
|
|
1473
|
-
* A specific UID to which this route definition is scoped. The route is only
|
|
1474
|
-
* defined for the page whose UID matches the given UID.
|
|
1475
|
-
*/
|
|
1476
|
-
uid?: string;
|
|
1477
|
-
/**
|
|
1478
|
-
* A specific language to which this route definition is scoped. The route is
|
|
1479
|
-
* only defined for pages whose language matches the given language.
|
|
1480
|
-
*/
|
|
1481
|
-
lang?: string;
|
|
1482
|
-
/**
|
|
1483
|
-
* The resolved path of the page with optional placeholders.
|
|
1484
|
-
*/
|
|
1485
|
-
path: string;
|
|
1486
|
-
/**
|
|
1487
|
-
* An object that lists the API IDs of the Content Relationships in the route.
|
|
1488
|
-
*/
|
|
1489
|
-
resolvers?: Record<string, string>;
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Parameters for the Prismic Content API.
|
|
1493
|
-
*
|
|
1494
|
-
* @see Learn how to fetch content from Prismic: {@link https://prismic.io/docs/fetch-content}
|
|
1495
|
-
*/
|
|
1496
|
-
interface QueryParams {
|
|
1497
|
-
/**
|
|
1498
|
-
* The secure token for accessing the API (only needed if your repository is
|
|
1499
|
-
* set to private).
|
|
1500
|
-
*
|
|
1501
|
-
* {@link https://prismic.io/docs/access-token}
|
|
1502
|
-
*/
|
|
1503
|
-
accessToken?: string;
|
|
1504
|
-
/**
|
|
1505
|
-
* The `pageSize` parameter defines the maximum number of pages that the API
|
|
1506
|
-
* will return for your query.
|
|
1507
|
-
*
|
|
1508
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#pagesize}
|
|
1509
|
-
*/
|
|
1510
|
-
pageSize?: number;
|
|
1511
|
-
/**
|
|
1512
|
-
* The `page` parameter defines the pagination for the result of your query.
|
|
1513
|
-
*
|
|
1514
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#page}
|
|
1515
|
-
*/
|
|
1516
|
-
page?: number;
|
|
1517
|
-
/**
|
|
1518
|
-
* The `after` parameter can be used along with the orderings option. It will
|
|
1519
|
-
* remove all the pages except for those after the specified page in the
|
|
1520
|
-
* list.
|
|
1521
|
-
*
|
|
1522
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#after}
|
|
1523
|
-
*/
|
|
1524
|
-
after?: string;
|
|
1525
|
-
/**
|
|
1526
|
-
* The `fetch` parameter is used to make queries faster by only retrieving the
|
|
1527
|
-
* specified field(s).
|
|
1528
|
-
*
|
|
1529
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#fetch}
|
|
1530
|
-
*/
|
|
1531
|
-
fetch?: string | string[];
|
|
1532
|
-
/**
|
|
1533
|
-
* The `fetchLinks` parameter allows you to retrieve a specific content field
|
|
1534
|
-
* from a linked page and add it to the page response object.
|
|
1535
|
-
*
|
|
1536
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#fetchlinks}
|
|
1537
|
-
*/
|
|
1538
|
-
fetchLinks?: string | string[];
|
|
1539
|
-
/**
|
|
1540
|
-
* The `graphQuery` parameter allows you to specify which fields to retrieve
|
|
1541
|
-
* and what content to retrieve from Linked Documents / Content
|
|
1542
|
-
* Relationships.
|
|
1543
|
-
*
|
|
1544
|
-
* {@link https://prismic.io/docs/graphquery-rest-api}
|
|
1545
|
-
*/
|
|
1546
|
-
graphQuery?: string;
|
|
1547
|
-
/**
|
|
1548
|
-
* The `lang` option defines the language code for the results of your query.
|
|
1549
|
-
*
|
|
1550
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#lang}
|
|
1551
|
-
*/
|
|
1552
|
-
lang?: string;
|
|
1553
|
-
/**
|
|
1554
|
-
* The `orderings` parameter orders the results by the specified field(s). You
|
|
1555
|
-
* can specify as many fields as you want.
|
|
1556
|
-
*
|
|
1557
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#orderings}
|
|
1558
|
-
*
|
|
1559
|
-
* @remarks
|
|
1560
|
-
* Strings and arrays of strings are deprecated as of
|
|
1561
|
-
* `@prismicio/client@7.0.0`. Please migrate to the more explicit array of
|
|
1562
|
-
* objects.
|
|
1563
|
-
*
|
|
1564
|
-
* @example
|
|
1565
|
-
*
|
|
1566
|
-
* ```typescript
|
|
1567
|
-
* buildQueryURL(endpoint, {
|
|
1568
|
-
* orderings: [
|
|
1569
|
-
* { field: "my.product.price", direction: "desc" },
|
|
1570
|
-
* { field: "my.product.title" },
|
|
1571
|
-
* ],
|
|
1572
|
-
* })
|
|
1573
|
-
* ```
|
|
1574
|
-
*/
|
|
1575
|
-
orderings?: string | Ordering | (string | Ordering)[];
|
|
1576
|
-
/**
|
|
1577
|
-
* The `routes` option allows you to define how a page's `url` field is
|
|
1578
|
-
* resolved.
|
|
1579
|
-
*
|
|
1580
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1581
|
-
*/
|
|
1582
|
-
routes?: Route | string | (Route | string)[];
|
|
1583
|
-
/**
|
|
1584
|
-
* The `brokenRoute` option allows you to define the route populated in the
|
|
1585
|
-
* `url` property for broken link or content relationship fields. A broken
|
|
1586
|
-
* link is a link or content relationship field whose linked page has been
|
|
1587
|
-
* unpublished or deleted.
|
|
1588
|
-
*
|
|
1589
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1590
|
-
*/
|
|
1591
|
-
brokenRoute?: string;
|
|
1592
|
-
}
|
|
1593
|
-
/**
|
|
1594
|
-
* Arguments for `buildQueryURL` to construct a Query URL.
|
|
1595
|
-
*/
|
|
1596
|
-
type BuildQueryURLParams = {
|
|
1597
|
-
/**
|
|
1598
|
-
* Ref used to query documents.
|
|
1599
|
-
*
|
|
1600
|
-
* {@link https://prismic.io/docs/api#refs-and-the-entry-api}
|
|
1601
|
-
*/
|
|
1602
|
-
ref: string;
|
|
1603
|
-
/**
|
|
1604
|
-
* Ref used to populate integration fields with the latest content.
|
|
1605
|
-
*
|
|
1606
|
-
* {@link https://prismic.io/docs/integration-fields}
|
|
1607
|
-
*/
|
|
1608
|
-
integrationFieldsRef?: string;
|
|
1609
|
-
/**
|
|
1610
|
-
* One or more filters to filter documents for the query.
|
|
1611
|
-
*
|
|
1612
|
-
* {@link https://prismic.io/docs/rest-api-technical-reference#q}
|
|
1613
|
-
*/
|
|
1614
|
-
filters?: string | string[];
|
|
1615
|
-
/**
|
|
1616
|
-
* @deprecated Renamed to `filters`. Ensure the value is an array of filters,
|
|
1617
|
-
* not a single, non-array filter.
|
|
1618
|
-
*/
|
|
1619
|
-
predicates?: string | string[];
|
|
1620
|
-
};
|
|
1621
|
-
type BuildQueryURLArgs = QueryParams & BuildQueryURLParams;
|
|
1622
|
-
/**
|
|
1623
|
-
* Builds a Prismic Content API URL to request pages from a repository. The
|
|
1624
|
-
* paginated response for this URL includes pages matching the parameters.
|
|
1625
|
-
*
|
|
1626
|
-
* A ref is required to make a request. Request the `endpoint` URL to retrieve a
|
|
1627
|
-
* list of available refs.
|
|
1628
|
-
*
|
|
1629
|
-
* Type the JSON response with `Query`.
|
|
1630
|
-
*
|
|
1631
|
-
* @example
|
|
1632
|
-
*
|
|
1633
|
-
* ```ts
|
|
1634
|
-
* const url = buildQueryURL("https://my-repo.cdn.prismic.io/api/v2", {
|
|
1635
|
-
* ref: "my-ref",
|
|
1636
|
-
* filters: [filter.at("document.type", "blog_post")],
|
|
1637
|
-
* })
|
|
1638
|
-
* ```
|
|
1639
|
-
*
|
|
1640
|
-
* @param endpoint - URL to the repository's Content API.
|
|
1641
|
-
* @param args - Arguments to filter and scope the query.
|
|
1642
|
-
*
|
|
1643
|
-
* @returns URL that can be used to request pages from the repository.
|
|
1644
|
-
*
|
|
1645
|
-
* @see Prismic Content API technical reference: {@link https://prismic.io/docs/content-api}
|
|
1646
|
-
*/
|
|
1647
|
-
declare const buildQueryURL: (endpoint: string, args: BuildQueryURLArgs) => string;
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* Extracts one or more Prismic document types that match a given Prismic
|
|
1651
|
-
* document type. If no matches are found, no extraction is performed and the
|
|
1652
|
-
* union of all provided Prismic document types are returned.
|
|
1653
|
-
*
|
|
1654
|
-
* @typeParam TDocuments - Prismic document types from which to extract.
|
|
1655
|
-
* @typeParam TDocumentType - Type(s) to match `TDocuments` against.
|
|
1656
|
-
*/
|
|
1657
|
-
type ExtractDocumentType$1<TDocuments extends PrismicDocument, TDocumentType extends TDocuments["type"]> = Extract<TDocuments, {
|
|
1658
|
-
type: TDocumentType;
|
|
1659
|
-
}> extends never ? TDocuments : Extract<TDocuments, {
|
|
1660
|
-
type: TDocumentType;
|
|
1661
|
-
}>;
|
|
1662
|
-
/**
|
|
1663
|
-
* The minimum required properties to treat as an HTTP Request for automatic
|
|
1664
|
-
* Prismic preview support.
|
|
1665
|
-
*/
|
|
1666
|
-
type HttpRequestLike = /**
|
|
1667
|
-
* Web API Request
|
|
1668
|
-
*
|
|
1669
|
-
* @see http://developer.mozilla.org/en-US/docs/Web/API/Request
|
|
1670
|
-
*/ {
|
|
1671
|
-
headers?: {
|
|
1672
|
-
get(name: string): string | null;
|
|
1673
|
-
};
|
|
1674
|
-
url?: string;
|
|
1675
|
-
}
|
|
1676
|
-
/**
|
|
1677
|
-
* Express-style Request
|
|
1678
|
-
*/
|
|
1679
|
-
| {
|
|
1680
|
-
headers?: {
|
|
1681
|
-
cookie?: string;
|
|
1682
|
-
};
|
|
1683
|
-
query?: Record<string, unknown>;
|
|
1684
|
-
};
|
|
1685
|
-
/**
|
|
1686
|
-
* A ref or a function that returns a ref. If a static ref is known, one can be
|
|
1687
|
-
* given. If the ref must be fetched on-demand, a function can be provided. This
|
|
1688
|
-
* function can optionally be asynchronous.
|
|
1689
|
-
*/
|
|
1690
|
-
type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
|
|
1691
|
-
/**
|
|
1692
|
-
* Parameters for any client method that use `fetch()`.
|
|
1693
|
-
*/
|
|
1694
|
-
type FetchParams = {
|
|
1695
|
-
/**
|
|
1696
|
-
* Options provided to the client's `fetch()` on all network requests. These
|
|
1697
|
-
* options will be merged with internally required options. They can also be
|
|
1698
|
-
* overriden on a per-query basis using the query's `fetchOptions` parameter.
|
|
1699
|
-
*/
|
|
1700
|
-
fetchOptions?: RequestInitLike;
|
|
1701
|
-
/**
|
|
1702
|
-
* An `AbortSignal` provided by an `AbortController`. This allows the network
|
|
1703
|
-
* request to be cancelled if necessary.
|
|
1704
|
-
*
|
|
1705
|
-
* @deprecated Move the `signal` parameter into `fetchOptions.signal`:
|
|
1706
|
-
*
|
|
1707
|
-
* @see \<https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\>
|
|
1708
|
-
*/
|
|
1709
|
-
signal?: AbortSignalLike;
|
|
1710
|
-
};
|
|
1711
|
-
/**
|
|
1712
|
-
* Configuration for clients that determine how content is queried.
|
|
1713
|
-
*/
|
|
1714
|
-
type ClientConfig = {
|
|
1715
|
-
/**
|
|
1716
|
-
* The full Rest API V2 endpoint for the repository. This is only helpful if
|
|
1717
|
-
* you're using Prismic behind a proxy which we do not recommend.
|
|
1718
|
-
*
|
|
1719
|
-
* @defaultValue `getRepositoryEndpoint(repositoryNameOrEndpoint)`
|
|
1720
|
-
*/
|
|
1721
|
-
documentAPIEndpoint?: string;
|
|
1722
|
-
/**
|
|
1723
|
-
* The secure token for accessing the Prismic repository. This is only
|
|
1724
|
-
* required if the repository is set to private.
|
|
1725
|
-
*/
|
|
1726
|
-
accessToken?: string;
|
|
1727
|
-
/**
|
|
1728
|
-
* A string representing a version of the Prismic repository's content. This
|
|
1729
|
-
* may point to the latest version (called the "master ref"), or a preview
|
|
1730
|
-
* with draft content.
|
|
1731
|
-
*/
|
|
1732
|
-
ref?: RefStringOrThunk;
|
|
1733
|
-
/**
|
|
1734
|
-
* A list of route resolver objects that define how a document's `url`
|
|
1735
|
-
* property is resolved.
|
|
1736
|
-
*
|
|
1737
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1738
|
-
*/
|
|
1739
|
-
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
1740
|
-
/**
|
|
1741
|
-
* The `brokenRoute` option allows you to define the route populated in the
|
|
1742
|
-
* `url` property for broken link or content relationship fields. A broken
|
|
1743
|
-
* link is a link or content relationship field whose linked document has been
|
|
1744
|
-
* unpublished or deleted.
|
|
1745
|
-
*
|
|
1746
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1747
|
-
*/
|
|
1748
|
-
brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
|
|
1749
|
-
/**
|
|
1750
|
-
* Default parameters that will be sent with each query. These parameters can
|
|
1751
|
-
* be overridden on each query if needed.
|
|
1752
|
-
*/
|
|
1753
|
-
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute">;
|
|
1754
|
-
/**
|
|
1755
|
-
* The function used to make network requests to the Prismic REST API. In
|
|
1756
|
-
* environments where a global `fetch` function does not exist, such as
|
|
1757
|
-
* Node.js, this function must be provided.
|
|
1758
|
-
*/
|
|
1759
|
-
fetch?: FetchLike;
|
|
1760
|
-
/**
|
|
1761
|
-
* Options provided to the client's `fetch()` on all network requests. These
|
|
1762
|
-
* options will be merged with internally required options. They can also be
|
|
1763
|
-
* overriden on a per-query basis using the query's `fetchOptions` parameter.
|
|
1764
|
-
*/
|
|
1765
|
-
fetchOptions?: RequestInitLike;
|
|
1766
|
-
};
|
|
1767
|
-
/**
|
|
1768
|
-
* Parameters specific to client methods that fetch all documents. These methods
|
|
1769
|
-
* start with `getAll` (for example, `getAllByType`).
|
|
1770
|
-
*/
|
|
1771
|
-
type GetAllParams = {
|
|
1772
|
-
/**
|
|
1773
|
-
* Limit the number of documents queried. If a number is not provided, there
|
|
1774
|
-
* will be no limit and all matching documents will be returned.
|
|
1775
|
-
*/
|
|
1776
|
-
limit?: number;
|
|
1777
|
-
};
|
|
1778
|
-
/**
|
|
1779
|
-
* Arguments to determine how the URL for a preview session is resolved.
|
|
1780
|
-
*/
|
|
1781
|
-
type ResolvePreviewArgs<LinkResolverReturnType> = {
|
|
1782
|
-
/**
|
|
1783
|
-
* A function that maps a Prismic document to a URL within your app.
|
|
1784
|
-
*/
|
|
1785
|
-
linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
|
|
1786
|
-
/**
|
|
1787
|
-
* A fallback URL if the link resolver does not return a value.
|
|
1788
|
-
*/
|
|
1789
|
-
defaultURL: string;
|
|
1790
|
-
/**
|
|
1791
|
-
* The preview token (also known as a ref) that will be used to query preview
|
|
1792
|
-
* content from the Prismic repository.
|
|
1793
|
-
*/
|
|
1794
|
-
previewToken?: string;
|
|
1795
|
-
/**
|
|
1796
|
-
* The previewed document that will be used to determine the destination URL.
|
|
1797
|
-
*/
|
|
1798
|
-
documentID?: string;
|
|
1799
|
-
};
|
|
1800
|
-
/**
|
|
1801
|
-
* A client that allows querying content from a Prismic repository.
|
|
1802
|
-
*
|
|
1803
|
-
* If used in an environment where a global `fetch` function is unavailable,
|
|
1804
|
-
* such as Node.js, the `fetch` option must be provided as part of the `options`
|
|
1805
|
-
* parameter.
|
|
1806
|
-
*
|
|
1807
|
-
* @typeParam TDocuments - Document types that are registered for the Prismic
|
|
1808
|
-
* repository. Query methods will automatically be typed based on this type.
|
|
1809
|
-
*/
|
|
1810
|
-
declare class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
1811
|
-
#private;
|
|
1812
|
-
/**
|
|
1813
|
-
* The function used to make network requests to the Prismic REST API. In
|
|
1814
|
-
* environments where a global `fetch` function does not exist, such as
|
|
1815
|
-
* Node.js, this function must be provided.
|
|
1816
|
-
*/
|
|
1817
|
-
fetchFn: FetchLike;
|
|
1818
|
-
fetchOptions?: RequestInitLike;
|
|
1819
|
-
/**
|
|
1820
|
-
* The Prismic repository's name.
|
|
1821
|
-
*/
|
|
1822
|
-
set repositoryName(value: string);
|
|
1823
|
-
/**
|
|
1824
|
-
* The Prismic repository's name.
|
|
1825
|
-
*/
|
|
1826
|
-
get repositoryName(): string;
|
|
1827
|
-
/**
|
|
1828
|
-
* The Prismic REST API V2 endpoint for the repository (use
|
|
1829
|
-
* `prismic.getRepositoryEndpoint` for the default endpoint).
|
|
1830
|
-
*/
|
|
1831
|
-
documentAPIEndpoint: string;
|
|
1832
|
-
/**
|
|
1833
|
-
* The Prismic REST API V2 endpoint for the repository (use
|
|
1834
|
-
* `prismic.getRepositoryEndpoint` for the default endpoint).
|
|
1835
|
-
*
|
|
1836
|
-
* @deprecated Use `documentAPIEndpoint` instead.
|
|
1837
|
-
*/
|
|
1838
|
-
set endpoint(value: string);
|
|
1839
|
-
/**
|
|
1840
|
-
* The Prismic REST API V2 endpoint for the repository (use
|
|
1841
|
-
* `prismic.getRepositoryEndpoint` for the default endpoint).
|
|
1842
|
-
*
|
|
1843
|
-
* @deprecated Use `documentAPIEndpoint` instead.
|
|
1844
|
-
*/
|
|
1845
|
-
get endpoint(): string;
|
|
1846
|
-
/**
|
|
1847
|
-
* The secure token for accessing the API (only needed if your repository is
|
|
1848
|
-
* set to private).
|
|
1849
|
-
*
|
|
1850
|
-
* {@link https://user-guides.prismic.io/en/articles/1036153-generating-an-access-token}
|
|
1851
|
-
*/
|
|
1852
|
-
accessToken?: string;
|
|
1853
|
-
/**
|
|
1854
|
-
* A list of route resolver objects that define how a document's `url` field
|
|
1855
|
-
* is resolved.
|
|
1856
|
-
*
|
|
1857
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1858
|
-
*/
|
|
1859
|
-
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
1860
|
-
/**
|
|
1861
|
-
* The `brokenRoute` option allows you to define the route populated in the
|
|
1862
|
-
* `url` property for broken link or content relationship fields. A broken
|
|
1863
|
-
* link is a link or content relationship field whose linked document has been
|
|
1864
|
-
* unpublished or deleted.
|
|
1865
|
-
*
|
|
1866
|
-
* {@link https://prismic.io/docs/route-resolver}
|
|
1867
|
-
*/
|
|
1868
|
-
brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
|
|
1869
|
-
/**
|
|
1870
|
-
* Default parameters that will be sent with each query. These parameters can
|
|
1871
|
-
* be overridden on each query if needed.
|
|
1872
|
-
*/
|
|
1873
|
-
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
|
|
1874
|
-
/**
|
|
1875
|
-
* The client's ref mode state. This determines which ref is used during
|
|
1876
|
-
* queries.
|
|
1877
|
-
*/
|
|
1878
|
-
private refState;
|
|
1879
|
-
/**
|
|
1880
|
-
* Cached repository value.
|
|
1881
|
-
*/
|
|
1882
|
-
private cachedRepository;
|
|
1883
|
-
/**
|
|
1884
|
-
* Timestamp at which the cached repository data is considered stale.
|
|
1885
|
-
*/
|
|
1886
|
-
private cachedRepositoryExpiration;
|
|
1887
|
-
/**
|
|
1888
|
-
* Creates a Prismic client that can be used to query a repository.
|
|
1889
|
-
*
|
|
1890
|
-
* If used in an environment where a global `fetch` function is unavailable,
|
|
1891
|
-
* such as in some Node.js versions, the `fetch` option must be provided as
|
|
1892
|
-
* part of the `options` parameter.
|
|
1893
|
-
*
|
|
1894
|
-
* @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
|
|
1895
|
-
* API V2 endpoint for the repository.
|
|
1896
|
-
* @param options - Configuration that determines how content will be queried
|
|
1897
|
-
* from the Prismic repository.
|
|
1898
|
-
*
|
|
1899
|
-
* @returns A client that can query content from the repository.
|
|
1900
|
-
*/
|
|
1901
|
-
constructor(repositoryNameOrEndpoint: string, options?: ClientConfig);
|
|
1902
|
-
/**
|
|
1903
|
-
* Enables the client to automatically query content from a preview session if
|
|
1904
|
-
* one is active in browser environments. This is enabled by default in the
|
|
1905
|
-
* browser.
|
|
1906
|
-
*
|
|
1907
|
-
* For server environments, use `enableAutoPreviewsFromReq`.
|
|
1908
|
-
*
|
|
1909
|
-
* @example
|
|
1910
|
-
*
|
|
1911
|
-
* ```ts
|
|
1912
|
-
* client.enableAutoPreviews()
|
|
1913
|
-
* ```
|
|
1914
|
-
*
|
|
1915
|
-
* @see enableAutoPreviewsFromReq
|
|
1916
|
-
*/
|
|
1917
|
-
enableAutoPreviews(): void;
|
|
1918
|
-
/**
|
|
1919
|
-
* Enables the client to automatically query content from a preview session if
|
|
1920
|
-
* one is active in server environments. This is disabled by default on the
|
|
1921
|
-
* server.
|
|
1922
|
-
*
|
|
1923
|
-
* For browser environments, use `enableAutoPreviews`.
|
|
1924
|
-
*
|
|
1925
|
-
* @example
|
|
1926
|
-
*
|
|
1927
|
-
* ```ts
|
|
1928
|
-
* // In an express app
|
|
1929
|
-
* app.get("/", function (req, res) {
|
|
1930
|
-
* client.enableAutoPreviewsFromReq(req)
|
|
1931
|
-
* })
|
|
1932
|
-
* ```
|
|
1933
|
-
*
|
|
1934
|
-
* @param req - An HTTP server request object containing the request's
|
|
1935
|
-
* cookies.
|
|
1936
|
-
*/
|
|
1937
|
-
enableAutoPreviewsFromReq<R extends HttpRequestLike>(req: R): void;
|
|
1938
|
-
/**
|
|
1939
|
-
* Disables the client from automatically querying content from a preview
|
|
1940
|
-
* session if one is active.
|
|
1941
|
-
*
|
|
1942
|
-
* Automatic preview content querying is enabled by default unless this method
|
|
1943
|
-
* is called.
|
|
1944
|
-
*
|
|
1945
|
-
* @example
|
|
1946
|
-
*
|
|
1947
|
-
* ```ts
|
|
1948
|
-
* client.disableAutoPreviews()
|
|
1949
|
-
* ```
|
|
1950
|
-
*/
|
|
1951
|
-
disableAutoPreviews(): void;
|
|
1952
|
-
/**
|
|
1953
|
-
* Queries content from the Prismic repository.
|
|
1954
|
-
*
|
|
1955
|
-
* @example
|
|
1956
|
-
*
|
|
1957
|
-
* ```ts
|
|
1958
|
-
* const response = await client.get()
|
|
1959
|
-
* ```
|
|
1960
|
-
*
|
|
1961
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1962
|
-
*
|
|
1963
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
1964
|
-
*
|
|
1965
|
-
* @returns A paginated response containing the result of the query.
|
|
1966
|
-
*/
|
|
1967
|
-
get<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
1968
|
-
/**
|
|
1969
|
-
* Queries content from the Prismic repository and returns only the first
|
|
1970
|
-
* result, if any.
|
|
1971
|
-
*
|
|
1972
|
-
* @example
|
|
1973
|
-
*
|
|
1974
|
-
* ```ts
|
|
1975
|
-
* const document = await client.getFirst()
|
|
1976
|
-
* ```
|
|
1977
|
-
*
|
|
1978
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
1979
|
-
*
|
|
1980
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
1981
|
-
*
|
|
1982
|
-
* @returns The first result of the query, if any.
|
|
1983
|
-
*/
|
|
1984
|
-
getFirst<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
1985
|
-
/**
|
|
1986
|
-
* **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
|
|
1987
|
-
* require more resources than other methods. Prefer using other methods that
|
|
1988
|
-
* filter by filters such as `getAllByType`.
|
|
1989
|
-
*
|
|
1990
|
-
* Queries content from the Prismic repository and returns all matching
|
|
1991
|
-
* content. If no filters are provided, all documents will be fetched.
|
|
1992
|
-
*
|
|
1993
|
-
* This method may make multiple network requests to query all matching
|
|
1994
|
-
* content.
|
|
1995
|
-
*
|
|
1996
|
-
* @example
|
|
1997
|
-
*
|
|
1998
|
-
* ```ts
|
|
1999
|
-
* const response = await client.dangerouslyGetAll()
|
|
2000
|
-
* ```
|
|
2001
|
-
*
|
|
2002
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2003
|
-
*
|
|
2004
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
2005
|
-
*
|
|
2006
|
-
* @returns A list of documents matching the query.
|
|
2007
|
-
*/
|
|
2008
|
-
dangerouslyGetAll<TDocument extends TDocuments>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
2009
|
-
/**
|
|
2010
|
-
* Queries a document from the Prismic repository with a specific ID.
|
|
2011
|
-
*
|
|
2012
|
-
* @remarks
|
|
2013
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2014
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2015
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2016
|
-
* custom type.
|
|
2017
|
-
*
|
|
2018
|
-
* @example
|
|
2019
|
-
*
|
|
2020
|
-
* ```ts
|
|
2021
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
2022
|
-
* ```
|
|
2023
|
-
*
|
|
2024
|
-
* @typeParam TDocument- Type of the Prismic document returned.
|
|
2025
|
-
*
|
|
2026
|
-
* @param id - ID of the document.
|
|
2027
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2028
|
-
*
|
|
2029
|
-
* @returns The document with an ID matching the `id` parameter, if a matching
|
|
2030
|
-
* document exists.
|
|
2031
|
-
*/
|
|
2032
|
-
getByID<TDocument extends TDocuments>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
2033
|
-
/**
|
|
2034
|
-
* Queries documents from the Prismic repository with specific IDs.
|
|
2035
|
-
*
|
|
2036
|
-
* @remarks
|
|
2037
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2038
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2039
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2040
|
-
* custom type.
|
|
2041
|
-
*
|
|
2042
|
-
* @example
|
|
2043
|
-
*
|
|
2044
|
-
* ```ts
|
|
2045
|
-
* const response = await client.getByIDs([
|
|
2046
|
-
* "WW4bKScAAMAqmluX",
|
|
2047
|
-
* "U1kTRgEAAC8A5ldS",
|
|
2048
|
-
* ])
|
|
2049
|
-
* ```
|
|
2050
|
-
*
|
|
2051
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2052
|
-
*
|
|
2053
|
-
* @param ids - A list of document IDs.
|
|
2054
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2055
|
-
*
|
|
2056
|
-
* @returns A paginated response containing documents with IDs matching the
|
|
2057
|
-
* `ids` parameter.
|
|
2058
|
-
*/
|
|
2059
|
-
getByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
2060
|
-
/**
|
|
2061
|
-
* Queries all documents from the Prismic repository with specific IDs.
|
|
2062
|
-
*
|
|
2063
|
-
* This method may make multiple network requests to query all matching
|
|
2064
|
-
* content.
|
|
2065
|
-
*
|
|
2066
|
-
* @remarks
|
|
2067
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2068
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2069
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2070
|
-
* custom type.
|
|
2071
|
-
*
|
|
2072
|
-
* @example
|
|
2073
|
-
*
|
|
2074
|
-
* ```ts
|
|
2075
|
-
* const response = await client.getAllByIDs([
|
|
2076
|
-
* "WW4bKScAAMAqmluX",
|
|
2077
|
-
* "U1kTRgEAAC8A5ldS",
|
|
2078
|
-
* ])
|
|
2079
|
-
* ```
|
|
2080
|
-
*
|
|
2081
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2082
|
-
*
|
|
2083
|
-
* @param ids - A list of document IDs.
|
|
2084
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2085
|
-
*
|
|
2086
|
-
* @returns A list of documents with IDs matching the `ids` parameter.
|
|
2087
|
-
*/
|
|
2088
|
-
getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
2089
|
-
/**
|
|
2090
|
-
* Queries a document from the Prismic repository with a specific UID and
|
|
2091
|
-
* custom type.
|
|
2092
|
-
*
|
|
2093
|
-
* @remarks
|
|
2094
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2095
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2096
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2097
|
-
* custom type.
|
|
2098
|
-
*
|
|
2099
|
-
* @example
|
|
2100
|
-
*
|
|
2101
|
-
* ```ts
|
|
2102
|
-
* const document = await client.getByUID("blog_post", "my-first-post")
|
|
2103
|
-
* ```
|
|
2104
|
-
*
|
|
2105
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
2106
|
-
*
|
|
2107
|
-
* @param documentType - The API ID of the document's custom type.
|
|
2108
|
-
* @param uid - UID of the document.
|
|
2109
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2110
|
-
*
|
|
2111
|
-
* @returns The document with a UID matching the `uid` parameter, if a
|
|
2112
|
-
* matching document exists.
|
|
2113
|
-
*/
|
|
2114
|
-
getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType$1<TDocument, TDocumentType>>;
|
|
2115
|
-
/**
|
|
2116
|
-
* Queries document from the Prismic repository with specific UIDs and Custom
|
|
2117
|
-
* Type.
|
|
2118
|
-
*
|
|
2119
|
-
* @remarks
|
|
2120
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2121
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2122
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2123
|
-
* custom type.
|
|
2124
|
-
*
|
|
2125
|
-
* @example
|
|
2126
|
-
*
|
|
2127
|
-
* ```ts
|
|
2128
|
-
* const document = await client.getByUIDs("blog_post", [
|
|
2129
|
-
* "my-first-post",
|
|
2130
|
-
* "my-second-post",
|
|
2131
|
-
* ])
|
|
2132
|
-
* ```
|
|
2133
|
-
*
|
|
2134
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
2135
|
-
*
|
|
2136
|
-
* @param documentType - The API ID of the document's custom type.
|
|
2137
|
-
* @param uids - A list of document UIDs.
|
|
2138
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2139
|
-
*
|
|
2140
|
-
* @returns A paginated response containing documents with UIDs matching the
|
|
2141
|
-
* `uids` parameter.
|
|
2142
|
-
*/
|
|
2143
|
-
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType$1<TDocument, TDocumentType>>>;
|
|
2144
|
-
/**
|
|
2145
|
-
* Queries all documents from the Prismic repository with specific UIDs and
|
|
2146
|
-
* custom type.
|
|
2147
|
-
*
|
|
2148
|
-
* This method may make multiple network requests to query all matching
|
|
2149
|
-
* content.
|
|
2150
|
-
*
|
|
2151
|
-
* @remarks
|
|
2152
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
2153
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
2154
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
2155
|
-
* custom type.
|
|
2156
|
-
*
|
|
2157
|
-
* @example
|
|
2158
|
-
*
|
|
2159
|
-
* ```ts
|
|
2160
|
-
* const response = await client.getAllByUIDs([
|
|
2161
|
-
* "my-first-post",
|
|
2162
|
-
* "my-second-post",
|
|
2163
|
-
* ])
|
|
2164
|
-
* ```
|
|
2165
|
-
*
|
|
2166
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2167
|
-
*
|
|
2168
|
-
* @param documentType - The API ID of the document's custom type.
|
|
2169
|
-
* @param uids - A list of document UIDs.
|
|
2170
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2171
|
-
*
|
|
2172
|
-
* @returns A list of documents with UIDs matching the `uids` parameter.
|
|
2173
|
-
*/
|
|
2174
|
-
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType$1<TDocument, TDocumentType>[]>;
|
|
2175
|
-
/**
|
|
2176
|
-
* Queries a singleton document from the Prismic repository for a specific
|
|
2177
|
-
* custom type.
|
|
2178
|
-
*
|
|
2179
|
-
* @remarks
|
|
2180
|
-
* A singleton document is one that is configured in Prismic to only allow one
|
|
2181
|
-
* instance. For example, a repository may be configured to contain just one
|
|
2182
|
-
* Settings document. This is in contrast to a repeatable custom type which
|
|
2183
|
-
* allows multiple instances of itself.
|
|
2184
|
-
*
|
|
2185
|
-
* @example
|
|
2186
|
-
*
|
|
2187
|
-
* ```ts
|
|
2188
|
-
* const document = await client.getSingle("settings")
|
|
2189
|
-
* ```
|
|
2190
|
-
*
|
|
2191
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
2192
|
-
*
|
|
2193
|
-
* @param documentType - The API ID of the singleton custom type.
|
|
2194
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2195
|
-
*
|
|
2196
|
-
* @returns The singleton document for the custom type, if a matching document
|
|
2197
|
-
* exists.
|
|
2198
|
-
*/
|
|
2199
|
-
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType$1<TDocument, TDocumentType>>;
|
|
2200
|
-
/**
|
|
2201
|
-
* Queries documents from the Prismic repository for a specific custom type.
|
|
2202
|
-
*
|
|
2203
|
-
* Use `getAllByType` instead if you need to query all documents for a
|
|
2204
|
-
* specific custom type.
|
|
2205
|
-
*
|
|
2206
|
-
* @example
|
|
2207
|
-
*
|
|
2208
|
-
* ```ts
|
|
2209
|
-
* const response = await client.getByType("blog_post")
|
|
2210
|
-
* ```
|
|
2211
|
-
*
|
|
2212
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2213
|
-
*
|
|
2214
|
-
* @param documentType - The API ID of the custom type.
|
|
2215
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2216
|
-
*
|
|
2217
|
-
* @returns A paginated response containing documents of the custom type.
|
|
2218
|
-
*/
|
|
2219
|
-
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType$1<TDocument, TDocumentType>>>;
|
|
2220
|
-
/**
|
|
2221
|
-
* Queries all documents from the Prismic repository for a specific Custom
|
|
2222
|
-
* Type.
|
|
2223
|
-
*
|
|
2224
|
-
* This method may make multiple network requests to query all matching
|
|
2225
|
-
* content.
|
|
2226
|
-
*
|
|
2227
|
-
* @example
|
|
2228
|
-
*
|
|
2229
|
-
* ```ts
|
|
2230
|
-
* const response = await client.getByType("blog_post")
|
|
2231
|
-
* ```
|
|
2232
|
-
*
|
|
2233
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2234
|
-
*
|
|
2235
|
-
* @param documentType - The API ID of the custom type.
|
|
2236
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2237
|
-
*
|
|
2238
|
-
* @returns A list of all documents of the custom type.
|
|
2239
|
-
*/
|
|
2240
|
-
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType$1<TDocument, TDocumentType>[]>;
|
|
2241
|
-
/**
|
|
2242
|
-
* Queries documents from the Prismic repository with a specific tag.
|
|
2243
|
-
*
|
|
2244
|
-
* Use `getAllByTag` instead if you need to query all documents with a
|
|
2245
|
-
* specific tag.
|
|
2246
|
-
*
|
|
2247
|
-
* @example
|
|
2248
|
-
*
|
|
2249
|
-
* ```ts
|
|
2250
|
-
* const response = await client.getByTag("food")
|
|
2251
|
-
* ```
|
|
2252
|
-
*
|
|
2253
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2254
|
-
*
|
|
2255
|
-
* @param tag - The tag that must be included on a document.
|
|
2256
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2257
|
-
*
|
|
2258
|
-
* @returns A paginated response containing documents with the tag.
|
|
2259
|
-
*/
|
|
2260
|
-
getByTag<TDocument extends TDocuments>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
2261
|
-
/**
|
|
2262
|
-
* Queries all documents from the Prismic repository with a specific tag.
|
|
2263
|
-
*
|
|
2264
|
-
* This method may make multiple network requests to query all matching
|
|
2265
|
-
* content.
|
|
2266
|
-
*
|
|
2267
|
-
* @example
|
|
2268
|
-
*
|
|
2269
|
-
* ```ts
|
|
2270
|
-
* const response = await client.getAllByTag("food")
|
|
2271
|
-
* ```
|
|
2272
|
-
*
|
|
2273
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2274
|
-
*
|
|
2275
|
-
* @param tag - The tag that must be included on a document.
|
|
2276
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2277
|
-
*
|
|
2278
|
-
* @returns A list of all documents with the tag.
|
|
2279
|
-
*/
|
|
2280
|
-
getAllByTag<TDocument extends TDocuments>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
2281
|
-
/**
|
|
2282
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
2283
|
-
* document must be tagged with all of the queried tags to be included.
|
|
2284
|
-
*
|
|
2285
|
-
* @example
|
|
2286
|
-
*
|
|
2287
|
-
* ```ts
|
|
2288
|
-
* const response = await client.getByEveryTag(["food", "fruit"])
|
|
2289
|
-
* ```
|
|
2290
|
-
*
|
|
2291
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2292
|
-
*
|
|
2293
|
-
* @param tags - A list of tags that must be included on a document.
|
|
2294
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2295
|
-
*
|
|
2296
|
-
* @returns A paginated response containing documents with the tags.
|
|
2297
|
-
*/
|
|
2298
|
-
getByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
2299
|
-
/**
|
|
2300
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
2301
|
-
* document must be tagged with all of the queried tags to be included.
|
|
2302
|
-
*
|
|
2303
|
-
* This method may make multiple network requests to query all matching
|
|
2304
|
-
* content.
|
|
2305
|
-
*
|
|
2306
|
-
* @example
|
|
2307
|
-
*
|
|
2308
|
-
* ```ts
|
|
2309
|
-
* const response = await client.getAllByEveryTag(["food", "fruit"])
|
|
2310
|
-
* ```
|
|
2311
|
-
*
|
|
2312
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2313
|
-
*
|
|
2314
|
-
* @param tags - A list of tags that must be included on a document.
|
|
2315
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2316
|
-
*
|
|
2317
|
-
* @returns A list of all documents with the tags.
|
|
2318
|
-
*/
|
|
2319
|
-
getAllByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
2320
|
-
/**
|
|
2321
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
2322
|
-
* document must be tagged with at least one of the queried tags to be
|
|
2323
|
-
* included.
|
|
2324
|
-
*
|
|
2325
|
-
* @example
|
|
2326
|
-
*
|
|
2327
|
-
* ```ts
|
|
2328
|
-
* const response = await client.getByEveryTag(["food", "fruit"])
|
|
2329
|
-
* ```
|
|
2330
|
-
*
|
|
2331
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2332
|
-
*
|
|
2333
|
-
* @param tags - A list of tags that must be included on a document.
|
|
2334
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2335
|
-
*
|
|
2336
|
-
* @returns A paginated response containing documents with at least one of the
|
|
2337
|
-
* tags.
|
|
2338
|
-
*/
|
|
2339
|
-
getBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
2340
|
-
/**
|
|
2341
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
2342
|
-
* document must be tagged with at least one of the queried tags to be
|
|
2343
|
-
* included.
|
|
2344
|
-
*
|
|
2345
|
-
* This method may make multiple network requests to query all matching
|
|
2346
|
-
* content.
|
|
2347
|
-
*
|
|
2348
|
-
* @example
|
|
2349
|
-
*
|
|
2350
|
-
* ```ts
|
|
2351
|
-
* const response = await client.getAllBySomeTags(["food", "fruit"])
|
|
2352
|
-
* ```
|
|
2353
|
-
*
|
|
2354
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2355
|
-
*
|
|
2356
|
-
* @param tags - A list of tags that must be included on a document.
|
|
2357
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2358
|
-
*
|
|
2359
|
-
* @returns A list of all documents with at least one of the tags.
|
|
2360
|
-
*/
|
|
2361
|
-
getAllBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
2362
|
-
/**
|
|
2363
|
-
* Returns metadata about the Prismic repository, such as its refs, releases,
|
|
2364
|
-
* and custom types.
|
|
2365
|
-
*
|
|
2366
|
-
* @returns Repository metadata.
|
|
2367
|
-
*/
|
|
2368
|
-
getRepository(params?: FetchParams): Promise<Repository>;
|
|
2369
|
-
/**
|
|
2370
|
-
* Returns a list of all refs for the Prismic repository.
|
|
2371
|
-
*
|
|
2372
|
-
* Refs are used to identify which version of the repository's content should
|
|
2373
|
-
* be queried. All repositories will have at least one ref pointing to the
|
|
2374
|
-
* latest published content called the "master ref".
|
|
2375
|
-
*
|
|
2376
|
-
* @returns A list of all refs for the Prismic repository.
|
|
2377
|
-
*/
|
|
2378
|
-
getRefs(params?: FetchParams): Promise<Ref[]>;
|
|
2379
|
-
/**
|
|
2380
|
-
* Returns a ref for the Prismic repository with a matching ID.
|
|
2381
|
-
*
|
|
2382
|
-
* @param id - ID of the ref.
|
|
2383
|
-
*
|
|
2384
|
-
* @returns The ref with a matching ID, if it exists.
|
|
2385
|
-
*/
|
|
2386
|
-
getRefByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
2387
|
-
/**
|
|
2388
|
-
* Returns a ref for the Prismic repository with a matching label.
|
|
2389
|
-
*
|
|
2390
|
-
* @param label - Label of the ref.
|
|
2391
|
-
*
|
|
2392
|
-
* @returns The ref with a matching label, if it exists.
|
|
2393
|
-
*/
|
|
2394
|
-
getRefByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
2395
|
-
/**
|
|
2396
|
-
* Returns the master ref for the Prismic repository. The master ref points to
|
|
2397
|
-
* the repository's latest published content.
|
|
2398
|
-
*
|
|
2399
|
-
* @returns The repository's master ref.
|
|
2400
|
-
*/
|
|
2401
|
-
getMasterRef(params?: FetchParams): Promise<Ref>;
|
|
2402
|
-
/**
|
|
2403
|
-
* Returns a list of all Releases for the Prismic repository. Releases are
|
|
2404
|
-
* used to group content changes before publishing.
|
|
2405
|
-
*
|
|
2406
|
-
* @returns A list of all Releases for the Prismic repository.
|
|
2407
|
-
*/
|
|
2408
|
-
getReleases(params?: FetchParams): Promise<Ref[]>;
|
|
2409
|
-
/**
|
|
2410
|
-
* Returns a Release for the Prismic repository with a matching ID.
|
|
2411
|
-
*
|
|
2412
|
-
* @param id - ID of the Release.
|
|
2413
|
-
*
|
|
2414
|
-
* @returns The Release with a matching ID, if it exists.
|
|
2415
|
-
*/
|
|
2416
|
-
getReleaseByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
2417
|
-
/**
|
|
2418
|
-
* Returns a Release for the Prismic repository with a matching label.
|
|
2419
|
-
*
|
|
2420
|
-
* @param label - Label of the ref.
|
|
2421
|
-
*
|
|
2422
|
-
* @returns The ref with a matching label, if it exists.
|
|
2423
|
-
*/
|
|
2424
|
-
getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
2425
|
-
/**
|
|
2426
|
-
* Returns a list of all tags used in the Prismic repository.
|
|
2427
|
-
*
|
|
2428
|
-
* @returns A list of all tags used in the repository.
|
|
2429
|
-
*/
|
|
2430
|
-
getTags(params?: FetchParams): Promise<string[]>;
|
|
2431
|
-
/**
|
|
2432
|
-
* Builds a URL used to query content from the Prismic repository.
|
|
2433
|
-
*
|
|
2434
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
2435
|
-
*
|
|
2436
|
-
* @returns A URL string that can be requested to query content.
|
|
2437
|
-
*/
|
|
2438
|
-
buildQueryURL({ signal, fetchOptions, ...params }?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
|
|
2439
|
-
/**
|
|
2440
|
-
* Determines the URL for a previewed document during an active preview
|
|
2441
|
-
* session. The result of this method should be used to redirect the user to
|
|
2442
|
-
* the document's URL.
|
|
2443
|
-
*
|
|
2444
|
-
* @example
|
|
2445
|
-
*
|
|
2446
|
-
* ```ts
|
|
2447
|
-
* const url = client.resolvePreviewURL({
|
|
2448
|
-
* linkResolver: (document) => `/${document.uid}`
|
|
2449
|
-
* defaultURL: '/'
|
|
2450
|
-
* })
|
|
2451
|
-
* ```
|
|
2452
|
-
*
|
|
2453
|
-
* @param args - Arguments to configure the URL resolving.
|
|
2454
|
-
*
|
|
2455
|
-
* @returns The URL for the previewed document during an active preview
|
|
2456
|
-
* session. The user should be redirected to this URL.
|
|
2457
|
-
*/
|
|
2458
|
-
resolvePreviewURL<LinkResolverReturnType>(args: ResolvePreviewArgs<LinkResolverReturnType> & FetchParams): Promise<string>;
|
|
2459
|
-
/**
|
|
2460
|
-
* Configures the client to query the latest published content for all future
|
|
2461
|
-
* queries.
|
|
2462
|
-
*
|
|
2463
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
2464
|
-
* that query.
|
|
2465
|
-
*
|
|
2466
|
-
* @example
|
|
2467
|
-
*
|
|
2468
|
-
* ```ts
|
|
2469
|
-
* await client.queryLatestContent()
|
|
2470
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
2471
|
-
* ```
|
|
2472
|
-
*/
|
|
2473
|
-
queryLatestContent(): void;
|
|
2474
|
-
/**
|
|
2475
|
-
* Configures the client to query content from a specific Release identified
|
|
2476
|
-
* by its ID for all future queries.
|
|
2477
|
-
*
|
|
2478
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
2479
|
-
* that query.
|
|
2480
|
-
*
|
|
2481
|
-
* @example
|
|
2482
|
-
*
|
|
2483
|
-
* ```ts
|
|
2484
|
-
* await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa")
|
|
2485
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
2486
|
-
* ```
|
|
2487
|
-
*
|
|
2488
|
-
* @param releaseID - The ID of the Release.
|
|
2489
|
-
*/
|
|
2490
|
-
queryContentFromReleaseByID(releaseID: string): void;
|
|
2491
|
-
/**
|
|
2492
|
-
* Configures the client to query content from a specific Release identified
|
|
2493
|
-
* by its label for all future queries.
|
|
2494
|
-
*
|
|
2495
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
2496
|
-
* that query.
|
|
2497
|
-
*
|
|
2498
|
-
* @example
|
|
2499
|
-
*
|
|
2500
|
-
* ```ts
|
|
2501
|
-
* await client.queryContentFromReleaseByLabel("My Release")
|
|
2502
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
2503
|
-
* ```
|
|
2504
|
-
*
|
|
2505
|
-
* @param releaseLabel - The label of the Release.
|
|
2506
|
-
*/
|
|
2507
|
-
queryContentFromReleaseByLabel(releaseLabel: string): void;
|
|
2508
|
-
/**
|
|
2509
|
-
* Configures the client to query content from a specific ref. The ref can be
|
|
2510
|
-
* provided as a string or a function.
|
|
2511
|
-
*
|
|
2512
|
-
* If a function is provided, the ref is fetched lazily before each query. The
|
|
2513
|
-
* function may also be asynchronous.
|
|
2514
|
-
*
|
|
2515
|
-
* @example
|
|
2516
|
-
*
|
|
2517
|
-
* ```ts
|
|
2518
|
-
* await client.queryContentFromRef("my-ref")
|
|
2519
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
2520
|
-
* ```
|
|
2521
|
-
*
|
|
2522
|
-
* @param ref - The ref or a function that returns the ref from which to query
|
|
2523
|
-
* content.
|
|
2524
|
-
*/
|
|
2525
|
-
queryContentFromRef(ref: RefStringOrThunk): void;
|
|
2526
|
-
/**
|
|
2527
|
-
* A `fetch()` function to be used with GraphQL clients configured for
|
|
2528
|
-
* Prismic's GraphQL API. It automatically applies the necessary `prismic-ref`
|
|
2529
|
-
* and Authorization headers. Queries will automatically be minified by
|
|
2530
|
-
* removing whitespace where possible.
|
|
2531
|
-
*
|
|
2532
|
-
* @example
|
|
2533
|
-
*
|
|
2534
|
-
* ```ts
|
|
2535
|
-
* const graphQLClient = new ApolloClient({
|
|
2536
|
-
* link: new HttpLink({
|
|
2537
|
-
* uri: prismic.getGraphQLEndpoint(repositoryName),
|
|
2538
|
-
* // Provide `client.graphQLFetch` as the fetch implementation.
|
|
2539
|
-
* fetch: client.graphQLFetch,
|
|
2540
|
-
* // Using GET is required.
|
|
2541
|
-
* useGETForQueries: true,
|
|
2542
|
-
* }),
|
|
2543
|
-
* cache: new InMemoryCache(),
|
|
2544
|
-
* })
|
|
2545
|
-
* ```
|
|
2546
|
-
*
|
|
2547
|
-
* @param input - The `fetch()` `input` parameter. Only strings are supported.
|
|
2548
|
-
* @param init - The `fetch()` `init` parameter. Only plain objects are
|
|
2549
|
-
* supported.
|
|
2550
|
-
*
|
|
2551
|
-
* @returns The `fetch()` Response for the request.
|
|
2552
|
-
*
|
|
2553
|
-
* @experimental
|
|
2554
|
-
*/
|
|
2555
|
-
graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
|
|
2556
|
-
signal?: AbortSignalLike;
|
|
2557
|
-
}): Promise<Response>;
|
|
2558
|
-
/**
|
|
2559
|
-
* Returns a cached version of `getRepository` with a TTL.
|
|
2560
|
-
*
|
|
2561
|
-
* @returns Cached repository metadata.
|
|
2562
|
-
*/
|
|
2563
|
-
private getCachedRepository;
|
|
2564
|
-
/**
|
|
2565
|
-
* Returns the ref needed to query based on the client's current state. This
|
|
2566
|
-
* method may make a network request to fetch a ref or resolve the user's ref
|
|
2567
|
-
* thunk.
|
|
2568
|
-
*
|
|
2569
|
-
* If auto previews are enabled, the preview ref takes priority if available.
|
|
2570
|
-
*
|
|
2571
|
-
* The following strategies are used depending on the client's state:
|
|
2572
|
-
*
|
|
2573
|
-
* - If the user called `queryLatestContent`: Use the repository's master ref.
|
|
2574
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new master ref is
|
|
2575
|
-
* fetched.
|
|
2576
|
-
* - If the user called `queryContentFromReleaseByID`: Use the release's ref.
|
|
2577
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new ref for the
|
|
2578
|
-
* release is fetched.
|
|
2579
|
-
* - If the user called `queryContentFromReleaseByLabel`: Use the release's ref.
|
|
2580
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new ref for the
|
|
2581
|
-
* release is fetched.
|
|
2582
|
-
* - If the user called `queryContentFromRef`: Use the provided ref. Fall back
|
|
2583
|
-
* to the master ref if the ref is not a string.
|
|
2584
|
-
*
|
|
2585
|
-
* @returns The ref to use during a query.
|
|
2586
|
-
*/
|
|
2587
|
-
private getResolvedRefString;
|
|
2588
|
-
/**
|
|
2589
|
-
* The private implementation of `this.get`. It returns the API response and
|
|
2590
|
-
* the URL used to make the request. The URL is sometimes used in the public
|
|
2591
|
-
* method to include in thrown errors.
|
|
2592
|
-
*
|
|
2593
|
-
* This method retries requests that throw `RefNotFoundError` or
|
|
2594
|
-
* `RefExpiredError`. It contains special logic to retry with the latest
|
|
2595
|
-
* master ref, provided in the API's error message.
|
|
2596
|
-
*
|
|
2597
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
2598
|
-
*
|
|
2599
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
2600
|
-
*
|
|
2601
|
-
* @returns An object containing the paginated response containing the result
|
|
2602
|
-
* of the query and the URL used to make the API request.
|
|
2603
|
-
*/
|
|
2604
|
-
private _get;
|
|
2605
|
-
protected _buildRequestInit(params?: FetchParams): RequestInitLike;
|
|
2606
|
-
}
|
|
2607
|
-
|
|
2608
|
-
/**
|
|
2609
|
-
* Type definitions for the `createClient()` function. May be augmented by
|
|
2610
|
-
* third-party libraries.
|
|
2611
|
-
*/
|
|
2612
|
-
interface CreateClient {
|
|
2613
|
-
<TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof Client>): Client<TDocuments>;
|
|
2614
|
-
}
|
|
2615
|
-
/**
|
|
2616
|
-
* Creates a Prismic client that can be used to query content from a repository.
|
|
2617
|
-
*
|
|
2618
|
-
* @example
|
|
2619
|
-
*
|
|
2620
|
-
* ```ts
|
|
2621
|
-
* // With a repository name
|
|
2622
|
-
* createClient("my-repo")
|
|
2623
|
-
*
|
|
2624
|
-
* // With a full Prismic Content API endpoint
|
|
2625
|
-
* createClient("https://my-repo.cdn.prismic.io/api/v2")
|
|
2626
|
-
* ```
|
|
2627
|
-
*
|
|
2628
|
-
* @typeParam TDocuments - A union of Prismic page and custom types for the
|
|
2629
|
-
* repository.
|
|
2630
|
-
*
|
|
2631
|
-
* @param repositoryNameOrEndpoint - The Prismic repository name or full Content
|
|
2632
|
-
* API endpoint for the repository.
|
|
2633
|
-
* @param options - Configuration that determines how content will be queried
|
|
2634
|
-
* from the Prismic repository.
|
|
2635
|
-
*
|
|
2636
|
-
* @returns A client that can query content from the repository.
|
|
2637
|
-
*
|
|
2638
|
-
* @see @prismicio/client technical reference: {@link https://prismic.io/docs/technical-reference/prismicio-client/v7}
|
|
2639
|
-
*/
|
|
2640
|
-
declare const createClient: CreateClient;
|
|
2641
|
-
|
|
2642
|
-
/**
|
|
2643
|
-
* An object representing an tag used by the Asset API.
|
|
2644
|
-
*
|
|
2645
|
-
* @see Prismic Asset API technical reference: {@link https://prismic.io/docs/asset-api-technical-reference}
|
|
2646
|
-
*/
|
|
2647
|
-
type AssetTag = {
|
|
2648
|
-
/**
|
|
2649
|
-
* Tag ID.
|
|
2650
|
-
*/
|
|
2651
|
-
id: string;
|
|
2652
|
-
/**
|
|
2653
|
-
* Tag name.
|
|
2654
|
-
*/
|
|
2655
|
-
name: string;
|
|
2656
|
-
/**
|
|
2657
|
-
* Tag creation date.
|
|
2658
|
-
*/
|
|
2659
|
-
created_at: number;
|
|
2660
|
-
/**
|
|
2661
|
-
* Tag last modification date.
|
|
2662
|
-
*/
|
|
2663
|
-
last_modified: number;
|
|
2664
|
-
/**
|
|
2665
|
-
* @internal
|
|
2666
|
-
*/
|
|
2667
|
-
uploader_id?: string;
|
|
2668
|
-
/**
|
|
2669
|
-
* Number of assets tagged with this tag.
|
|
2670
|
-
*/
|
|
2671
|
-
count?: number;
|
|
2672
|
-
};
|
|
2673
|
-
|
|
2674
|
-
/**
|
|
2675
|
-
* Asset types.
|
|
2676
|
-
*/
|
|
2677
|
-
declare const AssetType: {
|
|
2678
|
-
readonly All: "all";
|
|
2679
|
-
readonly Audio: "audio";
|
|
2680
|
-
readonly Document: "document";
|
|
2681
|
-
readonly Image: "image";
|
|
2682
|
-
readonly Video: "video";
|
|
2683
|
-
};
|
|
2684
|
-
/**
|
|
2685
|
-
* An object representing an asset returned by the Asset API.
|
|
2686
|
-
*
|
|
2687
|
-
* @see Prismic Asset API technical reference: {@link https://prismic.io/docs/asset-api-technical-reference}
|
|
2688
|
-
*/
|
|
2689
|
-
type Asset = {
|
|
2690
|
-
/**
|
|
2691
|
-
* Asset ID.
|
|
2692
|
-
*/
|
|
2693
|
-
id: string;
|
|
2694
|
-
/**
|
|
2695
|
-
* Asset URL.
|
|
2696
|
-
*/
|
|
2697
|
-
url: string;
|
|
2698
|
-
/**
|
|
2699
|
-
* Asset creation date.
|
|
2700
|
-
*/
|
|
2701
|
-
created_at: number;
|
|
2702
|
-
/**
|
|
2703
|
-
* Asset last modification date.
|
|
2704
|
-
*/
|
|
2705
|
-
last_modified: number;
|
|
2706
|
-
/**
|
|
2707
|
-
* Asset filename.
|
|
2708
|
-
*/
|
|
2709
|
-
filename: string;
|
|
2710
|
-
/**
|
|
2711
|
-
* Asset extension.
|
|
2712
|
-
*/
|
|
2713
|
-
extension: string;
|
|
2714
|
-
/**
|
|
2715
|
-
* Asset size in bytes.
|
|
2716
|
-
*/
|
|
2717
|
-
size: number;
|
|
2718
|
-
/**
|
|
2719
|
-
* Asset kind.
|
|
2720
|
-
*/
|
|
2721
|
-
kind: Exclude<(typeof AssetType)[keyof typeof AssetType], (typeof AssetType)["All"]>;
|
|
2722
|
-
/**
|
|
2723
|
-
* Asset width in pixels.
|
|
2724
|
-
*/
|
|
2725
|
-
width?: number;
|
|
2726
|
-
/**
|
|
2727
|
-
* Asset height in pixels.
|
|
2728
|
-
*/
|
|
2729
|
-
height?: number;
|
|
2730
|
-
/**
|
|
2731
|
-
* Asset notes.
|
|
2732
|
-
*/
|
|
2733
|
-
notes?: string;
|
|
2734
|
-
/**
|
|
2735
|
-
* Asset credits.
|
|
2736
|
-
*/
|
|
2737
|
-
credits?: string;
|
|
2738
|
-
/**
|
|
2739
|
-
* Asset alt text.
|
|
2740
|
-
*/
|
|
2741
|
-
alt?: string;
|
|
2742
|
-
/**
|
|
2743
|
-
* Asset tags.
|
|
2744
|
-
*/
|
|
2745
|
-
tags?: AssetTag[];
|
|
2746
|
-
/**
|
|
2747
|
-
* @internal
|
|
2748
|
-
*/
|
|
2749
|
-
origin_url?: string;
|
|
2750
|
-
/**
|
|
2751
|
-
* @internal
|
|
2752
|
-
*/
|
|
2753
|
-
uploader_id?: string;
|
|
2754
|
-
/**
|
|
2755
|
-
* @internal
|
|
2756
|
-
*/
|
|
2757
|
-
search_highlight?: {
|
|
2758
|
-
filename?: string[];
|
|
2759
|
-
notes?: string[];
|
|
2760
|
-
credits?: string[];
|
|
2761
|
-
alt?: string[];
|
|
2762
|
-
};
|
|
2763
|
-
};
|
|
2764
|
-
|
|
2765
|
-
type ValueOrThunk<T> = T | (() => Promise<T> | T);
|
|
2766
|
-
/**
|
|
2767
|
-
* A content relationship field in a migration.
|
|
2768
|
-
*/
|
|
2769
|
-
type MigrationContentRelationship<TDocuments extends PrismicDocument = PrismicDocument> = ValueOrThunk<TDocuments | PrismicMigrationDocument<TDocuments> | undefined> | (Pick<ContentRelationshipField, "link_type"> & {
|
|
2770
|
-
id: ValueOrThunk<TDocuments | PrismicMigrationDocument<TDocuments> | undefined>;
|
|
2771
|
-
});
|
|
2772
|
-
|
|
2773
|
-
/**
|
|
2774
|
-
* A utility type that extends any fields in a record with their migration
|
|
2775
|
-
* fields equivalent.
|
|
2776
|
-
*
|
|
2777
|
-
* @typeParam T - Type of the record to extend.
|
|
2778
|
-
*/
|
|
2779
|
-
type InjectMigrationSpecificTypes<T> = T extends RTImageNode ? T | (Omit<T, "linkTo"> & InjectMigrationSpecificTypes<Pick<T, "linkTo">>) | MigrationRTImageNode | undefined : T extends FilledImageFieldImage ? T | MigrationImage | undefined : T extends FilledLinkToMediaField ? T | MigrationLinkToMedia | undefined : T extends FilledContentRelationshipField ? T | MigrationContentRelationship : T extends EmbedField<AnyOEmbed & OEmbedExtra, "filled"> ? T | Pick<T, "embed_url"> : T extends SharedSlice ? T | InjectMigrationSpecificTypes<Omit<T, "id" | "slice_label" | "version">> : T extends Record<any, any> ? {
|
|
2780
|
-
[P in keyof T]: InjectMigrationSpecificTypes<T[P]>;
|
|
2781
|
-
} : T extends Array<infer U> ? Array<InjectMigrationSpecificTypes<U>> : T;
|
|
2782
|
-
/**
|
|
2783
|
-
* A utility type that ties the type and data of a Prismic document, creating a
|
|
2784
|
-
* strict union.
|
|
2785
|
-
*/
|
|
2786
|
-
type TiedDocumentTypeAndData<TDocument extends PrismicDocument> = TDocument extends PrismicDocument<infer TData, infer TType> ? {
|
|
2787
|
-
/**
|
|
2788
|
-
* Type of the document.
|
|
2789
|
-
*/
|
|
2790
|
-
type: TType;
|
|
2791
|
-
/**
|
|
2792
|
-
* Data contained in the document.
|
|
2793
|
-
*/
|
|
2794
|
-
data: InjectMigrationSpecificTypes<TData>;
|
|
2795
|
-
} & (TDocument extends PrismicDocumentWithUID ? Pick<TDocument, "uid"> : Partial<Pick<TDocument, "uid">>) : never;
|
|
2796
|
-
/**
|
|
2797
|
-
* A pending Prismic document to be created with the Migration API.
|
|
2798
|
-
*
|
|
2799
|
-
* @typeParam TDocument - Type of the Prismic document.
|
|
2800
|
-
*/
|
|
2801
|
-
type PendingPrismicDocument<TDocument extends PrismicDocument = PrismicDocument> = Pick<TDocument, "lang"> & Partial<Pick<TDocument, "tags">> & TiedDocumentTypeAndData<TDocument>;
|
|
2802
|
-
/**
|
|
2803
|
-
* An existing Prismic document to be updated with the Migration API.
|
|
2804
|
-
*
|
|
2805
|
-
* @typeParam TDocument - Type of the Prismic document.
|
|
2806
|
-
*/
|
|
2807
|
-
type ExistingPrismicDocument<TDocument extends PrismicDocument = PrismicDocument> = Omit<TDocument, "uid" | "type" | "data"> & TiedDocumentTypeAndData<TDocument>;
|
|
2808
|
-
/**
|
|
2809
|
-
* A Prismic document to be sent to the Migration API.
|
|
2810
|
-
*
|
|
2811
|
-
* @typeParam TDocument - Type of the Prismic document.
|
|
2812
|
-
*/
|
|
2813
|
-
type MigrationDocument<TDocument extends PrismicDocument = PrismicDocument> = PendingPrismicDocument<TDocument> | ExistingPrismicDocument<TDocument>;
|
|
2814
|
-
/**
|
|
2815
|
-
* A Prismic migration document instance.
|
|
2816
|
-
*
|
|
2817
|
-
* @typeParam TDocument - Type of the Prismic document.
|
|
2818
|
-
*/
|
|
2819
|
-
declare class PrismicMigrationDocument<TDocument extends PrismicDocument = PrismicDocument> {
|
|
2820
|
-
/**
|
|
2821
|
-
* The document to be sent to the Migration API.
|
|
2822
|
-
*/
|
|
2823
|
-
document: MigrationDocument<TDocument> & Partial<Pick<TDocument, "id">>;
|
|
2824
|
-
/**
|
|
2825
|
-
* The name of the document displayed in the editor.
|
|
2826
|
-
*/
|
|
2827
|
-
title?: string;
|
|
2828
|
-
/**
|
|
2829
|
-
* The link to the master language document to relate the document to if any.
|
|
2830
|
-
*/
|
|
2831
|
-
masterLanguageDocument?: MigrationContentRelationship;
|
|
2832
|
-
/**
|
|
2833
|
-
* Original Prismic document when the migration document came from another
|
|
2834
|
-
* Prismic repository.
|
|
2835
|
-
*
|
|
2836
|
-
* @remarks
|
|
2837
|
-
* When migrating a document from another repository, one might want to alter
|
|
2838
|
-
* it with migration specific types, hence accepting an
|
|
2839
|
-
* `ExistingPrismicDocument` instead of a regular `PrismicDocument`.
|
|
2840
|
-
*/
|
|
2841
|
-
originalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>;
|
|
2842
|
-
/**
|
|
2843
|
-
* Creates a Prismic migration document instance.
|
|
2844
|
-
*
|
|
2845
|
-
* @param document - The document to be sent to the Migration API.
|
|
2846
|
-
* @param title - The name of the document displayed in the editor.
|
|
2847
|
-
* @param params - Parameters to create/update the document with on the
|
|
2848
|
-
* Migration API.
|
|
2849
|
-
*
|
|
2850
|
-
* @returns A Prismic migration document instance.
|
|
2851
|
-
*/
|
|
2852
|
-
constructor(document: MigrationDocument<TDocument>, title?: string, params?: {
|
|
2853
|
-
masterLanguageDocument?: MigrationContentRelationship;
|
|
2854
|
-
originalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>;
|
|
2855
|
-
});
|
|
2856
|
-
}
|
|
2857
|
-
|
|
2858
|
-
/**
|
|
2859
|
-
* An asset to be uploaded to Prismic media library.
|
|
2860
|
-
*/
|
|
2861
|
-
type MigrationAssetConfig = {
|
|
2862
|
-
/**
|
|
2863
|
-
* ID the assets is indexed with on the migration instance.
|
|
2864
|
-
*
|
|
2865
|
-
* @remarks
|
|
2866
|
-
* This property's value is not necessarily the same as the as the one in the
|
|
2867
|
-
* `file` property. It is mainly used for deduplication within a `Migration`
|
|
2868
|
-
* instance.
|
|
2869
|
-
*/
|
|
2870
|
-
id: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0];
|
|
2871
|
-
/**
|
|
2872
|
-
* File to be uploaded as an asset.
|
|
2873
|
-
*/
|
|
2874
|
-
file: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0];
|
|
2875
|
-
/**
|
|
2876
|
-
* Filename of the asset.
|
|
2877
|
-
*/
|
|
2878
|
-
filename: string;
|
|
2879
|
-
/**
|
|
2880
|
-
* Notes about the asset. Notes are private and only visible in Prismic media
|
|
2881
|
-
* library.
|
|
2882
|
-
*/
|
|
2883
|
-
notes?: string;
|
|
2884
|
-
/**
|
|
2885
|
-
* Credits and copyright for the asset if any.
|
|
2886
|
-
*/
|
|
2887
|
-
credits?: string;
|
|
2888
|
-
/**
|
|
2889
|
-
* Alternate text for the asset.
|
|
2890
|
-
*/
|
|
2891
|
-
alt?: string;
|
|
2892
|
-
/**
|
|
2893
|
-
* Tags associated with the asset.
|
|
2894
|
-
*
|
|
2895
|
-
* @remarks
|
|
2896
|
-
* Tags should be at least 3 characters long and 20 characters at most.
|
|
2897
|
-
*/
|
|
2898
|
-
tags?: string[];
|
|
2899
|
-
};
|
|
2900
|
-
/**
|
|
2901
|
-
* An image field in a migration.
|
|
2902
|
-
*/
|
|
2903
|
-
type MigrationImage = PrismicMigrationAsset | ({
|
|
2904
|
-
/**
|
|
2905
|
-
* A reference to the migration asset used to resolve the image field's
|
|
2906
|
-
* value.
|
|
2907
|
-
*/
|
|
2908
|
-
id: PrismicMigrationAsset;
|
|
2909
|
-
} & Record<string, PrismicMigrationAsset>);
|
|
2910
|
-
/**
|
|
2911
|
-
* A link to media field in a migration.
|
|
2912
|
-
*/
|
|
2913
|
-
type MigrationLinkToMedia = Pick<LinkToMediaField<"filled">, "link_type" | "text"> & {
|
|
2914
|
-
/**
|
|
2915
|
-
* A reference to the migration asset used to resolve the link to media
|
|
2916
|
-
* field's value.
|
|
2917
|
-
*/
|
|
2918
|
-
id: PrismicMigrationAsset;
|
|
2919
|
-
};
|
|
2920
|
-
/**
|
|
2921
|
-
* A rich text image node in a migration.
|
|
2922
|
-
*/
|
|
2923
|
-
type MigrationRTImageNode = InjectMigrationSpecificTypes<Pick<RTImageNode, "type" | "linkTo">> & {
|
|
2924
|
-
/**
|
|
2925
|
-
* A reference to the migration asset used to resolve the rich text image
|
|
2926
|
-
* node's value.
|
|
2927
|
-
*/
|
|
2928
|
-
id: PrismicMigrationAsset;
|
|
2929
|
-
};
|
|
2930
|
-
/**
|
|
2931
|
-
* A migration asset used with the Prismic Migration API.
|
|
2932
|
-
*/
|
|
2933
|
-
declare class PrismicMigrationAsset {
|
|
2934
|
-
/**
|
|
2935
|
-
* Asset object from Prismic, available once created.
|
|
2936
|
-
*/
|
|
2937
|
-
asset?: Asset;
|
|
2938
|
-
/**
|
|
2939
|
-
* Configuration of the asset.
|
|
2940
|
-
*/
|
|
2941
|
-
config: MigrationAssetConfig;
|
|
2942
|
-
/**
|
|
2943
|
-
* The initial field value this migration field was created with.
|
|
2944
|
-
*/
|
|
2945
|
-
originalField?: FilledImageFieldImage | LinkToMediaField<"filled"> | RTImageNode;
|
|
2946
|
-
/**
|
|
2947
|
-
* Creates a migration asset used with the Prismic Migration API.
|
|
2948
|
-
*
|
|
2949
|
-
* @param config - Configuration of the asset.
|
|
2950
|
-
* @param initialField - The initial field value if any.
|
|
2951
|
-
*
|
|
2952
|
-
* @returns A migration asset instance.
|
|
2953
|
-
*/
|
|
2954
|
-
constructor(config: MigrationAssetConfig, initialField?: FilledImageFieldImage | LinkToMediaField<"filled"> | RTImageNode);
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
/**
|
|
2958
|
-
* Extracts one or more Prismic document types that match a given Prismic
|
|
2959
|
-
* document type. If no matches are found, no extraction is performed and the
|
|
2960
|
-
* union of all provided Prismic document types are returned.
|
|
2961
|
-
*
|
|
2962
|
-
* @typeParam TDocuments - Prismic document types from which to extract.
|
|
2963
|
-
* @typeParam TDocumentType - Type(s) to match `TDocuments` against.
|
|
2964
|
-
*/
|
|
2965
|
-
type ExtractDocumentType<TDocuments extends {
|
|
2966
|
-
type: string;
|
|
2967
|
-
}, TDocumentType extends TDocuments["type"]> = Extract<TDocuments, {
|
|
2968
|
-
type: TDocumentType;
|
|
2969
|
-
}> extends never ? TDocuments : Extract<TDocuments, {
|
|
2970
|
-
type: TDocumentType;
|
|
2971
|
-
}>;
|
|
2972
|
-
/**
|
|
2973
|
-
* A helper that allows preparing your migration to Prismic.
|
|
2974
|
-
*
|
|
2975
|
-
* @typeParam TDocuments - Document types that are registered for the Prismic
|
|
2976
|
-
* repository. Query methods will automatically be typed based on this type.
|
|
2977
|
-
*/
|
|
2978
|
-
declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
2979
|
-
#private;
|
|
2980
|
-
/**
|
|
2981
|
-
* Assets registered in the migration.
|
|
2982
|
-
*
|
|
2983
|
-
* @internal
|
|
2984
|
-
*/
|
|
2985
|
-
_assets: Map<MigrationAssetConfig["file"], PrismicMigrationAsset>;
|
|
2986
|
-
/**
|
|
2987
|
-
* Documents registered in the migration.
|
|
2988
|
-
*
|
|
2989
|
-
* @internal
|
|
2990
|
-
*/
|
|
2991
|
-
_documents: PrismicMigrationDocument<TDocuments>[];
|
|
2992
|
-
/**
|
|
2993
|
-
* Registers an asset to be created in the migration from an asset object.
|
|
2994
|
-
*
|
|
2995
|
-
* @remarks
|
|
2996
|
-
* This method does not create the asset in Prismic media library right away.
|
|
2997
|
-
* Instead, it registers it in your migration. The asset will be created when
|
|
2998
|
-
* the migration is executed through the `writeClient.migrate()` method.
|
|
2999
|
-
*
|
|
3000
|
-
* @param asset - An asset object from Prismic Asset API.
|
|
3001
|
-
*
|
|
3002
|
-
* @returns A migration asset field instance.
|
|
3003
|
-
*
|
|
3004
|
-
* @internal
|
|
3005
|
-
*/
|
|
3006
|
-
createAsset(asset: Asset): PrismicMigrationAsset;
|
|
3007
|
-
/**
|
|
3008
|
-
* Registers an asset to be created in the migration from an image or link to
|
|
3009
|
-
* media field.
|
|
3010
|
-
*
|
|
3011
|
-
* @remarks
|
|
3012
|
-
* This method does not create the asset in Prismic media library right away.
|
|
3013
|
-
* Instead, it registers it in your migration. The asset will be created when
|
|
3014
|
-
* the migration is executed through the `writeClient.migrate()` method.
|
|
3015
|
-
*
|
|
3016
|
-
* @param imageOrLinkToMediaField - An image or link to media field from
|
|
3017
|
-
* Prismic Document API.
|
|
3018
|
-
*
|
|
3019
|
-
* @returns A migration asset field instance.
|
|
3020
|
-
*
|
|
3021
|
-
* @internal
|
|
3022
|
-
*/
|
|
3023
|
-
createAsset(imageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField): PrismicMigrationAsset;
|
|
3024
|
-
/**
|
|
3025
|
-
* Registers an asset to be created in the migration from a file.
|
|
3026
|
-
*
|
|
3027
|
-
* @remarks
|
|
3028
|
-
* This method does not create the asset in Prismic media library right away.
|
|
3029
|
-
* Instead, it registers it in your migration. The asset will be created when
|
|
3030
|
-
* the migration is executed through the `writeClient.migrate()` method.
|
|
3031
|
-
*
|
|
3032
|
-
* @param file - The URL or content of the file to be created.
|
|
3033
|
-
* @param filename - The filename of the asset.
|
|
3034
|
-
* @param params - Additional asset data.
|
|
3035
|
-
*
|
|
3036
|
-
* @returns A migration asset field instance.
|
|
3037
|
-
*/
|
|
3038
|
-
createAsset(file: MigrationAssetConfig["file"], filename: MigrationAssetConfig["filename"], params?: {
|
|
3039
|
-
notes?: string;
|
|
3040
|
-
credits?: string;
|
|
3041
|
-
alt?: string;
|
|
3042
|
-
tags?: string[];
|
|
3043
|
-
}): PrismicMigrationAsset;
|
|
3044
|
-
/**
|
|
3045
|
-
* Registers a document to be created in the migration.
|
|
3046
|
-
*
|
|
3047
|
-
* @remarks
|
|
3048
|
-
* This method does not create the document in Prismic right away. Instead, it
|
|
3049
|
-
* registers it in your migration. The document will be created when the
|
|
3050
|
-
* migration is executed through the `writeClient.migrate()` method.
|
|
3051
|
-
*
|
|
3052
|
-
* @typeParam TType - Type of the Prismic document to create.
|
|
3053
|
-
*
|
|
3054
|
-
* @param document - The document to create.
|
|
3055
|
-
* @param title - The title of the document to create which will be displayed
|
|
3056
|
-
* in the editor.
|
|
3057
|
-
* @param params - Document master language document ID.
|
|
3058
|
-
*
|
|
3059
|
-
* @returns A migration document instance.
|
|
3060
|
-
*/
|
|
3061
|
-
createDocument<TType extends TDocuments["type"]>(document: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>, title: string, params?: {
|
|
3062
|
-
masterLanguageDocument?: MigrationContentRelationship;
|
|
3063
|
-
}): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
|
|
3064
|
-
/**
|
|
3065
|
-
* Registers an existing document to be updated in the migration.
|
|
3066
|
-
*
|
|
3067
|
-
* @remarks
|
|
3068
|
-
* This method does not update the document in Prismic right away. Instead, it
|
|
3069
|
-
* registers it in your migration. The document will be updated when the
|
|
3070
|
-
* migration is executed through the `writeClient.migrate()` method.
|
|
3071
|
-
*
|
|
3072
|
-
* @typeParam TType - Type of Prismic documents to update.
|
|
3073
|
-
*
|
|
3074
|
-
* @param document - The document to update.
|
|
3075
|
-
* @param title - The title of the document to update which will be displayed
|
|
3076
|
-
* in the editor.
|
|
3077
|
-
*
|
|
3078
|
-
* @returns A migration document instance.
|
|
3079
|
-
*/
|
|
3080
|
-
updateDocument<TType extends TDocuments["type"]>(document: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>, title?: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
|
|
3081
|
-
/**
|
|
3082
|
-
* Registers a document from another Prismic repository to be created in the
|
|
3083
|
-
* migration.
|
|
3084
|
-
*
|
|
3085
|
-
* @remarks
|
|
3086
|
-
* This method does not create the document in Prismic right away. Instead, it
|
|
3087
|
-
* registers it in your migration. The document will be created when the
|
|
3088
|
-
* migration is executed through the `writeClient.migrate()` method.
|
|
3089
|
-
*
|
|
3090
|
-
* @param document - The document from Prismic to create.
|
|
3091
|
-
* @param title - The title of the document to create which will be displayed
|
|
3092
|
-
* in the editor.
|
|
3093
|
-
*
|
|
3094
|
-
* @returns A migration document instance.
|
|
3095
|
-
*/
|
|
3096
|
-
createDocumentFromPrismic<TType extends TDocuments["type"]>(document: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>, title: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>;
|
|
3097
|
-
/**
|
|
3098
|
-
* Queries a document from the migration instance with a specific UID and
|
|
3099
|
-
* custom type.
|
|
3100
|
-
*
|
|
3101
|
-
* @example
|
|
3102
|
-
*
|
|
3103
|
-
* ```ts
|
|
3104
|
-
* const contentRelationship = migration.createContentRelationship(() =>
|
|
3105
|
-
* migration.getByUID("blog_post", "my-first-post"),
|
|
3106
|
-
* )
|
|
3107
|
-
* ```
|
|
3108
|
-
*
|
|
3109
|
-
* @typeParam TType - Type of the Prismic document returned.
|
|
3110
|
-
*
|
|
3111
|
-
* @param type - The API ID of the document's custom type.
|
|
3112
|
-
* @param uid - The UID of the document.
|
|
3113
|
-
*
|
|
3114
|
-
* @returns The migration document instance with a UID matching the `uid`
|
|
3115
|
-
* parameter, if a matching document is found.
|
|
3116
|
-
*/
|
|
3117
|
-
getByUID<TType extends TDocuments["type"]>(type: TType, uid: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
3118
|
-
/**
|
|
3119
|
-
* Queries a singleton document from the migration instance for a specific
|
|
3120
|
-
* custom type.
|
|
3121
|
-
*
|
|
3122
|
-
* @example
|
|
3123
|
-
*
|
|
3124
|
-
* ```ts
|
|
3125
|
-
* const contentRelationship = migration.createContentRelationship(() =>
|
|
3126
|
-
* migration.getSingle("settings"),
|
|
3127
|
-
* )
|
|
3128
|
-
* ```
|
|
3129
|
-
*
|
|
3130
|
-
* @typeParam TType - Type of the Prismic document returned.
|
|
3131
|
-
*
|
|
3132
|
-
* @param type - The API ID of the singleton custom type.
|
|
3133
|
-
*
|
|
3134
|
-
* @returns The migration document instance for the custom type, if a matching
|
|
3135
|
-
* document is found.
|
|
3136
|
-
*/
|
|
3137
|
-
getSingle<TType extends TDocuments["type"]>(type: TType): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
3138
|
-
/**
|
|
3139
|
-
* Queries a document from the migration instance for a specific original ID.
|
|
3140
|
-
*
|
|
3141
|
-
* @example
|
|
3142
|
-
*
|
|
3143
|
-
* ```ts
|
|
3144
|
-
* const contentRelationship = migration.createContentRelationship(() =>
|
|
3145
|
-
* migration._getByOriginalID("YhdrDxIAACgAcp_b"),
|
|
3146
|
-
* )
|
|
3147
|
-
* ```
|
|
3148
|
-
*
|
|
3149
|
-
* @typeParam TType - Type of the Prismic document returned.
|
|
3150
|
-
*
|
|
3151
|
-
* @param id - The original ID of the Prismic document.
|
|
3152
|
-
*
|
|
3153
|
-
* @returns The migration document instance for the original ID, if a matching
|
|
3154
|
-
* document is found.
|
|
3155
|
-
*
|
|
3156
|
-
* @internal
|
|
3157
|
-
*/
|
|
3158
|
-
_getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
/**
|
|
3162
|
-
* Utility type to construct events reported by the migration process.
|
|
3163
|
-
*/
|
|
3164
|
-
type MigrateReporterEvent<TType extends string, TData = never> = TData extends never ? {
|
|
3165
|
-
type: TType;
|
|
3166
|
-
} : {
|
|
3167
|
-
type: TType;
|
|
3168
|
-
data: TData;
|
|
3169
|
-
};
|
|
3170
|
-
/**
|
|
3171
|
-
* A map of event types and their data reported by the migration process.
|
|
3172
|
-
*/
|
|
3173
|
-
type MigrateReporterEventMap = {
|
|
3174
|
-
start: {
|
|
3175
|
-
pending: {
|
|
3176
|
-
documents: number;
|
|
3177
|
-
assets: number;
|
|
3178
|
-
};
|
|
3179
|
-
};
|
|
3180
|
-
end: {
|
|
3181
|
-
migrated: {
|
|
3182
|
-
documents: number;
|
|
3183
|
-
assets: number;
|
|
3184
|
-
};
|
|
3185
|
-
};
|
|
3186
|
-
"assets:creating": {
|
|
3187
|
-
current: number;
|
|
3188
|
-
remaining: number;
|
|
3189
|
-
total: number;
|
|
3190
|
-
asset: PrismicMigrationAsset;
|
|
3191
|
-
};
|
|
3192
|
-
"assets:created": {
|
|
3193
|
-
created: number;
|
|
3194
|
-
};
|
|
3195
|
-
"documents:masterLocale": {
|
|
3196
|
-
masterLocale: string;
|
|
3197
|
-
};
|
|
3198
|
-
"documents:creating": {
|
|
3199
|
-
current: number;
|
|
3200
|
-
remaining: number;
|
|
3201
|
-
total: number;
|
|
3202
|
-
document: PrismicMigrationDocument;
|
|
3203
|
-
};
|
|
3204
|
-
"documents:created": {
|
|
3205
|
-
created: number;
|
|
3206
|
-
};
|
|
3207
|
-
"documents:updating": {
|
|
3208
|
-
current: number;
|
|
3209
|
-
remaining: number;
|
|
3210
|
-
total: number;
|
|
3211
|
-
document: PrismicMigrationDocument;
|
|
3212
|
-
};
|
|
3213
|
-
"documents:updated": {
|
|
3214
|
-
updated: number;
|
|
3215
|
-
};
|
|
3216
|
-
};
|
|
3217
|
-
/**
|
|
3218
|
-
* Available event types reported by the migration process.
|
|
3219
|
-
*/
|
|
3220
|
-
type MigrateReporterEventTypes = keyof MigrateReporterEventMap;
|
|
3221
|
-
/**
|
|
3222
|
-
* All events reported by the migration process. Events can be listened to by
|
|
3223
|
-
* providing a `reporter` function to the `migrate` method.
|
|
3224
|
-
*/
|
|
3225
|
-
type MigrateReporterEvents = {
|
|
3226
|
-
[K in MigrateReporterEventTypes]: MigrateReporterEvent<K, MigrateReporterEventMap[K]>;
|
|
3227
|
-
}[MigrateReporterEventTypes];
|
|
3228
|
-
/**
|
|
3229
|
-
* Configuration for clients that determine how content is queried.
|
|
3230
|
-
*/
|
|
3231
|
-
type WriteClientConfig = {
|
|
3232
|
-
/**
|
|
3233
|
-
* A Prismic write token that allows writing content to the repository.
|
|
3234
|
-
*/
|
|
3235
|
-
writeToken: string;
|
|
3236
|
-
/**
|
|
3237
|
-
* The Prismic Asset API endpoint.
|
|
3238
|
-
*
|
|
3239
|
-
* @defaultValue `"https://asset-api.prismic.io/"`
|
|
3240
|
-
*
|
|
3241
|
-
* @see Prismic Asset API technical reference: {@link https://prismic.io/docs/asset-api-technical-reference}
|
|
3242
|
-
*/
|
|
3243
|
-
assetAPIEndpoint?: string;
|
|
3244
|
-
/**
|
|
3245
|
-
* The Prismic Migration API endpoint.
|
|
3246
|
-
*
|
|
3247
|
-
* @defaultValue `"https://migration.prismic.io/"`
|
|
3248
|
-
*
|
|
3249
|
-
* @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}
|
|
3250
|
-
*/
|
|
3251
|
-
migrationAPIEndpoint?: string;
|
|
3252
|
-
} & ClientConfig;
|
|
3253
|
-
/**
|
|
3254
|
-
* A client that allows querying and writing content to a Prismic repository.
|
|
3255
|
-
*
|
|
3256
|
-
* If used in an environment where a global `fetch` function is unavailable,
|
|
3257
|
-
* such as Node.js, the `fetch` option must be provided as part of the `options`
|
|
3258
|
-
* parameter.
|
|
3259
|
-
*
|
|
3260
|
-
* @typeParam TDocuments - Document types that are registered for the Prismic
|
|
3261
|
-
* repository. Query methods will automatically be typed based on this type.
|
|
3262
|
-
*/
|
|
3263
|
-
declare class WriteClient<TDocuments extends PrismicDocument = PrismicDocument> extends Client<TDocuments> {
|
|
3264
|
-
#private;
|
|
3265
|
-
writeToken: string;
|
|
3266
|
-
assetAPIEndpoint: string;
|
|
3267
|
-
migrationAPIEndpoint: string;
|
|
3268
|
-
/**
|
|
3269
|
-
* Creates a Prismic client that can be used to query and write content to a
|
|
3270
|
-
* repository.
|
|
3271
|
-
*
|
|
3272
|
-
* If used in an environment where a global `fetch` function is unavailable,
|
|
3273
|
-
* such as in some Node.js versions, the `fetch` option must be provided as
|
|
3274
|
-
* part of the `options` parameter.
|
|
3275
|
-
*
|
|
3276
|
-
* @param repositoryName - The Prismic repository name for the repository.
|
|
3277
|
-
* @param options - Configuration that determines how content will be queried
|
|
3278
|
-
* from and written to the Prismic repository.
|
|
3279
|
-
*
|
|
3280
|
-
* @returns A client that can query and write content to the repository.
|
|
3281
|
-
*/
|
|
3282
|
-
constructor(repositoryName: string, options: WriteClientConfig);
|
|
3283
|
-
/**
|
|
3284
|
-
* Creates a migration release on the Prismic repository based on the provided
|
|
3285
|
-
* prepared migration.
|
|
3286
|
-
*
|
|
3287
|
-
* @param migration - A migration prepared with {@link createMigration}.
|
|
3288
|
-
* @param params - An event listener and additional fetch parameters.
|
|
3289
|
-
*
|
|
3290
|
-
* @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}
|
|
3291
|
-
*/
|
|
3292
|
-
migrate(migration: Migration<TDocuments>, params?: {
|
|
3293
|
-
reporter?: (event: MigrateReporterEvents) => void;
|
|
3294
|
-
} & FetchParams): Promise<void>;
|
|
3295
|
-
/**
|
|
3296
|
-
* Creates assets in the Prismic repository's media library.
|
|
3297
|
-
*
|
|
3298
|
-
* @param migration - A migration prepared with {@link createMigration}.
|
|
3299
|
-
* @param params - An event listener and additional fetch parameters.
|
|
3300
|
-
*
|
|
3301
|
-
* @internal This method is one of the step performed by the {@link migrate} method.
|
|
3302
|
-
*/
|
|
3303
|
-
private migrateCreateAssets;
|
|
3304
|
-
/**
|
|
3305
|
-
* Creates documents in the Prismic repository's migration release.
|
|
3306
|
-
*
|
|
3307
|
-
* @param migration - A migration prepared with {@link createMigration}.
|
|
3308
|
-
* @param params - An event listener and additional fetch parameters.
|
|
3309
|
-
*
|
|
3310
|
-
* @internal This method is one of the step performed by the {@link migrate} method.
|
|
3311
|
-
*/
|
|
3312
|
-
private migrateCreateDocuments;
|
|
3313
|
-
/**
|
|
3314
|
-
* Updates documents in the Prismic repository's migration release with their
|
|
3315
|
-
* patched data.
|
|
3316
|
-
*
|
|
3317
|
-
* @param migration - A migration prepared with {@link createMigration}.
|
|
3318
|
-
* @param params - An event listener and additional fetch parameters.
|
|
3319
|
-
*
|
|
3320
|
-
* @internal This method is one of the step performed by the {@link migrate} method.
|
|
3321
|
-
*/
|
|
3322
|
-
private migrateUpdateDocuments;
|
|
3323
|
-
/**
|
|
3324
|
-
* Creates an asset in the Prismic media library.
|
|
3325
|
-
*
|
|
3326
|
-
* @param file - The file to upload as an asset.
|
|
3327
|
-
* @param filename - The filename of the asset.
|
|
3328
|
-
* @param params - Additional asset data and fetch parameters.
|
|
3329
|
-
*
|
|
3330
|
-
* @returns The created asset.
|
|
3331
|
-
*/
|
|
3332
|
-
private createAsset;
|
|
3333
|
-
/**
|
|
3334
|
-
* Updates an asset in the Prismic media library.
|
|
3335
|
-
*
|
|
3336
|
-
* @param id - The ID of the asset to update.
|
|
3337
|
-
* @param params - The asset data to update and additional fetch parameters.
|
|
3338
|
-
*
|
|
3339
|
-
* @returns The updated asset.
|
|
3340
|
-
*/
|
|
3341
|
-
private updateAsset;
|
|
3342
|
-
/**
|
|
3343
|
-
* Fetches a foreign asset from a URL.
|
|
3344
|
-
*
|
|
3345
|
-
* @param url - The URL of the asset to fetch.
|
|
3346
|
-
* @param params - Additional fetch parameters.
|
|
3347
|
-
*
|
|
3348
|
-
* @returns A file representing the fetched asset.
|
|
3349
|
-
*/
|
|
3350
|
-
private fetchForeignAsset;
|
|
3351
|
-
/**
|
|
3352
|
-
* {@link resolveAssetTagIDs} rate limiter.
|
|
3353
|
-
*/
|
|
3354
|
-
private _resolveAssetTagIDsLimit;
|
|
3355
|
-
/**
|
|
3356
|
-
* Resolves asset tag IDs from tag names.
|
|
3357
|
-
*
|
|
3358
|
-
* @param tagNames - An array of tag names to resolve.
|
|
3359
|
-
* @param params - Whether or not missing tags should be created and
|
|
3360
|
-
* additional fetch parameters.
|
|
3361
|
-
*
|
|
3362
|
-
* @returns An array of resolved tag IDs.
|
|
3363
|
-
*/
|
|
3364
|
-
private resolveAssetTagIDs;
|
|
3365
|
-
/**
|
|
3366
|
-
* Creates a tag in the Asset API.
|
|
3367
|
-
*
|
|
3368
|
-
* @remarks
|
|
3369
|
-
* Tags should be at least 3 characters long and 20 characters at most.
|
|
3370
|
-
*
|
|
3371
|
-
* @param name - The name of the tag to create.
|
|
3372
|
-
* @param params - Additional fetch parameters.
|
|
3373
|
-
*
|
|
3374
|
-
* @returns The created tag.
|
|
3375
|
-
*/
|
|
3376
|
-
private createAssetTag;
|
|
3377
|
-
/**
|
|
3378
|
-
* Queries existing tags from the Asset API.
|
|
3379
|
-
*
|
|
3380
|
-
* @param params - Additional fetch parameters.
|
|
3381
|
-
*
|
|
3382
|
-
* @returns An array of existing tags.
|
|
3383
|
-
*/
|
|
3384
|
-
private getAssetTags;
|
|
3385
|
-
/**
|
|
3386
|
-
* Creates a document in the repository's migration release.
|
|
3387
|
-
*
|
|
3388
|
-
* @typeParam TType - Type of Prismic documents to create.
|
|
3389
|
-
*
|
|
3390
|
-
* @param document - The document to create.
|
|
3391
|
-
* @param documentTitle - The title of the document to create which will be
|
|
3392
|
-
* displayed in the editor.
|
|
3393
|
-
* @param params - Document master language document ID and additional fetch
|
|
3394
|
-
* parameters.
|
|
3395
|
-
*
|
|
3396
|
-
* @returns The ID of the created document.
|
|
3397
|
-
*
|
|
3398
|
-
* @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}
|
|
3399
|
-
*/
|
|
3400
|
-
private createDocument;
|
|
3401
|
-
/**
|
|
3402
|
-
* Updates an existing document in the repository's migration release.
|
|
3403
|
-
*
|
|
3404
|
-
* @typeParam TType - Type of Prismic documents to update.
|
|
3405
|
-
*
|
|
3406
|
-
* @param id - The ID of the document to update.
|
|
3407
|
-
* @param document - The document content to update.
|
|
3408
|
-
* @param params - Additional fetch parameters.
|
|
3409
|
-
*
|
|
3410
|
-
* @see Prismic Migration API technical reference: {@link https://prismic.io/docs/migration-api-technical-reference}
|
|
3411
|
-
*/
|
|
3412
|
-
private updateDocument;
|
|
3413
|
-
}
|
|
3414
|
-
|
|
3415
|
-
/**
|
|
3416
|
-
* Type definitions for the `createWriteClient()` function. May be augmented by
|
|
3417
|
-
* third-party libraries.
|
|
3418
|
-
*/
|
|
3419
|
-
interface CreateWriteClient {
|
|
3420
|
-
<TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof WriteClient>): WriteClient<TDocuments>;
|
|
3421
|
-
}
|
|
3422
|
-
/**
|
|
3423
|
-
* Creates a Prismic client that can be used to query and write content to a
|
|
3424
|
-
* repository.
|
|
3425
|
-
*
|
|
3426
|
-
* @remarks
|
|
3427
|
-
* This client works in environments supporting File, Blob, and FormData,
|
|
3428
|
-
* including Node.js 20 and later.
|
|
3429
|
-
*
|
|
3430
|
-
* @example
|
|
3431
|
-
*
|
|
3432
|
-
* ```ts
|
|
3433
|
-
* createWriteClient("qwerty", { writeToken: "***" })
|
|
3434
|
-
* ```
|
|
3435
|
-
*
|
|
3436
|
-
* @typeParam TDocuments - A union of Prismic document types for the repository.
|
|
3437
|
-
*
|
|
3438
|
-
* @param repositoryName - The Prismic repository name for the repository.
|
|
3439
|
-
* @param options - Configuration that determines how content will be queried
|
|
3440
|
-
* from and written to the Prismic repository.
|
|
3441
|
-
*
|
|
3442
|
-
* @returns A client that can query and write content to the repository.
|
|
3443
|
-
*/
|
|
3444
|
-
declare const createWriteClient: CreateWriteClient;
|
|
3445
|
-
|
|
3446
|
-
/**
|
|
3447
|
-
* Type definitions for the `createMigration()` function. May be augmented by
|
|
3448
|
-
* third-party libraries.
|
|
3449
|
-
*/
|
|
3450
|
-
interface CreateMigration {
|
|
3451
|
-
<TDocuments extends PrismicDocument>(...args: ConstructorParameters<typeof Migration>): Migration<TDocuments>;
|
|
3452
|
-
}
|
|
3453
|
-
/**
|
|
3454
|
-
* Creates a Prismic migration instance that can be used to prepare your
|
|
3455
|
-
* migration to Prismic.
|
|
3456
|
-
*
|
|
3457
|
-
* @example
|
|
3458
|
-
*
|
|
3459
|
-
* ```ts
|
|
3460
|
-
* createMigration()
|
|
3461
|
-
* ```
|
|
3462
|
-
*
|
|
3463
|
-
* @typeParam TDocuments - A union of Prismic document types for the repository.
|
|
3464
|
-
*
|
|
3465
|
-
* @returns A migration instance to prepare your migration.
|
|
3466
|
-
*/
|
|
3467
|
-
declare const createMigration: CreateMigration;
|
|
3468
|
-
|
|
3469
|
-
/**
|
|
3470
|
-
* Get a repository's Prismic Content API endpoint.
|
|
3471
|
-
*
|
|
3472
|
-
* @example
|
|
3473
|
-
*
|
|
3474
|
-
* ```ts
|
|
3475
|
-
* getRepositoryEndpoint("my-repo")
|
|
3476
|
-
* // => "https://my-repo.cdn.prismic.io/api/v2"
|
|
3477
|
-
* ```
|
|
3478
|
-
*
|
|
3479
|
-
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
3480
|
-
*
|
|
3481
|
-
* @param repositoryName - Name of the repository.
|
|
3482
|
-
*
|
|
3483
|
-
* @returns The repository's Prismic Content API endpoint.
|
|
3484
|
-
*
|
|
3485
|
-
* @throws {@link Error} Thrown if an invalid repository name is provided.
|
|
3486
|
-
*/
|
|
3487
|
-
declare const getRepositoryEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/api/v2`;
|
|
3488
|
-
|
|
3489
|
-
/**
|
|
3490
|
-
* Get a Prismic repository's name from its standard Prismic Document API or
|
|
3491
|
-
* GraphQL endpoint.
|
|
3492
|
-
*
|
|
3493
|
-
* @param repositoryEndpoint - Prismic Document API endpoint for the repository.
|
|
3494
|
-
*
|
|
3495
|
-
* @returns The Prismic repository's name.
|
|
3496
|
-
*
|
|
3497
|
-
* @throws {@link Error} Thrown if an invalid Prismic Document API endpoint is
|
|
3498
|
-
* provided.
|
|
3499
|
-
*/
|
|
3500
|
-
declare const getRepositoryName: (repositoryEndpoint: string) => string;
|
|
3501
|
-
|
|
3502
|
-
/**
|
|
3503
|
-
* Get a repository's Prismic GraphQL endpoint.
|
|
3504
|
-
*
|
|
3505
|
-
* @typeParam RepositoryName - Name of the Prismic repository.
|
|
3506
|
-
*
|
|
3507
|
-
* @param repositoryName - Name of the repository.
|
|
3508
|
-
*
|
|
3509
|
-
* @returns The repository's Prismic REST API V2 endpoint
|
|
3510
|
-
*/
|
|
3511
|
-
declare const getGraphQLEndpoint: <RepositoryName extends string>(repositoryName: RepositoryName) => `https://${RepositoryName}.cdn.prismic.io/graphql`;
|
|
3512
|
-
|
|
3513
|
-
/**
|
|
3514
|
-
* Determines if an input is a valid Prismic repository name.
|
|
3515
|
-
*
|
|
3516
|
-
* @param input - Input to test.
|
|
3517
|
-
*
|
|
3518
|
-
* @returns `true` if `input` is a valid Prismic repository name, `false`
|
|
3519
|
-
* otherwise.
|
|
3520
|
-
*/
|
|
3521
|
-
declare const isRepositoryName: (input: string) => boolean;
|
|
3522
|
-
|
|
3523
|
-
/**
|
|
3524
|
-
* Determines if a string is a Prismic Content API endpoint. Note that any valid
|
|
3525
|
-
* URL is a valid endpoint to support network proxies.
|
|
3526
|
-
*
|
|
3527
|
-
* @param input - Input to test.
|
|
3528
|
-
*
|
|
3529
|
-
* @returns `true` if `input` is a valid Prismic Content API endpoint, `false`
|
|
3530
|
-
* otherwise.
|
|
3531
|
-
*/
|
|
3532
|
-
declare const isRepositoryEndpoint: (input: string) => boolean;
|
|
3533
|
-
|
|
3534
|
-
/**
|
|
3535
|
-
* Returns the URL for a Prismic repository's Prismic Toolbar script. Use the
|
|
3536
|
-
* URL to inject the script into your app.
|
|
3537
|
-
*
|
|
3538
|
-
* @example
|
|
3539
|
-
*
|
|
3540
|
-
* ```typescriptreact
|
|
3541
|
-
* // In Next.js apps, use `next/script` in your `app/layout.tsx` file.
|
|
3542
|
-
*
|
|
3543
|
-
* import Script from "next/script";
|
|
3544
|
-
* import * as prismic from "@prismicio/client";
|
|
3545
|
-
*
|
|
3546
|
-
* export default function RootLayout({
|
|
3547
|
-
* children,
|
|
3548
|
-
* }: {
|
|
3549
|
-
* children: React.ReactNode,
|
|
3550
|
-
* }) {
|
|
3551
|
-
* const toolbarSrc = prismic.getToolbarSrc("my-repo");
|
|
3552
|
-
*
|
|
3553
|
-
* return (
|
|
3554
|
-
* <html lang="en">
|
|
3555
|
-
* <body>{children}</body>
|
|
3556
|
-
* <Script src={toolbarSrc} />
|
|
3557
|
-
* </html>
|
|
3558
|
-
* );
|
|
3559
|
-
* }
|
|
3560
|
-
* ```
|
|
3561
|
-
*
|
|
3562
|
-
* @param repositoryName - The name of the Prismic repository. For example,
|
|
3563
|
-
* `"my-repo"` if the repository URL is `my-repo.prismic.io`.
|
|
3564
|
-
*
|
|
3565
|
-
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
3566
|
-
*/
|
|
3567
|
-
declare const getToolbarSrc: <TRepositoryName extends string>(repositoryName: TRepositoryName) => `https://static.cdn.prismic.io/prismic.js?new=true&repo=${TRepositoryName}`;
|
|
3568
|
-
|
|
3569
|
-
/**
|
|
3570
|
-
* The well-known name of the cookie used to store a Prismic preview session's
|
|
3571
|
-
* ref.
|
|
3572
|
-
*/
|
|
3573
|
-
declare const preview = "io.prismic.preview";
|
|
3574
|
-
|
|
3575
|
-
declare const cookie_preview: typeof preview;
|
|
3576
|
-
declare namespace cookie {
|
|
3577
|
-
export {
|
|
3578
|
-
cookie_preview as preview,
|
|
3579
|
-
};
|
|
3580
|
-
}
|
|
3581
|
-
|
|
3582
|
-
/**
|
|
3583
|
-
* The return type of `asDate()`.
|
|
3584
|
-
*/
|
|
3585
|
-
type AsDateReturnType<Field extends DateField | TimestampField | null | undefined> = Field extends DateField<"filled"> | TimestampField<"filled"> ? Date : null;
|
|
3586
|
-
/**
|
|
3587
|
-
* Converts a date or timestamp field to a JavaScript Date object.
|
|
3588
|
-
*
|
|
3589
|
-
* @example
|
|
3590
|
-
*
|
|
3591
|
-
* ```ts
|
|
3592
|
-
* const date = asDate(document.data.release_date)
|
|
3593
|
-
* // => Date object or null
|
|
3594
|
-
* ```
|
|
3595
|
-
*
|
|
3596
|
-
* @param dateOrTimestampField - A date or timestamp field from Prismic.
|
|
3597
|
-
*
|
|
3598
|
-
* @returns A Date object, or `null` if the field is empty.
|
|
3599
|
-
*
|
|
3600
|
-
* @see Learn about date and timestamp fields: {@link https://prismic.io/docs/fields/date}
|
|
3601
|
-
*/
|
|
3602
|
-
declare const asDate: <Field extends DateField | TimestampField | null | undefined>(dateOrTimestampField: Field) => AsDateReturnType<Field>;
|
|
3603
|
-
|
|
3604
|
-
type AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = {
|
|
3605
|
-
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
3606
|
-
isExternal: boolean;
|
|
3607
|
-
target?: string;
|
|
3608
|
-
};
|
|
3609
|
-
type AsLinkAttrsConfig<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = {
|
|
3610
|
-
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>;
|
|
3611
|
-
rel?: (args: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>) => string | undefined | void;
|
|
3612
|
-
};
|
|
3613
|
-
/**
|
|
3614
|
-
* The return type of `asLinkAttrs()`.
|
|
3615
|
-
*/
|
|
3616
|
-
type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? {
|
|
3617
|
-
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
3618
|
-
target?: string;
|
|
3619
|
-
rel?: string;
|
|
3620
|
-
} : {
|
|
3621
|
-
href?: undefined;
|
|
3622
|
-
target?: undefined;
|
|
3623
|
-
rel?: undefined;
|
|
3624
|
-
};
|
|
3625
|
-
/**
|
|
3626
|
-
* Resolves any type of link field or Prismic page to a set of link attributes.
|
|
3627
|
-
* The attributes are designed to be passed to link HTML elements, like `<a>`.
|
|
3628
|
-
*
|
|
3629
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
3630
|
-
* `rel` is returned as `"noreferrer"`.
|
|
3631
|
-
*
|
|
3632
|
-
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
3633
|
-
* type
|
|
3634
|
-
* @typeParam Field - Link field or Prismic page to resolve to link attributes
|
|
3635
|
-
*
|
|
3636
|
-
* @param linkFieldOrDocument - Any kind of link field or a page to resolve
|
|
3637
|
-
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
3638
|
-
*
|
|
3639
|
-
* @returns Resolved set of link attributes or, if the provided link field or
|
|
3640
|
-
* page is empty, and empty object
|
|
3641
|
-
*
|
|
3642
|
-
* @see Learn about route resolvers and link resolvers: {@link https://prismic.io/docs/routes}
|
|
3643
|
-
*/
|
|
3644
|
-
declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
3645
|
-
|
|
3646
|
-
/**
|
|
3647
|
-
* Configuration that determines the output of `asText()`.
|
|
3648
|
-
*/
|
|
3649
|
-
type AsTextConfig = {
|
|
3650
|
-
/**
|
|
3651
|
-
* Separator used to join each element.
|
|
3652
|
-
*
|
|
3653
|
-
* @defaultValue ` ` (a space)
|
|
3654
|
-
*/
|
|
3655
|
-
separator?: string;
|
|
3656
|
-
};
|
|
3657
|
-
/**
|
|
3658
|
-
* @deprecated Use object-style configuration instead.
|
|
3659
|
-
*/
|
|
3660
|
-
type AsTextDeprecatedTupleConfig = [separator?: string];
|
|
3661
|
-
/**
|
|
3662
|
-
* The return type of `asText()`.
|
|
3663
|
-
*/
|
|
3664
|
-
type AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null;
|
|
3665
|
-
declare const asText: {
|
|
3666
|
-
/**
|
|
3667
|
-
* Converts a rich text field to a plain text string.
|
|
3668
|
-
*
|
|
3669
|
-
* @example
|
|
3670
|
-
*
|
|
3671
|
-
* ```ts
|
|
3672
|
-
* const text = asText(document.data.content)
|
|
3673
|
-
* // => "Hello world"
|
|
3674
|
-
* ```
|
|
3675
|
-
*
|
|
3676
|
-
* @param richTextField - A rich text field from Prismic.
|
|
3677
|
-
* @param config - Configuration that determines the output of `asText()`.
|
|
3678
|
-
*
|
|
3679
|
-
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
3680
|
-
* field is empty.
|
|
3681
|
-
*
|
|
3682
|
-
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
3683
|
-
*/
|
|
3684
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, config?: AsTextConfig): AsTextReturnType<Field>;
|
|
3685
|
-
/**
|
|
3686
|
-
* Converts a rich text field to a plain text string.
|
|
3687
|
-
*
|
|
3688
|
-
* @deprecated Use object-style configuration instead.
|
|
3689
|
-
*
|
|
3690
|
-
* @param richTextField - A rich text field from Prismic.
|
|
3691
|
-
* @param separator - Separator used to join each element. Defaults to a
|
|
3692
|
-
* space.
|
|
3693
|
-
*
|
|
3694
|
-
* @returns Plain text equivalent of the rich text field, or `null` if the
|
|
3695
|
-
* field is empty.
|
|
3696
|
-
*
|
|
3697
|
-
* @see Learn how to work with rich text fields: {@link https://prismic.io/docs/fields/rich-text}
|
|
3698
|
-
*/
|
|
3699
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, ...config: AsTextDeprecatedTupleConfig): AsTextReturnType<Field>;
|
|
3700
|
-
};
|
|
3701
|
-
|
|
3702
|
-
/**
|
|
3703
|
-
* The return type of `asImageSrc()`.
|
|
3704
|
-
*/
|
|
3705
|
-
type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> = Field extends ImageFieldImage<"filled"> ? string : null;
|
|
3706
|
-
/**
|
|
3707
|
-
* Returns the URL of an image field with optional image transformations via
|
|
3708
|
-
* imgix URL parameters.
|
|
3709
|
-
*
|
|
3710
|
-
* @example
|
|
3711
|
-
*
|
|
3712
|
-
* ```ts
|
|
3713
|
-
* const src = asImageSrc(document.data.photo, { sat: -100 })
|
|
3714
|
-
* // => "https://images.prismic.io/repo/image.png?sat=-100"
|
|
3715
|
-
* ```
|
|
3716
|
-
*
|
|
3717
|
-
* @param field - An image field (or one of its responsive views) from which to
|
|
3718
|
-
* get an image URL.
|
|
3719
|
-
* @param config - An object of imgix URL API parameters to transform the image.
|
|
3720
|
-
*
|
|
3721
|
-
* @returns The image field's URL with transformations applied, or `null` if the
|
|
3722
|
-
* field is empty.
|
|
3723
|
-
*
|
|
3724
|
-
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
3725
|
-
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
3726
|
-
*/
|
|
3727
|
-
declare const asImageSrc: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: ImgixURLParams) => AsImageSrcReturnType<Field>;
|
|
3728
|
-
|
|
3729
|
-
/**
|
|
3730
|
-
* The return type of `asImageWidthSrcSet()`.
|
|
3731
|
-
*/
|
|
3732
|
-
type AsImageWidthSrcSetReturnType<Field extends ImageFieldImage | null | undefined> = Field extends ImageFieldImage<"filled"> ? {
|
|
3733
|
-
/**
|
|
3734
|
-
* The image field's URL with imgix URL parameters (if given).
|
|
3735
|
-
*/
|
|
3736
|
-
src: string;
|
|
3737
|
-
/**
|
|
3738
|
-
* A width-based `srcset` attribute value for the image field with imgix
|
|
3739
|
-
* URL parameters (if given).
|
|
3740
|
-
*/
|
|
3741
|
-
srcset: string;
|
|
3742
|
-
} : null;
|
|
3743
|
-
/**
|
|
3744
|
-
* Configuration for `asImageWidthSrcSet()`.
|
|
3745
|
-
*/
|
|
3746
|
-
type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
3747
|
-
widths?: "thumbnails" | BuildWidthSrcSetParams["widths"];
|
|
3748
|
-
};
|
|
3749
|
-
/**
|
|
3750
|
-
* Creates a width-based `srcset` from an image field with optional image
|
|
3751
|
-
* transformations via imgix URL parameters.
|
|
3752
|
-
*
|
|
3753
|
-
* If a `widths` parameter is not given, the following widths (in pixels) will
|
|
3754
|
-
* be used by default: 640, 750, 828, 1080, 1200, 1920, 2048, 3840.
|
|
3755
|
-
*
|
|
3756
|
-
* If the image field contains responsive views, each responsive view can be
|
|
3757
|
-
* used as a width in the resulting `srcset` by passing `"thumbnails"` as the
|
|
3758
|
-
* `widths` parameter.
|
|
3759
|
-
*
|
|
3760
|
-
* @example
|
|
3761
|
-
*
|
|
3762
|
-
* ```ts
|
|
3763
|
-
* const srcset = asImageWidthSrcSet(document.data.photo, {
|
|
3764
|
-
* widths: [400, 800, 1600],
|
|
3765
|
-
* sat: -100,
|
|
3766
|
-
* })
|
|
3767
|
-
* // => {
|
|
3768
|
-
* // src: "https://images.prismic.io/repo/image.png?sat=-100",
|
|
3769
|
-
* // srcset: "https://images.prismic.io/repo/image.png?sat=-100&width=400 400w, " +
|
|
3770
|
-
* // "https://images.prismic.io/repo/image.png?sat=-100&width=800 800w, " +
|
|
3771
|
-
* // "https://images.prismic.io/repo/image.png?sat=-100&width=1600 1600w"
|
|
3772
|
-
* // }
|
|
3773
|
-
* ```
|
|
3774
|
-
*
|
|
3775
|
-
* @param field - An image field (or one of its responsive views) from which to
|
|
3776
|
-
* get an image URL.
|
|
3777
|
-
* @param config - An object of imgix URL API parameters. The `widths` parameter
|
|
3778
|
-
* defines the resulting `srcset` widths. Pass `"thumbnails"` to automatically
|
|
3779
|
-
* use the field's responsive views.
|
|
3780
|
-
*
|
|
3781
|
-
* @returns A `srcset` attribute value for the image field with imgix URL
|
|
3782
|
-
* parameters, or `null` if the field is empty.
|
|
3783
|
-
*
|
|
3784
|
-
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
3785
|
-
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
3786
|
-
*/
|
|
3787
|
-
declare const asImageWidthSrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImageWidthSrcSetConfig) => AsImageWidthSrcSetReturnType<Field>;
|
|
3788
|
-
|
|
3789
|
-
/**
|
|
3790
|
-
* Configuration for `asImagePixelDensitySrcSet()`.
|
|
3791
|
-
*/
|
|
3792
|
-
type AsImagePixelDensitySrcSetConfig = Omit<BuildPixelDensitySrcSetParams, "pixelDensities"> & Partial<Pick<BuildPixelDensitySrcSetParams, "pixelDensities">>;
|
|
3793
|
-
/**
|
|
3794
|
-
* The return type of `asImagePixelDensitySrcSet()`.
|
|
3795
|
-
*/
|
|
3796
|
-
type AsImagePixelDensitySrcSetReturnType<Field extends ImageFieldImage | null | undefined> = Field extends ImageFieldImage<"filled"> ? {
|
|
3797
|
-
/**
|
|
3798
|
-
* The image field's URL with imgix URL parameters (if given).
|
|
3799
|
-
*/
|
|
3800
|
-
src: string;
|
|
3801
|
-
/**
|
|
3802
|
-
* A pixel-density-based `srcset` attribute value for the image field
|
|
3803
|
-
* with imgix URL parameters (if given).
|
|
3804
|
-
*/
|
|
3805
|
-
srcset: string;
|
|
3806
|
-
} : null;
|
|
3807
|
-
/**
|
|
3808
|
-
* Creates a pixel-density-based `srcset` from an image field with optional
|
|
3809
|
-
* image transformations via imgix URL parameters.
|
|
3810
|
-
*
|
|
3811
|
-
* If a `pixelDensities` parameter is not given, the following pixel densities
|
|
3812
|
-
* will be used by default: 1, 2, 3.
|
|
3813
|
-
*
|
|
3814
|
-
* @example
|
|
3815
|
-
*
|
|
3816
|
-
* ```ts
|
|
3817
|
-
* const srcset = asImagePixelDensitySrcSet(document.data.photo, {
|
|
3818
|
-
* pixelDensities: [1, 2],
|
|
3819
|
-
* sat: -100,
|
|
3820
|
-
* })
|
|
3821
|
-
* // => {
|
|
3822
|
-
* // src: "https://images.prismic.io/repo/image.png?sat=-100",
|
|
3823
|
-
* // srcset: "https://images.prismic.io/repo/image.png?sat=-100&dpr=1 1x, " +
|
|
3824
|
-
* // "https://images.prismic.io/repo/image.png?sat=-100&dpr=2 2x"
|
|
3825
|
-
* // }
|
|
3826
|
-
* ```
|
|
3827
|
-
*
|
|
3828
|
-
* @param field - An image field (or one of its responsive views) from which to
|
|
3829
|
-
* get an image URL.
|
|
3830
|
-
* @param config - An object of imgix URL API parameters. The `pixelDensities`
|
|
3831
|
-
* parameter defines the resulting `srcset` pixel densities.
|
|
3832
|
-
*
|
|
3833
|
-
* @returns A `srcset` attribute value for the image field with imgix URL
|
|
3834
|
-
* parameters, or `null` if the field is empty.
|
|
3835
|
-
*
|
|
3836
|
-
* @see Learn how to optimize images with imgix: {@link https://prismic.io/docs/fields/image}
|
|
3837
|
-
* @see imgix URL parameters reference: {@link https://docs.imgix.com/apis/rendering}
|
|
3838
|
-
*/
|
|
3839
|
-
declare const asImagePixelDensitySrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImagePixelDensitySrcSetConfig) => AsImagePixelDensitySrcSetReturnType<Field>;
|
|
3840
|
-
|
|
3841
|
-
/**
|
|
3842
|
-
* Determines if a rich text field is filled.
|
|
3843
|
-
*
|
|
3844
|
-
* @param field - rich text field to check.
|
|
3845
|
-
*
|
|
3846
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3847
|
-
*/
|
|
3848
|
-
declare const richText: (field: RichTextField | null | undefined) => field is RichTextField<"filled">;
|
|
3849
|
-
/**
|
|
3850
|
-
* Determines if a title field is filled.
|
|
3851
|
-
*
|
|
3852
|
-
* @param field - Title field to check.
|
|
3853
|
-
*
|
|
3854
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3855
|
-
*/
|
|
3856
|
-
declare const title: (field: TitleField | null | undefined) => field is TitleField<"filled">;
|
|
3857
|
-
/**
|
|
3858
|
-
* Determines if an image thumbnail is filled.
|
|
3859
|
-
*
|
|
3860
|
-
* @param thumbnail - Image thumbnail to check.
|
|
3861
|
-
*
|
|
3862
|
-
* @returns `true` if the thumbnail is filled, `false` otherwise.
|
|
3863
|
-
*/
|
|
3864
|
-
declare const imageThumbnail: (thumbnail: ImageFieldImage | null | undefined) => thumbnail is ImageFieldImage<"filled">;
|
|
3865
|
-
/**
|
|
3866
|
-
* Determines if an image field is filled.
|
|
3867
|
-
*
|
|
3868
|
-
* @param field - Image field to check.
|
|
3869
|
-
*
|
|
3870
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3871
|
-
*/
|
|
3872
|
-
declare const image: <ThumbnailNames extends string | null = never>(field: ImageField<ThumbnailNames> | null | undefined) => field is ImageField<ThumbnailNames, "filled">;
|
|
3873
|
-
/**
|
|
3874
|
-
* Determines if a link field is filled.
|
|
3875
|
-
*
|
|
3876
|
-
* @param field - Link field to check.
|
|
3877
|
-
*
|
|
3878
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3879
|
-
*/
|
|
3880
|
-
declare const link: <TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown>(field: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined) => field is LinkField<TypeEnum, LangEnum, DataInterface, "filled">;
|
|
3881
|
-
/**
|
|
3882
|
-
* Determines if a link to media field is filled.
|
|
3883
|
-
*
|
|
3884
|
-
* @param field - Link to media field to check.
|
|
3885
|
-
*
|
|
3886
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3887
|
-
*/
|
|
3888
|
-
declare const linkToMedia: (field: LinkToMediaField | null | undefined) => field is LinkToMediaField<"filled">;
|
|
3889
|
-
/**
|
|
3890
|
-
* Determines if a content relationship field is filled.
|
|
3891
|
-
*
|
|
3892
|
-
* @param field - Content relationship field to check.
|
|
3893
|
-
*
|
|
3894
|
-
* @returns `true` if the field is filled, `false` otherwise.
|
|
3895
|
-
*/
|
|
3896
|
-
declare const contentRelationship: <Field extends ContentRelationshipField>(field: Field | null | undefined) => field is Exclude<Field, EmptyContentRelationshipField>;
|
|
3897
|
-
/**
|
|
3898
|
-
* Determines if a date field is filled.
|
|
3899
|
-
*
|
|
3900
|
-
* @param field - Date field to check.
|
|
3901
|
-
*
|
|
3902
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3903
|
-
*/
|
|
3904
|
-
declare const date: (field: DateField | null | undefined) => field is DateField<"filled">;
|
|
3905
|
-
/**
|
|
3906
|
-
* Determines if a timestamp field is filled.
|
|
3907
|
-
*
|
|
3908
|
-
* @param field - Timestamp field to check.
|
|
3909
|
-
*
|
|
3910
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3911
|
-
*/
|
|
3912
|
-
declare const timestamp: (field: TimestampField | null | undefined) => field is TimestampField<"filled">;
|
|
3913
|
-
/**
|
|
3914
|
-
* Determines if a color field is filled.
|
|
3915
|
-
*
|
|
3916
|
-
* @param field - Color field to check.
|
|
3917
|
-
*
|
|
3918
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3919
|
-
*/
|
|
3920
|
-
declare const color: (field: ColorField | null | undefined) => field is ColorField<"filled">;
|
|
3921
|
-
/**
|
|
3922
|
-
* Determines if a number field is filled.
|
|
3923
|
-
*
|
|
3924
|
-
* @param field - Number field to check.
|
|
3925
|
-
*
|
|
3926
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3927
|
-
*/
|
|
3928
|
-
declare const number: (field: NumberField | null | undefined) => field is NumberField<"filled">;
|
|
3929
|
-
/**
|
|
3930
|
-
* Determines if a key text field is filled.
|
|
3931
|
-
*
|
|
3932
|
-
* @param field - Key text field to check.
|
|
3933
|
-
*
|
|
3934
|
-
* @returns `true` if the field is filled, `false` otherwise.
|
|
3935
|
-
*/
|
|
3936
|
-
declare const keyText: (field: KeyTextField | null | undefined) => field is KeyTextField<"filled">;
|
|
3937
|
-
/**
|
|
3938
|
-
* Determines if a select field is filled.
|
|
3939
|
-
*
|
|
3940
|
-
* @param field - Select field to check.
|
|
3941
|
-
*
|
|
3942
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3943
|
-
*/
|
|
3944
|
-
declare const select: <Enum extends string>(field: SelectField<Enum> | null | undefined) => field is SelectField<Enum, "filled">;
|
|
3945
|
-
/**
|
|
3946
|
-
* Determines if an embed field is filled.
|
|
3947
|
-
*
|
|
3948
|
-
* @param field - Embed field to check.
|
|
3949
|
-
*
|
|
3950
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3951
|
-
*/
|
|
3952
|
-
declare const embed: <Field extends EmbedField<AnyOEmbed>>(field: Field | null | undefined) => field is Extract<Field, EmbedField<AnyOEmbed, "filled">>;
|
|
3953
|
-
/**
|
|
3954
|
-
* Determines if a geopoint field is filled.
|
|
3955
|
-
*
|
|
3956
|
-
* @param field - Geopoint field to check.
|
|
3957
|
-
*
|
|
3958
|
-
* @returns `true` if the field is filled, `false` otherwise.
|
|
3959
|
-
*/
|
|
3960
|
-
declare const geoPoint: (field: GeoPointField | null | undefined) => field is GeoPointField<"filled">;
|
|
3961
|
-
/**
|
|
3962
|
-
* Determines if a table field is filled.
|
|
3963
|
-
*
|
|
3964
|
-
* @param field - Table field to check.
|
|
3965
|
-
*
|
|
3966
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3967
|
-
*/
|
|
3968
|
-
declare const table: (field: TableField | null | undefined) => field is TableField<"filled">;
|
|
3969
|
-
/**
|
|
3970
|
-
* Determines if an integration field is filled.
|
|
3971
|
-
*
|
|
3972
|
-
* @param field - Integration field to check.
|
|
3973
|
-
*
|
|
3974
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
3975
|
-
*/
|
|
3976
|
-
declare const integration: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
3977
|
-
/**
|
|
3978
|
-
* @deprecated Renamed to `integration`.
|
|
3979
|
-
*/
|
|
3980
|
-
declare const integrationField: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
3981
|
-
/**
|
|
3982
|
-
* @deprecated Renamed to `integrationField`.
|
|
3983
|
-
*/
|
|
3984
|
-
declare const integrationFields: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
3985
|
-
/**
|
|
3986
|
-
* Determines if a repeatable field has at least one item.
|
|
3987
|
-
*
|
|
3988
|
-
* @param repeatable - Repeatable to check.
|
|
3989
|
-
*
|
|
3990
|
-
* @returns `true` if `repeatable` contains at least one item, `false`
|
|
3991
|
-
* otherwise.
|
|
3992
|
-
*/
|
|
3993
|
-
declare const repeatable: <T extends LinkField>(repeatable: Repeatable<T> | null | undefined) => repeatable is Repeatable<T, "filled">;
|
|
3994
|
-
/**
|
|
3995
|
-
* Determines if a group has at least one item.
|
|
3996
|
-
*
|
|
3997
|
-
* @param group - Group to check.
|
|
3998
|
-
*
|
|
3999
|
-
* @returns `true` if the group contains at least one item, `false` otherwise.
|
|
4000
|
-
*/
|
|
4001
|
-
declare const group: <Fields extends Record<string, AnyRegularField | NestedGroupField>>(group: GroupField<Fields> | null | undefined) => group is GroupField<Fields, "filled">;
|
|
4002
|
-
/**
|
|
4003
|
-
* Determines if a slice zone has at least one slice.
|
|
4004
|
-
*
|
|
4005
|
-
* @param slices - Slice zone to check.
|
|
4006
|
-
*
|
|
4007
|
-
* @returns `true` if the slice zone contains at least one slice, `false`
|
|
4008
|
-
* otherwise.
|
|
4009
|
-
*/
|
|
4010
|
-
declare const sliceZone: <Slices extends Slice | SharedSlice>(slices: SliceZone<Slices> | null | undefined) => slices is SliceZone<Slices, "filled">;
|
|
4011
|
-
|
|
4012
|
-
declare const isFilled_color: typeof color;
|
|
4013
|
-
declare const isFilled_contentRelationship: typeof contentRelationship;
|
|
4014
|
-
declare const isFilled_date: typeof date;
|
|
4015
|
-
declare const isFilled_embed: typeof embed;
|
|
4016
|
-
declare const isFilled_geoPoint: typeof geoPoint;
|
|
4017
|
-
declare const isFilled_group: typeof group;
|
|
4018
|
-
declare const isFilled_image: typeof image;
|
|
4019
|
-
declare const isFilled_imageThumbnail: typeof imageThumbnail;
|
|
4020
|
-
declare const isFilled_integration: typeof integration;
|
|
4021
|
-
declare const isFilled_integrationField: typeof integrationField;
|
|
4022
|
-
declare const isFilled_integrationFields: typeof integrationFields;
|
|
4023
|
-
declare const isFilled_keyText: typeof keyText;
|
|
4024
|
-
declare const isFilled_link: typeof link;
|
|
4025
|
-
declare const isFilled_linkToMedia: typeof linkToMedia;
|
|
4026
|
-
declare const isFilled_number: typeof number;
|
|
4027
|
-
declare const isFilled_repeatable: typeof repeatable;
|
|
4028
|
-
declare const isFilled_richText: typeof richText;
|
|
4029
|
-
declare const isFilled_select: typeof select;
|
|
4030
|
-
declare const isFilled_sliceZone: typeof sliceZone;
|
|
4031
|
-
declare const isFilled_table: typeof table;
|
|
4032
|
-
declare const isFilled_timestamp: typeof timestamp;
|
|
4033
|
-
declare const isFilled_title: typeof title;
|
|
4034
|
-
declare namespace isFilled {
|
|
4035
|
-
export {
|
|
4036
|
-
isFilled_color as color,
|
|
4037
|
-
isFilled_contentRelationship as contentRelationship,
|
|
4038
|
-
isFilled_date as date,
|
|
4039
|
-
isFilled_embed as embed,
|
|
4040
|
-
isFilled_geoPoint as geoPoint,
|
|
4041
|
-
isFilled_group as group,
|
|
4042
|
-
isFilled_image as image,
|
|
4043
|
-
isFilled_imageThumbnail as imageThumbnail,
|
|
4044
|
-
isFilled_integration as integration,
|
|
4045
|
-
isFilled_integrationField as integrationField,
|
|
4046
|
-
isFilled_integrationFields as integrationFields,
|
|
4047
|
-
isFilled_keyText as keyText,
|
|
4048
|
-
isFilled_link as link,
|
|
4049
|
-
isFilled_linkToMedia as linkToMedia,
|
|
4050
|
-
isFilled_number as number,
|
|
4051
|
-
isFilled_repeatable as repeatable,
|
|
4052
|
-
isFilled_richText as richText,
|
|
4053
|
-
isFilled_select as select,
|
|
4054
|
-
isFilled_sliceZone as sliceZone,
|
|
4055
|
-
isFilled_table as table,
|
|
4056
|
-
isFilled_timestamp as timestamp,
|
|
4057
|
-
isFilled_title as title,
|
|
4058
|
-
};
|
|
4059
|
-
}
|
|
4060
|
-
|
|
4061
|
-
type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
|
|
4062
|
-
/**
|
|
4063
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
4064
|
-
* for document links
|
|
4065
|
-
*
|
|
4066
|
-
* @typeParam TDocument - Specific interface of the provided document
|
|
4067
|
-
*
|
|
4068
|
-
* @param prismicDocument - A document coming from Prismic
|
|
4069
|
-
*
|
|
4070
|
-
* @returns The equivalent link field to use with `asLink()`
|
|
4071
|
-
*
|
|
4072
|
-
* @internal
|
|
4073
|
-
*/
|
|
4074
|
-
declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
4075
|
-
|
|
4076
|
-
declare class PrismicError<Response> extends Error {
|
|
4077
|
-
url?: string;
|
|
4078
|
-
response: Response;
|
|
4079
|
-
constructor(message: string | undefined, url: string | undefined, response: Response);
|
|
4080
|
-
}
|
|
4081
|
-
|
|
4082
|
-
type ForbiddenErrorRepositoryAPIResponse = {
|
|
4083
|
-
type: string;
|
|
4084
|
-
message: string;
|
|
4085
|
-
};
|
|
4086
|
-
type ForbiddenErrorQueryAPIResponse = {
|
|
4087
|
-
error: string;
|
|
4088
|
-
};
|
|
4089
|
-
declare class ForbiddenError<TResponse = ForbiddenErrorRepositoryAPIResponse | ForbiddenErrorQueryAPIResponse> extends PrismicError<TResponse> {
|
|
4090
|
-
}
|
|
4091
|
-
|
|
4092
|
-
declare class NotFoundError<TResponse = undefined> extends PrismicError<TResponse> {
|
|
4093
|
-
}
|
|
4094
|
-
|
|
4095
|
-
type RefNotFoundErrorAPIResponse = {
|
|
4096
|
-
type: "api_notfound_error";
|
|
4097
|
-
message: string;
|
|
4098
|
-
};
|
|
4099
|
-
declare class RefNotFoundError<TResponse = RefNotFoundErrorAPIResponse> extends ForbiddenError<TResponse> {
|
|
4100
|
-
}
|
|
4101
|
-
|
|
4102
|
-
type RefExpiredErrorAPIResponse = {
|
|
4103
|
-
type: "api_validation_error";
|
|
4104
|
-
message: string;
|
|
4105
|
-
};
|
|
4106
|
-
declare class RefExpiredError<TResponse = RefExpiredErrorAPIResponse> extends ForbiddenError<TResponse> {
|
|
4107
|
-
}
|
|
4108
|
-
|
|
4109
|
-
type PreviewTokenExpiredErrorAPIResponse = {
|
|
4110
|
-
type: "api_security_error";
|
|
4111
|
-
message: string;
|
|
4112
|
-
};
|
|
4113
|
-
declare class PreviewTokenExpiredError<TResponse = PreviewTokenExpiredErrorAPIResponse> extends ForbiddenError<TResponse> {
|
|
4114
|
-
}
|
|
4115
|
-
|
|
4116
|
-
type ParsingErrorAPIResponse = {
|
|
4117
|
-
type: "parsing-error";
|
|
4118
|
-
message: string;
|
|
4119
|
-
pos: {
|
|
4120
|
-
line: number;
|
|
4121
|
-
column: number;
|
|
4122
|
-
id: number;
|
|
4123
|
-
location: string;
|
|
4124
|
-
};
|
|
4125
|
-
};
|
|
4126
|
-
declare class ParsingError<TResponse = ParsingErrorAPIResponse> extends PrismicError<TResponse> {
|
|
4127
|
-
}
|
|
4128
|
-
|
|
4129
|
-
declare class RepositoryNotFoundError<TResponse = undefined> extends NotFoundError<TResponse> {
|
|
4130
|
-
}
|
|
4131
|
-
|
|
4132
|
-
/**
|
|
4133
|
-
* A Prismic custom type model.
|
|
4134
|
-
*
|
|
4135
|
-
* @typeParam ID - API ID of the custom type.
|
|
4136
|
-
* @typeParam Definition - The custom type's tabs and their fields.
|
|
4137
|
-
*/
|
|
4138
|
-
interface CustomTypeModel<ID extends string = string, Definition extends CustomTypeModelDefinition = CustomTypeModelDefinition> {
|
|
4139
|
-
/**
|
|
4140
|
-
* The ID of the custom type model.
|
|
4141
|
-
*/
|
|
4142
|
-
id: ID;
|
|
4143
|
-
/**
|
|
4144
|
-
* The human readable name of the custom type model.
|
|
4145
|
-
*/
|
|
4146
|
-
label: string | null | undefined;
|
|
4147
|
-
/**
|
|
4148
|
-
* The format of the custom type model.
|
|
4149
|
-
*
|
|
4150
|
-
* Fallback to "custom" if undefined.
|
|
4151
|
-
*/
|
|
4152
|
-
format?: "page" | "custom";
|
|
4153
|
-
/**
|
|
4154
|
-
* Determines if more than one document for the custom type can be created.
|
|
4155
|
-
*/
|
|
4156
|
-
repeatable: boolean;
|
|
4157
|
-
/**
|
|
4158
|
-
* The custom type model definition.
|
|
4159
|
-
*/
|
|
4160
|
-
json: Definition;
|
|
4161
|
-
/**
|
|
4162
|
-
* Determines if new documents for the custom type can be created.
|
|
4163
|
-
*/
|
|
4164
|
-
status: boolean;
|
|
4165
|
-
}
|
|
4166
|
-
/**
|
|
4167
|
-
* A Prismic custom type's tabs and their fields.
|
|
4168
|
-
*
|
|
4169
|
-
* @typeParam TabName - Names of custom type tabs.
|
|
4170
|
-
*/
|
|
4171
|
-
type CustomTypeModelDefinition<TabName extends string = string> = Record<TabName, CustomTypeModelTab>;
|
|
4172
|
-
/**
|
|
4173
|
-
* A custom type's tab. Each tab can contain any number of fields but is limited
|
|
4174
|
-
* to one Slice Zone.
|
|
4175
|
-
*
|
|
4176
|
-
* @typeParam FieldName - API IDs of the fields.
|
|
4177
|
-
*/
|
|
4178
|
-
type CustomTypeModelTab<Fields extends Record<string, CustomTypeModelField> = Record<string, CustomTypeModelField>> = Fields;
|
|
4179
|
-
|
|
4180
|
-
/**
|
|
4181
|
-
* A shared Slice variation.
|
|
4182
|
-
*
|
|
4183
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
4184
|
-
*
|
|
4185
|
-
* @typeParam PrimaryFields - A record of fields that cannnot be repeated.
|
|
4186
|
-
* @typeParam ItemFields - A record of fields that can be repeated.
|
|
4187
|
-
*/
|
|
4188
|
-
interface SharedSliceModelVariation<ID extends string = string, PrimaryFields extends Record<string, CustomTypeModelFieldForSlicePrimary> = Record<string, CustomTypeModelFieldForSlicePrimary>, ItemFields extends Record<string, CustomTypeModelFieldForNestedGroup> = Record<string, CustomTypeModelFieldForNestedGroup>> {
|
|
4189
|
-
id: ID;
|
|
4190
|
-
name: string;
|
|
4191
|
-
docURL: string;
|
|
4192
|
-
version: string;
|
|
4193
|
-
description: string;
|
|
4194
|
-
primary?: PrimaryFields;
|
|
4195
|
-
items?: ItemFields;
|
|
4196
|
-
imageUrl: string;
|
|
4197
|
-
}
|
|
4198
|
-
|
|
4199
|
-
/**
|
|
4200
|
-
* A Prismic shared Slice model.
|
|
4201
|
-
*
|
|
4202
|
-
* More details: {@link https://prismic.io/docs/slice}
|
|
4203
|
-
*
|
|
4204
|
-
* @typeParam Variation - A variation for the shared Slice.
|
|
4205
|
-
*/
|
|
4206
|
-
interface SharedSliceModel<ID extends string = string, Variation extends SharedSliceModelVariation = SharedSliceModelVariation> {
|
|
4207
|
-
type: typeof CustomTypeModelSliceType.SharedSlice;
|
|
4208
|
-
id: ID;
|
|
4209
|
-
name: string;
|
|
4210
|
-
description?: string;
|
|
4211
|
-
variations: readonly Variation[];
|
|
4212
|
-
}
|
|
4213
|
-
|
|
4214
|
-
/**
|
|
4215
|
-
* Metadata for a Release.
|
|
4216
|
-
*
|
|
4217
|
-
* @remarks
|
|
4218
|
-
* This is an alias for `Ref`.
|
|
4219
|
-
*
|
|
4220
|
-
* @see {@link Ref}
|
|
4221
|
-
* @see More details on Releases: {@link https://prismic.io/docs/guides/draft-plan-and-schedule-content#releases}
|
|
4222
|
-
*/
|
|
4223
|
-
type Release = Ref;
|
|
4224
|
-
|
|
4225
|
-
/**
|
|
4226
|
-
* List of tags returned from the Prismic Tags API. This data can be fetched by
|
|
4227
|
-
* sending a `GET` request to a repository's `/api/tags` endpoint.
|
|
4228
|
-
*
|
|
4229
|
-
* @typeParam Tag - Tags that are returned by the Tags API.
|
|
4230
|
-
*
|
|
4231
|
-
* @see More details on the Tags API: {@link https://prismic.io/docs/tags-api-technical-reference}
|
|
4232
|
-
*/
|
|
4233
|
-
type Tags<Tag extends string = string> = Tag[];
|
|
4234
|
-
|
|
4235
|
-
/**
|
|
4236
|
-
* A catalog item from an integration field.
|
|
4237
|
-
*
|
|
4238
|
-
* @typeParam TData - The data shape for the catalog item.
|
|
4239
|
-
*
|
|
4240
|
-
* @see {@link https://prismic.io/docs/fields/integration#create-an-integration-catalog}
|
|
4241
|
-
*/
|
|
4242
|
-
type IntegrationAPIItem<TData extends IntegrationFieldData = IntegrationFieldData> = {
|
|
4243
|
-
id: string;
|
|
4244
|
-
title: string;
|
|
4245
|
-
description: string;
|
|
4246
|
-
image_url?: string;
|
|
4247
|
-
last_update?: number;
|
|
4248
|
-
blob: TData;
|
|
4249
|
-
};
|
|
4250
|
-
/**
|
|
4251
|
-
* Response payload from a custom integration catalog API. Contains an array of
|
|
4252
|
-
* catalog items and the total count.
|
|
4253
|
-
*
|
|
4254
|
-
* @typeParam TData - The shape of each catalog item's data.
|
|
4255
|
-
*
|
|
4256
|
-
* @see {@link https://prismic.io/docs/fields/integration#create-an-integration-catalog}
|
|
4257
|
-
*/
|
|
4258
|
-
type IntegrationAPIResults<TData extends IntegrationFieldData = IntegrationFieldData> = {
|
|
4259
|
-
results_size: number;
|
|
4260
|
-
results: IntegrationAPIItem<TData>[];
|
|
4261
|
-
};
|
|
4262
|
-
|
|
4263
|
-
/**
|
|
4264
|
-
* Webhook payload sent when a Prismic repository content is updated.
|
|
4265
|
-
*
|
|
4266
|
-
* @see More details: {@link https://prismic.io/docs/webhooks}
|
|
4267
|
-
*/
|
|
4268
|
-
interface WebhookBodyAPIUpdate extends WebhookBodyBase {
|
|
4269
|
-
type: typeof WebhookType.APIUpdate;
|
|
4270
|
-
masterRef?: string;
|
|
4271
|
-
releases: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateRelease>;
|
|
4272
|
-
masks: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateMask>;
|
|
4273
|
-
tags: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateTag>;
|
|
4274
|
-
documents: string[];
|
|
4275
|
-
/**
|
|
4276
|
-
* @deprecated Experiments are no longer supported by Prismic.
|
|
4277
|
-
*/
|
|
4278
|
-
experiments?: WebhookBodyAPIUpdateOperations<unknown>;
|
|
4279
|
-
}
|
|
4280
|
-
interface WebhookBodyAPIUpdateOperations<T> {
|
|
4281
|
-
update?: T[];
|
|
4282
|
-
addition?: T[];
|
|
4283
|
-
deletion?: T[];
|
|
4284
|
-
}
|
|
4285
|
-
/**
|
|
4286
|
-
* Metadata representing a mask (also called a custom type).
|
|
4287
|
-
*
|
|
4288
|
-
* @see More details: {@link https://prismic.io/docs/custom-types}
|
|
4289
|
-
*/
|
|
4290
|
-
interface WebhookBodyAPIUpdateMask {
|
|
4291
|
-
id: string;
|
|
4292
|
-
label: string;
|
|
4293
|
-
}
|
|
4294
|
-
/**
|
|
4295
|
-
* Metadata representing a tag.
|
|
4296
|
-
*
|
|
4297
|
-
* @see More details: {@link https://prismic.io/docs/guides/document-tags}
|
|
4298
|
-
*/
|
|
4299
|
-
interface WebhookBodyAPIUpdateTag {
|
|
4300
|
-
id: string;
|
|
4301
|
-
}
|
|
4302
|
-
/**
|
|
4303
|
-
* Metadata representing a Release.
|
|
4304
|
-
*
|
|
4305
|
-
* @see More details: {@link https://prismic.io/docs/guides/draft-plan-and-schedule-content#releases}
|
|
4306
|
-
*/
|
|
4307
|
-
interface WebhookBodyAPIUpdateRelease {
|
|
4308
|
-
id: string;
|
|
4309
|
-
ref: string;
|
|
4310
|
-
label: string;
|
|
4311
|
-
documents: string[];
|
|
4312
|
-
}
|
|
4313
|
-
|
|
4314
|
-
/**
|
|
4315
|
-
* Webhook payload sent when a test webhook action is triggered.
|
|
4316
|
-
*
|
|
4317
|
-
* @see More details: {@link https://prismic.io/docs/webhooks}
|
|
4318
|
-
*/
|
|
4319
|
-
interface WebhookBodyTestTrigger extends WebhookBodyBase {
|
|
4320
|
-
type: typeof WebhookType.TestTrigger;
|
|
4321
|
-
}
|
|
4322
|
-
|
|
4323
|
-
type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger;
|
|
4324
|
-
/**
|
|
4325
|
-
* Types of Prismic Webhooks.
|
|
4326
|
-
*
|
|
4327
|
-
* @see More details: {@link https://prismic.io/docs/webhooks}
|
|
4328
|
-
*/
|
|
4329
|
-
declare const WebhookType: {
|
|
4330
|
-
readonly APIUpdate: "api-update";
|
|
4331
|
-
readonly TestTrigger: "test-trigger";
|
|
4332
|
-
};
|
|
4333
|
-
interface WebhookBodyBase {
|
|
4334
|
-
type: (typeof WebhookType)[keyof typeof WebhookType];
|
|
4335
|
-
domain: string;
|
|
4336
|
-
apiUrl: string;
|
|
4337
|
-
secret: string | null;
|
|
4338
|
-
}
|
|
4339
|
-
|
|
4340
|
-
/**
|
|
4341
|
-
* @deprecated Renamed to `filter`
|
|
4342
|
-
*/
|
|
4343
|
-
declare const predicate: {
|
|
4344
|
-
at: (path: string, value: string | number | boolean | Date | string[]) => string;
|
|
4345
|
-
not: (path: string, value: string | number | boolean | Date | string[]) => string;
|
|
4346
|
-
any: (path: string, values: (string | number | boolean | Date)[]) => string;
|
|
4347
|
-
in: (path: string, values: string[]) => string;
|
|
4348
|
-
fulltext: (path: string, searchTerms: string) => string;
|
|
4349
|
-
has: (path: string) => string;
|
|
4350
|
-
missing: (path: string) => string;
|
|
4351
|
-
similar: (id: string, value: number) => string;
|
|
4352
|
-
geopointNear: (path: string, latitude: number, longitude: number, radius: number) => string;
|
|
4353
|
-
numberLessThan: (path: string, value: number) => string;
|
|
4354
|
-
numberGreaterThan: (path: string, value: number) => string;
|
|
4355
|
-
numberInRange: (path: string, lowerLimit: number, upperLimit: number) => string;
|
|
4356
|
-
dateAfter: (path: string, date: string | number | Date) => string;
|
|
4357
|
-
dateBefore: (path: string, date: string | number | Date) => string;
|
|
4358
|
-
dateBetween: (path: string, startDate: string | number | Date, endDate: string | number | Date) => string;
|
|
4359
|
-
dateDayOfMonth: (path: string, day: number) => string;
|
|
4360
|
-
dateDayOfMonthAfter: (path: string, day: number) => string;
|
|
4361
|
-
dateDayOfMonthBefore: (path: string, day: number) => string;
|
|
4362
|
-
dateDayOfWeek: (path: string, day: string | number) => string;
|
|
4363
|
-
dateDayOfWeekAfter: (path: string, day: string | number) => string;
|
|
4364
|
-
dateDayOfWeekBefore: (path: string, day: string | number) => string;
|
|
4365
|
-
dateMonth: (path: string, month: string | number) => string;
|
|
4366
|
-
dateMonthAfter: (path: string, month: string | number) => string;
|
|
4367
|
-
dateMonthBefore: (path: string, month: string | number) => string;
|
|
4368
|
-
dateYear: (path: string, year: number) => string;
|
|
4369
|
-
dateHour: (path: string, hour: number) => string;
|
|
4370
|
-
dateHourAfter: (path: string, hour: number) => string;
|
|
4371
|
-
dateHourBefore: (path: string, hour: number) => string;
|
|
4372
|
-
};
|
|
4373
|
-
|
|
4374
|
-
/**
|
|
4375
|
-
* @deprecated Renamed to `mapSliceZone`
|
|
4376
|
-
*/
|
|
4377
|
-
declare const unstable_mapSliceZone: typeof mapSliceZone;
|
|
4378
|
-
|
|
4379
|
-
/**
|
|
4380
|
-
* @deprecated Renamed to `HTMLRichTextMapSerializer`
|
|
4381
|
-
*/
|
|
4382
|
-
type HTMLMapSerializer = HTMLRichTextMapSerializer;
|
|
4383
|
-
/**
|
|
4384
|
-
* @deprecated Renamed to `HTMLRichTextFunctionSerializer`
|
|
4385
|
-
*/
|
|
4386
|
-
type HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;
|
|
4387
|
-
|
|
4388
|
-
/**
|
|
4389
|
-
* @deprecated Use {@link RichTextNodeType} instead.
|
|
4390
|
-
*/
|
|
4391
|
-
declare const Element: {
|
|
4392
|
-
readonly heading1: "heading1";
|
|
4393
|
-
readonly heading2: "heading2";
|
|
4394
|
-
readonly heading3: "heading3";
|
|
4395
|
-
readonly heading4: "heading4";
|
|
4396
|
-
readonly heading5: "heading5";
|
|
4397
|
-
readonly heading6: "heading6";
|
|
4398
|
-
readonly paragraph: "paragraph";
|
|
4399
|
-
readonly preformatted: "preformatted";
|
|
4400
|
-
readonly strong: "strong";
|
|
4401
|
-
readonly em: "em";
|
|
4402
|
-
readonly listItem: "list-item";
|
|
4403
|
-
readonly oListItem: "o-list-item";
|
|
4404
|
-
readonly list: "group-list-item";
|
|
4405
|
-
readonly oList: "group-o-list-item";
|
|
4406
|
-
readonly image: "image";
|
|
4407
|
-
readonly embed: "embed";
|
|
4408
|
-
readonly hyperlink: "hyperlink";
|
|
4409
|
-
readonly label: "label";
|
|
4410
|
-
readonly span: "span";
|
|
4411
|
-
};
|
|
4412
|
-
|
|
4413
|
-
/**
|
|
4414
|
-
* @deprecated Renamed to `IntegrationField`
|
|
4415
|
-
*/
|
|
4416
|
-
type IntegrationFields = IntegrationField;
|
|
4417
|
-
|
|
4418
|
-
/**
|
|
4419
|
-
* @deprecated Renamed to `CustomTypeModelIntegrationField`.
|
|
4420
|
-
*/
|
|
4421
|
-
type CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;
|
|
4422
|
-
|
|
4423
|
-
export { AnyOEmbed, AnyRegularField, Client, ColorField, ContentRelationshipField, CustomTypeModelFieldType, CustomTypeModelLinkSelectType, CustomTypeModelSliceDisplay, CustomTypeModelSliceType, DateField, Element, EmbedField, FilledContentRelationshipField, FilledImageFieldImage, FilledLinkToMediaField, FilledLinkToWebField, ForbiddenError, GeoPointField, GroupField, ImageField, ImageFieldImage, IntegrationField, IntegrationFieldData, KeyTextField, LinkField, LinkToMediaField, Migration, NestedGroupField, NotFoundError, NumberField, OEmbedExtra, ParsingError, PreviewTokenExpiredError, PrismicError, PrismicMigrationAsset, PrismicMigrationDocument, RTImageNode, RefExpiredError, RefNotFoundError, Repeatable, RepositoryNotFoundError, RichTextField, SelectField, SharedSlice, Slice, SliceZone, TableField, TimestampField, TitleField, WebhookType, WriteClient, asDate, asHTML, asImagePixelDensitySrcSet, asImageSrc, asImageWidthSrcSet, asLink, asLinkAttrs, asText, buildQueryURL, cookie, createClient, createMigration, createWriteClient, documentToLinkField, filter, getGraphQLEndpoint, getRepositoryEndpoint, getRepositoryName, getToolbarSrc, isFilled, isRepositoryEndpoint, isRepositoryName, mapSliceZone, predicate, unstable_mapSliceZone };
|
|
4424
|
-
export type { AbortSignalLike, AlternateLanguage, AsLinkAttrsConfig, BuildQueryURLArgs, ClientConfig, CreateClient, CreateMigration, CreateWriteClient, CustomTypeModel, CustomTypeModelBooleanField, CustomTypeModelColorField, CustomTypeModelContentRelationshipField, CustomTypeModelDateField, CustomTypeModelDefinition, CustomTypeModelEmbedField, CustomTypeModelFetchContentRelationshipLevel1, CustomTypeModelFetchCustomTypeLevel1, CustomTypeModelFetchCustomTypeLevel2, CustomTypeModelFetchGroupLevel1, CustomTypeModelFetchGroupLevel2, CustomTypeModelField, CustomTypeModelFieldForGroup, CustomTypeModelFieldForNestedGroup, CustomTypeModelFieldForSlicePrimary, CustomTypeModelGeoPointField, CustomTypeModelGroupField, CustomTypeModelImageConstraint, CustomTypeModelImageField, CustomTypeModelImageThumbnail, CustomTypeModelIntegrationField, CustomTypeModelIntegrationFieldsField, CustomTypeModelKeyTextField, CustomTypeModelLegacySlice, CustomTypeModelLinkField, CustomTypeModelLinkToMediaField, CustomTypeModelNestedGroupField, CustomTypeModelNumberField, CustomTypeModelRangeField, CustomTypeModelRichTextField, CustomTypeModelRichTextMultiField, CustomTypeModelRichTextSingleField, CustomTypeModelSelectField, CustomTypeModelSeparatorField, CustomTypeModelSharedSlice, CustomTypeModelSlice, CustomTypeModelSliceLabel, CustomTypeModelSliceZoneField, CustomTypeModelTab, CustomTypeModelTableField, CustomTypeModelTimestampField, CustomTypeModelTitleField, CustomTypeModelUIDField, ExistingPrismicDocument, FetchLike, Form, FormField, HTMLFunctionSerializer, HTMLMapSerializer, HTMLRichTextFunctionSerializer, HTMLRichTextMapSerializer, HTMLRichTextSerializer, HttpRequestLike, InjectMigrationSpecificTypes, IntegrationAPIItem, IntegrationAPIResults, IntegrationFields, Language, LinkResolverFunction, MigrateReporterEvents, MigrationContentRelationship, MigrationImage, MigrationLinkToMedia, MigrationRTImageNode, Ordering, PendingPrismicDocument, PrismicDocument, PrismicDocumentHeader, PrismicDocumentWithUID, PrismicDocumentWithoutUID, Query, QueryParams, Ref, Release, Repository, RequestInitLike, ResponseLike, Route, SharedSliceModel, SharedSliceModelVariation, SliceMapper, Tags, WebhookBody, WebhookBodyAPIUpdate, WebhookBodyTestTrigger, WriteClientConfig };
|