@prismicio/client 7.22.1 → 7.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client.cjs +11 -6
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +14 -16
- package/dist/Client.d.cts.map +1 -1
- package/dist/Client.d.ts +14 -16
- package/dist/Client.d.ts.map +1 -1
- package/dist/Client.js +11 -6
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +24 -23
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +1 -3
- package/dist/Migration.d.cts.map +1 -1
- package/dist/Migration.d.ts +1 -3
- package/dist/Migration.d.ts.map +1 -1
- package/dist/Migration.js +24 -23
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +21 -19
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +18 -22
- package/dist/WriteClient.d.cts.map +1 -1
- package/dist/WriteClient.d.ts +18 -22
- package/dist/WriteClient.d.ts.map +1 -1
- package/dist/WriteClient.js +21 -19
- package/dist/WriteClient.js.map +1 -1
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +5 -6
- package/dist/buildQueryURL.d.cts.map +1 -1
- package/dist/buildQueryURL.d.ts +5 -6
- package/dist/buildQueryURL.d.ts.map +1 -1
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.d.cts +1 -1
- package/dist/cookie.d.cts.map +1 -1
- package/dist/cookie.d.ts +1 -1
- package/dist/cookie.d.ts.map +1 -1
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +2 -4
- package/dist/createClient.d.cts.map +1 -1
- package/dist/createClient.d.ts +2 -4
- package/dist/createClient.d.ts.map +1 -1
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +2 -4
- package/dist/createMigration.d.cts.map +1 -1
- package/dist/createMigration.d.ts +2 -4
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +2 -4
- package/dist/createWriteClient.d.cts.map +1 -1
- package/dist/createWriteClient.d.ts +2 -4
- package/dist/createWriteClient.d.ts.map +1 -1
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +9 -10
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts +9 -10
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/filter.cjs +175 -0
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +3 -4
- package/dist/filter.d.cts.map +1 -1
- package/dist/filter.d.ts +3 -4
- package/dist/filter.d.ts.map +1 -1
- package/dist/filter.js +175 -0
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +1 -2
- package/dist/getGraphQLEndpoint.d.cts.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +1 -2
- package/dist/getGraphQLEndpoint.d.ts.map +1 -1
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +1 -2
- package/dist/getRepositoryEndpoint.d.cts.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +1 -2
- package/dist/getRepositoryEndpoint.d.ts.map +1 -1
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +1 -2
- package/dist/getRepositoryName.d.cts.map +1 -1
- package/dist/getRepositoryName.d.ts +1 -2
- package/dist/getRepositoryName.d.ts.map +1 -1
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +1 -2
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +1 -2
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +1 -3
- package/dist/helpers/asDate.d.cts.map +1 -1
- package/dist/helpers/asDate.d.ts +1 -3
- package/dist/helpers/asDate.d.ts.map +1 -1
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +7 -5
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +12 -11
- package/dist/helpers/asHTML.d.cts.map +1 -1
- package/dist/helpers/asHTML.d.ts +12 -11
- package/dist/helpers/asHTML.d.ts.map +1 -1
- package/dist/helpers/asHTML.js +7 -5
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +3 -4
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +3 -4
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +1 -3
- package/dist/helpers/asImageSrc.d.cts.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +1 -3
- package/dist/helpers/asImageSrc.d.ts.map +1 -1
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +3 -4
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +3 -4
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +3 -5
- package/dist/helpers/asLink.d.cts.map +1 -1
- package/dist/helpers/asLink.d.ts +3 -5
- package/dist/helpers/asLink.d.ts.map +1 -1
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +2 -4
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +2 -4
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +1 -3
- package/dist/helpers/asText.d.cts.map +1 -1
- package/dist/helpers/asText.d.ts +1 -3
- package/dist/helpers/asText.d.ts.map +1 -1
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +1 -3
- package/dist/helpers/documentToLinkField.d.cts.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +1 -3
- package/dist/helpers/documentToLinkField.d.ts.map +1 -1
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +20 -0
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +22 -24
- package/dist/helpers/isFilled.d.cts.map +1 -1
- package/dist/helpers/isFilled.d.ts +22 -24
- package/dist/helpers/isFilled.d.ts.map +1 -1
- package/dist/helpers/isFilled.js +1 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +10 -8
- package/dist/helpers/mapSliceZone.d.cts.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +10 -8
- package/dist/helpers/mapSliceZone.d.ts.map +1 -1
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +1 -2
- package/dist/isRepositoryEndpoint.d.cts.map +1 -1
- package/dist/isRepositoryEndpoint.d.ts +1 -2
- package/dist/isRepositoryEndpoint.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.d.cts +1 -2
- package/dist/isRepositoryName.d.cts.map +1 -1
- package/dist/isRepositoryName.d.ts +1 -2
- package/dist/isRepositoryName.d.ts.map +1 -1
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +1 -0
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +5 -6
- package/dist/lib/request.d.cts.map +1 -1
- package/dist/lib/request.d.ts +5 -6
- package/dist/lib/request.d.ts.map +1 -1
- package/dist/lib/request.js +1 -1
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +3 -0
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +1 -1
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs +10 -6
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js +10 -6
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/throttledWarn.cjs.map +1 -1
- package/dist/lib/throttledWarn.js.map +1 -1
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +1 -3
- package/dist/richtext/asText.d.cts.map +1 -1
- package/dist/richtext/asText.d.ts +1 -3
- package/dist/richtext/asText.d.ts.map +1 -1
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +1 -3
- package/dist/richtext/asTree.d.cts.map +1 -1
- package/dist/richtext/asTree.d.ts +1 -3
- package/dist/richtext/asTree.d.ts.map +1 -1
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +1 -3
- package/dist/richtext/composeSerializers.d.cts.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +1 -3
- package/dist/richtext/composeSerializers.d.ts.map +1 -1
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +1 -3
- package/dist/richtext/serialize.d.cts.map +1 -1
- package/dist/richtext/serialize.d.ts +1 -3
- package/dist/richtext/serialize.d.ts.map +1 -1
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +5 -7
- package/dist/richtext/types.d.cts.map +1 -1
- package/dist/richtext/types.d.ts +5 -7
- package/dist/richtext/types.d.ts.map +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +1 -3
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +1 -3
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/asset/asset.d.cts +35 -20
- package/dist/types/api/asset/asset.d.cts.map +1 -1
- package/dist/types/api/asset/asset.d.ts +35 -20
- package/dist/types/api/asset/asset.d.ts.map +1 -1
- package/dist/types/api/asset/tag.d.cts +12 -7
- package/dist/types/api/asset/tag.d.cts.map +1 -1
- package/dist/types/api/asset/tag.d.ts +12 -7
- package/dist/types/api/asset/tag.d.ts.map +1 -1
- package/dist/types/api/integration.d.cts +2 -4
- package/dist/types/api/integration.d.cts.map +1 -1
- package/dist/types/api/integration.d.ts +2 -4
- package/dist/types/api/integration.d.ts.map +1 -1
- package/dist/types/api/migration/release.d.cts +3 -7
- package/dist/types/api/migration/release.d.cts.map +1 -1
- package/dist/types/api/migration/release.d.ts +3 -7
- package/dist/types/api/migration/release.d.ts.map +1 -1
- package/dist/types/api/query.d.cts +1 -3
- package/dist/types/api/query.d.cts.map +1 -1
- package/dist/types/api/query.d.ts +1 -3
- package/dist/types/api/query.d.ts.map +1 -1
- package/dist/types/api/ref.d.cts +1 -2
- package/dist/types/api/ref.d.cts.map +1 -1
- package/dist/types/api/ref.d.ts +1 -2
- package/dist/types/api/ref.d.ts.map +1 -1
- package/dist/types/api/release.d.cts +1 -3
- package/dist/types/api/release.d.cts.map +1 -1
- package/dist/types/api/release.d.ts +1 -3
- package/dist/types/api/release.d.ts.map +1 -1
- package/dist/types/api/repository.d.cts +4 -6
- package/dist/types/api/repository.d.cts.map +1 -1
- package/dist/types/api/repository.d.ts +4 -6
- package/dist/types/api/repository.d.ts.map +1 -1
- package/dist/types/api/tags.d.cts +1 -2
- package/dist/types/api/tags.d.cts.map +1 -1
- package/dist/types/api/tags.d.ts +1 -2
- package/dist/types/api/tags.d.ts.map +1 -1
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +21 -15
- package/dist/types/migration/Asset.d.cts.map +1 -1
- package/dist/types/migration/Asset.d.ts +21 -15
- package/dist/types/migration/Asset.d.ts.map +1 -1
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +1 -3
- package/dist/types/migration/ContentRelationship.d.cts.map +1 -1
- package/dist/types/migration/ContentRelationship.d.ts +1 -3
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -1
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +8 -8
- package/dist/types/migration/Document.d.cts.map +1 -1
- package/dist/types/migration/Document.d.ts +8 -8
- package/dist/types/migration/Document.d.ts.map +1 -1
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/boolean.d.cts +1 -3
- package/dist/types/model/boolean.d.cts.map +1 -1
- package/dist/types/model/boolean.d.ts +1 -3
- package/dist/types/model/boolean.d.ts.map +1 -1
- package/dist/types/model/color.d.cts +1 -3
- package/dist/types/model/color.d.cts.map +1 -1
- package/dist/types/model/color.d.ts +1 -3
- package/dist/types/model/color.d.ts.map +1 -1
- package/dist/types/model/contentRelationship.d.cts +6 -8
- package/dist/types/model/contentRelationship.d.cts.map +1 -1
- package/dist/types/model/contentRelationship.d.ts +6 -8
- package/dist/types/model/contentRelationship.d.ts.map +1 -1
- package/dist/types/model/customType.d.cts +3 -5
- package/dist/types/model/customType.d.cts.map +1 -1
- package/dist/types/model/customType.d.ts +3 -5
- package/dist/types/model/customType.d.ts.map +1 -1
- package/dist/types/model/date.d.cts +1 -3
- package/dist/types/model/date.d.cts.map +1 -1
- package/dist/types/model/date.d.ts +1 -3
- package/dist/types/model/date.d.ts.map +1 -1
- package/dist/types/model/embed.d.cts +1 -3
- package/dist/types/model/embed.d.cts.map +1 -1
- package/dist/types/model/embed.d.ts +1 -3
- package/dist/types/model/embed.d.ts.map +1 -1
- package/dist/types/model/geoPoint.d.cts +1 -3
- package/dist/types/model/geoPoint.d.cts.map +1 -1
- package/dist/types/model/geoPoint.d.ts +1 -3
- package/dist/types/model/geoPoint.d.ts.map +1 -1
- package/dist/types/model/group.d.cts +2 -4
- package/dist/types/model/group.d.cts.map +1 -1
- package/dist/types/model/group.d.ts +2 -4
- package/dist/types/model/group.d.ts.map +1 -1
- package/dist/types/model/image.d.cts +3 -5
- package/dist/types/model/image.d.cts.map +1 -1
- package/dist/types/model/image.d.ts +3 -5
- package/dist/types/model/image.d.ts.map +1 -1
- package/dist/types/model/integration.d.cts +1 -3
- package/dist/types/model/integration.d.cts.map +1 -1
- package/dist/types/model/integration.d.ts +1 -3
- package/dist/types/model/integration.d.ts.map +1 -1
- package/dist/types/model/keyText.d.cts +1 -3
- package/dist/types/model/keyText.d.cts.map +1 -1
- package/dist/types/model/keyText.d.ts +1 -3
- package/dist/types/model/keyText.d.ts.map +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.cts +2 -4
- package/dist/types/model/link.d.cts.map +1 -1
- package/dist/types/model/link.d.ts +2 -4
- package/dist/types/model/link.d.ts.map +1 -1
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.cts +1 -3
- package/dist/types/model/linkToMedia.d.cts.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -3
- package/dist/types/model/linkToMedia.d.ts.map +1 -1
- package/dist/types/model/number.d.cts +1 -3
- package/dist/types/model/number.d.cts.map +1 -1
- package/dist/types/model/number.d.ts +1 -3
- package/dist/types/model/number.d.ts.map +1 -1
- package/dist/types/model/range.d.cts +1 -3
- package/dist/types/model/range.d.cts.map +1 -1
- package/dist/types/model/range.d.ts +1 -3
- package/dist/types/model/range.d.ts.map +1 -1
- package/dist/types/model/richText.d.cts +3 -5
- package/dist/types/model/richText.d.cts.map +1 -1
- package/dist/types/model/richText.d.ts +3 -5
- package/dist/types/model/richText.d.ts.map +1 -1
- package/dist/types/model/select.d.cts +1 -3
- package/dist/types/model/select.d.cts.map +1 -1
- package/dist/types/model/select.d.ts +1 -3
- package/dist/types/model/select.d.ts.map +1 -1
- package/dist/types/model/separator.d.cts +1 -3
- package/dist/types/model/separator.d.cts.map +1 -1
- package/dist/types/model/separator.d.ts +1 -3
- package/dist/types/model/separator.d.ts.map +1 -1
- package/dist/types/model/sharedSlice.d.cts +1 -3
- package/dist/types/model/sharedSlice.d.cts.map +1 -1
- package/dist/types/model/sharedSlice.d.ts +1 -3
- package/dist/types/model/sharedSlice.d.ts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.cts +1 -3
- package/dist/types/model/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.ts +1 -3
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.cts +3 -5
- package/dist/types/model/slice.d.cts.map +1 -1
- package/dist/types/model/slice.d.ts +3 -5
- package/dist/types/model/slice.d.ts.map +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.cts +4 -6
- package/dist/types/model/sliceZone.d.cts.map +1 -1
- package/dist/types/model/sliceZone.d.ts +4 -6
- package/dist/types/model/sliceZone.d.ts.map +1 -1
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/table.d.cts +1 -3
- package/dist/types/model/table.d.cts.map +1 -1
- package/dist/types/model/table.d.ts +1 -3
- package/dist/types/model/table.d.ts.map +1 -1
- package/dist/types/model/timestamp.d.cts +1 -3
- package/dist/types/model/timestamp.d.cts.map +1 -1
- package/dist/types/model/timestamp.d.ts +1 -3
- package/dist/types/model/timestamp.d.ts.map +1 -1
- package/dist/types/model/title.d.cts +1 -3
- package/dist/types/model/title.d.cts.map +1 -1
- package/dist/types/model/title.d.ts +1 -3
- package/dist/types/model/title.d.ts.map +1 -1
- package/dist/types/model/types.cjs +4 -0
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +13 -11
- package/dist/types/model/types.d.cts.map +1 -1
- package/dist/types/model/types.d.ts +13 -11
- package/dist/types/model/types.d.ts.map +1 -1
- package/dist/types/model/types.js +4 -0
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.cts +1 -3
- package/dist/types/model/uid.d.cts.map +1 -1
- package/dist/types/model/uid.d.ts +1 -3
- package/dist/types/model/uid.d.ts.map +1 -1
- package/dist/types/value/boolean.d.cts +1 -2
- package/dist/types/value/boolean.d.cts.map +1 -1
- package/dist/types/value/boolean.d.ts +1 -2
- package/dist/types/value/boolean.d.ts.map +1 -1
- package/dist/types/value/color.d.cts +1 -3
- package/dist/types/value/color.d.cts.map +1 -1
- package/dist/types/value/color.d.ts +1 -3
- package/dist/types/value/color.d.ts.map +1 -1
- package/dist/types/value/contentRelationship.d.cts +3 -5
- package/dist/types/value/contentRelationship.d.cts.map +1 -1
- package/dist/types/value/contentRelationship.d.ts +3 -5
- package/dist/types/value/contentRelationship.d.ts.map +1 -1
- package/dist/types/value/date.d.cts +1 -3
- package/dist/types/value/date.d.cts.map +1 -1
- package/dist/types/value/date.d.ts +1 -3
- package/dist/types/value/date.d.ts.map +1 -1
- package/dist/types/value/document.d.cts +5 -7
- package/dist/types/value/document.d.cts.map +1 -1
- package/dist/types/value/document.d.ts +5 -7
- package/dist/types/value/document.d.ts.map +1 -1
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +43 -25
- package/dist/types/value/embed.d.cts.map +1 -1
- package/dist/types/value/embed.d.ts +43 -25
- package/dist/types/value/embed.d.ts.map +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +1 -3
- package/dist/types/value/geoPoint.d.cts.map +1 -1
- package/dist/types/value/geoPoint.d.ts +1 -3
- package/dist/types/value/geoPoint.d.ts.map +1 -1
- package/dist/types/value/group.d.cts +2 -4
- package/dist/types/value/group.d.cts.map +1 -1
- package/dist/types/value/group.d.ts +2 -4
- package/dist/types/value/group.d.ts.map +1 -1
- package/dist/types/value/image.d.cts +4 -6
- package/dist/types/value/image.d.cts.map +1 -1
- package/dist/types/value/image.d.ts +4 -6
- package/dist/types/value/image.d.ts.map +1 -1
- package/dist/types/value/integration.d.cts +2 -4
- package/dist/types/value/integration.d.cts.map +1 -1
- package/dist/types/value/integration.d.ts +2 -4
- package/dist/types/value/integration.d.ts.map +1 -1
- package/dist/types/value/keyText.d.cts +1 -3
- package/dist/types/value/keyText.d.cts.map +1 -1
- package/dist/types/value/keyText.d.ts +1 -3
- package/dist/types/value/keyText.d.ts.map +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +6 -8
- package/dist/types/value/link.d.cts.map +1 -1
- package/dist/types/value/link.d.ts +6 -8
- package/dist/types/value/link.d.ts.map +1 -1
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts +2 -4
- package/dist/types/value/linkToMedia.d.cts.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +2 -4
- package/dist/types/value/linkToMedia.d.ts.map +1 -1
- package/dist/types/value/number.d.cts +1 -3
- package/dist/types/value/number.d.cts.map +1 -1
- package/dist/types/value/number.d.ts +1 -3
- package/dist/types/value/number.d.ts.map +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.cts +29 -31
- package/dist/types/value/richText.d.cts.map +1 -1
- package/dist/types/value/richText.d.ts +29 -31
- package/dist/types/value/richText.d.ts.map +1 -1
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.cts +1 -3
- package/dist/types/value/select.d.cts.map +1 -1
- package/dist/types/value/select.d.ts +1 -3
- package/dist/types/value/select.d.ts.map +1 -1
- package/dist/types/value/sharedSlice.d.cts +1 -3
- package/dist/types/value/sharedSlice.d.cts.map +1 -1
- package/dist/types/value/sharedSlice.d.ts +1 -3
- package/dist/types/value/sharedSlice.d.ts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.cts +1 -3
- package/dist/types/value/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +1 -3
- package/dist/types/value/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/value/slice.d.cts +1 -3
- package/dist/types/value/slice.d.cts.map +1 -1
- package/dist/types/value/slice.d.ts +1 -3
- package/dist/types/value/slice.d.ts.map +1 -1
- package/dist/types/value/sliceZone.d.cts +1 -3
- package/dist/types/value/sliceZone.d.cts.map +1 -1
- package/dist/types/value/sliceZone.d.ts +1 -3
- package/dist/types/value/sliceZone.d.ts.map +1 -1
- package/dist/types/value/table.d.cts +26 -16
- package/dist/types/value/table.d.cts.map +1 -1
- package/dist/types/value/table.d.ts +26 -16
- package/dist/types/value/table.d.ts.map +1 -1
- package/dist/types/value/timestamp.d.cts +1 -3
- package/dist/types/value/timestamp.d.cts.map +1 -1
- package/dist/types/value/timestamp.d.ts +1 -3
- package/dist/types/value/timestamp.d.ts.map +1 -1
- package/dist/types/value/title.d.cts +1 -3
- package/dist/types/value/title.d.cts.map +1 -1
- package/dist/types/value/title.d.ts +1 -3
- package/dist/types/value/title.d.ts.map +1 -1
- package/dist/types/value/types.d.cts +6 -8
- package/dist/types/value/types.d.cts.map +1 -1
- package/dist/types/value/types.d.ts +6 -8
- package/dist/types/value/types.d.ts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.cts +1 -3
- package/dist/types/webhook/apiUpdate.d.cts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.ts +1 -3
- package/dist/types/webhook/apiUpdate.d.ts.map +1 -1
- package/dist/types/webhook/testTrigger.d.cts +1 -3
- package/dist/types/webhook/testTrigger.d.cts.map +1 -1
- package/dist/types/webhook/testTrigger.d.ts +1 -3
- package/dist/types/webhook/testTrigger.d.ts.map +1 -1
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.cts +3 -5
- package/dist/types/webhook/types.d.cts.map +1 -1
- package/dist/types/webhook/types.d.ts +3 -5
- package/dist/types/webhook/types.d.ts.map +1 -1
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +11 -11
- package/src/Client.ts +3 -2
- package/src/WriteClient.ts +14 -19
- package/src/lib/resolveMigrationDocumentData.ts +1 -1
- package/src/types/api/migration/release.ts +2 -5
package/dist/Client.js
CHANGED
|
@@ -220,12 +220,13 @@ var Client = class {
|
|
|
220
220
|
let latestResult;
|
|
221
221
|
while ((!latestResult || latestResult.next_page) && documents.length < limit) {
|
|
222
222
|
const page = latestResult ? latestResult.page + 1 : void 0;
|
|
223
|
-
|
|
223
|
+
const response = await this.#internalGet({
|
|
224
224
|
...resolvedParams,
|
|
225
225
|
page
|
|
226
226
|
});
|
|
227
|
+
latestResult = await response.json();
|
|
227
228
|
documents.push(...latestResult.results);
|
|
228
|
-
if (latestResult.next_page) await new Promise((res) => setTimeout(res, GET_ALL_QUERY_DELAY));
|
|
229
|
+
if (latestResult.next_page && !response.headers.get("x-cache")?.startsWith("Hit")) await new Promise((res) => setTimeout(res, GET_ALL_QUERY_DELAY));
|
|
229
230
|
}
|
|
230
231
|
return documents.slice(0, limit);
|
|
231
232
|
}
|
|
@@ -640,12 +641,13 @@ var Client = class {
|
|
|
640
641
|
}
|
|
641
642
|
}
|
|
642
643
|
if (documentID != null && previewToken != null) {
|
|
643
|
-
const
|
|
644
|
+
const document = await this.getByID(documentID, {
|
|
644
645
|
ref: previewToken,
|
|
645
646
|
lang: "*",
|
|
646
647
|
signal: args.signal,
|
|
647
648
|
fetchOptions: args.fetchOptions
|
|
648
|
-
})
|
|
649
|
+
});
|
|
650
|
+
const url = asLink(document, { linkResolver: args.linkResolver });
|
|
649
651
|
if (typeof url === "string") return url;
|
|
650
652
|
}
|
|
651
653
|
return args.defaultURL;
|
|
@@ -769,7 +771,8 @@ var Client = class {
|
|
|
769
771
|
*/
|
|
770
772
|
async #getResolvedRef(params) {
|
|
771
773
|
if (this.#autoPreviews) {
|
|
772
|
-
const
|
|
774
|
+
const cookies = this.#autoPreviewsRequest?.headers ? "get" in this.#autoPreviewsRequest.headers ? this.#autoPreviewsRequest.headers.get("cookie") : this.#autoPreviewsRequest.headers.cookie : globalThis.document?.cookie;
|
|
775
|
+
const previewRef = getPreviewCookie(cookies ?? "");
|
|
773
776
|
if (previewRef) return previewRef;
|
|
774
777
|
}
|
|
775
778
|
const ref = await this.#getRef?.(params);
|
|
@@ -791,7 +794,9 @@ var Client = class {
|
|
|
791
794
|
if (!params?.ref) this.#cachedRepository = void 0;
|
|
792
795
|
const masterRef = error.message.match(/master ref is: (?<ref>.*)$/i)?.groups?.ref;
|
|
793
796
|
if (!masterRef) throw error;
|
|
794
|
-
|
|
797
|
+
const badRef = new URL(url).searchParams.get("ref");
|
|
798
|
+
const issue = error instanceof RefNotFoundError ? "invalid" : "expired";
|
|
799
|
+
throttledWarn(`[@prismicio/client] The ref (${badRef}) was ${issue}. Now retrying with the latest master ref (${masterRef}). If you were previewing content, the response will not include draft content.`);
|
|
795
800
|
return await this.#internalGet({
|
|
796
801
|
...params,
|
|
797
802
|
ref: masterRef
|
package/dist/Client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Client.js","names":["#repositoryName","#autoPreviews","#autoPreviewsRequest","#internalGet","#cachedRepository","#cachedRepositoryExpiration","#request","#throwContentAPIError","#getResolvedRef","#getRef"],"sources":["../src/Client.ts"],"sourcesContent":["import { type BuildQueryURLArgs, buildQueryURL } from \"./buildQueryURL\"\nimport {\n\tForbiddenError,\n\tNotFoundError,\n\tParsingError,\n\tPreviewTokenExpiredError,\n\tPrismicError,\n\tRefExpiredError,\n\tRefNotFoundError,\n\tRepositoryNotFoundError,\n} from \"./errors\"\nimport { filter } from \"./filter\"\nimport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\"\nimport { getRepositoryName } from \"./getRepositoryName\"\nimport { type LinkResolverFunction, asLink } from \"./helpers/asLink\"\nimport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\"\nimport { devMsg } from \"./lib/devMsg\"\nimport { getPreviewCookie } from \"./lib/getPreviewCookie\"\nimport type { ResponseLike } from \"./lib/request\"\nimport { type AbortSignalLike, type FetchLike, type RequestInitLike, request } from \"./lib/request\"\nimport { throttledWarn } from \"./lib/throttledWarn\"\nimport type { Query } from \"./types/api/query\"\nimport type { Ref } from \"./types/api/ref\"\nimport type { Repository } from \"./types/api/repository\"\nimport type { PrismicDocument } from \"./types/value/document\"\n\nconst MAX_PAGE_SIZE = 100\nconst REPOSITORY_CACHE_TTL = 5000\nconst GET_ALL_QUERY_DELAY = 500\nconst MAX_INVALID_REF_RETRY_ATTEMPTS = 3\n\n/** Extracts a document type with a matching `type` property from a union of document types. */\ntype ExtractDocumentType<\n\tTDocuments extends PrismicDocument,\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * The minimum required properties to treat as an HTTP Request for automatic Prismic preview\n * support.\n */\nexport type HttpRequestLike =\n\t| // Web API Request\n\t {\n\t\t\theaders?: {\n\t\t\t\tget(name: string): string | null\n\t\t\t}\n\t\t\turl?: string\n\t }\n\t// Express-style request\n\t| {\n\t\t\theaders?: {\n\t\t\t\tcookie?: string\n\t\t\t}\n\t\t\tquery?: Record<string, unknown>\n\t }\n\n/**\n * A function that returns a ref string. Used to configure which ref the client queries content\n * from.\n */\ntype GetRef = (\n\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n) => string | undefined | Promise<string | undefined>\n\n/** Parameters for client methods that use `fetch()`. */\nexport type FetchParams = {\n\t/**\n\t * Options provided to the client's `fetch()` on all network requests. These options will be\n\t * merged with internally required options. They can also be overriden on a per-query basis using\n\t * the query's `fetchOptions` parameter.\n\t */\n\tfetchOptions?: RequestInitLike\n\t/** @deprecated Move to `fetchOptions.signal`: */\n\t// TODO: Remove in v8.\n\tsignal?: AbortSignalLike\n}\n\n/** Prismic client configuration. */\nexport type ClientConfig = {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint?: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * The version of the repository's content. It can optionally be a function that returns a ref.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tref?: string | GetRef\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<\n\t\tBuildQueryURLArgs,\n\t\t\"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\" | \"brokenRoute\"\n\t>\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetch?: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions?: RequestInitLike\n}\n\n/**\n * Parameters specific to client methods that fetch all documents. These methods start with `getAll`\n * (e.g. `getAllByType`).\n */\ntype GetAllParams = {\n\t/**\n\t * Limit the number of documents queried.\n\t *\n\t * @default No limit.\n\t */\n\tlimit?: number\n}\n\n/**\n * A client for fetching content from a Prismic repository.\n *\n * @see {@link https://prismic.io/docs/fetch-content}\n * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}\n */\nexport class Client<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<BuildQueryURLArgs, \"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\">\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchFn: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions: RequestInitLike\n\n\t#repositoryName: string | undefined\n\n\t#getRef?: GetRef\n\t#autoPreviews = true\n\t#autoPreviewsRequest?: HttpRequestLike\n\n\t#cachedRepository: Repository | undefined\n\t#cachedRepositoryExpiration = 0 // Timestamp\n\n\t/**\n\t * @param repositoryNameOrEndpoint - The Prismic repository name or full Content API endpoint for\n\t * the repository.\n\t * @param config - Client configuration.\n\t */\n\tconstructor(repositoryNameOrEndpoint: string, config: ClientConfig = {}) {\n\t\tconst {\n\t\t\tdocumentAPIEndpoint,\n\t\t\taccessToken,\n\t\t\tref,\n\t\t\troutes,\n\t\t\tbrokenRoute,\n\t\t\tdefaultParams,\n\t\t\tfetchOptions = {},\n\t\t\tfetch = globalThis.fetch?.bind(globalThis),\n\t\t} = config\n\n\t\tif (isRepositoryEndpoint(repositoryNameOrEndpoint)) {\n\t\t\ttry {\n\t\t\t\tthis.repositoryName = getRepositoryName(repositoryNameOrEndpoint)\n\t\t\t} catch {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[@prismicio/client] A repository name could not be inferred from the provided endpoint (\\`${repositoryNameOrEndpoint}\\`). Some methods will be disabled. Create the client using a repository name to prevent this warning. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.documentAPIEndpoint = documentAPIEndpoint || repositoryNameOrEndpoint\n\t\t} else {\n\t\t\tthis.repositoryName = repositoryNameOrEndpoint\n\t\t\tthis.documentAPIEndpoint =\n\t\t\t\tdocumentAPIEndpoint || getRepositoryEndpoint(repositoryNameOrEndpoint)\n\t\t}\n\n\t\tif (!fetch) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"A valid fetch implementation was not provided. In environments where fetch is not available, a fetch implementation must be provided via a polyfill or the `fetch` option.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (typeof fetch !== \"function\") {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`fetch must be a function, but received: ${typeof fetch}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\tif (!isRepositoryEndpoint(this.documentAPIEndpoint)) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`documentAPIEndpoint is not a valid URL: ${documentAPIEndpoint}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tisRepositoryEndpoint(repositoryNameOrEndpoint) &&\n\t\t\tdocumentAPIEndpoint &&\n\t\t\trepositoryNameOrEndpoint !== documentAPIEndpoint\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] Multiple incompatible endpoints were provided. Create the client using a repository name to prevent this error. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io\\/(?!api\\/v2\\/?)/i.test(this.documentAPIEndpoint)\n\t\t) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"@prismicio/client only supports Prismic Rest API V2. Please provide only the repository name to the first createClient() parameter or use the getRepositoryEndpoint() helper to generate a valid Rest API V2 endpoint URL.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname) &&\n\t\t\t!/\\.cdn\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname)\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] The client was created with a non-CDN endpoint. Convert it to the CDN endpoint for better performance. For more details, see ${devMsg(\"endpoint-must-use-cdn\")}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.accessToken = accessToken\n\t\tthis.routes = routes\n\t\tthis.brokenRoute = brokenRoute\n\t\tthis.defaultParams = defaultParams\n\t\tthis.fetchOptions = fetchOptions\n\t\tthis.fetchFn = fetch\n\n\t\tthis.graphQLFetch = this.graphQLFetch.bind(this)\n\n\t\tif (ref) {\n\t\t\tthis.queryContentFromRef(ref)\n\t\t}\n\t}\n\n\t/** The Prismic repository's name. */\n\tset repositoryName(value: string) {\n\t\tthis.#repositoryName = value\n\t}\n\t/** The Prismic repository's name. */\n\tget repositoryName(): string {\n\t\tif (!this.#repositoryName) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`A repository name is required for this method but one could not be inferred from the provided API endpoint (\\`${this.documentAPIEndpoint}\\`). To fix this error, provide a repository name when creating the client. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn this.#repositoryName\n\t}\n\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tset endpoint(value: string) {\n\t\tthis.documentAPIEndpoint = value\n\t}\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tget endpoint(): string {\n\t\treturn this.documentAPIEndpoint\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}\n\t */\n\tenableAutoPreviews(): void {\n\t\tthis.#autoPreviews = true\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session using an HTTP request\n\t * object.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviewsFromReq(req)\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}\n\t */\n\tenableAutoPreviewsFromReq(request: HttpRequestLike): void {\n\t\tthis.enableAutoPreviews()\n\t\tthis.#autoPreviewsRequest = request\n\t}\n\n\t/**\n\t * Disables the client from automatically querying content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.disableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}\n\t */\n\tdisableAutoPreviews(): void {\n\t\tthis.#autoPreviews = false\n\t\tthis.#autoPreviewsRequest = undefined\n\t}\n\n\t/**\n\t * Fetches pages based on the `params` argument. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.get({ pageSize: 10 })\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}\n\t */\n\tasync get<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\tconst response = await this.#internalGet(params)\n\n\t\treturn await response.json()\n\t}\n\n\t/**\n\t * Fetches the first page returned based on the `params` argument.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getFirst()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}\n\t */\n\tasync getFirst<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\tconst actualParams = params?.page || params?.pageSize ? params : { ...params, pageSize: 1 }\n\t\tconst response = await this.#internalGet(actualParams)\n\t\tconst { results }: Query<TDocument> = await response.clone().json()\n\n\t\tif (results[0]) {\n\t\t\treturn results[0]\n\t\t}\n\n\t\tthrow new NotFoundError(\"No documents were returned\", response.url, undefined)\n\t}\n\n\t/**\n\t * Fetches all pages based on the `params` argument. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.dangerouslyGetAll()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}\n\t */\n\tasync dangerouslyGetAll<TDocument extends TDocuments>(\n\t\tparams: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams = {},\n\t): Promise<TDocument[]> {\n\t\tconst { limit = Infinity, ...actualParams } = params\n\t\tconst resolvedParams = {\n\t\t\t...actualParams,\n\t\t\tpageSize: Math.min(\n\t\t\t\tlimit,\n\t\t\t\tactualParams.pageSize || this.defaultParams?.pageSize || MAX_PAGE_SIZE,\n\t\t\t),\n\t\t}\n\n\t\tconst documents: TDocument[] = []\n\t\tlet latestResult: Query<TDocument> | undefined\n\n\t\twhile ((!latestResult || latestResult.next_page) && documents.length < limit) {\n\t\t\tconst page = latestResult ? latestResult.page + 1 : undefined\n\n\t\t\tlatestResult = await this.get<TDocument>({ ...resolvedParams, page })\n\t\t\tdocuments.push(...latestResult.results)\n\n\t\t\tif (latestResult.next_page) {\n\t\t\t\tawait new Promise((res) => setTimeout(res, GET_ALL_QUERY_DELAY))\n\t\t\t}\n\t\t}\n\n\t\treturn documents.slice(0, limit)\n\t}\n\n\t/**\n\t * Fetches a page with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByID(\"WW4bKScAAMAqmluX\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}\n\t */\n\tasync getByID<TDocument extends TDocuments>(\n\t\tid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\treturn await this.getFirst<TDocument>(appendFilters(params, filter.at(\"document.id\", id)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}\n\t */\n\tasync getByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.in(\"document.id\", ids)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. This method may make multiple network requests to fetch all\n\t * matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}\n\t */\n\tasync getAllByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.in(\"document.id\", ids)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a page with a specific UID and type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByUID(\"blog_post\", \"my-first-post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}\n\t */\n\tasync getByUID<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.at(`my.${documentType}.uid`, uid),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}\n\t */\n\tasync getByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}\n\t */\n\tasync getAllByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a specific single type page.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getSingle(\"settings\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}\n\t */\n\tasync getSingle<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}\n\t */\n\tasync getByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}\n\t */\n\tasync getAllByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}\n\t */\n\tasync getByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", [tag])))\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}\n\t */\n\tasync getAllByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", [tag])),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}\n\t */\n\tasync getByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.at(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}\n\t */\n\tasync getAllByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.at(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}\n\t */\n\tasync getBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}\n\t */\n\tasync getAllBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches metadata about the client's Prismic repository.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst repository = await client.getRepository()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}\n\t */\n\tasync getRepository(\n\t\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n\t): Promise<Repository> {\n\t\tif (this.#cachedRepository && this.#cachedRepositoryExpiration > Date.now()) {\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tconst url = new URL(this.documentAPIEndpoint)\n\n\t\tconst accessToken = params?.accessToken || this.accessToken\n\t\tif (accessToken) {\n\t\t\turl.searchParams.set(\"access_token\", accessToken)\n\t\t}\n\n\t\tconst response = await this.#request(url, params)\n\n\t\tif (response.ok) {\n\t\t\tthis.#cachedRepository = (await response.json()) as Repository\n\t\t\tthis.#cachedRepositoryExpiration = Date.now() + REPOSITORY_CACHE_TTL\n\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tif (response.status === 404) {\n\t\t\tthrow new RepositoryNotFoundError(\n\t\t\t\t`Prismic repository not found. Check that \"${this.documentAPIEndpoint}\" is pointing to the correct repository.`,\n\t\t\t\turl.toString(),\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn await this.#throwContentAPIError(response, url.toString())\n\t}\n\n\t/**\n\t * Fetches the repository's active refs.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst refs = await client.getRefs()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}\n\t */\n\tasync getRefs(params?: FetchParams): Promise<Ref[]> {\n\t\tconst repository = await this.getRepository(params)\n\n\t\treturn repository.refs\n\t}\n\n\t/**\n\t * Fetches a ref by its ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}\n\t */\n\tasync getRefByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.id === id)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches a ref by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}\n\t */\n\tasync getRefByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.label === label)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with label \"${label}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's master ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst masterRef = await client.getMasterRef()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}\n\t */\n\tasync getMasterRef(params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.isMasterRef)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(\"Master ref could not be found.\", undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's active releases.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst releases = await client.getReleases()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}\n\t */\n\tasync getReleases(params?: FetchParams): Promise<Ref[]> {\n\t\tconst refs = await this.getRefs(params)\n\n\t\treturn refs.filter((ref) => !ref.isMasterRef)\n\t}\n\n\t/**\n\t * Fetches a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}\n\t */\n\tasync getReleaseByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.id === id)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(`Release with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches a release by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}\n\t */\n\tasync getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.label === label)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`Release with label \"${label}\" could not be found.`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches the repository's page tags.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst tags = await client.getTags()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}\n\t */\n\tasync getTags(params?: FetchParams): Promise<string[]> {\n\t\tconst repository = await this.getRepository(params)\n\t\tconst form = repository.forms.tags\n\t\tif (form) {\n\t\t\tconst url = new URL(form.action)\n\t\t\tif (this.accessToken) {\n\t\t\t\turl.searchParams.set(\"access_token\", this.accessToken)\n\t\t\t}\n\n\t\t\tconst response = await this.#request(url, params)\n\t\t\tif (response.ok) {\n\t\t\t\treturn (await response.json()) as string[]\n\t\t\t}\n\t\t}\n\n\t\treturn repository.tags\n\t}\n\n\t/**\n\t * Builds a Content API query URL with a set of parameters.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.buildQueryURL({\n\t * \t\tfilters: [filter.at(\"document.type\", \"blog_post\")],\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}\n\t */\n\tasync buildQueryURL({\n\t\tsignal,\n\t\tfetchOptions,\n\t\t...params\n\t}: Partial<BuildQueryURLArgs> & FetchParams = {}): Promise<string> {\n\t\tconst ref =\n\t\t\tparams.ref ||\n\t\t\t(await this.#getResolvedRef({\n\t\t\t\taccessToken: params.accessToken,\n\t\t\t\tsignal,\n\t\t\t\tfetchOptions,\n\t\t\t}))\n\t\tconst integrationFieldsRef =\n\t\t\tparams.integrationFieldsRef ||\n\t\t\t(\n\t\t\t\tawait this.getRepository({\n\t\t\t\t\taccessToken: params.accessToken,\n\t\t\t\t\tsignal,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t})\n\t\t\t).integrationFieldsRef ||\n\t\t\tundefined\n\n\t\treturn buildQueryURL(this.documentAPIEndpoint, {\n\t\t\t...this.defaultParams,\n\t\t\t...params,\n\t\t\tref,\n\t\t\tintegrationFieldsRef,\n\t\t\troutes: params.routes || this.routes,\n\t\t\tbrokenRoute: params.brokenRoute || this.brokenRoute,\n\t\t\taccessToken: params.accessToken || this.accessToken,\n\t\t})\n\t}\n\n\t/**\n\t * Fetches a previewed page's URL using a preview token and page ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.resolvePreviewURL({\n\t * \t\tlinkResolver,\n\t * \t\tdefaultURL: \"/\",\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}\n\t */\n\tasync resolvePreviewURL<LinkResolverReturnType>(\n\t\targs: {\n\t\t\t/** A function converts a document to a URL in your website. */\n\t\t\tlinkResolver?: LinkResolverFunction<LinkResolverReturnType>\n\t\t\t/** A fallback URL used when the document does not have a URL. */\n\t\t\tdefaultURL: string\n\t\t\t/** The preview token for the preview session. */\n\t\t\tpreviewToken?: string\n\t\t\t/** The previewed document's ID. */\n\t\t\tdocumentID?: string\n\t\t} & FetchParams,\n\t): Promise<string> {\n\t\tlet documentID: string | undefined | null = args.documentID\n\t\tlet previewToken: string | undefined | null = args.previewToken\n\n\t\tif (typeof globalThis.location !== \"undefined\") {\n\t\t\tconst searchParams = new URLSearchParams(globalThis.location.search)\n\n\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t} else if (this.#autoPreviewsRequest) {\n\t\t\tif (\"query\" in this.#autoPreviewsRequest) {\n\t\t\t\tdocumentID = documentID || (this.#autoPreviewsRequest.query?.documentId as string)\n\t\t\t\tpreviewToken = previewToken || (this.#autoPreviewsRequest.query?.token as string)\n\t\t\t} else if (\"url\" in this.#autoPreviewsRequest && this.#autoPreviewsRequest.url) {\n\t\t\t\t// Including \"missing-host://\" by default\n\t\t\t\t// handles a case where Next.js Route Handlers\n\t\t\t\t// only provide the pathname and search\n\t\t\t\t// parameters in the `url` property\n\t\t\t\t// (e.g. `/api/preview?foo=bar`).\n\t\t\t\tconst searchParams = new URL(this.#autoPreviewsRequest.url, \"missing-host://\").searchParams\n\n\t\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t\t}\n\t\t}\n\n\t\tif (documentID != null && previewToken != null) {\n\t\t\tconst document = await this.getByID(documentID, {\n\t\t\t\tref: previewToken,\n\t\t\t\tlang: \"*\",\n\t\t\t\tsignal: args.signal,\n\t\t\t\tfetchOptions: args.fetchOptions,\n\t\t\t})\n\n\t\t\tconst url = asLink(document, { linkResolver: args.linkResolver })\n\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\treturn url\n\t\t\t}\n\t\t}\n\n\t\treturn args.defaultURL\n\t}\n\n\t/**\n\t * Configures the client to query the latest published content. This is the client's default mode.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryLatestContent()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}\n\t */\n\tqueryLatestContent(): void {\n\t\tthis.#getRef = undefined\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}\n\t */\n\tqueryContentFromReleaseByID(id: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByID(id, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific label.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}\n\t */\n\tqueryContentFromReleaseByLabel(label: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByLabel(label, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a specific ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromRef(\"my-ref\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}\n\t */\n\tqueryContentFromRef(ref: string | GetRef): void {\n\t\tthis.#getRef = typeof ref === \"string\" ? () => ref : ref\n\t}\n\n\t/**\n\t * A preconfigured `fetch()` function for Prismic's GraphQL API that can be provided to GraphQL\n\t * clients.\n\t *\n\t * @example\n\t * \t```ts\n\t * \timport { createClient, getGraphQLEndpoint } from \"@prismicio/client\"\n\t *\n\t * \tconst client = createClient(\"example-prismic-repo\")\n\t * \tconst graphQLClient = new ApolloClient({\n\t * \tlink: new HttpLink({\n\t * \turi: getGraphQLEndpoint(client.repositoryName),\n\t * \t// Provide `client.graphQLFetch` as the fetch implementation.\n\t * \tfetch: client.graphQLFetch,\n\t * \t// Using GET is required.\n\t * \tuseGETForQueries: true,\n\t * \t}),\n\t * \tcache: new InMemoryCache(),\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}\n\t */\n\tasync graphQLFetch(\n\t\tinput: RequestInfo,\n\t\tinit?: Omit<RequestInit, \"signal\"> & { signal?: AbortSignalLike },\n\t): Promise<Response> {\n\t\tconst params = {\n\t\t\taccessToken: this.accessToken,\n\t\t\tfetchOptions: this.fetchOptions,\n\t\t}\n\t\tconst repository = await this.getRepository(params)\n\t\tconst ref = await this.#getResolvedRef(params)\n\n\t\tconst headers: NonNullable<RequestInitLike[\"headers\"]> = {}\n\t\theaders[\"prismic-ref\"] = ref\n\t\tif (this.accessToken) {\n\t\t\theaders[\"authorization\"] = `Token ${this.accessToken}`\n\t\t}\n\t\tif (repository.integrationFieldsRef) {\n\t\t\theaders[\"prismic-integration-field-ref\"] = repository.integrationFieldsRef\n\t\t}\n\t\tfor (const [key, value] of Object.entries(init?.headers ?? {})) {\n\t\t\theaders[key.toLowerCase()] = value\n\t\t}\n\n\t\tconst url = new URL(typeof input === \"string\" ? input : input.url)\n\t\tconst query = (url.searchParams.get(\"query\") ?? \"\").replace(\n\t\t\t// Minify the query\n\t\t\t/(\\n| )*( |{|})(\\n| )*/gm,\n\t\t\t(_chars, _spaces, brackets) => brackets,\n\t\t)\n\t\turl.searchParams.set(\"query\", query)\n\t\t// Only used to prevent caching; caches ignore header differences\n\t\turl.searchParams.set(\"ref\", ref)\n\n\t\treturn (await this.fetchFn(url.toString(), {\n\t\t\t...init,\n\t\t\theaders,\n\t\t})) as Response\n\t}\n\n\t/**\n\t * Returns the ref needed to query based on the client's current state. This method may make a\n\t * network request to fetch a ref or resolve the user's ref thunk.\n\t *\n\t * If auto previews are enabled, the preview ref takes priority.\n\t *\n\t * The following strategies are used depending on the client's state:\n\t *\n\t * - If the user called `queryLatestContent`: Use the repository's master ref. The ref is cached for\n\t * 5 seconds. After 5 seconds, a new master ref is fetched.\n\t * - If the user called `queryContentFromReleaseByID`: Use the release's ref. The ref is cached for\n\t * 5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref. The ref is cached\n\t * for 5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromRef`: Use the provided ref. Fall back to the master ref if\n\t * the ref is not a string.\n\t */\n\tasync #getResolvedRef(params?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams) {\n\t\tif (this.#autoPreviews) {\n\t\t\tconst cookies = this.#autoPreviewsRequest?.headers\n\t\t\t\t? \"get\" in this.#autoPreviewsRequest.headers\n\t\t\t\t\t? this.#autoPreviewsRequest.headers.get(\"cookie\")\n\t\t\t\t\t: this.#autoPreviewsRequest.headers.cookie\n\t\t\t\t: globalThis.document?.cookie\n\t\t\tconst previewRef = getPreviewCookie(cookies ?? \"\")\n\t\t\tif (previewRef) {\n\t\t\t\treturn previewRef\n\t\t\t}\n\t\t}\n\n\t\tconst ref = await this.#getRef?.(params)\n\t\tif (ref) {\n\t\t\treturn ref\n\t\t}\n\n\t\tconst masterRef = await this.getMasterRef(params)\n\t\treturn masterRef.ref\n\t}\n\n\t/**\n\t * Performs a low-level Content API request with the given parameters. Automatically retries if an\n\t * invalid ref is used.\n\t */\n\tasync #internalGet(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t\tattempt = 1,\n\t): Promise<ResponseLike> {\n\t\tconst url = await this.buildQueryURL(params)\n\t\tconst response = await this.#request(new URL(url), params)\n\n\t\tif (response.ok) {\n\t\t\treturn response\n\t\t}\n\n\t\ttry {\n\t\t\treturn await this.#throwContentAPIError(response, url)\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\t(error instanceof RefNotFoundError || error instanceof RefExpiredError) &&\n\t\t\t\tattempt < MAX_INVALID_REF_RETRY_ATTEMPTS\n\t\t\t) {\n\t\t\t\t// If no explicit ref is given (i.e. the master ref from\n\t\t\t\t// /api/v2 is used), clear the cached repository value.\n\t\t\t\t// Clearing the cached value prevents other methods from\n\t\t\t\t// using a known-stale ref.\n\t\t\t\tif (!params?.ref) {\n\t\t\t\t\tthis.#cachedRepository = undefined\n\t\t\t\t}\n\n\t\t\t\tconst masterRef = error.message.match(/master ref is: (?<ref>.*)$/i)?.groups?.ref\n\t\t\t\tif (!masterRef) {\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tconst badRef = new URL(url).searchParams.get(\"ref\")\n\t\t\t\tconst issue = error instanceof RefNotFoundError ? \"invalid\" : \"expired\"\n\t\t\t\tthrottledWarn(\n\t\t\t\t\t`[@prismicio/client] The ref (${badRef}) was ${issue}. Now retrying with the latest master ref (${masterRef}). If you were previewing content, the response will not include draft content.`,\n\t\t\t\t)\n\n\t\t\t\treturn await this.#internalGet({ ...params, ref: masterRef }, attempt + 1)\n\t\t\t}\n\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/** Throws an error based on a Content API response. Only call in known-errored states. */\n\tasync #throwContentAPIError(response: ResponseLike, url: string): Promise<never> {\n\t\tswitch (response.status) {\n\t\t\tcase 400: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ParsingError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 401: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ForbiddenError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 404: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase \"api_notfound_error\": {\n\t\t\t\t\t\tthrow new RefNotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t\tcase \"api_security_error\": {\n\t\t\t\t\t\tif (/preview token.*expired/i.test(json.message)) {\n\t\t\t\t\t\t\tthrow new PreviewTokenExpiredError(json.message, url, json)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tthrow new NotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase 410: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new RefExpiredError(json.message, url, json)\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new PrismicError(undefined, url, await response.text())\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Performs a low-level network request with the client's fetch options. */\n\tasync #request(url: URL, params?: FetchParams): Promise<ResponseLike> {\n\t\treturn await request(\n\t\t\turl,\n\t\t\t{\n\t\t\t\t...this.fetchOptions,\n\t\t\t\t...params?.fetchOptions,\n\t\t\t\theaders: {\n\t\t\t\t\t...this.fetchOptions?.headers,\n\t\t\t\t\t...params?.fetchOptions?.headers,\n\t\t\t\t},\n\t\t\t\tsignal: params?.fetchOptions?.signal || params?.signal || this.fetchOptions?.signal,\n\t\t\t},\n\t\t\tthis.fetchFn,\n\t\t)\n\t}\n}\n\n/** Appends filters to a params object. */\nfunction appendFilters<T extends Pick<BuildQueryURLArgs, \"filters\">>(\n\tparams = {} as T,\n\t...filters: string[]\n): T & { filters: string[] } {\n\treturn { ...params, filters: [...(params.filters ?? []), ...filters] }\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,iCAAiC;;;;;;;AAmIvC,IAAa,SAAb,MAA0E;;;;;;CAMzE;;;;;;CAMA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;CAEA;CAEA;CACA,gBAAgB;CACh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AI,cAAc,KAAK,SAAS,KAAK,KAAK;;;GAInD,KAAK,KAAK;IACT,MAAM,OAAO,MAAM,SAAS,OAAO,CAAC,MAAM;AAC1C,UAAM,IAAI,gBAAgB,KAAK,SAAS,KAAK,KAAK;;GAEnD,QACC,OAAM,IAAI,aAAa,KAAA,GAAW,KAAK,MAAM,SAAS,MAAM,CAAC;;;;CAMhE,OAAA,QAAe,KAAU,QAA6C;AACrE,SAAO,MAAM,QACZ,KACA;GACC,GAAG,KAAK;GACR,GAAG,QAAQ;GACX,SAAS;IACR,GAAG,KAAK,cAAc;IACtB,GAAG,QAAQ,cAAc;IACzB;GACD,QAAQ,QAAQ,cAAc,UAAU,QAAQ,UAAU,KAAK,cAAc;GAC7E,EACD,KAAK,QACL;;;;AAKH,SAAS,cACR,SAAS,EAAE,EACX,GAAG,SACyB;AAC5B,QAAO;EAAE,GAAG;EAAQ,SAAS,CAAC,GAAI,OAAO,WAAW,EAAE,EAAG,GAAG,QAAQ;EAAE"}
|
|
1
|
+
{"version":3,"file":"Client.js","names":[],"sources":["../src/Client.ts"],"sourcesContent":["import { type BuildQueryURLArgs, buildQueryURL } from \"./buildQueryURL\"\nimport {\n\tForbiddenError,\n\tNotFoundError,\n\tParsingError,\n\tPreviewTokenExpiredError,\n\tPrismicError,\n\tRefExpiredError,\n\tRefNotFoundError,\n\tRepositoryNotFoundError,\n} from \"./errors\"\nimport { filter } from \"./filter\"\nimport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\"\nimport { getRepositoryName } from \"./getRepositoryName\"\nimport { type LinkResolverFunction, asLink } from \"./helpers/asLink\"\nimport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\"\nimport { devMsg } from \"./lib/devMsg\"\nimport { getPreviewCookie } from \"./lib/getPreviewCookie\"\nimport type { ResponseLike } from \"./lib/request\"\nimport { type AbortSignalLike, type FetchLike, type RequestInitLike, request } from \"./lib/request\"\nimport { throttledWarn } from \"./lib/throttledWarn\"\nimport type { Query } from \"./types/api/query\"\nimport type { Ref } from \"./types/api/ref\"\nimport type { Repository } from \"./types/api/repository\"\nimport type { PrismicDocument } from \"./types/value/document\"\n\nconst MAX_PAGE_SIZE = 100\nconst REPOSITORY_CACHE_TTL = 5000\nconst GET_ALL_QUERY_DELAY = 500\nconst MAX_INVALID_REF_RETRY_ATTEMPTS = 3\n\n/** Extracts a document type with a matching `type` property from a union of document types. */\ntype ExtractDocumentType<\n\tTDocuments extends PrismicDocument,\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * The minimum required properties to treat as an HTTP Request for automatic Prismic preview\n * support.\n */\nexport type HttpRequestLike =\n\t| // Web API Request\n\t {\n\t\t\theaders?: {\n\t\t\t\tget(name: string): string | null\n\t\t\t}\n\t\t\turl?: string\n\t }\n\t// Express-style request\n\t| {\n\t\t\theaders?: {\n\t\t\t\tcookie?: string\n\t\t\t}\n\t\t\tquery?: Record<string, unknown>\n\t }\n\n/**\n * A function that returns a ref string. Used to configure which ref the client queries content\n * from.\n */\ntype GetRef = (\n\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n) => string | undefined | Promise<string | undefined>\n\n/** Parameters for client methods that use `fetch()`. */\nexport type FetchParams = {\n\t/**\n\t * Options provided to the client's `fetch()` on all network requests. These options will be\n\t * merged with internally required options. They can also be overriden on a per-query basis using\n\t * the query's `fetchOptions` parameter.\n\t */\n\tfetchOptions?: RequestInitLike\n\t/** @deprecated Move to `fetchOptions.signal`: */\n\t// TODO: Remove in v8.\n\tsignal?: AbortSignalLike\n}\n\n/** Prismic client configuration. */\nexport type ClientConfig = {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint?: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * The version of the repository's content. It can optionally be a function that returns a ref.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tref?: string | GetRef\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<\n\t\tBuildQueryURLArgs,\n\t\t\"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\" | \"brokenRoute\"\n\t>\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetch?: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions?: RequestInitLike\n}\n\n/**\n * Parameters specific to client methods that fetch all documents. These methods start with `getAll`\n * (e.g. `getAllByType`).\n */\ntype GetAllParams = {\n\t/**\n\t * Limit the number of documents queried.\n\t *\n\t * @default No limit.\n\t */\n\tlimit?: number\n}\n\n/**\n * A client for fetching content from a Prismic repository.\n *\n * @see {@link https://prismic.io/docs/fetch-content}\n * @see {@link https://prismic.io/docs/technical-reference/prismicio-client}\n */\nexport class Client<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * The client's Content API endpoint.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdocumentAPIEndpoint: string\n\t/**\n\t * The secure token used for the Content API.\n\t *\n\t * @see {@link https://prismic.io/docs/fetch-content#content-visibility}\n\t */\n\taccessToken?: string\n\t/**\n\t * A list of route resolver objects that define how a document's `url` property is resolved.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\troutes?: NonNullable<BuildQueryURLArgs[\"routes\"]>\n\t/**\n\t * The URL used for link or content relationship fields that point to an archived or deleted page.\n\t *\n\t * @see {@link https://prismic.io/docs/routes}\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tbrokenRoute?: NonNullable<BuildQueryURLArgs[\"brokenRoute\"]>\n\t/**\n\t * Default parameters sent with each Content API request. These parameters can be overridden on\n\t * each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tdefaultParams?: Omit<BuildQueryURLArgs, \"ref\" | \"integrationFieldsRef\" | \"accessToken\" | \"routes\">\n\t/**\n\t * The `fetch` function used to make network requests.\n\t *\n\t * @default The global `fetch` function.\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchFn: FetchLike\n\t/**\n\t * The default `fetch` options sent with each Content API request. These parameters can be\n\t * overriden on each method.\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}\n\t */\n\tfetchOptions: RequestInitLike\n\n\t#repositoryName: string | undefined\n\n\t#getRef?: GetRef\n\t#autoPreviews = true\n\t#autoPreviewsRequest?: HttpRequestLike\n\n\t#cachedRepository: Repository | undefined\n\t#cachedRepositoryExpiration = 0 // Timestamp\n\n\t/**\n\t * @param repositoryNameOrEndpoint - The Prismic repository name or full Content API endpoint for\n\t * the repository.\n\t * @param config - Client configuration.\n\t */\n\tconstructor(repositoryNameOrEndpoint: string, config: ClientConfig = {}) {\n\t\tconst {\n\t\t\tdocumentAPIEndpoint,\n\t\t\taccessToken,\n\t\t\tref,\n\t\t\troutes,\n\t\t\tbrokenRoute,\n\t\t\tdefaultParams,\n\t\t\tfetchOptions = {},\n\t\t\tfetch = globalThis.fetch?.bind(globalThis),\n\t\t} = config\n\n\t\tif (isRepositoryEndpoint(repositoryNameOrEndpoint)) {\n\t\t\ttry {\n\t\t\t\tthis.repositoryName = getRepositoryName(repositoryNameOrEndpoint)\n\t\t\t} catch {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[@prismicio/client] A repository name could not be inferred from the provided endpoint (\\`${repositoryNameOrEndpoint}\\`). Some methods will be disabled. Create the client using a repository name to prevent this warning. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\tthis.documentAPIEndpoint = documentAPIEndpoint || repositoryNameOrEndpoint\n\t\t} else {\n\t\t\tthis.repositoryName = repositoryNameOrEndpoint\n\t\t\tthis.documentAPIEndpoint =\n\t\t\t\tdocumentAPIEndpoint || getRepositoryEndpoint(repositoryNameOrEndpoint)\n\t\t}\n\n\t\tif (!fetch) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"A valid fetch implementation was not provided. In environments where fetch is not available, a fetch implementation must be provided via a polyfill or the `fetch` option.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (typeof fetch !== \"function\") {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`fetch must be a function, but received: ${typeof fetch}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\tif (!isRepositoryEndpoint(this.documentAPIEndpoint)) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`documentAPIEndpoint is not a valid URL: ${documentAPIEndpoint}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tisRepositoryEndpoint(repositoryNameOrEndpoint) &&\n\t\t\tdocumentAPIEndpoint &&\n\t\t\trepositoryNameOrEndpoint !== documentAPIEndpoint\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] Multiple incompatible endpoints were provided. Create the client using a repository name to prevent this error. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io\\/(?!api\\/v2\\/?)/i.test(this.documentAPIEndpoint)\n\t\t) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t\"@prismicio/client only supports Prismic Rest API V2. Please provide only the repository name to the first createClient() parameter or use the getRepositoryEndpoint() helper to generate a valid Rest API V2 endpoint URL.\",\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\t\tif (\n\t\t\tprocess.env.NODE_ENV === \"development\" &&\n\t\t\t/\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname) &&\n\t\t\t!/\\.cdn\\.prismic\\.io$/i.test(new URL(this.documentAPIEndpoint).hostname)\n\t\t) {\n\t\t\tconsole.warn(\n\t\t\t\t`[@prismicio/client] The client was created with a non-CDN endpoint. Convert it to the CDN endpoint for better performance. For more details, see ${devMsg(\"endpoint-must-use-cdn\")}`,\n\t\t\t)\n\t\t}\n\n\t\tthis.accessToken = accessToken\n\t\tthis.routes = routes\n\t\tthis.brokenRoute = brokenRoute\n\t\tthis.defaultParams = defaultParams\n\t\tthis.fetchOptions = fetchOptions\n\t\tthis.fetchFn = fetch\n\n\t\tthis.graphQLFetch = this.graphQLFetch.bind(this)\n\n\t\tif (ref) {\n\t\t\tthis.queryContentFromRef(ref)\n\t\t}\n\t}\n\n\t/** The Prismic repository's name. */\n\tset repositoryName(value: string) {\n\t\tthis.#repositoryName = value\n\t}\n\t/** The Prismic repository's name. */\n\tget repositoryName(): string {\n\t\tif (!this.#repositoryName) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`A repository name is required for this method but one could not be inferred from the provided API endpoint (\\`${this.documentAPIEndpoint}\\`). To fix this error, provide a repository name when creating the client. For more details, see ${devMsg(\"prefer-repository-name\")}`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn this.#repositoryName\n\t}\n\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tset endpoint(value: string) {\n\t\tthis.documentAPIEndpoint = value\n\t}\n\t/** @deprecated Replace with `documentAPIEndpoint`. */\n\t// TODO: Remove in v8.\n\tget endpoint(): string {\n\t\treturn this.documentAPIEndpoint\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}\n\t */\n\tenableAutoPreviews(): void {\n\t\tthis.#autoPreviews = true\n\t}\n\n\t/**\n\t * Enables the client to automatically query content from a preview session using an HTTP request\n\t * object.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.enableAutoPreviewsFromReq(req)\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}\n\t */\n\tenableAutoPreviewsFromReq(request: HttpRequestLike): void {\n\t\tthis.enableAutoPreviews()\n\t\tthis.#autoPreviewsRequest = request\n\t}\n\n\t/**\n\t * Disables the client from automatically querying content from a preview session.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.disableAutoPreviews()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}\n\t */\n\tdisableAutoPreviews(): void {\n\t\tthis.#autoPreviews = false\n\t\tthis.#autoPreviewsRequest = undefined\n\t}\n\n\t/**\n\t * Fetches pages based on the `params` argument. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.get({ pageSize: 10 })\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}\n\t */\n\tasync get<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\tconst response = await this.#internalGet(params)\n\n\t\treturn await response.json()\n\t}\n\n\t/**\n\t * Fetches the first page returned based on the `params` argument.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getFirst()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}\n\t */\n\tasync getFirst<TDocument extends TDocuments>(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\tconst actualParams = params?.page || params?.pageSize ? params : { ...params, pageSize: 1 }\n\t\tconst response = await this.#internalGet(actualParams)\n\t\tconst { results }: Query<TDocument> = await response.clone().json()\n\n\t\tif (results[0]) {\n\t\t\treturn results[0]\n\t\t}\n\n\t\tthrow new NotFoundError(\"No documents were returned\", response.url, undefined)\n\t}\n\n\t/**\n\t * Fetches all pages based on the `params` argument. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.dangerouslyGetAll()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}\n\t */\n\tasync dangerouslyGetAll<TDocument extends TDocuments>(\n\t\tparams: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams = {},\n\t): Promise<TDocument[]> {\n\t\tconst { limit = Infinity, ...actualParams } = params\n\t\tconst resolvedParams = {\n\t\t\t...actualParams,\n\t\t\tpageSize: Math.min(\n\t\t\t\tlimit,\n\t\t\t\tactualParams.pageSize || this.defaultParams?.pageSize || MAX_PAGE_SIZE,\n\t\t\t),\n\t\t}\n\n\t\tconst documents: TDocument[] = []\n\t\tlet latestResult: Query<TDocument> | undefined\n\n\t\twhile ((!latestResult || latestResult.next_page) && documents.length < limit) {\n\t\t\tconst page = latestResult ? latestResult.page + 1 : undefined\n\n\t\t\tconst response = await this.#internalGet({ ...resolvedParams, page })\n\t\t\tlatestResult = (await response.json()) as Query<TDocument>\n\t\t\tdocuments.push(...latestResult.results)\n\n\t\t\tif (latestResult.next_page && !response.headers.get(\"x-cache\")?.startsWith(\"Hit\")) {\n\t\t\t\tawait new Promise((res) => setTimeout(res, GET_ALL_QUERY_DELAY))\n\t\t\t}\n\t\t}\n\n\t\treturn documents.slice(0, limit)\n\t}\n\n\t/**\n\t * Fetches a page with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByID(\"WW4bKScAAMAqmluX\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}\n\t */\n\tasync getByID<TDocument extends TDocuments>(\n\t\tid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<TDocument> {\n\t\treturn await this.getFirst<TDocument>(appendFilters(params, filter.at(\"document.id\", id)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}\n\t */\n\tasync getByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.in(\"document.id\", ids)))\n\t}\n\n\t/**\n\t * Fetches pages with specific IDs. This method may make multiple network requests to fetch all\n\t * matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByIDs([\"WW4bKScAAMAqmluX\", \"U1kTRgEAAC8A5ldS\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}\n\t */\n\tasync getAllByIDs<TDocument extends TDocuments>(\n\t\tids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.in(\"document.id\", ids)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a page with a specific UID and type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getByUID(\"blog_post\", \"my-first-post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}\n\t */\n\tasync getByUID<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuid: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.at(`my.${documentType}.uid`, uid),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}\n\t */\n\tasync getByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with specific UIDs and a specific type. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByUIDs(\"blog_post\", [\"my-first-post\", \"my-second-post\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}\n\t */\n\tasync getAllByUIDs<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tuids: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(\n\t\t\t\tparams,\n\t\t\t\tfilter.at(\"document.type\", documentType),\n\t\t\t\tfilter.in(`my.${documentType}.uid`, uids),\n\t\t\t),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches a specific single type page.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst page = await client.getSingle(\"settings\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}\n\t */\n\tasync getSingle<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>> {\n\t\treturn await this.getFirst<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}\n\t */\n\tasync getByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>> {\n\t\treturn await this.get<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific type. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByType(\"blog_post\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}\n\t */\n\tasync getAllByType<\n\t\tTDocument extends TDocuments,\n\t\tTDocumentType extends TDocument[\"type\"] = TDocument[\"type\"],\n\t>(\n\t\tdocumentType: TDocumentType,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<ExtractDocumentType<TDocument, TDocumentType>[]> {\n\t\treturn await this.dangerouslyGetAll<ExtractDocumentType<TDocument, TDocumentType>>(\n\t\t\tappendFilters(params, filter.at(\"document.type\", documentType)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}\n\t */\n\tasync getByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", [tag])))\n\t}\n\n\t/**\n\t * Fetches pages with a specific tag. This method may make multiple network requests to fetch all\n\t * matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByTag(\"featured\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}\n\t */\n\tasync getAllByTag<TDocument extends TDocuments>(\n\t\ttag: string,\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", [tag])),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}\n\t */\n\tasync getByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.at(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with every tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching pages.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllByEveryTag([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}\n\t */\n\tasync getAllByEveryTag<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.at(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. Results are paginated.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst response = await client.getBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}\n\t */\n\tasync getBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t): Promise<Query<TDocument>> {\n\t\treturn await this.get<TDocument>(appendFilters(params, filter.any(\"document.tags\", tags)))\n\t}\n\n\t/**\n\t * Fetches pages with at least one tag from a list of tags. This method may make multiple network\n\t * requests to fetch all matching documents.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst pages = await client.getAllBySomeTags([\"featured\", \"homepage\"])\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}\n\t */\n\tasync getAllBySomeTags<TDocument extends TDocuments>(\n\t\ttags: string[],\n\t\tparams?: Partial<Omit<BuildQueryURLArgs, \"page\">> & GetAllParams & FetchParams,\n\t): Promise<TDocument[]> {\n\t\treturn await this.dangerouslyGetAll<TDocument>(\n\t\t\tappendFilters(params, filter.any(\"document.tags\", tags)),\n\t\t)\n\t}\n\n\t/**\n\t * Fetches metadata about the client's Prismic repository.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst repository = await client.getRepository()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}\n\t */\n\tasync getRepository(\n\t\tparams?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams,\n\t): Promise<Repository> {\n\t\tif (this.#cachedRepository && this.#cachedRepositoryExpiration > Date.now()) {\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tconst url = new URL(this.documentAPIEndpoint)\n\n\t\tconst accessToken = params?.accessToken || this.accessToken\n\t\tif (accessToken) {\n\t\t\turl.searchParams.set(\"access_token\", accessToken)\n\t\t}\n\n\t\tconst response = await this.#request(url, params)\n\n\t\tif (response.ok) {\n\t\t\tthis.#cachedRepository = (await response.json()) as Repository\n\t\t\tthis.#cachedRepositoryExpiration = Date.now() + REPOSITORY_CACHE_TTL\n\n\t\t\treturn this.#cachedRepository\n\t\t}\n\n\t\tif (response.status === 404) {\n\t\t\tthrow new RepositoryNotFoundError(\n\t\t\t\t`Prismic repository not found. Check that \"${this.documentAPIEndpoint}\" is pointing to the correct repository.`,\n\t\t\t\turl.toString(),\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn await this.#throwContentAPIError(response, url.toString())\n\t}\n\n\t/**\n\t * Fetches the repository's active refs.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst refs = await client.getRefs()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}\n\t */\n\tasync getRefs(params?: FetchParams): Promise<Ref[]> {\n\t\tconst repository = await this.getRepository(params)\n\n\t\treturn repository.refs\n\t}\n\n\t/**\n\t * Fetches a ref by its ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}\n\t */\n\tasync getRefByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.id === id)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches a ref by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst ref = await client.getRefByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}\n\t */\n\tasync getRefByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.label === label)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(`Ref with label \"${label}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's master ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst masterRef = await client.getMasterRef()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}\n\t */\n\tasync getMasterRef(params?: FetchParams): Promise<Ref> {\n\t\tconst refs = await this.getRefs(params)\n\t\tconst ref = refs.find((ref) => ref.isMasterRef)\n\n\t\tif (!ref) {\n\t\t\tthrow new PrismicError(\"Master ref could not be found.\", undefined, undefined)\n\t\t}\n\n\t\treturn ref\n\t}\n\n\t/**\n\t * Fetches the repository's active releases.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst releases = await client.getReleases()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}\n\t */\n\tasync getReleases(params?: FetchParams): Promise<Ref[]> {\n\t\tconst refs = await this.getRefs(params)\n\n\t\treturn refs.filter((ref) => !ref.isMasterRef)\n\t}\n\n\t/**\n\t * Fetches a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}\n\t */\n\tasync getReleaseByID(id: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.id === id)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(`Release with ID \"${id}\" could not be found.`, undefined, undefined)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches a release by its label. A release ref's label is its name shown in the Page Builder.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst release = await client.getReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}\n\t */\n\tasync getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref> {\n\t\tconst releases = await this.getReleases(params)\n\t\tconst release = releases.find((ref) => ref.label === label)\n\n\t\tif (!release) {\n\t\t\tthrow new PrismicError(\n\t\t\t\t`Release with label \"${label}\" could not be found.`,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t)\n\t\t}\n\n\t\treturn release\n\t}\n\n\t/**\n\t * Fetches the repository's page tags.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst tags = await client.getTags()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}\n\t */\n\tasync getTags(params?: FetchParams): Promise<string[]> {\n\t\tconst repository = await this.getRepository(params)\n\t\tconst form = repository.forms.tags\n\t\tif (form) {\n\t\t\tconst url = new URL(form.action)\n\t\t\tif (this.accessToken) {\n\t\t\t\turl.searchParams.set(\"access_token\", this.accessToken)\n\t\t\t}\n\n\t\t\tconst response = await this.#request(url, params)\n\t\t\tif (response.ok) {\n\t\t\t\treturn (await response.json()) as string[]\n\t\t\t}\n\t\t}\n\n\t\treturn repository.tags\n\t}\n\n\t/**\n\t * Builds a Content API query URL with a set of parameters.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.buildQueryURL({\n\t * \t\tfilters: [filter.at(\"document.type\", \"blog_post\")],\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}\n\t */\n\tasync buildQueryURL({\n\t\tsignal,\n\t\tfetchOptions,\n\t\t...params\n\t}: Partial<BuildQueryURLArgs> & FetchParams = {}): Promise<string> {\n\t\tconst ref =\n\t\t\tparams.ref ||\n\t\t\t(await this.#getResolvedRef({\n\t\t\t\taccessToken: params.accessToken,\n\t\t\t\tsignal,\n\t\t\t\tfetchOptions,\n\t\t\t}))\n\t\tconst integrationFieldsRef =\n\t\t\tparams.integrationFieldsRef ||\n\t\t\t(\n\t\t\t\tawait this.getRepository({\n\t\t\t\t\taccessToken: params.accessToken,\n\t\t\t\t\tsignal,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t})\n\t\t\t).integrationFieldsRef ||\n\t\t\tundefined\n\n\t\treturn buildQueryURL(this.documentAPIEndpoint, {\n\t\t\t...this.defaultParams,\n\t\t\t...params,\n\t\t\tref,\n\t\t\tintegrationFieldsRef,\n\t\t\troutes: params.routes || this.routes,\n\t\t\tbrokenRoute: params.brokenRoute || this.brokenRoute,\n\t\t\taccessToken: params.accessToken || this.accessToken,\n\t\t})\n\t}\n\n\t/**\n\t * Fetches a previewed page's URL using a preview token and page ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst url = await client.resolvePreviewURL({\n\t * \t\tlinkResolver,\n\t * \t\tdefaultURL: \"/\",\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}\n\t */\n\tasync resolvePreviewURL<LinkResolverReturnType>(\n\t\targs: {\n\t\t\t/** A function converts a document to a URL in your website. */\n\t\t\tlinkResolver?: LinkResolverFunction<LinkResolverReturnType>\n\t\t\t/** A fallback URL used when the document does not have a URL. */\n\t\t\tdefaultURL: string\n\t\t\t/** The preview token for the preview session. */\n\t\t\tpreviewToken?: string\n\t\t\t/** The previewed document's ID. */\n\t\t\tdocumentID?: string\n\t\t} & FetchParams,\n\t): Promise<string> {\n\t\tlet documentID: string | undefined | null = args.documentID\n\t\tlet previewToken: string | undefined | null = args.previewToken\n\n\t\tif (typeof globalThis.location !== \"undefined\") {\n\t\t\tconst searchParams = new URLSearchParams(globalThis.location.search)\n\n\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t} else if (this.#autoPreviewsRequest) {\n\t\t\tif (\"query\" in this.#autoPreviewsRequest) {\n\t\t\t\tdocumentID = documentID || (this.#autoPreviewsRequest.query?.documentId as string)\n\t\t\t\tpreviewToken = previewToken || (this.#autoPreviewsRequest.query?.token as string)\n\t\t\t} else if (\"url\" in this.#autoPreviewsRequest && this.#autoPreviewsRequest.url) {\n\t\t\t\t// Including \"missing-host://\" by default\n\t\t\t\t// handles a case where Next.js Route Handlers\n\t\t\t\t// only provide the pathname and search\n\t\t\t\t// parameters in the `url` property\n\t\t\t\t// (e.g. `/api/preview?foo=bar`).\n\t\t\t\tconst searchParams = new URL(this.#autoPreviewsRequest.url, \"missing-host://\").searchParams\n\n\t\t\t\tdocumentID = documentID || searchParams.get(\"documentId\")\n\t\t\t\tpreviewToken = previewToken || searchParams.get(\"token\")\n\t\t\t}\n\t\t}\n\n\t\tif (documentID != null && previewToken != null) {\n\t\t\tconst document = await this.getByID(documentID, {\n\t\t\t\tref: previewToken,\n\t\t\t\tlang: \"*\",\n\t\t\t\tsignal: args.signal,\n\t\t\t\tfetchOptions: args.fetchOptions,\n\t\t\t})\n\n\t\t\tconst url = asLink(document, { linkResolver: args.linkResolver })\n\n\t\t\tif (typeof url === \"string\") {\n\t\t\t\treturn url\n\t\t\t}\n\t\t}\n\n\t\treturn args.defaultURL\n\t}\n\n\t/**\n\t * Configures the client to query the latest published content. This is the client's default mode.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryLatestContent()\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}\n\t */\n\tqueryLatestContent(): void {\n\t\tthis.#getRef = undefined\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByID(\"YhE3YhEAACIA4321\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}\n\t */\n\tqueryContentFromReleaseByID(id: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByID(id, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a release with a specific label.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromReleaseByLabel(\"My Release\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}\n\t */\n\tqueryContentFromReleaseByLabel(label: string): void {\n\t\tthis.#getRef = async (params) => {\n\t\t\tconst release = await this.getReleaseByLabel(label, params)\n\t\t\treturn release.ref\n\t\t}\n\t}\n\n\t/**\n\t * Configures the client to query content from a specific ref.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tclient.queryContentFromRef(\"my-ref\")\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}\n\t */\n\tqueryContentFromRef(ref: string | GetRef): void {\n\t\tthis.#getRef = typeof ref === \"string\" ? () => ref : ref\n\t}\n\n\t/**\n\t * A preconfigured `fetch()` function for Prismic's GraphQL API that can be provided to GraphQL\n\t * clients.\n\t *\n\t * @example\n\t * \t```ts\n\t * \timport { createClient, getGraphQLEndpoint } from \"@prismicio/client\"\n\t *\n\t * \tconst client = createClient(\"example-prismic-repo\")\n\t * \tconst graphQLClient = new ApolloClient({\n\t * \tlink: new HttpLink({\n\t * \turi: getGraphQLEndpoint(client.repositoryName),\n\t * \t// Provide `client.graphQLFetch` as the fetch implementation.\n\t * \tfetch: client.graphQLFetch,\n\t * \t// Using GET is required.\n\t * \tuseGETForQueries: true,\n\t * \t}),\n\t * \tcache: new InMemoryCache(),\n\t * \t})\n\t * \t```\n\t *\n\t * @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}\n\t */\n\tasync graphQLFetch(\n\t\tinput: RequestInfo,\n\t\tinit?: Omit<RequestInit, \"signal\"> & { signal?: AbortSignalLike },\n\t): Promise<Response> {\n\t\tconst params = {\n\t\t\taccessToken: this.accessToken,\n\t\t\tfetchOptions: this.fetchOptions,\n\t\t}\n\t\tconst repository = await this.getRepository(params)\n\t\tconst ref = await this.#getResolvedRef(params)\n\n\t\tconst headers: NonNullable<RequestInitLike[\"headers\"]> = {}\n\t\theaders[\"prismic-ref\"] = ref\n\t\tif (this.accessToken) {\n\t\t\theaders[\"authorization\"] = `Token ${this.accessToken}`\n\t\t}\n\t\tif (repository.integrationFieldsRef) {\n\t\t\theaders[\"prismic-integration-field-ref\"] = repository.integrationFieldsRef\n\t\t}\n\t\tfor (const [key, value] of Object.entries(init?.headers ?? {})) {\n\t\t\theaders[key.toLowerCase()] = value\n\t\t}\n\n\t\tconst url = new URL(typeof input === \"string\" ? input : input.url)\n\t\tconst query = (url.searchParams.get(\"query\") ?? \"\").replace(\n\t\t\t// Minify the query\n\t\t\t/(\\n| )*( |{|})(\\n| )*/gm,\n\t\t\t(_chars, _spaces, brackets) => brackets,\n\t\t)\n\t\turl.searchParams.set(\"query\", query)\n\t\t// Only used to prevent caching; caches ignore header differences\n\t\turl.searchParams.set(\"ref\", ref)\n\n\t\treturn (await this.fetchFn(url.toString(), {\n\t\t\t...init,\n\t\t\theaders,\n\t\t})) as Response\n\t}\n\n\t/**\n\t * Returns the ref needed to query based on the client's current state. This method may make a\n\t * network request to fetch a ref or resolve the user's ref thunk.\n\t *\n\t * If auto previews are enabled, the preview ref takes priority.\n\t *\n\t * The following strategies are used depending on the client's state:\n\t *\n\t * - If the user called `queryLatestContent`: Use the repository's master ref. The ref is cached for\n\t * 5 seconds. After 5 seconds, a new master ref is fetched.\n\t * - If the user called `queryContentFromReleaseByID`: Use the release's ref. The ref is cached for\n\t * 5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromReleaseByLabel`: Use the release's ref. The ref is cached\n\t * for 5 seconds. After 5 seconds, a new ref for the release is fetched.\n\t * - If the user called `queryContentFromRef`: Use the provided ref. Fall back to the master ref if\n\t * the ref is not a string.\n\t */\n\tasync #getResolvedRef(params?: Pick<BuildQueryURLArgs, \"accessToken\"> & FetchParams) {\n\t\tif (this.#autoPreviews) {\n\t\t\tconst cookies = this.#autoPreviewsRequest?.headers\n\t\t\t\t? \"get\" in this.#autoPreviewsRequest.headers\n\t\t\t\t\t? this.#autoPreviewsRequest.headers.get(\"cookie\")\n\t\t\t\t\t: this.#autoPreviewsRequest.headers.cookie\n\t\t\t\t: globalThis.document?.cookie\n\t\t\tconst previewRef = getPreviewCookie(cookies ?? \"\")\n\t\t\tif (previewRef) {\n\t\t\t\treturn previewRef\n\t\t\t}\n\t\t}\n\n\t\tconst ref = await this.#getRef?.(params)\n\t\tif (ref) {\n\t\t\treturn ref\n\t\t}\n\n\t\tconst masterRef = await this.getMasterRef(params)\n\t\treturn masterRef.ref\n\t}\n\n\t/**\n\t * Performs a low-level Content API request with the given parameters. Automatically retries if an\n\t * invalid ref is used.\n\t */\n\tasync #internalGet(\n\t\tparams?: Partial<BuildQueryURLArgs> & FetchParams,\n\t\tattempt = 1,\n\t): Promise<ResponseLike> {\n\t\tconst url = await this.buildQueryURL(params)\n\t\tconst response = await this.#request(new URL(url), params)\n\n\t\tif (response.ok) {\n\t\t\treturn response\n\t\t}\n\n\t\ttry {\n\t\t\treturn await this.#throwContentAPIError(response, url)\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\t(error instanceof RefNotFoundError || error instanceof RefExpiredError) &&\n\t\t\t\tattempt < MAX_INVALID_REF_RETRY_ATTEMPTS\n\t\t\t) {\n\t\t\t\t// If no explicit ref is given (i.e. the master ref from\n\t\t\t\t// /api/v2 is used), clear the cached repository value.\n\t\t\t\t// Clearing the cached value prevents other methods from\n\t\t\t\t// using a known-stale ref.\n\t\t\t\tif (!params?.ref) {\n\t\t\t\t\tthis.#cachedRepository = undefined\n\t\t\t\t}\n\n\t\t\t\tconst masterRef = error.message.match(/master ref is: (?<ref>.*)$/i)?.groups?.ref\n\t\t\t\tif (!masterRef) {\n\t\t\t\t\tthrow error\n\t\t\t\t}\n\n\t\t\t\tconst badRef = new URL(url).searchParams.get(\"ref\")\n\t\t\t\tconst issue = error instanceof RefNotFoundError ? \"invalid\" : \"expired\"\n\t\t\t\tthrottledWarn(\n\t\t\t\t\t`[@prismicio/client] The ref (${badRef}) was ${issue}. Now retrying with the latest master ref (${masterRef}). If you were previewing content, the response will not include draft content.`,\n\t\t\t\t)\n\n\t\t\t\treturn await this.#internalGet({ ...params, ref: masterRef }, attempt + 1)\n\t\t\t}\n\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/** Throws an error based on a Content API response. Only call in known-errored states. */\n\tasync #throwContentAPIError(response: ResponseLike, url: string): Promise<never> {\n\t\tswitch (response.status) {\n\t\t\tcase 400: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ParsingError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 401: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new ForbiddenError(json.message, url, json)\n\t\t\t}\n\t\t\tcase 404: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tswitch (json.type) {\n\t\t\t\t\tcase \"api_notfound_error\": {\n\t\t\t\t\t\tthrow new RefNotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t\tcase \"api_security_error\": {\n\t\t\t\t\t\tif (/preview token.*expired/i.test(json.message)) {\n\t\t\t\t\t\t\tthrow new PreviewTokenExpiredError(json.message, url, json)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tthrow new NotFoundError(json.message, url, json)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tcase 410: {\n\t\t\t\tconst json = await response.clone().json()\n\t\t\t\tthrow new RefExpiredError(json.message, url, json)\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tthrow new PrismicError(undefined, url, await response.text())\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Performs a low-level network request with the client's fetch options. */\n\tasync #request(url: URL, params?: FetchParams): Promise<ResponseLike> {\n\t\treturn await request(\n\t\t\turl,\n\t\t\t{\n\t\t\t\t...this.fetchOptions,\n\t\t\t\t...params?.fetchOptions,\n\t\t\t\theaders: {\n\t\t\t\t\t...this.fetchOptions?.headers,\n\t\t\t\t\t...params?.fetchOptions?.headers,\n\t\t\t\t},\n\t\t\t\tsignal: params?.fetchOptions?.signal || params?.signal || this.fetchOptions?.signal,\n\t\t\t},\n\t\t\tthis.fetchFn,\n\t\t)\n\t}\n}\n\n/** Appends filters to a params object. */\nfunction appendFilters<T extends Pick<BuildQueryURLArgs, \"filters\">>(\n\tparams = {} as T,\n\t...filters: string[]\n): T & { filters: string[] } {\n\treturn { ...params, filters: [...(params.filters ?? []), ...filters] }\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,gBAAgB;AACtB,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,iCAAiC;;;;;;;AAmIvC,IAAa,SAAb,MAA0E;;;;;;CAMzE;;;;;;CAMA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;;;;;;;CAOA;CAEA;CAEA;CACA,gBAAgB;CAChB;CAEA;CACA,8BAA8B;;;;;;CAO9B,YAAY,0BAAkC,SAAuB,CAAC,GAAG;EACxE,MAAM,EACL,qBACA,aACA,KACA,QACA,aACA,eACA,eAAe,CAAC,GAChB,QAAQ,WAAW,OAAO,KAAK,UAAU,MACtC;EAEJ,IAAI,qBAAqB,wBAA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AM,OAAO,MAAM,SAAS,MAAM,CAAC,CAAC,KAAK;IACzC,MAAM,IAAI,eAAe,KAAK,SAAS,KAAK,IAAI;GACjD;GACA,KAAK,KAAK;IACT,MAAM,OAAO,MAAM,SAAS,MAAM,CAAC,CAAC,KAAK;IACzC,QAAQ,KAAK,MAAb;KACC,KAAK,sBACJ,MAAM,IAAI,iBAAiB,KAAK,SAAS,KAAK,IAAI;KAEnD,KAAK,sBACJ,IAAI,0BAA0B,KAAK,KAAK,OAAO,GAC9C,MAAM,IAAI,yBAAyB,KAAK,SAAS,KAAK,IAAI;KAG5D,SACC,MAAM,IAAI,cAAc,KAAK,SAAS,KAAK,IAAI;IAEjD;GACD;GACA,KAAK,KAAK;IACT,MAAM,OAAO,MAAM,SAAS,MAAM,CAAC,CAAC,KAAK;IACzC,MAAM,IAAI,gBAAgB,KAAK,SAAS,KAAK,IAAI;GAClD;GACA,SACC,MAAM,IAAI,aAAa,KAAA,GAAW,KAAK,MAAM,SAAS,KAAK,CAAC;EAE9D;CACD;;CAGA,MAAM,SAAS,KAAU,QAA6C;EACrE,OAAO,MAAM,QACZ,KACA;GACC,GAAG,KAAK;GACR,GAAG,QAAQ;GACX,SAAS;IACR,GAAG,KAAK,cAAc;IACtB,GAAG,QAAQ,cAAc;GAC1B;GACA,QAAQ,QAAQ,cAAc,UAAU,QAAQ,UAAU,KAAK,cAAc;EAC9E,GACA,KAAK,OACN;CACD;AACD;;AAGA,SAAS,cACR,SAAS,CAAC,GACV,GAAG,SACyB;CAC5B,OAAO;EAAE,GAAG;EAAQ,SAAS,CAAC,GAAI,OAAO,WAAW,CAAC,GAAI,GAAG,OAAO;CAAE;AACtE"}
|
package/dist/Migration.cjs
CHANGED
|
@@ -38,31 +38,32 @@ var Migration = class {
|
|
|
38
38
|
createAsset(fileOrAssetOrField, filename, { notes, credits, alt, tags } = {}) {
|
|
39
39
|
let config;
|
|
40
40
|
let maybeInitialField;
|
|
41
|
-
if (typeof fileOrAssetOrField === "object" && "url" in fileOrAssetOrField)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
if (typeof fileOrAssetOrField === "object" && "url" in fileOrAssetOrField) {
|
|
42
|
+
if ("dimensions" in fileOrAssetOrField || "link_type" in fileOrAssetOrField) {
|
|
43
|
+
const url = fileOrAssetOrField.url.split("?")[0];
|
|
44
|
+
const filename = "name" in fileOrAssetOrField ? fileOrAssetOrField.name : url.split("/").pop().split("_").pop();
|
|
45
|
+
const credits = "copyright" in fileOrAssetOrField && fileOrAssetOrField.copyright ? fileOrAssetOrField.copyright : void 0;
|
|
46
|
+
const alt = "alt" in fileOrAssetOrField && fileOrAssetOrField.alt ? fileOrAssetOrField.alt : void 0;
|
|
47
|
+
if ("dimensions" in fileOrAssetOrField) maybeInitialField = fileOrAssetOrField;
|
|
48
|
+
config = {
|
|
49
|
+
id: fileOrAssetOrField.id,
|
|
50
|
+
file: url,
|
|
51
|
+
filename,
|
|
52
|
+
notes: void 0,
|
|
53
|
+
credits,
|
|
54
|
+
alt,
|
|
55
|
+
tags: void 0
|
|
56
|
+
};
|
|
57
|
+
} else config = {
|
|
48
58
|
id: fileOrAssetOrField.id,
|
|
49
|
-
file: url,
|
|
50
|
-
filename,
|
|
51
|
-
notes:
|
|
52
|
-
credits,
|
|
53
|
-
alt,
|
|
54
|
-
tags:
|
|
59
|
+
file: fileOrAssetOrField.url,
|
|
60
|
+
filename: fileOrAssetOrField.filename,
|
|
61
|
+
notes: fileOrAssetOrField.notes,
|
|
62
|
+
credits: fileOrAssetOrField.credits,
|
|
63
|
+
alt: fileOrAssetOrField.alt,
|
|
64
|
+
tags: fileOrAssetOrField.tags?.map(({ name }) => name)
|
|
55
65
|
};
|
|
56
66
|
} else config = {
|
|
57
|
-
id: fileOrAssetOrField.id,
|
|
58
|
-
file: fileOrAssetOrField.url,
|
|
59
|
-
filename: fileOrAssetOrField.filename,
|
|
60
|
-
notes: fileOrAssetOrField.notes,
|
|
61
|
-
credits: fileOrAssetOrField.credits,
|
|
62
|
-
alt: fileOrAssetOrField.alt,
|
|
63
|
-
tags: fileOrAssetOrField.tags?.map(({ name }) => name)
|
|
64
|
-
};
|
|
65
|
-
else config = {
|
|
66
67
|
id: fileOrAssetOrField,
|
|
67
68
|
file: fileOrAssetOrField,
|
|
68
69
|
filename,
|
|
@@ -78,7 +79,7 @@ var Migration = class {
|
|
|
78
79
|
maybeAsset.config.notes = maybeAsset.config.notes || config.notes;
|
|
79
80
|
maybeAsset.config.credits = maybeAsset.config.credits || config.credits;
|
|
80
81
|
maybeAsset.config.alt = maybeAsset.config.alt || config.alt;
|
|
81
|
-
maybeAsset.config.tags = Array.from(new Set([...maybeAsset.config.tags || [], ...config.tags || []]));
|
|
82
|
+
maybeAsset.config.tags = Array.from(/* @__PURE__ */ new Set([...maybeAsset.config.tags || [], ...config.tags || []]));
|
|
82
83
|
} else this._assets.set(config.id, migrationAsset);
|
|
83
84
|
return migrationAsset;
|
|
84
85
|
}
|
package/dist/Migration.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.cjs","names":["PrismicMigrationAsset","PrismicMigrationDocument","#migratePrismicDocumentData","getOptionalLinkProperties","LinkType","RichTextNodeType"],"sources":["../src/Migration.ts"],"sourcesContent":["import { getOptionalLinkProperties } from \"./lib/getOptionalLinkProperties\"\nimport * as is from \"./lib/isValue\"\nimport { validateAssetMetadata } from \"./lib/validateAssetMetadata\"\nimport type { Asset } from \"./types/api/asset/asset\"\nimport type {\n\tMigrationAssetConfig,\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"./types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"./types/migration/ContentRelationship\"\nimport { PrismicMigrationDocument } from \"./types/migration/Document\"\nimport type { ExistingPrismicDocument, PendingPrismicDocument } from \"./types/migration/Document\"\nimport type { PrismicDocument } from \"./types/value/document\"\nimport type { FilledImageFieldImage } from \"./types/value/image\"\nimport { type FilledLinkToWebField, LinkType } from \"./types/value/link\"\nimport type { FilledLinkToMediaField } from \"./types/value/linkToMedia\"\nimport { RichTextNodeType } from \"./types/value/richText\"\n\n/**\n * Extracts one or more Prismic document types that match a given Prismic document type. If no\n * matches are found, no extraction is performed and the union of all provided Prismic document\n * types are returned.\n *\n * @typeParam TDocuments - Prismic document types from which to extract.\n * @typeParam TDocumentType - Type(s) to match `TDocuments` against.\n */\ntype ExtractDocumentType<\n\tTDocuments extends { type: string },\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * A helper that allows preparing your migration to Prismic.\n *\n * @typeParam TDocuments - Document types that are registered for the Prismic repository. Query\n * methods will automatically be typed based on this type.\n */\nexport class Migration<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * Assets registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_assets: Map<MigrationAssetConfig[\"file\"], PrismicMigrationAsset> = new Map()\n\n\t/**\n\t * Documents registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_documents: PrismicMigrationDocument<TDocuments>[] = []\n\n\t/**\n\t * Registers an asset to be created in the migration from an asset object.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param asset - An asset object from Prismic Asset API.\n\t * @returns A migration asset field instance.\n\t * @internal\n\t */\n\tcreateAsset(asset: Asset): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from an image or link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param imageOrLinkToMediaField - An image or link to media field from Prismic Document API.\n\t * @returns A migration asset field instance.\n\t * @internal\n\t */\n\tcreateAsset(\n\t\timageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField,\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param file - The URL or content of the file to be created.\n\t * @param filename - The filename of the asset.\n\t * @param params - Additional asset data.\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfile: MigrationAssetConfig[\"file\"],\n\t\tfilename: MigrationAssetConfig[\"filename\"],\n\t\tparams?: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t},\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file, an asset object, or an image or\n\t * link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfileOrAssetOrField:\n\t\t\t| MigrationAssetConfig[\"file\"]\n\t\t\t| Asset\n\t\t\t| FilledImageFieldImage\n\t\t\t| FilledLinkToMediaField,\n\t\tfilename?: MigrationAssetConfig[\"filename\"],\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\ttags,\n\t\t}: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t} = {},\n\t): PrismicMigrationAsset {\n\t\tlet config: MigrationAssetConfig\n\t\tlet maybeInitialField: FilledImageFieldImage | undefined\n\t\tif (typeof fileOrAssetOrField === \"object\" && \"url\" in fileOrAssetOrField) {\n\t\t\tif (\"dimensions\" in fileOrAssetOrField || \"link_type\" in fileOrAssetOrField) {\n\t\t\t\tconst url = fileOrAssetOrField.url.split(\"?\")[0]\n\t\t\t\tconst filename =\n\t\t\t\t\t\"name\" in fileOrAssetOrField\n\t\t\t\t\t\t? fileOrAssetOrField.name\n\t\t\t\t\t\t: url.split(\"/\").pop()!.split(\"_\").pop()!\n\t\t\t\tconst credits =\n\t\t\t\t\t\"copyright\" in fileOrAssetOrField && fileOrAssetOrField.copyright\n\t\t\t\t\t\t? fileOrAssetOrField.copyright\n\t\t\t\t\t\t: undefined\n\t\t\t\tconst alt =\n\t\t\t\t\t\"alt\" in fileOrAssetOrField && fileOrAssetOrField.alt ? fileOrAssetOrField.alt : undefined\n\n\t\t\t\tif (\"dimensions\" in fileOrAssetOrField) {\n\t\t\t\t\tmaybeInitialField = fileOrAssetOrField\n\t\t\t\t}\n\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: url,\n\t\t\t\t\tfilename,\n\t\t\t\t\tnotes: undefined,\n\t\t\t\t\tcredits,\n\t\t\t\t\talt,\n\t\t\t\t\ttags: undefined,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: fileOrAssetOrField.url,\n\t\t\t\t\tfilename: fileOrAssetOrField.filename,\n\t\t\t\t\tnotes: fileOrAssetOrField.notes,\n\t\t\t\t\tcredits: fileOrAssetOrField.credits,\n\t\t\t\t\talt: fileOrAssetOrField.alt,\n\t\t\t\t\ttags: fileOrAssetOrField.tags?.map(({ name }) => name),\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = {\n\t\t\t\tid: fileOrAssetOrField,\n\t\t\t\tfile: fileOrAssetOrField,\n\t\t\t\tfilename: filename!,\n\t\t\t\tnotes,\n\t\t\t\tcredits,\n\t\t\t\talt,\n\t\t\t\ttags,\n\t\t\t}\n\t\t}\n\n\t\tvalidateAssetMetadata(config)\n\n\t\t// We create a detached instance of the asset each time to serialize it properly\n\t\tconst migrationAsset = new PrismicMigrationAsset(config, maybeInitialField)\n\n\t\tconst maybeAsset = this._assets.get(config.id)\n\t\tif (maybeAsset) {\n\t\t\t// Consolidate existing asset with new asset value if possible\n\t\t\tmaybeAsset.config.notes = maybeAsset.config.notes || config.notes\n\t\t\tmaybeAsset.config.credits = maybeAsset.config.credits || config.credits\n\t\t\tmaybeAsset.config.alt = maybeAsset.config.alt || config.alt\n\t\t\tmaybeAsset.config.tags = Array.from(\n\t\t\t\tnew Set([...(maybeAsset.config.tags || []), ...(config.tags || [])]),\n\t\t\t)\n\t\t} else {\n\t\t\tthis._assets.set(config.id, migrationAsset)\n\t\t}\n\n\t\treturn migrationAsset\n\t}\n\n\t/**\n\t * Registers a document to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be created when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @typeParam TType - Type of the Prismic document to create.\n\t * @param document - The document to create.\n\t * @param title - The title of the document to create which will be displayed in the editor.\n\t * @param params - Document master language document ID.\n\t * @returns A migration document instance.\n\t */\n\tcreateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t},\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>(\n\t\t\tdocument,\n\t\t\ttitle,\n\t\t\tparams,\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers an existing document to be updated in the migration.\n\t *\n\t * @remarks\n\t * This method does not update the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be updated when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @typeParam TType - Type of Prismic documents to update.\n\t * @param document - The document to update.\n\t * @param title - The title of the document to update which will be displayed in the editor.\n\t * @returns A migration document instance.\n\t */\n\tupdateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\t// Title is optional for existing documents as we might not want to update it.\n\t\ttitle?: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>(\n\t\t\tdocument,\n\t\t\ttitle,\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers a document from another Prismic repository to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be created when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @param document - The document from Prismic to create.\n\t * @param title - The title of the document to create which will be displayed in the editor.\n\t * @returns A migration document instance.\n\t */\n\tcreateDocumentFromPrismic<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument(\n\t\t\tthis.#migratePrismicDocumentData({\n\t\t\t\ttype: document.type,\n\t\t\t\tlang: document.lang,\n\t\t\t\tuid: document.uid,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}) as PendingPrismicDocument<ExtractDocumentType<TDocuments, TType>>,\n\t\t\ttitle,\n\t\t\t{ originalPrismicDocument: document },\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Queries a document from the migration instance with a specific UID and custom type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration.getByUID(\"blog_post\", \"my-first-post\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param type - The API ID of the document's custom type.\n\t * @param uid - The UID of the document.\n\t * @returns The migration document instance with a UID matching the `uid` parameter, if a matching\n\t * document is found.\n\t */\n\tgetByUID<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t\tuid: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.document.type === type && doc.document.uid === uid,\n\t\t)\n\t}\n\n\t/**\n\t * Queries a singleton document from the migration instance for a specific custom type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration.getSingle(\"settings\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param type - The API ID of the singleton custom type.\n\t * @returns The migration document instance for the custom type, if a matching\n\t * document is found.\n\t */\n\tgetSingle<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.document.type === type,\n\t\t)\n\t}\n\n\t/**\n\t * Migrates a Prismic document data from another repository so that it can be created through the\n\t * current repository's Migration API.\n\t *\n\t * @param input - The Prismic document data to migrate.\n\t * @returns The migrated Prismic document data.\n\t */\n\t#migratePrismicDocumentData(input: unknown): unknown {\n\t\tif (is.filledContentRelationship(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\tif (input.isBroken) {\n\t\t\t\treturn {\n\t\t\t\t\t...optionalLinkProperties,\n\t\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\t\t// ID needs to be 16 characters long to be considered valid by the API\n\t\t\t\t\tid: \"_____broken_____\",\n\t\t\t\t\tisBroken: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\tid: () => this._getByOriginalID(input.id),\n\t\t\t}\n\t\t}\n\n\t\tif (is.filledLinkToMedia(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Media,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\t\t}\n\n\t\tif (is.rtImageNode(input)) {\n\t\t\t// Rich text image nodes\n\t\t\tconst rtImageNode: MigrationRTImageNode = {\n\t\t\t\ttype: RichTextNodeType.image,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tif (input.linkTo) {\n\t\t\t\trtImageNode.linkTo = this.#migratePrismicDocumentData(input.linkTo) as\n\t\t\t\t\t| MigrationContentRelationship\n\t\t\t\t\t| MigrationLinkToMedia\n\t\t\t\t\t| FilledLinkToWebField\n\t\t\t}\n\n\t\t\treturn rtImageNode\n\t\t}\n\n\t\tif (is.filledImage(input)) {\n\t\t\tconst image: MigrationImage = {\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tid: _id,\n\t\t\t\turl: _url,\n\t\t\t\tdimensions: _dimensions,\n\t\t\t\tedit: _edit,\n\t\t\t\talt: _alt,\n\t\t\t\tcopyright: _copyright,\n\t\t\t\t...thumbnails\n\t\t\t} = input\n\n\t\t\tfor (const name in thumbnails) {\n\t\t\t\tif (is.filledImage(thumbnails[name])) {\n\t\t\t\t\timage[name] = this.createAsset(thumbnails[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn image\n\t\t}\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input.map((element) => this.#migratePrismicDocumentData(element))\n\t\t}\n\n\t\tif (input && typeof input === \"object\") {\n\t\t\tconst res: Record<PropertyKey, unknown> = {}\n\n\t\t\tfor (const key in input) {\n\t\t\t\tres[key] = this.#migratePrismicDocumentData(input[key as keyof typeof input])\n\t\t\t}\n\n\t\t\treturn res\n\t\t}\n\n\t\treturn input\n\t}\n\n\t/**\n\t * Queries a document from the migration instance for a specific original ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration._getByOriginalID(\"YhdrDxIAACgAcp_b\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param id - The original ID of the Prismic document.\n\t * @returns The migration document instance for the original ID, if a matching\n\t * document is found.\n\t * @internal\n\t */\n\t_getByOriginalID<TType extends TDocuments[\"type\"]>(\n\t\tid: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.originalPrismicDocument?.id === id,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAa,YAAb,MAA6E;;;;;;CAM5E,0BAAoE,IAAI,KAAK;;;;;;CAO7E,aAAqD,EAAE;;;;;;;;;;;CA+DvD,YACC,oBAKA,UACA,EACC,OACA,SACA,KACA,SAMG,EAAE,EACkB;EACxB,IAAI;EACJ,IAAI;AACJ,MAAI,OAAO,uBAAuB,YAAY,SAAS,mBACtD,KAAI,gBAAgB,sBAAsB,eAAe,oBAAoB;GAC5E,MAAM,MAAM,mBAAmB,IAAI,MAAM,IAAI,CAAC;GAC9C,MAAM,WACL,UAAU,qBACP,mBAAmB,OACnB,IAAI,MAAM,IAAI,CAAC,KAAK,CAAE,MAAM,IAAI,CAAC,KAAK;GAC1C,MAAM,UACL,eAAe,sBAAsB,mBAAmB,YACrD,mBAAmB,YACnB,KAAA;GACJ,MAAM,MACL,SAAS,sBAAsB,m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,KAAK,MACL,YAAY,aACZ,MAAM,OACN,KAAK,MACL,WAAW,YACX,GAAG,eACA;AAEJ,QAAK,MAAM,QAAQ,WAClB,KAAA,gBAAA,YAAmB,WAAW,MAAM,CACnC,OAAM,QAAQ,KAAK,YAAY,WAAW,MAAM;AAIlD,UAAO;;AAGR,MAAI,MAAM,QAAQ,MAAM,CACvB,QAAO,MAAM,KAAK,YAAY,MAAA,2BAAiC,QAAQ,CAAC;AAGzE,MAAI,SAAS,OAAO,UAAU,UAAU;GACvC,MAAM,MAAoC,EAAE;AAE5C,QAAK,MAAM,OAAO,MACjB,KAAI,OAAO,MAAA,2BAAiC,MAAM,KAA2B;AAG9E,UAAO;;AAGR,SAAO;;;;;;;;;;;;;;;;;;CAmBR,iBACC,IAC+E;AAC/E,SAAO,KAAK,WAAW,MACrB,QACA,IAAI,yBAAyB,OAAO,GACrC"}
|
|
1
|
+
{"version":3,"file":"Migration.cjs","names":["PrismicMigrationAsset","PrismicMigrationDocument","getOptionalLinkProperties","LinkType","RichTextNodeType"],"sources":["../src/Migration.ts"],"sourcesContent":["import { getOptionalLinkProperties } from \"./lib/getOptionalLinkProperties\"\nimport * as is from \"./lib/isValue\"\nimport { validateAssetMetadata } from \"./lib/validateAssetMetadata\"\nimport type { Asset } from \"./types/api/asset/asset\"\nimport type {\n\tMigrationAssetConfig,\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"./types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"./types/migration/ContentRelationship\"\nimport { PrismicMigrationDocument } from \"./types/migration/Document\"\nimport type { ExistingPrismicDocument, PendingPrismicDocument } from \"./types/migration/Document\"\nimport type { PrismicDocument } from \"./types/value/document\"\nimport type { FilledImageFieldImage } from \"./types/value/image\"\nimport { type FilledLinkToWebField, LinkType } from \"./types/value/link\"\nimport type { FilledLinkToMediaField } from \"./types/value/linkToMedia\"\nimport { RichTextNodeType } from \"./types/value/richText\"\n\n/**\n * Extracts one or more Prismic document types that match a given Prismic document type. If no\n * matches are found, no extraction is performed and the union of all provided Prismic document\n * types are returned.\n *\n * @typeParam TDocuments - Prismic document types from which to extract.\n * @typeParam TDocumentType - Type(s) to match `TDocuments` against.\n */\ntype ExtractDocumentType<\n\tTDocuments extends { type: string },\n\tTDocumentType extends TDocuments[\"type\"],\n> =\n\tExtract<TDocuments, { type: TDocumentType }> extends never\n\t\t? TDocuments\n\t\t: Extract<TDocuments, { type: TDocumentType }>\n\n/**\n * A helper that allows preparing your migration to Prismic.\n *\n * @typeParam TDocuments - Document types that are registered for the Prismic repository. Query\n * methods will automatically be typed based on this type.\n */\nexport class Migration<TDocuments extends PrismicDocument = PrismicDocument> {\n\t/**\n\t * Assets registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_assets: Map<MigrationAssetConfig[\"file\"], PrismicMigrationAsset> = new Map()\n\n\t/**\n\t * Documents registered in the migration.\n\t *\n\t * @internal\n\t */\n\t_documents: PrismicMigrationDocument<TDocuments>[] = []\n\n\t/**\n\t * Registers an asset to be created in the migration from an asset object.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param asset - An asset object from Prismic Asset API.\n\t * @returns A migration asset field instance.\n\t * @internal\n\t */\n\tcreateAsset(asset: Asset): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from an image or link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param imageOrLinkToMediaField - An image or link to media field from Prismic Document API.\n\t * @returns A migration asset field instance.\n\t * @internal\n\t */\n\tcreateAsset(\n\t\timageOrLinkToMediaField: FilledImageFieldImage | FilledLinkToMediaField,\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @param file - The URL or content of the file to be created.\n\t * @param filename - The filename of the asset.\n\t * @param params - Additional asset data.\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfile: MigrationAssetConfig[\"file\"],\n\t\tfilename: MigrationAssetConfig[\"filename\"],\n\t\tparams?: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t},\n\t): PrismicMigrationAsset\n\n\t/**\n\t * Registers an asset to be created in the migration from a file, an asset object, or an image or\n\t * link to media field.\n\t *\n\t * @remarks\n\t * This method does not create the asset in Prismic media library right away. Instead, it\n\t * registers it in your migration. The asset will be created when the migration is executed\n\t * through the `writeClient.migrate()` method.\n\t * @returns A migration asset field instance.\n\t */\n\tcreateAsset(\n\t\tfileOrAssetOrField:\n\t\t\t| MigrationAssetConfig[\"file\"]\n\t\t\t| Asset\n\t\t\t| FilledImageFieldImage\n\t\t\t| FilledLinkToMediaField,\n\t\tfilename?: MigrationAssetConfig[\"filename\"],\n\t\t{\n\t\t\tnotes,\n\t\t\tcredits,\n\t\t\talt,\n\t\t\ttags,\n\t\t}: {\n\t\t\tnotes?: string\n\t\t\tcredits?: string\n\t\t\talt?: string\n\t\t\ttags?: string[]\n\t\t} = {},\n\t): PrismicMigrationAsset {\n\t\tlet config: MigrationAssetConfig\n\t\tlet maybeInitialField: FilledImageFieldImage | undefined\n\t\tif (typeof fileOrAssetOrField === \"object\" && \"url\" in fileOrAssetOrField) {\n\t\t\tif (\"dimensions\" in fileOrAssetOrField || \"link_type\" in fileOrAssetOrField) {\n\t\t\t\tconst url = fileOrAssetOrField.url.split(\"?\")[0]\n\t\t\t\tconst filename =\n\t\t\t\t\t\"name\" in fileOrAssetOrField\n\t\t\t\t\t\t? fileOrAssetOrField.name\n\t\t\t\t\t\t: url.split(\"/\").pop()!.split(\"_\").pop()!\n\t\t\t\tconst credits =\n\t\t\t\t\t\"copyright\" in fileOrAssetOrField && fileOrAssetOrField.copyright\n\t\t\t\t\t\t? fileOrAssetOrField.copyright\n\t\t\t\t\t\t: undefined\n\t\t\t\tconst alt =\n\t\t\t\t\t\"alt\" in fileOrAssetOrField && fileOrAssetOrField.alt ? fileOrAssetOrField.alt : undefined\n\n\t\t\t\tif (\"dimensions\" in fileOrAssetOrField) {\n\t\t\t\t\tmaybeInitialField = fileOrAssetOrField\n\t\t\t\t}\n\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: url,\n\t\t\t\t\tfilename,\n\t\t\t\t\tnotes: undefined,\n\t\t\t\t\tcredits,\n\t\t\t\t\talt,\n\t\t\t\t\ttags: undefined,\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconfig = {\n\t\t\t\t\tid: fileOrAssetOrField.id,\n\t\t\t\t\tfile: fileOrAssetOrField.url,\n\t\t\t\t\tfilename: fileOrAssetOrField.filename,\n\t\t\t\t\tnotes: fileOrAssetOrField.notes,\n\t\t\t\t\tcredits: fileOrAssetOrField.credits,\n\t\t\t\t\talt: fileOrAssetOrField.alt,\n\t\t\t\t\ttags: fileOrAssetOrField.tags?.map(({ name }) => name),\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = {\n\t\t\t\tid: fileOrAssetOrField,\n\t\t\t\tfile: fileOrAssetOrField,\n\t\t\t\tfilename: filename!,\n\t\t\t\tnotes,\n\t\t\t\tcredits,\n\t\t\t\talt,\n\t\t\t\ttags,\n\t\t\t}\n\t\t}\n\n\t\tvalidateAssetMetadata(config)\n\n\t\t// We create a detached instance of the asset each time to serialize it properly\n\t\tconst migrationAsset = new PrismicMigrationAsset(config, maybeInitialField)\n\n\t\tconst maybeAsset = this._assets.get(config.id)\n\t\tif (maybeAsset) {\n\t\t\t// Consolidate existing asset with new asset value if possible\n\t\t\tmaybeAsset.config.notes = maybeAsset.config.notes || config.notes\n\t\t\tmaybeAsset.config.credits = maybeAsset.config.credits || config.credits\n\t\t\tmaybeAsset.config.alt = maybeAsset.config.alt || config.alt\n\t\t\tmaybeAsset.config.tags = Array.from(\n\t\t\t\tnew Set([...(maybeAsset.config.tags || []), ...(config.tags || [])]),\n\t\t\t)\n\t\t} else {\n\t\t\tthis._assets.set(config.id, migrationAsset)\n\t\t}\n\n\t\treturn migrationAsset\n\t}\n\n\t/**\n\t * Registers a document to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be created when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @typeParam TType - Type of the Prismic document to create.\n\t * @param document - The document to create.\n\t * @param title - The title of the document to create which will be displayed in the editor.\n\t * @param params - Document master language document ID.\n\t * @returns A migration document instance.\n\t */\n\tcreateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<PendingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t},\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>(\n\t\t\tdocument,\n\t\t\ttitle,\n\t\t\tparams,\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers an existing document to be updated in the migration.\n\t *\n\t * @remarks\n\t * This method does not update the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be updated when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @typeParam TType - Type of Prismic documents to update.\n\t * @param document - The document to update.\n\t * @param title - The title of the document to update which will be displayed in the editor.\n\t * @returns A migration document instance.\n\t */\n\tupdateDocument<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\t// Title is optional for existing documents as we might not want to update it.\n\t\ttitle?: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>>(\n\t\t\tdocument,\n\t\t\ttitle,\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Registers a document from another Prismic repository to be created in the migration.\n\t *\n\t * @remarks\n\t * This method does not create the document in Prismic right away. Instead, it registers it in\n\t * your migration. The document will be created when the migration is executed through the\n\t * `writeClient.migrate()` method.\n\t * @param document - The document from Prismic to create.\n\t * @param title - The title of the document to create which will be displayed in the editor.\n\t * @returns A migration document instance.\n\t */\n\tcreateDocumentFromPrismic<TType extends TDocuments[\"type\"]>(\n\t\tdocument: ExtractDocumentType<ExistingPrismicDocument<TDocuments>, TType>,\n\t\ttitle: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> {\n\t\tconst doc = new PrismicMigrationDocument(\n\t\t\tthis.#migratePrismicDocumentData({\n\t\t\t\ttype: document.type,\n\t\t\t\tlang: document.lang,\n\t\t\t\tuid: document.uid,\n\t\t\t\ttags: document.tags,\n\t\t\t\tdata: document.data,\n\t\t\t}) as PendingPrismicDocument<ExtractDocumentType<TDocuments, TType>>,\n\t\t\ttitle,\n\t\t\t{ originalPrismicDocument: document },\n\t\t)\n\n\t\tthis._documents.push(doc)\n\n\t\treturn doc\n\t}\n\n\t/**\n\t * Queries a document from the migration instance with a specific UID and custom type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration.getByUID(\"blog_post\", \"my-first-post\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param type - The API ID of the document's custom type.\n\t * @param uid - The UID of the document.\n\t * @returns The migration document instance with a UID matching the `uid` parameter, if a matching\n\t * document is found.\n\t */\n\tgetByUID<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t\tuid: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.document.type === type && doc.document.uid === uid,\n\t\t)\n\t}\n\n\t/**\n\t * Queries a singleton document from the migration instance for a specific custom type.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration.getSingle(\"settings\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param type - The API ID of the singleton custom type.\n\t * @returns The migration document instance for the custom type, if a matching\n\t * document is found.\n\t */\n\tgetSingle<TType extends TDocuments[\"type\"]>(\n\t\ttype: TType,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.document.type === type,\n\t\t)\n\t}\n\n\t/**\n\t * Migrates a Prismic document data from another repository so that it can be created through the\n\t * current repository's Migration API.\n\t *\n\t * @param input - The Prismic document data to migrate.\n\t * @returns The migrated Prismic document data.\n\t */\n\t#migratePrismicDocumentData(input: unknown): unknown {\n\t\tif (is.filledContentRelationship(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\tif (input.isBroken) {\n\t\t\t\treturn {\n\t\t\t\t\t...optionalLinkProperties,\n\t\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\t\t// ID needs to be 16 characters long to be considered valid by the API\n\t\t\t\t\tid: \"_____broken_____\",\n\t\t\t\t\tisBroken: true,\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Document,\n\t\t\t\tid: () => this._getByOriginalID(input.id),\n\t\t\t}\n\t\t}\n\n\t\tif (is.filledLinkToMedia(input)) {\n\t\t\tconst optionalLinkProperties = getOptionalLinkProperties(input)\n\n\t\t\treturn {\n\t\t\t\t...optionalLinkProperties,\n\t\t\t\tlink_type: LinkType.Media,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\t\t}\n\n\t\tif (is.rtImageNode(input)) {\n\t\t\t// Rich text image nodes\n\t\t\tconst rtImageNode: MigrationRTImageNode = {\n\t\t\t\ttype: RichTextNodeType.image,\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tif (input.linkTo) {\n\t\t\t\trtImageNode.linkTo = this.#migratePrismicDocumentData(input.linkTo) as\n\t\t\t\t\t| MigrationContentRelationship\n\t\t\t\t\t| MigrationLinkToMedia\n\t\t\t\t\t| FilledLinkToWebField\n\t\t\t}\n\n\t\t\treturn rtImageNode\n\t\t}\n\n\t\tif (is.filledImage(input)) {\n\t\t\tconst image: MigrationImage = {\n\t\t\t\tid: this.createAsset(input),\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tid: _id,\n\t\t\t\turl: _url,\n\t\t\t\tdimensions: _dimensions,\n\t\t\t\tedit: _edit,\n\t\t\t\talt: _alt,\n\t\t\t\tcopyright: _copyright,\n\t\t\t\t...thumbnails\n\t\t\t} = input\n\n\t\t\tfor (const name in thumbnails) {\n\t\t\t\tif (is.filledImage(thumbnails[name])) {\n\t\t\t\t\timage[name] = this.createAsset(thumbnails[name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn image\n\t\t}\n\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input.map((element) => this.#migratePrismicDocumentData(element))\n\t\t}\n\n\t\tif (input && typeof input === \"object\") {\n\t\t\tconst res: Record<PropertyKey, unknown> = {}\n\n\t\t\tfor (const key in input) {\n\t\t\t\tres[key] = this.#migratePrismicDocumentData(input[key as keyof typeof input])\n\t\t\t}\n\n\t\t\treturn res\n\t\t}\n\n\t\treturn input\n\t}\n\n\t/**\n\t * Queries a document from the migration instance for a specific original ID.\n\t *\n\t * @example\n\t * \t;```ts\n\t * \tconst contentRelationship = migration.createContentRelationship(() =>\n\t * \t\tmigration._getByOriginalID(\"YhdrDxIAACgAcp_b\"),\n\t * \t)\n\t * \t```\n\t *\n\t * @typeParam TType - Type of the Prismic document returned.\n\t * @param id - The original ID of the Prismic document.\n\t * @returns The migration document instance for the original ID, if a matching\n\t * document is found.\n\t * @internal\n\t */\n\t_getByOriginalID<TType extends TDocuments[\"type\"]>(\n\t\tid: string,\n\t): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined {\n\t\treturn this._documents.find(\n\t\t\t(doc): doc is PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> =>\n\t\t\t\tdoc.originalPrismicDocument?.id === id,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AA0CA,IAAa,YAAb,MAA6E;;;;;;CAM5E,0BAAoE,IAAI,IAAI;;;;;;CAO5E,aAAqD,CAAC;;;;;;;;;;;CA+DtD,YACC,oBAKA,UACA,EACC,OACA,SACA,KACA,SAMG,CAAC,GACmB;EACxB,IAAI;EACJ,IAAI;EACJ,IAAI,OAAO,uBAAuB,YAAY,SAAS,oBAAoB;GAC1E,IAAI,gBAAgB,sBAAsB,eAAe,oBAAoB;IAC5E,MAAM,MAAM,mBAAmB,IAAI,MAAM,GAAG,CAAC,CAAC;IAC9C,MAAM,WACL,UAAU,qBACP,mBAAmB,OACnB,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAE,MAAM,GAAG,CAAC,CAAC,IAAI;IACzC,MAAM,UACL,eAAe,sBAAsB,mBAAmB,YACrD,mBAAmB,YACnB,KAAA;IACJ,MAAM,MACL,SAAS,sBAAsB,mBAAmB,MAAM,mBAAmB,MAAM,KAAA;IAElF,IAAI,gBAAgB,oBACnB,oBAAoB;IAGrB,SAAS;KACR,IAAI,mBAAmB;KACvB,MAAM;KACN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J,KAAK,MAAM,QAAQ,YAClB,IAAA,gBAAA,YAAmB,WAAW,KAAK,GAClC,MAAM,QAAQ,KAAK,YAAY,WAAW,KAAK;GAIjD,OAAO;EACR;EAEA,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,KAAK,YAAY,KAAK,4BAA4B,OAAO,CAAC;EAGxE,IAAI,SAAS,OAAO,UAAU,UAAU;GACvC,MAAM,MAAoC,CAAC;GAE3C,KAAK,MAAM,OAAO,OACjB,IAAI,OAAO,KAAK,4BAA4B,MAAM,IAA0B;GAG7E,OAAO;EACR;EAEA,OAAO;CACR;;;;;;;;;;;;;;;;;CAkBA,iBACC,IAC+E;EAC/E,OAAO,KAAK,WAAW,MACrB,QACA,IAAI,yBAAyB,OAAO,EACtC;CACD;AACD"}
|
package/dist/Migration.d.cts
CHANGED
|
@@ -5,7 +5,6 @@ import { Asset } from "./types/api/asset/asset.cjs";
|
|
|
5
5
|
import { MigrationContentRelationship } from "./types/migration/ContentRelationship.cjs";
|
|
6
6
|
import { ExistingPrismicDocument, PendingPrismicDocument, PrismicMigrationDocument } from "./types/migration/Document.cjs";
|
|
7
7
|
import { MigrationAssetConfig, PrismicMigrationAsset } from "./types/migration/Asset.cjs";
|
|
8
|
-
|
|
9
8
|
//#region src/Migration.d.ts
|
|
10
9
|
/**
|
|
11
10
|
* Extracts one or more Prismic document types that match a given Prismic document type. If no
|
|
@@ -28,7 +27,7 @@ type ExtractDocumentType<TDocuments extends {
|
|
|
28
27
|
* @typeParam TDocuments - Document types that are registered for the Prismic repository. Query
|
|
29
28
|
* methods will automatically be typed based on this type.
|
|
30
29
|
*/
|
|
31
|
-
declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
30
|
+
export declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
32
31
|
#private;
|
|
33
32
|
/**
|
|
34
33
|
* Assets registered in the migration.
|
|
@@ -177,5 +176,4 @@ declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
177
176
|
_getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
178
177
|
}
|
|
179
178
|
//#endregion
|
|
180
|
-
export { Migration };
|
|
181
179
|
//# sourceMappingURL=Migration.d.cts.map
|
package/dist/Migration.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.d.cts","names":[],"sources":["../src/Migration.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Migration.d.cts","names":[],"sources":["../src/Migration.ts"],"mappings":";;;;;;;;;;;;;;;;KA4BK,oBACJ;EAAqB;GACrB,sBAAsB,sBAEtB,QAAQ;EAAc,MAAM;mBACzB,aACA,QAAQ;EAAc,MAAM;;;;;;;;qBAQnB,UAAU,mBAAmB,kBAAkB;;;;;;;EAM3D,SAAS,IAAI,8BAA8B;;;;;;EAO3C,YAAY,yBAAyB;;;;;;;;;;;;EAarC,YAAY,OAAO,QAAQ;;;;;;;;;;;;EAa3B,YACC,yBAAyB,wBAAwB,yBAC/C;;;;;;;;;;;;;EAcH,YACC,MAAM,8BACN,UAAU,kCACV;IACC;IACA;IACA;IACA;MAEC;;;;;;;;;;;;;;EAqHH,eAAe,cAAc,oBAC5B,UAAU,oBAAoB,uBAAuB,aAAa,QAClE,eACA;IACC,yBAAyB;MAExB,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;EAwB5D,eAAe,cAAc,oBAC5B,UAAU,oBAAoB,wBAAwB,aAAa,QAEnE,iBACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;EAsB5D,0BAA0B,cAAc,oBACvC,UAAU,oBAAoB,wBAAwB,aAAa,QACnE,gBACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;;EAkC5D,SAAS,cAAc,oBACtB,MAAM,OACN,cACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;EAsB5D,UAAU,cAAc,oBACvB,MAAM,QACJ,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;;EAuH5D,iBAAiB,cAAc,oBAC9B,aACE,yBAAyB,oBAAoB,YAAY"}
|
package/dist/Migration.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { Asset } from "./types/api/asset/asset.js";
|
|
|
5
5
|
import { MigrationContentRelationship } from "./types/migration/ContentRelationship.js";
|
|
6
6
|
import { ExistingPrismicDocument, PendingPrismicDocument, PrismicMigrationDocument } from "./types/migration/Document.js";
|
|
7
7
|
import { MigrationAssetConfig, PrismicMigrationAsset } from "./types/migration/Asset.js";
|
|
8
|
-
|
|
9
8
|
//#region src/Migration.d.ts
|
|
10
9
|
/**
|
|
11
10
|
* Extracts one or more Prismic document types that match a given Prismic document type. If no
|
|
@@ -28,7 +27,7 @@ type ExtractDocumentType<TDocuments extends {
|
|
|
28
27
|
* @typeParam TDocuments - Document types that are registered for the Prismic repository. Query
|
|
29
28
|
* methods will automatically be typed based on this type.
|
|
30
29
|
*/
|
|
31
|
-
declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
30
|
+
export declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
32
31
|
#private;
|
|
33
32
|
/**
|
|
34
33
|
* Assets registered in the migration.
|
|
@@ -177,5 +176,4 @@ declare class Migration<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
177
176
|
_getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
178
177
|
}
|
|
179
178
|
//#endregion
|
|
180
|
-
export { Migration };
|
|
181
179
|
//# sourceMappingURL=Migration.d.ts.map
|
package/dist/Migration.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Migration.d.ts","names":[],"sources":["../src/Migration.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Migration.d.ts","names":[],"sources":["../src/Migration.ts"],"mappings":";;;;;;;;;;;;;;;;KA4BK,oBACJ;EAAqB;GACrB,sBAAsB,sBAEtB,QAAQ;EAAc,MAAM;mBACzB,aACA,QAAQ;EAAc,MAAM;;;;;;;;qBAQnB,UAAU,mBAAmB,kBAAkB;;;;;;;EAM3D,SAAS,IAAI,8BAA8B;;;;;;EAO3C,YAAY,yBAAyB;;;;;;;;;;;;EAarC,YAAY,OAAO,QAAQ;;;;;;;;;;;;EAa3B,YACC,yBAAyB,wBAAwB,yBAC/C;;;;;;;;;;;;;EAcH,YACC,MAAM,8BACN,UAAU,kCACV;IACC;IACA;IACA;IACA;MAEC;;;;;;;;;;;;;;EAqHH,eAAe,cAAc,oBAC5B,UAAU,oBAAoB,uBAAuB,aAAa,QAClE,eACA;IACC,yBAAyB;MAExB,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;EAwB5D,eAAe,cAAc,oBAC5B,UAAU,oBAAoB,wBAAwB,aAAa,QAEnE,iBACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;EAsB5D,0BAA0B,cAAc,oBACvC,UAAU,oBAAoB,wBAAwB,aAAa,QACnE,gBACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;;EAkC5D,SAAS,cAAc,oBACtB,MAAM,OACN,cACE,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;EAsB5D,UAAU,cAAc,oBACvB,MAAM,QACJ,yBAAyB,oBAAoB,YAAY;;;;;;;;;;;;;;;;;EAuH5D,iBAAiB,cAAc,oBAC9B,aACE,yBAAyB,oBAAoB,YAAY"}
|