@azure/storage-file-share 12.15.0-beta.1 → 12.20.0-alpha.20230607.3
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/index.js +7060 -7656
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BatchResponse.js +4 -0
- package/dist-esm/storage-blob/src/BatchResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchResponseParser.js +137 -0
- package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchUtils.browser.js +11 -0
- package/dist-esm/storage-blob/src/BatchUtils.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BatchUtils.js +15 -0
- package/dist-esm/storage-blob/src/BatchUtils.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobBatch.js +267 -0
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobBatchClient.js +140 -0
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js +7 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js +455 -0
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +192 -0
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js +362 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.js +367 -0
- package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/BlobServiceClient.js +702 -0
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -0
- package/dist-esm/storage-blob/src/Clients.js +2527 -0
- package/dist-esm/storage-blob/src/Clients.js.map +1 -0
- package/dist-esm/storage-blob/src/ContainerClient.js +1161 -0
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -0
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +24 -0
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -0
- package/dist-esm/storage-blob/src/Pipeline.js +259 -0
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -0
- package/dist-esm/storage-blob/src/Range.js +21 -0
- package/dist-esm/storage-blob/src/Range.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/StorageBrowserPolicyFactory.js +1 -1
- package/dist-esm/storage-blob/src/StorageBrowserPolicyFactory.js.map +1 -0
- package/dist-esm/storage-blob/src/StorageClient.js +29 -0
- package/dist-esm/storage-blob/src/StorageClient.js.map +1 -0
- package/dist-esm/storage-blob/src/StorageContextClient.js +17 -0
- package/dist-esm/storage-blob/src/StorageContextClient.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/StorageRetryPolicyFactory.js +2 -1
- package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/credentials/AnonymousCredential.js +1 -1
- package/dist-esm/storage-blob/src/credentials/AnonymousCredential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/Credential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.browser.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/credentials/StorageSharedKeyCredential.js +1 -1
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js +5 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js +31 -0
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/generated/src/index.js +1 -1
- package/dist-esm/storage-blob/src/generated/src/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/index.js +256 -0
- package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js +8196 -0
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1610 -0
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js +221 -0
- package/dist-esm/storage-blob/src/generated/src/operations/appendBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js +997 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js +365 -0
- package/dist-esm/storage-blob/src/generated/src/operations/blockBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/container.js +705 -0
- package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/index.js +14 -0
- package/dist-esm/storage-blob/src/generated/src/operations/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js +456 -0
- package/dist-esm/storage-blob/src/generated/src/operations/pageBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operations/service.js +315 -0
- package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/appendBlob.js.map +1 -0
- package/dist-esm/{src/generated/src/models/index.js → storage-blob/src/generated/src/operationsInterfaces/blob.js} +1 -1
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/blockBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/container.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js +14 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/pageBlob.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js +9 -0
- package/dist-esm/storage-blob/src/generated/src/operationsInterfaces/service.js.map +1 -0
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +49 -0
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -0
- package/dist-esm/storage-blob/src/generatedModels.js +4 -0
- package/dist-esm/storage-blob/src/generatedModels.js.map +1 -0
- package/dist-esm/storage-blob/src/index.browser.js +23 -0
- package/dist-esm/storage-blob/src/index.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/index.js +33 -0
- package/dist-esm/storage-blob/src/index.js.map +1 -0
- package/dist-esm/storage-blob/src/log.js +8 -0
- package/dist-esm/storage-blob/src/log.js.map +1 -0
- package/dist-esm/storage-blob/src/models.js +108 -0
- package/dist-esm/storage-blob/src/models.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/AnonymousCredentialPolicy.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/policies/CredentialPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/CredentialPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js +40 -0
- package/dist-esm/storage-blob/src/policies/RequestPolicy.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/policies/StorageBrowserPolicy.js +2 -1
- package/dist-esm/{src → storage-blob/src}/policies/StorageBrowserPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js +31 -0
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicyV2.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/policies/StorageRetryPolicy.js +15 -6
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +165 -0
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js +18 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js +131 -0
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -0
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +130 -0
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js +227 -0
- package/dist-esm/storage-blob/src/sas/AccountSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASResourceTypes.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASServices.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js +93 -0
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js +195 -0
- package/dist-esm/storage-blob/src/sas/BlobSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +555 -0
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +221 -0
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js +234 -0
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js.map +1 -0
- package/dist-esm/storage-blob/src/sas/SasIPRange.js +13 -0
- package/dist-esm/storage-blob/src/sas/SasIPRange.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/Batch.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js +111 -0
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/Mutex.js +66 -0
- package/dist-esm/storage-blob/src/utils/Mutex.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js +119 -0
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/cache.js +11 -0
- package/dist-esm/storage-blob/src/utils/cache.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/constants.js +223 -0
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/tracing.js +14 -0
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.browser.js +48 -0
- package/dist-esm/storage-blob/src/utils/utils.browser.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.common.js +754 -0
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -0
- package/dist-esm/storage-blob/src/utils/utils.node.js +132 -0
- package/dist-esm/storage-blob/src/utils/utils.node.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASPermissions.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js +72 -0
- package/dist-esm/storage-file-share/src/AccountSASResourceTypes.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASServices.js +80 -0
- package/dist-esm/storage-file-share/src/AccountSASServices.js.map +1 -0
- package/dist-esm/storage-file-share/src/AccountSASSignatureValues.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/Clients.js +476 -1253
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileDownloadResponse.browser.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/FileDownloadResponse.js +15 -14
- package/dist-esm/storage-file-share/src/FileDownloadResponse.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSASPermissions.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSASSignatureValues.js.map +1 -0
- package/dist-esm/storage-file-share/src/FileSystemAttributes.js.map +1 -0
- package/dist-esm/storage-file-share/src/Range.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/SASQueryParameters.js +14 -14
- package/dist-esm/storage-file-share/src/SASQueryParameters.js.map +1 -0
- package/dist-esm/storage-file-share/src/SasIPRange.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/ShareClientInternal.js +1 -2
- package/dist-esm/storage-file-share/src/ShareClientInternal.js.map +1 -0
- package/dist-esm/storage-file-share/src/ShareSASPermissions.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/ShareServiceClient.js +58 -121
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/StorageClient.js +20 -14
- package/dist-esm/storage-file-share/src/StorageClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/StorageContextClient.js +18 -0
- package/dist-esm/storage-file-share/src/StorageContextClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/index.js +11 -0
- package/dist-esm/storage-file-share/src/generated/src/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/models/index.js +144 -0
- package/dist-esm/storage-file-share/src/generated/src/models/index.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/models/mappers.js +16 -64
- package/dist-esm/storage-file-share/src/generated/src/models/mappers.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/models/parameters.js +17 -37
- package/dist-esm/storage-file-share/src/generated/src/models/parameters.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/directory.js +17 -73
- package/dist-esm/storage-file-share/src/generated/src/operations/directory.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/file.js +33 -142
- package/dist-esm/storage-file-share/src/generated/src/operations/file.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operations/index.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/service.js +7 -17
- package/dist-esm/storage-file-share/src/generated/src/operations/service.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/generated/src/operations/share.js +26 -85
- package/dist-esm/storage-file-share/src/generated/src/operations/share.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/directory.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/directory.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/file.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/file.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js +12 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/service.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/service.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/share.js +9 -0
- package/dist-esm/storage-file-share/src/generated/src/operationsInterfaces/share.js.map +1 -0
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js +48 -0
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -0
- package/dist-esm/storage-file-share/src/generatedModels.js +4 -0
- package/dist-esm/storage-file-share/src/generatedModels.js.map +1 -0
- package/dist-esm/storage-file-share/src/index.browser.js +18 -0
- package/dist-esm/storage-file-share/src/index.browser.js.map +1 -0
- package/dist-esm/storage-file-share/src/index.js +28 -0
- package/dist-esm/storage-file-share/src/index.js.map +1 -0
- package/dist-esm/storage-file-share/src/log.js.map +1 -0
- package/dist-esm/storage-file-share/src/models.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/Batch.js +122 -0
- package/dist-esm/storage-file-share/src/utils/Batch.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/BufferScheduler.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/RetriableReadableStream.js +51 -48
- package/dist-esm/storage-file-share/src/utils/RetriableReadableStream.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/constants.js +2 -6
- package/dist-esm/storage-file-share/src/utils/constants.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/tracing.js +14 -0
- package/dist-esm/storage-file-share/src/utils/tracing.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/utils.browser.js.map +1 -0
- package/dist-esm/{src → storage-file-share/src}/utils/utils.common.js +82 -95
- package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -0
- package/dist-esm/storage-file-share/src/utils/utils.node.js.map +1 -0
- package/package.json +31 -25
- package/types/3.1/storage-file-share.d.ts +1454 -532
- package/types/latest/storage-file-share.d.ts +1571 -544
- package/dist-esm/src/AccountSASPermissions.js.map +0 -1
- package/dist-esm/src/AccountSASResourceTypes.js.map +0 -1
- package/dist-esm/src/AccountSASServices.js.map +0 -1
- package/dist-esm/src/AccountSASSignatureValues.js.map +0 -1
- package/dist-esm/src/Clients.js.map +0 -1
- package/dist-esm/src/FileDownloadResponse.browser.js.map +0 -1
- package/dist-esm/src/FileDownloadResponse.js.map +0 -1
- package/dist-esm/src/FileSASPermissions.js.map +0 -1
- package/dist-esm/src/FileSASSignatureValues.js.map +0 -1
- package/dist-esm/src/FileSystemAttributes.js.map +0 -1
- package/dist-esm/src/Pipeline.js +0 -88
- package/dist-esm/src/Pipeline.js.map +0 -1
- package/dist-esm/src/Range.js.map +0 -1
- package/dist-esm/src/SASQueryParameters.js.map +0 -1
- package/dist-esm/src/SasIPRange.js.map +0 -1
- package/dist-esm/src/ShareClientInternal.js.map +0 -1
- package/dist-esm/src/ShareSASPermissions.js.map +0 -1
- package/dist-esm/src/ShareServiceClient.js.map +0 -1
- package/dist-esm/src/StorageBrowserPolicyFactory.js.map +0 -1
- package/dist-esm/src/StorageClient.js.map +0 -1
- package/dist-esm/src/StorageRetryPolicyFactory.js.map +0 -1
- package/dist-esm/src/TelemetryPolicyFactory.js +0 -50
- package/dist-esm/src/TelemetryPolicyFactory.js.map +0 -1
- package/dist-esm/src/credentials/AnonymousCredential.js.map +0 -1
- package/dist-esm/src/credentials/Credential.js.map +0 -1
- package/dist-esm/src/credentials/StorageSharedKeyCredential.browser.js.map +0 -1
- package/dist-esm/src/credentials/StorageSharedKeyCredential.js.map +0 -1
- package/dist-esm/src/generated/src/index.js.map +0 -1
- package/dist-esm/src/generated/src/models/index.js.map +0 -1
- package/dist-esm/src/generated/src/models/mappers.js.map +0 -1
- package/dist-esm/src/generated/src/models/parameters.js.map +0 -1
- package/dist-esm/src/generated/src/operations/directory.js.map +0 -1
- package/dist-esm/src/generated/src/operations/file.js.map +0 -1
- package/dist-esm/src/generated/src/operations/index.js.map +0 -1
- package/dist-esm/src/generated/src/operations/service.js.map +0 -1
- package/dist-esm/src/generated/src/operations/share.js.map +0 -1
- package/dist-esm/src/generated/src/storageClient.js +0 -25
- package/dist-esm/src/generated/src/storageClient.js.map +0 -1
- package/dist-esm/src/generated/src/storageClientContext.js +0 -40
- package/dist-esm/src/generated/src/storageClientContext.js.map +0 -1
- package/dist-esm/src/generatedModels.js +0 -8
- package/dist-esm/src/generatedModels.js.map +0 -1
- package/dist-esm/src/index.browser.js +0 -17
- package/dist-esm/src/index.browser.js.map +0 -1
- package/dist-esm/src/index.js +0 -27
- package/dist-esm/src/index.js.map +0 -1
- package/dist-esm/src/log.js.map +0 -1
- package/dist-esm/src/models.js.map +0 -1
- package/dist-esm/src/policies/AnonymousCredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/CredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/StorageRetryPolicy.js.map +0 -1
- package/dist-esm/src/policies/StorageSharedKeyCredentialPolicy.js.map +0 -1
- package/dist-esm/src/policies/TelemetryPolicy.js +0 -36
- package/dist-esm/src/policies/TelemetryPolicy.js.map +0 -1
- package/dist-esm/src/utils/Batch.js.map +0 -1
- package/dist-esm/src/utils/BufferScheduler.js.map +0 -1
- package/dist-esm/src/utils/RetriableReadableStream.js.map +0 -1
- package/dist-esm/src/utils/cache.js +0 -8
- package/dist-esm/src/utils/cache.js.map +0 -1
- package/dist-esm/src/utils/constants.js.map +0 -1
- package/dist-esm/src/utils/tracing.js +0 -27
- package/dist-esm/src/utils/tracing.js.map +0 -1
- package/dist-esm/src/utils/utils.browser.js.map +0 -1
- package/dist-esm/src/utils/utils.common.js.map +0 -1
- package/dist-esm/src/utils/utils.node.js.map +0 -1
- /package/dist-esm/{src → storage-blob/src}/credentials/Credential.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/credentials/StorageSharedKeyCredential.browser.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/policies/AnonymousCredentialPolicy.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/policies/StorageSharedKeyCredentialPolicy.js +0 -0
- /package/dist-esm/{src → storage-blob/src/sas}/AccountSASResourceTypes.js +0 -0
- /package/dist-esm/{src → storage-blob/src/sas}/AccountSASServices.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/utils/Batch.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/AccountSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/AccountSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileDownloadResponse.browser.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/FileSystemAttributes.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/Range.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/SasIPRange.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/ShareSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/generated/src/operations/index.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/log.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/models.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/BufferScheduler.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/utils.browser.js +0 -0
- /package/dist-esm/{src → storage-file-share/src}/utils/utils.node.js +0 -0
@@ -0,0 +1,754 @@
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
2
|
+
// Licensed under the MIT license.
|
3
|
+
import { createHttpHeaders } from "@azure/core-rest-pipeline";
|
4
|
+
import { isNode } from "@azure/core-util";
|
5
|
+
import { DevelopmentConnectionString, HeaderConstants, PathStylePorts, URLConstants, } from "./constants";
|
6
|
+
/**
|
7
|
+
* Reserved URL characters must be properly escaped for Storage services like Blob or File.
|
8
|
+
*
|
9
|
+
* ## URL encode and escape strategy for JS SDKs
|
10
|
+
*
|
11
|
+
* When customers pass a URL string into XxxClient classes constructor, the URL string may already be URL encoded or not.
|
12
|
+
* But before sending to Azure Storage server, the URL must be encoded. However, it's hard for a SDK to guess whether the URL
|
13
|
+
* string has been encoded or not. We have 2 potential strategies, and chose strategy two for the XxxClient constructors.
|
14
|
+
*
|
15
|
+
* ### Strategy One: Assume the customer URL string is not encoded, and always encode URL string in SDK.
|
16
|
+
*
|
17
|
+
* This is what legacy V2 SDK does, simple and works for most of the cases.
|
18
|
+
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
|
19
|
+
* SDK will encode it to "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
|
20
|
+
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
|
21
|
+
* SDK will encode it to "http://account.blob.core.windows.net/con/b%253A" and send to server. A blob named "b%3A" will be created.
|
22
|
+
*
|
23
|
+
* But this strategy will make it not possible to create a blob with "?" in it's name. Because when customer URL string is
|
24
|
+
* "http://account.blob.core.windows.net/con/blob?name", the "?name" will be treated as URL paramter instead of blob name.
|
25
|
+
* If customer URL string is "http://account.blob.core.windows.net/con/blob%3Fname", a blob named "blob%3Fname" will be created.
|
26
|
+
* V2 SDK doesn't have this issue because it doesn't allow customer pass in a full URL, it accepts a separate blob name and encodeURIComponent for it.
|
27
|
+
* We cannot accept a SDK cannot create a blob name with "?". So we implement strategy two:
|
28
|
+
*
|
29
|
+
* ### Strategy Two: SDK doesn't assume the URL has been encoded or not. It will just escape the special characters.
|
30
|
+
*
|
31
|
+
* This is what V10 Blob Go SDK does. It accepts a URL type in Go, and call url.EscapedPath() to escape the special chars unescaped.
|
32
|
+
* - When customer URL string is "http://account.blob.core.windows.net/con/b:",
|
33
|
+
* SDK will escape ":" like "http://account.blob.core.windows.net/con/b%3A" and send to server. A blob named "b:" will be created.
|
34
|
+
* - When customer URL string is "http://account.blob.core.windows.net/con/b%3A",
|
35
|
+
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%3A" to server. A blob named "b:" will be created.
|
36
|
+
* - When customer URL string is "http://account.blob.core.windows.net/con/b%253A",
|
37
|
+
* There is no special characters, so send "http://account.blob.core.windows.net/con/b%253A" to server. A blob named "b%3A" will be created.
|
38
|
+
*
|
39
|
+
* This strategy gives us flexibility to create with any special characters. But "%" will be treated as a special characters, if the URL string
|
40
|
+
* is not encoded, there shouldn't a "%" in the URL string, otherwise the URL is not a valid URL.
|
41
|
+
* If customer needs to create a blob with "%" in it's blob name, use "%25" instead of "%". Just like above 3rd sample.
|
42
|
+
* And following URL strings are invalid:
|
43
|
+
* - "http://account.blob.core.windows.net/con/b%"
|
44
|
+
* - "http://account.blob.core.windows.net/con/b%2"
|
45
|
+
* - "http://account.blob.core.windows.net/con/b%G"
|
46
|
+
*
|
47
|
+
* Another special character is "?", use "%2F" to represent a blob name with "?" in a URL string.
|
48
|
+
*
|
49
|
+
* ### Strategy for containerName, blobName or other specific XXXName parameters in methods such as `containerClient.getBlobClient(blobName)`
|
50
|
+
*
|
51
|
+
* We will apply strategy one, and call encodeURIComponent for these parameters like blobName. Because what customers passes in is a plain name instead of a URL.
|
52
|
+
*
|
53
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata
|
54
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-shares--directories--files--and-metadata
|
55
|
+
*
|
56
|
+
* @param url -
|
57
|
+
*/
|
58
|
+
export function escapeURLPath(url) {
|
59
|
+
const urlParsed = new URL(url);
|
60
|
+
let path = urlParsed.pathname;
|
61
|
+
path = path || "/";
|
62
|
+
path = escape(path);
|
63
|
+
urlParsed.pathname = path;
|
64
|
+
return urlParsed.toString();
|
65
|
+
}
|
66
|
+
function getProxyUriFromDevConnString(connectionString) {
|
67
|
+
// Development Connection String
|
68
|
+
// https://docs.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string#connect-to-the-emulator-account-using-the-well-known-account-name-and-key
|
69
|
+
let proxyUri = "";
|
70
|
+
if (connectionString.search("DevelopmentStorageProxyUri=") !== -1) {
|
71
|
+
// CONNECTION_STRING=UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://myProxyUri
|
72
|
+
const matchCredentials = connectionString.split(";");
|
73
|
+
for (const element of matchCredentials) {
|
74
|
+
if (element.trim().startsWith("DevelopmentStorageProxyUri=")) {
|
75
|
+
proxyUri = element.trim().match("DevelopmentStorageProxyUri=(.*)")[1];
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return proxyUri;
|
80
|
+
}
|
81
|
+
export function getValueInConnString(connectionString, argument) {
|
82
|
+
const elements = connectionString.split(";");
|
83
|
+
for (const element of elements) {
|
84
|
+
if (element.trim().startsWith(argument)) {
|
85
|
+
return element.trim().match(argument + "=(.*)")[1];
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return "";
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* Extracts the parts of an Azure Storage account connection string.
|
92
|
+
*
|
93
|
+
* @param connectionString - Connection string.
|
94
|
+
* @returns String key value pairs of the storage account's url and credentials.
|
95
|
+
*/
|
96
|
+
export function extractConnectionStringParts(connectionString) {
|
97
|
+
let proxyUri = "";
|
98
|
+
if (connectionString.startsWith("UseDevelopmentStorage=true")) {
|
99
|
+
// Development connection string
|
100
|
+
proxyUri = getProxyUriFromDevConnString(connectionString);
|
101
|
+
connectionString = DevelopmentConnectionString;
|
102
|
+
}
|
103
|
+
// Matching BlobEndpoint in the Account connection string
|
104
|
+
let blobEndpoint = getValueInConnString(connectionString, "BlobEndpoint");
|
105
|
+
// Slicing off '/' at the end if exists
|
106
|
+
// (The methods that use `extractConnectionStringParts` expect the url to not have `/` at the end)
|
107
|
+
blobEndpoint = blobEndpoint.endsWith("/") ? blobEndpoint.slice(0, -1) : blobEndpoint;
|
108
|
+
if (connectionString.search("DefaultEndpointsProtocol=") !== -1 &&
|
109
|
+
connectionString.search("AccountKey=") !== -1) {
|
110
|
+
// Account connection string
|
111
|
+
let defaultEndpointsProtocol = "";
|
112
|
+
let accountName = "";
|
113
|
+
let accountKey = Buffer.from("accountKey", "base64");
|
114
|
+
let endpointSuffix = "";
|
115
|
+
// Get account name and key
|
116
|
+
accountName = getValueInConnString(connectionString, "AccountName");
|
117
|
+
accountKey = Buffer.from(getValueInConnString(connectionString, "AccountKey"), "base64");
|
118
|
+
if (!blobEndpoint) {
|
119
|
+
// BlobEndpoint is not present in the Account connection string
|
120
|
+
// Can be obtained from `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`
|
121
|
+
defaultEndpointsProtocol = getValueInConnString(connectionString, "DefaultEndpointsProtocol");
|
122
|
+
const protocol = defaultEndpointsProtocol.toLowerCase();
|
123
|
+
if (protocol !== "https" && protocol !== "http") {
|
124
|
+
throw new Error("Invalid DefaultEndpointsProtocol in the provided Connection String. Expecting 'https' or 'http'");
|
125
|
+
}
|
126
|
+
endpointSuffix = getValueInConnString(connectionString, "EndpointSuffix");
|
127
|
+
if (!endpointSuffix) {
|
128
|
+
throw new Error("Invalid EndpointSuffix in the provided Connection String");
|
129
|
+
}
|
130
|
+
blobEndpoint = `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;
|
131
|
+
}
|
132
|
+
if (!accountName) {
|
133
|
+
throw new Error("Invalid AccountName in the provided Connection String");
|
134
|
+
}
|
135
|
+
else if (accountKey.length === 0) {
|
136
|
+
throw new Error("Invalid AccountKey in the provided Connection String");
|
137
|
+
}
|
138
|
+
return {
|
139
|
+
kind: "AccountConnString",
|
140
|
+
url: blobEndpoint,
|
141
|
+
accountName,
|
142
|
+
accountKey,
|
143
|
+
proxyUri,
|
144
|
+
};
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
// SAS connection string
|
148
|
+
let accountSas = getValueInConnString(connectionString, "SharedAccessSignature");
|
149
|
+
const accountName = getAccountNameFromUrl(blobEndpoint);
|
150
|
+
if (!blobEndpoint) {
|
151
|
+
throw new Error("Invalid BlobEndpoint in the provided SAS Connection String");
|
152
|
+
}
|
153
|
+
else if (!accountSas) {
|
154
|
+
throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String");
|
155
|
+
}
|
156
|
+
// client constructors assume accountSas does *not* start with ?
|
157
|
+
if (accountSas.startsWith("?")) {
|
158
|
+
accountSas = accountSas.substring(1);
|
159
|
+
}
|
160
|
+
return { kind: "SASConnString", url: blobEndpoint, accountName, accountSas };
|
161
|
+
}
|
162
|
+
}
|
163
|
+
/**
|
164
|
+
* Internal escape method implemented Strategy Two mentioned in escapeURL() description.
|
165
|
+
*
|
166
|
+
* @param text -
|
167
|
+
*/
|
168
|
+
function escape(text) {
|
169
|
+
return encodeURIComponent(text)
|
170
|
+
.replace(/%2F/g, "/") // Don't escape for "/"
|
171
|
+
.replace(/'/g, "%27") // Escape for "'"
|
172
|
+
.replace(/\+/g, "%20")
|
173
|
+
.replace(/%25/g, "%"); // Revert encoded "%"
|
174
|
+
}
|
175
|
+
/**
|
176
|
+
* Append a string to URL path. Will remove duplicated "/" in front of the string
|
177
|
+
* when URL path ends with a "/".
|
178
|
+
*
|
179
|
+
* @param url - Source URL string
|
180
|
+
* @param name - String to be appended to URL
|
181
|
+
* @returns An updated URL string
|
182
|
+
*/
|
183
|
+
export function appendToURLPath(url, name) {
|
184
|
+
const urlParsed = new URL(url);
|
185
|
+
let path = urlParsed.pathname;
|
186
|
+
path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name;
|
187
|
+
urlParsed.pathname = path;
|
188
|
+
return urlParsed.toString();
|
189
|
+
}
|
190
|
+
/**
|
191
|
+
* Set URL parameter name and value. If name exists in URL parameters, old value
|
192
|
+
* will be replaced by name key. If not provide value, the parameter will be deleted.
|
193
|
+
*
|
194
|
+
* @param url - Source URL string
|
195
|
+
* @param name - Parameter name
|
196
|
+
* @param value - Parameter value
|
197
|
+
* @returns An updated URL string
|
198
|
+
*/
|
199
|
+
export function setURLParameter(url, name, value) {
|
200
|
+
const urlParsed = new URL(url);
|
201
|
+
const encodedName = encodeURIComponent(name);
|
202
|
+
const encodedValue = value ? encodeURIComponent(value) : undefined;
|
203
|
+
// mutating searchParams will change the encoding, so we have to do this ourselves
|
204
|
+
const searchString = urlParsed.search === "" ? "?" : urlParsed.search;
|
205
|
+
const searchPieces = [];
|
206
|
+
for (const pair of searchString.slice(1).split("&")) {
|
207
|
+
if (pair) {
|
208
|
+
const [key] = pair.split("=", 2);
|
209
|
+
if (key !== encodedName) {
|
210
|
+
searchPieces.push(pair);
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
if (encodedValue) {
|
215
|
+
searchPieces.push(`${encodedName}=${encodedValue}`);
|
216
|
+
}
|
217
|
+
urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
|
218
|
+
return urlParsed.toString();
|
219
|
+
}
|
220
|
+
/**
|
221
|
+
* Get URL parameter by name.
|
222
|
+
*
|
223
|
+
* @param url -
|
224
|
+
* @param name -
|
225
|
+
*/
|
226
|
+
export function getURLParameter(url, name) {
|
227
|
+
var _a;
|
228
|
+
const urlParsed = new URL(url);
|
229
|
+
return (_a = urlParsed.searchParams.get(name)) !== null && _a !== void 0 ? _a : undefined;
|
230
|
+
}
|
231
|
+
/**
|
232
|
+
* Set URL host.
|
233
|
+
*
|
234
|
+
* @param url - Source URL string
|
235
|
+
* @param host - New host string
|
236
|
+
* @returns An updated URL string
|
237
|
+
*/
|
238
|
+
export function setURLHost(url, host) {
|
239
|
+
const urlParsed = new URL(url);
|
240
|
+
urlParsed.hostname = host;
|
241
|
+
return urlParsed.toString();
|
242
|
+
}
|
243
|
+
/**
|
244
|
+
* Get URL path from an URL string.
|
245
|
+
*
|
246
|
+
* @param url - Source URL string
|
247
|
+
*/
|
248
|
+
export function getURLPath(url) {
|
249
|
+
try {
|
250
|
+
const urlParsed = new URL(url);
|
251
|
+
return urlParsed.pathname;
|
252
|
+
}
|
253
|
+
catch (e) {
|
254
|
+
return undefined;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
/**
|
258
|
+
* Get URL scheme from an URL string.
|
259
|
+
*
|
260
|
+
* @param url - Source URL string
|
261
|
+
*/
|
262
|
+
export function getURLScheme(url) {
|
263
|
+
try {
|
264
|
+
const urlParsed = new URL(url);
|
265
|
+
return urlParsed.protocol.endsWith(":") ? urlParsed.protocol.slice(0, -1) : urlParsed.protocol;
|
266
|
+
}
|
267
|
+
catch (e) {
|
268
|
+
return undefined;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
/**
|
272
|
+
* Get URL path and query from an URL string.
|
273
|
+
*
|
274
|
+
* @param url - Source URL string
|
275
|
+
*/
|
276
|
+
export function getURLPathAndQuery(url) {
|
277
|
+
const urlParsed = new URL(url);
|
278
|
+
const pathString = urlParsed.pathname;
|
279
|
+
if (!pathString) {
|
280
|
+
throw new RangeError("Invalid url without valid path.");
|
281
|
+
}
|
282
|
+
let queryString = urlParsed.search || "";
|
283
|
+
queryString = queryString.trim();
|
284
|
+
if (queryString !== "") {
|
285
|
+
queryString = queryString.startsWith("?") ? queryString : `?${queryString}`; // Ensure query string start with '?'
|
286
|
+
}
|
287
|
+
return `${pathString}${queryString}`;
|
288
|
+
}
|
289
|
+
/**
|
290
|
+
* Get URL query key value pairs from an URL string.
|
291
|
+
*
|
292
|
+
* @param url -
|
293
|
+
*/
|
294
|
+
export function getURLQueries(url) {
|
295
|
+
let queryString = new URL(url).search;
|
296
|
+
if (!queryString) {
|
297
|
+
return {};
|
298
|
+
}
|
299
|
+
queryString = queryString.trim();
|
300
|
+
queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString;
|
301
|
+
let querySubStrings = queryString.split("&");
|
302
|
+
querySubStrings = querySubStrings.filter((value) => {
|
303
|
+
const indexOfEqual = value.indexOf("=");
|
304
|
+
const lastIndexOfEqual = value.lastIndexOf("=");
|
305
|
+
return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1);
|
306
|
+
});
|
307
|
+
const queries = {};
|
308
|
+
for (const querySubString of querySubStrings) {
|
309
|
+
const splitResults = querySubString.split("=");
|
310
|
+
const key = splitResults[0];
|
311
|
+
const value = splitResults[1];
|
312
|
+
queries[key] = value;
|
313
|
+
}
|
314
|
+
return queries;
|
315
|
+
}
|
316
|
+
/**
|
317
|
+
* Append a string to URL query.
|
318
|
+
*
|
319
|
+
* @param url - Source URL string.
|
320
|
+
* @param queryParts - String to be appended to the URL query.
|
321
|
+
* @returns An updated URL string.
|
322
|
+
*/
|
323
|
+
export function appendToURLQuery(url, queryParts) {
|
324
|
+
const urlParsed = new URL(url);
|
325
|
+
let query = urlParsed.search;
|
326
|
+
if (query) {
|
327
|
+
query += "&" + queryParts;
|
328
|
+
}
|
329
|
+
else {
|
330
|
+
query = queryParts;
|
331
|
+
}
|
332
|
+
urlParsed.search = query;
|
333
|
+
return urlParsed.toString();
|
334
|
+
}
|
335
|
+
/**
|
336
|
+
* Rounds a date off to seconds.
|
337
|
+
*
|
338
|
+
* @param date -
|
339
|
+
* @param withMilliseconds - If true, YYYY-MM-DDThh:mm:ss.fffffffZ will be returned;
|
340
|
+
* If false, YYYY-MM-DDThh:mm:ssZ will be returned.
|
341
|
+
* @returns Date string in ISO8061 format, with or without 7 milliseconds component
|
342
|
+
*/
|
343
|
+
export function truncatedISO8061Date(date, withMilliseconds = true) {
|
344
|
+
// Date.toISOString() will return like "2018-10-29T06:34:36.139Z"
|
345
|
+
const dateString = date.toISOString();
|
346
|
+
return withMilliseconds
|
347
|
+
? dateString.substring(0, dateString.length - 1) + "0000" + "Z"
|
348
|
+
: dateString.substring(0, dateString.length - 5) + "Z";
|
349
|
+
}
|
350
|
+
/**
|
351
|
+
* Base64 encode.
|
352
|
+
*
|
353
|
+
* @param content -
|
354
|
+
*/
|
355
|
+
export function base64encode(content) {
|
356
|
+
return !isNode ? btoa(content) : Buffer.from(content).toString("base64");
|
357
|
+
}
|
358
|
+
/**
|
359
|
+
* Base64 decode.
|
360
|
+
*
|
361
|
+
* @param encodedString -
|
362
|
+
*/
|
363
|
+
export function base64decode(encodedString) {
|
364
|
+
return !isNode ? atob(encodedString) : Buffer.from(encodedString, "base64").toString();
|
365
|
+
}
|
366
|
+
/**
|
367
|
+
* Generate a 64 bytes base64 block ID string.
|
368
|
+
*
|
369
|
+
* @param blockIndex -
|
370
|
+
*/
|
371
|
+
export function generateBlockID(blockIDPrefix, blockIndex) {
|
372
|
+
// To generate a 64 bytes base64 string, source string should be 48
|
373
|
+
const maxSourceStringLength = 48;
|
374
|
+
// A blob can have a maximum of 100,000 uncommitted blocks at any given time
|
375
|
+
const maxBlockIndexLength = 6;
|
376
|
+
const maxAllowedBlockIDPrefixLength = maxSourceStringLength - maxBlockIndexLength;
|
377
|
+
if (blockIDPrefix.length > maxAllowedBlockIDPrefixLength) {
|
378
|
+
blockIDPrefix = blockIDPrefix.slice(0, maxAllowedBlockIDPrefixLength);
|
379
|
+
}
|
380
|
+
const res = blockIDPrefix +
|
381
|
+
padStart(blockIndex.toString(), maxSourceStringLength - blockIDPrefix.length, "0");
|
382
|
+
return base64encode(res);
|
383
|
+
}
|
384
|
+
/**
|
385
|
+
* Delay specified time interval.
|
386
|
+
*
|
387
|
+
* @param timeInMs -
|
388
|
+
* @param aborter -
|
389
|
+
* @param abortError -
|
390
|
+
*/
|
391
|
+
export async function delay(timeInMs, aborter, abortError) {
|
392
|
+
return new Promise((resolve, reject) => {
|
393
|
+
/* eslint-disable-next-line prefer-const */
|
394
|
+
let timeout;
|
395
|
+
const abortHandler = () => {
|
396
|
+
if (timeout !== undefined) {
|
397
|
+
clearTimeout(timeout);
|
398
|
+
}
|
399
|
+
reject(abortError);
|
400
|
+
};
|
401
|
+
const resolveHandler = () => {
|
402
|
+
if (aborter !== undefined) {
|
403
|
+
aborter.removeEventListener("abort", abortHandler);
|
404
|
+
}
|
405
|
+
resolve();
|
406
|
+
};
|
407
|
+
timeout = setTimeout(resolveHandler, timeInMs);
|
408
|
+
if (aborter !== undefined) {
|
409
|
+
aborter.addEventListener("abort", abortHandler);
|
410
|
+
}
|
411
|
+
});
|
412
|
+
}
|
413
|
+
/**
|
414
|
+
* String.prototype.padStart()
|
415
|
+
*
|
416
|
+
* @param currentString -
|
417
|
+
* @param targetLength -
|
418
|
+
* @param padString -
|
419
|
+
*/
|
420
|
+
export function padStart(currentString, targetLength, padString = " ") {
|
421
|
+
// @ts-expect-error: TS doesn't know this code needs to run downlevel sometimes
|
422
|
+
if (String.prototype.padStart) {
|
423
|
+
return currentString.padStart(targetLength, padString);
|
424
|
+
}
|
425
|
+
padString = padString || " ";
|
426
|
+
if (currentString.length > targetLength) {
|
427
|
+
return currentString;
|
428
|
+
}
|
429
|
+
else {
|
430
|
+
targetLength = targetLength - currentString.length;
|
431
|
+
if (targetLength > padString.length) {
|
432
|
+
padString += padString.repeat(targetLength / padString.length);
|
433
|
+
}
|
434
|
+
return padString.slice(0, targetLength) + currentString;
|
435
|
+
}
|
436
|
+
}
|
437
|
+
export function sanitizeURL(url) {
|
438
|
+
let safeURL = url;
|
439
|
+
if (getURLParameter(safeURL, URLConstants.Parameters.SIGNATURE)) {
|
440
|
+
safeURL = setURLParameter(safeURL, URLConstants.Parameters.SIGNATURE, "*****");
|
441
|
+
}
|
442
|
+
return safeURL;
|
443
|
+
}
|
444
|
+
export function sanitizeHeaders(originalHeader) {
|
445
|
+
const headers = createHttpHeaders();
|
446
|
+
for (const [name, value] of originalHeader) {
|
447
|
+
if (name.toLowerCase() === HeaderConstants.AUTHORIZATION.toLowerCase()) {
|
448
|
+
headers.set(name, "*****");
|
449
|
+
}
|
450
|
+
else if (name.toLowerCase() === HeaderConstants.X_MS_COPY_SOURCE) {
|
451
|
+
headers.set(name, sanitizeURL(value));
|
452
|
+
}
|
453
|
+
else {
|
454
|
+
headers.set(name, value);
|
455
|
+
}
|
456
|
+
}
|
457
|
+
return headers;
|
458
|
+
}
|
459
|
+
/**
|
460
|
+
* If two strings are equal when compared case insensitive.
|
461
|
+
*
|
462
|
+
* @param str1 -
|
463
|
+
* @param str2 -
|
464
|
+
*/
|
465
|
+
export function iEqual(str1, str2) {
|
466
|
+
return str1.toLocaleLowerCase() === str2.toLocaleLowerCase();
|
467
|
+
}
|
468
|
+
/**
|
469
|
+
* Extracts account name from the url
|
470
|
+
* @param url - url to extract the account name from
|
471
|
+
* @returns with the account name
|
472
|
+
*/
|
473
|
+
export function getAccountNameFromUrl(url) {
|
474
|
+
const parsedUrl = new URL(url);
|
475
|
+
let accountName;
|
476
|
+
try {
|
477
|
+
if (parsedUrl.hostname.split(".")[1] === "blob") {
|
478
|
+
// `${defaultEndpointsProtocol}://${accountName}.blob.${endpointSuffix}`;
|
479
|
+
accountName = parsedUrl.hostname.split(".")[0];
|
480
|
+
}
|
481
|
+
else if (isIpEndpointStyle(parsedUrl)) {
|
482
|
+
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/
|
483
|
+
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/
|
484
|
+
// .getPath() -> /devstoreaccount1/
|
485
|
+
accountName = parsedUrl.pathname.split("/")[1];
|
486
|
+
}
|
487
|
+
else {
|
488
|
+
// Custom domain case: "https://customdomain.com/containername/blob".
|
489
|
+
accountName = "";
|
490
|
+
}
|
491
|
+
return accountName;
|
492
|
+
}
|
493
|
+
catch (error) {
|
494
|
+
throw new Error("Unable to extract accountName with provided information.");
|
495
|
+
}
|
496
|
+
}
|
497
|
+
export function isIpEndpointStyle(parsedUrl) {
|
498
|
+
const host = parsedUrl.host;
|
499
|
+
// Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.
|
500
|
+
// Case 2: localhost(:port), use broad regex to match port part.
|
501
|
+
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
|
502
|
+
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
|
503
|
+
return (/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) ||
|
504
|
+
(Boolean(parsedUrl.port) && PathStylePorts.includes(parsedUrl.port)));
|
505
|
+
}
|
506
|
+
/**
|
507
|
+
* Convert Tags to encoded string.
|
508
|
+
*
|
509
|
+
* @param tags -
|
510
|
+
*/
|
511
|
+
export function toBlobTagsString(tags) {
|
512
|
+
if (tags === undefined) {
|
513
|
+
return undefined;
|
514
|
+
}
|
515
|
+
const tagPairs = [];
|
516
|
+
for (const key in tags) {
|
517
|
+
if (Object.prototype.hasOwnProperty.call(tags, key)) {
|
518
|
+
const value = tags[key];
|
519
|
+
tagPairs.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);
|
520
|
+
}
|
521
|
+
}
|
522
|
+
return tagPairs.join("&");
|
523
|
+
}
|
524
|
+
/**
|
525
|
+
* Convert Tags type to BlobTags.
|
526
|
+
*
|
527
|
+
* @param tags -
|
528
|
+
*/
|
529
|
+
export function toBlobTags(tags) {
|
530
|
+
if (tags === undefined) {
|
531
|
+
return undefined;
|
532
|
+
}
|
533
|
+
const res = {
|
534
|
+
blobTagSet: [],
|
535
|
+
};
|
536
|
+
for (const key in tags) {
|
537
|
+
if (Object.prototype.hasOwnProperty.call(tags, key)) {
|
538
|
+
const value = tags[key];
|
539
|
+
res.blobTagSet.push({
|
540
|
+
key,
|
541
|
+
value,
|
542
|
+
});
|
543
|
+
}
|
544
|
+
}
|
545
|
+
return res;
|
546
|
+
}
|
547
|
+
/**
|
548
|
+
* Covert BlobTags to Tags type.
|
549
|
+
*
|
550
|
+
* @param tags -
|
551
|
+
*/
|
552
|
+
export function toTags(tags) {
|
553
|
+
if (tags === undefined) {
|
554
|
+
return undefined;
|
555
|
+
}
|
556
|
+
const res = {};
|
557
|
+
for (const blobTag of tags.blobTagSet) {
|
558
|
+
res[blobTag.key] = blobTag.value;
|
559
|
+
}
|
560
|
+
return res;
|
561
|
+
}
|
562
|
+
/**
|
563
|
+
* Convert BlobQueryTextConfiguration to QuerySerialization type.
|
564
|
+
*
|
565
|
+
* @param textConfiguration -
|
566
|
+
*/
|
567
|
+
export function toQuerySerialization(textConfiguration) {
|
568
|
+
if (textConfiguration === undefined) {
|
569
|
+
return undefined;
|
570
|
+
}
|
571
|
+
switch (textConfiguration.kind) {
|
572
|
+
case "csv":
|
573
|
+
return {
|
574
|
+
format: {
|
575
|
+
type: "delimited",
|
576
|
+
delimitedTextConfiguration: {
|
577
|
+
columnSeparator: textConfiguration.columnSeparator || ",",
|
578
|
+
fieldQuote: textConfiguration.fieldQuote || "",
|
579
|
+
recordSeparator: textConfiguration.recordSeparator,
|
580
|
+
escapeChar: textConfiguration.escapeCharacter || "",
|
581
|
+
headersPresent: textConfiguration.hasHeaders || false,
|
582
|
+
},
|
583
|
+
},
|
584
|
+
};
|
585
|
+
case "json":
|
586
|
+
return {
|
587
|
+
format: {
|
588
|
+
type: "json",
|
589
|
+
jsonTextConfiguration: {
|
590
|
+
recordSeparator: textConfiguration.recordSeparator,
|
591
|
+
},
|
592
|
+
},
|
593
|
+
};
|
594
|
+
case "arrow":
|
595
|
+
return {
|
596
|
+
format: {
|
597
|
+
type: "arrow",
|
598
|
+
arrowConfiguration: {
|
599
|
+
schema: textConfiguration.schema,
|
600
|
+
},
|
601
|
+
},
|
602
|
+
};
|
603
|
+
case "parquet":
|
604
|
+
return {
|
605
|
+
format: {
|
606
|
+
type: "parquet",
|
607
|
+
},
|
608
|
+
};
|
609
|
+
default:
|
610
|
+
throw Error("Invalid BlobQueryTextConfiguration.");
|
611
|
+
}
|
612
|
+
}
|
613
|
+
export function parseObjectReplicationRecord(objectReplicationRecord) {
|
614
|
+
if (!objectReplicationRecord) {
|
615
|
+
return undefined;
|
616
|
+
}
|
617
|
+
if ("policy-id" in objectReplicationRecord) {
|
618
|
+
// If the dictionary contains a key with policy id, we are not required to do any parsing since
|
619
|
+
// the policy id should already be stored in the ObjectReplicationDestinationPolicyId.
|
620
|
+
return undefined;
|
621
|
+
}
|
622
|
+
const orProperties = [];
|
623
|
+
for (const key in objectReplicationRecord) {
|
624
|
+
const ids = key.split("_");
|
625
|
+
const policyPrefix = "or-";
|
626
|
+
if (ids[0].startsWith(policyPrefix)) {
|
627
|
+
ids[0] = ids[0].substring(policyPrefix.length);
|
628
|
+
}
|
629
|
+
const rule = {
|
630
|
+
ruleId: ids[1],
|
631
|
+
replicationStatus: objectReplicationRecord[key],
|
632
|
+
};
|
633
|
+
const policyIndex = orProperties.findIndex((policy) => policy.policyId === ids[0]);
|
634
|
+
if (policyIndex > -1) {
|
635
|
+
orProperties[policyIndex].rules.push(rule);
|
636
|
+
}
|
637
|
+
else {
|
638
|
+
orProperties.push({
|
639
|
+
policyId: ids[0],
|
640
|
+
rules: [rule],
|
641
|
+
});
|
642
|
+
}
|
643
|
+
}
|
644
|
+
return orProperties;
|
645
|
+
}
|
646
|
+
/**
|
647
|
+
* Attach a TokenCredential to an object.
|
648
|
+
*
|
649
|
+
* @param thing -
|
650
|
+
* @param credential -
|
651
|
+
*/
|
652
|
+
export function attachCredential(thing, credential) {
|
653
|
+
thing.credential = credential;
|
654
|
+
return thing;
|
655
|
+
}
|
656
|
+
export function httpAuthorizationToString(httpAuthorization) {
|
657
|
+
return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
|
658
|
+
}
|
659
|
+
export function BlobNameToString(name) {
|
660
|
+
if (name.encoded) {
|
661
|
+
return decodeURIComponent(name.content);
|
662
|
+
}
|
663
|
+
else {
|
664
|
+
return name.content;
|
665
|
+
}
|
666
|
+
}
|
667
|
+
export function ConvertInternalResponseOfListBlobFlat(internalResponse) {
|
668
|
+
return Object.assign(Object.assign({}, internalResponse), { segment: {
|
669
|
+
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
|
670
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
|
671
|
+
return blobItem;
|
672
|
+
}),
|
673
|
+
} });
|
674
|
+
}
|
675
|
+
export function ConvertInternalResponseOfListBlobHierarchy(internalResponse) {
|
676
|
+
var _a;
|
677
|
+
return Object.assign(Object.assign({}, internalResponse), { segment: {
|
678
|
+
blobPrefixes: (_a = internalResponse.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
|
679
|
+
const blobPrefix = {
|
680
|
+
name: BlobNameToString(blobPrefixInternal.name),
|
681
|
+
};
|
682
|
+
return blobPrefix;
|
683
|
+
}),
|
684
|
+
blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
|
685
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
|
686
|
+
return blobItem;
|
687
|
+
}),
|
688
|
+
} });
|
689
|
+
}
|
690
|
+
export function* ExtractPageRangeInfoItems(getPageRangesSegment) {
|
691
|
+
let pageRange = [];
|
692
|
+
let clearRange = [];
|
693
|
+
if (getPageRangesSegment.pageRange)
|
694
|
+
pageRange = getPageRangesSegment.pageRange;
|
695
|
+
if (getPageRangesSegment.clearRange)
|
696
|
+
clearRange = getPageRangesSegment.clearRange;
|
697
|
+
let pageRangeIndex = 0;
|
698
|
+
let clearRangeIndex = 0;
|
699
|
+
while (pageRangeIndex < pageRange.length && clearRangeIndex < clearRange.length) {
|
700
|
+
if (pageRange[pageRangeIndex].start < clearRange[clearRangeIndex].start) {
|
701
|
+
yield {
|
702
|
+
start: pageRange[pageRangeIndex].start,
|
703
|
+
end: pageRange[pageRangeIndex].end,
|
704
|
+
isClear: false,
|
705
|
+
};
|
706
|
+
++pageRangeIndex;
|
707
|
+
}
|
708
|
+
else {
|
709
|
+
yield {
|
710
|
+
start: clearRange[clearRangeIndex].start,
|
711
|
+
end: clearRange[clearRangeIndex].end,
|
712
|
+
isClear: true,
|
713
|
+
};
|
714
|
+
++clearRangeIndex;
|
715
|
+
}
|
716
|
+
}
|
717
|
+
for (; pageRangeIndex < pageRange.length; ++pageRangeIndex) {
|
718
|
+
yield {
|
719
|
+
start: pageRange[pageRangeIndex].start,
|
720
|
+
end: pageRange[pageRangeIndex].end,
|
721
|
+
isClear: false,
|
722
|
+
};
|
723
|
+
}
|
724
|
+
for (; clearRangeIndex < clearRange.length; ++clearRangeIndex) {
|
725
|
+
yield {
|
726
|
+
start: clearRange[clearRangeIndex].start,
|
727
|
+
end: clearRange[clearRangeIndex].end,
|
728
|
+
isClear: true,
|
729
|
+
};
|
730
|
+
}
|
731
|
+
}
|
732
|
+
/**
|
733
|
+
* Escape the blobName but keep path separator ('/').
|
734
|
+
*/
|
735
|
+
export function EscapePath(blobName) {
|
736
|
+
const split = blobName.split("/");
|
737
|
+
for (let i = 0; i < split.length; i++) {
|
738
|
+
split[i] = encodeURIComponent(split[i]);
|
739
|
+
}
|
740
|
+
return split.join("/");
|
741
|
+
}
|
742
|
+
/**
|
743
|
+
* A typesafe helper for ensuring that a given response object has
|
744
|
+
* the original _response attached.
|
745
|
+
* @param response - A response object from calling a client operation
|
746
|
+
* @returns The same object, but with known _response property
|
747
|
+
*/
|
748
|
+
export function assertResponse(response) {
|
749
|
+
if (`_response` in response) {
|
750
|
+
return response;
|
751
|
+
}
|
752
|
+
throw new TypeError(`Unexpected response object ${response}`);
|
753
|
+
}
|
754
|
+
//# sourceMappingURL=utils.common.js.map
|