@prismicio/client 7.21.7 → 7.21.8-canary.ed5a769
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 +190 -263
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +175 -241
- package/dist/Client.d.cts.map +1 -1
- package/dist/Client.d.ts +175 -241
- package/dist/Client.d.ts.map +1 -1
- package/dist/Client.js +190 -263
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +54 -86
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +50 -84
- package/dist/Migration.d.cts.map +1 -1
- package/dist/Migration.d.ts +50 -84
- package/dist/Migration.d.ts.map +1 -1
- package/dist/Migration.js +54 -86
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +78 -77
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +50 -63
- package/dist/WriteClient.d.cts.map +1 -1
- package/dist/WriteClient.d.ts +50 -63
- package/dist/WriteClient.d.ts.map +1 -1
- package/dist/WriteClient.js +78 -77
- package/dist/WriteClient.js.map +1 -1
- package/dist/buildQueryURL.cjs +15 -22
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +53 -63
- package/dist/buildQueryURL.d.cts.map +1 -1
- package/dist/buildQueryURL.d.ts +53 -63
- package/dist/buildQueryURL.d.ts.map +1 -1
- package/dist/buildQueryURL.js +15 -22
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs +1 -4
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.d.cts +1 -4
- package/dist/cookie.d.cts.map +1 -1
- package/dist/cookie.d.ts +1 -4
- package/dist/cookie.d.ts.map +1 -1
- package/dist/cookie.js +1 -4
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +10 -14
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +11 -18
- package/dist/createClient.d.cts.map +1 -1
- package/dist/createClient.d.ts +11 -18
- package/dist/createClient.d.ts.map +1 -1
- package/dist/createClient.js +10 -14
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs +4 -7
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +5 -11
- package/dist/createMigration.d.cts.map +1 -1
- package/dist/createMigration.d.ts +5 -11
- package/dist/createMigration.d.ts.map +1 -1
- package/dist/createMigration.js +4 -7
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs +8 -13
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +10 -15
- package/dist/createWriteClient.d.cts.map +1 -1
- package/dist/createWriteClient.d.ts +10 -15
- package/dist/createWriteClient.d.ts.map +1 -1
- package/dist/createWriteClient.js +8 -13
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/filter.cjs +5 -18
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +59 -63
- package/dist/filter.d.cts.map +1 -1
- package/dist/filter.d.ts +59 -63
- package/dist/filter.d.ts.map +1 -1
- package/dist/filter.js +5 -18
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs +0 -2
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +0 -2
- package/dist/getGraphQLEndpoint.d.cts.map +1 -1
- package/dist/getGraphQLEndpoint.d.ts +0 -2
- package/dist/getGraphQLEndpoint.d.ts.map +1 -1
- package/dist/getGraphQLEndpoint.js +0 -2
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs +4 -8
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +4 -8
- package/dist/getRepositoryEndpoint.d.cts.map +1 -1
- package/dist/getRepositoryEndpoint.d.ts +4 -8
- package/dist/getRepositoryEndpoint.d.ts.map +1 -1
- package/dist/getRepositoryEndpoint.js +4 -8
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs +2 -5
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +2 -5
- package/dist/getRepositoryName.d.cts.map +1 -1
- package/dist/getRepositoryName.d.ts +2 -5
- package/dist/getRepositoryName.d.ts.map +1 -1
- package/dist/getRepositoryName.js +2 -5
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs +17 -19
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +17 -19
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +17 -19
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js +17 -19
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs +6 -9
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +5 -10
- package/dist/helpers/asDate.d.cts.map +1 -1
- package/dist/helpers/asDate.d.ts +5 -10
- package/dist/helpers/asDate.d.ts.map +1 -1
- package/dist/helpers/asDate.js +6 -9
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +25 -26
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +29 -55
- package/dist/helpers/asHTML.d.cts.map +1 -1
- package/dist/helpers/asHTML.d.ts +29 -55
- package/dist/helpers/asHTML.d.ts.map +1 -1
- package/dist/helpers/asHTML.js +25 -26
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -27
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +25 -36
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +25 -36
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -27
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs +7 -12
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +8 -15
- package/dist/helpers/asImageSrc.d.cts.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +8 -15
- package/dist/helpers/asImageSrc.d.ts.map +1 -1
- package/dist/helpers/asImageSrc.js +7 -12
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +25 -32
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +29 -41
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +29 -41
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.js +25 -32
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +15 -32
- package/dist/helpers/asLink.d.cts.map +1 -1
- package/dist/helpers/asLink.d.ts +15 -32
- package/dist/helpers/asLink.d.ts.map +1 -1
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs +8 -11
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +9 -14
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +9 -14
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -1
- package/dist/helpers/asLinkAttrs.js +8 -11
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +10 -23
- package/dist/helpers/asText.d.cts.map +1 -1
- package/dist/helpers/asText.d.ts +10 -23
- package/dist/helpers/asText.d.ts.map +1 -1
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs +2 -7
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +1 -5
- package/dist/helpers/documentToLinkField.d.cts.map +1 -1
- package/dist/helpers/documentToLinkField.d.ts +1 -5
- package/dist/helpers/documentToLinkField.d.ts.map +1 -1
- package/dist/helpers/documentToLinkField.js +2 -7
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +8 -35
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +8 -32
- package/dist/helpers/isFilled.d.cts.map +1 -1
- package/dist/helpers/isFilled.d.ts +8 -32
- package/dist/helpers/isFilled.d.ts.map +1 -1
- package/dist/helpers/isFilled.js +8 -35
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs +8 -10
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +35 -63
- package/dist/helpers/mapSliceZone.d.cts.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +35 -63
- package/dist/helpers/mapSliceZone.d.ts.map +1 -1
- package/dist/helpers/mapSliceZone.js +8 -10
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.cjs +11 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -51
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +38 -51
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -17
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +3 -4
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +3 -4
- package/dist/isRepositoryEndpoint.d.cts.map +1 -1
- package/dist/isRepositoryEndpoint.d.ts +3 -4
- package/dist/isRepositoryEndpoint.d.ts.map +1 -1
- package/dist/isRepositoryEndpoint.js +3 -4
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs +1 -2
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.d.cts +1 -2
- package/dist/isRepositoryName.d.cts.map +1 -1
- package/dist/isRepositoryName.d.ts +1 -2
- package/dist/isRepositoryName.d.ts.map +1 -1
- package/dist/isRepositoryName.js +1 -2
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/devMsg.cjs +6 -8
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +6 -8
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs +5 -6
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js +5 -6
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs +1 -3
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js +1 -3
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs +0 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js +0 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs +7 -17
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js +7 -17
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs +2 -16
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js +2 -16
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/pLimit.cjs +5 -7
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js +5 -7
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +12 -23
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +7 -20
- package/dist/lib/request.d.cts.map +1 -1
- package/dist/lib/request.d.ts +7 -20
- package/dist/lib/request.d.ts.map +1 -1
- package/dist/lib/request.js +12 -23
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +7 -15
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +7 -15
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/throttledWarn.cjs +3 -4
- package/dist/lib/throttledWarn.cjs.map +1 -1
- package/dist/lib/throttledWarn.js +3 -4
- package/dist/lib/throttledWarn.js.map +1 -1
- package/dist/lib/validateAssetMetadata.cjs +6 -18
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js +6 -18
- package/dist/lib/validateAssetMetadata.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/richtext/asText.cjs +0 -2
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +0 -2
- package/dist/richtext/asText.d.cts.map +1 -1
- package/dist/richtext/asText.d.ts +0 -2
- package/dist/richtext/asText.d.ts.map +1 -1
- package/dist/richtext/asText.js +0 -2
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs +2 -4
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +2 -4
- package/dist/richtext/asTree.d.cts.map +1 -1
- package/dist/richtext/asTree.d.ts +2 -4
- package/dist/richtext/asTree.d.ts.map +1 -1
- package/dist/richtext/asTree.js +2 -4
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs +4 -7
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +4 -7
- package/dist/richtext/composeSerializers.d.cts.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +4 -7
- package/dist/richtext/composeSerializers.d.ts.map +1 -1
- package/dist/richtext/composeSerializers.js +4 -7
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs +2 -6
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +2 -6
- package/dist/richtext/serialize.d.cts.map +1 -1
- package/dist/richtext/serialize.d.ts +2 -6
- package/dist/richtext/serialize.d.ts.map +1 -1
- package/dist/richtext/serialize.js +2 -6
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +3 -7
- package/dist/richtext/types.d.cts.map +1 -1
- package/dist/richtext/types.d.ts +3 -7
- package/dist/richtext/types.d.ts.map +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs +2 -5
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +2 -5
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +2 -5
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -1
- package/dist/richtext/wrapMapSerializer.js +2 -5
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/asset/asset.d.cts +17 -70
- package/dist/types/api/asset/asset.d.cts.map +1 -1
- package/dist/types/api/asset/asset.d.ts +17 -70
- package/dist/types/api/asset/asset.d.ts.map +1 -1
- package/dist/types/api/asset/tag.d.cts +5 -23
- package/dist/types/api/asset/tag.d.cts.map +1 -1
- package/dist/types/api/asset/tag.d.ts +5 -23
- package/dist/types/api/asset/tag.d.ts.map +1 -1
- package/dist/types/api/integration.d.cts +2 -4
- package/dist/types/api/integration.d.cts.map +1 -1
- package/dist/types/api/integration.d.ts +2 -4
- package/dist/types/api/integration.d.ts.map +1 -1
- package/dist/types/api/migration/release.d.cts +16 -0
- package/dist/types/api/migration/release.d.cts.map +1 -0
- package/dist/types/api/migration/release.d.ts +16 -0
- package/dist/types/api/migration/release.d.ts.map +1 -0
- package/dist/types/api/query.d.cts +10 -27
- package/dist/types/api/query.d.cts.map +1 -1
- package/dist/types/api/query.d.ts +10 -27
- package/dist/types/api/query.d.ts.map +1 -1
- package/dist/types/api/ref.d.cts +6 -16
- package/dist/types/api/ref.d.cts.map +1 -1
- package/dist/types/api/ref.d.ts +6 -16
- package/dist/types/api/ref.d.ts.map +1 -1
- package/dist/types/api/release.d.cts +1 -2
- package/dist/types/api/release.d.cts.map +1 -1
- package/dist/types/api/release.d.ts +1 -2
- package/dist/types/api/release.d.ts.map +1 -1
- package/dist/types/api/repository.d.cts +18 -45
- package/dist/types/api/repository.d.cts.map +1 -1
- package/dist/types/api/repository.d.ts +18 -45
- package/dist/types/api/repository.d.ts.map +1 -1
- package/dist/types/api/tags.d.cts +2 -3
- package/dist/types/api/tags.d.cts.map +1 -1
- package/dist/types/api/tags.d.ts +2 -3
- package/dist/types/api/tags.d.ts.map +1 -1
- package/dist/types/migration/Asset.cjs +4 -13
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +20 -66
- package/dist/types/migration/Asset.d.cts.map +1 -1
- package/dist/types/migration/Asset.d.ts +20 -66
- package/dist/types/migration/Asset.d.ts.map +1 -1
- package/dist/types/migration/Asset.js +4 -13
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +1 -3
- package/dist/types/migration/ContentRelationship.d.cts.map +1 -1
- package/dist/types/migration/ContentRelationship.d.ts +1 -3
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -1
- package/dist/types/migration/Document.cjs +10 -19
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +12 -31
- package/dist/types/migration/Document.d.cts.map +1 -1
- package/dist/types/migration/Document.d.ts +12 -31
- package/dist/types/migration/Document.d.ts.map +1 -1
- package/dist/types/migration/Document.js +10 -19
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/contentRelationship.d.cts +5 -15
- package/dist/types/model/contentRelationship.d.cts.map +1 -1
- package/dist/types/model/contentRelationship.d.ts +5 -15
- package/dist/types/model/contentRelationship.d.ts.map +1 -1
- package/dist/types/model/customType.d.cts +6 -17
- package/dist/types/model/customType.d.cts.map +1 -1
- package/dist/types/model/customType.d.ts +6 -17
- package/dist/types/model/customType.d.ts.map +1 -1
- package/dist/types/model/image.d.cts.map +1 -1
- package/dist/types/model/image.d.ts.map +1 -1
- package/dist/types/model/linkToMedia.d.cts.map +1 -1
- package/dist/types/model/linkToMedia.d.ts.map +1 -1
- package/dist/types/model/range.d.cts +1 -3
- package/dist/types/model/range.d.cts.map +1 -1
- package/dist/types/model/range.d.ts +1 -3
- package/dist/types/model/range.d.ts.map +1 -1
- package/dist/types/model/separator.d.cts +1 -3
- package/dist/types/model/separator.d.cts.map +1 -1
- package/dist/types/model/separator.d.ts +1 -3
- package/dist/types/model/separator.d.ts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.cts +1 -3
- package/dist/types/model/slice.d.cts.map +1 -1
- package/dist/types/model/slice.d.ts +1 -3
- package/dist/types/model/slice.d.ts.map +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.cts.map +1 -1
- package/dist/types/model/sliceZone.d.ts.map +1 -1
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/types.cjs +1 -3
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +9 -31
- package/dist/types/model/types.d.cts.map +1 -1
- package/dist/types/model/types.d.ts +9 -31
- package/dist/types/model/types.d.ts.map +1 -1
- package/dist/types/model/types.js +1 -3
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/value/color.d.cts +0 -1
- package/dist/types/value/color.d.cts.map +1 -1
- package/dist/types/value/color.d.ts +0 -1
- package/dist/types/value/color.d.ts.map +1 -1
- package/dist/types/value/contentRelationship.d.cts +3 -5
- package/dist/types/value/contentRelationship.d.cts.map +1 -1
- package/dist/types/value/contentRelationship.d.ts +3 -5
- package/dist/types/value/contentRelationship.d.ts.map +1 -1
- package/dist/types/value/date.d.cts +0 -1
- package/dist/types/value/date.d.cts.map +1 -1
- package/dist/types/value/date.d.ts +0 -1
- package/dist/types/value/date.d.ts.map +1 -1
- package/dist/types/value/document.d.cts +23 -50
- package/dist/types/value/document.d.cts.map +1 -1
- package/dist/types/value/document.d.ts +23 -50
- package/dist/types/value/document.d.ts.map +1 -1
- package/dist/types/value/embed.cjs +1 -1
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +28 -95
- package/dist/types/value/embed.d.cts.map +1 -1
- package/dist/types/value/embed.d.ts +28 -95
- package/dist/types/value/embed.d.ts.map +1 -1
- package/dist/types/value/embed.js +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +0 -1
- package/dist/types/value/geoPoint.d.cts.map +1 -1
- package/dist/types/value/geoPoint.d.ts +0 -1
- package/dist/types/value/geoPoint.d.ts.map +1 -1
- package/dist/types/value/group.d.cts.map +1 -1
- package/dist/types/value/group.d.ts.map +1 -1
- package/dist/types/value/image.d.cts +5 -8
- package/dist/types/value/image.d.cts.map +1 -1
- package/dist/types/value/image.d.ts +5 -8
- package/dist/types/value/image.d.ts.map +1 -1
- package/dist/types/value/integration.d.cts +0 -1
- package/dist/types/value/integration.d.cts.map +1 -1
- package/dist/types/value/integration.d.ts +0 -1
- package/dist/types/value/integration.d.ts.map +1 -1
- package/dist/types/value/keyText.d.cts +0 -1
- package/dist/types/value/keyText.d.cts.map +1 -1
- package/dist/types/value/keyText.d.ts +0 -1
- package/dist/types/value/keyText.d.ts.map +1 -1
- package/dist/types/value/link.cjs +1 -3
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +8 -12
- package/dist/types/value/link.d.cts.map +1 -1
- package/dist/types/value/link.d.ts +8 -12
- package/dist/types/value/link.d.ts.map +1 -1
- package/dist/types/value/link.js +1 -3
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts.map +1 -1
- package/dist/types/value/linkToMedia.d.ts.map +1 -1
- package/dist/types/value/number.d.cts +0 -1
- package/dist/types/value/number.d.cts.map +1 -1
- package/dist/types/value/number.d.ts +0 -1
- package/dist/types/value/number.d.ts.map +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.cts +26 -77
- package/dist/types/value/richText.d.cts.map +1 -1
- package/dist/types/value/richText.d.ts +26 -77
- package/dist/types/value/richText.d.ts.map +1 -1
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.cts +0 -1
- package/dist/types/value/select.d.cts.map +1 -1
- package/dist/types/value/select.d.ts +0 -1
- package/dist/types/value/select.d.ts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.cts +1 -3
- package/dist/types/value/sharedSliceVariation.d.cts.map +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +1 -3
- package/dist/types/value/sharedSliceVariation.d.ts.map +1 -1
- package/dist/types/value/slice.d.cts.map +1 -1
- package/dist/types/value/slice.d.ts.map +1 -1
- package/dist/types/value/sliceZone.d.cts +3 -4
- package/dist/types/value/sliceZone.d.cts.map +1 -1
- package/dist/types/value/sliceZone.d.ts +3 -4
- package/dist/types/value/sliceZone.d.ts.map +1 -1
- package/dist/types/value/table.d.cts +14 -63
- package/dist/types/value/table.d.cts.map +1 -1
- package/dist/types/value/table.d.ts +14 -63
- package/dist/types/value/table.d.ts.map +1 -1
- package/dist/types/value/timestamp.d.cts.map +1 -1
- package/dist/types/value/timestamp.d.ts.map +1 -1
- package/dist/types/value/title.d.cts +1 -1
- package/dist/types/value/title.d.cts.map +1 -1
- package/dist/types/value/title.d.ts +1 -1
- package/dist/types/value/title.d.ts.map +1 -1
- package/dist/types/value/types.d.cts +11 -24
- package/dist/types/value/types.d.cts.map +1 -1
- package/dist/types/value/types.d.ts +11 -24
- package/dist/types/value/types.d.ts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.cts +1 -3
- package/dist/types/webhook/apiUpdate.d.cts.map +1 -1
- package/dist/types/webhook/apiUpdate.d.ts +1 -3
- package/dist/types/webhook/apiUpdate.d.ts.map +1 -1
- package/package.json +32 -34
- package/src/Client.ts +236 -399
- package/src/Migration.ts +80 -139
- package/src/WriteClient.ts +118 -174
- package/src/buildQueryURL.ts +68 -100
- package/src/cookie.ts +1 -4
- package/src/createClient.ts +12 -20
- package/src/createMigration.ts +8 -16
- package/src/createWriteClient.ts +11 -19
- package/src/errors.ts +5 -15
- package/src/filter.ts +79 -122
- package/src/getGraphQLEndpoint.ts +0 -3
- package/src/getRepositoryEndpoint.ts +4 -9
- package/src/getRepositoryName.ts +2 -5
- package/src/getToolbarSrc.ts +17 -20
- package/src/helpers/asDate.ts +13 -18
- package/src/helpers/asHTML.ts +55 -102
- package/src/helpers/asImagePixelDensitySrcSet.ts +29 -49
- package/src/helpers/asImageSrc.ts +8 -16
- package/src/helpers/asImageWidthSrcSet.ts +33 -52
- package/src/helpers/asLink.ts +26 -54
- package/src/helpers/asLinkAttrs.ts +14 -29
- package/src/helpers/asText.ts +15 -31
- package/src/helpers/documentToLinkField.ts +4 -15
- package/src/helpers/isFilled.ts +14 -51
- package/src/helpers/mapSliceZone.ts +42 -84
- package/src/index.ts +20 -68
- package/src/isRepositoryEndpoint.ts +3 -4
- package/src/isRepositoryName.ts +1 -2
- package/src/lib/devMsg.ts +6 -8
- package/src/lib/getOptionalLinkProperties.ts +5 -6
- package/src/lib/getPreviewCookie.ts +1 -3
- package/src/lib/isInternalURL.ts +0 -1
- package/src/lib/isMigrationValue.ts +9 -22
- package/src/lib/isValue.ts +9 -38
- package/src/lib/pLimit.ts +9 -16
- package/src/lib/request.ts +15 -40
- package/src/lib/resolveMigrationDocumentData.ts +8 -27
- package/src/lib/serializerHelpers.ts +9 -29
- package/src/lib/throttledWarn.ts +4 -8
- package/src/lib/validateAssetMetadata.ts +17 -43
- package/src/richtext/asText.ts +2 -8
- package/src/richtext/asTree.ts +8 -26
- package/src/richtext/composeSerializers.ts +5 -11
- package/src/richtext/serialize.ts +4 -12
- package/src/richtext/types.ts +13 -57
- package/src/richtext/wrapMapSerializer.ts +4 -8
- package/src/types/api/asset/asset.ts +26 -77
- package/src/types/api/asset/tag.ts +6 -18
- package/src/types/api/integration.ts +4 -10
- package/src/types/api/migration/document.ts +11 -27
- package/src/types/api/migration/release.ts +12 -0
- package/src/types/api/query.ts +10 -27
- package/src/types/api/ref.ts +6 -16
- package/src/types/api/release.ts +1 -2
- package/src/types/api/repository.ts +18 -45
- package/src/types/api/tags.ts +2 -3
- package/src/types/migration/Asset.ts +26 -82
- package/src/types/migration/ContentRelationship.ts +5 -12
- package/src/types/migration/Document.ts +26 -52
- package/src/types/migration/Link.ts +7 -9
- package/src/types/model/contentRelationship.ts +7 -20
- package/src/types/model/customType.ts +7 -21
- package/src/types/model/image.ts +4 -5
- package/src/types/model/linkToMedia.ts +1 -2
- package/src/types/model/range.ts +1 -3
- package/src/types/model/separator.ts +1 -3
- package/src/types/model/sharedSliceVariation.ts +4 -4
- package/src/types/model/slice.ts +7 -12
- package/src/types/model/sliceZone.ts +4 -11
- package/src/types/model/types.ts +10 -31
- package/src/types/value/color.ts +3 -3
- package/src/types/value/contentRelationship.ts +8 -13
- package/src/types/value/date.ts +1 -3
- package/src/types/value/document.ts +24 -52
- package/src/types/value/embed.ts +33 -80
- package/src/types/value/geoPoint.ts +6 -8
- package/src/types/value/group.ts +1 -4
- package/src/types/value/image.ts +10 -14
- package/src/types/value/integration.ts +0 -1
- package/src/types/value/keyText.ts +3 -3
- package/src/types/value/link.ts +14 -22
- package/src/types/value/linkToMedia.ts +2 -5
- package/src/types/value/number.ts +3 -3
- package/src/types/value/richText.ts +30 -82
- package/src/types/value/select.ts +0 -1
- package/src/types/value/sharedSliceVariation.ts +3 -11
- package/src/types/value/slice.ts +2 -8
- package/src/types/value/sliceZone.ts +4 -6
- package/src/types/value/table.ts +25 -64
- package/src/types/value/timestamp.ts +3 -2
- package/src/types/value/title.ts +16 -18
- package/src/types/value/types.ts +8 -21
- package/src/types/webhook/apiUpdate.ts +1 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the
|
|
1
|
+
{"version":3,"file":"getPreviewCookie.cjs","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;AAC5C,QAAO,MAAM,QAAQ,QAAQ,IAAI;;;;;;;;AASlC,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAI;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAAA,sBAErB;AAC/B,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
|
|
@@ -6,9 +6,7 @@ const readValue = (value) => {
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns the value of a cookie from a given cookie store.
|
|
8
8
|
*
|
|
9
|
-
* @param cookieJar - The stringified cookie store from which to read the
|
|
10
|
-
* cookie.
|
|
11
|
-
*
|
|
9
|
+
* @param cookieJar - The stringified cookie store from which to read the cookie.
|
|
12
10
|
* @returns The value of the cookie, if it exists.
|
|
13
11
|
*/
|
|
14
12
|
const getPreviewCookie = (cookieJar) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviewCookie.js","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the
|
|
1
|
+
{"version":3,"file":"getPreviewCookie.js","names":[],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the cookie.\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;AAEA,MAAM,aAAa,UAA0B;AAC5C,QAAO,MAAM,QAAQ,QAAQ,IAAI;;;;;;;;AASlC,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAI;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAAA,sBAErB;AAC/B,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n
|
|
1
|
+
{"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.js","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n
|
|
1
|
+
{"version":3,"file":"isInternalURL.js","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
|
|
@@ -8,14 +8,11 @@ const require_isValue = require("./isValue.cjs");
|
|
|
8
8
|
* Checks if a value is a migration content relationship field.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a link
|
|
12
|
+
* field, not strictly a content relationship field.
|
|
14
13
|
* @param value - Value to check.
|
|
15
|
-
*
|
|
16
14
|
* @returns `true` if `value` is a migration content relationship field, `false`
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* otherwise.
|
|
19
16
|
* @internal
|
|
20
17
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
21
18
|
*/
|
|
@@ -26,9 +23,7 @@ const contentRelationship = (value) => {
|
|
|
26
23
|
* Checks if a value is a migration image field.
|
|
27
24
|
*
|
|
28
25
|
* @param value - Value to check.
|
|
29
|
-
*
|
|
30
26
|
* @returns `true` if `value` is a migration image field, `false` otherwise.
|
|
31
|
-
*
|
|
32
27
|
* @internal
|
|
33
28
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
34
29
|
*/
|
|
@@ -38,15 +33,12 @@ const image = (value) => {
|
|
|
38
33
|
/**
|
|
39
34
|
* Checks if a value is a migration link to media field.
|
|
40
35
|
*
|
|
41
|
-
* - @remarks `OptionalLinkProperties` is included because
|
|
42
|
-
*
|
|
43
|
-
* relationship field.
|
|
36
|
+
* - @remarks `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a
|
|
37
|
+
* link field, not strictly a content relationship field.
|
|
44
38
|
*
|
|
45
39
|
* @param value - Value to check.
|
|
46
|
-
*
|
|
47
40
|
* @returns `true` if `value` is a migration link to media field, `false`
|
|
48
|
-
*
|
|
49
|
-
*
|
|
41
|
+
* otherwise.
|
|
50
42
|
* @internal
|
|
51
43
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
52
44
|
*/
|
|
@@ -57,10 +49,8 @@ const linkToMedia = (value) => {
|
|
|
57
49
|
* Checks if a value is a migration rich text image node.
|
|
58
50
|
*
|
|
59
51
|
* @param value - Value to check.
|
|
60
|
-
*
|
|
61
52
|
* @returns `true` if `value` is a migration rich text image node, `false`
|
|
62
|
-
*
|
|
63
|
-
*
|
|
53
|
+
* otherwise.
|
|
64
54
|
* @internal
|
|
65
55
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
66
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\
|
|
1
|
+
{"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiBA,iBAAAA,4BAAAA,gBAAAA,gBACE,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,aAAAA,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;AAYzD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiBC,cAAAA,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0BA,cAAAA,sBAC9C;;;;;;;;;;;;;;AAgBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,cAAAA,yBACpB,eAAe,SACf,MAAM,cAAcD,aAAAA,SAAS;;;;;;;;;;;AAa/B,MAAa,eAAe,UAAuD;AAClF,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,cAAAA,yBACpB,UAAU,SACV,MAAM,SAASC,iBAAAA,iBAAiB"}
|
|
@@ -8,14 +8,11 @@ import { prismicDocument } from "./isValue.js";
|
|
|
8
8
|
* Checks if a value is a migration content relationship field.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a link
|
|
12
|
+
* field, not strictly a content relationship field.
|
|
14
13
|
* @param value - Value to check.
|
|
15
|
-
*
|
|
16
14
|
* @returns `true` if `value` is a migration content relationship field, `false`
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* otherwise.
|
|
19
16
|
* @internal
|
|
20
17
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
21
18
|
*/
|
|
@@ -26,9 +23,7 @@ const contentRelationship = (value) => {
|
|
|
26
23
|
* Checks if a value is a migration image field.
|
|
27
24
|
*
|
|
28
25
|
* @param value - Value to check.
|
|
29
|
-
*
|
|
30
26
|
* @returns `true` if `value` is a migration image field, `false` otherwise.
|
|
31
|
-
*
|
|
32
27
|
* @internal
|
|
33
28
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
34
29
|
*/
|
|
@@ -38,15 +33,12 @@ const image = (value) => {
|
|
|
38
33
|
/**
|
|
39
34
|
* Checks if a value is a migration link to media field.
|
|
40
35
|
*
|
|
41
|
-
* - @remarks `OptionalLinkProperties` is included because
|
|
42
|
-
*
|
|
43
|
-
* relationship field.
|
|
36
|
+
* - @remarks `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a
|
|
37
|
+
* link field, not strictly a content relationship field.
|
|
44
38
|
*
|
|
45
39
|
* @param value - Value to check.
|
|
46
|
-
*
|
|
47
40
|
* @returns `true` if `value` is a migration link to media field, `false`
|
|
48
|
-
*
|
|
49
|
-
*
|
|
41
|
+
* otherwise.
|
|
50
42
|
* @internal
|
|
51
43
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
52
44
|
*/
|
|
@@ -57,10 +49,8 @@ const linkToMedia = (value) => {
|
|
|
57
49
|
* Checks if a value is a migration rich text image node.
|
|
58
50
|
*
|
|
59
51
|
* @param value - Value to check.
|
|
60
|
-
*
|
|
61
52
|
* @returns `true` if `value` is a migration rich text image node, `false`
|
|
62
|
-
*
|
|
63
|
-
*
|
|
53
|
+
* otherwise.
|
|
64
54
|
* @internal
|
|
65
55
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
66
56
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\
|
|
1
|
+
{"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a link\n * field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because `MigrationContentRelationship` may be a\n * link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiB,4BACjBA,gBAAmB,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;AAYzD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0B,sBAC9C;;;;;;;;;;;;;;AAgBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;;;;;;;;;;;AAa/B,MAAa,eAAe,UAAuD;AAClF,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB"}
|
package/dist/lib/isValue.cjs
CHANGED
|
@@ -5,9 +5,7 @@ const require_link = require("../types/value/link.cjs");
|
|
|
5
5
|
* Checks if a value is a link to media field.
|
|
6
6
|
*
|
|
7
7
|
* @param value - Value to check.
|
|
8
|
-
*
|
|
9
8
|
* @returns `true` if `value` is a link to media field, `false` otherwise.
|
|
10
|
-
*
|
|
11
9
|
* @internal
|
|
12
10
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
13
11
|
*/
|
|
@@ -21,9 +19,7 @@ const filledLinkToMedia = (value) => {
|
|
|
21
19
|
* Checks if a value is like an image field.
|
|
22
20
|
*
|
|
23
21
|
* @param value - Value to check.
|
|
24
|
-
*
|
|
25
22
|
* @returns `true` if `value` is like an image field, `false` otherwise.
|
|
26
|
-
*
|
|
27
23
|
* @internal
|
|
28
24
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
29
25
|
*/
|
|
@@ -37,9 +33,7 @@ const imageLike = (value) => {
|
|
|
37
33
|
* Checks if a value is an image field.
|
|
38
34
|
*
|
|
39
35
|
* @param value - Value to check.
|
|
40
|
-
*
|
|
41
36
|
* @returns `true` if `value` is an image field, `false` otherwise.
|
|
42
|
-
*
|
|
43
37
|
* @internal
|
|
44
38
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
45
39
|
*/
|
|
@@ -51,9 +45,7 @@ const filledImage = (value) => {
|
|
|
51
45
|
* Checks if a value is a rich text image node.
|
|
52
46
|
*
|
|
53
47
|
* @param value - Value to check.
|
|
54
|
-
*
|
|
55
48
|
* @returns `true` if `value` is a rich text image node, `false` otherwise.
|
|
56
|
-
*
|
|
57
49
|
* @internal
|
|
58
50
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
59
51
|
*/
|
|
@@ -65,14 +57,10 @@ const rtImageNode = (value) => {
|
|
|
65
57
|
* Checks if a value is a content relationship field.
|
|
66
58
|
*
|
|
67
59
|
* @remarks
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* relationship field.
|
|
71
|
-
*
|
|
60
|
+
* The return value includes `OptionalLinkProperties` because `FilledContentRelationshipField` may
|
|
61
|
+
* be a link field, not strictly a content relationship field.
|
|
72
62
|
* @param value - Value to check.
|
|
73
|
-
*
|
|
74
63
|
* @returns `true` if `value` is a content relationship, `false` otherwise.
|
|
75
|
-
*
|
|
76
64
|
* @internal
|
|
77
65
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
78
66
|
*/
|
|
@@ -86,9 +74,7 @@ const filledContentRelationship = (value) => {
|
|
|
86
74
|
* Checks if a value is a Prismic document.
|
|
87
75
|
*
|
|
88
76
|
* @param value - Value to check.
|
|
89
|
-
*
|
|
90
77
|
* @returns `true` if `value` is a Prismic document, `false` otherwise.
|
|
91
|
-
*
|
|
92
78
|
* @internal
|
|
93
79
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
94
80
|
*/
|
package/dist/lib/isValue.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValue.cjs","names":["LinkType","RichTextNodeType"],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n *
|
|
1
|
+
{"version":3,"file":"isValue.cjs","names":["LinkType","RichTextNodeType"],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (value: UnknownValue): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is like an image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (value: UnknownValue): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is an image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (value: UnknownValue): value is ImageField<string, \"filled\"> => {\n\tif (imageLike(value) && (!(\"type\" in value) || value.type !== RichTextNodeType.image)) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (imageLike(value) && \"type\" in value && value.type === RichTextNodeType.image) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because `FilledContentRelationshipField` may\n * be a link field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (value: UnknownValue): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA+BA,MAAa,qBAAqB,UAAyD;AAC1F,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAcA,aAAAA,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAM,aAAa,UAA6E;AAC/F,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY;MAGlD,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAa,eAAe,UAA+D;AAC1F,KAAI,UAAU,MAAM,KAAK,EAAE,UAAU,UAAU,MAAM,SAASC,iBAAAA,iBAAiB,OAC9E,QAAO;AAGR,QAAO;;;;;;;;;;AAWR,MAAa,eAAe,UAA8C;AACzE,KAAI,UAAU,MAAM,IAAI,UAAU,SAAS,MAAM,SAASA,iBAAAA,iBAAiB,MAC1E,QAAO;AAGR,QAAO;;;;;;;;;;;;;AAcR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAcD,aAAAA,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAa,mBAAmB,UAAkD;AACjF,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
|
package/dist/lib/isValue.js
CHANGED
|
@@ -5,9 +5,7 @@ import { LinkType } from "../types/value/link.js";
|
|
|
5
5
|
* Checks if a value is a link to media field.
|
|
6
6
|
*
|
|
7
7
|
* @param value - Value to check.
|
|
8
|
-
*
|
|
9
8
|
* @returns `true` if `value` is a link to media field, `false` otherwise.
|
|
10
|
-
*
|
|
11
9
|
* @internal
|
|
12
10
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
13
11
|
*/
|
|
@@ -21,9 +19,7 @@ const filledLinkToMedia = (value) => {
|
|
|
21
19
|
* Checks if a value is like an image field.
|
|
22
20
|
*
|
|
23
21
|
* @param value - Value to check.
|
|
24
|
-
*
|
|
25
22
|
* @returns `true` if `value` is like an image field, `false` otherwise.
|
|
26
|
-
*
|
|
27
23
|
* @internal
|
|
28
24
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
29
25
|
*/
|
|
@@ -37,9 +33,7 @@ const imageLike = (value) => {
|
|
|
37
33
|
* Checks if a value is an image field.
|
|
38
34
|
*
|
|
39
35
|
* @param value - Value to check.
|
|
40
|
-
*
|
|
41
36
|
* @returns `true` if `value` is an image field, `false` otherwise.
|
|
42
|
-
*
|
|
43
37
|
* @internal
|
|
44
38
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
45
39
|
*/
|
|
@@ -51,9 +45,7 @@ const filledImage = (value) => {
|
|
|
51
45
|
* Checks if a value is a rich text image node.
|
|
52
46
|
*
|
|
53
47
|
* @param value - Value to check.
|
|
54
|
-
*
|
|
55
48
|
* @returns `true` if `value` is a rich text image node, `false` otherwise.
|
|
56
|
-
*
|
|
57
49
|
* @internal
|
|
58
50
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
59
51
|
*/
|
|
@@ -65,14 +57,10 @@ const rtImageNode = (value) => {
|
|
|
65
57
|
* Checks if a value is a content relationship field.
|
|
66
58
|
*
|
|
67
59
|
* @remarks
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* relationship field.
|
|
71
|
-
*
|
|
60
|
+
* The return value includes `OptionalLinkProperties` because `FilledContentRelationshipField` may
|
|
61
|
+
* be a link field, not strictly a content relationship field.
|
|
72
62
|
* @param value - Value to check.
|
|
73
|
-
*
|
|
74
63
|
* @returns `true` if `value` is a content relationship, `false` otherwise.
|
|
75
|
-
*
|
|
76
64
|
* @internal
|
|
77
65
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
78
66
|
*/
|
|
@@ -86,9 +74,7 @@ const filledContentRelationship = (value) => {
|
|
|
86
74
|
* Checks if a value is a Prismic document.
|
|
87
75
|
*
|
|
88
76
|
* @param value - Value to check.
|
|
89
|
-
*
|
|
90
77
|
* @returns `true` if `value` is a Prismic document, `false` otherwise.
|
|
91
|
-
*
|
|
92
78
|
* @internal
|
|
93
79
|
* This is not an official helper function and it's only designed to work with internal processes.
|
|
94
80
|
*/
|
package/dist/lib/isValue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValue.js","names":[],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n *
|
|
1
|
+
{"version":3,"file":"isValue.js","names":[],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (value: UnknownValue): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is like an image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (value: UnknownValue): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is an image field, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (value: UnknownValue): value is ImageField<string, \"filled\"> => {\n\tif (imageLike(value) && (!(\"type\" in value) || value.type !== RichTextNodeType.image)) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (imageLike(value) && \"type\" in value && value.type === RichTextNodeType.image) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because `FilledContentRelationshipField` may\n * be a link field, not strictly a content relationship field.\n * @param value - Value to check.\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (value: UnknownValue): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;AA+BA,MAAa,qBAAqB,UAAyD;AAC1F,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAc,SAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAM,aAAa,UAA6E;AAC/F,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY;MAGlD,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAa,eAAe,UAA+D;AAC1F,KAAI,UAAU,MAAM,KAAK,EAAE,UAAU,UAAU,MAAM,SAAS,iBAAiB,OAC9E,QAAO;AAGR,QAAO;;;;;;;;;;AAWR,MAAa,eAAe,UAA8C;AACzE,KAAI,UAAU,MAAM,IAAI,UAAU,SAAS,MAAM,SAAS,iBAAiB,MAC1E,QAAO;AAGR,QAAO;;;;;;;;;;;;;AAcR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa;MAEvD,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;AAWR,MAAa,mBAAmB,UAAkD;AACjF,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
|
package/dist/lib/pLimit.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/lib/pLimit.ts
|
|
2
2
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
3
|
/**
|
|
4
|
-
* Creates a limiting function that will only execute one promise at a time and
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param args - Options for the function, `interval` is the minimum time to
|
|
8
|
-
* wait between each promise execution.
|
|
4
|
+
* Creates a limiting function that will only execute one promise at a time and respect a given
|
|
5
|
+
* interval between each call.
|
|
9
6
|
*
|
|
7
|
+
* @param args - Options for the function, `interval` is the minimum time to wait between each
|
|
8
|
+
* promise execution.
|
|
10
9
|
* @returns A limiting function as per configuration, see {@link LimitFunction}.
|
|
11
10
|
*/
|
|
12
11
|
const pLimit = ({ interval } = {}) => {
|
|
@@ -15,8 +14,7 @@ const pLimit = ({ interval } = {}) => {
|
|
|
15
14
|
let lastCompletion = 0;
|
|
16
15
|
const resumeNext = () => {
|
|
17
16
|
if (!busy && queue.length > 0) {
|
|
18
|
-
|
|
19
|
-
(_queue$shift = queue.shift()) === null || _queue$shift === void 0 || _queue$shift();
|
|
17
|
+
queue.shift()?.();
|
|
20
18
|
busy = true;
|
|
21
19
|
}
|
|
22
20
|
};
|
package/dist/lib/pLimit.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pLimit.cjs","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing
|
|
1
|
+
{"version":3,"file":"pLimit.cjs","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the\n * `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't\n * need this optimization unless you're pushing a lot of functions.\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (...arguments_: TArguments) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and respect a given\n * interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to wait between each\n * promise execution.\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({ interval }: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;AAsB/E,MAAa,UAAU,EAAE,aAAoC,EAAE,KAAoB;CAClF,MAAM,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,SAAM,OAAO,IAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,KAAA,GAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
|
package/dist/lib/pLimit.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/lib/pLimit.ts
|
|
2
2
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3
3
|
/**
|
|
4
|
-
* Creates a limiting function that will only execute one promise at a time and
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param args - Options for the function, `interval` is the minimum time to
|
|
8
|
-
* wait between each promise execution.
|
|
4
|
+
* Creates a limiting function that will only execute one promise at a time and respect a given
|
|
5
|
+
* interval between each call.
|
|
9
6
|
*
|
|
7
|
+
* @param args - Options for the function, `interval` is the minimum time to wait between each
|
|
8
|
+
* promise execution.
|
|
10
9
|
* @returns A limiting function as per configuration, see {@link LimitFunction}.
|
|
11
10
|
*/
|
|
12
11
|
const pLimit = ({ interval } = {}) => {
|
|
@@ -15,8 +14,7 @@ const pLimit = ({ interval } = {}) => {
|
|
|
15
14
|
let lastCompletion = 0;
|
|
16
15
|
const resumeNext = () => {
|
|
17
16
|
if (!busy && queue.length > 0) {
|
|
18
|
-
|
|
19
|
-
(_queue$shift = queue.shift()) === null || _queue$shift === void 0 || _queue$shift();
|
|
17
|
+
queue.shift()?.();
|
|
20
18
|
busy = true;
|
|
21
19
|
}
|
|
22
20
|
};
|
package/dist/lib/pLimit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pLimit.js","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing
|
|
1
|
+
{"version":3,"file":"pLimit.js","names":[],"sources":["../../src/lib/pLimit.ts"],"sourcesContent":["/*\n ** Core logic from https://github.com/sindresorhus/p-limit\n ** Many thanks to @sindresorhus\n */\n\n// oxlint-disable-next-line no-explicit-any\ntype AnyFunction = (...arguments_: readonly any[]) => unknown\n\nconst sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * @param fn - Promise-returning/async function.\n * @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the\n * `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't\n * need this optimization unless you're pushing a lot of functions.\n * @returns The promise returned by calling `fn(...arguments)`.\n */\nexport type LimitFunction = <TArguments extends unknown[], TReturnType>(\n\tfunction_: (...arguments_: TArguments) => PromiseLike<TReturnType> | TReturnType,\n\t...arguments_: TArguments\n) => Promise<TReturnType>\n\n/**\n * Creates a limiting function that will only execute one promise at a time and respect a given\n * interval between each call.\n *\n * @param args - Options for the function, `interval` is the minimum time to wait between each\n * promise execution.\n * @returns A limiting function as per configuration, see {@link LimitFunction}.\n */\nexport const pLimit = ({ interval }: { interval?: number } = {}): LimitFunction => {\n\tconst queue: AnyFunction[] = []\n\tlet busy = false\n\tlet lastCompletion = 0\n\n\tconst resumeNext = () => {\n\t\tif (!busy && queue.length > 0) {\n\t\t\tqueue.shift()?.()\n\t\t\tbusy = true\n\t\t}\n\t}\n\n\tconst next = () => {\n\t\tbusy = false\n\n\t\tresumeNext()\n\t}\n\n\tconst run = async (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\tconst timeSinceLastCompletion = Date.now() - lastCompletion\n\n\t\tif (interval && timeSinceLastCompletion < interval) {\n\t\t\tawait sleep(interval - timeSinceLastCompletion)\n\t\t}\n\t\tconst result = (async () => function_(...arguments_))()\n\n\t\tresolve(result)\n\n\t\ttry {\n\t\t\tawait result\n\t\t} catch {}\n\n\t\tlastCompletion = Date.now()\n\n\t\tnext()\n\t}\n\n\tconst enqueue = (\n\t\tfunction_: AnyFunction,\n\t\tresolve: (value: unknown) => void,\n\t\targuments_: unknown[],\n\t) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise((internalResolve) => {\n\t\t\tqueue.push(internalResolve)\n\t\t}).then(run.bind(undefined, function_, resolve, arguments_))\n\t\t;(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve()\n\n\t\t\tif (!busy) {\n\t\t\t\tresumeNext()\n\t\t\t}\n\t\t})()\n\t}\n\n\treturn ((function_: AnyFunction, ...arguments_: unknown[]) =>\n\t\tnew Promise<unknown>((resolve) => {\n\t\t\tenqueue(function_, resolve, arguments_)\n\t\t})) as LimitFunction\n}\n"],"mappings":";AAQA,MAAM,SAAS,OAAe,IAAI,SAAS,YAAY,WAAW,SAAS,GAAG,CAAC;;;;;;;;;AAsB/E,MAAa,UAAU,EAAE,aAAoC,EAAE,KAAoB;CAClF,MAAM,QAAuB,EAAE;CAC/B,IAAI,OAAO;CACX,IAAI,iBAAiB;CAErB,MAAM,mBAAmB;AACxB,MAAI,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,SAAM,OAAO,IAAI;AACjB,UAAO;;;CAIT,MAAM,aAAa;AAClB,SAAO;AAEP,cAAY;;CAGb,MAAM,MAAM,OACX,WACA,SACA,eACI;EACJ,MAAM,0BAA0B,KAAK,KAAK,GAAG;AAE7C,MAAI,YAAY,0BAA0B,SACzC,OAAM,MAAM,WAAW,wBAAwB;EAEhD,MAAM,UAAU,YAAY,UAAU,GAAG,WAAW,GAAG;AAEvD,UAAQ,OAAO;AAEf,MAAI;AACH,SAAM;UACC;AAER,mBAAiB,KAAK,KAAK;AAE3B,QAAM;;CAGP,MAAM,WACL,WACA,SACA,eACI;AAGJ,MAAI,SAAS,oBAAoB;AAChC,SAAM,KAAK,gBAAgB;IAC1B,CAAC,KAAK,IAAI,KAAK,KAAA,GAAW,WAAW,SAAS,WAAW,CAAC;AAC3D,GAAC,YAAY;AAKb,SAAM,QAAQ,SAAS;AAEvB,OAAI,CAAC,KACJ,aAAY;MAEV;;AAGL,UAAS,WAAwB,GAAG,eACnC,IAAI,SAAkB,YAAY;AACjC,UAAQ,WAAW,SAAS,WAAW;GACtC"}
|
package/dist/lib/request.cjs
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
const require_pLimit = require("./pLimit.cjs");
|
|
2
2
|
//#region src/lib/request.ts
|
|
3
3
|
/**
|
|
4
|
-
* The default number of milliseconds to wait before retrying a rate-limited
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The default number of milliseconds to wait before retrying a rate-limited `fetch()` request (429
|
|
5
|
+
* response code). The default value is only used if the response does not include a `retry-after`
|
|
6
|
+
* header.
|
|
7
7
|
*/
|
|
8
8
|
const DEFAULT_RETRY_AFTER = 1500;
|
|
9
|
-
/**
|
|
10
|
-
* A record of URLs mapped to throttled task runners.
|
|
11
|
-
*/
|
|
9
|
+
/** A record of URLs mapped to throttled task runners. */
|
|
12
10
|
const THROTTLED_RUNNERS = {};
|
|
13
|
-
/**
|
|
14
|
-
* A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their
|
|
15
|
-
* optional signal.
|
|
16
|
-
*/
|
|
11
|
+
/** A record of URLs mapped to active deduplicated jobs. Jobs are keyed by their optional signal. */
|
|
17
12
|
const DEDUPLICATED_JOBS = {};
|
|
18
13
|
async function memoizeResponse(response) {
|
|
19
14
|
const buffer = await response.arrayBuffer();
|
|
@@ -31,32 +26,26 @@ async function memoizeResponse(response) {
|
|
|
31
26
|
return memoized;
|
|
32
27
|
}
|
|
33
28
|
/**
|
|
34
|
-
* Makes an HTTP request with automatic retry for rate limits and request
|
|
35
|
-
* deduplication.
|
|
29
|
+
* Makes an HTTP request with automatic retry for rate limits and request deduplication.
|
|
36
30
|
*
|
|
37
31
|
* @param url - The URL to request.
|
|
38
32
|
* @param init - Fetch options.
|
|
39
33
|
* @param fetchFn - The fetch function to use.
|
|
40
|
-
*
|
|
41
34
|
* @returns The response from the fetch request.
|
|
42
35
|
*/
|
|
43
36
|
async function request(url, init, fetchFn) {
|
|
44
37
|
const stringURL = url.toString();
|
|
45
38
|
let job;
|
|
46
|
-
if (init
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
var _DEDUPLICATED_JOBS$st;
|
|
51
|
-
const existingJob = (_DEDUPLICATED_JOBS$st = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st === void 0 ? void 0 : _DEDUPLICATED_JOBS$st.get(init === null || init === void 0 ? void 0 : init.signal);
|
|
39
|
+
if (init?.body) job = (THROTTLED_RUNNERS[url.hostname] ||= require_pLimit.pLimit({ interval: DEFAULT_RETRY_AFTER }))(() => fetchFn(stringURL, init));
|
|
40
|
+
else {
|
|
41
|
+
const existingJob = DEDUPLICATED_JOBS[stringURL]?.get(init?.signal);
|
|
52
42
|
if (existingJob) job = existingJob;
|
|
53
43
|
else {
|
|
54
44
|
job = fetchFn(stringURL, init).then(memoizeResponse).finally(() => {
|
|
55
|
-
|
|
56
|
-
(
|
|
57
|
-
if (((_DEDUPLICATED_JOBS$st3 = DEDUPLICATED_JOBS[stringURL]) === null || _DEDUPLICATED_JOBS$st3 === void 0 ? void 0 : _DEDUPLICATED_JOBS$st3.size) === 0) delete DEDUPLICATED_JOBS[stringURL];
|
|
45
|
+
DEDUPLICATED_JOBS[stringURL]?.delete(init?.signal);
|
|
46
|
+
if (DEDUPLICATED_JOBS[stringURL]?.size === 0) delete DEDUPLICATED_JOBS[stringURL];
|
|
58
47
|
});
|
|
59
|
-
(DEDUPLICATED_JOBS[stringURL]
|
|
48
|
+
(DEDUPLICATED_JOBS[stringURL] ||= /* @__PURE__ */ new Map()).set(init?.signal, job);
|
|
60
49
|
}
|
|
61
50
|
}
|
|
62
51
|
const response = await job;
|