@prismicio/client 7.21.0-alpha.2 → 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 +926 -0
- package/dist/Client.cjs.map +1 -0
- package/dist/Client.d.cts +704 -0
- package/dist/Client.d.cts.map +1 -0
- package/dist/Client.d.ts +704 -0
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +926 -0
- package/dist/Client.js.map +1 -0
- package/dist/Migration.cjs +284 -0
- package/dist/Migration.cjs.map +1 -0
- package/dist/Migration.d.cts +216 -0
- package/dist/Migration.d.cts.map +1 -0
- package/dist/Migration.d.ts +216 -0
- package/dist/Migration.d.ts.map +1 -0
- package/dist/Migration.js +284 -0
- package/dist/Migration.js.map +1 -0
- package/dist/WriteClient.cjs +488 -0
- package/dist/WriteClient.cjs.map +1 -0
- package/dist/WriteClient.d.cts +262 -0
- package/dist/WriteClient.d.cts.map +1 -0
- package/dist/WriteClient.d.ts +262 -0
- package/dist/WriteClient.d.ts.map +1 -0
- package/dist/WriteClient.js +488 -0
- package/dist/WriteClient.js.map +1 -0
- package/dist/_virtual/rolldown_runtime.cjs +14 -0
- package/dist/_virtual/rolldown_runtime.js +13 -0
- package/dist/buildQueryURL.cjs +96 -0
- package/dist/buildQueryURL.cjs.map +1 -0
- package/dist/buildQueryURL.d.cts +212 -0
- package/dist/buildQueryURL.d.cts.map +1 -0
- package/dist/buildQueryURL.d.ts +212 -0
- package/dist/buildQueryURL.d.ts.map +1 -0
- package/dist/buildQueryURL.js +96 -0
- package/dist/buildQueryURL.js.map +1 -0
- package/dist/cookie.cjs +19 -0
- package/dist/cookie.cjs.map +1 -0
- package/dist/cookie.d.cts +11 -0
- package/dist/cookie.d.cts.map +1 -0
- package/dist/cookie.d.ts +11 -0
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cookie.js +13 -0
- package/dist/cookie.js.map +1 -0
- package/dist/createClient.cjs +33 -0
- package/dist/createClient.cjs.map +1 -0
- package/dist/createClient.d.cts +41 -0
- package/dist/createClient.d.cts.map +1 -0
- package/dist/createClient.d.ts +41 -0
- package/dist/createClient.d.ts.map +1 -0
- package/dist/createClient.js +33 -0
- package/dist/createClient.js.map +1 -0
- package/dist/createMigration.cjs +22 -0
- package/dist/createMigration.cjs.map +1 -0
- package/dist/createMigration.d.cts +30 -0
- package/dist/createMigration.d.cts.map +1 -0
- package/dist/createMigration.d.ts +30 -0
- package/dist/createMigration.d.ts.map +1 -0
- package/dist/createMigration.js +22 -0
- package/dist/createMigration.js.map +1 -0
- package/dist/createWriteClient.cjs +30 -0
- package/dist/createWriteClient.cjs.map +1 -0
- package/dist/createWriteClient.d.cts +38 -0
- package/dist/createWriteClient.d.cts.map +1 -0
- package/dist/createWriteClient.d.ts +38 -0
- package/dist/createWriteClient.d.ts.map +1 -0
- package/dist/createWriteClient.js +30 -0
- package/dist/createWriteClient.js.map +1 -0
- 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 +104 -0
- package/dist/filter.cjs.map +1 -0
- package/dist/filter.d.cts +213 -0
- package/dist/filter.d.cts.map +1 -0
- package/dist/filter.d.ts +213 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +103 -0
- package/dist/filter.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +21 -0
- package/dist/getGraphQLEndpoint.cjs.map +1 -0
- package/dist/getGraphQLEndpoint.d.cts +14 -0
- package/dist/getGraphQLEndpoint.d.cts.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +14 -0
- package/dist/getGraphQLEndpoint.d.ts.map +1 -0
- package/dist/getGraphQLEndpoint.js +21 -0
- package/dist/getGraphQLEndpoint.js.map +1 -0
- package/dist/getRepositoryEndpoint.cjs +30 -0
- package/dist/getRepositoryEndpoint.cjs.map +1 -0
- package/dist/getRepositoryEndpoint.d.cts +23 -0
- package/dist/getRepositoryEndpoint.d.cts.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +23 -0
- package/dist/getRepositoryEndpoint.d.ts.map +1 -0
- package/dist/getRepositoryEndpoint.js +30 -0
- package/dist/getRepositoryEndpoint.js.map +1 -0
- package/dist/getRepositoryName.cjs +25 -0
- package/dist/getRepositoryName.cjs.map +1 -0
- package/dist/getRepositoryName.d.cts +16 -0
- package/dist/getRepositoryName.d.cts.map +1 -0
- package/dist/getRepositoryName.d.ts +16 -0
- package/dist/getRepositoryName.d.ts.map +1 -0
- package/dist/getRepositoryName.js +25 -0
- package/dist/getRepositoryName.js.map +1 -0
- package/dist/getToolbarSrc.cjs +45 -0
- package/dist/getToolbarSrc.cjs.map +1 -0
- package/dist/getToolbarSrc.d.cts +38 -0
- package/dist/getToolbarSrc.d.cts.map +1 -0
- package/dist/getToolbarSrc.d.ts +38 -0
- package/dist/getToolbarSrc.d.ts.map +1 -0
- package/dist/getToolbarSrc.js +45 -0
- package/dist/getToolbarSrc.js.map +1 -0
- package/dist/helpers/asDate.cjs +39 -0
- package/dist/helpers/asDate.cjs.map +1 -0
- package/dist/helpers/asDate.d.cts +29 -0
- package/dist/helpers/asDate.d.cts.map +1 -0
- package/dist/helpers/asDate.d.ts +29 -0
- package/dist/helpers/asDate.d.ts.map +1 -0
- package/dist/helpers/asDate.js +38 -0
- package/dist/helpers/asDate.js.map +1 -0
- package/dist/helpers/asHTML.cjs +83 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.cts +147 -0
- package/dist/helpers/asHTML.d.cts.map +1 -0
- package/dist/helpers/asHTML.d.ts +147 -0
- package/dist/helpers/asHTML.d.ts.map +1 -0
- package/dist/helpers/asHTML.js +83 -0
- package/dist/helpers/asHTML.js.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +60 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +59 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +59 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +60 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
- package/dist/helpers/asImageSrc.cjs +33 -0
- package/dist/helpers/asImageSrc.cjs.map +1 -0
- package/dist/helpers/asImageSrc.d.cts +34 -0
- package/dist/helpers/asImageSrc.d.cts.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +34 -0
- package/dist/helpers/asImageSrc.d.ts.map +1 -0
- package/dist/helpers/asImageSrc.js +33 -0
- package/dist/helpers/asImageSrc.js.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.cjs +79 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.cts +67 -0
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +67 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.js +79 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +29 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.cts +83 -0
- package/dist/helpers/asLink.d.cts.map +1 -0
- package/dist/helpers/asLink.d.ts +83 -0
- package/dist/helpers/asLink.d.ts.map +1 -0
- package/dist/helpers/asLink.js +29 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asLinkAttrs.cjs +47 -0
- package/dist/helpers/asLinkAttrs.cjs.map +1 -0
- package/dist/helpers/asLinkAttrs.d.cts +51 -0
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +51 -0
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -0
- package/dist/helpers/asLinkAttrs.js +47 -0
- package/dist/helpers/asLinkAttrs.js.map +1 -0
- package/dist/helpers/asText.cjs +16 -0
- package/dist/helpers/asText.cjs.map +1 -0
- package/dist/helpers/asText.d.cts +62 -0
- package/dist/helpers/asText.d.cts.map +1 -0
- package/dist/helpers/asText.d.ts +62 -0
- package/dist/helpers/asText.d.ts.map +1 -0
- package/dist/helpers/asText.js +16 -0
- package/dist/helpers/asText.js.map +1 -0
- package/dist/helpers/documentToLinkField.cjs +33 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.cts +21 -0
- package/dist/helpers/documentToLinkField.d.cts.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +21 -0
- package/dist/helpers/documentToLinkField.d.ts.map +1 -0
- package/dist/helpers/documentToLinkField.js +33 -0
- package/dist/helpers/documentToLinkField.js.map +1 -0
- package/dist/helpers/isFilled.cjs +250 -0
- package/dist/helpers/isFilled.cjs.map +1 -0
- package/dist/helpers/isFilled.d.cts +199 -0
- package/dist/helpers/isFilled.d.cts.map +1 -0
- package/dist/helpers/isFilled.d.ts +199 -0
- package/dist/helpers/isFilled.d.ts.map +1 -0
- package/dist/helpers/isFilled.js +243 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/helpers/mapSliceZone.cjs +53 -0
- package/dist/helpers/mapSliceZone.cjs.map +1 -0
- package/dist/helpers/mapSliceZone.d.cts +139 -0
- package/dist/helpers/mapSliceZone.d.cts.map +1 -0
- package/dist/helpers/mapSliceZone.d.ts +139 -0
- package/dist/helpers/mapSliceZone.d.ts.map +1 -0
- package/dist/helpers/mapSliceZone.js +52 -0
- package/dist/helpers/mapSliceZone.js.map +1 -0
- package/dist/index.cjs +109 -3882
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -4394
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +143 -4394
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/isRepositoryEndpoint.cjs +23 -0
- package/dist/isRepositoryEndpoint.cjs.map +1 -0
- package/dist/isRepositoryEndpoint.d.cts +14 -0
- package/dist/isRepositoryEndpoint.d.cts.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +14 -0
- package/dist/isRepositoryEndpoint.d.ts.map +1 -0
- package/dist/isRepositoryEndpoint.js +22 -0
- package/dist/isRepositoryEndpoint.js.map +1 -0
- package/dist/isRepositoryName.cjs +17 -0
- package/dist/isRepositoryName.cjs.map +1 -0
- package/dist/isRepositoryName.d.cts +13 -0
- package/dist/isRepositoryName.d.cts.map +1 -0
- package/dist/isRepositoryName.d.ts +13 -0
- package/dist/isRepositoryName.d.ts.map +1 -0
- package/dist/isRepositoryName.js +16 -0
- package/dist/isRepositoryName.js.map +1 -0
- package/dist/lib/devMsg.cjs +25 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.js +25 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/escapeHTML.cjs +40 -0
- package/dist/lib/escapeHTML.cjs.map +1 -0
- package/dist/lib/escapeHTML.js +39 -0
- package/dist/lib/escapeHTML.js.map +1 -0
- package/dist/lib/getOptionalLinkProperties.cjs +22 -0
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -0
- package/dist/lib/getOptionalLinkProperties.js +21 -0
- package/dist/lib/getOptionalLinkProperties.js.map +1 -0
- package/dist/lib/getPreviewCookie.cjs +30 -0
- package/dist/lib/getPreviewCookie.cjs.map +1 -0
- package/dist/lib/getPreviewCookie.js +30 -0
- package/dist/lib/getPreviewCookie.js.map +1 -0
- package/dist/lib/isInternalURL.cjs +18 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.js +17 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/isMigrationValue.cjs +77 -0
- package/dist/lib/isMigrationValue.cjs.map +1 -0
- package/dist/lib/isMigrationValue.js +74 -0
- package/dist/lib/isMigrationValue.js.map +1 -0
- package/dist/lib/isValue.cjs +110 -0
- package/dist/lib/isValue.cjs.map +1 -0
- package/dist/lib/isValue.js +106 -0
- package/dist/lib/isValue.js.map +1 -0
- package/dist/lib/pLimit.cjs +55 -0
- package/dist/lib/pLimit.cjs.map +1 -0
- package/dist/lib/pLimit.js +54 -0
- package/dist/lib/pLimit.js.map +1 -0
- package/dist/lib/request.cjs +60 -0
- package/dist/lib/request.cjs.map +1 -0
- package/dist/lib/request.d.cts +61 -0
- package/dist/lib/request.d.cts.map +1 -0
- package/dist/lib/request.d.ts +61 -0
- package/dist/lib/request.d.ts.map +1 -0
- package/dist/lib/request.js +60 -0
- package/dist/lib/request.js.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.cjs +156 -0
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.js +155 -0
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
- package/dist/lib/serializerHelpers.cjs +95 -0
- package/dist/lib/serializerHelpers.cjs.map +1 -0
- package/dist/lib/serializerHelpers.js +90 -0
- package/dist/lib/serializerHelpers.js.map +1 -0
- 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 +48 -0
- package/dist/lib/validateAssetMetadata.cjs.map +1 -0
- package/dist/lib/validateAssetMetadata.js +48 -0
- package/dist/lib/validateAssetMetadata.js.map +1 -0
- 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 +21 -0
- package/dist/richtext/asText.cjs.map +1 -0
- package/dist/richtext/asText.d.cts +18 -0
- package/dist/richtext/asText.d.cts.map +1 -0
- package/dist/richtext/asText.d.ts +18 -0
- package/dist/richtext/asText.d.ts.map +1 -0
- package/dist/richtext/asText.js +20 -0
- package/dist/richtext/asText.js.map +1 -0
- package/dist/richtext/asTree.cjs +122 -0
- package/dist/richtext/asTree.cjs.map +1 -0
- package/dist/richtext/asTree.d.cts +20 -0
- package/dist/richtext/asTree.d.cts.map +1 -0
- package/dist/richtext/asTree.d.ts +20 -0
- package/dist/richtext/asTree.d.ts.map +1 -0
- package/dist/richtext/asTree.js +122 -0
- package/dist/richtext/asTree.js.map +1 -0
- package/dist/richtext/composeSerializers.cjs +31 -0
- package/dist/richtext/composeSerializers.cjs.map +1 -0
- package/dist/richtext/composeSerializers.d.cts +22 -0
- package/dist/richtext/composeSerializers.d.cts.map +1 -0
- package/dist/richtext/composeSerializers.d.ts +22 -0
- package/dist/richtext/composeSerializers.d.ts.map +1 -0
- package/dist/richtext/composeSerializers.js +30 -0
- package/dist/richtext/composeSerializers.js.map +1 -0
- package/dist/richtext/serialize.cjs +35 -0
- package/dist/richtext/serialize.cjs.map +1 -0
- package/dist/richtext/serialize.d.cts +25 -0
- package/dist/richtext/serialize.d.cts.map +1 -0
- package/dist/richtext/serialize.d.ts +25 -0
- package/dist/richtext/serialize.d.ts.map +1 -0
- package/dist/richtext/serialize.js +35 -0
- package/dist/richtext/serialize.js.map +1 -0
- package/dist/richtext/types.cjs +13 -0
- package/dist/richtext/types.cjs.map +1 -0
- package/dist/richtext/types.d.cts +71 -0
- package/dist/richtext/types.d.cts.map +1 -0
- package/dist/richtext/types.d.ts +71 -0
- package/dist/richtext/types.d.ts.map +1 -0
- package/dist/richtext/types.js +13 -0
- package/dist/richtext/types.js.map +1 -0
- package/dist/richtext/wrapMapSerializer.cjs +32 -0
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.cts +21 -0
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.ts +21 -0
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -0
- package/dist/richtext/wrapMapSerializer.js +32 -0
- package/dist/richtext/wrapMapSerializer.js.map +1 -0
- package/dist/richtext.cjs +13 -0
- package/dist/richtext.d.cts +8 -0
- package/dist/richtext.d.ts +8 -0
- package/dist/richtext.js +8 -0
- 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 +97 -0
- 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 +35 -0
- 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 +34 -0
- 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 +49 -0
- 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 +36 -0
- 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 +17 -0
- 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 +115 -0
- 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 +13 -0
- package/dist/types/api/tags.d.ts.map +1 -0
- package/dist/types/migration/Asset.cjs +35 -0
- package/dist/types/migration/Asset.cjs.map +1 -0
- 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 +109 -0
- package/dist/types/migration/Asset.d.ts.map +1 -0
- package/dist/types/migration/Asset.js +34 -0
- package/dist/types/migration/Asset.js.map +1 -0
- 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 +15 -0
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -0
- package/dist/types/migration/Document.cjs +51 -0
- package/dist/types/migration/Document.cjs.map +1 -0
- 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 +97 -0
- package/dist/types/migration/Document.d.ts.map +1 -0
- package/dist/types/migration/Document.js +50 -0
- package/dist/types/migration/Document.js.map +1 -0
- 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 +21 -0
- 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 +19 -0
- 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 +59 -0
- 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 +54 -0
- 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 +20 -0
- 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 +19 -0
- 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 +18 -0
- 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 +29 -0
- 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 +37 -0
- 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 +20 -0
- 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 +19 -0
- package/dist/types/model/keyText.d.ts.map +1 -0
- package/dist/types/model/link.cjs +16 -0
- package/dist/types/model/link.cjs.map +1 -0
- 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 +34 -0
- package/dist/types/model/link.d.ts.map +1 -0
- package/dist/types/model/link.js +15 -0
- package/dist/types/model/link.js.map +1 -0
- 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 +23 -0
- 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 +21 -0
- 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 +20 -0
- 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 +43 -0
- 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 +24 -0
- 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 +16 -0
- 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 +22 -0
- 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 +25 -0
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -0
- package/dist/types/model/slice.cjs +15 -0
- package/dist/types/model/slice.cjs.map +1 -0
- 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 +39 -0
- package/dist/types/model/slice.d.ts.map +1 -0
- package/dist/types/model/slice.js +14 -0
- package/dist/types/model/slice.js.map +1 -0
- package/dist/types/model/sliceZone.cjs +15 -0
- package/dist/types/model/sliceZone.cjs.map +1 -0
- 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 +47 -0
- package/dist/types/model/sliceZone.d.ts.map +1 -0
- package/dist/types/model/sliceZone.js +14 -0
- package/dist/types/model/sliceZone.js.map +1 -0
- 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 +18 -0
- 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 +20 -0
- 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 +13 -0
- package/dist/types/model/title.d.ts.map +1 -0
- package/dist/types/model/types.cjs +32 -0
- package/dist/types/model/types.cjs.map +1 -0
- 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 +82 -0
- package/dist/types/model/types.d.ts.map +1 -0
- package/dist/types/model/types.js +31 -0
- package/dist/types/model/types.js.map +1 -0
- 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 +19 -0
- 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 +10 -0
- 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 +15 -0
- 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 +37 -0
- 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 +15 -0
- 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 +120 -0
- package/dist/types/value/document.d.ts.map +1 -0
- package/dist/types/value/embed.cjs +17 -0
- package/dist/types/value/embed.cjs.map +1 -0
- 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 +173 -0
- package/dist/types/value/embed.d.ts.map +1 -0
- package/dist/types/value/embed.js +16 -0
- package/dist/types/value/embed.js.map +1 -0
- 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 +18 -0
- 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 +19 -0
- 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 +53 -0
- 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 +22 -0
- 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 +15 -0
- package/dist/types/value/keyText.d.ts.map +1 -0
- package/dist/types/value/link.cjs +15 -0
- package/dist/types/value/link.cjs.map +1 -0
- 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 +74 -0
- package/dist/types/value/link.d.ts.map +1 -0
- package/dist/types/value/link.js +14 -0
- package/dist/types/value/link.js.map +1 -0
- 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 +33 -0
- 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 +15 -0
- package/dist/types/value/number.d.ts.map +1 -0
- package/dist/types/value/richText.cjs +32 -0
- package/dist/types/value/richText.cjs.map +1 -0
- 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 +221 -0
- package/dist/types/value/richText.d.ts.map +1 -0
- package/dist/types/value/richText.js +31 -0
- package/dist/types/value/richText.js.map +1 -0
- 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 +16 -0
- 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 +17 -0
- 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 +16 -0
- 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 +19 -0
- 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 +18 -0
- 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 +97 -0
- 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 +13 -0
- 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 +16 -0
- 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 +61 -0
- 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 +57 -0
- 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 +15 -0
- package/dist/types/webhook/testTrigger.d.ts.map +1 -0
- package/dist/types/webhook/types.cjs +15 -0
- package/dist/types/webhook/types.cjs.map +1 -0
- 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 +23 -0
- package/dist/types/webhook/types.d.ts.map +1 -0
- package/dist/types/webhook/types.js +14 -0
- package/dist/types/webhook/types.js.map +1 -0
- package/package.json +29 -35
- package/src/Client.ts +682 -1028
- package/src/WriteClient.ts +44 -46
- package/src/buildQueryURL.ts +14 -20
- package/src/createClient.ts +1 -1
- package/src/errors.ts +94 -0
- package/src/getGraphQLEndpoint.ts +1 -1
- package/src/getRepositoryEndpoint.ts +1 -1
- package/src/getRepositoryName.ts +1 -1
- package/src/getToolbarSrc.ts +1 -1
- package/src/helpers/asHTML.ts +4 -4
- package/src/helpers/asImageWidthSrcSet.ts +1 -5
- package/src/helpers/asLink.ts +0 -3
- package/src/helpers/asLinkAttrs.ts +0 -4
- package/src/helpers/mapSliceZone.ts +5 -5
- package/src/index.ts +11 -8
- 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/types/migration/Document.ts +1 -1
- package/src/types/model/contentRelationship.ts +1 -0
- 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/index.d.mts +0 -4424
- package/dist/index.mjs +0 -3837
- package/dist/index.mjs.map +0 -1
- package/dist/richtext/index.cjs +0 -244
- package/dist/richtext/index.cjs.map +0 -1
- package/dist/richtext/index.d.cts +0 -78
- package/dist/richtext/index.d.mts +0 -78
- package/dist/richtext/index.d.ts +0 -78
- package/dist/richtext/index.mjs +0 -237
- package/dist/richtext/index.mjs.map +0 -1
- package/dist/shared/client.TSGr56lO.d.cts +0 -899
- package/dist/shared/client.TSGr56lO.d.mts +0 -899
- package/dist/shared/client.TSGr56lO.d.ts +0 -899
- package/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/src/WriteClient.ts
CHANGED
|
@@ -27,17 +27,19 @@ import type {
|
|
|
27
27
|
} from "./types/migration/Document"
|
|
28
28
|
import type { PrismicDocument } from "./types/value/document"
|
|
29
29
|
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
import {
|
|
31
|
+
ForbiddenError,
|
|
32
|
+
InvalidDataError,
|
|
33
|
+
NotFoundError,
|
|
34
|
+
PrismicError,
|
|
35
|
+
} from "./errors"
|
|
34
36
|
|
|
35
37
|
import { name, version } from "../package.json"
|
|
36
38
|
|
|
37
39
|
import { Client } from "./Client"
|
|
38
40
|
import type { ClientConfig, FetchParams } from "./Client"
|
|
39
41
|
import type { Migration } from "./Migration"
|
|
40
|
-
//
|
|
42
|
+
// oxlint-disable-next-line no-unused-vars
|
|
41
43
|
import type { createMigration } from "./createMigration"
|
|
42
44
|
|
|
43
45
|
const CLIENT_IDENTIFIER = `${name.replace("@", "").replace("/", "-")}/${version}`
|
|
@@ -315,7 +317,7 @@ export class WriteClient<
|
|
|
315
317
|
let url: URL | undefined
|
|
316
318
|
try {
|
|
317
319
|
url = new URL(file)
|
|
318
|
-
} catch
|
|
320
|
+
} catch {
|
|
319
321
|
// noop only on invalid URL, fetch errors will throw in the next if statement
|
|
320
322
|
}
|
|
321
323
|
|
|
@@ -340,7 +342,10 @@ export class WriteClient<
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
const asset = await this.createAsset(resolvedFile, filename, {
|
|
343
|
-
|
|
345
|
+
notes,
|
|
346
|
+
credits,
|
|
347
|
+
alt,
|
|
348
|
+
tags,
|
|
344
349
|
...fetchParams,
|
|
345
350
|
})
|
|
346
351
|
|
|
@@ -372,7 +377,7 @@ export class WriteClient<
|
|
|
372
377
|
): Promise<void> {
|
|
373
378
|
// Resolve master locale
|
|
374
379
|
const repository = await this.getRepository(fetchParams)
|
|
375
|
-
const masterLocale = repository.languages.
|
|
380
|
+
const masterLocale = repository.languages[0].id
|
|
376
381
|
reporter?.({
|
|
377
382
|
type: "documents:masterLocale",
|
|
378
383
|
data: {
|
|
@@ -622,7 +627,7 @@ export class WriteClient<
|
|
|
622
627
|
url: string,
|
|
623
628
|
params: FetchParams = {},
|
|
624
629
|
): Promise<Blob> {
|
|
625
|
-
const res = await this
|
|
630
|
+
const res = await this.#request(new URL(url), params)
|
|
626
631
|
|
|
627
632
|
if (!res.ok) {
|
|
628
633
|
throw new PrismicError("Could not fetch foreign asset", url, undefined)
|
|
@@ -844,22 +849,26 @@ export class WriteClient<
|
|
|
844
849
|
*/
|
|
845
850
|
async #request(
|
|
846
851
|
url: URL,
|
|
847
|
-
params?:
|
|
852
|
+
params?: FetchParams,
|
|
848
853
|
init?: RequestInitLike,
|
|
849
854
|
): Promise<ResponseLike> {
|
|
850
|
-
const baseInit = this._buildRequestInit(params)
|
|
851
|
-
|
|
852
855
|
return await request(
|
|
853
856
|
url,
|
|
854
857
|
{
|
|
855
|
-
...
|
|
858
|
+
...this.fetchOptions,
|
|
859
|
+
...params?.fetchOptions,
|
|
856
860
|
...init,
|
|
857
861
|
headers: {
|
|
858
|
-
...
|
|
862
|
+
...this.fetchOptions?.headers,
|
|
863
|
+
...params?.fetchOptions?.headers,
|
|
859
864
|
...init?.headers,
|
|
860
865
|
repository: this.repositoryName,
|
|
861
866
|
authorization: `Bearer ${this.writeToken}`,
|
|
862
867
|
},
|
|
868
|
+
signal:
|
|
869
|
+
params?.fetchOptions?.signal ||
|
|
870
|
+
params?.signal ||
|
|
871
|
+
this.fetchOptions?.signal,
|
|
863
872
|
},
|
|
864
873
|
this.fetchFn,
|
|
865
874
|
)
|
|
@@ -908,45 +917,34 @@ export class WriteClient<
|
|
|
908
917
|
* @throws {@link PrismicError} For 500, and other unexpected errors.
|
|
909
918
|
*/
|
|
910
919
|
async #handleMigrationAPIError(response: ResponseLike): Promise<never> {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
json = JSON.parse(text)
|
|
916
|
-
} catch {
|
|
917
|
-
// no-op
|
|
918
|
-
}
|
|
920
|
+
const payload = (await response.json()) as unknown
|
|
921
|
+
|
|
922
|
+
// Common message across all branches
|
|
923
|
+
const message = (payload as { message?: string }).message
|
|
919
924
|
|
|
920
925
|
switch (response.status) {
|
|
921
|
-
case 400:
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
"Validation failed, check the response property of the error for details",
|
|
925
|
-
response.url,
|
|
926
|
-
json, // `json` has the shape Array<{ property: string, value: unknown, error: string }>
|
|
927
|
-
)
|
|
928
|
-
}
|
|
929
|
-
throw new InvalidDataError(text, response.url, text)
|
|
926
|
+
case 400: {
|
|
927
|
+
throw new InvalidDataError(message, response.url, payload)
|
|
928
|
+
}
|
|
930
929
|
|
|
931
|
-
case 401:
|
|
932
|
-
throw new ForbiddenError(
|
|
930
|
+
case 401: {
|
|
931
|
+
throw new ForbiddenError(message, response.url, payload)
|
|
932
|
+
}
|
|
933
933
|
|
|
934
|
-
case 403:
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
json,
|
|
940
|
-
)
|
|
941
|
-
}
|
|
942
|
-
throw new ForbiddenError(text, response.url, text)
|
|
934
|
+
case 403: {
|
|
935
|
+
// The lambda authorizer uses an uppercase key, remove this once it is fixed
|
|
936
|
+
const msg = message ?? (payload as { Message?: string }).Message
|
|
937
|
+
throw new ForbiddenError(msg, response.url, payload)
|
|
938
|
+
}
|
|
943
939
|
|
|
944
|
-
case 404:
|
|
945
|
-
throw new NotFoundError(
|
|
940
|
+
case 404: {
|
|
941
|
+
throw new NotFoundError(message, response.url, payload)
|
|
942
|
+
}
|
|
946
943
|
|
|
947
944
|
case 500:
|
|
948
|
-
default:
|
|
949
|
-
throw new PrismicError(
|
|
945
|
+
default: {
|
|
946
|
+
throw new PrismicError(message, response.url, payload)
|
|
947
|
+
}
|
|
950
948
|
}
|
|
951
949
|
}
|
|
952
950
|
}
|
package/src/buildQueryURL.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { castArray } from "./lib/castArray"
|
|
2
1
|
import { devMsg } from "./lib/devMsg"
|
|
3
2
|
|
|
4
3
|
import { version } from "../package.json"
|
|
@@ -9,9 +8,7 @@ import { version } from "../package.json"
|
|
|
9
8
|
*/
|
|
10
9
|
const PRISMIC_DEV_PARAM = "x-d"
|
|
11
10
|
|
|
12
|
-
/**
|
|
13
|
-
* The query parameter used to indicate the version of the client to the API.
|
|
14
|
-
*/
|
|
11
|
+
/** The query parameter used to indicate the version of the client to the API. */
|
|
15
12
|
const PRISMIC_CLIENT_VERSION_PARAM = "x-c"
|
|
16
13
|
|
|
17
14
|
/**
|
|
@@ -65,9 +62,7 @@ export interface Ordering {
|
|
|
65
62
|
* ```
|
|
66
63
|
*/
|
|
67
64
|
export interface Route {
|
|
68
|
-
/**
|
|
69
|
-
* The custom type of the page.
|
|
70
|
-
*/
|
|
65
|
+
/** The custom type of the page. */
|
|
71
66
|
type: string
|
|
72
67
|
|
|
73
68
|
/**
|
|
@@ -82,14 +77,10 @@ export interface Route {
|
|
|
82
77
|
*/
|
|
83
78
|
lang?: string
|
|
84
79
|
|
|
85
|
-
/**
|
|
86
|
-
* The resolved path of the page with optional placeholders.
|
|
87
|
-
*/
|
|
80
|
+
/** The resolved path of the page with optional placeholders. */
|
|
88
81
|
path: string
|
|
89
82
|
|
|
90
|
-
/**
|
|
91
|
-
* An object that lists the API IDs of the Content Relationships in the route.
|
|
92
|
-
*/
|
|
83
|
+
/** An object that lists the API IDs of the Content Relationships in the route. */
|
|
93
84
|
resolvers?: Record<string, string>
|
|
94
85
|
}
|
|
95
86
|
|
|
@@ -207,9 +198,7 @@ export interface QueryParams {
|
|
|
207
198
|
brokenRoute?: string
|
|
208
199
|
}
|
|
209
200
|
|
|
210
|
-
/**
|
|
211
|
-
* Arguments for `buildQueryURL` to construct a Query URL.
|
|
212
|
-
*/
|
|
201
|
+
/** Arguments for `buildQueryURL` to construct a Query URL. */
|
|
213
202
|
type BuildQueryURLParams = {
|
|
214
203
|
/**
|
|
215
204
|
* Ref used to query documents.
|
|
@@ -249,9 +238,7 @@ const RENAMED_PARAMS = {
|
|
|
249
238
|
accessToken: "access_token",
|
|
250
239
|
} as const
|
|
251
240
|
|
|
252
|
-
/**
|
|
253
|
-
* A valid parameter name for the Prismic REST API V2.
|
|
254
|
-
*/
|
|
241
|
+
/** A valid parameter name for the Prismic REST API V2. */
|
|
255
242
|
type ValidParamName =
|
|
256
243
|
| Exclude<
|
|
257
244
|
keyof QueryParams,
|
|
@@ -326,7 +313,10 @@ export const buildQueryURL = (
|
|
|
326
313
|
): string => {
|
|
327
314
|
const { filters, predicates, ...params } = args
|
|
328
315
|
|
|
329
|
-
|
|
316
|
+
if (!endpoint.endsWith("/")) {
|
|
317
|
+
endpoint += "/"
|
|
318
|
+
}
|
|
319
|
+
const url = new URL(`documents/search`, endpoint)
|
|
330
320
|
|
|
331
321
|
if (filters) {
|
|
332
322
|
// TODO: Remove warning when we remove support for string `filters` values.
|
|
@@ -403,3 +393,7 @@ export const buildQueryURL = (
|
|
|
403
393
|
|
|
404
394
|
return url.toString()
|
|
405
395
|
}
|
|
396
|
+
|
|
397
|
+
function castArray<A>(a: A | A[]): A[] {
|
|
398
|
+
return Array.isArray(a) ? a : [a]
|
|
399
|
+
}
|
package/src/createClient.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface CreateClient {
|
|
|
36
36
|
*
|
|
37
37
|
* @returns A client that can query content from the repository.
|
|
38
38
|
*
|
|
39
|
-
* @see
|
|
39
|
+
* @see https://prismic.io/docs/technical-reference/prismicio-client/v7
|
|
40
40
|
*/
|
|
41
41
|
export const createClient: CreateClient = <TDocuments extends PrismicDocument>(
|
|
42
42
|
repositoryNameOrEndpoint: string,
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export class PrismicError<Response> extends Error {
|
|
2
|
+
url?: string
|
|
3
|
+
response: Response
|
|
4
|
+
|
|
5
|
+
constructor(
|
|
6
|
+
message = "An invalid API response was returned",
|
|
7
|
+
url: string | undefined,
|
|
8
|
+
response: Response,
|
|
9
|
+
) {
|
|
10
|
+
super(message)
|
|
11
|
+
|
|
12
|
+
this.url = url
|
|
13
|
+
this.response = response
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type ForbiddenErrorRepositoryAPIResponse = {
|
|
18
|
+
type: string
|
|
19
|
+
message: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type ForbiddenErrorQueryAPIResponse = {
|
|
23
|
+
error: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class ForbiddenError<
|
|
27
|
+
TResponse =
|
|
28
|
+
| ForbiddenErrorRepositoryAPIResponse
|
|
29
|
+
| ForbiddenErrorQueryAPIResponse,
|
|
30
|
+
> extends PrismicError<TResponse> {}
|
|
31
|
+
|
|
32
|
+
export class NotFoundError<
|
|
33
|
+
TResponse = undefined,
|
|
34
|
+
> extends PrismicError<TResponse> {}
|
|
35
|
+
|
|
36
|
+
export class RepositoryNotFoundError<
|
|
37
|
+
TResponse = undefined,
|
|
38
|
+
> extends NotFoundError<TResponse> {}
|
|
39
|
+
|
|
40
|
+
type ParsingErrorAPIResponse = {
|
|
41
|
+
type: "parsing-error"
|
|
42
|
+
message: string
|
|
43
|
+
pos: {
|
|
44
|
+
line: number
|
|
45
|
+
column: number
|
|
46
|
+
id: number
|
|
47
|
+
location: string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class ParsingError<
|
|
52
|
+
TResponse = ParsingErrorAPIResponse,
|
|
53
|
+
> extends PrismicError<TResponse> {}
|
|
54
|
+
|
|
55
|
+
export class InvalidDataError<
|
|
56
|
+
TResponse = undefined,
|
|
57
|
+
> extends PrismicError<TResponse> {}
|
|
58
|
+
|
|
59
|
+
type RefExpiredErrorAPIResponse = {
|
|
60
|
+
type: "api_validation_error"
|
|
61
|
+
message: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// This error extends `ForbiddenError` for backwards compatibility. Before the
|
|
65
|
+
// API started returning 410 for expired refs, it returned 403, which threw a
|
|
66
|
+
// `ForbiddenError`.
|
|
67
|
+
// TODO: Extend this error from `PrismicError` in v8.
|
|
68
|
+
export class RefExpiredError<
|
|
69
|
+
TResponse = RefExpiredErrorAPIResponse,
|
|
70
|
+
> extends ForbiddenError<TResponse> {}
|
|
71
|
+
|
|
72
|
+
type RefNotFoundErrorAPIResponse = {
|
|
73
|
+
type: "api_notfound_error"
|
|
74
|
+
message: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// This error extends `ForbiddenError` for backwards compatibility. Before the
|
|
78
|
+
// API started returning 404 for not found refs, it returned 403, which threw a
|
|
79
|
+
// `ForbiddenError`.
|
|
80
|
+
// TODO: Extend this error from `PrismicError` in v8.
|
|
81
|
+
export class RefNotFoundError<
|
|
82
|
+
TResponse = RefNotFoundErrorAPIResponse,
|
|
83
|
+
> extends ForbiddenError<TResponse> {}
|
|
84
|
+
|
|
85
|
+
type PreviewTokenExpiredErrorAPIResponse = {
|
|
86
|
+
type: "api_security_error"
|
|
87
|
+
message: string
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// This error extends `ForbiddenError` for backwards compatibility.
|
|
91
|
+
// TODO: Extend this error from `PrismicError` in v8.
|
|
92
|
+
export class PreviewTokenExpiredError<
|
|
93
|
+
TResponse = PreviewTokenExpiredErrorAPIResponse,
|
|
94
|
+
> extends ForbiddenError<TResponse> {}
|
package/src/getRepositoryName.ts
CHANGED
package/src/getToolbarSrc.ts
CHANGED
package/src/helpers/asHTML.ts
CHANGED
|
@@ -93,10 +93,10 @@ type HTMLRichTextMapSerializerFunction<
|
|
|
93
93
|
*/
|
|
94
94
|
type ExtractNodeGeneric<T> =
|
|
95
95
|
T extends RichTextMapSerializerFunction<
|
|
96
|
-
//
|
|
96
|
+
// oxlint-disable-next-line no-explicit-any
|
|
97
97
|
any,
|
|
98
98
|
infer U,
|
|
99
|
-
//
|
|
99
|
+
// oxlint-disable-next-line no-explicit-any
|
|
100
100
|
any
|
|
101
101
|
>
|
|
102
102
|
? U
|
|
@@ -110,9 +110,9 @@ type ExtractNodeGeneric<T> =
|
|
|
110
110
|
*/
|
|
111
111
|
type ExtractTextTypeGeneric<T> =
|
|
112
112
|
T extends RichTextMapSerializerFunction<
|
|
113
|
-
//
|
|
113
|
+
// oxlint-disable-next-line no-explicit-any
|
|
114
114
|
any,
|
|
115
|
-
//
|
|
115
|
+
// oxlint-disable-next-line no-explicit-any
|
|
116
116
|
any,
|
|
117
117
|
infer U
|
|
118
118
|
>
|
|
@@ -85,11 +85,7 @@ export const asImageWidthSrcSet = <
|
|
|
85
85
|
if (field && isFilled.imageThumbnail(field)) {
|
|
86
86
|
// We are using destructuring to omit `widths` from the object
|
|
87
87
|
// we will pass to `buildURL()`.
|
|
88
|
-
let {
|
|
89
|
-
widths = DEFAULT_WIDTHS,
|
|
90
|
-
// eslint-disable-next-line prefer-const
|
|
91
|
-
...imgixParams
|
|
92
|
-
} = config
|
|
88
|
+
let { widths = DEFAULT_WIDTHS, ...imgixParams } = config
|
|
93
89
|
const {
|
|
94
90
|
url,
|
|
95
91
|
dimensions,
|
package/src/helpers/asLink.ts
CHANGED
|
@@ -145,9 +145,6 @@ export const asLink: {
|
|
|
145
145
|
const linkField =
|
|
146
146
|
// prettier-ignore
|
|
147
147
|
(
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
149
|
-
// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
|
|
150
|
-
// TODO: Remove the `prettier-ignore` comment when this bug is fixed.
|
|
151
148
|
"link_type" in linkFieldOrDocument
|
|
152
149
|
? linkFieldOrDocument
|
|
153
150
|
: documentToLinkField(linkFieldOrDocument)
|
|
@@ -98,15 +98,11 @@ export const asLinkAttrs = <
|
|
|
98
98
|
): AsLinkAttrsReturnType<LinkResolverFunctionReturnType> => {
|
|
99
99
|
if (
|
|
100
100
|
linkFieldOrDocument &&
|
|
101
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
102
|
-
// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
|
|
103
101
|
("link_type" in linkFieldOrDocument
|
|
104
102
|
? isFilledLink(linkFieldOrDocument)
|
|
105
103
|
: linkFieldOrDocument)
|
|
106
104
|
) {
|
|
107
105
|
const target =
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
109
|
-
// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
|
|
110
106
|
"target" in linkFieldOrDocument ? linkFieldOrDocument.target : undefined
|
|
111
107
|
|
|
112
108
|
const rawHref = asLink(linkFieldOrDocument, config.linkResolver)
|
|
@@ -11,7 +11,7 @@ type LazyModule<T> = () => Promise<T | { default: T }>
|
|
|
11
11
|
*/
|
|
12
12
|
type MaybeLazyModule<T> = T | LazyModule<T>
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// oxlint-disable-next-line no-explicit-any
|
|
15
15
|
type AnyFunction = (...args: any[]) => any
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -132,7 +132,7 @@ type SliceMappers<TSlice extends SliceLike = SliceLike, TContext = unknown> = {
|
|
|
132
132
|
[P in ExtractSliceType<TSlice>]?: MaybeLazyModule<
|
|
133
133
|
SliceMapper<
|
|
134
134
|
Extract<TSlice, SliceLike<P>>,
|
|
135
|
-
//
|
|
135
|
+
// oxlint-disable-next-line no-explicit-any
|
|
136
136
|
any,
|
|
137
137
|
TContext
|
|
138
138
|
>
|
|
@@ -158,7 +158,7 @@ export type SliceMapper<
|
|
|
158
158
|
* Unwraps a lazily loaded mapper module.
|
|
159
159
|
*/
|
|
160
160
|
type ResolveLazySliceMapperModule<
|
|
161
|
-
//
|
|
161
|
+
// oxlint-disable-next-line no-explicit-any
|
|
162
162
|
TSliceMapper extends SliceMapper<any, any> | LazyModule<SliceMapper>,
|
|
163
163
|
> =
|
|
164
164
|
TSliceMapper extends LazyModule<SliceMapper>
|
|
@@ -173,11 +173,11 @@ type ResolveLazySliceMapperModule<
|
|
|
173
173
|
* Transforms a Slice into its mapped version.
|
|
174
174
|
*/
|
|
175
175
|
type MapSliceLike<
|
|
176
|
-
//
|
|
176
|
+
// oxlint-disable-next-line no-explicit-any
|
|
177
177
|
TSliceLike extends SliceLike<any>,
|
|
178
178
|
TSliceMappers extends SliceMappers<
|
|
179
179
|
TSliceLike,
|
|
180
|
-
//
|
|
180
|
+
// oxlint-disable-next-line no-explicit-any
|
|
181
181
|
any
|
|
182
182
|
>,
|
|
183
183
|
> = TSliceLike extends Slice
|
package/src/index.ts
CHANGED
|
@@ -117,14 +117,17 @@ export type { HTMLRichTextSerializer } from "./helpers/asHTML"
|
|
|
117
117
|
//=============================================================================
|
|
118
118
|
|
|
119
119
|
// Client Errors
|
|
120
|
-
export {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
export {
|
|
121
|
+
ForbiddenError,
|
|
122
|
+
InvalidDataError,
|
|
123
|
+
NotFoundError,
|
|
124
|
+
ParsingError,
|
|
125
|
+
PreviewTokenExpiredError,
|
|
126
|
+
PrismicError,
|
|
127
|
+
RefExpiredError,
|
|
128
|
+
RefNotFoundError,
|
|
129
|
+
RepositoryNotFoundError,
|
|
130
|
+
} from "./errors"
|
|
128
131
|
|
|
129
132
|
//=============================================================================
|
|
130
133
|
// Types - Types representing Prismic content, models, and API payloads.
|
package/src/lib/isValue.ts
CHANGED
|
@@ -44,8 +44,6 @@ export const filledLinkToMedia = (
|
|
|
44
44
|
"url" in value &&
|
|
45
45
|
"size" in value
|
|
46
46
|
) {
|
|
47
|
-
value
|
|
48
|
-
|
|
49
47
|
return true
|
|
50
48
|
}
|
|
51
49
|
}
|
|
@@ -104,8 +102,6 @@ export const filledImage = (
|
|
|
104
102
|
imageLike(value) &&
|
|
105
103
|
(!("type" in value) || value.type !== RichTextNodeType.image)
|
|
106
104
|
) {
|
|
107
|
-
value
|
|
108
|
-
|
|
109
105
|
return true
|
|
110
106
|
}
|
|
111
107
|
|
|
@@ -128,8 +124,6 @@ export const rtImageNode = (value: UnknownValue): value is RTImageNode => {
|
|
|
128
124
|
"type" in value &&
|
|
129
125
|
value.type === RichTextNodeType.image
|
|
130
126
|
) {
|
|
131
|
-
value
|
|
132
|
-
|
|
133
127
|
return true
|
|
134
128
|
}
|
|
135
129
|
|
package/src/lib/pLimit.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
** Many thanks to @sindresorhus
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// oxlint-disable-next-line no-explicit-any
|
|
7
7
|
type AnyFunction = (...arguments_: readonly any[]) => unknown
|
|
8
8
|
|
|
9
9
|
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
|
package/src/lib/request.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type FetchLike = (
|
|
|
40
40
|
// different AbortSignal implementations. The types of each property are not
|
|
41
41
|
// important to validate since it is blindly passed to a given `fetch()`
|
|
42
42
|
// function.
|
|
43
|
-
//
|
|
43
|
+
// oxlint-disable-next-line no-explicit-any
|
|
44
44
|
export type AbortSignalLike = any
|
|
45
45
|
|
|
46
46
|
/**
|
|
@@ -62,7 +62,7 @@ export interface RequestInitLike extends Pick<RequestInit, "cache"> {
|
|
|
62
62
|
*/
|
|
63
63
|
// We want to keep the body type as compatible as possible, so
|
|
64
64
|
// we only declare the type we need and accept anything else.
|
|
65
|
-
//
|
|
65
|
+
// oxlint-disable-next-line no-explicit-any
|
|
66
66
|
body?: any | FormData | string
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -90,7 +90,7 @@ export interface ResponseLike {
|
|
|
90
90
|
status: number
|
|
91
91
|
headers: HeadersLike
|
|
92
92
|
url: string
|
|
93
|
-
//
|
|
93
|
+
// oxlint-disable-next-line no-explicit-any
|
|
94
94
|
json(): Promise<any>
|
|
95
95
|
text(): Promise<string>
|
|
96
96
|
blob(): Promise<Blob>
|
|
@@ -4,7 +4,7 @@ let lastMessage: string | undefined
|
|
|
4
4
|
let lastCalledAt = 0
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Logs a
|
|
7
|
+
* Logs a warning. If the message is identical the immediate previous logged
|
|
8
8
|
* message and that message was logged within 5 seconds of the current call, the
|
|
9
9
|
* log is ignored. This throttle behavior prevents identical messages from
|
|
10
10
|
* flooding the console.
|
|
@@ -12,17 +12,7 @@ let lastCalledAt = 0
|
|
|
12
12
|
* @param message - A message to log.
|
|
13
13
|
* @param config - Configuration for the log.
|
|
14
14
|
*/
|
|
15
|
-
export const
|
|
16
|
-
message: string,
|
|
17
|
-
config: {
|
|
18
|
-
/**
|
|
19
|
-
* The log level. Matches the global `console` log levels.
|
|
20
|
-
*/
|
|
21
|
-
level?: "log" | "warn" | "error"
|
|
22
|
-
} = {},
|
|
23
|
-
): void => {
|
|
24
|
-
const { level = "log" } = config
|
|
25
|
-
|
|
15
|
+
export const throttledWarn = (message: string): void => {
|
|
26
16
|
if (
|
|
27
17
|
message === lastMessage &&
|
|
28
18
|
Date.now() - lastCalledAt < THROTTLE_THRESHOLD_MS
|
|
@@ -35,6 +25,5 @@ export const throttledLog = (
|
|
|
35
25
|
lastCalledAt = Date.now()
|
|
36
26
|
lastMessage = message
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
console[level](message)
|
|
28
|
+
console.warn(message)
|
|
40
29
|
}
|
|
@@ -39,7 +39,7 @@ export type InjectMigrationSpecificTypes<T> = T extends RTImageNode
|
|
|
39
39
|
| InjectMigrationSpecificTypes<
|
|
40
40
|
Omit<T, "id" | "slice_label" | "version">
|
|
41
41
|
>
|
|
42
|
-
: //
|
|
42
|
+
: // oxlint-disable-next-line no-explicit-any
|
|
43
43
|
T extends Record<any, any>
|
|
44
44
|
? { [P in keyof T]: InjectMigrationSpecificTypes<T[P]> }
|
|
45
45
|
: T extends Array<infer U>
|
package/src/types/value/date.ts
CHANGED
|
@@ -8,4 +8,4 @@ import type { FieldState } from "./types"
|
|
|
8
8
|
* @see More details: {@link https://prismic.io/docs/date}
|
|
9
9
|
*/
|
|
10
10
|
export type DateField<State extends FieldState = FieldState> =
|
|
11
|
-
State extends "empty" ? null :
|
|
11
|
+
State extends "empty" ? null : string
|
|
@@ -83,7 +83,7 @@ export interface PrismicDocument<
|
|
|
83
83
|
DataInterface extends Record<
|
|
84
84
|
string,
|
|
85
85
|
AnyRegularField | GroupField | SliceZone
|
|
86
|
-
//
|
|
86
|
+
// oxlint-disable-next-line no-explicit-any
|
|
87
87
|
> = Record<string, any>,
|
|
88
88
|
TypeEnum = string,
|
|
89
89
|
LangEnum = string,
|
|
@@ -105,7 +105,7 @@ export interface PrismicDocumentWithoutUID<
|
|
|
105
105
|
DataInterface extends Record<
|
|
106
106
|
string,
|
|
107
107
|
AnyRegularField | GroupField | SliceZone
|
|
108
|
-
//
|
|
108
|
+
// oxlint-disable-next-line no-explicit-any
|
|
109
109
|
> = Record<string, any>,
|
|
110
110
|
TypeEnum = string,
|
|
111
111
|
LangEnum = string,
|
|
@@ -131,7 +131,7 @@ export interface PrismicDocumentWithUID<
|
|
|
131
131
|
DataInterface extends Record<
|
|
132
132
|
string,
|
|
133
133
|
AnyRegularField | GroupField | SliceZone
|
|
134
|
-
//
|
|
134
|
+
// oxlint-disable-next-line no-explicit-any
|
|
135
135
|
> = Record<string, any>,
|
|
136
136
|
TypeEnum = string,
|
|
137
137
|
LangEnum = string,
|