@prismicio/client 7.21.0-alpha.1 → 7.21.0-canary.147e3f2
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 +920 -1268
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +704 -0
- package/dist/Client.d.cts.map +1 -0
- package/dist/Client.d.ts +678 -955
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +913 -1261
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +281 -312
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +216 -0
- package/dist/Migration.d.cts.map +1 -0
- package/dist/Migration.d.ts +197 -194
- package/dist/Migration.d.ts.map +1 -0
- package/dist/Migration.js +280 -311
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +486 -558
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +262 -0
- package/dist/WriteClient.d.cts.map +1 -0
- package/dist/WriteClient.d.ts +226 -245
- package/dist/WriteClient.d.ts.map +1 -0
- package/dist/WriteClient.js +482 -554
- package/dist/WriteClient.js.map +1 -1
- package/dist/_virtual/rolldown_runtime.cjs +14 -0
- package/dist/_virtual/rolldown_runtime.js +13 -0
- package/dist/buildQueryURL.cjs +89 -59
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +212 -0
- package/dist/buildQueryURL.d.cts.map +1 -0
- package/dist/buildQueryURL.d.ts +164 -161
- package/dist/buildQueryURL.d.ts.map +1 -0
- package/dist/buildQueryURL.js +89 -59
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs +17 -3
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.d.cts +11 -0
- package/dist/cookie.d.cts.map +1 -0
- package/dist/cookie.d.ts +7 -1
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cookie.js +12 -4
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +32 -5
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +41 -0
- package/dist/createClient.d.cts.map +1 -0
- package/dist/createClient.d.ts +22 -13
- package/dist/createClient.d.ts.map +1 -0
- package/dist/createClient.js +31 -4
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs +21 -5
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +30 -0
- package/dist/createMigration.d.cts.map +1 -0
- package/dist/createMigration.d.ts +11 -5
- package/dist/createMigration.d.ts.map +1 -0
- package/dist/createMigration.js +20 -4
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs +29 -5
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +38 -0
- package/dist/createWriteClient.d.cts.map +1 -0
- package/dist/createWriteClient.d.ts +11 -5
- package/dist/createWriteClient.d.ts.map +1 -0
- package/dist/createWriteClient.js +28 -4
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors.cjs +31 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +46 -0
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +22 -0
- package/dist/errors.js.map +1 -0
- package/dist/filter.cjs +93 -236
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +213 -0
- package/dist/filter.d.cts.map +1 -0
- package/dist/filter.d.ts +212 -208
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +93 -237
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs +18 -10
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +14 -0
- package/dist/getGraphQLEndpoint.d.cts.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +5 -1
- package/dist/getGraphQLEndpoint.d.ts.map +1 -0
- package/dist/getGraphQLEndpoint.js +18 -10
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs +27 -10
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +23 -0
- package/dist/getRepositoryEndpoint.d.cts.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +14 -3
- package/dist/getRepositoryEndpoint.d.ts.map +1 -0
- package/dist/getRepositoryEndpoint.js +27 -10
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs +22 -14
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +16 -0
- package/dist/getRepositoryName.d.cts.map +1 -0
- package/dist/getRepositoryName.d.ts +5 -1
- package/dist/getRepositoryName.d.ts.map +1 -0
- package/dist/getRepositoryName.js +23 -15
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs +42 -10
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +38 -0
- package/dist/getToolbarSrc.d.cts.map +1 -0
- package/dist/getToolbarSrc.d.ts +5 -1
- package/dist/getToolbarSrc.d.ts.map +1 -0
- package/dist/getToolbarSrc.js +42 -10
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs +36 -11
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +29 -0
- package/dist/helpers/asDate.d.cts.map +1 -0
- package/dist/helpers/asDate.d.ts +20 -8
- package/dist/helpers/asDate.d.ts.map +1 -0
- package/dist/helpers/asDate.js +36 -12
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +76 -79
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +147 -0
- package/dist/helpers/asHTML.d.cts.map +1 -0
- package/dist/helpers/asHTML.d.ts +84 -78
- package/dist/helpers/asHTML.d.ts.map +1 -0
- package/dist/helpers/asHTML.js +74 -77
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +57 -18
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +59 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +31 -25
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +57 -18
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs +30 -10
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +34 -0
- package/dist/helpers/asImageSrc.d.cts.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +20 -14
- package/dist/helpers/asImageSrc.d.ts.map +1 -0
- package/dist/helpers/asImageSrc.js +30 -10
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +76 -42
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +67 -0
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +34 -28
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.js +76 -42
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs +26 -44
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +83 -0
- package/dist/helpers/asLink.d.cts.map +1 -0
- package/dist/helpers/asLink.d.ts +64 -58
- package/dist/helpers/asLink.d.ts.map +1 -0
- package/dist/helpers/asLink.js +25 -43
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs +44 -25
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +51 -0
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +29 -28
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -0
- package/dist/helpers/asLinkAttrs.js +43 -24
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs +15 -20
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +62 -0
- package/dist/helpers/asText.d.cts.map +1 -0
- package/dist/helpers/asText.d.ts +48 -33
- package/dist/helpers/asText.d.ts.map +1 -0
- package/dist/helpers/asText.js +15 -20
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs +30 -24
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +21 -0
- package/dist/helpers/documentToLinkField.d.cts.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +8 -4
- package/dist/helpers/documentToLinkField.d.ts.map +1 -0
- package/dist/helpers/documentToLinkField.js +30 -24
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +215 -42
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +199 -0
- package/dist/helpers/isFilled.d.cts.map +1 -0
- package/dist/helpers/isFilled.d.ts +65 -56
- package/dist/helpers/isFilled.d.ts.map +1 -0
- package/dist/helpers/isFilled.js +210 -44
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs +50 -39
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +139 -0
- package/dist/helpers/mapSliceZone.d.cts.map +1 -0
- package/dist/helpers/mapSliceZone.d.ts +47 -44
- package/dist/helpers/mapSliceZone.d.ts.map +1 -0
- package/dist/helpers/mapSliceZone.js +50 -40
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.cjs +109 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +143 -173
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -73
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +20 -9
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +14 -0
- package/dist/isRepositoryEndpoint.d.cts.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +7 -3
- package/dist/isRepositoryEndpoint.d.ts.map +1 -0
- package/dist/isRepositoryEndpoint.js +20 -10
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs +14 -4
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.d.cts +13 -0
- package/dist/isRepositoryName.d.cts.map +1 -0
- package/dist/isRepositoryName.d.ts +5 -1
- package/dist/isRepositoryName.d.ts.map +1 -0
- package/dist/isRepositoryName.js +14 -5
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/devMsg.cjs +22 -5
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +23 -6
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs +36 -39
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js +36 -40
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs +19 -11
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js +19 -12
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs +25 -16
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js +25 -16
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs +15 -6
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js +15 -7
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs +65 -12
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js +63 -13
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs +93 -36
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js +93 -40
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/pLimit.cjs +51 -45
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js +51 -46
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +54 -37
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +61 -0
- package/dist/lib/request.d.cts.map +1 -0
- package/dist/lib/request.d.ts +38 -50
- package/dist/lib/request.d.ts.map +1 -0
- package/dist/lib/request.js +54 -37
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +147 -125
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +143 -122
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs +73 -91
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js +71 -94
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/throttledWarn.cjs +27 -0
- package/dist/lib/throttledWarn.cjs.map +1 -0
- package/dist/lib/throttledWarn.js +26 -0
- package/dist/lib/throttledWarn.js.map +1 -0
- package/dist/lib/validateAssetMetadata.cjs +40 -20
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js +41 -21
- package/dist/lib/validateAssetMetadata.js.map +1 -1
- package/dist/package.cjs +19 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/richtext/asText.cjs +18 -10
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +18 -0
- package/dist/richtext/asText.d.cts.map +1 -0
- package/dist/richtext/asText.d.ts +13 -7
- package/dist/richtext/asText.d.ts.map +1 -0
- package/dist/richtext/asText.js +18 -11
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs +106 -107
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +20 -0
- package/dist/richtext/asTree.d.cts.map +1 -0
- package/dist/richtext/asTree.d.ts +9 -3
- package/dist/richtext/asTree.d.ts.map +1 -0
- package/dist/richtext/asTree.js +106 -107
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs +28 -14
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +22 -0
- package/dist/richtext/composeSerializers.d.cts.map +1 -0
- package/dist/richtext/composeSerializers.d.ts +8 -2
- package/dist/richtext/composeSerializers.d.ts.map +1 -0
- package/dist/richtext/composeSerializers.js +28 -15
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs +30 -14
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +25 -0
- package/dist/richtext/serialize.d.cts.map +1 -0
- package/dist/richtext/serialize.d.ts +17 -11
- package/dist/richtext/serialize.d.ts.map +1 -0
- package/dist/richtext/serialize.js +30 -14
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs +10 -8
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +71 -0
- package/dist/richtext/types.d.cts.map +1 -0
- package/dist/richtext/types.d.ts +49 -49
- package/dist/richtext/types.d.ts.map +1 -0
- package/dist/richtext/types.js +10 -8
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs +29 -21
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +21 -0
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.ts +8 -2
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -0
- package/dist/richtext/wrapMapSerializer.js +29 -21
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/richtext.cjs +13 -15
- package/dist/richtext.d.cts +8 -0
- package/dist/richtext.d.ts +8 -0
- package/dist/richtext.js +4 -11
- package/dist/types/api/asset/asset.d.cts +97 -0
- package/dist/types/api/asset/asset.d.cts.map +1 -0
- package/dist/types/api/asset/asset.d.ts +87 -167
- package/dist/types/api/asset/asset.d.ts.map +1 -0
- package/dist/types/api/asset/tag.d.cts +35 -0
- package/dist/types/api/asset/tag.d.cts.map +1 -0
- package/dist/types/api/asset/tag.d.ts +29 -47
- package/dist/types/api/asset/tag.d.ts.map +1 -0
- package/dist/types/api/integration.d.cts +34 -0
- package/dist/types/api/integration.d.cts.map +1 -0
- package/dist/types/api/integration.d.ts +17 -11
- package/dist/types/api/integration.d.ts.map +1 -0
- package/dist/types/api/query.d.cts +49 -0
- package/dist/types/api/query.d.cts.map +1 -0
- package/dist/types/api/query.d.ts +40 -34
- package/dist/types/api/query.d.ts.map +1 -0
- package/dist/types/api/ref.d.cts +36 -0
- package/dist/types/api/ref.d.cts.map +1 -0
- package/dist/types/api/ref.d.ts +30 -26
- package/dist/types/api/ref.d.ts.map +1 -0
- package/dist/types/api/release.d.cts +17 -0
- package/dist/types/api/release.d.cts.map +1 -0
- package/dist/types/api/release.d.ts +8 -2
- package/dist/types/api/release.d.ts.map +1 -0
- package/dist/types/api/repository.d.cts +115 -0
- package/dist/types/api/repository.d.cts.map +1 -0
- package/dist/types/api/repository.d.ts +90 -84
- package/dist/types/api/repository.d.ts.map +1 -0
- package/dist/types/api/tags.d.cts +13 -0
- package/dist/types/api/tags.d.cts.map +1 -0
- package/dist/types/api/tags.d.ts +5 -1
- package/dist/types/api/tags.d.ts.map +1 -0
- package/dist/types/migration/Asset.cjs +34 -32
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +109 -0
- package/dist/types/migration/Asset.d.cts.map +1 -0
- package/dist/types/migration/Asset.d.ts +89 -88
- package/dist/types/migration/Asset.d.ts.map +1 -0
- package/dist/types/migration/Asset.js +33 -32
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +15 -0
- package/dist/types/migration/ContentRelationship.d.cts.map +1 -0
- package/dist/types/migration/ContentRelationship.d.ts +10 -11
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -0
- package/dist/types/migration/Document.cjs +50 -46
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +97 -0
- package/dist/types/migration/Document.d.cts.map +1 -0
- package/dist/types/migration/Document.d.ts +62 -59
- package/dist/types/migration/Document.d.ts.map +1 -0
- package/dist/types/migration/Document.js +49 -46
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/boolean.d.cts +21 -0
- package/dist/types/model/boolean.d.cts.map +1 -0
- package/dist/types/model/boolean.d.ts +15 -9
- package/dist/types/model/boolean.d.ts.map +1 -0
- package/dist/types/model/color.d.cts +19 -0
- package/dist/types/model/color.d.cts.map +1 -0
- package/dist/types/model/color.d.ts +13 -7
- package/dist/types/model/color.d.ts.map +1 -0
- package/dist/types/model/contentRelationship.d.cts +59 -0
- package/dist/types/model/contentRelationship.d.cts.map +1 -0
- package/dist/types/model/contentRelationship.d.ts +33 -26
- package/dist/types/model/contentRelationship.d.ts.map +1 -0
- package/dist/types/model/customType.d.cts +54 -0
- package/dist/types/model/customType.d.cts.map +1 -0
- package/dist/types/model/customType.d.ts +36 -30
- package/dist/types/model/customType.d.ts.map +1 -0
- package/dist/types/model/date.d.cts +20 -0
- package/dist/types/model/date.d.cts.map +1 -0
- package/dist/types/model/date.d.ts +14 -8
- package/dist/types/model/date.d.ts.map +1 -0
- package/dist/types/model/embed.d.cts +19 -0
- package/dist/types/model/embed.d.cts.map +1 -0
- package/dist/types/model/embed.d.ts +13 -7
- package/dist/types/model/embed.d.ts.map +1 -0
- package/dist/types/model/geoPoint.d.cts +18 -0
- package/dist/types/model/geoPoint.d.cts.map +1 -0
- package/dist/types/model/geoPoint.d.ts +12 -6
- package/dist/types/model/geoPoint.d.ts.map +1 -0
- package/dist/types/model/group.d.cts +29 -0
- package/dist/types/model/group.d.cts.map +1 -0
- package/dist/types/model/group.d.ts +14 -8
- package/dist/types/model/group.d.ts.map +1 -0
- package/dist/types/model/image.d.cts +37 -0
- package/dist/types/model/image.d.cts.map +1 -0
- package/dist/types/model/image.d.ts +19 -13
- package/dist/types/model/image.d.ts.map +1 -0
- package/dist/types/model/integration.d.cts +20 -0
- package/dist/types/model/integration.d.cts.map +1 -0
- package/dist/types/model/integration.d.ts +14 -8
- package/dist/types/model/integration.d.ts.map +1 -0
- package/dist/types/model/keyText.d.cts +19 -0
- package/dist/types/model/keyText.d.cts.map +1 -0
- package/dist/types/model/keyText.d.ts +13 -7
- package/dist/types/model/keyText.d.ts.map +1 -0
- package/dist/types/model/link.cjs +13 -6
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.cts +34 -0
- package/dist/types/model/link.d.cts.map +1 -0
- package/dist/types/model/link.d.ts +22 -16
- package/dist/types/model/link.d.ts.map +1 -0
- package/dist/types/model/link.js +13 -7
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.cts +23 -0
- package/dist/types/model/linkToMedia.d.cts.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +17 -11
- package/dist/types/model/linkToMedia.d.ts.map +1 -0
- package/dist/types/model/number.d.cts +21 -0
- package/dist/types/model/number.d.cts.map +1 -0
- package/dist/types/model/number.d.ts +15 -9
- package/dist/types/model/number.d.ts.map +1 -0
- package/dist/types/model/range.d.cts +20 -0
- package/dist/types/model/range.d.cts.map +1 -0
- package/dist/types/model/range.d.ts +16 -10
- package/dist/types/model/range.d.ts.map +1 -0
- package/dist/types/model/richText.d.cts +43 -0
- package/dist/types/model/richText.d.cts.map +1 -0
- package/dist/types/model/richText.d.ts +26 -20
- package/dist/types/model/richText.d.ts.map +1 -0
- package/dist/types/model/select.d.cts +24 -0
- package/dist/types/model/select.d.cts.map +1 -0
- package/dist/types/model/select.d.ts +15 -9
- package/dist/types/model/select.d.ts.map +1 -0
- package/dist/types/model/separator.d.cts +16 -0
- package/dist/types/model/separator.d.cts.map +1 -0
- package/dist/types/model/separator.d.ts +12 -6
- package/dist/types/model/separator.d.ts.map +1 -0
- package/dist/types/model/sharedSlice.d.cts +22 -0
- package/dist/types/model/sharedSlice.d.cts.map +1 -0
- package/dist/types/model/sharedSlice.d.ts +14 -8
- package/dist/types/model/sharedSlice.d.ts.map +1 -0
- package/dist/types/model/sharedSliceVariation.d.cts +25 -0
- package/dist/types/model/sharedSliceVariation.d.cts.map +1 -0
- package/dist/types/model/sharedSliceVariation.d.ts +16 -10
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -0
- package/dist/types/model/slice.cjs +12 -5
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.cts +39 -0
- package/dist/types/model/slice.d.cts.map +1 -0
- package/dist/types/model/slice.d.ts +21 -15
- package/dist/types/model/slice.d.ts.map +1 -0
- package/dist/types/model/slice.js +12 -6
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs +12 -5
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.cts +47 -0
- package/dist/types/model/sliceZone.d.cts.map +1 -0
- package/dist/types/model/sliceZone.d.ts +23 -17
- package/dist/types/model/sliceZone.d.ts.map +1 -0
- package/dist/types/model/sliceZone.js +12 -6
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/table.d.cts +18 -0
- package/dist/types/model/table.d.cts.map +1 -0
- package/dist/types/model/table.d.ts +12 -6
- package/dist/types/model/table.d.ts.map +1 -0
- package/dist/types/model/timestamp.d.cts +20 -0
- package/dist/types/model/timestamp.d.cts.map +1 -0
- package/dist/types/model/timestamp.d.ts +14 -8
- package/dist/types/model/timestamp.d.ts.map +1 -0
- package/dist/types/model/title.d.cts +13 -0
- package/dist/types/model/title.d.cts.map +1 -0
- package/dist/types/model/title.d.ts +8 -2
- package/dist/types/model/title.d.ts.map +1 -0
- package/dist/types/model/types.cjs +29 -36
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +82 -0
- package/dist/types/model/types.d.cts.map +1 -0
- package/dist/types/model/types.d.ts +66 -61
- package/dist/types/model/types.d.ts.map +1 -0
- package/dist/types/model/types.js +29 -37
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.cts +19 -0
- package/dist/types/model/uid.d.cts.map +1 -0
- package/dist/types/model/uid.d.ts +13 -7
- package/dist/types/model/uid.d.ts.map +1 -0
- package/dist/types/value/boolean.d.cts +10 -0
- package/dist/types/value/boolean.d.cts.map +1 -0
- package/dist/types/value/boolean.d.ts +5 -1
- package/dist/types/value/boolean.d.ts.map +1 -0
- package/dist/types/value/color.d.cts +15 -0
- package/dist/types/value/color.d.cts.map +1 -0
- package/dist/types/value/color.d.ts +8 -2
- package/dist/types/value/color.d.ts.map +1 -0
- package/dist/types/value/contentRelationship.d.cts +37 -0
- package/dist/types/value/contentRelationship.d.cts.map +1 -0
- package/dist/types/value/contentRelationship.d.ts +23 -17
- package/dist/types/value/contentRelationship.d.ts.map +1 -0
- package/dist/types/value/date.d.cts +15 -0
- package/dist/types/value/date.d.cts.map +1 -0
- package/dist/types/value/date.d.ts +8 -2
- package/dist/types/value/date.d.ts.map +1 -0
- package/dist/types/value/document.d.cts +120 -0
- package/dist/types/value/document.d.cts.map +1 -0
- package/dist/types/value/document.d.ts +90 -84
- package/dist/types/value/document.d.ts.map +1 -0
- package/dist/types/value/embed.cjs +14 -7
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +173 -0
- package/dist/types/value/embed.d.cts.map +1 -0
- package/dist/types/value/embed.d.ts +110 -105
- package/dist/types/value/embed.d.ts.map +1 -0
- package/dist/types/value/embed.js +14 -8
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +18 -0
- package/dist/types/value/geoPoint.d.cts.map +1 -0
- package/dist/types/value/geoPoint.d.ts +10 -4
- package/dist/types/value/geoPoint.d.ts.map +1 -0
- package/dist/types/value/group.d.cts +19 -0
- package/dist/types/value/group.d.cts.map +1 -0
- package/dist/types/value/group.d.ts +9 -3
- package/dist/types/value/group.d.ts.map +1 -0
- package/dist/types/value/image.d.cts +53 -0
- package/dist/types/value/image.d.cts.map +1 -0
- package/dist/types/value/image.d.ts +31 -25
- package/dist/types/value/image.d.ts.map +1 -0
- package/dist/types/value/integration.d.cts +22 -0
- package/dist/types/value/integration.d.cts.map +1 -0
- package/dist/types/value/integration.d.ts +9 -3
- package/dist/types/value/integration.d.ts.map +1 -0
- package/dist/types/value/keyText.d.cts +15 -0
- package/dist/types/value/keyText.d.cts.map +1 -0
- package/dist/types/value/keyText.d.ts +8 -2
- package/dist/types/value/keyText.d.ts.map +1 -0
- package/dist/types/value/link.cjs +12 -7
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +74 -0
- package/dist/types/value/link.d.cts.map +1 -0
- package/dist/types/value/link.d.ts +27 -21
- package/dist/types/value/link.d.ts.map +1 -0
- package/dist/types/value/link.js +12 -8
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts +33 -0
- package/dist/types/value/linkToMedia.d.cts.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +19 -14
- package/dist/types/value/linkToMedia.d.ts.map +1 -0
- package/dist/types/value/number.d.cts +15 -0
- package/dist/types/value/number.d.cts.map +1 -0
- package/dist/types/value/number.d.ts +8 -2
- package/dist/types/value/number.d.ts.map +1 -0
- package/dist/types/value/richText.cjs +29 -22
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.cts +221 -0
- package/dist/types/value/richText.d.cts.map +1 -0
- package/dist/types/value/richText.d.ts +103 -97
- package/dist/types/value/richText.d.ts.map +1 -0
- package/dist/types/value/richText.js +29 -23
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.cts +16 -0
- package/dist/types/value/select.d.cts.map +1 -0
- package/dist/types/value/select.d.ts +8 -2
- package/dist/types/value/select.d.ts.map +1 -0
- package/dist/types/value/sharedSlice.d.cts +17 -0
- package/dist/types/value/sharedSlice.d.cts.map +1 -0
- package/dist/types/value/sharedSlice.d.ts +11 -5
- package/dist/types/value/sharedSlice.d.ts.map +1 -0
- package/dist/types/value/sharedSliceVariation.d.cts +16 -0
- package/dist/types/value/sharedSliceVariation.d.cts.map +1 -0
- package/dist/types/value/sharedSliceVariation.d.ts +12 -6
- package/dist/types/value/sharedSliceVariation.d.ts.map +1 -0
- package/dist/types/value/slice.d.cts +19 -0
- package/dist/types/value/slice.d.cts.map +1 -0
- package/dist/types/value/slice.d.ts +13 -7
- package/dist/types/value/slice.d.ts.map +1 -0
- package/dist/types/value/sliceZone.d.cts +18 -0
- package/dist/types/value/sliceZone.d.cts.map +1 -0
- package/dist/types/value/sliceZone.d.ts +10 -4
- package/dist/types/value/sliceZone.d.ts.map +1 -0
- package/dist/types/value/table.d.cts +97 -0
- package/dist/types/value/table.d.cts.map +1 -0
- package/dist/types/value/table.d.ts +65 -59
- package/dist/types/value/table.d.ts.map +1 -0
- package/dist/types/value/timestamp.d.cts +13 -0
- package/dist/types/value/timestamp.d.cts.map +1 -0
- package/dist/types/value/timestamp.d.ts +8 -3
- package/dist/types/value/timestamp.d.ts.map +1 -0
- package/dist/types/value/title.d.cts +16 -0
- package/dist/types/value/title.d.cts.map +1 -0
- package/dist/types/value/title.d.ts +11 -7
- package/dist/types/value/title.d.ts.map +1 -0
- package/dist/types/value/types.d.cts +61 -0
- package/dist/types/value/types.d.cts.map +1 -0
- package/dist/types/value/types.d.ts +31 -28
- package/dist/types/value/types.d.ts.map +1 -0
- package/dist/types/webhook/apiUpdate.d.cts +57 -0
- package/dist/types/webhook/apiUpdate.d.cts.map +1 -0
- package/dist/types/webhook/apiUpdate.d.ts +28 -23
- package/dist/types/webhook/apiUpdate.d.ts.map +1 -0
- package/dist/types/webhook/testTrigger.d.cts +15 -0
- package/dist/types/webhook/testTrigger.d.cts.map +1 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -3
- package/dist/types/webhook/testTrigger.d.ts.map +1 -0
- package/dist/types/webhook/types.cjs +12 -5
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.cts +23 -0
- package/dist/types/webhook/types.d.cts.map +1 -0
- package/dist/types/webhook/types.d.ts +16 -11
- package/dist/types/webhook/types.d.ts.map +1 -0
- package/dist/types/webhook/types.js +12 -6
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +20 -49
- package/src/Client.ts +682 -1028
- package/src/WriteClient.ts +44 -46
- package/src/buildQueryURL.ts +41 -39
- package/src/createClient.ts +11 -8
- package/src/errors.ts +94 -0
- package/src/getGraphQLEndpoint.ts +1 -1
- package/src/getRepositoryEndpoint.ts +10 -3
- package/src/getRepositoryName.ts +1 -1
- package/src/getToolbarSrc.ts +1 -1
- package/src/helpers/asDate.ts +11 -4
- package/src/helpers/asHTML.ts +38 -30
- package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
- package/src/helpers/asImageSrc.ts +11 -10
- package/src/helpers/asImageWidthSrcSet.ts +19 -22
- package/src/helpers/asLink.ts +33 -35
- package/src/helpers/asLinkAttrs.ts +6 -13
- package/src/helpers/asText.ts +20 -10
- package/src/helpers/isFilled.ts +15 -14
- package/src/helpers/mapSliceZone.ts +15 -15
- package/src/index.ts +13 -10
- package/src/isRepositoryEndpoint.ts +2 -2
- package/src/lib/isValue.ts +0 -6
- package/src/lib/pLimit.ts +1 -1
- package/src/lib/request.ts +3 -3
- package/src/lib/{throttledLog.ts → throttledWarn.ts} +3 -14
- package/src/lib/validateAssetMetadata.ts +1 -1
- package/src/richtext/asText.ts +5 -5
- package/src/richtext/serialize.ts +8 -8
- package/src/richtext/types.ts +6 -6
- package/src/types/migration/Asset.ts +10 -2
- package/src/types/migration/Document.ts +1 -1
- package/src/types/model/contentRelationship.ts +1 -0
- package/src/types/model/types.ts +0 -2
- package/src/types/value/date.ts +1 -1
- package/src/types/value/document.ts +3 -3
- package/src/types/value/timestamp.ts +1 -5
- package/dist/errors/ForbiddenError.cjs +0 -7
- package/dist/errors/ForbiddenError.cjs.map +0 -1
- package/dist/errors/ForbiddenError.d.ts +0 -11
- package/dist/errors/ForbiddenError.js +0 -7
- package/dist/errors/ForbiddenError.js.map +0 -1
- package/dist/errors/InvalidDataError.cjs +0 -7
- package/dist/errors/InvalidDataError.cjs.map +0 -1
- package/dist/errors/InvalidDataError.d.ts +0 -3
- package/dist/errors/InvalidDataError.js +0 -7
- package/dist/errors/InvalidDataError.js.map +0 -1
- package/dist/errors/NotFoundError.cjs +0 -7
- package/dist/errors/NotFoundError.cjs.map +0 -1
- package/dist/errors/NotFoundError.d.ts +0 -3
- package/dist/errors/NotFoundError.js +0 -7
- package/dist/errors/NotFoundError.js.map +0 -1
- package/dist/errors/ParsingError.cjs +0 -7
- package/dist/errors/ParsingError.cjs.map +0 -1
- package/dist/errors/ParsingError.d.ts +0 -14
- package/dist/errors/ParsingError.js +0 -7
- package/dist/errors/ParsingError.js.map +0 -1
- package/dist/errors/PreviewTokenExpired.cjs +0 -7
- package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
- package/dist/errors/PreviewTokenExpired.d.ts +0 -8
- package/dist/errors/PreviewTokenExpired.js +0 -7
- package/dist/errors/PreviewTokenExpired.js.map +0 -1
- package/dist/errors/PrismicError.cjs +0 -16
- package/dist/errors/PrismicError.cjs.map +0 -1
- package/dist/errors/PrismicError.d.ts +0 -5
- package/dist/errors/PrismicError.js +0 -16
- package/dist/errors/PrismicError.js.map +0 -1
- package/dist/errors/RefExpiredError.cjs +0 -7
- package/dist/errors/RefExpiredError.cjs.map +0 -1
- package/dist/errors/RefExpiredError.d.ts +0 -8
- package/dist/errors/RefExpiredError.js +0 -7
- package/dist/errors/RefExpiredError.js.map +0 -1
- package/dist/errors/RefNotFoundError.cjs +0 -7
- package/dist/errors/RefNotFoundError.cjs.map +0 -1
- package/dist/errors/RefNotFoundError.d.ts +0 -8
- package/dist/errors/RefNotFoundError.js +0 -7
- package/dist/errors/RefNotFoundError.js.map +0 -1
- package/dist/errors/RepositoryNotFoundError.cjs +0 -7
- package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
- package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
- package/dist/errors/RepositoryNotFoundError.js +0 -7
- package/dist/errors/RepositoryNotFoundError.js.map +0 -1
- package/dist/lib/appendFilters.cjs +0 -11
- package/dist/lib/appendFilters.cjs.map +0 -1
- package/dist/lib/appendFilters.d.ts +0 -18
- package/dist/lib/appendFilters.js +0 -11
- package/dist/lib/appendFilters.js.map +0 -1
- package/dist/lib/castArray.cjs +0 -7
- package/dist/lib/castArray.cjs.map +0 -1
- package/dist/lib/castArray.d.ts +0 -12
- package/dist/lib/castArray.js +0 -7
- package/dist/lib/castArray.js.map +0 -1
- package/dist/lib/castThunk.cjs +0 -7
- package/dist/lib/castThunk.cjs.map +0 -1
- package/dist/lib/castThunk.d.ts +0 -11
- package/dist/lib/castThunk.js +0 -7
- package/dist/lib/castThunk.js.map +0 -1
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/escapeHTML.d.ts +0 -1
- package/dist/lib/everyTagFilter.cjs +0 -9
- package/dist/lib/everyTagFilter.cjs.map +0 -1
- package/dist/lib/everyTagFilter.d.ts +0 -9
- package/dist/lib/everyTagFilter.js +0 -9
- package/dist/lib/everyTagFilter.js.map +0 -1
- package/dist/lib/findMasterRef.cjs +0 -8
- package/dist/lib/findMasterRef.cjs.map +0 -1
- package/dist/lib/findMasterRef.d.ts +0 -11
- package/dist/lib/findMasterRef.js +0 -8
- package/dist/lib/findMasterRef.js.map +0 -1
- package/dist/lib/findRef.cjs +0 -12
- package/dist/lib/findRef.cjs.map +0 -1
- package/dist/lib/findRef.d.ts +0 -14
- package/dist/lib/findRef.js +0 -12
- package/dist/lib/findRef.js.map +0 -1
- package/dist/lib/findRefByID.cjs +0 -8
- package/dist/lib/findRefByID.cjs.map +0 -1
- package/dist/lib/findRefByID.d.ts +0 -12
- package/dist/lib/findRefByID.js +0 -8
- package/dist/lib/findRefByID.js.map +0 -1
- package/dist/lib/findRefByLabel.cjs +0 -8
- package/dist/lib/findRefByLabel.cjs.map +0 -1
- package/dist/lib/findRefByLabel.d.ts +0 -12
- package/dist/lib/findRefByLabel.js +0 -8
- package/dist/lib/findRefByLabel.js.map +0 -1
- package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
- package/dist/lib/getPreviewCookie.d.ts +0 -9
- package/dist/lib/isInternalURL.d.ts +0 -8
- package/dist/lib/isMigrationValue.d.ts +0 -71
- package/dist/lib/isValue.d.ts +0 -78
- package/dist/lib/minifyGraphQLQuery.cjs +0 -7
- package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
- package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
- package/dist/lib/minifyGraphQLQuery.js +0 -7
- package/dist/lib/minifyGraphQLQuery.js.map +0 -1
- package/dist/lib/pLimit.d.ts +0 -22
- package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
- package/dist/lib/serializerHelpers.d.ts +0 -9
- package/dist/lib/someTagsFilter.cjs +0 -9
- package/dist/lib/someTagsFilter.cjs.map +0 -1
- package/dist/lib/someTagsFilter.d.ts +0 -9
- package/dist/lib/someTagsFilter.js +0 -9
- package/dist/lib/someTagsFilter.js.map +0 -1
- package/dist/lib/throttledLog.cjs +0 -17
- package/dist/lib/throttledLog.cjs.map +0 -1
- package/dist/lib/throttledLog.d.ts +0 -15
- package/dist/lib/throttledLog.js +0 -17
- package/dist/lib/throttledLog.js.map +0 -1
- package/dist/lib/typeFilter.cjs +0 -8
- package/dist/lib/typeFilter.cjs.map +0 -1
- package/dist/lib/typeFilter.d.ts +0 -8
- package/dist/lib/typeFilter.js +0 -8
- package/dist/lib/typeFilter.js.map +0 -1
- package/dist/lib/validateAssetMetadata.d.ts +0 -10
- package/dist/package.json.cjs +0 -7
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -7
- package/dist/package.json.js.map +0 -1
- package/dist/richtext/index.d.ts +0 -7
- package/dist/richtext.cjs.map +0 -1
- package/dist/richtext.js.map +0 -1
- package/dist/types/api/migration/document.d.ts +0 -60
- package/dist/types/migration/Link.d.ts +0 -19
- package/src/errors/ForbiddenError.ts +0 -16
- package/src/errors/InvalidDataError.ts +0 -5
- package/src/errors/NotFoundError.ts +0 -5
- package/src/errors/ParsingError.ts +0 -16
- package/src/errors/PreviewTokenExpired.ts +0 -12
- package/src/errors/PrismicError.ts +0 -15
- package/src/errors/RefExpiredError.ts +0 -14
- package/src/errors/RefNotFoundError.ts +0 -14
- package/src/errors/RepositoryNotFoundError.ts +0 -5
- package/src/lib/appendFilters.ts +0 -26
- package/src/lib/castArray.ts +0 -14
- package/src/lib/castThunk.ts +0 -13
- package/src/lib/everyTagFilter.ts +0 -15
- package/src/lib/findMasterRef.ts +0 -16
- package/src/lib/findRef.ts +0 -25
- package/src/lib/findRefByID.ts +0 -17
- package/src/lib/findRefByLabel.ts +0 -17
- package/src/lib/minifyGraphQLQuery.ts +0 -13
- package/src/lib/someTagsFilter.ts +0 -15
- package/src/lib/typeFilter.ts +0 -12
package/dist/Client.d.ts
CHANGED
|
@@ -1,981 +1,704 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { PrismicDocument } from "./types/value/document.js";
|
|
2
|
+
import { LinkResolverFunction } from "./helpers/asLink.js";
|
|
3
|
+
import { AbortSignalLike, FetchLike, RequestInitLike } from "./lib/request.js";
|
|
4
|
+
import { Query } from "./types/api/query.js";
|
|
5
|
+
import { Ref } from "./types/api/ref.js";
|
|
6
|
+
import { Repository } from "./types/api/repository.js";
|
|
7
|
+
import { BuildQueryURLArgs } from "./buildQueryURL.js";
|
|
8
|
+
|
|
9
|
+
//#region src/Client.d.ts
|
|
10
|
+
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* updated in the Prismic repository. As such, repository's metadata can only be
|
|
12
|
-
* considered valid for a short amount of time.
|
|
13
|
-
*/
|
|
14
|
-
export declare const REPOSITORY_CACHE_TTL = 5000;
|
|
15
|
-
/**
|
|
16
|
-
* The number of milliseconds in which a multi-page `getAll` (e.g. `getAll`,
|
|
17
|
-
* `getAllByType`, `getAllByTag`) will wait between individual page requests.
|
|
18
|
-
*
|
|
19
|
-
* This is done to ensure API performance is sustainable and reduces the chance
|
|
20
|
-
* of a failed API request due to overloading.
|
|
21
|
-
*/
|
|
22
|
-
export declare const GET_ALL_QUERY_DELAY = 500;
|
|
23
|
-
/**
|
|
24
|
-
* Extracts one or more Prismic document types that match a given Prismic
|
|
25
|
-
* document type. If no matches are found, no extraction is performed and the
|
|
26
|
-
* union of all provided Prismic document types are returned.
|
|
27
|
-
*
|
|
28
|
-
* @typeParam TDocuments - Prismic document types from which to extract.
|
|
29
|
-
* @typeParam TDocumentType - Type(s) to match `TDocuments` against.
|
|
12
|
+
* Extracts a document type with a matching `type` property from a union of
|
|
13
|
+
* document types.
|
|
30
14
|
*/
|
|
31
15
|
type ExtractDocumentType<TDocuments extends PrismicDocument, TDocumentType extends TDocuments["type"]> = Extract<TDocuments, {
|
|
32
|
-
|
|
16
|
+
type: TDocumentType;
|
|
33
17
|
}> extends never ? TDocuments : Extract<TDocuments, {
|
|
34
|
-
|
|
18
|
+
type: TDocumentType;
|
|
35
19
|
}>;
|
|
36
20
|
/**
|
|
37
21
|
* The minimum required properties to treat as an HTTP Request for automatic
|
|
38
22
|
* Prismic preview support.
|
|
39
23
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
| {
|
|
54
|
-
headers?: {
|
|
55
|
-
cookie?: string;
|
|
56
|
-
};
|
|
57
|
-
query?: Record<string, unknown>;
|
|
24
|
+
type HttpRequestLike =
|
|
25
|
+
// Web API Request
|
|
26
|
+
{
|
|
27
|
+
headers?: {
|
|
28
|
+
get(name: string): string | null;
|
|
29
|
+
};
|
|
30
|
+
url?: string;
|
|
31
|
+
} | {
|
|
32
|
+
headers?: {
|
|
33
|
+
cookie?: string;
|
|
34
|
+
};
|
|
35
|
+
query?: Record<string, unknown>;
|
|
58
36
|
};
|
|
59
37
|
/**
|
|
60
|
-
* A
|
|
61
|
-
*
|
|
62
|
-
* function can optionally be asynchronous.
|
|
63
|
-
*/
|
|
64
|
-
type RefStringOrThunk = string | (() => string | undefined | Promise<string | undefined>);
|
|
65
|
-
/**
|
|
66
|
-
* Parameters for any client method that use `fetch()`.
|
|
38
|
+
* A function that returns a ref string. Used to configure which ref the client
|
|
39
|
+
* queries content from.
|
|
67
40
|
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* @deprecated Move the `signal` parameter into `fetchOptions.signal`:
|
|
80
|
-
*
|
|
81
|
-
* @see \<https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal\>
|
|
82
|
-
*/
|
|
83
|
-
signal?: AbortSignalLike;
|
|
41
|
+
type GetRef = (params?: Pick<BuildQueryURLArgs, "accessToken"> & FetchParams) => string | undefined | Promise<string | undefined>;
|
|
42
|
+
/** Parameters for client methods that use `fetch()`. */
|
|
43
|
+
type FetchParams = {
|
|
44
|
+
/**
|
|
45
|
+
* Options provided to the client's `fetch()` on all network requests. These
|
|
46
|
+
* options will be merged with internally required options. They can also be
|
|
47
|
+
* overriden on a per-query basis using the query's `fetchOptions` parameter.
|
|
48
|
+
*/
|
|
49
|
+
fetchOptions?: RequestInitLike;
|
|
50
|
+
/** @deprecated Move to `fetchOptions.signal`: */
|
|
51
|
+
signal?: AbortSignalLike;
|
|
84
52
|
};
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
53
|
+
/** Prismic client configuration. */
|
|
54
|
+
type ClientConfig = {
|
|
55
|
+
/**
|
|
56
|
+
* The client's Content API endpoint.
|
|
57
|
+
*
|
|
58
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
59
|
+
*/
|
|
60
|
+
documentAPIEndpoint?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The secure token used for the Content API.
|
|
63
|
+
*
|
|
64
|
+
* @see {@link https://prismic.io/docs/fetch-content#content-visibility}
|
|
65
|
+
*/
|
|
66
|
+
accessToken?: string;
|
|
67
|
+
/**
|
|
68
|
+
* The version of the repository's content. It can optionally be a function
|
|
69
|
+
* that returns a ref.
|
|
70
|
+
*
|
|
71
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
72
|
+
*/
|
|
73
|
+
ref?: string | GetRef;
|
|
74
|
+
/**
|
|
75
|
+
* A list of route resolver objects that define how a document's `url`
|
|
76
|
+
* property is resolved.
|
|
77
|
+
*
|
|
78
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
79
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
80
|
+
*/
|
|
81
|
+
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
82
|
+
/**
|
|
83
|
+
* The URL used for link or content relationship fields that point to an
|
|
84
|
+
* archived or deleted page.
|
|
85
|
+
*
|
|
86
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
87
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
88
|
+
*/
|
|
89
|
+
brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
|
|
90
|
+
/**
|
|
91
|
+
* Default parameters sent with each Content API request. These parameters can
|
|
92
|
+
* be overridden on each method.
|
|
93
|
+
*
|
|
94
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
95
|
+
*/
|
|
96
|
+
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes" | "brokenRoute">;
|
|
97
|
+
/**
|
|
98
|
+
* The `fetch` function used to make network requests.
|
|
99
|
+
*
|
|
100
|
+
* @default The global `fetch` function.
|
|
101
|
+
*
|
|
102
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
103
|
+
*/
|
|
104
|
+
fetch?: FetchLike;
|
|
105
|
+
/**
|
|
106
|
+
* The default `fetch` options sent with each Content API request. These
|
|
107
|
+
* parameters can be overriden on each method.
|
|
108
|
+
*
|
|
109
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
110
|
+
*/
|
|
111
|
+
fetchOptions?: RequestInitLike;
|
|
140
112
|
};
|
|
141
113
|
/**
|
|
142
114
|
* Parameters specific to client methods that fetch all documents. These methods
|
|
143
|
-
* start with `getAll` (
|
|
115
|
+
* start with `getAll` (e.g. `getAllByType`).
|
|
144
116
|
*/
|
|
145
117
|
type GetAllParams = {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Limit the number of documents queried.
|
|
120
|
+
*
|
|
121
|
+
* @default No limit.
|
|
122
|
+
*/
|
|
123
|
+
limit?: number;
|
|
151
124
|
};
|
|
152
125
|
/**
|
|
153
|
-
*
|
|
126
|
+
* A client for fetching content from a Prismic repository.
|
|
127
|
+
*
|
|
128
|
+
* @see {@link https://prismic.io/docs/fetch-content}
|
|
129
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client}
|
|
154
130
|
*/
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
131
|
+
declare class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
132
|
+
#private;
|
|
133
|
+
/**
|
|
134
|
+
* The client's Content API endpoint.
|
|
135
|
+
*
|
|
136
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
137
|
+
*/
|
|
138
|
+
documentAPIEndpoint: string;
|
|
139
|
+
/**
|
|
140
|
+
* The secure token used for the Content API.
|
|
141
|
+
*
|
|
142
|
+
* @see {@link https://prismic.io/docs/fetch-content#content-visibility}
|
|
143
|
+
*/
|
|
144
|
+
accessToken?: string;
|
|
145
|
+
/**
|
|
146
|
+
* A list of route resolver objects that define how a document's `url`
|
|
147
|
+
* property is resolved.
|
|
148
|
+
*
|
|
149
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
150
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
151
|
+
*/
|
|
152
|
+
routes?: NonNullable<BuildQueryURLArgs["routes"]>;
|
|
153
|
+
/**
|
|
154
|
+
* The URL used for link or content relationship fields that point to an
|
|
155
|
+
* archived or deleted page.
|
|
156
|
+
*
|
|
157
|
+
* @see {@link https://prismic.io/docs/routes}
|
|
158
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
159
|
+
*/
|
|
160
|
+
brokenRoute?: NonNullable<BuildQueryURLArgs["brokenRoute"]>;
|
|
161
|
+
/**
|
|
162
|
+
* Default parameters sent with each Content API request. These parameters can
|
|
163
|
+
* be overridden on each method.
|
|
164
|
+
*
|
|
165
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
166
|
+
*/
|
|
167
|
+
defaultParams?: Omit<BuildQueryURLArgs, "ref" | "integrationFieldsRef" | "accessToken" | "routes">;
|
|
168
|
+
/**
|
|
169
|
+
* The `fetch` function used to make network requests.
|
|
170
|
+
*
|
|
171
|
+
* @default The global `fetch` function.
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
174
|
+
*/
|
|
175
|
+
fetchFn: FetchLike;
|
|
176
|
+
/**
|
|
177
|
+
* The default `fetch` options sent with each Content API request. These
|
|
178
|
+
* parameters can be overriden on each method.
|
|
179
|
+
*
|
|
180
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#config-options}
|
|
181
|
+
*/
|
|
182
|
+
fetchOptions: RequestInitLike;
|
|
183
|
+
/**
|
|
184
|
+
* @param repositoryNameOrEndpoint - The Prismic repository name or full
|
|
185
|
+
* Content API endpoint for the repository.
|
|
186
|
+
* @param config - Client configuration.
|
|
187
|
+
*/
|
|
188
|
+
constructor(repositoryNameOrEndpoint: string, config?: ClientConfig);
|
|
189
|
+
/** The Prismic repository's name. */
|
|
190
|
+
set repositoryName(value: string);
|
|
191
|
+
/** The Prismic repository's name. */
|
|
192
|
+
get repositoryName(): string;
|
|
193
|
+
/** @deprecated Replace with `documentAPIEndpoint`. */
|
|
194
|
+
set endpoint(value: string);
|
|
195
|
+
/** @deprecated Replace with `documentAPIEndpoint`. */
|
|
196
|
+
get endpoint(): string;
|
|
197
|
+
/**
|
|
198
|
+
* Enables the client to automatically query content from a preview session.
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
*
|
|
202
|
+
* ```ts
|
|
203
|
+
* client.enableAutoPreviews()
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviews}
|
|
207
|
+
*/
|
|
208
|
+
enableAutoPreviews(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Enables the client to automatically query content from a preview session
|
|
211
|
+
* using an HTTP request object.
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
*
|
|
215
|
+
* ```ts
|
|
216
|
+
* client.enableAutoPreviewsFromReq(req)
|
|
217
|
+
* ```
|
|
218
|
+
*
|
|
219
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#enableautopreviewsfromreq}
|
|
220
|
+
*/
|
|
221
|
+
enableAutoPreviewsFromReq(request: HttpRequestLike): void;
|
|
222
|
+
/**
|
|
223
|
+
* Disables the client from automatically querying content from a preview
|
|
224
|
+
* session.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
*
|
|
228
|
+
* ```ts
|
|
229
|
+
* client.disableAutoPreviews()
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#disableautopreviews}
|
|
233
|
+
*/
|
|
234
|
+
disableAutoPreviews(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Fetches pages based on the `params` argument. Results are paginated.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
*
|
|
240
|
+
* ```ts
|
|
241
|
+
* const response = await client.get({ pageSize: 10 })
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#get}
|
|
245
|
+
*/
|
|
246
|
+
get<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
247
|
+
/**
|
|
248
|
+
* Fetches the first page returned based on the `params` argument.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
*
|
|
252
|
+
* ```ts
|
|
253
|
+
* const page = await client.getFirst()
|
|
254
|
+
* ```
|
|
255
|
+
*
|
|
256
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getfirst}
|
|
257
|
+
*/
|
|
258
|
+
getFirst<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
259
|
+
/**
|
|
260
|
+
* Fetches all pages based on the `params` argument. This method may make
|
|
261
|
+
* multiple network requests to fetch all matching pages.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
*
|
|
265
|
+
* ```ts
|
|
266
|
+
* const pages = await client.dangerouslyGetAll()
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#dangerouslygetall}
|
|
270
|
+
*/
|
|
271
|
+
dangerouslyGetAll<TDocument extends TDocuments>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
272
|
+
/**
|
|
273
|
+
* Fetches a page with a specific ID.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
*
|
|
277
|
+
* ```ts
|
|
278
|
+
* const page = await client.getByID("WW4bKScAAMAqmluX")
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
281
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyid}
|
|
282
|
+
*/
|
|
283
|
+
getByID<TDocument extends TDocuments>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
284
|
+
/**
|
|
285
|
+
* Fetches pages with specific IDs. Results are paginated.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
*
|
|
289
|
+
* ```ts
|
|
290
|
+
* const response = await client.getByIDs([
|
|
291
|
+
* "WW4bKScAAMAqmluX",
|
|
292
|
+
* "U1kTRgEAAC8A5ldS",
|
|
293
|
+
* ])
|
|
294
|
+
* ```
|
|
295
|
+
*
|
|
296
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyids}
|
|
297
|
+
*/
|
|
298
|
+
getByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
299
|
+
/**
|
|
300
|
+
* Fetches pages with specific IDs. This method may make multiple network
|
|
301
|
+
* requests to fetch all matching pages.
|
|
302
|
+
*
|
|
303
|
+
* @example
|
|
304
|
+
*
|
|
305
|
+
* ```ts
|
|
306
|
+
* const pages = await client.getAllByIDs([
|
|
307
|
+
* "WW4bKScAAMAqmluX",
|
|
308
|
+
* "U1kTRgEAAC8A5ldS",
|
|
309
|
+
* ])
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyids}
|
|
313
|
+
*/
|
|
314
|
+
getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
315
|
+
/**
|
|
316
|
+
* Fetches a page with a specific UID and type.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
*
|
|
320
|
+
* ```ts
|
|
321
|
+
* const page = await client.getByUID("blog_post", "my-first-post")
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuid}
|
|
325
|
+
*/
|
|
326
|
+
getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
327
|
+
/**
|
|
328
|
+
* Fetches pages with specific UIDs and a specific type. Results are
|
|
329
|
+
* paginated.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
*
|
|
333
|
+
* ```ts
|
|
334
|
+
* const response = await client.getByUIDs("blog_post", [
|
|
335
|
+
* "my-first-post",
|
|
336
|
+
* "my-second-post",
|
|
337
|
+
* ])
|
|
338
|
+
* ```
|
|
339
|
+
*
|
|
340
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyuids}
|
|
341
|
+
*/
|
|
342
|
+
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
343
|
+
/**
|
|
344
|
+
* Fetches pages with specific UIDs and a specific type. This method may make
|
|
345
|
+
* multiple network requests to fetch all matching pages.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
*
|
|
349
|
+
* ```ts
|
|
350
|
+
* const pages = await client.getAllByUIDs("blog_post", [
|
|
351
|
+
* "my-first-post",
|
|
352
|
+
* "my-second-post",
|
|
353
|
+
* ])
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyuids}
|
|
357
|
+
*/
|
|
358
|
+
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
359
|
+
/**
|
|
360
|
+
* Fetches a specific single type page.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
*
|
|
364
|
+
* ```ts
|
|
365
|
+
* const page = await client.getSingle("settings")
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getsingle}
|
|
369
|
+
*/
|
|
370
|
+
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
371
|
+
/**
|
|
372
|
+
* Fetches pages with a specific type. Results are paginated.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
*
|
|
376
|
+
* ```ts
|
|
377
|
+
* const response = await client.getByType("blog_post")
|
|
378
|
+
* ```
|
|
379
|
+
*
|
|
380
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytype}
|
|
381
|
+
*/
|
|
382
|
+
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
383
|
+
/**
|
|
384
|
+
* Fetches pages with a specific type. This method may make multiple network
|
|
385
|
+
* requests to fetch all matching documents.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
*
|
|
389
|
+
* ```ts
|
|
390
|
+
* const pages = await client.getAllByType("blog_post")
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
393
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytype}
|
|
394
|
+
*/
|
|
395
|
+
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
396
|
+
/**
|
|
397
|
+
* Fetches pages with a specific tag. Results are paginated.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
*
|
|
401
|
+
* ```ts
|
|
402
|
+
* const response = await client.getByTag("featured")
|
|
403
|
+
* ```
|
|
404
|
+
*
|
|
405
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbytag}
|
|
406
|
+
*/
|
|
407
|
+
getByTag<TDocument extends TDocuments>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
408
|
+
/**
|
|
409
|
+
* Fetches pages with a specific tag. This method may make multiple network
|
|
410
|
+
* requests to fetch all matching documents.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
*
|
|
414
|
+
* ```ts
|
|
415
|
+
* const pages = await client.getAllByTag("featured")
|
|
416
|
+
* ```
|
|
417
|
+
*
|
|
418
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbytag}
|
|
419
|
+
*/
|
|
420
|
+
getAllByTag<TDocument extends TDocuments>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
421
|
+
/**
|
|
422
|
+
* Fetches pages with every tag from a list of tags. Results are paginated.
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
*
|
|
426
|
+
* ```ts
|
|
427
|
+
* const response = await client.getByEveryTag(["featured", "homepage"])
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbyeverytag}
|
|
431
|
+
*/
|
|
432
|
+
getByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
433
|
+
/**
|
|
434
|
+
* Fetches pages with every tag from a list of tags. This method may make
|
|
435
|
+
* multiple network requests to fetch all matching pages.
|
|
436
|
+
*
|
|
437
|
+
* @example
|
|
438
|
+
*
|
|
439
|
+
* ```ts
|
|
440
|
+
* const pages = await client.getAllByEveryTag(["featured", "homepage"])
|
|
441
|
+
* ```
|
|
442
|
+
*
|
|
443
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbyeverytag}
|
|
444
|
+
*/
|
|
445
|
+
getAllByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
446
|
+
/**
|
|
447
|
+
* Fetches pages with at least one tag from a list of tags. Results are
|
|
448
|
+
* paginated.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
*
|
|
452
|
+
* ```ts
|
|
453
|
+
* const response = await client.getBySomeTags(["featured", "homepage"])
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getbysometags}
|
|
457
|
+
*/
|
|
458
|
+
getBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
459
|
+
/**
|
|
460
|
+
* Fetches pages with at least one tag from a list of tags. This method may
|
|
461
|
+
* make multiple network requests to fetch all matching documents.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
*
|
|
465
|
+
* ```ts
|
|
466
|
+
* const pages = await client.getAllBySomeTags(["featured", "homepage"])
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getallbysometags}
|
|
470
|
+
*/
|
|
471
|
+
getAllBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
472
|
+
/**
|
|
473
|
+
* Fetches metadata about the client's Prismic repository.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
*
|
|
477
|
+
* ```ts
|
|
478
|
+
* const repository = await client.getRepository()
|
|
479
|
+
* ```
|
|
480
|
+
*
|
|
481
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrepository}
|
|
482
|
+
*/
|
|
483
|
+
getRepository(params?: Pick<BuildQueryURLArgs, "accessToken"> & FetchParams): Promise<Repository>;
|
|
484
|
+
/**
|
|
485
|
+
* Fetches the repository's active refs.
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
*
|
|
489
|
+
* ```ts
|
|
490
|
+
* const refs = await client.getRefs()
|
|
491
|
+
* ```
|
|
492
|
+
*
|
|
493
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefs}
|
|
494
|
+
*/
|
|
495
|
+
getRefs(params?: FetchParams): Promise<Ref[]>;
|
|
496
|
+
/**
|
|
497
|
+
* Fetches a ref by its ID.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
*
|
|
501
|
+
* ```ts
|
|
502
|
+
* const ref = await client.getRefByID("YhE3YhEAACIA4321")
|
|
503
|
+
* ```
|
|
504
|
+
*
|
|
505
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbyid}
|
|
506
|
+
*/
|
|
507
|
+
getRefByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
508
|
+
/**
|
|
509
|
+
* Fetches a ref by its label. A release ref's label is its name shown in the
|
|
510
|
+
* Page Builder.
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
*
|
|
514
|
+
* ```ts
|
|
515
|
+
* const ref = await client.getRefByLabel("My Release")
|
|
516
|
+
* ```
|
|
517
|
+
*
|
|
518
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getrefbylabel}
|
|
519
|
+
*/
|
|
520
|
+
getRefByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
521
|
+
/**
|
|
522
|
+
* Fetches the repository's master ref.
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
*
|
|
526
|
+
* ```ts
|
|
527
|
+
* const masterRef = await client.getMasterRef()
|
|
528
|
+
* ```
|
|
529
|
+
*
|
|
530
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getmasterref}
|
|
531
|
+
*/
|
|
532
|
+
getMasterRef(params?: FetchParams): Promise<Ref>;
|
|
533
|
+
/**
|
|
534
|
+
* Fetches the repository's active releases.
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
*
|
|
538
|
+
* ```ts
|
|
539
|
+
* const releases = await client.getReleases()
|
|
540
|
+
* ```
|
|
541
|
+
*
|
|
542
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleases}
|
|
543
|
+
*/
|
|
544
|
+
getReleases(params?: FetchParams): Promise<Ref[]>;
|
|
545
|
+
/**
|
|
546
|
+
* Fetches a release with a specific ID.
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
*
|
|
550
|
+
* ```ts
|
|
551
|
+
* const release = await client.getReleaseByID("YhE3YhEAACIA4321")
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebyid}
|
|
555
|
+
*/
|
|
556
|
+
getReleaseByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
557
|
+
/**
|
|
558
|
+
* Fetches a release by its label. A release ref's label is its name shown in
|
|
559
|
+
* the Page Builder.
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
*
|
|
563
|
+
* ```ts
|
|
564
|
+
* const release = await client.getReleaseByLabel("My Release")
|
|
565
|
+
* ```
|
|
566
|
+
*
|
|
567
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#getreleasebylabel}
|
|
568
|
+
*/
|
|
569
|
+
getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
570
|
+
/**
|
|
571
|
+
* Fetches the repository's page tags.
|
|
572
|
+
*
|
|
573
|
+
* @example
|
|
574
|
+
*
|
|
575
|
+
* ```ts
|
|
576
|
+
* const tags = await client.getTags()
|
|
577
|
+
* ```
|
|
578
|
+
*
|
|
579
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#gettags}
|
|
580
|
+
*/
|
|
581
|
+
getTags(params?: FetchParams): Promise<string[]>;
|
|
582
|
+
/**
|
|
583
|
+
* Builds a Content API query URL with a set of parameters.
|
|
584
|
+
*
|
|
585
|
+
* @example
|
|
586
|
+
*
|
|
587
|
+
* ```ts
|
|
588
|
+
* const url = await client.buildQueryURL({
|
|
589
|
+
* filters: [filter.at("document.type", "blog_post")],
|
|
590
|
+
* })
|
|
591
|
+
* ```
|
|
592
|
+
*
|
|
593
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#buildqueryurl}
|
|
594
|
+
*/
|
|
595
|
+
buildQueryURL({
|
|
596
|
+
signal,
|
|
597
|
+
fetchOptions,
|
|
598
|
+
...params
|
|
599
|
+
}?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
|
|
600
|
+
/**
|
|
601
|
+
* Fetches a previewed page's URL using a preview token and page ID.
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
*
|
|
605
|
+
* ```ts
|
|
606
|
+
* const url = await client.resolvePreviewURL({
|
|
607
|
+
* linkResolver,
|
|
608
|
+
* defaultURL: "/",
|
|
609
|
+
* })
|
|
610
|
+
* ```
|
|
611
|
+
*
|
|
612
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#resolvepreviewurl}
|
|
613
|
+
*/
|
|
614
|
+
resolvePreviewURL<LinkResolverReturnType>(args: {
|
|
615
|
+
/** A function converts a document to a URL in your website. */
|
|
159
616
|
linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
|
|
160
|
-
/**
|
|
161
|
-
* A fallback URL if the link resolver does not return a value.
|
|
162
|
-
*/
|
|
617
|
+
/** A fallback URL used when the document does not have a URL. */
|
|
163
618
|
defaultURL: string;
|
|
164
|
-
/**
|
|
165
|
-
* The preview token (also known as a ref) that will be used to query preview
|
|
166
|
-
* content from the Prismic repository.
|
|
167
|
-
*/
|
|
619
|
+
/** The preview token for the preview session. */
|
|
168
620
|
previewToken?: string;
|
|
169
|
-
/**
|
|
170
|
-
* The previewed document that will be used to determine the destination URL.
|
|
171
|
-
*/
|
|
621
|
+
/** The previewed document's ID. */
|
|
172
622
|
documentID?: string;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
*/
|
|
252
|
-
private refState;
|
|
253
|
-
/**
|
|
254
|
-
* Cached repository value.
|
|
255
|
-
*/
|
|
256
|
-
private cachedRepository;
|
|
257
|
-
/**
|
|
258
|
-
* Timestamp at which the cached repository data is considered stale.
|
|
259
|
-
*/
|
|
260
|
-
private cachedRepositoryExpiration;
|
|
261
|
-
/**
|
|
262
|
-
* Creates a Prismic client that can be used to query a repository.
|
|
263
|
-
*
|
|
264
|
-
* If used in an environment where a global `fetch` function is unavailable,
|
|
265
|
-
* such as in some Node.js versions, the `fetch` option must be provided as
|
|
266
|
-
* part of the `options` parameter.
|
|
267
|
-
*
|
|
268
|
-
* @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
|
|
269
|
-
* API V2 endpoint for the repository.
|
|
270
|
-
* @param options - Configuration that determines how content will be queried
|
|
271
|
-
* from the Prismic repository.
|
|
272
|
-
*
|
|
273
|
-
* @returns A client that can query content from the repository.
|
|
274
|
-
*/
|
|
275
|
-
constructor(repositoryNameOrEndpoint: string, options?: ClientConfig);
|
|
276
|
-
/**
|
|
277
|
-
* Enables the client to automatically query content from a preview session if
|
|
278
|
-
* one is active in browser environments. This is enabled by default in the
|
|
279
|
-
* browser.
|
|
280
|
-
*
|
|
281
|
-
* For server environments, use `enableAutoPreviewsFromReq`.
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
*
|
|
285
|
-
* ```ts
|
|
286
|
-
* client.enableAutoPreviews()
|
|
287
|
-
* ```
|
|
288
|
-
*
|
|
289
|
-
* @see enableAutoPreviewsFromReq
|
|
290
|
-
*/
|
|
291
|
-
enableAutoPreviews(): void;
|
|
292
|
-
/**
|
|
293
|
-
* Enables the client to automatically query content from a preview session if
|
|
294
|
-
* one is active in server environments. This is disabled by default on the
|
|
295
|
-
* server.
|
|
296
|
-
*
|
|
297
|
-
* For browser environments, use `enableAutoPreviews`.
|
|
298
|
-
*
|
|
299
|
-
* @example
|
|
300
|
-
*
|
|
301
|
-
* ```ts
|
|
302
|
-
* // In an express app
|
|
303
|
-
* app.get("/", function (req, res) {
|
|
304
|
-
* client.enableAutoPreviewsFromReq(req)
|
|
305
|
-
* })
|
|
306
|
-
* ```
|
|
307
|
-
*
|
|
308
|
-
* @param req - An HTTP server request object containing the request's
|
|
309
|
-
* cookies.
|
|
310
|
-
*/
|
|
311
|
-
enableAutoPreviewsFromReq<R extends HttpRequestLike>(req: R): void;
|
|
312
|
-
/**
|
|
313
|
-
* Disables the client from automatically querying content from a preview
|
|
314
|
-
* session if one is active.
|
|
315
|
-
*
|
|
316
|
-
* Automatic preview content querying is enabled by default unless this method
|
|
317
|
-
* is called.
|
|
318
|
-
*
|
|
319
|
-
* @example
|
|
320
|
-
*
|
|
321
|
-
* ```ts
|
|
322
|
-
* client.disableAutoPreviews()
|
|
323
|
-
* ```
|
|
324
|
-
*/
|
|
325
|
-
disableAutoPreviews(): void;
|
|
326
|
-
/**
|
|
327
|
-
* Queries content from the Prismic repository.
|
|
328
|
-
*
|
|
329
|
-
* @example
|
|
330
|
-
*
|
|
331
|
-
* ```ts
|
|
332
|
-
* const response = await client.get()
|
|
333
|
-
* ```
|
|
334
|
-
*
|
|
335
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
336
|
-
*
|
|
337
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
338
|
-
*
|
|
339
|
-
* @returns A paginated response containing the result of the query.
|
|
340
|
-
*/
|
|
341
|
-
get<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
342
|
-
/**
|
|
343
|
-
* Queries content from the Prismic repository and returns only the first
|
|
344
|
-
* result, if any.
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
*
|
|
348
|
-
* ```ts
|
|
349
|
-
* const document = await client.getFirst()
|
|
350
|
-
* ```
|
|
351
|
-
*
|
|
352
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
353
|
-
*
|
|
354
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
355
|
-
*
|
|
356
|
-
* @returns The first result of the query, if any.
|
|
357
|
-
*/
|
|
358
|
-
getFirst<TDocument extends TDocuments>(params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
359
|
-
/**
|
|
360
|
-
* **IMPORTANT**: Avoid using `dangerouslyGetAll` as it may be slower and
|
|
361
|
-
* require more resources than other methods. Prefer using other methods that
|
|
362
|
-
* filter by filters such as `getAllByType`.
|
|
363
|
-
*
|
|
364
|
-
* Queries content from the Prismic repository and returns all matching
|
|
365
|
-
* content. If no filters are provided, all documents will be fetched.
|
|
366
|
-
*
|
|
367
|
-
* This method may make multiple network requests to query all matching
|
|
368
|
-
* content.
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
*
|
|
372
|
-
* ```ts
|
|
373
|
-
* const response = await client.dangerouslyGetAll()
|
|
374
|
-
* ```
|
|
375
|
-
*
|
|
376
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
377
|
-
*
|
|
378
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
379
|
-
*
|
|
380
|
-
* @returns A list of documents matching the query.
|
|
381
|
-
*/
|
|
382
|
-
dangerouslyGetAll<TDocument extends TDocuments>(params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
383
|
-
/**
|
|
384
|
-
* Queries a document from the Prismic repository with a specific ID.
|
|
385
|
-
*
|
|
386
|
-
* @remarks
|
|
387
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
388
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
389
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
390
|
-
* custom type.
|
|
391
|
-
*
|
|
392
|
-
* @example
|
|
393
|
-
*
|
|
394
|
-
* ```ts
|
|
395
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
396
|
-
* ```
|
|
397
|
-
*
|
|
398
|
-
* @typeParam TDocument- Type of the Prismic document returned.
|
|
399
|
-
*
|
|
400
|
-
* @param id - ID of the document.
|
|
401
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
402
|
-
*
|
|
403
|
-
* @returns The document with an ID matching the `id` parameter, if a matching
|
|
404
|
-
* document exists.
|
|
405
|
-
*/
|
|
406
|
-
getByID<TDocument extends TDocuments>(id: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<TDocument>;
|
|
407
|
-
/**
|
|
408
|
-
* Queries documents from the Prismic repository with specific IDs.
|
|
409
|
-
*
|
|
410
|
-
* @remarks
|
|
411
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
412
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
413
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
414
|
-
* custom type.
|
|
415
|
-
*
|
|
416
|
-
* @example
|
|
417
|
-
*
|
|
418
|
-
* ```ts
|
|
419
|
-
* const response = await client.getByIDs([
|
|
420
|
-
* "WW4bKScAAMAqmluX",
|
|
421
|
-
* "U1kTRgEAAC8A5ldS",
|
|
422
|
-
* ])
|
|
423
|
-
* ```
|
|
424
|
-
*
|
|
425
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
426
|
-
*
|
|
427
|
-
* @param ids - A list of document IDs.
|
|
428
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
429
|
-
*
|
|
430
|
-
* @returns A paginated response containing documents with IDs matching the
|
|
431
|
-
* `ids` parameter.
|
|
432
|
-
*/
|
|
433
|
-
getByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
434
|
-
/**
|
|
435
|
-
* Queries all documents from the Prismic repository with specific IDs.
|
|
436
|
-
*
|
|
437
|
-
* This method may make multiple network requests to query all matching
|
|
438
|
-
* content.
|
|
439
|
-
*
|
|
440
|
-
* @remarks
|
|
441
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
442
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
443
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
444
|
-
* custom type.
|
|
445
|
-
*
|
|
446
|
-
* @example
|
|
447
|
-
*
|
|
448
|
-
* ```ts
|
|
449
|
-
* const response = await client.getAllByIDs([
|
|
450
|
-
* "WW4bKScAAMAqmluX",
|
|
451
|
-
* "U1kTRgEAAC8A5ldS",
|
|
452
|
-
* ])
|
|
453
|
-
* ```
|
|
454
|
-
*
|
|
455
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
456
|
-
*
|
|
457
|
-
* @param ids - A list of document IDs.
|
|
458
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
459
|
-
*
|
|
460
|
-
* @returns A list of documents with IDs matching the `ids` parameter.
|
|
461
|
-
*/
|
|
462
|
-
getAllByIDs<TDocument extends TDocuments>(ids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
463
|
-
/**
|
|
464
|
-
* Queries a document from the Prismic repository with a specific UID and
|
|
465
|
-
* custom type.
|
|
466
|
-
*
|
|
467
|
-
* @remarks
|
|
468
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
469
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
470
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
471
|
-
* custom type.
|
|
472
|
-
*
|
|
473
|
-
* @example
|
|
474
|
-
*
|
|
475
|
-
* ```ts
|
|
476
|
-
* const document = await client.getByUID("blog_post", "my-first-post")
|
|
477
|
-
* ```
|
|
478
|
-
*
|
|
479
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
480
|
-
*
|
|
481
|
-
* @param documentType - The API ID of the document's custom type.
|
|
482
|
-
* @param uid - UID of the document.
|
|
483
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
484
|
-
*
|
|
485
|
-
* @returns The document with a UID matching the `uid` parameter, if a
|
|
486
|
-
* matching document exists.
|
|
487
|
-
*/
|
|
488
|
-
getByUID<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uid: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
489
|
-
/**
|
|
490
|
-
* Queries document from the Prismic repository with specific UIDs and Custom
|
|
491
|
-
* Type.
|
|
492
|
-
*
|
|
493
|
-
* @remarks
|
|
494
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
495
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
496
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
497
|
-
* custom type.
|
|
498
|
-
*
|
|
499
|
-
* @example
|
|
500
|
-
*
|
|
501
|
-
* ```ts
|
|
502
|
-
* const document = await client.getByUIDs("blog_post", [
|
|
503
|
-
* "my-first-post",
|
|
504
|
-
* "my-second-post",
|
|
505
|
-
* ])
|
|
506
|
-
* ```
|
|
507
|
-
*
|
|
508
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
509
|
-
*
|
|
510
|
-
* @param documentType - The API ID of the document's custom type.
|
|
511
|
-
* @param uids - A list of document UIDs.
|
|
512
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
513
|
-
*
|
|
514
|
-
* @returns A paginated response containing documents with UIDs matching the
|
|
515
|
-
* `uids` parameter.
|
|
516
|
-
*/
|
|
517
|
-
getByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
518
|
-
/**
|
|
519
|
-
* Queries all documents from the Prismic repository with specific UIDs and
|
|
520
|
-
* custom type.
|
|
521
|
-
*
|
|
522
|
-
* This method may make multiple network requests to query all matching
|
|
523
|
-
* content.
|
|
524
|
-
*
|
|
525
|
-
* @remarks
|
|
526
|
-
* A document's UID is different from its ID. An ID is automatically generated
|
|
527
|
-
* for all documents and is made available on its `id` property. A UID is
|
|
528
|
-
* provided in the Prismic editor and is unique among all documents of its
|
|
529
|
-
* custom type.
|
|
530
|
-
*
|
|
531
|
-
* @example
|
|
532
|
-
*
|
|
533
|
-
* ```ts
|
|
534
|
-
* const response = await client.getAllByUIDs([
|
|
535
|
-
* "my-first-post",
|
|
536
|
-
* "my-second-post",
|
|
537
|
-
* ])
|
|
538
|
-
* ```
|
|
539
|
-
*
|
|
540
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
541
|
-
*
|
|
542
|
-
* @param documentType - The API ID of the document's custom type.
|
|
543
|
-
* @param uids - A list of document UIDs.
|
|
544
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
545
|
-
*
|
|
546
|
-
* @returns A list of documents with UIDs matching the `uids` parameter.
|
|
547
|
-
*/
|
|
548
|
-
getAllByUIDs<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, uids: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
549
|
-
/**
|
|
550
|
-
* Queries a singleton document from the Prismic repository for a specific
|
|
551
|
-
* custom type.
|
|
552
|
-
*
|
|
553
|
-
* @remarks
|
|
554
|
-
* A singleton document is one that is configured in Prismic to only allow one
|
|
555
|
-
* instance. For example, a repository may be configured to contain just one
|
|
556
|
-
* Settings document. This is in contrast to a repeatable custom type which
|
|
557
|
-
* allows multiple instances of itself.
|
|
558
|
-
*
|
|
559
|
-
* @example
|
|
560
|
-
*
|
|
561
|
-
* ```ts
|
|
562
|
-
* const document = await client.getSingle("settings")
|
|
563
|
-
* ```
|
|
564
|
-
*
|
|
565
|
-
* @typeParam TDocument - Type of the Prismic document returned.
|
|
566
|
-
*
|
|
567
|
-
* @param documentType - The API ID of the singleton custom type.
|
|
568
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
569
|
-
*
|
|
570
|
-
* @returns The singleton document for the custom type, if a matching document
|
|
571
|
-
* exists.
|
|
572
|
-
*/
|
|
573
|
-
getSingle<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>>;
|
|
574
|
-
/**
|
|
575
|
-
* Queries documents from the Prismic repository for a specific custom type.
|
|
576
|
-
*
|
|
577
|
-
* Use `getAllByType` instead if you need to query all documents for a
|
|
578
|
-
* specific custom type.
|
|
579
|
-
*
|
|
580
|
-
* @example
|
|
581
|
-
*
|
|
582
|
-
* ```ts
|
|
583
|
-
* const response = await client.getByType("blog_post")
|
|
584
|
-
* ```
|
|
585
|
-
*
|
|
586
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
587
|
-
*
|
|
588
|
-
* @param documentType - The API ID of the custom type.
|
|
589
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
590
|
-
*
|
|
591
|
-
* @returns A paginated response containing documents of the custom type.
|
|
592
|
-
*/
|
|
593
|
-
getByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<ExtractDocumentType<TDocument, TDocumentType>>>;
|
|
594
|
-
/**
|
|
595
|
-
* Queries all documents from the Prismic repository for a specific Custom
|
|
596
|
-
* Type.
|
|
597
|
-
*
|
|
598
|
-
* This method may make multiple network requests to query all matching
|
|
599
|
-
* content.
|
|
600
|
-
*
|
|
601
|
-
* @example
|
|
602
|
-
*
|
|
603
|
-
* ```ts
|
|
604
|
-
* const response = await client.getByType("blog_post")
|
|
605
|
-
* ```
|
|
606
|
-
*
|
|
607
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
608
|
-
*
|
|
609
|
-
* @param documentType - The API ID of the custom type.
|
|
610
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
611
|
-
*
|
|
612
|
-
* @returns A list of all documents of the custom type.
|
|
613
|
-
*/
|
|
614
|
-
getAllByType<TDocument extends TDocuments, TDocumentType extends TDocument["type"] = TDocument["type"]>(documentType: TDocumentType, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<ExtractDocumentType<TDocument, TDocumentType>[]>;
|
|
615
|
-
/**
|
|
616
|
-
* Queries documents from the Prismic repository with a specific tag.
|
|
617
|
-
*
|
|
618
|
-
* Use `getAllByTag` instead if you need to query all documents with a
|
|
619
|
-
* specific tag.
|
|
620
|
-
*
|
|
621
|
-
* @example
|
|
622
|
-
*
|
|
623
|
-
* ```ts
|
|
624
|
-
* const response = await client.getByTag("food")
|
|
625
|
-
* ```
|
|
626
|
-
*
|
|
627
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
628
|
-
*
|
|
629
|
-
* @param tag - The tag that must be included on a document.
|
|
630
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
631
|
-
*
|
|
632
|
-
* @returns A paginated response containing documents with the tag.
|
|
633
|
-
*/
|
|
634
|
-
getByTag<TDocument extends TDocuments>(tag: string, params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
635
|
-
/**
|
|
636
|
-
* Queries all documents from the Prismic repository with a specific tag.
|
|
637
|
-
*
|
|
638
|
-
* This method may make multiple network requests to query all matching
|
|
639
|
-
* content.
|
|
640
|
-
*
|
|
641
|
-
* @example
|
|
642
|
-
*
|
|
643
|
-
* ```ts
|
|
644
|
-
* const response = await client.getAllByTag("food")
|
|
645
|
-
* ```
|
|
646
|
-
*
|
|
647
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
648
|
-
*
|
|
649
|
-
* @param tag - The tag that must be included on a document.
|
|
650
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
651
|
-
*
|
|
652
|
-
* @returns A list of all documents with the tag.
|
|
653
|
-
*/
|
|
654
|
-
getAllByTag<TDocument extends TDocuments>(tag: string, params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
655
|
-
/**
|
|
656
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
657
|
-
* document must be tagged with all of the queried tags to be included.
|
|
658
|
-
*
|
|
659
|
-
* @example
|
|
660
|
-
*
|
|
661
|
-
* ```ts
|
|
662
|
-
* const response = await client.getByEveryTag(["food", "fruit"])
|
|
663
|
-
* ```
|
|
664
|
-
*
|
|
665
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
666
|
-
*
|
|
667
|
-
* @param tags - A list of tags that must be included on a document.
|
|
668
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
669
|
-
*
|
|
670
|
-
* @returns A paginated response containing documents with the tags.
|
|
671
|
-
*/
|
|
672
|
-
getByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
673
|
-
/**
|
|
674
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
675
|
-
* document must be tagged with all of the queried tags to be included.
|
|
676
|
-
*
|
|
677
|
-
* This method may make multiple network requests to query all matching
|
|
678
|
-
* content.
|
|
679
|
-
*
|
|
680
|
-
* @example
|
|
681
|
-
*
|
|
682
|
-
* ```ts
|
|
683
|
-
* const response = await client.getAllByEveryTag(["food", "fruit"])
|
|
684
|
-
* ```
|
|
685
|
-
*
|
|
686
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
687
|
-
*
|
|
688
|
-
* @param tags - A list of tags that must be included on a document.
|
|
689
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
690
|
-
*
|
|
691
|
-
* @returns A list of all documents with the tags.
|
|
692
|
-
*/
|
|
693
|
-
getAllByEveryTag<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
694
|
-
/**
|
|
695
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
696
|
-
* document must be tagged with at least one of the queried tags to be
|
|
697
|
-
* included.
|
|
698
|
-
*
|
|
699
|
-
* @example
|
|
700
|
-
*
|
|
701
|
-
* ```ts
|
|
702
|
-
* const response = await client.getByEveryTag(["food", "fruit"])
|
|
703
|
-
* ```
|
|
704
|
-
*
|
|
705
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
706
|
-
*
|
|
707
|
-
* @param tags - A list of tags that must be included on a document.
|
|
708
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
709
|
-
*
|
|
710
|
-
* @returns A paginated response containing documents with at least one of the
|
|
711
|
-
* tags.
|
|
712
|
-
*/
|
|
713
|
-
getBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<BuildQueryURLArgs> & FetchParams): Promise<Query<TDocument>>;
|
|
714
|
-
/**
|
|
715
|
-
* Queries documents from the Prismic repository with specific tags. A
|
|
716
|
-
* document must be tagged with at least one of the queried tags to be
|
|
717
|
-
* included.
|
|
718
|
-
*
|
|
719
|
-
* This method may make multiple network requests to query all matching
|
|
720
|
-
* content.
|
|
721
|
-
*
|
|
722
|
-
* @example
|
|
723
|
-
*
|
|
724
|
-
* ```ts
|
|
725
|
-
* const response = await client.getAllBySomeTags(["food", "fruit"])
|
|
726
|
-
* ```
|
|
727
|
-
*
|
|
728
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
729
|
-
*
|
|
730
|
-
* @param tags - A list of tags that must be included on a document.
|
|
731
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
732
|
-
*
|
|
733
|
-
* @returns A list of all documents with at least one of the tags.
|
|
734
|
-
*/
|
|
735
|
-
getAllBySomeTags<TDocument extends TDocuments>(tags: string[], params?: Partial<Omit<BuildQueryURLArgs, "page">> & GetAllParams & FetchParams): Promise<TDocument[]>;
|
|
736
|
-
/**
|
|
737
|
-
* Returns metadata about the Prismic repository, such as its refs, releases,
|
|
738
|
-
* and custom types.
|
|
739
|
-
*
|
|
740
|
-
* @returns Repository metadata.
|
|
741
|
-
*/
|
|
742
|
-
getRepository(params?: FetchParams): Promise<Repository>;
|
|
743
|
-
/**
|
|
744
|
-
* Returns a list of all refs for the Prismic repository.
|
|
745
|
-
*
|
|
746
|
-
* Refs are used to identify which version of the repository's content should
|
|
747
|
-
* be queried. All repositories will have at least one ref pointing to the
|
|
748
|
-
* latest published content called the "master ref".
|
|
749
|
-
*
|
|
750
|
-
* @returns A list of all refs for the Prismic repository.
|
|
751
|
-
*/
|
|
752
|
-
getRefs(params?: FetchParams): Promise<Ref[]>;
|
|
753
|
-
/**
|
|
754
|
-
* Returns a ref for the Prismic repository with a matching ID.
|
|
755
|
-
*
|
|
756
|
-
* @param id - ID of the ref.
|
|
757
|
-
*
|
|
758
|
-
* @returns The ref with a matching ID, if it exists.
|
|
759
|
-
*/
|
|
760
|
-
getRefByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
761
|
-
/**
|
|
762
|
-
* Returns a ref for the Prismic repository with a matching label.
|
|
763
|
-
*
|
|
764
|
-
* @param label - Label of the ref.
|
|
765
|
-
*
|
|
766
|
-
* @returns The ref with a matching label, if it exists.
|
|
767
|
-
*/
|
|
768
|
-
getRefByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
769
|
-
/**
|
|
770
|
-
* Returns the master ref for the Prismic repository. The master ref points to
|
|
771
|
-
* the repository's latest published content.
|
|
772
|
-
*
|
|
773
|
-
* @returns The repository's master ref.
|
|
774
|
-
*/
|
|
775
|
-
getMasterRef(params?: FetchParams): Promise<Ref>;
|
|
776
|
-
/**
|
|
777
|
-
* Returns a list of all Releases for the Prismic repository. Releases are
|
|
778
|
-
* used to group content changes before publishing.
|
|
779
|
-
*
|
|
780
|
-
* @returns A list of all Releases for the Prismic repository.
|
|
781
|
-
*/
|
|
782
|
-
getReleases(params?: FetchParams): Promise<Ref[]>;
|
|
783
|
-
/**
|
|
784
|
-
* Returns a Release for the Prismic repository with a matching ID.
|
|
785
|
-
*
|
|
786
|
-
* @param id - ID of the Release.
|
|
787
|
-
*
|
|
788
|
-
* @returns The Release with a matching ID, if it exists.
|
|
789
|
-
*/
|
|
790
|
-
getReleaseByID(id: string, params?: FetchParams): Promise<Ref>;
|
|
791
|
-
/**
|
|
792
|
-
* Returns a Release for the Prismic repository with a matching label.
|
|
793
|
-
*
|
|
794
|
-
* @param label - Label of the ref.
|
|
795
|
-
*
|
|
796
|
-
* @returns The ref with a matching label, if it exists.
|
|
797
|
-
*/
|
|
798
|
-
getReleaseByLabel(label: string, params?: FetchParams): Promise<Ref>;
|
|
799
|
-
/**
|
|
800
|
-
* Returns a list of all tags used in the Prismic repository.
|
|
801
|
-
*
|
|
802
|
-
* @returns A list of all tags used in the repository.
|
|
803
|
-
*/
|
|
804
|
-
getTags(params?: FetchParams): Promise<string[]>;
|
|
805
|
-
/**
|
|
806
|
-
* Builds a URL used to query content from the Prismic repository.
|
|
807
|
-
*
|
|
808
|
-
* @param params - Parameters to filter, sort, and paginate the results.
|
|
809
|
-
*
|
|
810
|
-
* @returns A URL string that can be requested to query content.
|
|
811
|
-
*/
|
|
812
|
-
buildQueryURL({ signal, fetchOptions, ...params }?: Partial<BuildQueryURLArgs> & FetchParams): Promise<string>;
|
|
813
|
-
/**
|
|
814
|
-
* Determines the URL for a previewed document during an active preview
|
|
815
|
-
* session. The result of this method should be used to redirect the user to
|
|
816
|
-
* the document's URL.
|
|
817
|
-
*
|
|
818
|
-
* @example
|
|
819
|
-
*
|
|
820
|
-
* ```ts
|
|
821
|
-
* const url = client.resolvePreviewURL({
|
|
822
|
-
* linkResolver: (document) => `/${document.uid}`
|
|
823
|
-
* defaultURL: '/'
|
|
824
|
-
* })
|
|
825
|
-
* ```
|
|
826
|
-
*
|
|
827
|
-
* @param args - Arguments to configure the URL resolving.
|
|
828
|
-
*
|
|
829
|
-
* @returns The URL for the previewed document during an active preview
|
|
830
|
-
* session. The user should be redirected to this URL.
|
|
831
|
-
*/
|
|
832
|
-
resolvePreviewURL<LinkResolverReturnType>(args: ResolvePreviewArgs<LinkResolverReturnType> & FetchParams): Promise<string>;
|
|
833
|
-
/**
|
|
834
|
-
* Configures the client to query the latest published content for all future
|
|
835
|
-
* queries.
|
|
836
|
-
*
|
|
837
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
838
|
-
* that query.
|
|
839
|
-
*
|
|
840
|
-
* @example
|
|
841
|
-
*
|
|
842
|
-
* ```ts
|
|
843
|
-
* await client.queryLatestContent()
|
|
844
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
845
|
-
* ```
|
|
846
|
-
*/
|
|
847
|
-
queryLatestContent(): void;
|
|
848
|
-
/**
|
|
849
|
-
* Configures the client to query content from a specific Release identified
|
|
850
|
-
* by its ID for all future queries.
|
|
851
|
-
*
|
|
852
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
853
|
-
* that query.
|
|
854
|
-
*
|
|
855
|
-
* @example
|
|
856
|
-
*
|
|
857
|
-
* ```ts
|
|
858
|
-
* await client.queryContentFromReleaseByID("YLB7OBAAACMA7Cpa")
|
|
859
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
860
|
-
* ```
|
|
861
|
-
*
|
|
862
|
-
* @param releaseID - The ID of the Release.
|
|
863
|
-
*/
|
|
864
|
-
queryContentFromReleaseByID(releaseID: string): void;
|
|
865
|
-
/**
|
|
866
|
-
* Configures the client to query content from a specific Release identified
|
|
867
|
-
* by its label for all future queries.
|
|
868
|
-
*
|
|
869
|
-
* If the `ref` parameter is provided during a query, it takes priority for
|
|
870
|
-
* that query.
|
|
871
|
-
*
|
|
872
|
-
* @example
|
|
873
|
-
*
|
|
874
|
-
* ```ts
|
|
875
|
-
* await client.queryContentFromReleaseByLabel("My Release")
|
|
876
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
877
|
-
* ```
|
|
878
|
-
*
|
|
879
|
-
* @param releaseLabel - The label of the Release.
|
|
880
|
-
*/
|
|
881
|
-
queryContentFromReleaseByLabel(releaseLabel: string): void;
|
|
882
|
-
/**
|
|
883
|
-
* Configures the client to query content from a specific ref. The ref can be
|
|
884
|
-
* provided as a string or a function.
|
|
885
|
-
*
|
|
886
|
-
* If a function is provided, the ref is fetched lazily before each query. The
|
|
887
|
-
* function may also be asynchronous.
|
|
888
|
-
*
|
|
889
|
-
* @example
|
|
890
|
-
*
|
|
891
|
-
* ```ts
|
|
892
|
-
* await client.queryContentFromRef("my-ref")
|
|
893
|
-
* const document = await client.getByID("WW4bKScAAMAqmluX")
|
|
894
|
-
* ```
|
|
895
|
-
*
|
|
896
|
-
* @param ref - The ref or a function that returns the ref from which to query
|
|
897
|
-
* content.
|
|
898
|
-
*/
|
|
899
|
-
queryContentFromRef(ref: RefStringOrThunk): void;
|
|
900
|
-
/**
|
|
901
|
-
* A `fetch()` function to be used with GraphQL clients configured for
|
|
902
|
-
* Prismic's GraphQL API. It automatically applies the necessary `prismic-ref`
|
|
903
|
-
* and Authorization headers. Queries will automatically be minified by
|
|
904
|
-
* removing whitespace where possible.
|
|
905
|
-
*
|
|
906
|
-
* @example
|
|
907
|
-
*
|
|
908
|
-
* ```ts
|
|
909
|
-
* const graphQLClient = new ApolloClient({
|
|
910
|
-
* link: new HttpLink({
|
|
911
|
-
* uri: prismic.getGraphQLEndpoint(repositoryName),
|
|
912
|
-
* // Provide `client.graphQLFetch` as the fetch implementation.
|
|
913
|
-
* fetch: client.graphQLFetch,
|
|
914
|
-
* // Using GET is required.
|
|
915
|
-
* useGETForQueries: true,
|
|
916
|
-
* }),
|
|
917
|
-
* cache: new InMemoryCache(),
|
|
918
|
-
* })
|
|
919
|
-
* ```
|
|
920
|
-
*
|
|
921
|
-
* @param input - The `fetch()` `input` parameter. Only strings are supported.
|
|
922
|
-
* @param init - The `fetch()` `init` parameter. Only plain objects are
|
|
923
|
-
* supported.
|
|
924
|
-
*
|
|
925
|
-
* @returns The `fetch()` Response for the request.
|
|
926
|
-
*
|
|
927
|
-
* @experimental
|
|
928
|
-
*/
|
|
929
|
-
graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
|
|
930
|
-
signal?: AbortSignalLike;
|
|
931
|
-
}): Promise<Response>;
|
|
932
|
-
/**
|
|
933
|
-
* Returns a cached version of `getRepository` with a TTL.
|
|
934
|
-
*
|
|
935
|
-
* @returns Cached repository metadata.
|
|
936
|
-
*/
|
|
937
|
-
private getCachedRepository;
|
|
938
|
-
/**
|
|
939
|
-
* Returns the ref needed to query based on the client's current state. This
|
|
940
|
-
* method may make a network request to fetch a ref or resolve the user's ref
|
|
941
|
-
* thunk.
|
|
942
|
-
*
|
|
943
|
-
* If auto previews are enabled, the preview ref takes priority if available.
|
|
944
|
-
*
|
|
945
|
-
* The following strategies are used depending on the client's state:
|
|
946
|
-
*
|
|
947
|
-
* - If the user called `queryLatestContent`: Use the repository's master ref.
|
|
948
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new master ref is
|
|
949
|
-
* fetched.
|
|
950
|
-
* - If the user called `queryContentFromReleaseByID`: Use the release's ref.
|
|
951
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new ref for the
|
|
952
|
-
* release is fetched.
|
|
953
|
-
* - If the user called `queryContentFromReleaseByLabel`: Use the release's ref.
|
|
954
|
-
* The ref is cached for 5 seconds. After 5 seconds, a new ref for the
|
|
955
|
-
* release is fetched.
|
|
956
|
-
* - If the user called `queryContentFromRef`: Use the provided ref. Fall back
|
|
957
|
-
* to the master ref if the ref is not a string.
|
|
958
|
-
*
|
|
959
|
-
* @returns The ref to use during a query.
|
|
960
|
-
*/
|
|
961
|
-
private getResolvedRefString;
|
|
962
|
-
/**
|
|
963
|
-
* The private implementation of `this.get`. It returns the API response and
|
|
964
|
-
* the URL used to make the request. The URL is sometimes used in the public
|
|
965
|
-
* method to include in thrown errors.
|
|
966
|
-
*
|
|
967
|
-
* This method retries requests that throw `RefNotFoundError` or
|
|
968
|
-
* `RefExpiredError`. It contains special logic to retry with the latest
|
|
969
|
-
* master ref, provided in the API's error message.
|
|
970
|
-
*
|
|
971
|
-
* @typeParam TDocument - Type of Prismic documents returned.
|
|
972
|
-
*
|
|
973
|
-
* @param params - Parameters to filter, sort, and paginate results.
|
|
974
|
-
*
|
|
975
|
-
* @returns An object containing the paginated response containing the result
|
|
976
|
-
* of the query and the URL used to make the API request.
|
|
977
|
-
*/
|
|
978
|
-
private _get;
|
|
979
|
-
protected _buildRequestInit(params?: FetchParams): RequestInitLike;
|
|
623
|
+
} & FetchParams): Promise<string>;
|
|
624
|
+
/**
|
|
625
|
+
* Configures the client to query the latest published content. This is the
|
|
626
|
+
* client's default mode.
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
*
|
|
630
|
+
* ```ts
|
|
631
|
+
* client.queryLatestContent()
|
|
632
|
+
* ```
|
|
633
|
+
*
|
|
634
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querylatestcontent}
|
|
635
|
+
*/
|
|
636
|
+
queryLatestContent(): void;
|
|
637
|
+
/**
|
|
638
|
+
* Configures the client to query content from a release with a specific ID.
|
|
639
|
+
*
|
|
640
|
+
* @example
|
|
641
|
+
*
|
|
642
|
+
* ```ts
|
|
643
|
+
* client.queryContentFromReleaseByID("YhE3YhEAACIA4321")
|
|
644
|
+
* ```
|
|
645
|
+
*
|
|
646
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebyid}
|
|
647
|
+
*/
|
|
648
|
+
queryContentFromReleaseByID(id: string): void;
|
|
649
|
+
/**
|
|
650
|
+
* Configures the client to query content from a release with a specific
|
|
651
|
+
* label.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
*
|
|
655
|
+
* ```ts
|
|
656
|
+
* client.queryContentFromReleaseByLabel("My Release")
|
|
657
|
+
* ```
|
|
658
|
+
*
|
|
659
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromreleasebylabel}
|
|
660
|
+
*/
|
|
661
|
+
queryContentFromReleaseByLabel(label: string): void;
|
|
662
|
+
/**
|
|
663
|
+
* Configures the client to query content from a specific ref.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
*
|
|
667
|
+
* ```ts
|
|
668
|
+
* client.queryContentFromRef("my-ref")
|
|
669
|
+
* ```
|
|
670
|
+
*
|
|
671
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#querycontentfromref}
|
|
672
|
+
*/
|
|
673
|
+
queryContentFromRef(ref: string | GetRef): void;
|
|
674
|
+
/**
|
|
675
|
+
* A preconfigured `fetch()` function for Prismic's GraphQL API that can be
|
|
676
|
+
* provided to GraphQL clients.
|
|
677
|
+
*
|
|
678
|
+
* @example
|
|
679
|
+
*
|
|
680
|
+
* ```ts
|
|
681
|
+
* import { createClient, getGraphQLEndpoint } from "@prismicio/client"
|
|
682
|
+
*
|
|
683
|
+
* const client = createClient("example-prismic-repo")
|
|
684
|
+
* const graphQLClient = new ApolloClient({
|
|
685
|
+
* link: new HttpLink({
|
|
686
|
+
* uri: getGraphQLEndpoint(client.repositoryName),
|
|
687
|
+
* // Provide `client.graphQLFetch` as the fetch implementation.
|
|
688
|
+
* fetch: client.graphQLFetch,
|
|
689
|
+
* // Using GET is required.
|
|
690
|
+
* useGETForQueries: true,
|
|
691
|
+
* }),
|
|
692
|
+
* cache: new InMemoryCache(),
|
|
693
|
+
* })
|
|
694
|
+
* ```
|
|
695
|
+
*
|
|
696
|
+
* @see {@link https://prismic.io/docs/technical-reference/prismicio-client/v7#graphqlfetch}
|
|
697
|
+
*/
|
|
698
|
+
graphQLFetch(input: RequestInfo, init?: Omit<RequestInit, "signal"> & {
|
|
699
|
+
signal?: AbortSignalLike;
|
|
700
|
+
}): Promise<Response>;
|
|
980
701
|
}
|
|
981
|
-
|
|
702
|
+
//#endregion
|
|
703
|
+
export { Client, ClientConfig, FetchParams, HttpRequestLike };
|
|
704
|
+
//# sourceMappingURL=Client.d.ts.map
|