@azure/storage-queue 12.13.0 → 12.20.0-alpha.20230615.1
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 +1216 -689
- 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 +1 -1
- package/dist-esm/storage-blob/src/StorageRetryPolicyFactory.js.map +1 -0
- package/dist-esm/{src → storage-blob/src}/credentials/AnonymousCredential.js +2 -2
- 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/storage-blob/src/generated/src/operationsInterfaces/blob.js +9 -0
- 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.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 +5 -4
- 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/{src → storage-blob/src}/policies/StorageSharedKeyCredentialPolicy.js +4 -2
- 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.map +1 -0
- package/dist-esm/storage-blob/src/utils/Batch.js +122 -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-queue/src/AccountSASPermissions.js.map +1 -0
- package/dist-esm/storage-queue/src/AccountSASResourceTypes.js +72 -0
- package/dist-esm/storage-queue/src/AccountSASResourceTypes.js.map +1 -0
- package/dist-esm/storage-queue/src/AccountSASServices.js +80 -0
- package/dist-esm/storage-queue/src/AccountSASServices.js.map +1 -0
- package/dist-esm/storage-queue/src/AccountSASSignatureValues.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/QueueClient.js +44 -43
- package/dist-esm/storage-queue/src/QueueClient.js.map +1 -0
- package/dist-esm/storage-queue/src/QueueSASPermissions.js.map +1 -0
- package/dist-esm/storage-queue/src/QueueSASSignatureValues.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/QueueServiceClient.js +49 -41
- package/dist-esm/storage-queue/src/QueueServiceClient.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/SASQueryParameters.js +14 -14
- package/dist-esm/storage-queue/src/SASQueryParameters.js.map +1 -0
- package/dist-esm/storage-queue/src/SasIPRange.js +13 -0
- package/dist-esm/storage-queue/src/SasIPRange.js.map +1 -0
- package/dist-esm/storage-queue/src/StorageClient.js +53 -0
- package/dist-esm/storage-queue/src/StorageClient.js.map +1 -0
- package/dist-esm/storage-queue/src/StorageContextClient.js +18 -0
- package/dist-esm/storage-queue/src/StorageContextClient.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/index.js +11 -0
- package/dist-esm/storage-queue/src/generated/src/index.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/models/index.js +57 -0
- package/dist-esm/storage-queue/src/generated/src/models/index.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/models/mappers.js +2 -2
- package/dist-esm/storage-queue/src/generated/src/models/mappers.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/models/parameters.js +4 -5
- package/dist-esm/storage-queue/src/generated/src/models/parameters.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operations/index.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/operations/messageId.js +6 -15
- package/dist-esm/storage-queue/src/generated/src/operations/messageId.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/operations/messages.js +8 -21
- package/dist-esm/storage-queue/src/generated/src/operations/messages.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/operations/queue.js +10 -28
- package/dist-esm/storage-queue/src/generated/src/operations/queue.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/generated/src/operations/service.js +8 -21
- package/dist-esm/storage-queue/src/generated/src/operations/service.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/index.js +12 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/index.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/messageId.js +9 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/messageId.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/messages.js +9 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/messages.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/queue.js +9 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/queue.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/service.js +9 -0
- package/dist-esm/storage-queue/src/generated/src/operationsInterfaces/service.js.map +1 -0
- package/dist-esm/storage-queue/src/generated/src/storageClient.js +47 -0
- package/dist-esm/storage-queue/src/generated/src/storageClient.js.map +1 -0
- package/dist-esm/storage-queue/src/generatedModels.js +4 -0
- package/dist-esm/storage-queue/src/generatedModels.js.map +1 -0
- package/dist-esm/storage-queue/src/index.browser.js +18 -0
- package/dist-esm/storage-queue/src/index.browser.js.map +1 -0
- package/dist-esm/storage-queue/src/index.js +26 -0
- package/dist-esm/storage-queue/src/index.js.map +1 -0
- package/dist-esm/storage-queue/src/log.js.map +1 -0
- package/dist-esm/storage-queue/src/models.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/utils/constants.js +2 -2
- package/dist-esm/storage-queue/src/utils/constants.js.map +1 -0
- package/dist-esm/storage-queue/src/utils/tracing.js +12 -0
- package/dist-esm/storage-queue/src/utils/tracing.js.map +1 -0
- package/dist-esm/{src → storage-queue/src}/utils/utils.common.js +69 -47
- package/dist-esm/storage-queue/src/utils/utils.common.js.map +1 -0
- package/package.json +25 -18
- package/types/3.1/storage-queue.d.ts +544 -255
- package/types/latest/storage-queue.d.ts +583 -259
- 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/Pipeline.js +0 -85
- package/dist-esm/src/Pipeline.js.map +0 -1
- package/dist-esm/src/QueueClient.js.map +0 -1
- package/dist-esm/src/QueueSASPermissions.js.map +0 -1
- package/dist-esm/src/QueueSASSignatureValues.js.map +0 -1
- package/dist-esm/src/QueueServiceClient.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/StorageBrowserPolicyFactory.js.map +0 -1
- package/dist-esm/src/StorageClient.js +0 -44
- 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/index.js.map +0 -1
- package/dist-esm/src/generated/src/operations/messageId.js.map +0 -1
- package/dist-esm/src/generated/src/operations/messages.js.map +0 -1
- package/dist-esm/src/generated/src/operations/queue.js.map +0 -1
- package/dist-esm/src/generated/src/operations/service.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 -39
- package/dist-esm/src/generated/src/storageClientContext.js.map +0 -1
- 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 -25
- 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/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.common.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}/generatedModels.js +0 -0
- /package/dist-esm/{src → storage-blob/src}/policies/AnonymousCredentialPolicy.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/sas}/SasIPRange.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/AccountSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/AccountSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/QueueSASPermissions.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/QueueSASSignatureValues.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/generated/src/operations/index.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/log.js +0 -0
- /package/dist-esm/{src → storage-queue/src}/models.js +0 -0
package/dist/index.js
CHANGED
|
@@ -2,13 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
6
6
|
var crypto = require('crypto');
|
|
7
|
-
var
|
|
7
|
+
var coreUtil = require('@azure/core-util');
|
|
8
|
+
var tslib = require('tslib');
|
|
9
|
+
var coreHttpCompat = require('@azure/core-http-compat');
|
|
10
|
+
var coreClient = require('@azure/core-client');
|
|
11
|
+
var coreXml = require('@azure/core-xml');
|
|
12
|
+
var coreAuth = require('@azure/core-auth');
|
|
13
|
+
var logger$2 = require('@azure/logger');
|
|
8
14
|
var abortController = require('@azure/abort-controller');
|
|
9
|
-
var os = require('os');
|
|
10
15
|
var coreTracing = require('@azure/core-tracing');
|
|
11
|
-
var tslib = require('tslib');
|
|
12
16
|
require('@azure/core-paging');
|
|
13
17
|
|
|
14
18
|
function _interopNamespace(e) {
|
|
@@ -29,8 +33,8 @@ function _interopNamespace(e) {
|
|
|
29
33
|
return Object.freeze(n);
|
|
30
34
|
}
|
|
31
35
|
|
|
32
|
-
var
|
|
33
|
-
var
|
|
36
|
+
var coreHttpCompat__namespace = /*#__PURE__*/_interopNamespace(coreHttpCompat);
|
|
37
|
+
var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
|
|
34
38
|
|
|
35
39
|
// Copyright (c) Microsoft Corporation.
|
|
36
40
|
// Licensed under the MIT license.
|
|
@@ -326,91 +330,10 @@ function ipRangeToString(ipRange) {
|
|
|
326
330
|
}
|
|
327
331
|
|
|
328
332
|
// Copyright (c) Microsoft Corporation.
|
|
329
|
-
|
|
330
|
-
const SDK_VERSION = "12.13.0";
|
|
331
|
-
const SERVICE_VERSION = "2022-11-02";
|
|
332
|
-
/**
|
|
333
|
-
* The OAuth scope to use with Azure Storage.
|
|
334
|
-
*/
|
|
335
|
-
const StorageOAuthScopes = "https://storage.azure.com/.default";
|
|
336
|
-
const URLConstants = {
|
|
337
|
-
Parameters: {
|
|
338
|
-
FORCE_BROWSER_NO_CACHE: "_",
|
|
339
|
-
SIGNATURE: "sig",
|
|
340
|
-
TIMEOUT: "timeout",
|
|
341
|
-
},
|
|
342
|
-
};
|
|
343
|
-
const HeaderConstants = {
|
|
344
|
-
AUTHORIZATION: "authorization",
|
|
345
|
-
AUTHORIZATION_SCHEME: "Bearer",
|
|
346
|
-
CONTENT_ENCODING: "content-encoding",
|
|
347
|
-
CONTENT_LANGUAGE: "content-language",
|
|
348
|
-
CONTENT_LENGTH: "content-length",
|
|
349
|
-
CONTENT_MD5: "content-md5",
|
|
350
|
-
CONTENT_TYPE: "content-type",
|
|
351
|
-
COOKIE: "Cookie",
|
|
352
|
-
DATE: "date",
|
|
353
|
-
IF_MATCH: "if-match",
|
|
354
|
-
IF_MODIFIED_SINCE: "if-modified-since",
|
|
355
|
-
IF_NONE_MATCH: "if-none-match",
|
|
356
|
-
IF_UNMODIFIED_SINCE: "if-unmodified-since",
|
|
357
|
-
PREFIX_FOR_STORAGE: "x-ms-",
|
|
358
|
-
RANGE: "Range",
|
|
359
|
-
USER_AGENT: "User-Agent",
|
|
360
|
-
X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id",
|
|
361
|
-
X_MS_COPY_SOURCE: "x-ms-copy-source",
|
|
362
|
-
X_MS_DATE: "x-ms-date",
|
|
363
|
-
};
|
|
333
|
+
const SERVICE_VERSION = "2021-10-04";
|
|
364
334
|
const DevelopmentConnectionString = `DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;
|
|
365
335
|
AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;
|
|
366
336
|
QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;`;
|
|
367
|
-
const StorageQueueLoggingAllowedHeaderNames = [
|
|
368
|
-
"Access-Control-Allow-Origin",
|
|
369
|
-
"Cache-Control",
|
|
370
|
-
"Content-Length",
|
|
371
|
-
"Content-Type",
|
|
372
|
-
"Date",
|
|
373
|
-
"Request-Id",
|
|
374
|
-
"traceparent",
|
|
375
|
-
"Transfer-Encoding",
|
|
376
|
-
"User-Agent",
|
|
377
|
-
"x-ms-client-request-id",
|
|
378
|
-
"x-ms-date",
|
|
379
|
-
"x-ms-error-code",
|
|
380
|
-
"x-ms-request-id",
|
|
381
|
-
"x-ms-return-client-request-id",
|
|
382
|
-
"x-ms-version",
|
|
383
|
-
"x-ms-approximate-messages-count",
|
|
384
|
-
"x-ms-popreceipt",
|
|
385
|
-
"x-ms-time-next-visible",
|
|
386
|
-
];
|
|
387
|
-
const StorageQueueLoggingAllowedQueryParameters = [
|
|
388
|
-
"comp",
|
|
389
|
-
"maxresults",
|
|
390
|
-
"rscc",
|
|
391
|
-
"rscd",
|
|
392
|
-
"rsce",
|
|
393
|
-
"rscl",
|
|
394
|
-
"rsct",
|
|
395
|
-
"se",
|
|
396
|
-
"si",
|
|
397
|
-
"sip",
|
|
398
|
-
"sp",
|
|
399
|
-
"spr",
|
|
400
|
-
"sr",
|
|
401
|
-
"srt",
|
|
402
|
-
"ss",
|
|
403
|
-
"st",
|
|
404
|
-
"sv",
|
|
405
|
-
"include",
|
|
406
|
-
"marker",
|
|
407
|
-
"prefix",
|
|
408
|
-
"messagettl",
|
|
409
|
-
"numofmessages",
|
|
410
|
-
"peekonly",
|
|
411
|
-
"popreceipt",
|
|
412
|
-
"visibilitytimeout",
|
|
413
|
-
];
|
|
414
337
|
/// List of ports used for path style addressing.
|
|
415
338
|
/// Path style addressing means that storage account is put in URI's Path segment in instead of in host.
|
|
416
339
|
const PathStylePorts = [
|
|
@@ -436,44 +359,6 @@ const PathStylePorts = [
|
|
|
436
359
|
"11104",
|
|
437
360
|
];
|
|
438
361
|
|
|
439
|
-
/*
|
|
440
|
-
* Copyright (c) Microsoft Corporation.
|
|
441
|
-
* Licensed under the MIT License.
|
|
442
|
-
*
|
|
443
|
-
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
444
|
-
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
445
|
-
*/
|
|
446
|
-
const packageName = "azure-storage-queue";
|
|
447
|
-
const packageVersion = "12.13.0";
|
|
448
|
-
class StorageClientContext extends coreHttp__namespace.ServiceClient {
|
|
449
|
-
/**
|
|
450
|
-
* Initializes a new instance of the StorageClientContext class.
|
|
451
|
-
* @param url The URL of the service account, queue or message that is the target of the desired
|
|
452
|
-
* operation.
|
|
453
|
-
* @param options The parameter options
|
|
454
|
-
*/
|
|
455
|
-
constructor(url, options) {
|
|
456
|
-
if (url === undefined) {
|
|
457
|
-
throw new Error("'url' cannot be null");
|
|
458
|
-
}
|
|
459
|
-
// Initializing default values for options
|
|
460
|
-
if (!options) {
|
|
461
|
-
options = {};
|
|
462
|
-
}
|
|
463
|
-
if (!options.userAgent) {
|
|
464
|
-
const defaultUserAgent = coreHttp__namespace.getDefaultUserAgentValue();
|
|
465
|
-
options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`;
|
|
466
|
-
}
|
|
467
|
-
super(undefined, options);
|
|
468
|
-
this.requestContentType = "application/json; charset=utf-8";
|
|
469
|
-
this.baseUri = options.endpoint || "{url}";
|
|
470
|
-
// Parameter assignments
|
|
471
|
-
this.url = url;
|
|
472
|
-
// Assigning values to Constant parameters
|
|
473
|
-
this.version = options.version || "2022-11-02";
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
362
|
/**
|
|
478
363
|
* Append a string to URL path. Will remove duplicated "/" in front of the string
|
|
479
364
|
* when URL path ends with a "/".
|
|
@@ -483,76 +368,12 @@ class StorageClientContext extends coreHttp__namespace.ServiceClient {
|
|
|
483
368
|
* @returns An updated URL string
|
|
484
369
|
*/
|
|
485
370
|
function appendToURLPath(url, name) {
|
|
486
|
-
const urlParsed =
|
|
487
|
-
let path = urlParsed.
|
|
371
|
+
const urlParsed = new URL(url);
|
|
372
|
+
let path = urlParsed.pathname;
|
|
488
373
|
path = path ? (path.endsWith("/") ? `${path}${name}` : `${path}/${name}`) : name;
|
|
489
|
-
urlParsed.
|
|
490
|
-
return urlParsed.toString();
|
|
491
|
-
}
|
|
492
|
-
/**
|
|
493
|
-
* Set URL parameter name and value. If name exists in URL parameters, old value
|
|
494
|
-
* will be replaced by name key. If not provide value, the parameter will be deleted.
|
|
495
|
-
*
|
|
496
|
-
* @param url - Source URL string
|
|
497
|
-
* @param name - Parameter name
|
|
498
|
-
* @param value - Parameter value
|
|
499
|
-
* @returns An updated URL string
|
|
500
|
-
*/
|
|
501
|
-
function setURLParameter(url, name, value) {
|
|
502
|
-
const urlParsed = coreHttp.URLBuilder.parse(url);
|
|
503
|
-
urlParsed.setQueryParameter(name, value);
|
|
504
|
-
return urlParsed.toString();
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Set URL host.
|
|
508
|
-
*
|
|
509
|
-
* @param url - Source URL string
|
|
510
|
-
* @param host - New host string
|
|
511
|
-
* @returns An updated URL string
|
|
512
|
-
*/
|
|
513
|
-
function setURLHost(url, host) {
|
|
514
|
-
const urlParsed = coreHttp.URLBuilder.parse(url);
|
|
515
|
-
urlParsed.setHost(host);
|
|
374
|
+
urlParsed.pathname = path;
|
|
516
375
|
return urlParsed.toString();
|
|
517
376
|
}
|
|
518
|
-
/**
|
|
519
|
-
* Gets URL path from an URL string.
|
|
520
|
-
*
|
|
521
|
-
* @param url - Source URL string
|
|
522
|
-
* @returns The path part of the given URL string.
|
|
523
|
-
*/
|
|
524
|
-
function getURLPath(url) {
|
|
525
|
-
const urlParsed = coreHttp.URLBuilder.parse(url);
|
|
526
|
-
return urlParsed.getPath();
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Gets URL query key value pairs from an URL string.
|
|
530
|
-
*
|
|
531
|
-
* @param url -
|
|
532
|
-
* @returns query key value string pairs from the given URL string.
|
|
533
|
-
*/
|
|
534
|
-
function getURLQueries(url) {
|
|
535
|
-
let queryString = coreHttp.URLBuilder.parse(url).getQuery();
|
|
536
|
-
if (!queryString) {
|
|
537
|
-
return {};
|
|
538
|
-
}
|
|
539
|
-
queryString = queryString.trim();
|
|
540
|
-
queryString = queryString.startsWith("?") ? queryString.substr(1) : queryString;
|
|
541
|
-
let querySubStrings = queryString.split("&");
|
|
542
|
-
querySubStrings = querySubStrings.filter((value) => {
|
|
543
|
-
const indexOfEqual = value.indexOf("=");
|
|
544
|
-
const lastIndexOfEqual = value.lastIndexOf("=");
|
|
545
|
-
return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1);
|
|
546
|
-
});
|
|
547
|
-
const queries = {};
|
|
548
|
-
for (const querySubString of querySubStrings) {
|
|
549
|
-
const splitResults = querySubString.split("=");
|
|
550
|
-
const key = splitResults[0];
|
|
551
|
-
const value = splitResults[1];
|
|
552
|
-
queries[key] = value;
|
|
553
|
-
}
|
|
554
|
-
return queries;
|
|
555
|
-
}
|
|
556
377
|
function getProxyUriFromDevConnString(connectionString) {
|
|
557
378
|
// Development Connection String
|
|
558
379
|
// 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
|
|
@@ -641,7 +462,7 @@ function extractConnectionStringParts(connectionString) {
|
|
|
641
462
|
}
|
|
642
463
|
else {
|
|
643
464
|
// SAS connection string
|
|
644
|
-
|
|
465
|
+
let accountSas = getValueInConnString(connectionString, "SharedAccessSignature");
|
|
645
466
|
const accountName = getAccountNameFromUrl(queueEndpoint);
|
|
646
467
|
if (!queueEndpoint) {
|
|
647
468
|
throw new Error("Invalid QueueEndpoint in the provided SAS Connection String");
|
|
@@ -649,6 +470,10 @@ function extractConnectionStringParts(connectionString) {
|
|
|
649
470
|
else if (!accountSas) {
|
|
650
471
|
throw new Error("Invalid SharedAccessSignature in the provided SAS Connection String");
|
|
651
472
|
}
|
|
473
|
+
// remove test SAS
|
|
474
|
+
if (accountSas === "fakeSasToken") {
|
|
475
|
+
accountSas = "";
|
|
476
|
+
}
|
|
652
477
|
return { kind: "SASConnString", url: queueEndpoint, accountName, accountSas };
|
|
653
478
|
}
|
|
654
479
|
}
|
|
@@ -667,53 +492,24 @@ function truncatedISO8061Date(date, withMilliseconds = true) {
|
|
|
667
492
|
? dateString.substring(0, dateString.length - 1) + "0000" + "Z"
|
|
668
493
|
: dateString.substring(0, dateString.length - 5) + "Z";
|
|
669
494
|
}
|
|
670
|
-
/**
|
|
671
|
-
* Delay specified time interval.
|
|
672
|
-
*
|
|
673
|
-
* @param timeInMs -
|
|
674
|
-
* @param aborter -
|
|
675
|
-
* @param abortError -
|
|
676
|
-
*/
|
|
677
|
-
async function delay(timeInMs, aborter, abortError) {
|
|
678
|
-
return new Promise((resolve, reject) => {
|
|
679
|
-
/* eslint-disable-next-line prefer-const*/
|
|
680
|
-
let timeout;
|
|
681
|
-
const abortHandler = () => {
|
|
682
|
-
if (timeout !== undefined) {
|
|
683
|
-
clearTimeout(timeout);
|
|
684
|
-
}
|
|
685
|
-
reject(abortError);
|
|
686
|
-
};
|
|
687
|
-
const resolveHandler = () => {
|
|
688
|
-
if (aborter !== undefined) {
|
|
689
|
-
aborter.removeEventListener("abort", abortHandler);
|
|
690
|
-
}
|
|
691
|
-
resolve();
|
|
692
|
-
};
|
|
693
|
-
timeout = setTimeout(resolveHandler, timeInMs);
|
|
694
|
-
if (aborter !== undefined) {
|
|
695
|
-
aborter.addEventListener("abort", abortHandler);
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
495
|
/**
|
|
700
496
|
* Extracts account name from the url
|
|
701
497
|
* @param url - url to extract the account name from
|
|
702
498
|
* @returns with the account name
|
|
703
499
|
*/
|
|
704
500
|
function getAccountNameFromUrl(url) {
|
|
705
|
-
const parsedUrl =
|
|
501
|
+
const parsedUrl = new URL(url);
|
|
706
502
|
let accountName;
|
|
707
503
|
try {
|
|
708
|
-
if (parsedUrl.
|
|
504
|
+
if (parsedUrl.hostname.split(".")[1] === "queue") {
|
|
709
505
|
// `${defaultEndpointsProtocol}://${accountName}.queue.${endpointSuffix}`;
|
|
710
|
-
accountName = parsedUrl.
|
|
506
|
+
accountName = parsedUrl.hostname.split(".")[0];
|
|
711
507
|
}
|
|
712
508
|
else if (isIpEndpointStyle(parsedUrl)) {
|
|
713
509
|
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/
|
|
714
510
|
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/
|
|
715
511
|
// .getPath() -> /devstoreaccount1/
|
|
716
|
-
accountName = parsedUrl.
|
|
512
|
+
accountName = parsedUrl.pathname.split("/")[1];
|
|
717
513
|
}
|
|
718
514
|
else {
|
|
719
515
|
// Custom domain case: "https://customdomain.com/containername/blob".
|
|
@@ -726,28 +522,13 @@ function getAccountNameFromUrl(url) {
|
|
|
726
522
|
}
|
|
727
523
|
}
|
|
728
524
|
function isIpEndpointStyle(parsedUrl) {
|
|
729
|
-
|
|
730
|
-
return false;
|
|
731
|
-
}
|
|
732
|
-
const host = parsedUrl.getHost() + (parsedUrl.getPort() === undefined ? "" : ":" + parsedUrl.getPort());
|
|
525
|
+
const host = parsedUrl.host;
|
|
733
526
|
// Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.
|
|
734
527
|
// Case 2: localhost(:port), use broad regex to match port part.
|
|
735
528
|
// Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
|
|
736
529
|
// For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
|
|
737
530
|
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) ||
|
|
738
|
-
(parsedUrl.
|
|
739
|
-
}
|
|
740
|
-
/**
|
|
741
|
-
* Gets a new StorageClientContext
|
|
742
|
-
* @param url - Url used for the StorageClientContext
|
|
743
|
-
* @param pipeline - a pipeline containing HTTP request policies
|
|
744
|
-
* @returns new StorageClientContext
|
|
745
|
-
*/
|
|
746
|
-
function getStorageClientContext(url, pipeline) {
|
|
747
|
-
const storageClientContext = new StorageClientContext(url, pipeline.toServiceClientOptions());
|
|
748
|
-
// Override protocol layer's default content-type
|
|
749
|
-
storageClientContext.requestContentType = undefined;
|
|
750
|
-
return storageClientContext;
|
|
531
|
+
(Boolean(parsedUrl.port) && PathStylePorts.includes(parsedUrl.port)));
|
|
751
532
|
}
|
|
752
533
|
/**
|
|
753
534
|
* Append a string to URL query.
|
|
@@ -757,17 +538,29 @@ function getStorageClientContext(url, pipeline) {
|
|
|
757
538
|
* @returns An updated URL string.
|
|
758
539
|
*/
|
|
759
540
|
function appendToURLQuery(url, queryParts) {
|
|
760
|
-
const urlParsed =
|
|
761
|
-
let query = urlParsed.
|
|
541
|
+
const urlParsed = new URL(url);
|
|
542
|
+
let query = urlParsed.search;
|
|
762
543
|
if (query) {
|
|
763
544
|
query += "&" + queryParts;
|
|
764
545
|
}
|
|
765
546
|
else {
|
|
766
547
|
query = queryParts;
|
|
767
548
|
}
|
|
768
|
-
urlParsed.
|
|
549
|
+
urlParsed.search = query;
|
|
769
550
|
return urlParsed.toString();
|
|
770
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* A typesafe helper for ensuring that a given response object has
|
|
554
|
+
* the original _response attached.
|
|
555
|
+
* @param response - A response object from calling a client operation
|
|
556
|
+
* @returns The same object, but with known _response property
|
|
557
|
+
*/
|
|
558
|
+
function assertResponse(response) {
|
|
559
|
+
if (`_response` in response) {
|
|
560
|
+
return response;
|
|
561
|
+
}
|
|
562
|
+
throw new TypeError(`Unexpected response object ${response}`);
|
|
563
|
+
}
|
|
771
564
|
|
|
772
565
|
// Copyright (c) Microsoft Corporation.
|
|
773
566
|
/**
|
|
@@ -794,6 +587,20 @@ exports.SASProtocol = void 0;
|
|
|
794
587
|
* NOTE: Instances of this class are immutable.
|
|
795
588
|
*/
|
|
796
589
|
class SASQueryParameters {
|
|
590
|
+
/**
|
|
591
|
+
* Optional. IP range allowed for this SAS.
|
|
592
|
+
*
|
|
593
|
+
* @readonly
|
|
594
|
+
*/
|
|
595
|
+
get ipRange() {
|
|
596
|
+
if (this.ipRangeInner) {
|
|
597
|
+
return {
|
|
598
|
+
end: this.ipRangeInner.end,
|
|
599
|
+
start: this.ipRangeInner.start,
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
return undefined;
|
|
603
|
+
}
|
|
797
604
|
/**
|
|
798
605
|
* Creates an instance of SASQueryParameters.
|
|
799
606
|
*
|
|
@@ -822,20 +629,6 @@ class SASQueryParameters {
|
|
|
822
629
|
this.resource = resource;
|
|
823
630
|
this.signature = signature;
|
|
824
631
|
}
|
|
825
|
-
/**
|
|
826
|
-
* Optional. IP range allowed for this SAS.
|
|
827
|
-
*
|
|
828
|
-
* @readonly
|
|
829
|
-
*/
|
|
830
|
-
get ipRange() {
|
|
831
|
-
if (this.ipRangeInner) {
|
|
832
|
-
return {
|
|
833
|
-
end: this.ipRangeInner.end,
|
|
834
|
-
start: this.ipRangeInner.start,
|
|
835
|
-
};
|
|
836
|
-
}
|
|
837
|
-
return undefined;
|
|
838
|
-
}
|
|
839
632
|
/**
|
|
840
633
|
* Encodes all SAS query parameters into a string that can be appended to a URL.
|
|
841
634
|
*
|
|
@@ -958,12 +751,52 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
|
|
|
958
751
|
return new SASQueryParameters(version, signature, parsedPermissions, parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange);
|
|
959
752
|
}
|
|
960
753
|
|
|
754
|
+
// Copyright (c) Microsoft Corporation.
|
|
755
|
+
// Licensed under the MIT license.
|
|
756
|
+
/**
|
|
757
|
+
* The base class from which all request policies derive.
|
|
758
|
+
*/
|
|
759
|
+
class BaseRequestPolicy {
|
|
760
|
+
/**
|
|
761
|
+
* The main method to implement that manipulates a request/response.
|
|
762
|
+
*/
|
|
763
|
+
constructor(
|
|
764
|
+
/**
|
|
765
|
+
* The next policy in the pipeline. Each policy is responsible for executing the next one if the request is to continue through the pipeline.
|
|
766
|
+
*/
|
|
767
|
+
_nextPolicy,
|
|
768
|
+
/**
|
|
769
|
+
* The options that can be passed to a given request policy.
|
|
770
|
+
*/
|
|
771
|
+
_options) {
|
|
772
|
+
this._nextPolicy = _nextPolicy;
|
|
773
|
+
this._options = _options;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Get whether or not a log with the provided log level should be logged.
|
|
777
|
+
* @param logLevel - The log level of the log that will be logged.
|
|
778
|
+
* @returns Whether or not a log with the provided log level should be logged.
|
|
779
|
+
*/
|
|
780
|
+
shouldLog(logLevel) {
|
|
781
|
+
return this._options.shouldLog(logLevel);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Attempt to log the provided message to the provided logger. If no logger was provided or if
|
|
785
|
+
* the log level does not meat the logger's threshold, then nothing will be logged.
|
|
786
|
+
* @param logLevel - The log level of this log.
|
|
787
|
+
* @param message - The message of this log.
|
|
788
|
+
*/
|
|
789
|
+
log(logLevel, message) {
|
|
790
|
+
this._options.log(logLevel, message);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
961
794
|
// Copyright (c) Microsoft Corporation.
|
|
962
795
|
/**
|
|
963
796
|
* Credential policy used to sign HTTP(S) requests before sending. This is an
|
|
964
797
|
* abstract class.
|
|
965
798
|
*/
|
|
966
|
-
class CredentialPolicy extends
|
|
799
|
+
class CredentialPolicy extends BaseRequestPolicy {
|
|
967
800
|
/**
|
|
968
801
|
* Sends out request.
|
|
969
802
|
*
|
|
@@ -1023,8 +856,8 @@ class Credential {
|
|
|
1023
856
|
|
|
1024
857
|
// Copyright (c) Microsoft Corporation.
|
|
1025
858
|
/**
|
|
1026
|
-
* AnonymousCredential provides a
|
|
1027
|
-
*
|
|
859
|
+
* AnonymousCredential provides a credentialPolicyCreator member used to create
|
|
860
|
+
* AnonymousCredentialPolicy objects. AnonymousCredentialPolicy is used with
|
|
1028
861
|
* HTTP(S) requests that read public resources or for use with Shared Access
|
|
1029
862
|
* Signatures (SAS).
|
|
1030
863
|
*/
|
|
@@ -1041,30 +874,319 @@ class AnonymousCredential extends Credential {
|
|
|
1041
874
|
}
|
|
1042
875
|
|
|
1043
876
|
// Copyright (c) Microsoft Corporation.
|
|
877
|
+
// Licensed under the MIT license.
|
|
878
|
+
const SDK_VERSION = "12.13.0";
|
|
1044
879
|
/**
|
|
1045
|
-
*
|
|
880
|
+
* The OAuth scope to use with Azure Storage.
|
|
1046
881
|
*/
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
882
|
+
const StorageOAuthScopes = "https://storage.azure.com/.default";
|
|
883
|
+
const URLConstants = {
|
|
884
|
+
Parameters: {
|
|
885
|
+
FORCE_BROWSER_NO_CACHE: "_",
|
|
886
|
+
SIGNATURE: "sig",
|
|
887
|
+
SNAPSHOT: "snapshot",
|
|
888
|
+
VERSIONID: "versionid",
|
|
889
|
+
TIMEOUT: "timeout",
|
|
890
|
+
},
|
|
891
|
+
};
|
|
892
|
+
const HeaderConstants = {
|
|
893
|
+
AUTHORIZATION: "Authorization",
|
|
894
|
+
AUTHORIZATION_SCHEME: "Bearer",
|
|
895
|
+
CONTENT_ENCODING: "Content-Encoding",
|
|
896
|
+
CONTENT_ID: "Content-ID",
|
|
897
|
+
CONTENT_LANGUAGE: "Content-Language",
|
|
898
|
+
CONTENT_LENGTH: "Content-Length",
|
|
899
|
+
CONTENT_MD5: "Content-Md5",
|
|
900
|
+
CONTENT_TRANSFER_ENCODING: "Content-Transfer-Encoding",
|
|
901
|
+
CONTENT_TYPE: "Content-Type",
|
|
902
|
+
COOKIE: "Cookie",
|
|
903
|
+
DATE: "date",
|
|
904
|
+
IF_MATCH: "if-match",
|
|
905
|
+
IF_MODIFIED_SINCE: "if-modified-since",
|
|
906
|
+
IF_NONE_MATCH: "if-none-match",
|
|
907
|
+
IF_UNMODIFIED_SINCE: "if-unmodified-since",
|
|
908
|
+
PREFIX_FOR_STORAGE: "x-ms-",
|
|
909
|
+
RANGE: "Range",
|
|
910
|
+
USER_AGENT: "User-Agent",
|
|
911
|
+
X_MS_CLIENT_REQUEST_ID: "x-ms-client-request-id",
|
|
912
|
+
X_MS_COPY_SOURCE: "x-ms-copy-source",
|
|
913
|
+
X_MS_DATE: "x-ms-date",
|
|
914
|
+
X_MS_ERROR_CODE: "x-ms-error-code",
|
|
915
|
+
X_MS_VERSION: "x-ms-version",
|
|
916
|
+
};
|
|
917
|
+
const StorageBlobLoggingAllowedHeaderNames = [
|
|
918
|
+
"Access-Control-Allow-Origin",
|
|
919
|
+
"Cache-Control",
|
|
920
|
+
"Content-Length",
|
|
921
|
+
"Content-Type",
|
|
922
|
+
"Date",
|
|
923
|
+
"Request-Id",
|
|
924
|
+
"traceparent",
|
|
925
|
+
"Transfer-Encoding",
|
|
926
|
+
"User-Agent",
|
|
927
|
+
"x-ms-client-request-id",
|
|
928
|
+
"x-ms-date",
|
|
929
|
+
"x-ms-error-code",
|
|
930
|
+
"x-ms-request-id",
|
|
931
|
+
"x-ms-return-client-request-id",
|
|
932
|
+
"x-ms-version",
|
|
933
|
+
"Accept-Ranges",
|
|
934
|
+
"Content-Disposition",
|
|
935
|
+
"Content-Encoding",
|
|
936
|
+
"Content-Language",
|
|
937
|
+
"Content-MD5",
|
|
938
|
+
"Content-Range",
|
|
939
|
+
"ETag",
|
|
940
|
+
"Last-Modified",
|
|
941
|
+
"Server",
|
|
942
|
+
"Vary",
|
|
943
|
+
"x-ms-content-crc64",
|
|
944
|
+
"x-ms-copy-action",
|
|
945
|
+
"x-ms-copy-completion-time",
|
|
946
|
+
"x-ms-copy-id",
|
|
947
|
+
"x-ms-copy-progress",
|
|
948
|
+
"x-ms-copy-status",
|
|
949
|
+
"x-ms-has-immutability-policy",
|
|
950
|
+
"x-ms-has-legal-hold",
|
|
951
|
+
"x-ms-lease-state",
|
|
952
|
+
"x-ms-lease-status",
|
|
953
|
+
"x-ms-range",
|
|
954
|
+
"x-ms-request-server-encrypted",
|
|
955
|
+
"x-ms-server-encrypted",
|
|
956
|
+
"x-ms-snapshot",
|
|
957
|
+
"x-ms-source-range",
|
|
958
|
+
"If-Match",
|
|
959
|
+
"If-Modified-Since",
|
|
960
|
+
"If-None-Match",
|
|
961
|
+
"If-Unmodified-Since",
|
|
962
|
+
"x-ms-access-tier",
|
|
963
|
+
"x-ms-access-tier-change-time",
|
|
964
|
+
"x-ms-access-tier-inferred",
|
|
965
|
+
"x-ms-account-kind",
|
|
966
|
+
"x-ms-archive-status",
|
|
967
|
+
"x-ms-blob-append-offset",
|
|
968
|
+
"x-ms-blob-cache-control",
|
|
969
|
+
"x-ms-blob-committed-block-count",
|
|
970
|
+
"x-ms-blob-condition-appendpos",
|
|
971
|
+
"x-ms-blob-condition-maxsize",
|
|
972
|
+
"x-ms-blob-content-disposition",
|
|
973
|
+
"x-ms-blob-content-encoding",
|
|
974
|
+
"x-ms-blob-content-language",
|
|
975
|
+
"x-ms-blob-content-length",
|
|
976
|
+
"x-ms-blob-content-md5",
|
|
977
|
+
"x-ms-blob-content-type",
|
|
978
|
+
"x-ms-blob-public-access",
|
|
979
|
+
"x-ms-blob-sequence-number",
|
|
980
|
+
"x-ms-blob-type",
|
|
981
|
+
"x-ms-copy-destination-snapshot",
|
|
982
|
+
"x-ms-creation-time",
|
|
983
|
+
"x-ms-default-encryption-scope",
|
|
984
|
+
"x-ms-delete-snapshots",
|
|
985
|
+
"x-ms-delete-type-permanent",
|
|
986
|
+
"x-ms-deny-encryption-scope-override",
|
|
987
|
+
"x-ms-encryption-algorithm",
|
|
988
|
+
"x-ms-if-sequence-number-eq",
|
|
989
|
+
"x-ms-if-sequence-number-le",
|
|
990
|
+
"x-ms-if-sequence-number-lt",
|
|
991
|
+
"x-ms-incremental-copy",
|
|
992
|
+
"x-ms-lease-action",
|
|
993
|
+
"x-ms-lease-break-period",
|
|
994
|
+
"x-ms-lease-duration",
|
|
995
|
+
"x-ms-lease-id",
|
|
996
|
+
"x-ms-lease-time",
|
|
997
|
+
"x-ms-page-write",
|
|
998
|
+
"x-ms-proposed-lease-id",
|
|
999
|
+
"x-ms-range-get-content-md5",
|
|
1000
|
+
"x-ms-rehydrate-priority",
|
|
1001
|
+
"x-ms-sequence-number-action",
|
|
1002
|
+
"x-ms-sku-name",
|
|
1003
|
+
"x-ms-source-content-md5",
|
|
1004
|
+
"x-ms-source-if-match",
|
|
1005
|
+
"x-ms-source-if-modified-since",
|
|
1006
|
+
"x-ms-source-if-none-match",
|
|
1007
|
+
"x-ms-source-if-unmodified-since",
|
|
1008
|
+
"x-ms-tag-count",
|
|
1009
|
+
"x-ms-encryption-key-sha256",
|
|
1010
|
+
"x-ms-if-tags",
|
|
1011
|
+
"x-ms-source-if-tags",
|
|
1012
|
+
];
|
|
1013
|
+
const StorageBlobLoggingAllowedQueryParameters = [
|
|
1014
|
+
"comp",
|
|
1015
|
+
"maxresults",
|
|
1016
|
+
"rscc",
|
|
1017
|
+
"rscd",
|
|
1018
|
+
"rsce",
|
|
1019
|
+
"rscl",
|
|
1020
|
+
"rsct",
|
|
1021
|
+
"se",
|
|
1022
|
+
"si",
|
|
1023
|
+
"sip",
|
|
1024
|
+
"sp",
|
|
1025
|
+
"spr",
|
|
1026
|
+
"sr",
|
|
1027
|
+
"srt",
|
|
1028
|
+
"ss",
|
|
1029
|
+
"st",
|
|
1030
|
+
"sv",
|
|
1031
|
+
"include",
|
|
1032
|
+
"marker",
|
|
1033
|
+
"prefix",
|
|
1034
|
+
"copyid",
|
|
1035
|
+
"restype",
|
|
1036
|
+
"blockid",
|
|
1037
|
+
"blocklisttype",
|
|
1038
|
+
"delimiter",
|
|
1039
|
+
"prevsnapshot",
|
|
1040
|
+
"ske",
|
|
1041
|
+
"skoid",
|
|
1042
|
+
"sks",
|
|
1043
|
+
"skt",
|
|
1044
|
+
"sktid",
|
|
1045
|
+
"skv",
|
|
1046
|
+
"snapshot",
|
|
1047
|
+
];
|
|
1048
|
+
|
|
1049
|
+
// Copyright (c) Microsoft Corporation.
|
|
1050
|
+
/**
|
|
1051
|
+
* Set URL parameter name and value. If name exists in URL parameters, old value
|
|
1052
|
+
* will be replaced by name key. If not provide value, the parameter will be deleted.
|
|
1053
|
+
*
|
|
1054
|
+
* @param url - Source URL string
|
|
1055
|
+
* @param name - Parameter name
|
|
1056
|
+
* @param value - Parameter value
|
|
1057
|
+
* @returns An updated URL string
|
|
1058
|
+
*/
|
|
1059
|
+
function setURLParameter(url, name, value) {
|
|
1060
|
+
const urlParsed = new URL(url);
|
|
1061
|
+
const encodedName = encodeURIComponent(name);
|
|
1062
|
+
const encodedValue = value ? encodeURIComponent(value) : undefined;
|
|
1063
|
+
// mutating searchParams will change the encoding, so we have to do this ourselves
|
|
1064
|
+
const searchString = urlParsed.search === "" ? "?" : urlParsed.search;
|
|
1065
|
+
const searchPieces = [];
|
|
1066
|
+
for (const pair of searchString.slice(1).split("&")) {
|
|
1067
|
+
if (pair) {
|
|
1068
|
+
const [key] = pair.split("=", 2);
|
|
1069
|
+
if (key !== encodedName) {
|
|
1070
|
+
searchPieces.push(pair);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
if (encodedValue) {
|
|
1075
|
+
searchPieces.push(`${encodedName}=${encodedValue}`);
|
|
1076
|
+
}
|
|
1077
|
+
urlParsed.search = searchPieces.length ? `?${searchPieces.join("&")}` : "";
|
|
1078
|
+
return urlParsed.toString();
|
|
1079
|
+
}
|
|
1080
|
+
/**
|
|
1081
|
+
* Set URL host.
|
|
1082
|
+
*
|
|
1083
|
+
* @param url - Source URL string
|
|
1084
|
+
* @param host - New host string
|
|
1085
|
+
* @returns An updated URL string
|
|
1086
|
+
*/
|
|
1087
|
+
function setURLHost(url, host) {
|
|
1088
|
+
const urlParsed = new URL(url);
|
|
1089
|
+
urlParsed.hostname = host;
|
|
1090
|
+
return urlParsed.toString();
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Get URL path from an URL string.
|
|
1094
|
+
*
|
|
1095
|
+
* @param url - Source URL string
|
|
1096
|
+
*/
|
|
1097
|
+
function getURLPath(url) {
|
|
1098
|
+
try {
|
|
1099
|
+
const urlParsed = new URL(url);
|
|
1100
|
+
return urlParsed.pathname;
|
|
1101
|
+
}
|
|
1102
|
+
catch (e) {
|
|
1103
|
+
return undefined;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Get URL query key value pairs from an URL string.
|
|
1108
|
+
*
|
|
1109
|
+
* @param url -
|
|
1110
|
+
*/
|
|
1111
|
+
function getURLQueries(url) {
|
|
1112
|
+
let queryString = new URL(url).search;
|
|
1113
|
+
if (!queryString) {
|
|
1114
|
+
return {};
|
|
1115
|
+
}
|
|
1116
|
+
queryString = queryString.trim();
|
|
1117
|
+
queryString = queryString.startsWith("?") ? queryString.substring(1) : queryString;
|
|
1118
|
+
let querySubStrings = queryString.split("&");
|
|
1119
|
+
querySubStrings = querySubStrings.filter((value) => {
|
|
1120
|
+
const indexOfEqual = value.indexOf("=");
|
|
1121
|
+
const lastIndexOfEqual = value.lastIndexOf("=");
|
|
1122
|
+
return (indexOfEqual > 0 && indexOfEqual === lastIndexOfEqual && lastIndexOfEqual < value.length - 1);
|
|
1123
|
+
});
|
|
1124
|
+
const queries = {};
|
|
1125
|
+
for (const querySubString of querySubStrings) {
|
|
1126
|
+
const splitResults = querySubString.split("=");
|
|
1127
|
+
const key = splitResults[0];
|
|
1128
|
+
const value = splitResults[1];
|
|
1129
|
+
queries[key] = value;
|
|
1130
|
+
}
|
|
1131
|
+
return queries;
|
|
1132
|
+
}
|
|
1133
|
+
/**
|
|
1134
|
+
* Delay specified time interval.
|
|
1135
|
+
*
|
|
1136
|
+
* @param timeInMs -
|
|
1137
|
+
* @param aborter -
|
|
1138
|
+
* @param abortError -
|
|
1139
|
+
*/
|
|
1140
|
+
async function delay(timeInMs, aborter, abortError) {
|
|
1141
|
+
return new Promise((resolve, reject) => {
|
|
1142
|
+
/* eslint-disable-next-line prefer-const */
|
|
1143
|
+
let timeout;
|
|
1144
|
+
const abortHandler = () => {
|
|
1145
|
+
if (timeout !== undefined) {
|
|
1146
|
+
clearTimeout(timeout);
|
|
1147
|
+
}
|
|
1148
|
+
reject(abortError);
|
|
1149
|
+
};
|
|
1150
|
+
const resolveHandler = () => {
|
|
1151
|
+
if (aborter !== undefined) {
|
|
1152
|
+
aborter.removeEventListener("abort", abortHandler);
|
|
1153
|
+
}
|
|
1154
|
+
resolve();
|
|
1155
|
+
};
|
|
1156
|
+
timeout = setTimeout(resolveHandler, timeInMs);
|
|
1157
|
+
if (aborter !== undefined) {
|
|
1158
|
+
aborter.addEventListener("abort", abortHandler);
|
|
1159
|
+
}
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// Copyright (c) Microsoft Corporation.
|
|
1164
|
+
/**
|
|
1165
|
+
* StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key.
|
|
1166
|
+
*/
|
|
1167
|
+
class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
|
|
1168
|
+
/**
|
|
1169
|
+
* Creates an instance of StorageSharedKeyCredentialPolicy.
|
|
1170
|
+
* @param nextPolicy -
|
|
1171
|
+
* @param options -
|
|
1172
|
+
* @param factory -
|
|
1173
|
+
*/
|
|
1174
|
+
constructor(nextPolicy, options, factory) {
|
|
1175
|
+
super(nextPolicy, options);
|
|
1176
|
+
this.factory = factory;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Signs request.
|
|
1180
|
+
*
|
|
1181
|
+
* @param request -
|
|
1182
|
+
*/
|
|
1183
|
+
signRequest(request) {
|
|
1184
|
+
request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());
|
|
1185
|
+
if (request.body &&
|
|
1186
|
+
(typeof request.body === "string" || request.body !== undefined) &&
|
|
1187
|
+
request.body.length > 0) {
|
|
1188
|
+
request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
|
|
1189
|
+
}
|
|
1068
1190
|
const stringToSign = [
|
|
1069
1191
|
request.method.toUpperCase(),
|
|
1070
1192
|
this.getHeaderValueToSign(request, HeaderConstants.CONTENT_LANGUAGE),
|
|
@@ -1151,7 +1273,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
|
|
|
1151
1273
|
* @param request -
|
|
1152
1274
|
*/
|
|
1153
1275
|
getCanonicalizedResourceString(request) {
|
|
1154
|
-
const path =
|
|
1276
|
+
const path = getURLPath(request.url) || "/";
|
|
1155
1277
|
let canonicalizedResourceString = "";
|
|
1156
1278
|
canonicalizedResourceString += `/${this.factory.accountName}${path}`;
|
|
1157
1279
|
const queries = getURLQueries(request.url);
|
|
@@ -1192,7 +1314,7 @@ class StorageSharedKeyCredential extends Credential {
|
|
|
1192
1314
|
this.accountKey = Buffer.from(accountKey, "base64");
|
|
1193
1315
|
}
|
|
1194
1316
|
/**
|
|
1195
|
-
* Creates a
|
|
1317
|
+
* Creates a StorageSharedKeyCredentialPolicy object.
|
|
1196
1318
|
*
|
|
1197
1319
|
* @param nextPolicy -
|
|
1198
1320
|
* @param options -
|
|
@@ -1214,65 +1336,7 @@ class StorageSharedKeyCredential extends Credential {
|
|
|
1214
1336
|
/**
|
|
1215
1337
|
* The `@azure/logger` configuration for this package.
|
|
1216
1338
|
*/
|
|
1217
|
-
const logger = logger$
|
|
1218
|
-
|
|
1219
|
-
// Copyright (c) Microsoft Corporation.
|
|
1220
|
-
/**
|
|
1221
|
-
* StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:
|
|
1222
|
-
*
|
|
1223
|
-
* 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'.
|
|
1224
|
-
* StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL
|
|
1225
|
-
* thus avoid the browser cache.
|
|
1226
|
-
*
|
|
1227
|
-
* 2. Remove cookie header for security
|
|
1228
|
-
*
|
|
1229
|
-
* 3. Remove content-length header to avoid browsers warning
|
|
1230
|
-
*/
|
|
1231
|
-
class StorageBrowserPolicy extends coreHttp.BaseRequestPolicy {
|
|
1232
|
-
/**
|
|
1233
|
-
* Creates an instance of StorageBrowserPolicy.
|
|
1234
|
-
* @param nextPolicy -
|
|
1235
|
-
* @param options -
|
|
1236
|
-
*/
|
|
1237
|
-
// The base class has a protected constructor. Adding a public one to enable constructing of this class.
|
|
1238
|
-
/* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/
|
|
1239
|
-
constructor(nextPolicy, options) {
|
|
1240
|
-
super(nextPolicy, options);
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Sends out request.
|
|
1244
|
-
*
|
|
1245
|
-
* @param request -
|
|
1246
|
-
*/
|
|
1247
|
-
async sendRequest(request) {
|
|
1248
|
-
if (coreHttp.isNode) {
|
|
1249
|
-
return this._nextPolicy.sendRequest(request);
|
|
1250
|
-
}
|
|
1251
|
-
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
|
|
1252
|
-
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
|
|
1253
|
-
}
|
|
1254
|
-
request.headers.remove(HeaderConstants.COOKIE);
|
|
1255
|
-
// According to XHR standards, content-length should be fully controlled by browsers
|
|
1256
|
-
request.headers.remove(HeaderConstants.CONTENT_LENGTH);
|
|
1257
|
-
return this._nextPolicy.sendRequest(request);
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
// Copyright (c) Microsoft Corporation.
|
|
1262
|
-
/**
|
|
1263
|
-
* StorageBrowserPolicyFactory is a factory class helping generating {@link StorageBrowserPolicy} objects.
|
|
1264
|
-
*/
|
|
1265
|
-
class StorageBrowserPolicyFactory {
|
|
1266
|
-
/**
|
|
1267
|
-
* Creates a StorageBrowserPolicyFactory object.
|
|
1268
|
-
*
|
|
1269
|
-
* @param nextPolicy -
|
|
1270
|
-
* @param options -
|
|
1271
|
-
*/
|
|
1272
|
-
create(nextPolicy, options) {
|
|
1273
|
-
return new StorageBrowserPolicy(nextPolicy, options);
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1339
|
+
const logger$1 = logger$2.createClientLogger("storage-blob");
|
|
1276
1340
|
|
|
1277
1341
|
// Copyright (c) Microsoft Corporation.
|
|
1278
1342
|
/**
|
|
@@ -1290,19 +1354,19 @@ exports.StorageRetryPolicyType = void 0;
|
|
|
1290
1354
|
StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED";
|
|
1291
1355
|
})(exports.StorageRetryPolicyType || (exports.StorageRetryPolicyType = {}));
|
|
1292
1356
|
// Default values of StorageRetryOptions
|
|
1293
|
-
const DEFAULT_RETRY_OPTIONS = {
|
|
1357
|
+
const DEFAULT_RETRY_OPTIONS$1 = {
|
|
1294
1358
|
maxRetryDelayInMs: 120 * 1000,
|
|
1295
1359
|
maxTries: 4,
|
|
1296
1360
|
retryDelayInMs: 4 * 1000,
|
|
1297
1361
|
retryPolicyType: exports.StorageRetryPolicyType.EXPONENTIAL,
|
|
1298
1362
|
secondaryHost: "",
|
|
1299
|
-
tryTimeoutInMs:
|
|
1363
|
+
tryTimeoutInMs: undefined, // Use server side default timeout strategy
|
|
1300
1364
|
};
|
|
1301
|
-
const RETRY_ABORT_ERROR = new abortController.AbortError("The operation was aborted.");
|
|
1365
|
+
const RETRY_ABORT_ERROR$1 = new abortController.AbortError("The operation was aborted.");
|
|
1302
1366
|
/**
|
|
1303
1367
|
* Retry policy with exponential retry and linear retry implemented.
|
|
1304
1368
|
*/
|
|
1305
|
-
class StorageRetryPolicy extends
|
|
1369
|
+
class StorageRetryPolicy extends BaseRequestPolicy {
|
|
1306
1370
|
/**
|
|
1307
1371
|
* Creates an instance of RetryPolicy.
|
|
1308
1372
|
*
|
|
@@ -1310,30 +1374,30 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1310
1374
|
* @param options -
|
|
1311
1375
|
* @param retryOptions -
|
|
1312
1376
|
*/
|
|
1313
|
-
constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS) {
|
|
1377
|
+
constructor(nextPolicy, options, retryOptions = DEFAULT_RETRY_OPTIONS$1) {
|
|
1314
1378
|
super(nextPolicy, options);
|
|
1315
1379
|
// Initialize retry options
|
|
1316
1380
|
this.retryOptions = {
|
|
1317
1381
|
retryPolicyType: retryOptions.retryPolicyType
|
|
1318
1382
|
? retryOptions.retryPolicyType
|
|
1319
|
-
: DEFAULT_RETRY_OPTIONS.retryPolicyType,
|
|
1383
|
+
: DEFAULT_RETRY_OPTIONS$1.retryPolicyType,
|
|
1320
1384
|
maxTries: retryOptions.maxTries && retryOptions.maxTries >= 1
|
|
1321
1385
|
? Math.floor(retryOptions.maxTries)
|
|
1322
|
-
: DEFAULT_RETRY_OPTIONS.maxTries,
|
|
1386
|
+
: DEFAULT_RETRY_OPTIONS$1.maxTries,
|
|
1323
1387
|
tryTimeoutInMs: retryOptions.tryTimeoutInMs && retryOptions.tryTimeoutInMs >= 0
|
|
1324
1388
|
? retryOptions.tryTimeoutInMs
|
|
1325
|
-
: DEFAULT_RETRY_OPTIONS.tryTimeoutInMs,
|
|
1389
|
+
: DEFAULT_RETRY_OPTIONS$1.tryTimeoutInMs,
|
|
1326
1390
|
retryDelayInMs: retryOptions.retryDelayInMs && retryOptions.retryDelayInMs >= 0
|
|
1327
1391
|
? Math.min(retryOptions.retryDelayInMs, retryOptions.maxRetryDelayInMs
|
|
1328
1392
|
? retryOptions.maxRetryDelayInMs
|
|
1329
|
-
: DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs)
|
|
1330
|
-
: DEFAULT_RETRY_OPTIONS.retryDelayInMs,
|
|
1393
|
+
: DEFAULT_RETRY_OPTIONS$1.maxRetryDelayInMs)
|
|
1394
|
+
: DEFAULT_RETRY_OPTIONS$1.retryDelayInMs,
|
|
1331
1395
|
maxRetryDelayInMs: retryOptions.maxRetryDelayInMs && retryOptions.maxRetryDelayInMs >= 0
|
|
1332
1396
|
? retryOptions.maxRetryDelayInMs
|
|
1333
|
-
: DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs,
|
|
1397
|
+
: DEFAULT_RETRY_OPTIONS$1.maxRetryDelayInMs,
|
|
1334
1398
|
secondaryHost: retryOptions.secondaryHost
|
|
1335
1399
|
? retryOptions.secondaryHost
|
|
1336
|
-
: DEFAULT_RETRY_OPTIONS.secondaryHost,
|
|
1400
|
+
: DEFAULT_RETRY_OPTIONS$1.secondaryHost,
|
|
1337
1401
|
};
|
|
1338
1402
|
}
|
|
1339
1403
|
/**
|
|
@@ -1348,7 +1412,6 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1348
1412
|
* Decide and perform next retry. Won't mutate request parameter.
|
|
1349
1413
|
*
|
|
1350
1414
|
* @param request -
|
|
1351
|
-
* @param response -
|
|
1352
1415
|
* @param secondaryHas404 - If attempt was against the secondary & it returned a StatusNotFound (404), then
|
|
1353
1416
|
* the resource was not found. This may be due to replication delay. So, in this
|
|
1354
1417
|
* case, we'll never try the secondary again for this operation.
|
|
@@ -1365,10 +1428,12 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1365
1428
|
newRequest.url = setURLHost(newRequest.url, this.retryOptions.secondaryHost);
|
|
1366
1429
|
}
|
|
1367
1430
|
// Set the server-side timeout query parameter "timeout=[seconds]"
|
|
1368
|
-
|
|
1431
|
+
if (this.retryOptions.tryTimeoutInMs) {
|
|
1432
|
+
newRequest.url = setURLParameter(newRequest.url, URLConstants.Parameters.TIMEOUT, Math.floor(this.retryOptions.tryTimeoutInMs / 1000).toString());
|
|
1433
|
+
}
|
|
1369
1434
|
let response;
|
|
1370
1435
|
try {
|
|
1371
|
-
logger.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`);
|
|
1436
|
+
logger$1.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`);
|
|
1372
1437
|
response = await this._nextPolicy.sendRequest(newRequest);
|
|
1373
1438
|
if (!this.shouldRetry(isPrimaryRetry, attempt, response)) {
|
|
1374
1439
|
return response;
|
|
@@ -1376,7 +1441,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1376
1441
|
secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);
|
|
1377
1442
|
}
|
|
1378
1443
|
catch (err) {
|
|
1379
|
-
logger.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);
|
|
1444
|
+
logger$1.error(`RetryPolicy: Caught error, message: ${err.message}, code: ${err.code}`);
|
|
1380
1445
|
if (!this.shouldRetry(isPrimaryRetry, attempt, response, err)) {
|
|
1381
1446
|
throw err;
|
|
1382
1447
|
}
|
|
@@ -1394,7 +1459,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1394
1459
|
*/
|
|
1395
1460
|
shouldRetry(isPrimaryRetry, attempt, response, err) {
|
|
1396
1461
|
if (attempt >= this.retryOptions.maxTries) {
|
|
1397
|
-
logger.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions
|
|
1462
|
+
logger$1.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${this.retryOptions
|
|
1398
1463
|
.maxTries}, no further try.`);
|
|
1399
1464
|
return false;
|
|
1400
1465
|
}
|
|
@@ -1416,7 +1481,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1416
1481
|
if (err.name.toUpperCase().includes(retriableError) ||
|
|
1417
1482
|
err.message.toUpperCase().includes(retriableError) ||
|
|
1418
1483
|
(err.code && err.code.toString().toUpperCase() === retriableError)) {
|
|
1419
|
-
logger.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);
|
|
1484
|
+
logger$1.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);
|
|
1420
1485
|
return true;
|
|
1421
1486
|
}
|
|
1422
1487
|
}
|
|
@@ -1427,17 +1492,17 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1427
1492
|
if (response || err) {
|
|
1428
1493
|
const statusCode = response ? response.status : err ? err.statusCode : 0;
|
|
1429
1494
|
if (!isPrimaryRetry && statusCode === 404) {
|
|
1430
|
-
logger.info(`RetryPolicy: Secondary access with 404, will retry.`);
|
|
1495
|
+
logger$1.info(`RetryPolicy: Secondary access with 404, will retry.`);
|
|
1431
1496
|
return true;
|
|
1432
1497
|
}
|
|
1433
1498
|
// Server internal error or server timeout
|
|
1434
1499
|
if (statusCode === 503 || statusCode === 500) {
|
|
1435
|
-
logger.info(`RetryPolicy: Will retry for status code ${statusCode}.`);
|
|
1500
|
+
logger$1.info(`RetryPolicy: Will retry for status code ${statusCode}.`);
|
|
1436
1501
|
return true;
|
|
1437
1502
|
}
|
|
1438
1503
|
}
|
|
1439
1504
|
if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : err.message.startsWith(`Error "Error: Unclosed root tag`))) {
|
|
1440
|
-
logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
|
|
1505
|
+
logger$1.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
|
|
1441
1506
|
return true;
|
|
1442
1507
|
}
|
|
1443
1508
|
return false;
|
|
@@ -1461,51 +1526,380 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1461
1526
|
break;
|
|
1462
1527
|
}
|
|
1463
1528
|
}
|
|
1464
|
-
else {
|
|
1465
|
-
delayTimeInMs = Math.random() * 1000;
|
|
1466
|
-
}
|
|
1467
|
-
logger.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);
|
|
1468
|
-
return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR);
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
// Copyright (c) Microsoft Corporation.
|
|
1473
|
-
/**
|
|
1474
|
-
* StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects.
|
|
1475
|
-
*/
|
|
1476
|
-
class StorageRetryPolicyFactory {
|
|
1477
|
-
/**
|
|
1478
|
-
* Creates an instance of StorageRetryPolicyFactory.
|
|
1479
|
-
* @param retryOptions -
|
|
1480
|
-
*/
|
|
1481
|
-
constructor(retryOptions) {
|
|
1482
|
-
this.retryOptions = retryOptions;
|
|
1483
|
-
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Creates a
|
|
1486
|
-
*
|
|
1487
|
-
* @param nextPolicy -
|
|
1488
|
-
* @param options -
|
|
1489
|
-
*/
|
|
1490
|
-
create(nextPolicy, options) {
|
|
1491
|
-
return new StorageRetryPolicy(nextPolicy, options, this.retryOptions);
|
|
1529
|
+
else {
|
|
1530
|
+
delayTimeInMs = Math.random() * 1000;
|
|
1531
|
+
}
|
|
1532
|
+
logger$1.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);
|
|
1533
|
+
return delay(delayTimeInMs, abortSignal, RETRY_ABORT_ERROR$1);
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
// Copyright (c) Microsoft Corporation.
|
|
1538
|
+
/**
|
|
1539
|
+
* StorageRetryPolicyFactory is a factory class helping generating {@link StorageRetryPolicy} objects.
|
|
1540
|
+
*/
|
|
1541
|
+
class StorageRetryPolicyFactory {
|
|
1542
|
+
/**
|
|
1543
|
+
* Creates an instance of StorageRetryPolicyFactory.
|
|
1544
|
+
* @param retryOptions -
|
|
1545
|
+
*/
|
|
1546
|
+
constructor(retryOptions) {
|
|
1547
|
+
this.retryOptions = retryOptions;
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Creates a StorageRetryPolicy object.
|
|
1551
|
+
*
|
|
1552
|
+
* @param nextPolicy -
|
|
1553
|
+
* @param options -
|
|
1554
|
+
*/
|
|
1555
|
+
create(nextPolicy, options) {
|
|
1556
|
+
return new StorageRetryPolicy(nextPolicy, options, this.retryOptions);
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
// Copyright (c) Microsoft Corporation.
|
|
1561
|
+
let _defaultHttpClient;
|
|
1562
|
+
function getCachedDefaultHttpClient() {
|
|
1563
|
+
if (!_defaultHttpClient) {
|
|
1564
|
+
_defaultHttpClient = coreRestPipeline.createDefaultHttpClient();
|
|
1565
|
+
}
|
|
1566
|
+
return _defaultHttpClient;
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
// Copyright (c) Microsoft Corporation.
|
|
1570
|
+
/**
|
|
1571
|
+
* The programmatic identifier of the StorageBrowserPolicy.
|
|
1572
|
+
*/
|
|
1573
|
+
const storageBrowserPolicyName = "storageBrowserPolicy";
|
|
1574
|
+
/**
|
|
1575
|
+
* storageBrowserPolicy is a policy used to prevent browsers from caching requests
|
|
1576
|
+
* and to remove cookies and explicit content-length headers.
|
|
1577
|
+
*/
|
|
1578
|
+
function storageBrowserPolicy() {
|
|
1579
|
+
return {
|
|
1580
|
+
name: storageBrowserPolicyName,
|
|
1581
|
+
async sendRequest(request, next) {
|
|
1582
|
+
if (coreUtil.isNode) {
|
|
1583
|
+
return next(request);
|
|
1584
|
+
}
|
|
1585
|
+
if (request.method === "GET" || request.method === "HEAD") {
|
|
1586
|
+
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
|
|
1587
|
+
}
|
|
1588
|
+
request.headers.delete(HeaderConstants.COOKIE);
|
|
1589
|
+
// According to XHR standards, content-length should be fully controlled by browsers
|
|
1590
|
+
request.headers.delete(HeaderConstants.CONTENT_LENGTH);
|
|
1591
|
+
return next(request);
|
|
1592
|
+
},
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1596
|
+
// Copyright (c) Microsoft Corporation.
|
|
1597
|
+
/**
|
|
1598
|
+
* Name of the {@link storageRetryPolicy}
|
|
1599
|
+
*/
|
|
1600
|
+
const storageRetryPolicyName = "storageRetryPolicy";
|
|
1601
|
+
/**
|
|
1602
|
+
* RetryPolicy types.
|
|
1603
|
+
*/
|
|
1604
|
+
var StorageRetryPolicyType;
|
|
1605
|
+
(function (StorageRetryPolicyType) {
|
|
1606
|
+
/**
|
|
1607
|
+
* Exponential retry. Retry time delay grows exponentially.
|
|
1608
|
+
*/
|
|
1609
|
+
StorageRetryPolicyType[StorageRetryPolicyType["EXPONENTIAL"] = 0] = "EXPONENTIAL";
|
|
1610
|
+
/**
|
|
1611
|
+
* Linear retry. Retry time delay grows linearly.
|
|
1612
|
+
*/
|
|
1613
|
+
StorageRetryPolicyType[StorageRetryPolicyType["FIXED"] = 1] = "FIXED";
|
|
1614
|
+
})(StorageRetryPolicyType || (StorageRetryPolicyType = {}));
|
|
1615
|
+
// Default values of StorageRetryOptions
|
|
1616
|
+
const DEFAULT_RETRY_OPTIONS = {
|
|
1617
|
+
maxRetryDelayInMs: 120 * 1000,
|
|
1618
|
+
maxTries: 4,
|
|
1619
|
+
retryDelayInMs: 4 * 1000,
|
|
1620
|
+
retryPolicyType: StorageRetryPolicyType.EXPONENTIAL,
|
|
1621
|
+
secondaryHost: "",
|
|
1622
|
+
tryTimeoutInMs: undefined, // Use server side default timeout strategy
|
|
1623
|
+
};
|
|
1624
|
+
const retriableErrors = [
|
|
1625
|
+
"ETIMEDOUT",
|
|
1626
|
+
"ESOCKETTIMEDOUT",
|
|
1627
|
+
"ECONNREFUSED",
|
|
1628
|
+
"ECONNRESET",
|
|
1629
|
+
"ENOENT",
|
|
1630
|
+
"ENOTFOUND",
|
|
1631
|
+
"TIMEOUT",
|
|
1632
|
+
"EPIPE",
|
|
1633
|
+
"REQUEST_SEND_ERROR",
|
|
1634
|
+
];
|
|
1635
|
+
const RETRY_ABORT_ERROR = new abortController.AbortError("The operation was aborted.");
|
|
1636
|
+
/**
|
|
1637
|
+
* Retry policy with exponential retry and linear retry implemented.
|
|
1638
|
+
*/
|
|
1639
|
+
function storageRetryPolicy(options = {}) {
|
|
1640
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1641
|
+
const retryPolicyType = (_a = options.retryPolicyType) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_OPTIONS.retryPolicyType;
|
|
1642
|
+
const maxTries = (_b = options.maxTries) !== null && _b !== void 0 ? _b : DEFAULT_RETRY_OPTIONS.maxTries;
|
|
1643
|
+
const retryDelayInMs = (_c = options.retryDelayInMs) !== null && _c !== void 0 ? _c : DEFAULT_RETRY_OPTIONS.retryDelayInMs;
|
|
1644
|
+
const maxRetryDelayInMs = (_d = options.maxRetryDelayInMs) !== null && _d !== void 0 ? _d : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs;
|
|
1645
|
+
const secondaryHost = (_e = options.secondaryHost) !== null && _e !== void 0 ? _e : DEFAULT_RETRY_OPTIONS.secondaryHost;
|
|
1646
|
+
const tryTimeoutInMs = (_f = options.tryTimeoutInMs) !== null && _f !== void 0 ? _f : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs;
|
|
1647
|
+
function shouldRetry({ isPrimaryRetry, attempt, response, error, }) {
|
|
1648
|
+
var _a, _b;
|
|
1649
|
+
if (attempt >= maxTries) {
|
|
1650
|
+
logger$1.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`);
|
|
1651
|
+
return false;
|
|
1652
|
+
}
|
|
1653
|
+
if (error) {
|
|
1654
|
+
for (const retriableError of retriableErrors) {
|
|
1655
|
+
if (error.name.toUpperCase().includes(retriableError) ||
|
|
1656
|
+
error.message.toUpperCase().includes(retriableError) ||
|
|
1657
|
+
(error.code && error.code.toString().toUpperCase() === retriableError)) {
|
|
1658
|
+
logger$1.info(`RetryPolicy: Network error ${retriableError} found, will retry.`);
|
|
1659
|
+
return true;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if ((error === null || error === void 0 ? void 0 : error.code) === "PARSE_ERROR" &&
|
|
1663
|
+
(error === null || error === void 0 ? void 0 : error.message.startsWith(`Error "Error: Unclosed root tag`))) {
|
|
1664
|
+
logger$1.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
|
|
1665
|
+
return true;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
// If attempt was against the secondary & it returned a StatusNotFound (404), then
|
|
1669
|
+
// the resource was not found. This may be due to replication delay. So, in this
|
|
1670
|
+
// case, we'll never try the secondary again for this operation.
|
|
1671
|
+
if (response || error) {
|
|
1672
|
+
const statusCode = (_b = (_a = response === null || response === void 0 ? void 0 : response.status) !== null && _a !== void 0 ? _a : error === null || error === void 0 ? void 0 : error.statusCode) !== null && _b !== void 0 ? _b : 0;
|
|
1673
|
+
if (!isPrimaryRetry && statusCode === 404) {
|
|
1674
|
+
logger$1.info(`RetryPolicy: Secondary access with 404, will retry.`);
|
|
1675
|
+
return true;
|
|
1676
|
+
}
|
|
1677
|
+
// Server internal error or server timeout
|
|
1678
|
+
if (statusCode === 503 || statusCode === 500) {
|
|
1679
|
+
logger$1.info(`RetryPolicy: Will retry for status code ${statusCode}.`);
|
|
1680
|
+
return true;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
return false;
|
|
1684
|
+
}
|
|
1685
|
+
function calculateDelay(isPrimaryRetry, attempt) {
|
|
1686
|
+
let delayTimeInMs = 0;
|
|
1687
|
+
if (isPrimaryRetry) {
|
|
1688
|
+
switch (retryPolicyType) {
|
|
1689
|
+
case StorageRetryPolicyType.EXPONENTIAL:
|
|
1690
|
+
delayTimeInMs = Math.min((Math.pow(2, attempt - 1) - 1) * retryDelayInMs, maxRetryDelayInMs);
|
|
1691
|
+
break;
|
|
1692
|
+
case StorageRetryPolicyType.FIXED:
|
|
1693
|
+
delayTimeInMs = retryDelayInMs;
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
else {
|
|
1698
|
+
delayTimeInMs = Math.random() * 1000;
|
|
1699
|
+
}
|
|
1700
|
+
logger$1.info(`RetryPolicy: Delay for ${delayTimeInMs}ms`);
|
|
1701
|
+
return delayTimeInMs;
|
|
1702
|
+
}
|
|
1703
|
+
return {
|
|
1704
|
+
name: storageRetryPolicyName,
|
|
1705
|
+
async sendRequest(request, next) {
|
|
1706
|
+
// Set the server-side timeout query parameter "timeout=[seconds]"
|
|
1707
|
+
if (tryTimeoutInMs) {
|
|
1708
|
+
request.url = setURLParameter(request.url, URLConstants.Parameters.TIMEOUT, String(Math.floor(tryTimeoutInMs / 1000)));
|
|
1709
|
+
}
|
|
1710
|
+
const primaryUrl = request.url;
|
|
1711
|
+
const secondaryUrl = secondaryHost ? setURLHost(request.url, secondaryHost) : undefined;
|
|
1712
|
+
let secondaryHas404 = false;
|
|
1713
|
+
let attempt = 1;
|
|
1714
|
+
let retryAgain = true;
|
|
1715
|
+
let response;
|
|
1716
|
+
let error;
|
|
1717
|
+
while (retryAgain) {
|
|
1718
|
+
const isPrimaryRetry = secondaryHas404 ||
|
|
1719
|
+
!secondaryUrl ||
|
|
1720
|
+
!["GET", "HEAD", "OPTIONS"].includes(request.method) ||
|
|
1721
|
+
attempt % 2 === 1;
|
|
1722
|
+
request.url = isPrimaryRetry ? primaryUrl : secondaryUrl;
|
|
1723
|
+
response = undefined;
|
|
1724
|
+
error = undefined;
|
|
1725
|
+
try {
|
|
1726
|
+
logger$1.info(`RetryPolicy: =====> Try=${attempt} ${isPrimaryRetry ? "Primary" : "Secondary"}`);
|
|
1727
|
+
response = await next(request);
|
|
1728
|
+
secondaryHas404 = secondaryHas404 || (!isPrimaryRetry && response.status === 404);
|
|
1729
|
+
}
|
|
1730
|
+
catch (e) {
|
|
1731
|
+
if (coreRestPipeline.isRestError(e)) {
|
|
1732
|
+
logger$1.error(`RetryPolicy: Caught error, message: ${e.message}, code: ${e.code}`);
|
|
1733
|
+
error = e;
|
|
1734
|
+
}
|
|
1735
|
+
else {
|
|
1736
|
+
logger$1.error(`RetryPolicy: Caught error, message: ${coreUtil.getErrorMessage(e)}`);
|
|
1737
|
+
throw e;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
retryAgain = shouldRetry({ isPrimaryRetry, attempt, response, error });
|
|
1741
|
+
if (retryAgain) {
|
|
1742
|
+
await delay(calculateDelay(isPrimaryRetry, attempt), request.abortSignal, RETRY_ABORT_ERROR);
|
|
1743
|
+
}
|
|
1744
|
+
attempt++;
|
|
1745
|
+
}
|
|
1746
|
+
if (response) {
|
|
1747
|
+
return response;
|
|
1748
|
+
}
|
|
1749
|
+
throw error !== null && error !== void 0 ? error : new coreRestPipeline.RestError("RetryPolicy failed without known error.");
|
|
1750
|
+
},
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
// Copyright (c) Microsoft Corporation.
|
|
1755
|
+
/**
|
|
1756
|
+
* The programmatic identifier of the storageSharedKeyCredentialPolicy.
|
|
1757
|
+
*/
|
|
1758
|
+
const storageSharedKeyCredentialPolicyName = "storageSharedKeyCredentialPolicy";
|
|
1759
|
+
/**
|
|
1760
|
+
* storageSharedKeyCredentialPolicy handles signing requests using storage account keys.
|
|
1761
|
+
*/
|
|
1762
|
+
function storageSharedKeyCredentialPolicy(options) {
|
|
1763
|
+
function signRequest(request) {
|
|
1764
|
+
request.headers.set(HeaderConstants.X_MS_DATE, new Date().toUTCString());
|
|
1765
|
+
if (request.body &&
|
|
1766
|
+
(typeof request.body === "string" || Buffer.isBuffer(request.body)) &&
|
|
1767
|
+
request.body.length > 0) {
|
|
1768
|
+
request.headers.set(HeaderConstants.CONTENT_LENGTH, Buffer.byteLength(request.body));
|
|
1769
|
+
}
|
|
1770
|
+
const stringToSign = [
|
|
1771
|
+
request.method.toUpperCase(),
|
|
1772
|
+
getHeaderValueToSign(request, HeaderConstants.CONTENT_LANGUAGE),
|
|
1773
|
+
getHeaderValueToSign(request, HeaderConstants.CONTENT_ENCODING),
|
|
1774
|
+
getHeaderValueToSign(request, HeaderConstants.CONTENT_LENGTH),
|
|
1775
|
+
getHeaderValueToSign(request, HeaderConstants.CONTENT_MD5),
|
|
1776
|
+
getHeaderValueToSign(request, HeaderConstants.CONTENT_TYPE),
|
|
1777
|
+
getHeaderValueToSign(request, HeaderConstants.DATE),
|
|
1778
|
+
getHeaderValueToSign(request, HeaderConstants.IF_MODIFIED_SINCE),
|
|
1779
|
+
getHeaderValueToSign(request, HeaderConstants.IF_MATCH),
|
|
1780
|
+
getHeaderValueToSign(request, HeaderConstants.IF_NONE_MATCH),
|
|
1781
|
+
getHeaderValueToSign(request, HeaderConstants.IF_UNMODIFIED_SINCE),
|
|
1782
|
+
getHeaderValueToSign(request, HeaderConstants.RANGE),
|
|
1783
|
+
].join("\n") +
|
|
1784
|
+
"\n" +
|
|
1785
|
+
getCanonicalizedHeadersString(request) +
|
|
1786
|
+
getCanonicalizedResourceString(request);
|
|
1787
|
+
const signature = crypto.createHmac("sha256", options.accountKey)
|
|
1788
|
+
.update(stringToSign, "utf8")
|
|
1789
|
+
.digest("base64");
|
|
1790
|
+
request.headers.set(HeaderConstants.AUTHORIZATION, `SharedKey ${options.accountName}:${signature}`);
|
|
1791
|
+
// console.log(`[URL]:${request.url}`);
|
|
1792
|
+
// console.log(`[HEADERS]:${request.headers.toString()}`);
|
|
1793
|
+
// console.log(`[STRING TO SIGN]:${JSON.stringify(stringToSign)}`);
|
|
1794
|
+
// console.log(`[KEY]: ${request.headers.get(HeaderConstants.AUTHORIZATION)}`);
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Retrieve header value according to shared key sign rules.
|
|
1798
|
+
* @see https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
|
|
1799
|
+
*/
|
|
1800
|
+
function getHeaderValueToSign(request, headerName) {
|
|
1801
|
+
const value = request.headers.get(headerName);
|
|
1802
|
+
if (!value) {
|
|
1803
|
+
return "";
|
|
1804
|
+
}
|
|
1805
|
+
// When using version 2015-02-21 or later, if Content-Length is zero, then
|
|
1806
|
+
// set the Content-Length part of the StringToSign to an empty string.
|
|
1807
|
+
// https://docs.microsoft.com/en-us/rest/api/storageservices/authenticate-with-shared-key
|
|
1808
|
+
if (headerName === HeaderConstants.CONTENT_LENGTH && value === "0") {
|
|
1809
|
+
return "";
|
|
1810
|
+
}
|
|
1811
|
+
return value;
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* To construct the CanonicalizedHeaders portion of the signature string, follow these steps:
|
|
1815
|
+
* 1. Retrieve all headers for the resource that begin with x-ms-, including the x-ms-date header.
|
|
1816
|
+
* 2. Convert each HTTP header name to lowercase.
|
|
1817
|
+
* 3. Sort the headers lexicographically by header name, in ascending order.
|
|
1818
|
+
* Each header may appear only once in the string.
|
|
1819
|
+
* 4. Replace any linear whitespace in the header value with a single space.
|
|
1820
|
+
* 5. Trim any whitespace around the colon in the header.
|
|
1821
|
+
* 6. Finally, append a new-line character to each canonicalized header in the resulting list.
|
|
1822
|
+
* Construct the CanonicalizedHeaders string by concatenating all headers in this list into a single string.
|
|
1823
|
+
*
|
|
1824
|
+
*/
|
|
1825
|
+
function getCanonicalizedHeadersString(request) {
|
|
1826
|
+
let headersArray = [];
|
|
1827
|
+
for (const [name, value] of request.headers) {
|
|
1828
|
+
if (name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE)) {
|
|
1829
|
+
headersArray.push({ name, value });
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
headersArray.sort((a, b) => {
|
|
1833
|
+
return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
|
|
1834
|
+
});
|
|
1835
|
+
// Remove duplicate headers
|
|
1836
|
+
headersArray = headersArray.filter((value, index, array) => {
|
|
1837
|
+
if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
return true;
|
|
1841
|
+
});
|
|
1842
|
+
let canonicalizedHeadersStringToSign = "";
|
|
1843
|
+
headersArray.forEach((header) => {
|
|
1844
|
+
canonicalizedHeadersStringToSign += `${header.name
|
|
1845
|
+
.toLowerCase()
|
|
1846
|
+
.trimRight()}:${header.value.trimLeft()}\n`;
|
|
1847
|
+
});
|
|
1848
|
+
return canonicalizedHeadersStringToSign;
|
|
1849
|
+
}
|
|
1850
|
+
function getCanonicalizedResourceString(request) {
|
|
1851
|
+
const path = getURLPath(request.url) || "/";
|
|
1852
|
+
let canonicalizedResourceString = "";
|
|
1853
|
+
canonicalizedResourceString += `/${options.accountName}${path}`;
|
|
1854
|
+
const queries = getURLQueries(request.url);
|
|
1855
|
+
const lowercaseQueries = {};
|
|
1856
|
+
if (queries) {
|
|
1857
|
+
const queryKeys = [];
|
|
1858
|
+
for (const key in queries) {
|
|
1859
|
+
if (Object.prototype.hasOwnProperty.call(queries, key)) {
|
|
1860
|
+
const lowercaseKey = key.toLowerCase();
|
|
1861
|
+
lowercaseQueries[lowercaseKey] = queries[key];
|
|
1862
|
+
queryKeys.push(lowercaseKey);
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
queryKeys.sort();
|
|
1866
|
+
for (const key of queryKeys) {
|
|
1867
|
+
canonicalizedResourceString += `\n${key}:${decodeURIComponent(lowercaseQueries[key])}`;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return canonicalizedResourceString;
|
|
1492
1871
|
}
|
|
1872
|
+
return {
|
|
1873
|
+
name: storageSharedKeyCredentialPolicyName,
|
|
1874
|
+
async sendRequest(request, next) {
|
|
1875
|
+
signRequest(request);
|
|
1876
|
+
return next(request);
|
|
1877
|
+
},
|
|
1878
|
+
};
|
|
1493
1879
|
}
|
|
1494
1880
|
|
|
1495
1881
|
// Copyright (c) Microsoft Corporation.
|
|
1496
1882
|
/**
|
|
1497
|
-
*
|
|
1883
|
+
* StorageBrowserPolicy will handle differences between Node.js and browser runtime, including:
|
|
1884
|
+
*
|
|
1885
|
+
* 1. Browsers cache GET/HEAD requests by adding conditional headers such as 'IF_MODIFIED_SINCE'.
|
|
1886
|
+
* StorageBrowserPolicy is a policy used to add a timestamp query to GET/HEAD request URL
|
|
1887
|
+
* thus avoid the browser cache.
|
|
1888
|
+
*
|
|
1889
|
+
* 2. Remove cookie header for security
|
|
1890
|
+
*
|
|
1891
|
+
* 3. Remove content-length header to avoid browsers warning
|
|
1498
1892
|
*/
|
|
1499
|
-
class
|
|
1893
|
+
class StorageBrowserPolicy extends BaseRequestPolicy {
|
|
1500
1894
|
/**
|
|
1501
|
-
* Creates an instance of
|
|
1895
|
+
* Creates an instance of StorageBrowserPolicy.
|
|
1502
1896
|
* @param nextPolicy -
|
|
1503
1897
|
* @param options -
|
|
1504
|
-
* @param telemetry -
|
|
1505
1898
|
*/
|
|
1506
|
-
constructor
|
|
1899
|
+
// The base class has a protected constructor. Adding a public one to enable constructing of this class.
|
|
1900
|
+
/* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/
|
|
1901
|
+
constructor(nextPolicy, options) {
|
|
1507
1902
|
super(nextPolicy, options);
|
|
1508
|
-
this.telemetry = telemetry;
|
|
1509
1903
|
}
|
|
1510
1904
|
/**
|
|
1511
1905
|
* Sends out request.
|
|
@@ -1513,76 +1907,57 @@ class TelemetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
|
1513
1907
|
* @param request -
|
|
1514
1908
|
*/
|
|
1515
1909
|
async sendRequest(request) {
|
|
1516
|
-
if (
|
|
1517
|
-
|
|
1518
|
-
request.headers = new coreHttp.HttpHeaders();
|
|
1519
|
-
}
|
|
1520
|
-
if (!request.headers.get(HeaderConstants.USER_AGENT)) {
|
|
1521
|
-
request.headers.set(HeaderConstants.USER_AGENT, this.telemetry);
|
|
1522
|
-
}
|
|
1910
|
+
if (coreUtil.isNode) {
|
|
1911
|
+
return this._nextPolicy.sendRequest(request);
|
|
1523
1912
|
}
|
|
1913
|
+
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
|
|
1914
|
+
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
|
|
1915
|
+
}
|
|
1916
|
+
request.headers.remove(HeaderConstants.COOKIE);
|
|
1917
|
+
// According to XHR standards, content-length should be fully controlled by browsers
|
|
1918
|
+
request.headers.remove(HeaderConstants.CONTENT_LENGTH);
|
|
1524
1919
|
return this._nextPolicy.sendRequest(request);
|
|
1525
1920
|
}
|
|
1526
1921
|
}
|
|
1527
1922
|
|
|
1528
1923
|
// Copyright (c) Microsoft Corporation.
|
|
1529
1924
|
/**
|
|
1530
|
-
*
|
|
1925
|
+
* StorageBrowserPolicyFactory is a factory class helping generating StorageBrowserPolicy objects.
|
|
1531
1926
|
*/
|
|
1532
|
-
class
|
|
1533
|
-
/**
|
|
1534
|
-
* Creates an instance of TelemetryPolicyFactory.
|
|
1535
|
-
* @param telemetry -
|
|
1536
|
-
*/
|
|
1537
|
-
constructor(telemetry) {
|
|
1538
|
-
const userAgentInfo = [];
|
|
1539
|
-
if (coreHttp.isNode) {
|
|
1540
|
-
if (telemetry) {
|
|
1541
|
-
const telemetryString = telemetry.userAgentPrefix || "";
|
|
1542
|
-
if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) {
|
|
1543
|
-
userAgentInfo.push(telemetryString);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
// e.g. azsdk-js-storagequeue/11.0.0
|
|
1547
|
-
const libInfo = `azsdk-js-storagequeue/${SDK_VERSION}`;
|
|
1548
|
-
if (userAgentInfo.indexOf(libInfo) === -1) {
|
|
1549
|
-
userAgentInfo.push(libInfo);
|
|
1550
|
-
}
|
|
1551
|
-
// e.g. (NODE-VERSION 4.9.1; Windows_NT 10.0.16299)
|
|
1552
|
-
let runtimeInfo = `(NODE-VERSION ${process.version})`;
|
|
1553
|
-
if (os__namespace) {
|
|
1554
|
-
runtimeInfo = `(NODE-VERSION ${process.version}; ${os__namespace.type()} ${os__namespace.release()})`;
|
|
1555
|
-
}
|
|
1556
|
-
if (userAgentInfo.indexOf(runtimeInfo) === -1) {
|
|
1557
|
-
userAgentInfo.push(runtimeInfo);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
this.telemetryString = userAgentInfo.join(" ");
|
|
1561
|
-
}
|
|
1927
|
+
class StorageBrowserPolicyFactory {
|
|
1562
1928
|
/**
|
|
1563
|
-
* Creates a
|
|
1929
|
+
* Creates a StorageBrowserPolicyFactory object.
|
|
1564
1930
|
*
|
|
1565
1931
|
* @param nextPolicy -
|
|
1566
1932
|
* @param options -
|
|
1567
1933
|
*/
|
|
1568
1934
|
create(nextPolicy, options) {
|
|
1569
|
-
return new
|
|
1935
|
+
return new StorageBrowserPolicy(nextPolicy, options);
|
|
1570
1936
|
}
|
|
1571
1937
|
}
|
|
1572
1938
|
|
|
1573
1939
|
// Copyright (c) Microsoft Corporation.
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1940
|
+
/**
|
|
1941
|
+
* A helper to decide if a given argument satisfies the Pipeline contract
|
|
1942
|
+
* @param pipeline - An argument that may be a Pipeline
|
|
1943
|
+
* @returns true when the argument satisfies the Pipeline contract
|
|
1944
|
+
*/
|
|
1945
|
+
function isPipelineLike(pipeline) {
|
|
1946
|
+
if (!pipeline || typeof pipeline !== "object") {
|
|
1947
|
+
return false;
|
|
1948
|
+
}
|
|
1949
|
+
const castPipeline = pipeline;
|
|
1950
|
+
return (Array.isArray(castPipeline.factories) &&
|
|
1951
|
+
typeof castPipeline.options === "object" &&
|
|
1952
|
+
typeof castPipeline.toServiceClientOptions === "function");
|
|
1577
1953
|
}
|
|
1578
|
-
|
|
1579
|
-
// Copyright (c) Microsoft Corporation.
|
|
1580
1954
|
/**
|
|
1581
1955
|
* A Pipeline class containing HTTP request policies.
|
|
1582
|
-
* You can create a default Pipeline by calling newPipeline
|
|
1956
|
+
* You can create a default Pipeline by calling {@link newPipeline}.
|
|
1583
1957
|
* Or you can create a Pipeline with your own policies by the constructor of Pipeline.
|
|
1584
|
-
*
|
|
1585
|
-
* implementing your
|
|
1958
|
+
*
|
|
1959
|
+
* Refer to {@link newPipeline} and provided policies before implementing your
|
|
1960
|
+
* customized Pipeline.
|
|
1586
1961
|
*/
|
|
1587
1962
|
class Pipeline {
|
|
1588
1963
|
/**
|
|
@@ -1593,12 +1968,10 @@ class Pipeline {
|
|
|
1593
1968
|
*/
|
|
1594
1969
|
constructor(factories, options = {}) {
|
|
1595
1970
|
this.factories = factories;
|
|
1596
|
-
|
|
1597
|
-
// avoid each client creating its own http client.
|
|
1598
|
-
this.options = Object.assign(Object.assign({}, options), { httpClient: options.httpClient || getCachedDefaultHttpClient() });
|
|
1971
|
+
this.options = options;
|
|
1599
1972
|
}
|
|
1600
1973
|
/**
|
|
1601
|
-
*
|
|
1974
|
+
* Transfer Pipeline object to ServiceClientOptions object which is required by
|
|
1602
1975
|
* ServiceClient constructor.
|
|
1603
1976
|
*
|
|
1604
1977
|
* @returns The ServiceClientOptions object from this Pipeline.
|
|
@@ -1614,39 +1987,192 @@ class Pipeline {
|
|
|
1614
1987
|
* Creates a new Pipeline object with Credential provided.
|
|
1615
1988
|
*
|
|
1616
1989
|
* @param credential - Such as AnonymousCredential, StorageSharedKeyCredential or any credential from the `@azure/identity` package to authenticate requests to the service. You can also provide an object that implements the TokenCredential interface. If not specified, AnonymousCredential is used.
|
|
1617
|
-
* @param pipelineOptions - Options.
|
|
1990
|
+
* @param pipelineOptions - Optional. Options.
|
|
1618
1991
|
* @returns A new Pipeline object.
|
|
1619
1992
|
*/
|
|
1620
1993
|
function newPipeline(credential, pipelineOptions = {}) {
|
|
1621
|
-
if (credential
|
|
1994
|
+
if (!credential) {
|
|
1622
1995
|
credential = new AnonymousCredential();
|
|
1623
1996
|
}
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1997
|
+
const pipeline = new Pipeline([], pipelineOptions);
|
|
1998
|
+
pipeline._credential = credential;
|
|
1999
|
+
return pipeline;
|
|
2000
|
+
}
|
|
2001
|
+
function processDownlevelPipeline(pipeline) {
|
|
2002
|
+
const knownFactoryFunctions = [
|
|
2003
|
+
isAnonymousCredential,
|
|
2004
|
+
isStorageSharedKeyCredential,
|
|
2005
|
+
isCoreHttpBearerTokenFactory,
|
|
2006
|
+
isStorageBrowserPolicyFactory,
|
|
2007
|
+
isStorageRetryPolicyFactory,
|
|
2008
|
+
isStorageTelemetryPolicyFactory,
|
|
2009
|
+
isCoreHttpPolicyFactory,
|
|
2010
|
+
];
|
|
2011
|
+
if (pipeline.factories.length) {
|
|
2012
|
+
const novelFactories = pipeline.factories.filter((factory) => {
|
|
2013
|
+
return !knownFactoryFunctions.some((knownFactory) => knownFactory(factory));
|
|
2014
|
+
});
|
|
2015
|
+
if (novelFactories.length) {
|
|
2016
|
+
const hasInjector = novelFactories.some((factory) => isInjectorPolicyFactory(factory));
|
|
2017
|
+
// if there are any left over, wrap in a requestPolicyFactoryPolicy
|
|
2018
|
+
return {
|
|
2019
|
+
wrappedPolicies: coreHttpCompat.createRequestPolicyFactoryPolicy(novelFactories),
|
|
2020
|
+
afterRetry: hasInjector,
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
return undefined;
|
|
2025
|
+
}
|
|
2026
|
+
function getCoreClientOptions(pipeline) {
|
|
2027
|
+
var _a;
|
|
2028
|
+
const _b = pipeline.options, { httpClient: v1Client } = _b, restOptions = tslib.__rest(_b, ["httpClient"]);
|
|
2029
|
+
let httpClient = pipeline._coreHttpClient;
|
|
2030
|
+
if (!httpClient) {
|
|
2031
|
+
httpClient = v1Client ? coreHttpCompat.convertHttpClient(v1Client) : getCachedDefaultHttpClient();
|
|
2032
|
+
pipeline._coreHttpClient = httpClient;
|
|
2033
|
+
}
|
|
2034
|
+
let corePipeline = pipeline._corePipeline;
|
|
2035
|
+
if (!corePipeline) {
|
|
2036
|
+
const packageDetails = `azsdk-js-azure-storage-blob/${SDK_VERSION}`;
|
|
2037
|
+
const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix
|
|
2038
|
+
? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
2039
|
+
: `${packageDetails}`;
|
|
2040
|
+
corePipeline = coreClient.createClientPipeline(Object.assign(Object.assign({}, restOptions), { loggingOptions: {
|
|
2041
|
+
additionalAllowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
|
|
2042
|
+
additionalAllowedQueryParameters: StorageBlobLoggingAllowedQueryParameters,
|
|
2043
|
+
logger: logger$1.info,
|
|
2044
|
+
}, userAgentOptions: {
|
|
2045
|
+
userAgentPrefix,
|
|
2046
|
+
}, serializationOptions: {
|
|
2047
|
+
stringifyXML: coreXml.stringifyXML,
|
|
2048
|
+
serializerOptions: {
|
|
2049
|
+
xml: {
|
|
2050
|
+
// Use customized XML char key of "#" so we can deserialize metadata
|
|
2051
|
+
// with "_" key
|
|
2052
|
+
xmlCharKey: "#",
|
|
2053
|
+
},
|
|
2054
|
+
},
|
|
2055
|
+
}, deserializationOptions: {
|
|
2056
|
+
parseXML: coreXml.parseXML,
|
|
2057
|
+
serializerOptions: {
|
|
2058
|
+
xml: {
|
|
2059
|
+
// Use customized XML char key of "#" so we can deserialize metadata
|
|
2060
|
+
// with "_" key
|
|
2061
|
+
xmlCharKey: "#",
|
|
2062
|
+
},
|
|
2063
|
+
},
|
|
2064
|
+
} }));
|
|
2065
|
+
corePipeline.removePolicy({ phase: "Retry" });
|
|
2066
|
+
corePipeline.removePolicy({ name: coreRestPipeline.decompressResponsePolicyName });
|
|
2067
|
+
corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
|
|
2068
|
+
corePipeline.addPolicy(storageBrowserPolicy());
|
|
2069
|
+
const downlevelResults = processDownlevelPipeline(pipeline);
|
|
2070
|
+
if (downlevelResults) {
|
|
2071
|
+
corePipeline.addPolicy(downlevelResults.wrappedPolicies, downlevelResults.afterRetry ? { afterPhase: "Retry" } : undefined);
|
|
2072
|
+
}
|
|
2073
|
+
const credential = getCredentialFromPipeline(pipeline);
|
|
2074
|
+
if (coreAuth.isTokenCredential(credential)) {
|
|
2075
|
+
corePipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
|
2076
|
+
credential,
|
|
2077
|
+
scopes: (_a = restOptions.audience) !== null && _a !== void 0 ? _a : StorageOAuthScopes,
|
|
2078
|
+
challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnTenantChallenge },
|
|
2079
|
+
}), { phase: "Sign" });
|
|
2080
|
+
}
|
|
2081
|
+
else if (credential instanceof StorageSharedKeyCredential) {
|
|
2082
|
+
corePipeline.addPolicy(storageSharedKeyCredentialPolicy({
|
|
2083
|
+
accountName: credential.accountName,
|
|
2084
|
+
accountKey: credential.accountKey,
|
|
2085
|
+
}), { phase: "Sign" });
|
|
2086
|
+
}
|
|
2087
|
+
pipeline._corePipeline = corePipeline;
|
|
2088
|
+
}
|
|
2089
|
+
return Object.assign(Object.assign({}, restOptions), { httpClient, pipeline: corePipeline });
|
|
2090
|
+
}
|
|
2091
|
+
function getCredentialFromPipeline(pipeline) {
|
|
2092
|
+
// see if we squirreled one away on the type itself
|
|
2093
|
+
if (pipeline._credential) {
|
|
2094
|
+
return pipeline._credential;
|
|
2095
|
+
}
|
|
2096
|
+
// if it came from another package, loop over the factories and look for one like before
|
|
2097
|
+
let credential = new AnonymousCredential();
|
|
2098
|
+
for (const factory of pipeline.factories) {
|
|
2099
|
+
if (coreAuth.isTokenCredential(factory.credential)) {
|
|
2100
|
+
// Only works if the factory has been attached a "credential" property.
|
|
2101
|
+
// We do that in newPipeline() when using TokenCredential.
|
|
2102
|
+
credential = factory.credential;
|
|
2103
|
+
}
|
|
2104
|
+
else if (isStorageSharedKeyCredential(factory)) {
|
|
2105
|
+
return factory;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2108
|
+
return credential;
|
|
2109
|
+
}
|
|
2110
|
+
function isStorageSharedKeyCredential(factory) {
|
|
2111
|
+
if (factory instanceof StorageSharedKeyCredential) {
|
|
2112
|
+
return true;
|
|
2113
|
+
}
|
|
2114
|
+
return factory.constructor.name === "StorageSharedKeyCredential";
|
|
2115
|
+
}
|
|
2116
|
+
function isAnonymousCredential(factory) {
|
|
2117
|
+
if (factory instanceof AnonymousCredential) {
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
return factory.constructor.name === "AnonymousCredential";
|
|
2121
|
+
}
|
|
2122
|
+
function isCoreHttpBearerTokenFactory(factory) {
|
|
2123
|
+
return coreAuth.isTokenCredential(factory.credential);
|
|
2124
|
+
}
|
|
2125
|
+
function isStorageBrowserPolicyFactory(factory) {
|
|
2126
|
+
if (factory instanceof StorageBrowserPolicyFactory) {
|
|
2127
|
+
return true;
|
|
2128
|
+
}
|
|
2129
|
+
return factory.constructor.name === "StorageBrowserPolicyFactory";
|
|
2130
|
+
}
|
|
2131
|
+
function isStorageRetryPolicyFactory(factory) {
|
|
2132
|
+
if (factory instanceof StorageRetryPolicyFactory) {
|
|
2133
|
+
return true;
|
|
2134
|
+
}
|
|
2135
|
+
return factory.constructor.name === "StorageRetryPolicyFactory";
|
|
2136
|
+
}
|
|
2137
|
+
function isStorageTelemetryPolicyFactory(factory) {
|
|
2138
|
+
return factory.constructor.name === "TelemetryPolicyFactory";
|
|
2139
|
+
}
|
|
2140
|
+
function isInjectorPolicyFactory(factory) {
|
|
2141
|
+
return factory.constructor.name === "InjectorPolicyFactory";
|
|
2142
|
+
}
|
|
2143
|
+
function isCoreHttpPolicyFactory(factory) {
|
|
2144
|
+
const knownPolicies = [
|
|
2145
|
+
"GenerateClientRequestIdPolicy",
|
|
2146
|
+
"TracingPolicy",
|
|
2147
|
+
"LogPolicy",
|
|
2148
|
+
"ProxyPolicy",
|
|
2149
|
+
"DisableResponseDecompressionPolicy",
|
|
2150
|
+
"KeepAlivePolicy",
|
|
2151
|
+
"DeserializationPolicy",
|
|
1641
2152
|
];
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
2153
|
+
const mockHttpClient = {
|
|
2154
|
+
sendRequest: async (request) => {
|
|
2155
|
+
return {
|
|
2156
|
+
request,
|
|
2157
|
+
headers: request.headers.clone(),
|
|
2158
|
+
status: 500,
|
|
2159
|
+
};
|
|
2160
|
+
},
|
|
2161
|
+
};
|
|
2162
|
+
const mockRequestPolicyOptions = {
|
|
2163
|
+
log(_logLevel, _message) {
|
|
2164
|
+
/* do nothing */
|
|
2165
|
+
},
|
|
2166
|
+
shouldLog(_logLevel) {
|
|
2167
|
+
return false;
|
|
2168
|
+
},
|
|
2169
|
+
};
|
|
2170
|
+
const policyInstance = factory.create(mockHttpClient, mockRequestPolicyOptions);
|
|
2171
|
+
const policyName = policyInstance.constructor.name;
|
|
2172
|
+
// bundlers sometimes add a custom suffix to the class name to make it unique
|
|
2173
|
+
return knownPolicies.some((knownPolicyName) => {
|
|
2174
|
+
return policyName.startsWith(knownPolicyName);
|
|
2175
|
+
});
|
|
1650
2176
|
}
|
|
1651
2177
|
|
|
1652
2178
|
/*
|
|
@@ -2667,12 +3193,12 @@ const QueueGetPropertiesHeaders = {
|
|
|
2667
3193
|
modelProperties: {
|
|
2668
3194
|
metadata: {
|
|
2669
3195
|
serializedName: "x-ms-meta",
|
|
3196
|
+
headerCollectionPrefix: "x-ms-meta-",
|
|
2670
3197
|
xmlName: "x-ms-meta",
|
|
2671
3198
|
type: {
|
|
2672
3199
|
name: "Dictionary",
|
|
2673
3200
|
value: { type: { name: "String" } }
|
|
2674
|
-
}
|
|
2675
|
-
headerCollectionPrefix: "x-ms-meta-"
|
|
3201
|
+
}
|
|
2676
3202
|
},
|
|
2677
3203
|
approximateMessagesCount: {
|
|
2678
3204
|
serializedName: "x-ms-approximate-messages-count",
|
|
@@ -3495,7 +4021,7 @@ const timeoutInSeconds = {
|
|
|
3495
4021
|
const version = {
|
|
3496
4022
|
parameterPath: "version",
|
|
3497
4023
|
mapper: {
|
|
3498
|
-
defaultValue: "
|
|
4024
|
+
defaultValue: "2021-10-04",
|
|
3499
4025
|
isConstant: true,
|
|
3500
4026
|
serializedName: "x-ms-version",
|
|
3501
4027
|
type: {
|
|
@@ -3596,18 +4122,18 @@ const include = {
|
|
|
3596
4122
|
}
|
|
3597
4123
|
}
|
|
3598
4124
|
},
|
|
3599
|
-
collectionFormat:
|
|
4125
|
+
collectionFormat: "CSV"
|
|
3600
4126
|
};
|
|
3601
4127
|
const metadata = {
|
|
3602
4128
|
parameterPath: ["options", "metadata"],
|
|
3603
4129
|
mapper: {
|
|
3604
4130
|
serializedName: "x-ms-meta",
|
|
3605
4131
|
xmlName: "x-ms-meta",
|
|
4132
|
+
headerCollectionPrefix: "x-ms-meta-",
|
|
3606
4133
|
type: {
|
|
3607
4134
|
name: "Dictionary",
|
|
3608
4135
|
value: { type: { name: "String" } }
|
|
3609
|
-
}
|
|
3610
|
-
headerCollectionPrefix: "x-ms-meta-"
|
|
4136
|
+
}
|
|
3611
4137
|
}
|
|
3612
4138
|
};
|
|
3613
4139
|
const comp3 = {
|
|
@@ -3743,8 +4269,8 @@ const visibilityTimeout1 = {
|
|
|
3743
4269
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
3744
4270
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
3745
4271
|
*/
|
|
3746
|
-
/** Class
|
|
3747
|
-
class
|
|
4272
|
+
/** Class containing Service operations. */
|
|
4273
|
+
class ServiceImpl {
|
|
3748
4274
|
/**
|
|
3749
4275
|
* Initialize a new instance of the class Service class.
|
|
3750
4276
|
* @param client Reference to the service client
|
|
@@ -3759,11 +4285,7 @@ class Service {
|
|
|
3759
4285
|
* @param options The options parameters.
|
|
3760
4286
|
*/
|
|
3761
4287
|
setProperties(properties, options) {
|
|
3762
|
-
|
|
3763
|
-
properties,
|
|
3764
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3765
|
-
};
|
|
3766
|
-
return this.client.sendOperationRequest(operationArguments, setPropertiesOperationSpec);
|
|
4288
|
+
return this.client.sendOperationRequest({ properties, options }, setPropertiesOperationSpec);
|
|
3767
4289
|
}
|
|
3768
4290
|
/**
|
|
3769
4291
|
* gets the properties of a storage account's Queue service, including properties for Storage Analytics
|
|
@@ -3771,10 +4293,7 @@ class Service {
|
|
|
3771
4293
|
* @param options The options parameters.
|
|
3772
4294
|
*/
|
|
3773
4295
|
getProperties(options) {
|
|
3774
|
-
|
|
3775
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3776
|
-
};
|
|
3777
|
-
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec$1);
|
|
4296
|
+
return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec$1);
|
|
3778
4297
|
}
|
|
3779
4298
|
/**
|
|
3780
4299
|
* Retrieves statistics related to replication for the Queue service. It is only available on the
|
|
@@ -3783,24 +4302,18 @@ class Service {
|
|
|
3783
4302
|
* @param options The options parameters.
|
|
3784
4303
|
*/
|
|
3785
4304
|
getStatistics(options) {
|
|
3786
|
-
|
|
3787
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3788
|
-
};
|
|
3789
|
-
return this.client.sendOperationRequest(operationArguments, getStatisticsOperationSpec);
|
|
4305
|
+
return this.client.sendOperationRequest({ options }, getStatisticsOperationSpec);
|
|
3790
4306
|
}
|
|
3791
4307
|
/**
|
|
3792
4308
|
* The List Queues Segment operation returns a list of the queues under the specified account
|
|
3793
4309
|
* @param options The options parameters.
|
|
3794
4310
|
*/
|
|
3795
4311
|
listQueuesSegment(options) {
|
|
3796
|
-
|
|
3797
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3798
|
-
};
|
|
3799
|
-
return this.client.sendOperationRequest(operationArguments, listQueuesSegmentOperationSpec);
|
|
4312
|
+
return this.client.sendOperationRequest({ options }, listQueuesSegmentOperationSpec);
|
|
3800
4313
|
}
|
|
3801
4314
|
}
|
|
3802
4315
|
// Operation Specifications
|
|
3803
|
-
const xmlSerializer$3 =
|
|
4316
|
+
const xmlSerializer$3 = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
|
|
3804
4317
|
const setPropertiesOperationSpec = {
|
|
3805
4318
|
path: "/",
|
|
3806
4319
|
httpMethod: "PUT",
|
|
@@ -3923,8 +4436,8 @@ const listQueuesSegmentOperationSpec = {
|
|
|
3923
4436
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
3924
4437
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
3925
4438
|
*/
|
|
3926
|
-
/** Class
|
|
3927
|
-
class
|
|
4439
|
+
/** Class containing Queue operations. */
|
|
4440
|
+
class QueueImpl {
|
|
3928
4441
|
/**
|
|
3929
4442
|
* Initialize a new instance of the class Queue class.
|
|
3930
4443
|
* @param client Reference to the service client
|
|
@@ -3937,20 +4450,14 @@ class Queue {
|
|
|
3937
4450
|
* @param options The options parameters.
|
|
3938
4451
|
*/
|
|
3939
4452
|
create(options) {
|
|
3940
|
-
|
|
3941
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3942
|
-
};
|
|
3943
|
-
return this.client.sendOperationRequest(operationArguments, createOperationSpec);
|
|
4453
|
+
return this.client.sendOperationRequest({ options }, createOperationSpec);
|
|
3944
4454
|
}
|
|
3945
4455
|
/**
|
|
3946
4456
|
* operation permanently deletes the specified queue
|
|
3947
4457
|
* @param options The options parameters.
|
|
3948
4458
|
*/
|
|
3949
4459
|
delete(options) {
|
|
3950
|
-
|
|
3951
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3952
|
-
};
|
|
3953
|
-
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec$1);
|
|
4460
|
+
return this.client.sendOperationRequest({ options }, deleteOperationSpec$1);
|
|
3954
4461
|
}
|
|
3955
4462
|
/**
|
|
3956
4463
|
* Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated
|
|
@@ -3958,10 +4465,7 @@ class Queue {
|
|
|
3958
4465
|
* @param options The options parameters.
|
|
3959
4466
|
*/
|
|
3960
4467
|
getProperties(options) {
|
|
3961
|
-
|
|
3962
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3963
|
-
};
|
|
3964
|
-
return this.client.sendOperationRequest(operationArguments, getPropertiesOperationSpec);
|
|
4468
|
+
return this.client.sendOperationRequest({ options }, getPropertiesOperationSpec);
|
|
3965
4469
|
}
|
|
3966
4470
|
/**
|
|
3967
4471
|
* sets user-defined metadata on the specified queue. Metadata is associated with the queue as
|
|
@@ -3969,10 +4473,7 @@ class Queue {
|
|
|
3969
4473
|
* @param options The options parameters.
|
|
3970
4474
|
*/
|
|
3971
4475
|
setMetadata(options) {
|
|
3972
|
-
|
|
3973
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3974
|
-
};
|
|
3975
|
-
return this.client.sendOperationRequest(operationArguments, setMetadataOperationSpec);
|
|
4476
|
+
return this.client.sendOperationRequest({ options }, setMetadataOperationSpec);
|
|
3976
4477
|
}
|
|
3977
4478
|
/**
|
|
3978
4479
|
* returns details about any stored access policies specified on the queue that may be used with Shared
|
|
@@ -3980,24 +4481,18 @@ class Queue {
|
|
|
3980
4481
|
* @param options The options parameters.
|
|
3981
4482
|
*/
|
|
3982
4483
|
getAccessPolicy(options) {
|
|
3983
|
-
|
|
3984
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3985
|
-
};
|
|
3986
|
-
return this.client.sendOperationRequest(operationArguments, getAccessPolicyOperationSpec);
|
|
4484
|
+
return this.client.sendOperationRequest({ options }, getAccessPolicyOperationSpec);
|
|
3987
4485
|
}
|
|
3988
4486
|
/**
|
|
3989
4487
|
* sets stored access policies for the queue that may be used with Shared Access Signatures
|
|
3990
4488
|
* @param options The options parameters.
|
|
3991
4489
|
*/
|
|
3992
4490
|
setAccessPolicy(options) {
|
|
3993
|
-
|
|
3994
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
3995
|
-
};
|
|
3996
|
-
return this.client.sendOperationRequest(operationArguments, setAccessPolicyOperationSpec);
|
|
4491
|
+
return this.client.sendOperationRequest({ options }, setAccessPolicyOperationSpec);
|
|
3997
4492
|
}
|
|
3998
4493
|
}
|
|
3999
4494
|
// Operation Specifications
|
|
4000
|
-
const xmlSerializer$2 =
|
|
4495
|
+
const xmlSerializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
|
|
4001
4496
|
const createOperationSpec = {
|
|
4002
4497
|
path: "/{queueName}",
|
|
4003
4498
|
httpMethod: "PUT",
|
|
@@ -4159,8 +4654,8 @@ const setAccessPolicyOperationSpec = {
|
|
|
4159
4654
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
4160
4655
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4161
4656
|
*/
|
|
4162
|
-
/** Class
|
|
4163
|
-
class
|
|
4657
|
+
/** Class containing Messages operations. */
|
|
4658
|
+
class MessagesImpl {
|
|
4164
4659
|
/**
|
|
4165
4660
|
* Initialize a new instance of the class Messages class.
|
|
4166
4661
|
* @param client Reference to the service client
|
|
@@ -4173,20 +4668,14 @@ class Messages {
|
|
|
4173
4668
|
* @param options The options parameters.
|
|
4174
4669
|
*/
|
|
4175
4670
|
dequeue(options) {
|
|
4176
|
-
|
|
4177
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4178
|
-
};
|
|
4179
|
-
return this.client.sendOperationRequest(operationArguments, dequeueOperationSpec);
|
|
4671
|
+
return this.client.sendOperationRequest({ options }, dequeueOperationSpec);
|
|
4180
4672
|
}
|
|
4181
4673
|
/**
|
|
4182
4674
|
* The Clear operation deletes all messages from the specified queue.
|
|
4183
4675
|
* @param options The options parameters.
|
|
4184
4676
|
*/
|
|
4185
4677
|
clear(options) {
|
|
4186
|
-
|
|
4187
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4188
|
-
};
|
|
4189
|
-
return this.client.sendOperationRequest(operationArguments, clearOperationSpec);
|
|
4678
|
+
return this.client.sendOperationRequest({ options }, clearOperationSpec);
|
|
4190
4679
|
}
|
|
4191
4680
|
/**
|
|
4192
4681
|
* The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can
|
|
@@ -4197,11 +4686,7 @@ class Messages {
|
|
|
4197
4686
|
* @param options The options parameters.
|
|
4198
4687
|
*/
|
|
4199
4688
|
enqueue(queueMessage, options) {
|
|
4200
|
-
|
|
4201
|
-
queueMessage,
|
|
4202
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4203
|
-
};
|
|
4204
|
-
return this.client.sendOperationRequest(operationArguments, enqueueOperationSpec);
|
|
4689
|
+
return this.client.sendOperationRequest({ queueMessage, options }, enqueueOperationSpec);
|
|
4205
4690
|
}
|
|
4206
4691
|
/**
|
|
4207
4692
|
* The Peek operation retrieves one or more messages from the front of the queue, but does not alter
|
|
@@ -4209,14 +4694,11 @@ class Messages {
|
|
|
4209
4694
|
* @param options The options parameters.
|
|
4210
4695
|
*/
|
|
4211
4696
|
peek(options) {
|
|
4212
|
-
|
|
4213
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4214
|
-
};
|
|
4215
|
-
return this.client.sendOperationRequest(operationArguments, peekOperationSpec);
|
|
4697
|
+
return this.client.sendOperationRequest({ options }, peekOperationSpec);
|
|
4216
4698
|
}
|
|
4217
4699
|
}
|
|
4218
4700
|
// Operation Specifications
|
|
4219
|
-
const xmlSerializer$1 =
|
|
4701
|
+
const xmlSerializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
|
|
4220
4702
|
const dequeueOperationSpec = {
|
|
4221
4703
|
path: "/{queueName}/messages",
|
|
4222
4704
|
httpMethod: "GET",
|
|
@@ -4363,8 +4845,8 @@ const peekOperationSpec = {
|
|
|
4363
4845
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
4364
4846
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4365
4847
|
*/
|
|
4366
|
-
/** Class
|
|
4367
|
-
class
|
|
4848
|
+
/** Class containing MessageId operations. */
|
|
4849
|
+
class MessageIdImpl {
|
|
4368
4850
|
/**
|
|
4369
4851
|
* Initialize a new instance of the class MessageId class.
|
|
4370
4852
|
* @param client Reference to the service client
|
|
@@ -4387,12 +4869,7 @@ class MessageId {
|
|
|
4387
4869
|
* @param options The options parameters.
|
|
4388
4870
|
*/
|
|
4389
4871
|
update(popReceipt, visibilityTimeout, options) {
|
|
4390
|
-
|
|
4391
|
-
popReceipt,
|
|
4392
|
-
visibilityTimeout,
|
|
4393
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4394
|
-
};
|
|
4395
|
-
return this.client.sendOperationRequest(operationArguments, updateOperationSpec);
|
|
4872
|
+
return this.client.sendOperationRequest({ popReceipt, visibilityTimeout, options }, updateOperationSpec);
|
|
4396
4873
|
}
|
|
4397
4874
|
/**
|
|
4398
4875
|
* The Delete operation deletes the specified message.
|
|
@@ -4401,15 +4878,11 @@ class MessageId {
|
|
|
4401
4878
|
* @param options The options parameters.
|
|
4402
4879
|
*/
|
|
4403
4880
|
delete(popReceipt, options) {
|
|
4404
|
-
|
|
4405
|
-
popReceipt,
|
|
4406
|
-
options: coreHttp__namespace.operationOptionsToRequestOptionsBase(options || {})
|
|
4407
|
-
};
|
|
4408
|
-
return this.client.sendOperationRequest(operationArguments, deleteOperationSpec);
|
|
4881
|
+
return this.client.sendOperationRequest({ popReceipt, options }, deleteOperationSpec);
|
|
4409
4882
|
}
|
|
4410
4883
|
}
|
|
4411
4884
|
// Operation Specifications
|
|
4412
|
-
const xmlSerializer =
|
|
4885
|
+
const xmlSerializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
|
|
4413
4886
|
const updateOperationSpec = {
|
|
4414
4887
|
path: "/{queueName}/messages/{messageid}",
|
|
4415
4888
|
httpMethod: "PUT",
|
|
@@ -4463,6 +4936,67 @@ const deleteOperationSpec = {
|
|
|
4463
4936
|
serializer: xmlSerializer
|
|
4464
4937
|
};
|
|
4465
4938
|
|
|
4939
|
+
/*
|
|
4940
|
+
* Copyright (c) Microsoft Corporation.
|
|
4941
|
+
* Licensed under the MIT License.
|
|
4942
|
+
*
|
|
4943
|
+
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
4944
|
+
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
4945
|
+
*/
|
|
4946
|
+
class StorageClient$1 extends coreHttpCompat__namespace.ExtendedServiceClient {
|
|
4947
|
+
/**
|
|
4948
|
+
* Initializes a new instance of the StorageClient class.
|
|
4949
|
+
* @param url The URL of the service account, queue or message that is the target of the desired
|
|
4950
|
+
* operation.
|
|
4951
|
+
* @param options The parameter options
|
|
4952
|
+
*/
|
|
4953
|
+
constructor(url, options) {
|
|
4954
|
+
var _a, _b;
|
|
4955
|
+
if (url === undefined) {
|
|
4956
|
+
throw new Error("'url' cannot be null");
|
|
4957
|
+
}
|
|
4958
|
+
// Initializing default values for options
|
|
4959
|
+
if (!options) {
|
|
4960
|
+
options = {};
|
|
4961
|
+
}
|
|
4962
|
+
const defaults = {
|
|
4963
|
+
requestContentType: "application/json; charset=utf-8"
|
|
4964
|
+
};
|
|
4965
|
+
const packageDetails = `azsdk-js-azure-storage-queue/12.20.0`;
|
|
4966
|
+
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
4967
|
+
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
4968
|
+
: `${packageDetails}`;
|
|
4969
|
+
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
|
4970
|
+
userAgentPrefix
|
|
4971
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{url}" });
|
|
4972
|
+
super(optionsWithDefaults);
|
|
4973
|
+
// Parameter assignments
|
|
4974
|
+
this.url = url;
|
|
4975
|
+
// Assigning values to Constant parameters
|
|
4976
|
+
this.version = options.version || "2021-10-04";
|
|
4977
|
+
this.service = new ServiceImpl(this);
|
|
4978
|
+
this.queue = new QueueImpl(this);
|
|
4979
|
+
this.messages = new MessagesImpl(this);
|
|
4980
|
+
this.messageId = new MessageIdImpl(this);
|
|
4981
|
+
}
|
|
4982
|
+
}
|
|
4983
|
+
|
|
4984
|
+
// Copyright (c) Microsoft Corporation.
|
|
4985
|
+
/**
|
|
4986
|
+
* @internal
|
|
4987
|
+
*/
|
|
4988
|
+
class StorageContextClient extends StorageClient$1 {
|
|
4989
|
+
async sendOperationRequest(operationArguments, operationSpec) {
|
|
4990
|
+
const operationSpecToSend = Object.assign({}, operationSpec);
|
|
4991
|
+
if (operationSpecToSend.path === "/{queueName}" ||
|
|
4992
|
+
operationSpecToSend.path === "/{queueName}/messages" ||
|
|
4993
|
+
operationSpecToSend.path === "/{queueName}/messages/{messageid}") {
|
|
4994
|
+
operationSpecToSend.path = "";
|
|
4995
|
+
}
|
|
4996
|
+
return super.sendOperationRequest(operationArguments, operationSpecToSend);
|
|
4997
|
+
}
|
|
4998
|
+
}
|
|
4999
|
+
|
|
4466
5000
|
// Copyright (c) Microsoft Corporation.
|
|
4467
5001
|
/**
|
|
4468
5002
|
* A StorageClient represents a based client class for {@link QueueServiceClient}, {@link QueueClient} and etc.
|
|
@@ -4477,29 +5011,28 @@ class StorageClient {
|
|
|
4477
5011
|
this.url = url;
|
|
4478
5012
|
this.accountName = getAccountNameFromUrl(url);
|
|
4479
5013
|
this.pipeline = pipeline;
|
|
4480
|
-
this.storageClientContext = getStorageClientContext(url, pipeline);
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
}
|
|
4497
|
-
catch (err) {
|
|
4498
|
-
// ignore errors in creating policy, the client instance may still work without the policy.
|
|
4499
|
-
}
|
|
4500
|
-
}
|
|
4501
|
-
}
|
|
5014
|
+
this.storageClientContext = getStorageClientContext(this.url, this.pipeline);
|
|
5015
|
+
this.credential = getCredentialFromPipeline(pipeline);
|
|
5016
|
+
}
|
|
5017
|
+
}
|
|
5018
|
+
/**
|
|
5019
|
+
* @internal
|
|
5020
|
+
*/
|
|
5021
|
+
function getStorageClientContext(url, pipeline) {
|
|
5022
|
+
const pipelineOptions = pipeline.options;
|
|
5023
|
+
// Set maximum timeout for queue operations.
|
|
5024
|
+
// This was previously set manually in the retry policy specific to this package.
|
|
5025
|
+
// https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations
|
|
5026
|
+
if (pipelineOptions.retryOptions === undefined) {
|
|
5027
|
+
pipelineOptions.retryOptions = {
|
|
5028
|
+
tryTimeoutInMs: 30 * 1000,
|
|
5029
|
+
};
|
|
4502
5030
|
}
|
|
5031
|
+
else if (pipelineOptions.retryOptions.tryTimeoutInMs === undefined) {
|
|
5032
|
+
pipelineOptions.retryOptions.tryTimeoutInMs = 30 * 1000;
|
|
5033
|
+
}
|
|
5034
|
+
const coreOptions = getCoreClientOptions(pipeline);
|
|
5035
|
+
return new StorageContextClient(url, coreOptions);
|
|
4503
5036
|
}
|
|
4504
5037
|
|
|
4505
5038
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -4651,6 +5184,12 @@ function getCanonicalName(accountName, queueName) {
|
|
|
4651
5184
|
* A QueueClient represents a URL to an Azure Storage Queue's messages allowing you to manipulate its messages.
|
|
4652
5185
|
*/
|
|
4653
5186
|
class QueueClient extends StorageClient {
|
|
5187
|
+
/**
|
|
5188
|
+
* The name of the queue.
|
|
5189
|
+
*/
|
|
5190
|
+
get name() {
|
|
5191
|
+
return this._name;
|
|
5192
|
+
}
|
|
4654
5193
|
constructor(urlOrConnectionString, credentialOrPipelineOrQueueName,
|
|
4655
5194
|
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
4656
5195
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
@@ -4663,9 +5202,9 @@ class QueueClient extends StorageClient {
|
|
|
4663
5202
|
url = urlOrConnectionString;
|
|
4664
5203
|
pipeline = credentialOrPipelineOrQueueName;
|
|
4665
5204
|
}
|
|
4666
|
-
else if ((
|
|
5205
|
+
else if ((coreUtil.isNode && credentialOrPipelineOrQueueName instanceof StorageSharedKeyCredential) ||
|
|
4667
5206
|
credentialOrPipelineOrQueueName instanceof AnonymousCredential ||
|
|
4668
|
-
|
|
5207
|
+
coreAuth.isTokenCredential(credentialOrPipelineOrQueueName)) {
|
|
4669
5208
|
// (url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
|
|
4670
5209
|
url = urlOrConnectionString;
|
|
4671
5210
|
pipeline = newPipeline(credentialOrPipelineOrQueueName, options);
|
|
@@ -4673,7 +5212,7 @@ class QueueClient extends StorageClient {
|
|
|
4673
5212
|
else if (!credentialOrPipelineOrQueueName &&
|
|
4674
5213
|
typeof credentialOrPipelineOrQueueName !== "string") {
|
|
4675
5214
|
// (url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions)
|
|
4676
|
-
// The second
|
|
5215
|
+
// The second parameter is undefined. Use anonymous credential.
|
|
4677
5216
|
url = urlOrConnectionString;
|
|
4678
5217
|
pipeline = newPipeline(new AnonymousCredential(), options);
|
|
4679
5218
|
}
|
|
@@ -4682,12 +5221,12 @@ class QueueClient extends StorageClient {
|
|
|
4682
5221
|
// (connectionString: string, containerName: string, queueName: string, options?: StoragePipelineOptions)
|
|
4683
5222
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
|
4684
5223
|
if (extractedCreds.kind === "AccountConnString") {
|
|
4685
|
-
if (
|
|
5224
|
+
if (coreUtil.isNode) {
|
|
4686
5225
|
const queueName = credentialOrPipelineOrQueueName;
|
|
4687
5226
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
|
4688
5227
|
url = appendToURLPath(extractedCreds.url, queueName);
|
|
4689
5228
|
if (!options.proxyOptions) {
|
|
4690
|
-
options.proxyOptions =
|
|
5229
|
+
options.proxyOptions = coreRestPipeline.getDefaultProxySettings(extractedCreds.proxyUri);
|
|
4691
5230
|
}
|
|
4692
5231
|
pipeline = newPipeline(sharedKeyCredential, options);
|
|
4693
5232
|
}
|
|
@@ -4709,20 +5248,14 @@ class QueueClient extends StorageClient {
|
|
|
4709
5248
|
}
|
|
4710
5249
|
super(url, pipeline);
|
|
4711
5250
|
this._name = this.getQueueNameFromUrl();
|
|
4712
|
-
this.queueContext =
|
|
5251
|
+
this.queueContext = this.storageClientContext.queue;
|
|
4713
5252
|
// MessagesContext
|
|
4714
5253
|
// Build the url with "messages"
|
|
4715
5254
|
const partsOfUrl = this.url.split("?");
|
|
4716
5255
|
this._messagesUrl = partsOfUrl[1]
|
|
4717
5256
|
? appendToURLPath(partsOfUrl[0], "messages") + "?" + partsOfUrl[1]
|
|
4718
5257
|
: appendToURLPath(partsOfUrl[0], "messages");
|
|
4719
|
-
this.messagesContext =
|
|
4720
|
-
}
|
|
4721
|
-
/**
|
|
4722
|
-
* The name of the queue.
|
|
4723
|
-
*/
|
|
4724
|
-
get name() {
|
|
4725
|
-
return this._name;
|
|
5258
|
+
this.messagesContext = getStorageClientContext(this._messagesUrl, this.pipeline).messages;
|
|
4726
5259
|
}
|
|
4727
5260
|
getMessageIdContext(messageId) {
|
|
4728
5261
|
// Build the url with messageId
|
|
@@ -4730,7 +5263,7 @@ class QueueClient extends StorageClient {
|
|
|
4730
5263
|
const urlWithMessageId = partsOfUrl[1]
|
|
4731
5264
|
? appendToURLPath(partsOfUrl[0], messageId) + "?" + partsOfUrl[1]
|
|
4732
5265
|
: appendToURLPath(partsOfUrl[0], messageId);
|
|
4733
|
-
return
|
|
5266
|
+
return getStorageClientContext(urlWithMessageId, this.pipeline).messageId;
|
|
4734
5267
|
}
|
|
4735
5268
|
/**
|
|
4736
5269
|
* Creates a new queue under the specified account.
|
|
@@ -4749,7 +5282,7 @@ class QueueClient extends StorageClient {
|
|
|
4749
5282
|
async create(options = {}) {
|
|
4750
5283
|
const { span, updatedOptions } = createSpan("QueueClient-create", options);
|
|
4751
5284
|
try {
|
|
4752
|
-
return await this.queueContext.create(
|
|
5285
|
+
return assertResponse(await this.queueContext.create(updatedOptions));
|
|
4753
5286
|
}
|
|
4754
5287
|
catch (e) {
|
|
4755
5288
|
span.setStatus({
|
|
@@ -4850,10 +5383,10 @@ class QueueClient extends StorageClient {
|
|
|
4850
5383
|
async delete(options = {}) {
|
|
4851
5384
|
const { span, updatedOptions } = createSpan("QueueClient-delete", options);
|
|
4852
5385
|
try {
|
|
4853
|
-
return await this.queueContext.delete({
|
|
5386
|
+
return assertResponse(await this.queueContext.delete({
|
|
4854
5387
|
abortSignal: options.abortSignal,
|
|
4855
5388
|
tracingOptions: updatedOptions.tracingOptions,
|
|
4856
|
-
});
|
|
5389
|
+
}));
|
|
4857
5390
|
}
|
|
4858
5391
|
catch (e) {
|
|
4859
5392
|
span.setStatus({
|
|
@@ -4918,10 +5451,10 @@ class QueueClient extends StorageClient {
|
|
|
4918
5451
|
async getProperties(options = {}) {
|
|
4919
5452
|
const { span, updatedOptions } = createSpan("QueueClient-getProperties", options);
|
|
4920
5453
|
try {
|
|
4921
|
-
return await this.queueContext.getProperties({
|
|
5454
|
+
return assertResponse(await this.queueContext.getProperties({
|
|
4922
5455
|
abortSignal: options.abortSignal,
|
|
4923
5456
|
tracingOptions: updatedOptions.tracingOptions,
|
|
4924
|
-
});
|
|
5457
|
+
}));
|
|
4925
5458
|
}
|
|
4926
5459
|
catch (e) {
|
|
4927
5460
|
span.setStatus({
|
|
@@ -4948,11 +5481,11 @@ class QueueClient extends StorageClient {
|
|
|
4948
5481
|
async setMetadata(metadata, options = {}) {
|
|
4949
5482
|
const { span, updatedOptions } = createSpan("QueueClient-setMetadata", options);
|
|
4950
5483
|
try {
|
|
4951
|
-
return await this.queueContext.setMetadata({
|
|
5484
|
+
return assertResponse(await this.queueContext.setMetadata({
|
|
4952
5485
|
abortSignal: options.abortSignal,
|
|
4953
5486
|
metadata,
|
|
4954
5487
|
tracingOptions: updatedOptions.tracingOptions,
|
|
4955
|
-
});
|
|
5488
|
+
}));
|
|
4956
5489
|
}
|
|
4957
5490
|
catch (e) {
|
|
4958
5491
|
span.setStatus({
|
|
@@ -4979,10 +5512,10 @@ class QueueClient extends StorageClient {
|
|
|
4979
5512
|
async getAccessPolicy(options = {}) {
|
|
4980
5513
|
const { span, updatedOptions } = createSpan("QueueClient-getAccessPolicy", options);
|
|
4981
5514
|
try {
|
|
4982
|
-
const response = await this.queueContext.getAccessPolicy({
|
|
5515
|
+
const response = assertResponse(await this.queueContext.getAccessPolicy({
|
|
4983
5516
|
abortSignal: options.abortSignal,
|
|
4984
5517
|
tracingOptions: updatedOptions.tracingOptions,
|
|
4985
|
-
});
|
|
5518
|
+
}));
|
|
4986
5519
|
const res = {
|
|
4987
5520
|
_response: response._response,
|
|
4988
5521
|
date: response.date,
|
|
@@ -5049,11 +5582,11 @@ class QueueClient extends StorageClient {
|
|
|
5049
5582
|
id: identifier.id,
|
|
5050
5583
|
});
|
|
5051
5584
|
}
|
|
5052
|
-
return await this.queueContext.setAccessPolicy({
|
|
5585
|
+
return assertResponse(await this.queueContext.setAccessPolicy({
|
|
5053
5586
|
abortSignal: options.abortSignal,
|
|
5054
5587
|
queueAcl: acl,
|
|
5055
5588
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5056
|
-
});
|
|
5589
|
+
}));
|
|
5057
5590
|
}
|
|
5058
5591
|
catch (e) {
|
|
5059
5592
|
span.setStatus({
|
|
@@ -5076,10 +5609,10 @@ class QueueClient extends StorageClient {
|
|
|
5076
5609
|
async clearMessages(options = {}) {
|
|
5077
5610
|
const { span, updatedOptions } = createSpan("QueueClient-clearMessages", options);
|
|
5078
5611
|
try {
|
|
5079
|
-
return await this.messagesContext.clear({
|
|
5612
|
+
return assertResponse(await this.messagesContext.clear({
|
|
5080
5613
|
abortSignal: options.abortSignal,
|
|
5081
5614
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5082
|
-
});
|
|
5615
|
+
}));
|
|
5083
5616
|
}
|
|
5084
5617
|
catch (e) {
|
|
5085
5618
|
span.setStatus({
|
|
@@ -5116,9 +5649,9 @@ class QueueClient extends StorageClient {
|
|
|
5116
5649
|
async sendMessage(messageText, options = {}) {
|
|
5117
5650
|
const { span, updatedOptions } = createSpan("QueueClient-sendMessage", options);
|
|
5118
5651
|
try {
|
|
5119
|
-
const response = await this.messagesContext.enqueue({
|
|
5652
|
+
const response = assertResponse(await this.messagesContext.enqueue({
|
|
5120
5653
|
messageText: messageText,
|
|
5121
|
-
}, updatedOptions);
|
|
5654
|
+
}, updatedOptions));
|
|
5122
5655
|
const item = response[0];
|
|
5123
5656
|
return {
|
|
5124
5657
|
_response: response._response,
|
|
@@ -5173,7 +5706,7 @@ class QueueClient extends StorageClient {
|
|
|
5173
5706
|
async receiveMessages(options = {}) {
|
|
5174
5707
|
const { span, updatedOptions } = createSpan("QueueClient-receiveMessages", options);
|
|
5175
5708
|
try {
|
|
5176
|
-
const response = await this.messagesContext.dequeue(updatedOptions);
|
|
5709
|
+
const response = assertResponse(await this.messagesContext.dequeue(updatedOptions));
|
|
5177
5710
|
const res = {
|
|
5178
5711
|
_response: response._response,
|
|
5179
5712
|
date: response.date,
|
|
@@ -5216,7 +5749,7 @@ class QueueClient extends StorageClient {
|
|
|
5216
5749
|
async peekMessages(options = {}) {
|
|
5217
5750
|
const { span, updatedOptions } = createSpan("QueueClient-peekMessages", options);
|
|
5218
5751
|
try {
|
|
5219
|
-
const response = await this.messagesContext.peek(updatedOptions);
|
|
5752
|
+
const response = assertResponse(await this.messagesContext.peek(updatedOptions));
|
|
5220
5753
|
const res = {
|
|
5221
5754
|
_response: response._response,
|
|
5222
5755
|
date: response.date,
|
|
@@ -5254,10 +5787,10 @@ class QueueClient extends StorageClient {
|
|
|
5254
5787
|
async deleteMessage(messageId, popReceipt, options = {}) {
|
|
5255
5788
|
const { span, updatedOptions } = createSpan("QueueClient-deleteMessage", options);
|
|
5256
5789
|
try {
|
|
5257
|
-
return await this.getMessageIdContext(messageId).delete(popReceipt, {
|
|
5790
|
+
return assertResponse(await this.getMessageIdContext(messageId).delete(popReceipt, {
|
|
5258
5791
|
abortSignal: options.abortSignal,
|
|
5259
5792
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5260
|
-
});
|
|
5793
|
+
}));
|
|
5261
5794
|
}
|
|
5262
5795
|
catch (e) {
|
|
5263
5796
|
span.setStatus({
|
|
@@ -5294,11 +5827,11 @@ class QueueClient extends StorageClient {
|
|
|
5294
5827
|
queueMessage = { messageText: message };
|
|
5295
5828
|
}
|
|
5296
5829
|
try {
|
|
5297
|
-
return await this.getMessageIdContext(messageId).update(popReceipt, visibilityTimeout || 0, {
|
|
5830
|
+
return assertResponse(await this.getMessageIdContext(messageId).update(popReceipt, visibilityTimeout || 0, {
|
|
5298
5831
|
abortSignal: options.abortSignal,
|
|
5299
5832
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5300
5833
|
queueMessage,
|
|
5301
|
-
});
|
|
5834
|
+
}));
|
|
5302
5835
|
}
|
|
5303
5836
|
catch (e) {
|
|
5304
5837
|
span.setStatus({
|
|
@@ -5319,22 +5852,22 @@ class QueueClient extends StorageClient {
|
|
|
5319
5852
|
// "https://myaccount.queue.core.windows.net/myqueue".
|
|
5320
5853
|
// IPv4/IPv6 address hosts, Endpoints - `http://127.0.0.1:10001/devstoreaccount1/myqueue`
|
|
5321
5854
|
// http://localhost:10001/devstoreaccount1/queuename
|
|
5322
|
-
const parsedUrl =
|
|
5323
|
-
if (parsedUrl.
|
|
5855
|
+
const parsedUrl = new URL(this.url);
|
|
5856
|
+
if (parsedUrl.hostname.split(".")[1] === "queue") {
|
|
5324
5857
|
// "https://myaccount.queue.core.windows.net/queuename".
|
|
5325
5858
|
// .getPath() -> /queuename
|
|
5326
|
-
queueName = parsedUrl.
|
|
5859
|
+
queueName = parsedUrl.pathname.split("/")[1];
|
|
5327
5860
|
}
|
|
5328
5861
|
else if (isIpEndpointStyle(parsedUrl)) {
|
|
5329
5862
|
// IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/queuename
|
|
5330
5863
|
// Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/queuename
|
|
5331
5864
|
// .getPath() -> /devstoreaccount1/queuename
|
|
5332
|
-
queueName = parsedUrl.
|
|
5865
|
+
queueName = parsedUrl.pathname.split("/")[2];
|
|
5333
5866
|
}
|
|
5334
5867
|
else {
|
|
5335
5868
|
// "https://customdomain.com/queuename".
|
|
5336
5869
|
// .getPath() -> /queuename
|
|
5337
|
-
queueName = parsedUrl.
|
|
5870
|
+
queueName = parsedUrl.pathname.split("/")[1];
|
|
5338
5871
|
}
|
|
5339
5872
|
if (!queueName) {
|
|
5340
5873
|
throw new Error("Provided queueName is invalid.");
|
|
@@ -5371,26 +5904,6 @@ class QueueClient extends StorageClient {
|
|
|
5371
5904
|
* to manipulate queues.
|
|
5372
5905
|
*/
|
|
5373
5906
|
class QueueServiceClient extends StorageClient {
|
|
5374
|
-
constructor(url, credentialOrPipeline,
|
|
5375
|
-
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
5376
|
-
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
5377
|
-
options) {
|
|
5378
|
-
let pipeline;
|
|
5379
|
-
if (credentialOrPipeline instanceof Pipeline) {
|
|
5380
|
-
pipeline = credentialOrPipeline;
|
|
5381
|
-
}
|
|
5382
|
-
else if ((coreHttp.isNode && credentialOrPipeline instanceof StorageSharedKeyCredential) ||
|
|
5383
|
-
credentialOrPipeline instanceof AnonymousCredential ||
|
|
5384
|
-
coreHttp.isTokenCredential(credentialOrPipeline)) {
|
|
5385
|
-
pipeline = newPipeline(credentialOrPipeline, options);
|
|
5386
|
-
}
|
|
5387
|
-
else {
|
|
5388
|
-
// The second paramter is undefined. Use anonymous credential.
|
|
5389
|
-
pipeline = newPipeline(new AnonymousCredential(), options);
|
|
5390
|
-
}
|
|
5391
|
-
super(url, pipeline);
|
|
5392
|
-
this.serviceContext = new Service(this.storageClientContext);
|
|
5393
|
-
}
|
|
5394
5907
|
/**
|
|
5395
5908
|
* Creates an instance of QueueServiceClient.
|
|
5396
5909
|
*
|
|
@@ -5410,10 +5923,10 @@ class QueueServiceClient extends StorageClient {
|
|
|
5410
5923
|
options = options || {};
|
|
5411
5924
|
const extractedCreds = extractConnectionStringParts(connectionString);
|
|
5412
5925
|
if (extractedCreds.kind === "AccountConnString") {
|
|
5413
|
-
if (
|
|
5926
|
+
if (coreUtil.isNode) {
|
|
5414
5927
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
|
5415
5928
|
if (!options.proxyOptions) {
|
|
5416
|
-
options.proxyOptions =
|
|
5929
|
+
options.proxyOptions = coreRestPipeline.getDefaultProxySettings(extractedCreds.proxyUri);
|
|
5417
5930
|
}
|
|
5418
5931
|
const pipeline = newPipeline(sharedKeyCredential, options);
|
|
5419
5932
|
return new QueueServiceClient(extractedCreds.url, pipeline);
|
|
@@ -5430,6 +5943,26 @@ class QueueServiceClient extends StorageClient {
|
|
|
5430
5943
|
throw new Error("Connection string must be either an Account connection string or a SAS connection string");
|
|
5431
5944
|
}
|
|
5432
5945
|
}
|
|
5946
|
+
constructor(url, credentialOrPipeline,
|
|
5947
|
+
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
5948
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
5949
|
+
options) {
|
|
5950
|
+
let pipeline;
|
|
5951
|
+
if (credentialOrPipeline instanceof Pipeline) {
|
|
5952
|
+
pipeline = credentialOrPipeline;
|
|
5953
|
+
}
|
|
5954
|
+
else if ((coreUtil.isNode && credentialOrPipeline instanceof StorageSharedKeyCredential) ||
|
|
5955
|
+
credentialOrPipeline instanceof AnonymousCredential ||
|
|
5956
|
+
coreAuth.isTokenCredential(credentialOrPipeline)) {
|
|
5957
|
+
pipeline = newPipeline(credentialOrPipeline, options);
|
|
5958
|
+
}
|
|
5959
|
+
else {
|
|
5960
|
+
// The second parameter is undefined. Use anonymous credential.
|
|
5961
|
+
pipeline = newPipeline(new AnonymousCredential(), options);
|
|
5962
|
+
}
|
|
5963
|
+
super(url, pipeline);
|
|
5964
|
+
this.serviceContext = this.storageClientContext.service;
|
|
5965
|
+
}
|
|
5433
5966
|
/**
|
|
5434
5967
|
* Creates a {@link QueueClient} object.
|
|
5435
5968
|
*
|
|
@@ -5466,14 +5999,14 @@ class QueueServiceClient extends StorageClient {
|
|
|
5466
5999
|
options.prefix = undefined;
|
|
5467
6000
|
}
|
|
5468
6001
|
try {
|
|
5469
|
-
return await this.serviceContext.listQueuesSegment({
|
|
6002
|
+
return assertResponse(await this.serviceContext.listQueuesSegment({
|
|
5470
6003
|
abortSignal: options.abortSignal,
|
|
5471
6004
|
marker: marker,
|
|
5472
6005
|
maxPageSize: options.maxPageSize,
|
|
5473
6006
|
prefix: options.prefix,
|
|
5474
6007
|
include: options.include === undefined ? undefined : [options.include],
|
|
5475
6008
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5476
|
-
});
|
|
6009
|
+
}));
|
|
5477
6010
|
}
|
|
5478
6011
|
catch (e) {
|
|
5479
6012
|
span.setStatus({
|
|
@@ -5518,23 +6051,30 @@ class QueueServiceClient extends StorageClient {
|
|
|
5518
6051
|
*/
|
|
5519
6052
|
listItems(options = {}) {
|
|
5520
6053
|
return tslib.__asyncGenerator(this, arguments, function* listItems_1() {
|
|
5521
|
-
var e_1,
|
|
6054
|
+
var _a, e_1, _b, _c;
|
|
5522
6055
|
if (options.prefix === "") {
|
|
5523
6056
|
options.prefix = undefined;
|
|
5524
6057
|
}
|
|
5525
6058
|
let marker;
|
|
5526
6059
|
try {
|
|
5527
|
-
for (var
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
6060
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listSegments(marker, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a;) {
|
|
6061
|
+
_c = _f.value;
|
|
6062
|
+
_d = false;
|
|
6063
|
+
try {
|
|
6064
|
+
const segment = _c;
|
|
6065
|
+
if (segment.queueItems) {
|
|
6066
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(segment.queueItems)));
|
|
6067
|
+
}
|
|
6068
|
+
}
|
|
6069
|
+
finally {
|
|
6070
|
+
_d = true;
|
|
5531
6071
|
}
|
|
5532
6072
|
}
|
|
5533
6073
|
}
|
|
5534
6074
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
5535
6075
|
finally {
|
|
5536
6076
|
try {
|
|
5537
|
-
if (
|
|
6077
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
|
5538
6078
|
}
|
|
5539
6079
|
finally { if (e_1) throw e_1.error; }
|
|
5540
6080
|
}
|
|
@@ -5563,7 +6103,7 @@ class QueueServiceClient extends StorageClient {
|
|
|
5563
6103
|
* let iterator = queueServiceClient.listQueues();
|
|
5564
6104
|
* let item = await iterator.next();
|
|
5565
6105
|
* while (!item.done) {
|
|
5566
|
-
* console.log(`Queue${i}: ${
|
|
6106
|
+
* console.log(`Queue${i}: ${item.value.name}`);
|
|
5567
6107
|
* i++;
|
|
5568
6108
|
* item = await iterator.next();
|
|
5569
6109
|
* }
|
|
@@ -5656,10 +6196,10 @@ class QueueServiceClient extends StorageClient {
|
|
|
5656
6196
|
async getProperties(options = {}) {
|
|
5657
6197
|
const { span, updatedOptions } = createSpan("QueueServiceClient-getProperties", options);
|
|
5658
6198
|
try {
|
|
5659
|
-
return await this.serviceContext.getProperties({
|
|
6199
|
+
return assertResponse(await this.serviceContext.getProperties({
|
|
5660
6200
|
abortSignal: options.abortSignal,
|
|
5661
6201
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5662
|
-
});
|
|
6202
|
+
}));
|
|
5663
6203
|
}
|
|
5664
6204
|
catch (e) {
|
|
5665
6205
|
span.setStatus({
|
|
@@ -5684,10 +6224,10 @@ class QueueServiceClient extends StorageClient {
|
|
|
5684
6224
|
async setProperties(properties, options = {}) {
|
|
5685
6225
|
const { span, updatedOptions } = createSpan("QueueServiceClient-setProperties", options);
|
|
5686
6226
|
try {
|
|
5687
|
-
return await this.serviceContext.setProperties(properties, {
|
|
6227
|
+
return assertResponse(await this.serviceContext.setProperties(properties, {
|
|
5688
6228
|
abortSignal: options.abortSignal,
|
|
5689
6229
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5690
|
-
});
|
|
6230
|
+
}));
|
|
5691
6231
|
}
|
|
5692
6232
|
catch (e) {
|
|
5693
6233
|
span.setStatus({
|
|
@@ -5712,10 +6252,10 @@ class QueueServiceClient extends StorageClient {
|
|
|
5712
6252
|
async getStatistics(options = {}) {
|
|
5713
6253
|
const { span, updatedOptions } = createSpan("QueueServiceClient-getStatistics", options);
|
|
5714
6254
|
try {
|
|
5715
|
-
return await this.serviceContext.getStatistics({
|
|
6255
|
+
return assertResponse(await this.serviceContext.getStatistics({
|
|
5716
6256
|
abortSignal: options.abortSignal,
|
|
5717
6257
|
tracingOptions: updatedOptions.tracingOptions,
|
|
5718
|
-
});
|
|
6258
|
+
}));
|
|
5719
6259
|
}
|
|
5720
6260
|
catch (e) {
|
|
5721
6261
|
span.setStatus({
|
|
@@ -5805,35 +6345,22 @@ class QueueServiceClient extends StorageClient {
|
|
|
5805
6345
|
}
|
|
5806
6346
|
}
|
|
5807
6347
|
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
get: function () { return coreHttp.HttpHeaders; }
|
|
5815
|
-
});
|
|
5816
|
-
Object.defineProperty(exports, 'RequestPolicyOptions', {
|
|
5817
|
-
enumerable: true,
|
|
5818
|
-
get: function () { return coreHttp.RequestPolicyOptions; }
|
|
5819
|
-
});
|
|
6348
|
+
// Copyright (c) Microsoft Corporation.
|
|
6349
|
+
/**
|
|
6350
|
+
* The `@azure/logger` configuration for this package.
|
|
6351
|
+
*/
|
|
6352
|
+
const logger = logger$2.createClientLogger("storage-queue");
|
|
6353
|
+
|
|
5820
6354
|
Object.defineProperty(exports, 'RestError', {
|
|
5821
6355
|
enumerable: true,
|
|
5822
|
-
get: function () { return
|
|
5823
|
-
});
|
|
5824
|
-
Object.defineProperty(exports, 'WebResource', {
|
|
5825
|
-
enumerable: true,
|
|
5826
|
-
get: function () { return coreHttp.WebResource; }
|
|
5827
|
-
});
|
|
5828
|
-
Object.defineProperty(exports, 'deserializationPolicy', {
|
|
5829
|
-
enumerable: true,
|
|
5830
|
-
get: function () { return coreHttp.deserializationPolicy; }
|
|
6356
|
+
get: function () { return coreRestPipeline.RestError; }
|
|
5831
6357
|
});
|
|
5832
6358
|
exports.AccountSASPermissions = AccountSASPermissions;
|
|
5833
6359
|
exports.AccountSASResourceTypes = AccountSASResourceTypes;
|
|
5834
6360
|
exports.AccountSASServices = AccountSASServices;
|
|
5835
6361
|
exports.AnonymousCredential = AnonymousCredential;
|
|
5836
6362
|
exports.AnonymousCredentialPolicy = AnonymousCredentialPolicy;
|
|
6363
|
+
exports.BaseRequestPolicy = BaseRequestPolicy;
|
|
5837
6364
|
exports.Credential = Credential;
|
|
5838
6365
|
exports.CredentialPolicy = CredentialPolicy;
|
|
5839
6366
|
exports.Pipeline = Pipeline;
|
|
@@ -5843,13 +6370,13 @@ exports.QueueServiceClient = QueueServiceClient;
|
|
|
5843
6370
|
exports.SASQueryParameters = SASQueryParameters;
|
|
5844
6371
|
exports.StorageBrowserPolicy = StorageBrowserPolicy;
|
|
5845
6372
|
exports.StorageBrowserPolicyFactory = StorageBrowserPolicyFactory;
|
|
5846
|
-
exports.StorageOAuthScopes = StorageOAuthScopes;
|
|
5847
6373
|
exports.StorageRetryPolicy = StorageRetryPolicy;
|
|
5848
6374
|
exports.StorageRetryPolicyFactory = StorageRetryPolicyFactory;
|
|
5849
6375
|
exports.StorageSharedKeyCredential = StorageSharedKeyCredential;
|
|
5850
6376
|
exports.StorageSharedKeyCredentialPolicy = StorageSharedKeyCredentialPolicy;
|
|
5851
6377
|
exports.generateAccountSASQueryParameters = generateAccountSASQueryParameters;
|
|
5852
6378
|
exports.generateQueueSASQueryParameters = generateQueueSASQueryParameters;
|
|
6379
|
+
exports.isPipelineLike = isPipelineLike;
|
|
5853
6380
|
exports.logger = logger;
|
|
5854
6381
|
exports.newPipeline = newPipeline;
|
|
5855
6382
|
//# sourceMappingURL=index.js.map
|