@azure/storage-file-share 12.28.0-beta.1 → 12.28.0
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/browser/AccountSASPermissions.d.ts +1 -1
- package/dist/browser/AccountSASPermissions.js +34 -36
- package/dist/browser/AccountSASPermissions.js.map +1 -1
- package/dist/browser/AccountSASResourceTypes.d.ts +1 -1
- package/dist/browser/AccountSASResourceTypes.js +13 -15
- package/dist/browser/AccountSASResourceTypes.js.map +1 -1
- package/dist/browser/AccountSASServices.js +16 -18
- package/dist/browser/AccountSASServices.js.map +1 -1
- package/dist/browser/AccountSASSignatureValues.d.ts +4 -4
- package/dist/browser/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/AccountSASSignatureValues.js +1 -1
- package/dist/browser/AccountSASSignatureValues.js.map +1 -1
- package/dist/browser/Clients.d.ts +56 -55
- package/dist/browser/Clients.d.ts.map +1 -1
- package/dist/browser/Clients.js +602 -289
- package/dist/browser/Clients.js.map +1 -1
- package/dist/browser/FileSASPermissions.js +16 -18
- package/dist/browser/FileSASPermissions.js.map +1 -1
- package/dist/browser/FileSASSignatureValues.d.ts +2 -2
- package/dist/browser/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/FileSASSignatureValues.js.map +1 -1
- package/dist/browser/FileSystemAttributes.d.ts +1 -1
- package/dist/browser/FileSystemAttributes.js +44 -46
- package/dist/browser/FileSystemAttributes.js.map +1 -1
- package/dist/browser/Pipeline.d.ts +2 -4
- package/dist/browser/Pipeline.d.ts.map +1 -1
- package/dist/browser/Pipeline.js +28 -19
- package/dist/browser/Pipeline.js.map +1 -1
- package/dist/browser/Range.d.ts +1 -1
- package/dist/browser/Range.js.map +1 -1
- package/dist/browser/SASQueryParameters.d.ts +1 -1
- package/dist/browser/SASQueryParameters.js +70 -0
- package/dist/browser/SASQueryParameters.js.map +1 -1
- package/dist/browser/ShareClientInternal.js +1 -0
- package/dist/browser/ShareClientInternal.js.map +1 -1
- package/dist/browser/ShareSASPermissions.d.ts +1 -1
- package/dist/browser/ShareSASPermissions.js +21 -23
- package/dist/browser/ShareSASPermissions.js.map +1 -1
- package/dist/browser/ShareServiceClient.d.ts +5 -5
- package/dist/browser/ShareServiceClient.d.ts.map +1 -1
- package/dist/browser/ShareServiceClient.js +70 -54
- package/dist/browser/ShareServiceClient.js.map +1 -1
- package/dist/browser/StorageClient.d.ts +2 -2
- package/dist/browser/StorageClient.d.ts.map +1 -1
- package/dist/browser/StorageClient.js +23 -0
- package/dist/browser/StorageClient.js.map +1 -1
- package/dist/browser/StorageContextClient.js +1 -1
- package/dist/browser/StorageContextClient.js.map +1 -1
- package/dist/browser/generated/src/operations/directory.js +1 -0
- package/dist/browser/generated/src/operations/directory.js.map +1 -1
- package/dist/browser/generated/src/operations/file.js +1 -0
- package/dist/browser/generated/src/operations/file.js.map +1 -1
- package/dist/browser/generated/src/operations/service.js +1 -0
- package/dist/browser/generated/src/operations/service.js.map +1 -1
- package/dist/browser/generated/src/operations/share.js +1 -0
- package/dist/browser/generated/src/operations/share.js.map +1 -1
- package/dist/browser/generated/src/storageClient.js +15 -4
- package/dist/browser/generated/src/storageClient.js.map +1 -1
- package/dist/browser/index-browser.d.mts.map +1 -1
- package/dist/browser/index-browser.mjs.map +1 -1
- package/dist/browser/index.d.ts +1 -7
- package/dist/browser/index.js +1 -7
- package/dist/browser/utils/Batch.js +29 -21
- package/dist/browser/utils/Batch.js.map +1 -1
- package/dist/browser/utils/BufferScheduler.js +70 -44
- package/dist/browser/utils/BufferScheduler.js.map +1 -1
- package/dist/browser/utils/RetriableReadableStream.js +70 -62
- package/dist/browser/utils/RetriableReadableStream.js.map +1 -1
- package/dist/browser/utils/constants.d.ts.map +1 -1
- package/dist/browser/utils/constants.js +1 -1
- package/dist/browser/utils/constants.js.map +1 -1
- package/dist/browser/utils/utils.common.d.ts +2 -2
- package/dist/browser/utils/utils.common.js +33 -17
- package/dist/browser/utils/utils.common.js.map +1 -1
- package/dist/commonjs/AccountSASPermissions.d.ts +1 -1
- package/dist/commonjs/AccountSASPermissions.js +34 -36
- package/dist/commonjs/AccountSASPermissions.js.map +1 -1
- package/dist/commonjs/AccountSASResourceTypes.d.ts +1 -1
- package/dist/commonjs/AccountSASResourceTypes.js +13 -15
- package/dist/commonjs/AccountSASResourceTypes.js.map +1 -1
- package/dist/commonjs/AccountSASServices.js +16 -18
- package/dist/commonjs/AccountSASServices.js.map +1 -1
- package/dist/commonjs/AccountSASSignatureValues.d.ts +4 -4
- package/dist/commonjs/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/AccountSASSignatureValues.js +1 -1
- package/dist/commonjs/AccountSASSignatureValues.js.map +1 -1
- package/dist/commonjs/Clients.d.ts +56 -55
- package/dist/commonjs/Clients.d.ts.map +1 -1
- package/dist/commonjs/Clients.js +614 -301
- package/dist/commonjs/Clients.js.map +1 -1
- package/dist/commonjs/FileDownloadResponse.js +2 -0
- package/dist/commonjs/FileDownloadResponse.js.map +1 -1
- package/dist/commonjs/FileSASPermissions.js +16 -18
- package/dist/commonjs/FileSASPermissions.js.map +1 -1
- package/dist/commonjs/FileSASSignatureValues.d.ts +2 -2
- package/dist/commonjs/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/FileSASSignatureValues.js.map +1 -1
- package/dist/commonjs/FileSystemAttributes.d.ts +1 -1
- package/dist/commonjs/FileSystemAttributes.js +44 -46
- package/dist/commonjs/FileSystemAttributes.js.map +1 -1
- package/dist/commonjs/Pipeline.d.ts +2 -4
- package/dist/commonjs/Pipeline.d.ts.map +1 -1
- package/dist/commonjs/Pipeline.js +39 -30
- package/dist/commonjs/Pipeline.js.map +1 -1
- package/dist/commonjs/Range.d.ts +1 -1
- package/dist/commonjs/Range.js.map +1 -1
- package/dist/commonjs/SASQueryParameters.d.ts +1 -1
- package/dist/commonjs/SASQueryParameters.js +70 -0
- package/dist/commonjs/SASQueryParameters.js.map +1 -1
- package/dist/commonjs/ShareClientInternal.js +1 -0
- package/dist/commonjs/ShareClientInternal.js.map +1 -1
- package/dist/commonjs/ShareSASPermissions.d.ts +1 -1
- package/dist/commonjs/ShareSASPermissions.js +21 -23
- package/dist/commonjs/ShareSASPermissions.js.map +1 -1
- package/dist/commonjs/ShareServiceClient.d.ts +5 -5
- package/dist/commonjs/ShareServiceClient.d.ts.map +1 -1
- package/dist/commonjs/ShareServiceClient.js +76 -60
- package/dist/commonjs/ShareServiceClient.js.map +1 -1
- package/dist/commonjs/StorageClient.d.ts +2 -2
- package/dist/commonjs/StorageClient.d.ts.map +1 -1
- package/dist/commonjs/StorageClient.js +23 -0
- package/dist/commonjs/StorageClient.js.map +1 -1
- package/dist/commonjs/StorageContextClient.js +1 -1
- package/dist/commonjs/StorageContextClient.js.map +1 -1
- package/dist/commonjs/generated/src/operations/directory.js +1 -0
- package/dist/commonjs/generated/src/operations/directory.js.map +1 -1
- package/dist/commonjs/generated/src/operations/file.js +1 -0
- package/dist/commonjs/generated/src/operations/file.js.map +1 -1
- package/dist/commonjs/generated/src/operations/service.js +1 -0
- package/dist/commonjs/generated/src/operations/service.js.map +1 -1
- package/dist/commonjs/generated/src/operations/share.js +1 -0
- package/dist/commonjs/generated/src/operations/share.js.map +1 -1
- package/dist/commonjs/generated/src/storageClient.js +15 -4
- package/dist/commonjs/generated/src/storageClient.js.map +1 -1
- package/dist/commonjs/index.d.ts +1 -9
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +13 -18
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +11 -11
- package/dist/commonjs/utils/Batch.js +29 -21
- package/dist/commonjs/utils/Batch.js.map +1 -1
- package/dist/commonjs/utils/BufferScheduler.js +70 -44
- package/dist/commonjs/utils/BufferScheduler.js.map +1 -1
- package/dist/commonjs/utils/RetriableReadableStream.js +70 -62
- package/dist/commonjs/utils/RetriableReadableStream.js.map +1 -1
- package/dist/commonjs/utils/constants.d.ts.map +1 -1
- package/dist/commonjs/utils/constants.js +1 -1
- package/dist/commonjs/utils/constants.js.map +1 -1
- package/dist/commonjs/utils/utils.common.d.ts +2 -2
- package/dist/commonjs/utils/utils.common.js +33 -17
- package/dist/commonjs/utils/utils.common.js.map +1 -1
- package/dist/commonjs/utils/utils.d.ts +1 -1
- package/dist/commonjs/utils/utils.d.ts.map +1 -1
- package/dist/commonjs/utils/utils.js +5 -5
- package/dist/commonjs/utils/utils.js.map +1 -1
- package/dist/esm/AccountSASPermissions.d.ts +1 -1
- package/dist/esm/AccountSASPermissions.js +34 -36
- package/dist/esm/AccountSASPermissions.js.map +1 -1
- package/dist/esm/AccountSASResourceTypes.d.ts +1 -1
- package/dist/esm/AccountSASResourceTypes.js +13 -15
- package/dist/esm/AccountSASResourceTypes.js.map +1 -1
- package/dist/esm/AccountSASServices.js +16 -18
- package/dist/esm/AccountSASServices.js.map +1 -1
- package/dist/esm/AccountSASSignatureValues.d.ts +4 -4
- package/dist/esm/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/AccountSASSignatureValues.js +1 -1
- package/dist/esm/AccountSASSignatureValues.js.map +1 -1
- package/dist/esm/Clients.d.ts +56 -55
- package/dist/esm/Clients.d.ts.map +1 -1
- package/dist/esm/Clients.js +602 -289
- package/dist/esm/Clients.js.map +1 -1
- package/dist/esm/FileDownloadResponse.js +2 -0
- package/dist/esm/FileDownloadResponse.js.map +1 -1
- package/dist/esm/FileSASPermissions.js +16 -18
- package/dist/esm/FileSASPermissions.js.map +1 -1
- package/dist/esm/FileSASSignatureValues.d.ts +2 -2
- package/dist/esm/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/FileSASSignatureValues.js.map +1 -1
- package/dist/esm/FileSystemAttributes.d.ts +1 -1
- package/dist/esm/FileSystemAttributes.js +44 -46
- package/dist/esm/FileSystemAttributes.js.map +1 -1
- package/dist/esm/Pipeline.d.ts +2 -4
- package/dist/esm/Pipeline.d.ts.map +1 -1
- package/dist/esm/Pipeline.js +28 -19
- package/dist/esm/Pipeline.js.map +1 -1
- package/dist/esm/Range.d.ts +1 -1
- package/dist/esm/Range.js.map +1 -1
- package/dist/esm/SASQueryParameters.d.ts +1 -1
- package/dist/esm/SASQueryParameters.js +70 -0
- package/dist/esm/SASQueryParameters.js.map +1 -1
- package/dist/esm/ShareClientInternal.js +1 -0
- package/dist/esm/ShareClientInternal.js.map +1 -1
- package/dist/esm/ShareSASPermissions.d.ts +1 -1
- package/dist/esm/ShareSASPermissions.js +21 -23
- package/dist/esm/ShareSASPermissions.js.map +1 -1
- package/dist/esm/ShareServiceClient.d.ts +5 -5
- package/dist/esm/ShareServiceClient.d.ts.map +1 -1
- package/dist/esm/ShareServiceClient.js +70 -54
- package/dist/esm/ShareServiceClient.js.map +1 -1
- package/dist/esm/StorageClient.d.ts +2 -2
- package/dist/esm/StorageClient.d.ts.map +1 -1
- package/dist/esm/StorageClient.js +23 -0
- package/dist/esm/StorageClient.js.map +1 -1
- package/dist/esm/StorageContextClient.js +1 -1
- package/dist/esm/StorageContextClient.js.map +1 -1
- package/dist/esm/generated/src/operations/directory.js +1 -0
- package/dist/esm/generated/src/operations/directory.js.map +1 -1
- package/dist/esm/generated/src/operations/file.js +1 -0
- package/dist/esm/generated/src/operations/file.js.map +1 -1
- package/dist/esm/generated/src/operations/service.js +1 -0
- package/dist/esm/generated/src/operations/service.js.map +1 -1
- package/dist/esm/generated/src/operations/share.js +1 -0
- package/dist/esm/generated/src/operations/share.js.map +1 -1
- package/dist/esm/generated/src/storageClient.js +15 -4
- package/dist/esm/generated/src/storageClient.js.map +1 -1
- package/dist/esm/index.d.ts +1 -9
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/Batch.js +29 -21
- package/dist/esm/utils/Batch.js.map +1 -1
- package/dist/esm/utils/BufferScheduler.js +70 -44
- package/dist/esm/utils/BufferScheduler.js.map +1 -1
- package/dist/esm/utils/RetriableReadableStream.js +70 -62
- package/dist/esm/utils/RetriableReadableStream.js.map +1 -1
- package/dist/esm/utils/constants.d.ts.map +1 -1
- package/dist/esm/utils/constants.js +1 -1
- package/dist/esm/utils/constants.js.map +1 -1
- package/dist/esm/utils/utils.common.d.ts +2 -2
- package/dist/esm/utils/utils.common.js +33 -17
- package/dist/esm/utils/utils.common.js.map +1 -1
- package/dist/esm/utils/utils.d.ts +1 -1
- package/dist/esm/utils/utils.d.ts.map +1 -1
- package/dist/esm/utils/utils.js +2 -2
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/react-native/AccountSASPermissions.d.ts +1 -1
- package/dist/react-native/AccountSASPermissions.js +34 -36
- package/dist/react-native/AccountSASPermissions.js.map +1 -1
- package/dist/react-native/AccountSASResourceTypes.d.ts +1 -1
- package/dist/react-native/AccountSASResourceTypes.js +13 -15
- package/dist/react-native/AccountSASResourceTypes.js.map +1 -1
- package/dist/react-native/AccountSASServices.js +16 -18
- package/dist/react-native/AccountSASServices.js.map +1 -1
- package/dist/react-native/AccountSASSignatureValues.d.ts +4 -4
- package/dist/react-native/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/AccountSASSignatureValues.js +1 -1
- package/dist/react-native/AccountSASSignatureValues.js.map +1 -1
- package/dist/react-native/Clients.d.ts +56 -55
- package/dist/react-native/Clients.d.ts.map +1 -1
- package/dist/react-native/Clients.js +602 -289
- package/dist/react-native/Clients.js.map +1 -1
- package/dist/react-native/FileDownloadResponse.js +2 -0
- package/dist/react-native/FileDownloadResponse.js.map +1 -1
- package/dist/react-native/FileSASPermissions.js +16 -18
- package/dist/react-native/FileSASPermissions.js.map +1 -1
- package/dist/react-native/FileSASSignatureValues.d.ts +2 -2
- package/dist/react-native/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/FileSASSignatureValues.js.map +1 -1
- package/dist/react-native/FileSystemAttributes.d.ts +1 -1
- package/dist/react-native/FileSystemAttributes.js +44 -46
- package/dist/react-native/FileSystemAttributes.js.map +1 -1
- package/dist/react-native/Pipeline.d.ts +2 -4
- package/dist/react-native/Pipeline.d.ts.map +1 -1
- package/dist/react-native/Pipeline.js +28 -19
- package/dist/react-native/Pipeline.js.map +1 -1
- package/dist/react-native/Range.d.ts +1 -1
- package/dist/react-native/Range.js.map +1 -1
- package/dist/react-native/SASQueryParameters.d.ts +1 -1
- package/dist/react-native/SASQueryParameters.js +70 -0
- package/dist/react-native/SASQueryParameters.js.map +1 -1
- package/dist/react-native/ShareClientInternal.js +1 -0
- package/dist/react-native/ShareClientInternal.js.map +1 -1
- package/dist/react-native/ShareSASPermissions.d.ts +1 -1
- package/dist/react-native/ShareSASPermissions.js +21 -23
- package/dist/react-native/ShareSASPermissions.js.map +1 -1
- package/dist/react-native/ShareServiceClient.d.ts +5 -5
- package/dist/react-native/ShareServiceClient.d.ts.map +1 -1
- package/dist/react-native/ShareServiceClient.js +70 -54
- package/dist/react-native/ShareServiceClient.js.map +1 -1
- package/dist/react-native/StorageClient.d.ts +2 -2
- package/dist/react-native/StorageClient.d.ts.map +1 -1
- package/dist/react-native/StorageClient.js +23 -0
- package/dist/react-native/StorageClient.js.map +1 -1
- package/dist/react-native/StorageContextClient.js +1 -1
- package/dist/react-native/StorageContextClient.js.map +1 -1
- package/dist/react-native/generated/src/operations/directory.js +1 -0
- package/dist/react-native/generated/src/operations/directory.js.map +1 -1
- package/dist/react-native/generated/src/operations/file.js +1 -0
- package/dist/react-native/generated/src/operations/file.js.map +1 -1
- package/dist/react-native/generated/src/operations/service.js +1 -0
- package/dist/react-native/generated/src/operations/service.js.map +1 -1
- package/dist/react-native/generated/src/operations/share.js +1 -0
- package/dist/react-native/generated/src/operations/share.js.map +1 -1
- package/dist/react-native/generated/src/storageClient.js +15 -4
- package/dist/react-native/generated/src/storageClient.js.map +1 -1
- package/dist/react-native/index.d.ts +1 -9
- package/dist/react-native/index.d.ts.map +1 -1
- package/dist/react-native/index.js +1 -9
- package/dist/react-native/index.js.map +1 -1
- package/dist/react-native/utils/Batch.js +29 -21
- package/dist/react-native/utils/Batch.js.map +1 -1
- package/dist/react-native/utils/BufferScheduler.js +70 -44
- package/dist/react-native/utils/BufferScheduler.js.map +1 -1
- package/dist/react-native/utils/RetriableReadableStream.js +70 -62
- package/dist/react-native/utils/RetriableReadableStream.js.map +1 -1
- package/dist/react-native/utils/constants.d.ts.map +1 -1
- package/dist/react-native/utils/constants.js +1 -1
- package/dist/react-native/utils/constants.js.map +1 -1
- package/dist/react-native/utils/utils.common.d.ts +2 -2
- package/dist/react-native/utils/utils.common.js +33 -17
- package/dist/react-native/utils/utils.common.js.map +1 -1
- package/dist/react-native/utils/utils.d.ts +1 -1
- package/dist/react-native/utils/utils.d.ts.map +1 -1
- package/dist/react-native/utils/utils.js +2 -2
- package/dist/react-native/utils/utils.js.map +1 -1
- package/package.json +8 -8
- package/dist/browser/StorageRetryPolicyFactory.d.ts +0 -56
- package/dist/browser/StorageRetryPolicyFactory.d.ts.map +0 -1
- package/dist/browser/StorageRetryPolicyFactory.js +0 -26
- package/dist/browser/StorageRetryPolicyFactory.js.map +0 -1
- package/dist/browser/policies/StorageRetryPolicy.d.ts +0 -75
- package/dist/browser/policies/StorageRetryPolicy.d.ts.map +0 -1
- package/dist/browser/policies/StorageRetryPolicy.js +0 -220
- package/dist/browser/policies/StorageRetryPolicy.js.map +0 -1
- package/dist/browser/policies/StorageRetryPolicyV2.d.ts +0 -24
- package/dist/browser/policies/StorageRetryPolicyV2.d.ts.map +0 -1
- package/dist/browser/policies/StorageRetryPolicyV2.js +0 -176
- package/dist/browser/policies/StorageRetryPolicyV2.js.map +0 -1
- package/dist/commonjs/StorageRetryPolicyFactory.d.ts +0 -56
- package/dist/commonjs/StorageRetryPolicyFactory.d.ts.map +0 -1
- package/dist/commonjs/StorageRetryPolicyFactory.js +0 -31
- package/dist/commonjs/StorageRetryPolicyFactory.js.map +0 -1
- package/dist/commonjs/policies/StorageRetryPolicy.d.ts +0 -75
- package/dist/commonjs/policies/StorageRetryPolicy.d.ts.map +0 -1
- package/dist/commonjs/policies/StorageRetryPolicy.js +0 -225
- package/dist/commonjs/policies/StorageRetryPolicy.js.map +0 -1
- package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts +0 -24
- package/dist/commonjs/policies/StorageRetryPolicyV2.d.ts.map +0 -1
- package/dist/commonjs/policies/StorageRetryPolicyV2.js +0 -180
- package/dist/commonjs/policies/StorageRetryPolicyV2.js.map +0 -1
- package/dist/esm/StorageRetryPolicyFactory.d.ts +0 -56
- package/dist/esm/StorageRetryPolicyFactory.d.ts.map +0 -1
- package/dist/esm/StorageRetryPolicyFactory.js +0 -26
- package/dist/esm/StorageRetryPolicyFactory.js.map +0 -1
- package/dist/esm/policies/StorageRetryPolicy.d.ts +0 -75
- package/dist/esm/policies/StorageRetryPolicy.d.ts.map +0 -1
- package/dist/esm/policies/StorageRetryPolicy.js +0 -220
- package/dist/esm/policies/StorageRetryPolicy.js.map +0 -1
- package/dist/esm/policies/StorageRetryPolicyV2.d.ts +0 -24
- package/dist/esm/policies/StorageRetryPolicyV2.d.ts.map +0 -1
- package/dist/esm/policies/StorageRetryPolicyV2.js +0 -176
- package/dist/esm/policies/StorageRetryPolicyV2.js.map +0 -1
- package/dist/react-native/StorageRetryPolicyFactory.d.ts +0 -56
- package/dist/react-native/StorageRetryPolicyFactory.d.ts.map +0 -1
- package/dist/react-native/StorageRetryPolicyFactory.js +0 -26
- package/dist/react-native/StorageRetryPolicyFactory.js.map +0 -1
- package/dist/react-native/policies/StorageRetryPolicy.d.ts +0 -75
- package/dist/react-native/policies/StorageRetryPolicy.d.ts.map +0 -1
- package/dist/react-native/policies/StorageRetryPolicy.js +0 -220
- package/dist/react-native/policies/StorageRetryPolicy.js.map +0 -1
- package/dist/react-native/policies/StorageRetryPolicyV2.d.ts +0 -24
- package/dist/react-native/policies/StorageRetryPolicyV2.d.ts.map +0 -1
- package/dist/react-native/policies/StorageRetryPolicyV2.js +0 -176
- package/dist/react-native/policies/StorageRetryPolicyV2.js.map +0 -1
package/dist/commonjs/Clients.js
CHANGED
@@ -3,15 +3,14 @@
|
|
3
3
|
// Licensed under the MIT License.
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
5
5
|
exports.ShareLeaseClient = exports.ShareFileClient = exports.ShareDirectoryClient = exports.ShareClient = void 0;
|
6
|
-
const tslib_1 = require("tslib");
|
7
6
|
const core_auth_1 = require("@azure/core-auth");
|
8
7
|
const core_util_1 = require("@azure/core-util");
|
9
8
|
const Pipeline_js_1 = require("./Pipeline.js");
|
10
9
|
const constants_js_1 = require("./utils/constants.js");
|
11
10
|
const utils_common_js_1 = require("./utils/utils.common.js");
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
11
|
+
const storage_common_1 = require("@azure/storage-common");
|
12
|
+
const storage_common_2 = require("@azure/storage-common");
|
13
|
+
const storage_common_3 = require("@azure/storage-common");
|
15
14
|
const tracing_js_1 = require("./utils/tracing.js");
|
16
15
|
const StorageClient_js_1 = require("./StorageClient.js");
|
17
16
|
const FileDownloadResponse_js_1 = require("./FileDownloadResponse.js");
|
@@ -26,6 +25,12 @@ const FileSASSignatureValues_js_1 = require("./FileSASSignatureValues.js");
|
|
26
25
|
* A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
|
27
26
|
*/
|
28
27
|
class ShareClient extends StorageClient_js_1.StorageClient {
|
28
|
+
/**
|
29
|
+
* Share operation context provided by protocol layer.
|
30
|
+
*/
|
31
|
+
context;
|
32
|
+
_name;
|
33
|
+
shareClientConfig;
|
29
34
|
/**
|
30
35
|
* The name of the share
|
31
36
|
*/
|
@@ -42,7 +47,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
42
47
|
url = urlOrConnectionString;
|
43
48
|
pipeline = credentialOrPipelineOrShareName;
|
44
49
|
}
|
45
|
-
else if (credentialOrPipelineOrShareName instanceof
|
50
|
+
else if (credentialOrPipelineOrShareName instanceof storage_common_1.Credential ||
|
46
51
|
(0, core_auth_1.isTokenCredential)(credentialOrPipelineOrShareName)) {
|
47
52
|
// (url: string, credential?: Credential, options?: ShareClientOptions)
|
48
53
|
url = urlOrConnectionString;
|
@@ -53,7 +58,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
53
58
|
// (url: string, credential?: Credential, options?: ShareClientOptions)
|
54
59
|
// The second parameter is undefined. Use anonymous credential.
|
55
60
|
url = urlOrConnectionString;
|
56
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
61
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
57
62
|
}
|
58
63
|
else if (credentialOrPipelineOrShareName &&
|
59
64
|
typeof credentialOrPipelineOrShareName === "string") {
|
@@ -62,7 +67,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
62
67
|
const name = credentialOrPipelineOrShareName;
|
63
68
|
if (extractedCreds.kind === "AccountConnString") {
|
64
69
|
if (core_util_1.isNodeLike) {
|
65
|
-
const sharedKeyCredential = new
|
70
|
+
const sharedKeyCredential = new storage_common_2.StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
66
71
|
url = (0, utils_common_js_1.appendToURLPath)(extractedCreds.url, name);
|
67
72
|
pipeline = (0, Pipeline_js_1.newPipeline)(sharedKeyCredential, options);
|
68
73
|
}
|
@@ -72,7 +77,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
72
77
|
}
|
73
78
|
else if (extractedCreds.kind === "SASConnString") {
|
74
79
|
url = (0, utils_common_js_1.appendToURLPath)(extractedCreds.url, name) + "?" + extractedCreds.accountSas;
|
75
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
80
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
76
81
|
}
|
77
82
|
else {
|
78
83
|
throw new Error("Connection string must be either an Account connection string or a SAS connection string");
|
@@ -99,33 +104,43 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
99
104
|
/**
|
100
105
|
* Creates a new share under the specified account. If the share with
|
101
106
|
* the same name already exists, the operation fails.
|
102
|
-
* @see https://learn.microsoft.com/
|
107
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-share
|
103
108
|
*
|
104
109
|
* @param options - Options to Share Create operation.
|
105
110
|
* @returns Response data for the Share Create operation.
|
106
111
|
*/
|
107
112
|
async create(options = {}) {
|
108
113
|
return tracing_js_1.tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
109
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.create(
|
114
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.create({
|
115
|
+
...updatedOptions,
|
116
|
+
...this.shareClientConfig,
|
117
|
+
enabledProtocols: (0, models_js_1.toShareProtocolsString)(updatedOptions.protocols),
|
118
|
+
}));
|
110
119
|
});
|
111
120
|
}
|
112
121
|
/**
|
113
122
|
* Creates a new share under the specified account. If the share with
|
114
123
|
* the same name already exists, it is not changed.
|
115
|
-
* @see https://learn.microsoft.com/
|
124
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-share
|
116
125
|
*
|
117
126
|
* @param options -
|
118
127
|
*/
|
119
128
|
async createIfNotExists(options = {}) {
|
120
129
|
return tracing_js_1.tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
|
121
|
-
var _a, _b;
|
122
130
|
try {
|
123
131
|
const res = await this.create(updatedOptions);
|
124
|
-
return
|
132
|
+
return {
|
133
|
+
succeeded: true,
|
134
|
+
...res,
|
135
|
+
};
|
125
136
|
}
|
126
137
|
catch (e) {
|
127
|
-
if (
|
128
|
-
return
|
138
|
+
if (e.details?.errorCode === "ShareAlreadyExists") {
|
139
|
+
return {
|
140
|
+
succeeded: false,
|
141
|
+
...e.response?.parsedHeaders,
|
142
|
+
_response: e.response,
|
143
|
+
};
|
129
144
|
}
|
130
145
|
throw e;
|
131
146
|
}
|
@@ -155,7 +170,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
155
170
|
}
|
156
171
|
/**
|
157
172
|
* Creates a new subdirectory under this share.
|
158
|
-
* @see https://learn.microsoft.com/
|
173
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-directory
|
159
174
|
*
|
160
175
|
* @param directoryName -
|
161
176
|
* @param options - Options to Directory Create operation.
|
@@ -174,7 +189,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
174
189
|
/**
|
175
190
|
* Removes the specified empty sub directory under this share.
|
176
191
|
* Note that the directory must be empty before it can be deleted.
|
177
|
-
* @see https://learn.microsoft.com/
|
192
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-directory
|
178
193
|
*
|
179
194
|
* @param directoryName -
|
180
195
|
* @param options - Options to Directory Delete operation.
|
@@ -189,7 +204,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
189
204
|
/**
|
190
205
|
* Creates a new file or replaces a file under the root directory of this share.
|
191
206
|
* Note it only initializes the file with no content.
|
192
|
-
* @see https://learn.microsoft.com/
|
207
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-file
|
193
208
|
*
|
194
209
|
* @param fileName -
|
195
210
|
* @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
|
@@ -220,7 +235,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
220
235
|
* a share. An attempt to perform this operation on a share snapshot will fail with 400
|
221
236
|
* (`InvalidQueryParameterValue`)
|
222
237
|
*
|
223
|
-
* @see https://learn.microsoft.com/
|
238
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-file2
|
224
239
|
*
|
225
240
|
* @param directoryName -
|
226
241
|
* @param fileName -
|
@@ -260,7 +275,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
260
275
|
/**
|
261
276
|
* Returns all user-defined metadata and system properties for the specified
|
262
277
|
* share.
|
263
|
-
* @see https://learn.microsoft.com/
|
278
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-share-properties
|
264
279
|
*
|
265
280
|
* WARNING: The `metadata` object returned in the response will have its keys in lowercase, even if
|
266
281
|
* they originally contained uppercase characters. This differs from the metadata keys returned by
|
@@ -272,39 +287,52 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
272
287
|
async getProperties(options = {}) {
|
273
288
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
274
289
|
const res = (0, utils_common_js_1.assertResponse)(await this.context.getProperties(updatedOptions));
|
275
|
-
return
|
290
|
+
return {
|
291
|
+
...res,
|
292
|
+
...this.shareClientConfig,
|
293
|
+
protocols: (0, models_js_1.toShareProtocols)(res.enabledProtocols),
|
294
|
+
};
|
276
295
|
});
|
277
296
|
}
|
278
297
|
/**
|
279
298
|
* Marks the specified share for deletion. The share and any directories or files
|
280
299
|
* contained within it are later deleted during garbage collection.
|
281
|
-
* @see https://learn.microsoft.com/
|
300
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-share
|
282
301
|
*
|
283
302
|
* @param options - Options to Share Delete operation.
|
284
303
|
* @returns Response data for the Share Delete operation.
|
285
304
|
*/
|
286
305
|
async delete(options = {}) {
|
287
306
|
return tracing_js_1.tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
288
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.delete(
|
307
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.delete({
|
308
|
+
...updatedOptions,
|
309
|
+
...this.shareClientConfig,
|
310
|
+
}));
|
289
311
|
});
|
290
312
|
}
|
291
313
|
/**
|
292
314
|
* Marks the specified share for deletion if it exists. The share and any directories or files
|
293
315
|
* contained within it are later deleted during garbage collection.
|
294
|
-
* @see https://learn.microsoft.com/
|
316
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-share
|
295
317
|
*
|
296
318
|
* @param options -
|
297
319
|
*/
|
298
320
|
async deleteIfExists(options = {}) {
|
299
321
|
return tracing_js_1.tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
300
|
-
var _a, _b;
|
301
322
|
try {
|
302
323
|
const res = await this.delete(updatedOptions);
|
303
|
-
return
|
324
|
+
return {
|
325
|
+
succeeded: true,
|
326
|
+
...res,
|
327
|
+
};
|
304
328
|
}
|
305
329
|
catch (e) {
|
306
|
-
if (
|
307
|
-
return
|
330
|
+
if (e.details?.errorCode === "ShareNotFound") {
|
331
|
+
return {
|
332
|
+
succeeded: false,
|
333
|
+
...e.response?.parsedHeaders,
|
334
|
+
_response: e.response,
|
335
|
+
};
|
308
336
|
}
|
309
337
|
throw e;
|
310
338
|
}
|
@@ -315,7 +343,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
315
343
|
*
|
316
344
|
* If no option provided, or no metadata defined in the option parameter, the share
|
317
345
|
* metadata will be removed.
|
318
|
-
* @see https://learn.microsoft.com/
|
346
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-share-metadata
|
319
347
|
*
|
320
348
|
* @param metadata - If no metadata provided, all existing directory metadata will be removed.
|
321
349
|
* @param option - Options to Share Set Metadata operation.
|
@@ -323,7 +351,11 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
323
351
|
*/
|
324
352
|
async setMetadata(metadata, options = {}) {
|
325
353
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
326
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
354
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
355
|
+
...updatedOptions,
|
356
|
+
...this.shareClientConfig,
|
357
|
+
metadata,
|
358
|
+
}));
|
327
359
|
});
|
328
360
|
}
|
329
361
|
/**
|
@@ -333,14 +365,17 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
333
365
|
* WARNING: JavaScript Date will potential lost precision when parsing start and expiry string.
|
334
366
|
* For example, new Date("2018-12-31T03:44:23.8827891Z").toISOString() will get "2018-12-31T03:44:23.882Z".
|
335
367
|
*
|
336
|
-
* @see https://learn.microsoft.com/
|
368
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-share-acl
|
337
369
|
*
|
338
370
|
* @param option - Options to Share Get Access Policy operation.
|
339
371
|
* @returns Response data for the Share Get Access Policy operation.
|
340
372
|
*/
|
341
373
|
async getAccessPolicy(options = {}) {
|
342
374
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
343
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.getAccessPolicy(
|
375
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.getAccessPolicy({
|
376
|
+
...updatedOptions,
|
377
|
+
...this.shareClientConfig,
|
378
|
+
}));
|
344
379
|
const res = {
|
345
380
|
_response: response._response,
|
346
381
|
date: response.date,
|
@@ -382,7 +417,7 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
382
417
|
* When you establish a stored access policy on a share, it may take up to 30 seconds to take effect.
|
383
418
|
* During this interval, a shared access signature that is associated with the stored access policy will
|
384
419
|
* fail with status code 403 (Forbidden), until the access policy becomes active.
|
385
|
-
* @see https://learn.microsoft.com/
|
420
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-share-acl
|
386
421
|
*
|
387
422
|
* @param shareAcl - Array of signed identifiers, each having a unique Id and details of access policy.
|
388
423
|
* @param option - Options to Share Set Access Policy operation.
|
@@ -390,23 +425,26 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
390
425
|
*/
|
391
426
|
async setAccessPolicy(shareAcl, options = {}) {
|
392
427
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
393
|
-
var _a, _b, _c;
|
394
428
|
const acl = [];
|
395
429
|
for (const identifier of shareAcl || []) {
|
396
430
|
acl.push({
|
397
431
|
accessPolicy: {
|
398
|
-
expiresOn:
|
432
|
+
expiresOn: identifier.accessPolicy?.expiresOn
|
399
433
|
? (0, utils_common_js_1.truncatedISO8061Date)(identifier.accessPolicy.expiresOn)
|
400
434
|
: undefined,
|
401
|
-
permissions:
|
402
|
-
startsOn:
|
435
|
+
permissions: identifier.accessPolicy?.permissions,
|
436
|
+
startsOn: identifier.accessPolicy?.startsOn
|
403
437
|
? (0, utils_common_js_1.truncatedISO8061Date)(identifier.accessPolicy.startsOn)
|
404
438
|
: undefined,
|
405
439
|
},
|
406
440
|
id: identifier.id,
|
407
441
|
});
|
408
442
|
}
|
409
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setAccessPolicy(
|
443
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setAccessPolicy({
|
444
|
+
...updatedOptions,
|
445
|
+
...this.shareClientConfig,
|
446
|
+
shareAcl: acl,
|
447
|
+
}));
|
410
448
|
});
|
411
449
|
}
|
412
450
|
/**
|
@@ -417,7 +455,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
417
455
|
*/
|
418
456
|
async createSnapshot(options = {}) {
|
419
457
|
return tracing_js_1.tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
|
420
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.createSnapshot(
|
458
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.createSnapshot({
|
459
|
+
...updatedOptions,
|
460
|
+
...this.shareClientConfig,
|
461
|
+
}));
|
421
462
|
});
|
422
463
|
}
|
423
464
|
/**
|
@@ -431,7 +472,11 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
431
472
|
*/
|
432
473
|
async setQuota(quotaInGB, options = {}) {
|
433
474
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
434
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties(
|
475
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties({
|
476
|
+
...updatedOptions,
|
477
|
+
...this.shareClientConfig,
|
478
|
+
quota: quotaInGB,
|
479
|
+
}));
|
435
480
|
});
|
436
481
|
}
|
437
482
|
/**
|
@@ -442,7 +487,12 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
442
487
|
*/
|
443
488
|
async setProperties(options = {}) {
|
444
489
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
445
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties(
|
490
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties({
|
491
|
+
...options,
|
492
|
+
...this.shareClientConfig,
|
493
|
+
quota: options.quotaInGB,
|
494
|
+
tracingOptions: updatedOptions.tracingOptions,
|
495
|
+
}));
|
446
496
|
});
|
447
497
|
}
|
448
498
|
/**
|
@@ -453,35 +503,44 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
453
503
|
*/
|
454
504
|
async getStatistics(options = {}) {
|
455
505
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
456
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.getStatistics(
|
506
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.getStatistics({
|
507
|
+
...updatedOptions,
|
508
|
+
...this.shareClientConfig,
|
509
|
+
}));
|
457
510
|
const GBBytes = 1024 * 1024 * 1024;
|
458
|
-
return
|
511
|
+
return { ...response, shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) };
|
459
512
|
});
|
460
513
|
}
|
461
514
|
/**
|
462
515
|
* Creates a file permission (a security descriptor) at the share level.
|
463
516
|
* The created security descriptor can be used for the files/directories in the share.
|
464
|
-
* @see https://learn.microsoft.com/
|
517
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-permission
|
465
518
|
*
|
466
519
|
* @param options - Options to Share Create Permission operation.
|
467
520
|
* @param filePermission - File permission described in the SDDL
|
468
521
|
*/
|
469
522
|
async createPermission(filePermission, options = {}) {
|
470
523
|
return tracing_js_1.tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
471
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.createPermission((0, utils_common_js_1.asSharePermission)(filePermission),
|
524
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.createPermission((0, utils_common_js_1.asSharePermission)(filePermission), {
|
525
|
+
...updatedOptions,
|
526
|
+
...this.shareClientConfig,
|
527
|
+
}));
|
472
528
|
});
|
473
529
|
}
|
474
530
|
/**
|
475
531
|
* Gets the Security Descriptor Definition Language (SDDL) for a given file permission key
|
476
532
|
* which indicates a security descriptor.
|
477
|
-
* @see https://learn.microsoft.com/
|
533
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-permission
|
478
534
|
*
|
479
535
|
* @param options - Options to Share Create Permission operation.
|
480
536
|
* @param filePermissionKey - File permission key which indicates the security descriptor of the permission.
|
481
537
|
*/
|
482
538
|
async getPermission(filePermissionKey, options = {}) {
|
483
539
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
484
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getPermission(filePermissionKey,
|
540
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getPermission(filePermissionKey, {
|
541
|
+
...updatedOptions,
|
542
|
+
...this.shareClientConfig,
|
543
|
+
}));
|
485
544
|
});
|
486
545
|
}
|
487
546
|
/**
|
@@ -499,16 +558,19 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
499
558
|
* Generates a Service Shared Access Signature (SAS) URI based on the client properties
|
500
559
|
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
501
560
|
*
|
502
|
-
* @see https://learn.microsoft.com/
|
561
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
|
503
562
|
*
|
504
563
|
* @param options - Optional parameters.
|
505
564
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
506
565
|
*/
|
507
566
|
generateSasUrl(options) {
|
508
|
-
if (!(this.credential instanceof
|
567
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
509
568
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
510
569
|
}
|
511
|
-
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)(
|
570
|
+
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)({
|
571
|
+
shareName: this.name,
|
572
|
+
...options,
|
573
|
+
}, this.credential).toString();
|
512
574
|
return (0, utils_common_js_1.appendToURLQuery)(this.url, sas);
|
513
575
|
}
|
514
576
|
/**
|
@@ -517,17 +579,20 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
517
579
|
* Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
|
518
580
|
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
519
581
|
*
|
520
|
-
* @see https://learn.microsoft.com/
|
582
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
|
521
583
|
*
|
522
584
|
* @param options - Optional parameters.
|
523
585
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
524
586
|
*/
|
525
587
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
526
588
|
generateSasStringToSign(options) {
|
527
|
-
if (!(this.credential instanceof
|
589
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
528
590
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
529
591
|
}
|
530
|
-
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)(
|
592
|
+
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)({
|
593
|
+
shareName: this.name,
|
594
|
+
...options,
|
595
|
+
}, this.credential).stringToSign;
|
531
596
|
}
|
532
597
|
}
|
533
598
|
exports.ShareClient = ShareClient;
|
@@ -535,6 +600,14 @@ exports.ShareClient = ShareClient;
|
|
535
600
|
* A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
|
536
601
|
*/
|
537
602
|
class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
603
|
+
/**
|
604
|
+
* context provided by protocol layer.
|
605
|
+
*/
|
606
|
+
context;
|
607
|
+
_shareName;
|
608
|
+
_path;
|
609
|
+
_name;
|
610
|
+
shareClientConfig;
|
538
611
|
/**
|
539
612
|
* The share name corresponding to this directory client
|
540
613
|
*/
|
@@ -561,13 +634,13 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
561
634
|
if ((0, Pipeline_js_1.isPipelineLike)(credentialOrPipeline)) {
|
562
635
|
pipeline = credentialOrPipeline;
|
563
636
|
}
|
564
|
-
else if (credentialOrPipeline instanceof
|
637
|
+
else if (credentialOrPipeline instanceof storage_common_1.Credential ||
|
565
638
|
(0, core_auth_1.isTokenCredential)(credentialOrPipeline)) {
|
566
639
|
pipeline = (0, Pipeline_js_1.newPipeline)(credentialOrPipeline, options);
|
567
640
|
}
|
568
641
|
else {
|
569
642
|
// The second parameter is undefined. Use anonymous credential.
|
570
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
643
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
571
644
|
}
|
572
645
|
super(url, pipeline);
|
573
646
|
({
|
@@ -580,7 +653,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
580
653
|
}
|
581
654
|
/**
|
582
655
|
* Creates a new directory under the specified share or parent directory.
|
583
|
-
* @see https://learn.microsoft.com/
|
656
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-directory
|
584
657
|
*
|
585
658
|
* @param options - Options to Directory Create operation.
|
586
659
|
* @returns Response data for the Directory operation.
|
@@ -590,36 +663,55 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
590
663
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions)(options);
|
591
664
|
}
|
592
665
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
593
|
-
|
594
|
-
|
666
|
+
const rawResponse = await this.context.create({
|
667
|
+
...updatedOptions,
|
668
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
669
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
670
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
671
|
+
fileAttributes: updatedOptions.fileAttributes
|
595
672
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
596
|
-
: undefined,
|
597
|
-
|
673
|
+
: undefined,
|
674
|
+
owner: updatedOptions.posixProperties?.owner,
|
675
|
+
group: updatedOptions.posixProperties?.group,
|
676
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
677
|
+
...this.shareClientConfig,
|
678
|
+
});
|
679
|
+
const wrappedRes = {
|
680
|
+
...rawResponse,
|
681
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
682
|
+
posixProperties: {
|
598
683
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
599
684
|
fileType: rawResponse.nfsFileType,
|
600
685
|
owner: rawResponse.owner,
|
601
686
|
group: rawResponse.group,
|
602
|
-
}
|
687
|
+
},
|
688
|
+
};
|
603
689
|
return (0, utils_common_js_1.assertResponse)(wrappedRes);
|
604
690
|
});
|
605
691
|
}
|
606
692
|
/**
|
607
693
|
* Creates a new directory under the specified share or parent directory if it does not already exists.
|
608
694
|
* If the directory already exists, it is not modified.
|
609
|
-
* @see https://learn.microsoft.com/
|
695
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-directory
|
610
696
|
*
|
611
697
|
* @param options -
|
612
698
|
*/
|
613
699
|
async createIfNotExists(options = {}) {
|
614
700
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
615
|
-
var _a, _b;
|
616
701
|
try {
|
617
702
|
const res = await this.create(updatedOptions);
|
618
|
-
return
|
703
|
+
return {
|
704
|
+
succeeded: true,
|
705
|
+
...res,
|
706
|
+
};
|
619
707
|
}
|
620
708
|
catch (e) {
|
621
|
-
if (
|
622
|
-
return
|
709
|
+
if (e.details?.errorCode === "ResourceAlreadyExists") {
|
710
|
+
return {
|
711
|
+
succeeded: false,
|
712
|
+
...e.response?.parsedHeaders,
|
713
|
+
_response: e.response,
|
714
|
+
};
|
623
715
|
}
|
624
716
|
throw e;
|
625
717
|
}
|
@@ -627,7 +719,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
627
719
|
}
|
628
720
|
/**
|
629
721
|
* Sets properties on the directory.
|
630
|
-
* @see https://learn.microsoft.com/
|
722
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-directory-properties
|
631
723
|
*
|
632
724
|
* @param DirectoryProperties - Directory properties. If no values are provided,
|
633
725
|
* existing values will be preserved.
|
@@ -635,15 +727,28 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
635
727
|
async setProperties(properties = {}) {
|
636
728
|
properties = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(properties);
|
637
729
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
638
|
-
|
639
|
-
|
730
|
+
const rawResponse = await this.context.setProperties({
|
731
|
+
...updatedOptions,
|
732
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
733
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
734
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
735
|
+
fileAttributes: updatedOptions.fileAttributes
|
640
736
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
641
|
-
: undefined,
|
642
|
-
|
737
|
+
: undefined,
|
738
|
+
owner: updatedOptions.posixProperties?.owner,
|
739
|
+
group: updatedOptions.posixProperties?.group,
|
740
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
741
|
+
...this.shareClientConfig,
|
742
|
+
});
|
743
|
+
return (0, utils_common_js_1.assertResponse)({
|
744
|
+
...rawResponse,
|
745
|
+
_response: rawResponse._response,
|
746
|
+
posixProperties: {
|
643
747
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
644
748
|
owner: rawResponse.owner,
|
645
749
|
group: rawResponse.group,
|
646
|
-
}
|
750
|
+
},
|
751
|
+
});
|
647
752
|
});
|
648
753
|
}
|
649
754
|
/**
|
@@ -678,7 +783,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
678
783
|
}
|
679
784
|
/**
|
680
785
|
* Creates a new subdirectory under this directory.
|
681
|
-
* @see https://learn.microsoft.com/
|
786
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-directory
|
682
787
|
*
|
683
788
|
* @param directoryName -
|
684
789
|
* @param options - Options to Directory Create operation.
|
@@ -697,7 +802,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
697
802
|
/**
|
698
803
|
* Removes the specified empty sub directory under this directory.
|
699
804
|
* Note that the directory must be empty before it can be deleted.
|
700
|
-
* @see https://learn.microsoft.com/
|
805
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-directory
|
701
806
|
*
|
702
807
|
* @param directoryName -
|
703
808
|
* @param options - Options to Directory Delete operation.
|
@@ -711,7 +816,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
711
816
|
}
|
712
817
|
/**
|
713
818
|
* Creates a new file or replaces a file under this directory. Note it only initializes the file with no content.
|
714
|
-
* @see https://learn.microsoft.com/
|
819
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-file
|
715
820
|
*
|
716
821
|
* @param fileName -
|
717
822
|
* @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
|
@@ -740,7 +845,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
740
845
|
* Delete File is not supported on a share snapshot, which is a read-only copy of
|
741
846
|
* a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
|
742
847
|
*
|
743
|
-
* @see https://learn.microsoft.com/
|
848
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-file2
|
744
849
|
*
|
745
850
|
* @param fileName - Name of the file to delete
|
746
851
|
* @param options - Options to File Delete operation.
|
@@ -804,7 +909,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
804
909
|
async exists(options = {}) {
|
805
910
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
806
911
|
try {
|
807
|
-
await this.getProperties(
|
912
|
+
await this.getProperties({ ...updatedOptions, ...this.shareClientConfig });
|
808
913
|
return true;
|
809
914
|
}
|
810
915
|
catch (e) {
|
@@ -819,53 +924,66 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
819
924
|
* Returns all system properties for the specified directory, and can also be used to check the
|
820
925
|
* existence of a directory. The data returned does not include the files in the directory or any
|
821
926
|
* subdirectories.
|
822
|
-
* @see https://learn.microsoft.com/
|
927
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-directory-properties
|
823
928
|
*
|
824
929
|
* @param options - Options to Directory Get Properties operation.
|
825
930
|
* @returns Response data for the Directory Get Properties operation.
|
826
931
|
*/
|
827
932
|
async getProperties(options = {}) {
|
828
933
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
829
|
-
const rawResponse = await this.context.getProperties(
|
830
|
-
|
934
|
+
const rawResponse = await this.context.getProperties({
|
935
|
+
...updatedOptions,
|
936
|
+
...this.shareClientConfig,
|
937
|
+
});
|
938
|
+
return (0, utils_common_js_1.assertResponse)({
|
939
|
+
...rawResponse,
|
940
|
+
_response: rawResponse._response,
|
941
|
+
posixProperties: {
|
831
942
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
832
943
|
owner: rawResponse.owner,
|
833
944
|
group: rawResponse.group,
|
834
945
|
fileType: rawResponse.nfsFileType,
|
835
|
-
}
|
946
|
+
},
|
947
|
+
});
|
836
948
|
});
|
837
949
|
}
|
838
950
|
/**
|
839
951
|
* Removes the specified empty directory. Note that the directory must be empty before it can be
|
840
952
|
* deleted.
|
841
|
-
* @see https://learn.microsoft.com/
|
953
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-directory
|
842
954
|
*
|
843
955
|
* @param options - Options to Directory Delete operation.
|
844
956
|
* @returns Response data for the Directory Delete operation.
|
845
957
|
*/
|
846
958
|
async delete(options = {}) {
|
847
959
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
848
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.delete(
|
960
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
849
961
|
});
|
850
962
|
}
|
851
963
|
/**
|
852
964
|
* Removes the specified empty directory if it exists. Note that the directory must be empty before it can be
|
853
965
|
* deleted.
|
854
|
-
* @see https://learn.microsoft.com/
|
966
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-directory
|
855
967
|
*
|
856
968
|
* @param options -
|
857
969
|
*/
|
858
970
|
async deleteIfExists(options = {}) {
|
859
971
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
860
|
-
var _a, _b, _c;
|
861
972
|
try {
|
862
973
|
const res = await this.delete(updatedOptions);
|
863
|
-
return
|
974
|
+
return {
|
975
|
+
succeeded: true,
|
976
|
+
...res,
|
977
|
+
};
|
864
978
|
}
|
865
979
|
catch (e) {
|
866
|
-
if (
|
867
|
-
|
868
|
-
return
|
980
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
981
|
+
e.details?.errorCode === "ParentNotFound") {
|
982
|
+
return {
|
983
|
+
succeeded: false,
|
984
|
+
...e.response?.parsedHeaders,
|
985
|
+
_response: e.response,
|
986
|
+
};
|
869
987
|
}
|
870
988
|
throw e;
|
871
989
|
}
|
@@ -873,7 +991,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
873
991
|
}
|
874
992
|
/**
|
875
993
|
* Updates user defined metadata for the specified directory.
|
876
|
-
* @see https://learn.microsoft.com/
|
994
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-directory-metadata
|
877
995
|
*
|
878
996
|
* @param metadata - If no metadata provided, all existing directory metadata will be removed
|
879
997
|
* @param options - Options to Directory Set Metadata operation.
|
@@ -881,7 +999,11 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
881
999
|
*/
|
882
1000
|
async setMetadata(metadata, options = {}) {
|
883
1001
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
884
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
1002
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
1003
|
+
...updatedOptions,
|
1004
|
+
metadata,
|
1005
|
+
...this.shareClientConfig,
|
1006
|
+
}));
|
885
1007
|
});
|
886
1008
|
}
|
887
1009
|
/**
|
@@ -896,52 +1018,35 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
896
1018
|
* items. The marker value is opaque to the client.
|
897
1019
|
* @param options - Options to list files and directories operation.
|
898
1020
|
*/
|
899
|
-
iterateFilesAndDirectoriesSegments(
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
} while (marker);
|
910
|
-
});
|
1021
|
+
async *iterateFilesAndDirectoriesSegments(marker, options = {}) {
|
1022
|
+
if (options.prefix === "") {
|
1023
|
+
options.prefix = undefined;
|
1024
|
+
}
|
1025
|
+
let listFilesAndDirectoriesResponse;
|
1026
|
+
do {
|
1027
|
+
listFilesAndDirectoriesResponse = await this.listFilesAndDirectoriesSegment(marker, options);
|
1028
|
+
marker = listFilesAndDirectoriesResponse.continuationToken;
|
1029
|
+
yield await listFilesAndDirectoriesResponse;
|
1030
|
+
} while (marker);
|
911
1031
|
}
|
912
1032
|
/**
|
913
1033
|
* Returns an AsyncIterableIterator for file and directory items
|
914
1034
|
*
|
915
1035
|
* @param options - Options to list files and directories operation.
|
916
1036
|
*/
|
917
|
-
listFilesAndDirectoriesItems() {
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
for (var _d = true, _e = tslib_1.__asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield tslib_1.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
926
|
-
_c = _f.value;
|
927
|
-
_d = false;
|
928
|
-
const listFilesAndDirectoriesResponse = _c;
|
929
|
-
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
930
|
-
yield yield tslib_1.__await(Object.assign({ kind: "file" }, file));
|
931
|
-
}
|
932
|
-
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
933
|
-
yield yield tslib_1.__await(Object.assign({ kind: "directory" }, directory));
|
934
|
-
}
|
935
|
-
}
|
1037
|
+
async *listFilesAndDirectoriesItems(options = {}) {
|
1038
|
+
if (options.prefix === "") {
|
1039
|
+
options.prefix = undefined;
|
1040
|
+
}
|
1041
|
+
let marker;
|
1042
|
+
for await (const listFilesAndDirectoriesResponse of this.iterateFilesAndDirectoriesSegments(marker, options)) {
|
1043
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
1044
|
+
yield { kind: "file", ...file };
|
936
1045
|
}
|
937
|
-
|
938
|
-
|
939
|
-
try {
|
940
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
941
|
-
}
|
942
|
-
finally { if (e_1) throw e_1.error; }
|
1046
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
1047
|
+
yield { kind: "directory", ...directory };
|
943
1048
|
}
|
944
|
-
}
|
1049
|
+
}
|
945
1050
|
}
|
946
1051
|
/**
|
947
1052
|
* Returns an async iterable iterator to list all the files and directories
|
@@ -1109,7 +1214,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1109
1214
|
if (options.prefix === "") {
|
1110
1215
|
options.prefix = undefined;
|
1111
1216
|
}
|
1112
|
-
const updatedOptions =
|
1217
|
+
const updatedOptions = {
|
1218
|
+
...options,
|
1219
|
+
...(include.length > 0 ? { include: include } : {}),
|
1220
|
+
};
|
1113
1221
|
// AsyncIterableIterator to iterate over files and directories
|
1114
1222
|
const iter = this.listFilesAndDirectoriesItems(updatedOptions);
|
1115
1223
|
return {
|
@@ -1129,14 +1237,17 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1129
1237
|
* Return an AsyncIterableIterator that works a page at a time
|
1130
1238
|
*/
|
1131
1239
|
byPage: (settings = {}) => {
|
1132
|
-
return this.iterateFilesAndDirectoriesSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
1240
|
+
return this.iterateFilesAndDirectoriesSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
1241
|
+
maxResults: settings.maxPageSize,
|
1242
|
+
...updatedOptions,
|
1243
|
+
});
|
1133
1244
|
},
|
1134
1245
|
};
|
1135
1246
|
}
|
1136
1247
|
/**
|
1137
1248
|
* Returns a list of files or directories under the specified share or directory. It lists the
|
1138
1249
|
* contents only for a single level of the directory hierarchy.
|
1139
|
-
* @see https://learn.microsoft.com/
|
1250
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/list-directories-and-files
|
1140
1251
|
*
|
1141
1252
|
* @param marker - A string value that identifies the portion of the list to be returned with the next list operation.
|
1142
1253
|
* @param options - Options to Directory List Files and Directories Segment operation.
|
@@ -1147,8 +1258,18 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1147
1258
|
options.prefix = undefined;
|
1148
1259
|
}
|
1149
1260
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1150
|
-
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.listFilesAndDirectoriesSegment(
|
1151
|
-
|
1261
|
+
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.listFilesAndDirectoriesSegment({
|
1262
|
+
...updatedOptions,
|
1263
|
+
marker,
|
1264
|
+
...this.shareClientConfig,
|
1265
|
+
}));
|
1266
|
+
const wrappedResponse = {
|
1267
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListFiles)(rawResponse),
|
1268
|
+
_response: {
|
1269
|
+
...rawResponse._response,
|
1270
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListFiles)(rawResponse._response.parsedBody),
|
1271
|
+
}, // _response is made non-enumerable
|
1272
|
+
};
|
1152
1273
|
return wrappedResponse;
|
1153
1274
|
});
|
1154
1275
|
}
|
@@ -1162,47 +1283,30 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1162
1283
|
* set of list items.
|
1163
1284
|
* @param options - Options to list handles operation.
|
1164
1285
|
*/
|
1165
|
-
iterateHandleSegments(
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
}
|
1175
|
-
});
|
1286
|
+
async *iterateHandleSegments(marker, options = {}) {
|
1287
|
+
let listHandlesResponse;
|
1288
|
+
if (!!marker || marker === undefined) {
|
1289
|
+
do {
|
1290
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
1291
|
+
marker = listHandlesResponse.continuationToken;
|
1292
|
+
yield await listHandlesResponse;
|
1293
|
+
} while (marker);
|
1294
|
+
}
|
1176
1295
|
}
|
1177
1296
|
/**
|
1178
1297
|
* Returns an AsyncIterableIterator for handles
|
1179
1298
|
*
|
1180
1299
|
* @param options - Options to list handles operation.
|
1181
1300
|
*/
|
1182
|
-
listHandleItems() {
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
_c = _f.value;
|
1189
|
-
_d = false;
|
1190
|
-
const listHandlesResponse = _c;
|
1191
|
-
if (listHandlesResponse.handleList) {
|
1192
|
-
for (const handle of listHandlesResponse.handleList) {
|
1193
|
-
yield yield tslib_1.__await(handle);
|
1194
|
-
}
|
1195
|
-
}
|
1301
|
+
async *listHandleItems(options = {}) {
|
1302
|
+
let marker;
|
1303
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
1304
|
+
if (listHandlesResponse.handleList) {
|
1305
|
+
for (const handle of listHandlesResponse.handleList) {
|
1306
|
+
yield handle;
|
1196
1307
|
}
|
1197
1308
|
}
|
1198
|
-
|
1199
|
-
finally {
|
1200
|
-
try {
|
1201
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
1202
|
-
}
|
1203
|
-
finally { if (e_2) throw e_2.error; }
|
1204
|
-
}
|
1205
|
-
});
|
1309
|
+
}
|
1206
1310
|
}
|
1207
1311
|
/**
|
1208
1312
|
* Returns an async iterable iterator to list all the handles.
|
@@ -1347,13 +1451,16 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1347
1451
|
* Return an AsyncIterableIterator that works a page at a time
|
1348
1452
|
*/
|
1349
1453
|
byPage: (settings = {}) => {
|
1350
|
-
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
1454
|
+
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
1455
|
+
maxResults: settings.maxPageSize,
|
1456
|
+
...options,
|
1457
|
+
});
|
1351
1458
|
},
|
1352
1459
|
};
|
1353
1460
|
}
|
1354
1461
|
/**
|
1355
1462
|
* Lists handles for a directory.
|
1356
|
-
* @see https://learn.microsoft.com/
|
1463
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/list-handles
|
1357
1464
|
*
|
1358
1465
|
* @param marker - Optional. A string value that identifies the portion of the list to be
|
1359
1466
|
* returned with the next list handles operation. The operation returns a
|
@@ -1365,19 +1472,29 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1365
1472
|
async listHandlesSegment(marker, options = {}) {
|
1366
1473
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1367
1474
|
marker = marker === "" ? undefined : marker;
|
1368
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles(
|
1475
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles({
|
1476
|
+
...updatedOptions,
|
1477
|
+
marker,
|
1478
|
+
...this.shareClientConfig,
|
1479
|
+
}));
|
1369
1480
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1370
1481
|
// response.handleList is an empty string
|
1371
1482
|
if (response.handleList === "") {
|
1372
1483
|
response.handleList = undefined;
|
1373
1484
|
}
|
1374
|
-
const wrappedResponse =
|
1485
|
+
const wrappedResponse = {
|
1486
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response),
|
1487
|
+
_response: {
|
1488
|
+
...response._response,
|
1489
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response._response.parsedBody),
|
1490
|
+
},
|
1491
|
+
};
|
1375
1492
|
return wrappedResponse;
|
1376
1493
|
});
|
1377
1494
|
}
|
1378
1495
|
/**
|
1379
1496
|
* Force close all handles for a directory.
|
1380
|
-
* @see https://learn.microsoft.com/
|
1497
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
1381
1498
|
*
|
1382
1499
|
* @param marker - Optional. A string value that identifies the position of handles that will
|
1383
1500
|
* be closed with the next force close handles operation.
|
@@ -1388,17 +1505,24 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1388
1505
|
*/
|
1389
1506
|
async forceCloseHandlesSegment(marker, options = {}) {
|
1390
1507
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
1391
|
-
var _a, _b;
|
1392
1508
|
if (marker === "") {
|
1393
1509
|
marker = undefined;
|
1394
1510
|
}
|
1395
|
-
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.forceCloseHandles("*",
|
1396
|
-
|
1511
|
+
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.forceCloseHandles("*", {
|
1512
|
+
...updatedOptions,
|
1513
|
+
marker,
|
1514
|
+
...this.shareClientConfig,
|
1515
|
+
}));
|
1516
|
+
return {
|
1517
|
+
...rawResponse,
|
1518
|
+
closedHandlesCount: rawResponse.numberOfHandlesClosed ?? 0,
|
1519
|
+
closeFailureCount: rawResponse.numberOfHandlesFailedToClose ?? 0,
|
1520
|
+
};
|
1397
1521
|
});
|
1398
1522
|
}
|
1399
1523
|
/**
|
1400
1524
|
* Force close all handles for a directory.
|
1401
|
-
* @see https://learn.microsoft.com/
|
1525
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
1402
1526
|
*
|
1403
1527
|
* @param options -
|
1404
1528
|
*/
|
@@ -1425,7 +1549,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1425
1549
|
}
|
1426
1550
|
/**
|
1427
1551
|
* Force close a specific handle for a directory.
|
1428
|
-
* @see https://learn.microsoft.com/
|
1552
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
1429
1553
|
*
|
1430
1554
|
* @param aborter - Create a new Aborter instance with Aborter.none or Aborter.timeout(),
|
1431
1555
|
* goto documents of Aborter for more examples about request cancellation
|
@@ -1438,7 +1562,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1438
1562
|
if (handleId === "*") {
|
1439
1563
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1440
1564
|
}
|
1441
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
1565
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
1566
|
+
...updatedOptions,
|
1567
|
+
...this.shareClientConfig,
|
1568
|
+
});
|
1442
1569
|
const response = rawResponse;
|
1443
1570
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1444
1571
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -1494,15 +1621,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1494
1621
|
}
|
1495
1622
|
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
1496
1623
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1497
|
-
const response = (0, utils_common_js_1.assertResponse)(await destDirectory.context.rename(this.url,
|
1624
|
+
const response = (0, utils_common_js_1.assertResponse)(await destDirectory.context.rename(this.url, {
|
1625
|
+
...updatedOptions,
|
1626
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1498
1627
|
? {
|
1499
1628
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1500
1629
|
}
|
1501
|
-
: undefined,
|
1630
|
+
: undefined,
|
1631
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
1502
1632
|
? {
|
1503
1633
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1504
1634
|
}
|
1505
|
-
: undefined
|
1635
|
+
: undefined,
|
1636
|
+
...this.shareClientConfig,
|
1637
|
+
}));
|
1506
1638
|
return {
|
1507
1639
|
destinationDirectoryClient: destDirectory,
|
1508
1640
|
directoryRenameResponse: response,
|
@@ -1515,6 +1647,14 @@ exports.ShareDirectoryClient = ShareDirectoryClient;
|
|
1515
1647
|
* A ShareFileClient represents a URL to an Azure Storage file.
|
1516
1648
|
*/
|
1517
1649
|
class ShareFileClient extends StorageClient_js_1.StorageClient {
|
1650
|
+
/**
|
1651
|
+
* context provided by protocol layer.
|
1652
|
+
*/
|
1653
|
+
context;
|
1654
|
+
_shareName;
|
1655
|
+
_path;
|
1656
|
+
_name;
|
1657
|
+
shareClientConfig;
|
1518
1658
|
/**
|
1519
1659
|
* The share name corresponding to this file client
|
1520
1660
|
*/
|
@@ -1541,13 +1681,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1541
1681
|
if ((0, Pipeline_js_1.isPipelineLike)(credentialOrPipeline)) {
|
1542
1682
|
pipeline = credentialOrPipeline;
|
1543
1683
|
}
|
1544
|
-
else if (credentialOrPipeline instanceof
|
1684
|
+
else if (credentialOrPipeline instanceof storage_common_1.Credential ||
|
1545
1685
|
(0, core_auth_1.isTokenCredential)(credentialOrPipeline)) {
|
1546
1686
|
pipeline = (0, Pipeline_js_1.newPipeline)(credentialOrPipeline, options);
|
1547
1687
|
}
|
1548
1688
|
else {
|
1549
1689
|
// The second parameter is undefined. Use anonymous credential.
|
1550
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
1690
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
1551
1691
|
}
|
1552
1692
|
super(url, pipeline);
|
1553
1693
|
({
|
@@ -1570,7 +1710,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1570
1710
|
}
|
1571
1711
|
/**
|
1572
1712
|
* Creates a new file or replaces a file. Note it only initializes the file with no content.
|
1573
|
-
* @see https://learn.microsoft.com/
|
1713
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/create-file
|
1574
1714
|
*
|
1575
1715
|
* @param size - Specifies the maximum size in bytes for the file, up to 4 TB.
|
1576
1716
|
* @param options - Options to File Create operation.
|
@@ -1612,16 +1752,30 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1612
1752
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions)(options);
|
1613
1753
|
options.fileHttpHeaders = options.fileHttpHeaders || {};
|
1614
1754
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1615
|
-
|
1616
|
-
|
1755
|
+
const rawResponse = await this.context.create(size, {
|
1756
|
+
...updatedOptions,
|
1757
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
1758
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
1759
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
1760
|
+
fileAttributes: updatedOptions.fileAttributes
|
1617
1761
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1618
|
-
: undefined,
|
1619
|
-
|
1762
|
+
: undefined,
|
1763
|
+
owner: updatedOptions.posixProperties?.owner,
|
1764
|
+
group: updatedOptions.posixProperties?.group,
|
1765
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
1766
|
+
nfsFileType: updatedOptions.posixProperties?.fileType,
|
1767
|
+
...this.shareClientConfig,
|
1768
|
+
});
|
1769
|
+
const wrappedRes = {
|
1770
|
+
...rawResponse,
|
1771
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1772
|
+
posixProperties: {
|
1620
1773
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1621
1774
|
fileType: rawResponse.nfsFileType,
|
1622
1775
|
owner: rawResponse.owner,
|
1623
1776
|
group: rawResponse.group,
|
1624
|
-
}
|
1777
|
+
},
|
1778
|
+
};
|
1625
1779
|
return (0, utils_common_js_1.assertResponse)(wrappedRes);
|
1626
1780
|
});
|
1627
1781
|
}
|
@@ -1631,7 +1785,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1631
1785
|
* * In Node.js, data returns in a Readable stream `readableStreamBody`
|
1632
1786
|
* * In browsers, data returns in a promise `contentAsBlob`
|
1633
1787
|
*
|
1634
|
-
* @see https://learn.microsoft.com/
|
1788
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-file
|
1635
1789
|
*
|
1636
1790
|
* @param offset - From which position of the file to download, greater than or equal to 0
|
1637
1791
|
* @param count - How much data to be downloaded, greater than 0. Will download to the end when undefined
|
@@ -1711,15 +1865,24 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1711
1865
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1712
1866
|
}
|
1713
1867
|
const downloadFullFile = offset === 0 && !count;
|
1714
|
-
const rawResponse = await this.context.download(
|
1868
|
+
const rawResponse = await this.context.download({
|
1869
|
+
...updatedOptions,
|
1870
|
+
requestOptions: {
|
1715
1871
|
onDownloadProgress: core_util_1.isNodeLike ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1716
|
-
},
|
1717
|
-
|
1872
|
+
},
|
1873
|
+
range: downloadFullFile ? undefined : (0, Range_js_1.rangeToString)({ offset, count }),
|
1874
|
+
...this.shareClientConfig,
|
1875
|
+
});
|
1876
|
+
const res = (0, utils_common_js_1.assertResponse)({
|
1877
|
+
...rawResponse,
|
1878
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1879
|
+
posixProperties: {
|
1718
1880
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1719
1881
|
owner: rawResponse.owner,
|
1720
1882
|
group: rawResponse.group,
|
1721
1883
|
linkCount: rawResponse.linkCount,
|
1722
|
-
}
|
1884
|
+
},
|
1885
|
+
});
|
1723
1886
|
// Return browser response immediately
|
1724
1887
|
if (!core_util_1.isNodeLike) {
|
1725
1888
|
return res;
|
@@ -1749,7 +1912,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1749
1912
|
// chunkDownloadOptions.range
|
1750
1913
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1751
1914
|
// );
|
1752
|
-
const downloadRes = await this.context.download(
|
1915
|
+
const downloadRes = await this.context.download({
|
1916
|
+
...updatedOptions,
|
1917
|
+
...updatedDownloadOptions,
|
1918
|
+
...this.shareClientConfig, // TODO: confirm whether this is needed
|
1919
|
+
});
|
1753
1920
|
if (!(downloadRes.etag === res.etag)) {
|
1754
1921
|
throw new Error("File has been modified concurrently");
|
1755
1922
|
}
|
@@ -1786,26 +1953,33 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1786
1953
|
/**
|
1787
1954
|
* Returns all user-defined metadata, standard HTTP properties, and system properties
|
1788
1955
|
* for the file. It does not return the content of the file.
|
1789
|
-
* @see https://learn.microsoft.com/
|
1956
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/get-file-properties
|
1790
1957
|
*
|
1791
1958
|
* @param options - Options to File Get Properties operation.
|
1792
1959
|
* @returns Response data for the File Get Properties operation.
|
1793
1960
|
*/
|
1794
1961
|
async getProperties(options = {}) {
|
1795
1962
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1796
|
-
const rawResponse = await this.context.getProperties(
|
1797
|
-
|
1963
|
+
const rawResponse = await this.context.getProperties({
|
1964
|
+
...updatedOptions,
|
1965
|
+
...this.shareClientConfig,
|
1966
|
+
});
|
1967
|
+
return (0, utils_common_js_1.assertResponse)({
|
1968
|
+
...rawResponse,
|
1969
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1970
|
+
posixProperties: {
|
1798
1971
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1799
1972
|
fileType: rawResponse.nfsFileType,
|
1800
1973
|
owner: rawResponse.owner,
|
1801
1974
|
group: rawResponse.group,
|
1802
1975
|
linkCount: rawResponse.linkCount,
|
1803
|
-
}
|
1976
|
+
},
|
1977
|
+
});
|
1804
1978
|
});
|
1805
1979
|
}
|
1806
1980
|
/**
|
1807
1981
|
* Sets properties on the file.
|
1808
|
-
* @see https://learn.microsoft.com/
|
1982
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-file-properties
|
1809
1983
|
*
|
1810
1984
|
* @param properties - File properties. For file HTTP headers(e.g. Content-Type),
|
1811
1985
|
* if no values are provided, existing HTTP headers will be removed.
|
@@ -1816,16 +1990,29 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1816
1990
|
properties = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(properties);
|
1817
1991
|
properties.fileHttpHeaders = properties.fileHttpHeaders || {};
|
1818
1992
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1819
|
-
|
1820
|
-
|
1993
|
+
const rawResponse = await this.context.setHttpHeaders({
|
1994
|
+
...updatedOptions,
|
1995
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
1996
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
1997
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
1998
|
+
fileAttributes: updatedOptions.fileAttributes
|
1821
1999
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1822
|
-
: undefined,
|
1823
|
-
|
2000
|
+
: undefined,
|
2001
|
+
owner: updatedOptions.posixProperties?.owner,
|
2002
|
+
group: updatedOptions.posixProperties?.group,
|
2003
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2004
|
+
...this.shareClientConfig,
|
2005
|
+
});
|
2006
|
+
return (0, utils_common_js_1.assertResponse)({
|
2007
|
+
...rawResponse,
|
2008
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2009
|
+
posixProperties: {
|
1824
2010
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1825
2011
|
owner: rawResponse.owner,
|
1826
2012
|
group: rawResponse.group,
|
1827
2013
|
linkCount: rawResponse.linkCount,
|
1828
|
-
}
|
2014
|
+
},
|
2015
|
+
});
|
1829
2016
|
});
|
1830
2017
|
}
|
1831
2018
|
/**
|
@@ -1840,14 +2027,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1840
2027
|
* Delete File is not supported on a share snapshot, which is a read-only copy of
|
1841
2028
|
* a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
|
1842
2029
|
*
|
1843
|
-
* @see https://learn.microsoft.com/
|
2030
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-file2
|
1844
2031
|
*
|
1845
2032
|
* @param options - Options to File Delete operation.
|
1846
2033
|
* @returns Response data for the File Delete operation.
|
1847
2034
|
*/
|
1848
2035
|
async delete(options = {}) {
|
1849
2036
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1850
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.delete(
|
2037
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
1851
2038
|
});
|
1852
2039
|
}
|
1853
2040
|
/**
|
@@ -1862,21 +2049,27 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1862
2049
|
* Delete File is not supported on a share snapshot, which is a read-only copy of
|
1863
2050
|
* a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue)
|
1864
2051
|
*
|
1865
|
-
* @see https://learn.microsoft.com/
|
2052
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/delete-file2
|
1866
2053
|
*
|
1867
2054
|
* @param options -
|
1868
2055
|
*/
|
1869
2056
|
async deleteIfExists(options = {}) {
|
1870
2057
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
1871
|
-
var _a, _b, _c;
|
1872
2058
|
try {
|
1873
2059
|
const res = await this.delete(updatedOptions);
|
1874
|
-
return
|
2060
|
+
return {
|
2061
|
+
succeeded: true,
|
2062
|
+
...res,
|
2063
|
+
};
|
1875
2064
|
}
|
1876
2065
|
catch (e) {
|
1877
|
-
if (
|
1878
|
-
|
1879
|
-
return
|
2066
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
2067
|
+
e.details?.errorCode === "ParentNotFound") {
|
2068
|
+
return {
|
2069
|
+
succeeded: false,
|
2070
|
+
...e.response?.parsedHeaders,
|
2071
|
+
_response: e.response,
|
2072
|
+
};
|
1880
2073
|
}
|
1881
2074
|
throw e;
|
1882
2075
|
}
|
@@ -1887,7 +2080,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1887
2080
|
*
|
1888
2081
|
* If no option provided, or no value provided for the file HTTP headers in the options,
|
1889
2082
|
* these file HTTP headers without a value will be cleared.
|
1890
|
-
* @see https://learn.microsoft.com/
|
2083
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-file-properties
|
1891
2084
|
*
|
1892
2085
|
* @param FileHttpHeaders - File HTTP headers like Content-Type.
|
1893
2086
|
* Provide undefined will remove existing HTTP headers.
|
@@ -1898,22 +2091,36 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1898
2091
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved
|
1899
2092
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(options);
|
1900
2093
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1901
|
-
|
1902
|
-
|
2094
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2095
|
+
...updatedOptions,
|
2096
|
+
fileHttpHeaders,
|
2097
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
2098
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
2099
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
2100
|
+
fileAttributes: updatedOptions.fileAttributes
|
1903
2101
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1904
|
-
: undefined,
|
1905
|
-
|
2102
|
+
: undefined,
|
2103
|
+
owner: updatedOptions.posixProperties?.owner,
|
2104
|
+
group: updatedOptions.posixProperties?.group,
|
2105
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2106
|
+
...this.shareClientConfig,
|
2107
|
+
});
|
2108
|
+
return (0, utils_common_js_1.assertResponse)({
|
2109
|
+
...rawResponse,
|
2110
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2111
|
+
posixProperties: {
|
1906
2112
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1907
2113
|
owner: rawResponse.owner,
|
1908
2114
|
group: rawResponse.group,
|
1909
2115
|
linkCount: rawResponse.linkCount,
|
1910
|
-
}
|
2116
|
+
},
|
2117
|
+
});
|
1911
2118
|
});
|
1912
2119
|
}
|
1913
2120
|
/**
|
1914
2121
|
* Resize file.
|
1915
2122
|
*
|
1916
|
-
* @see https://learn.microsoft.com/
|
2123
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-file-properties
|
1917
2124
|
*
|
1918
2125
|
* @param length - Resizes a file to the specified size in bytes.
|
1919
2126
|
* If the specified byte value is less than the current size of the file,
|
@@ -1928,14 +2135,28 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1928
2135
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1929
2136
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(options);
|
1930
2137
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
2138
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2139
|
+
...updatedOptions,
|
2140
|
+
fileContentLength: length,
|
2141
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(options.changeTime),
|
2142
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(options.creationTime),
|
2143
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(options.lastWriteTime),
|
2144
|
+
fileAttributes: (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes),
|
2145
|
+
owner: updatedOptions.posixProperties?.owner,
|
2146
|
+
group: updatedOptions.posixProperties?.group,
|
2147
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(options.posixProperties?.fileMode),
|
2148
|
+
...this.shareClientConfig,
|
2149
|
+
});
|
2150
|
+
return (0, utils_common_js_1.assertResponse)({
|
2151
|
+
...rawResponse,
|
2152
|
+
_response: rawResponse._response,
|
2153
|
+
posixProperties: {
|
1934
2154
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1935
2155
|
owner: rawResponse.owner,
|
1936
2156
|
group: rawResponse.group,
|
1937
2157
|
linkCount: rawResponse.linkCount,
|
1938
|
-
}
|
2158
|
+
},
|
2159
|
+
});
|
1939
2160
|
});
|
1940
2161
|
}
|
1941
2162
|
/**
|
@@ -1943,7 +2164,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1943
2164
|
*
|
1944
2165
|
* If no metadata defined in the option parameter, the file
|
1945
2166
|
* metadata will be removed.
|
1946
|
-
* @see https://learn.microsoft.com/
|
2167
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/set-file-metadata
|
1947
2168
|
*
|
1948
2169
|
* @param metadata - If no metadata provided, all existing directory metadata will be removed
|
1949
2170
|
* @param options - Options to File Set Metadata operation.
|
@@ -1951,7 +2172,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1951
2172
|
*/
|
1952
2173
|
async setMetadata(metadata = {}, options = {}) {
|
1953
2174
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1954
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
2175
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
2176
|
+
...updatedOptions,
|
2177
|
+
metadata,
|
2178
|
+
...this.shareClientConfig,
|
2179
|
+
}));
|
1955
2180
|
});
|
1956
2181
|
}
|
1957
2182
|
/**
|
@@ -2007,9 +2232,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2007
2232
|
if (contentLength > constants_js_1.FILE_RANGE_MAX_SIZE_BYTES) {
|
2008
2233
|
throw new RangeError(`offset must be < ${constants_js_1.FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2009
2234
|
}
|
2010
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "update", contentLength,
|
2235
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "update", contentLength, {
|
2236
|
+
...updatedOptions,
|
2237
|
+
requestOptions: {
|
2011
2238
|
onUploadProgress: updatedOptions.onProgress,
|
2012
|
-
},
|
2239
|
+
},
|
2240
|
+
body,
|
2241
|
+
...this.shareClientConfig,
|
2242
|
+
}));
|
2013
2243
|
});
|
2014
2244
|
}
|
2015
2245
|
/**
|
@@ -2030,7 +2260,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2030
2260
|
if (count <= 0 || count > constants_js_1.FILE_RANGE_MAX_SIZE_BYTES) {
|
2031
2261
|
throw new RangeError(`count must be > 0 and <= ${constants_js_1.FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2032
2262
|
}
|
2033
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRangeFromURL((0, Range_js_1.rangeToString)({ offset: destOffset, count }), sourceURL, 0,
|
2263
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRangeFromURL((0, Range_js_1.rangeToString)({ offset: destOffset, count }), sourceURL, 0, {
|
2264
|
+
...updatedOptions,
|
2265
|
+
sourceRange: (0, Range_js_1.rangeToString)({ offset: sourceOffset, count }),
|
2266
|
+
sourceModifiedAccessConditions: updatedOptions.sourceConditions,
|
2267
|
+
copySourceAuthorization: (0, utils_common_js_1.httpAuthorizationToString)(updatedOptions.sourceAuthorization),
|
2268
|
+
...this.shareClientConfig,
|
2269
|
+
}));
|
2034
2270
|
});
|
2035
2271
|
}
|
2036
2272
|
/**
|
@@ -2046,7 +2282,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2046
2282
|
if (offset < 0 || contentLength <= 0) {
|
2047
2283
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
2048
2284
|
}
|
2049
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "clear", 0,
|
2285
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "clear", 0, { ...updatedOptions, ...this.shareClientConfig }));
|
2050
2286
|
});
|
2051
2287
|
}
|
2052
2288
|
/**
|
@@ -2056,12 +2292,20 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2056
2292
|
*/
|
2057
2293
|
async getRangeList(options = {}) {
|
2058
2294
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
2059
|
-
const originalResponse = (0, utils_common_js_1.assertResponse)(await this.context.getRangeList(
|
2295
|
+
const originalResponse = (0, utils_common_js_1.assertResponse)(await this.context.getRangeList({
|
2296
|
+
...updatedOptions,
|
2297
|
+
range: updatedOptions.range ? (0, Range_js_1.rangeToString)(updatedOptions.range) : undefined,
|
2298
|
+
...this.shareClientConfig,
|
2299
|
+
}));
|
2060
2300
|
// Only returns ranges, ignoring clearRanges.
|
2061
2301
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
2062
2302
|
? originalResponse._response.parsedBody.ranges
|
2063
2303
|
: [];
|
2064
|
-
return
|
2304
|
+
return {
|
2305
|
+
...originalResponse,
|
2306
|
+
_response: { ...originalResponse._response, parsedBody },
|
2307
|
+
rangeList: originalResponse.ranges ? originalResponse.ranges : [],
|
2308
|
+
};
|
2065
2309
|
});
|
2066
2310
|
}
|
2067
2311
|
/**
|
@@ -2072,7 +2316,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2072
2316
|
*/
|
2073
2317
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
2074
2318
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
2075
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getRangeList(
|
2319
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getRangeList({
|
2320
|
+
...updatedOptions,
|
2321
|
+
prevsharesnapshot: prevShareSnapshot,
|
2322
|
+
supportRename: options.includeRenames,
|
2323
|
+
range: updatedOptions.range ? (0, Range_js_1.rangeToString)(updatedOptions.range) : undefined,
|
2324
|
+
...this.shareClientConfig,
|
2325
|
+
}));
|
2076
2326
|
});
|
2077
2327
|
}
|
2078
2328
|
/**
|
@@ -2089,21 +2339,28 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2089
2339
|
*/
|
2090
2340
|
async startCopyFromURL(copySource, options = {}) {
|
2091
2341
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
2092
|
-
|
2093
|
-
|
2342
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.startCopy(copySource, {
|
2343
|
+
...updatedOptions,
|
2344
|
+
...this.shareClientConfig,
|
2345
|
+
owner: updatedOptions.posixProperties?.owner,
|
2346
|
+
group: updatedOptions.posixProperties?.group,
|
2347
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2348
|
+
fileModeCopyMode: updatedOptions.fileModeCopyMode,
|
2349
|
+
fileOwnerCopyMode: updatedOptions.fileOwnerCopyMode,
|
2350
|
+
}));
|
2094
2351
|
});
|
2095
2352
|
}
|
2096
2353
|
/**
|
2097
2354
|
* Aborts a pending Copy File operation, and leaves a destination file with zero length and full
|
2098
2355
|
* metadata.
|
2099
|
-
* @see https://learn.microsoft.com/
|
2356
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/abort-copy-file
|
2100
2357
|
*
|
2101
2358
|
* @param copyId - Id of the Copy File operation to abort.
|
2102
2359
|
* @param options - Options to File Abort Copy From URL operation.
|
2103
2360
|
*/
|
2104
2361
|
async abortCopyFromURL(copyId, options = {}) {
|
2105
2362
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
2106
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.abortCopy(copyId,
|
2363
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.abortCopy(copyId, { ...updatedOptions, ...this.shareClientConfig }));
|
2107
2364
|
});
|
2108
2365
|
}
|
2109
2366
|
// High Level functions
|
@@ -2429,7 +2686,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2429
2686
|
}
|
2430
2687
|
/**
|
2431
2688
|
* Lists handles for a file.
|
2432
|
-
* @see https://learn.microsoft.com/
|
2689
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/list-handles
|
2433
2690
|
*
|
2434
2691
|
* @param marker - Optional. A string value that identifies the portion of the list to be
|
2435
2692
|
* returned with the next list handles operation. The operation returns a
|
@@ -2441,13 +2698,23 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2441
2698
|
async listHandlesSegment(marker, options = {}) {
|
2442
2699
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2443
2700
|
marker = marker === "" ? undefined : marker;
|
2444
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles(
|
2701
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles({
|
2702
|
+
...updatedOptions,
|
2703
|
+
...this.shareClientConfig,
|
2704
|
+
marker,
|
2705
|
+
}));
|
2445
2706
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2446
2707
|
// response.handleList is an empty string
|
2447
2708
|
if (response.handleList === "") {
|
2448
2709
|
response.handleList = undefined;
|
2449
2710
|
}
|
2450
|
-
const wrappedResponse =
|
2711
|
+
const wrappedResponse = {
|
2712
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response),
|
2713
|
+
_response: {
|
2714
|
+
...response._response,
|
2715
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response._response.parsedBody),
|
2716
|
+
},
|
2717
|
+
};
|
2451
2718
|
return wrappedResponse;
|
2452
2719
|
});
|
2453
2720
|
}
|
@@ -2461,47 +2728,30 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2461
2728
|
* set of list items.
|
2462
2729
|
* @param options - Options to list handles operation.
|
2463
2730
|
*/
|
2464
|
-
iterateHandleSegments(
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
}
|
2474
|
-
});
|
2731
|
+
async *iterateHandleSegments(marker, options = {}) {
|
2732
|
+
let listHandlesResponse;
|
2733
|
+
if (!!marker || marker === undefined) {
|
2734
|
+
do {
|
2735
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
2736
|
+
marker = listHandlesResponse.continuationToken;
|
2737
|
+
yield listHandlesResponse;
|
2738
|
+
} while (marker);
|
2739
|
+
}
|
2475
2740
|
}
|
2476
2741
|
/**
|
2477
2742
|
* Returns an AsyncIterableIterator for handles
|
2478
2743
|
*
|
2479
2744
|
* @param options - Options to list handles operation.
|
2480
2745
|
*/
|
2481
|
-
listHandleItems() {
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
_c = _f.value;
|
2488
|
-
_d = false;
|
2489
|
-
const listHandlesResponse = _c;
|
2490
|
-
if (listHandlesResponse.handleList) {
|
2491
|
-
for (const handle of listHandlesResponse.handleList) {
|
2492
|
-
yield yield tslib_1.__await(handle);
|
2493
|
-
}
|
2494
|
-
}
|
2746
|
+
async *listHandleItems(options = {}) {
|
2747
|
+
let marker;
|
2748
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
2749
|
+
if (listHandlesResponse.handleList) {
|
2750
|
+
for (const handle of listHandlesResponse.handleList) {
|
2751
|
+
yield handle;
|
2495
2752
|
}
|
2496
2753
|
}
|
2497
|
-
|
2498
|
-
finally {
|
2499
|
-
try {
|
2500
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
2501
|
-
}
|
2502
|
-
finally { if (e_3) throw e_3.error; }
|
2503
|
-
}
|
2504
|
-
});
|
2754
|
+
}
|
2505
2755
|
}
|
2506
2756
|
/**
|
2507
2757
|
* Returns an async iterable iterator to list all the handles.
|
@@ -2533,13 +2783,16 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2533
2783
|
* Return an AsyncIterableIterator that works a page at a time
|
2534
2784
|
*/
|
2535
2785
|
byPage: (settings = {}) => {
|
2536
|
-
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
2786
|
+
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
2787
|
+
maxPageSize: settings.maxPageSize,
|
2788
|
+
...options,
|
2789
|
+
});
|
2537
2790
|
},
|
2538
2791
|
};
|
2539
2792
|
}
|
2540
2793
|
/**
|
2541
2794
|
* Force close all handles for a file.
|
2542
|
-
* @see https://learn.microsoft.com/
|
2795
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
2543
2796
|
*
|
2544
2797
|
* @param marker - Optional. A string value that identifies the position of handles that will
|
2545
2798
|
* be closed with the next force close handles operation.
|
@@ -2551,7 +2804,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2551
2804
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2552
2805
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2553
2806
|
marker = marker === "" ? undefined : marker;
|
2554
|
-
const rawResponse = await this.context.forceCloseHandles("*",
|
2807
|
+
const rawResponse = await this.context.forceCloseHandles("*", {
|
2808
|
+
...updatedOptions,
|
2809
|
+
...this.shareClientConfig,
|
2810
|
+
marker,
|
2811
|
+
});
|
2555
2812
|
const response = rawResponse;
|
2556
2813
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2557
2814
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2560,7 +2817,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2560
2817
|
}
|
2561
2818
|
/**
|
2562
2819
|
* Force close all handles for a file.
|
2563
|
-
* @see https://learn.microsoft.com/
|
2820
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
2564
2821
|
*
|
2565
2822
|
* @param options - Options to force close handles operation.
|
2566
2823
|
*/
|
@@ -2587,7 +2844,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2587
2844
|
}
|
2588
2845
|
/**
|
2589
2846
|
* Force close a specific handle for a file.
|
2590
|
-
* @see https://learn.microsoft.com/
|
2847
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/force-close-handles
|
2591
2848
|
*
|
2592
2849
|
* @param handleId - Specific handle ID, cannot be asterisk "*".
|
2593
2850
|
* Use forceCloseAllHandles() to close all handles.
|
@@ -2598,7 +2855,10 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2598
2855
|
if (handleId === "*") {
|
2599
2856
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
2600
2857
|
}
|
2601
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
2858
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
2859
|
+
...updatedOptions,
|
2860
|
+
...this.shareClientConfig,
|
2861
|
+
});
|
2602
2862
|
const response = rawResponse;
|
2603
2863
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2604
2864
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2613,14 +2873,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2613
2873
|
*/
|
2614
2874
|
async createHardLink(targetFile, options = {}) {
|
2615
2875
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-createHardLink", options, async (updatedOptions) => {
|
2616
|
-
const rawResponse = await this.context.createHardLink(targetFile,
|
2617
|
-
|
2876
|
+
const rawResponse = await this.context.createHardLink(targetFile, {
|
2877
|
+
...updatedOptions,
|
2878
|
+
...this.shareClientConfig,
|
2879
|
+
});
|
2880
|
+
return (0, utils_common_js_1.assertResponse)({
|
2881
|
+
...rawResponse,
|
2882
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2883
|
+
posixProperties: {
|
2618
2884
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
2619
2885
|
fileType: rawResponse.nfsFileType,
|
2620
2886
|
owner: rawResponse.owner,
|
2621
2887
|
group: rawResponse.group,
|
2622
2888
|
linkCount: rawResponse.linkCount,
|
2623
|
-
}
|
2889
|
+
},
|
2890
|
+
});
|
2624
2891
|
});
|
2625
2892
|
}
|
2626
2893
|
/**
|
@@ -2632,13 +2899,20 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2632
2899
|
*/
|
2633
2900
|
async createSymbolicLink(linkText, options = {}) {
|
2634
2901
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-createSymbolicLink", options, async (updatedOptions) => {
|
2635
|
-
const rawResponse = await this.context.createSymbolicLink(linkText,
|
2636
|
-
|
2902
|
+
const rawResponse = await this.context.createSymbolicLink(linkText, {
|
2903
|
+
...updatedOptions,
|
2904
|
+
...this.shareClientConfig,
|
2905
|
+
});
|
2906
|
+
return (0, utils_common_js_1.assertResponse)({
|
2907
|
+
...rawResponse,
|
2908
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2909
|
+
posixProperties: {
|
2637
2910
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
2638
2911
|
owner: rawResponse.owner,
|
2639
2912
|
group: rawResponse.group,
|
2640
2913
|
fileType: rawResponse.nfsFileType,
|
2641
|
-
}
|
2914
|
+
},
|
2915
|
+
});
|
2642
2916
|
});
|
2643
2917
|
}
|
2644
2918
|
/**
|
@@ -2647,7 +2921,10 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2647
2921
|
*/
|
2648
2922
|
async getSymbolicLink(options = {}) {
|
2649
2923
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getSymbolicLink", options, async (updatedOptions) => {
|
2650
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getSymbolicLink(
|
2924
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getSymbolicLink({
|
2925
|
+
...updatedOptions,
|
2926
|
+
...this.shareClientConfig,
|
2927
|
+
}));
|
2651
2928
|
});
|
2652
2929
|
}
|
2653
2930
|
/**
|
@@ -2665,16 +2942,20 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2665
2942
|
* Generates a Service Shared Access Signature (SAS) URI based on the client properties
|
2666
2943
|
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
2667
2944
|
*
|
2668
|
-
* @see https://learn.microsoft.com/
|
2945
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
|
2669
2946
|
*
|
2670
2947
|
* @param options - Optional parameters.
|
2671
2948
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
2672
2949
|
*/
|
2673
2950
|
generateSasUrl(options) {
|
2674
|
-
if (!(this.credential instanceof
|
2951
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
2675
2952
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2676
2953
|
}
|
2677
|
-
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)(
|
2954
|
+
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)({
|
2955
|
+
shareName: this.shareName,
|
2956
|
+
filePath: this.path,
|
2957
|
+
...options,
|
2958
|
+
}, this.credential).toString();
|
2678
2959
|
return (0, utils_common_js_1.appendToURLQuery)(this.url, sas);
|
2679
2960
|
}
|
2680
2961
|
/**
|
@@ -2683,17 +2964,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2683
2964
|
* Generates string to sign for a Service Shared Access Signature (SAS) URI based on the client properties
|
2684
2965
|
* and parameters passed in. The SAS is signed by the shared key credential of the client.
|
2685
2966
|
*
|
2686
|
-
* @see https://learn.microsoft.com/
|
2967
|
+
* @see https://learn.microsoft.com/rest/api/storageservices/constructing-a-service-sas
|
2687
2968
|
*
|
2688
2969
|
* @param options - Optional parameters.
|
2689
2970
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
2690
2971
|
*/
|
2691
2972
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
2692
2973
|
generateSasStringToSign(options) {
|
2693
|
-
if (!(this.credential instanceof
|
2974
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
2694
2975
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2695
2976
|
}
|
2696
|
-
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)(
|
2977
|
+
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)({
|
2978
|
+
shareName: this.shareName,
|
2979
|
+
filePath: this.path,
|
2980
|
+
...options,
|
2981
|
+
}, this.credential).stringToSign;
|
2697
2982
|
}
|
2698
2983
|
/**
|
2699
2984
|
* Renames a file.
|
@@ -2748,19 +3033,25 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2748
3033
|
}
|
2749
3034
|
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
2750
3035
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2751
|
-
const response = (0, utils_common_js_1.assertResponse)(await destFile.context.rename(this.url,
|
3036
|
+
const response = (0, utils_common_js_1.assertResponse)(await destFile.context.rename(this.url, {
|
3037
|
+
...updatedOptions,
|
3038
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2752
3039
|
? {
|
2753
3040
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
2754
3041
|
}
|
2755
|
-
: undefined,
|
3042
|
+
: undefined,
|
3043
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
2756
3044
|
? {
|
2757
3045
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
2758
3046
|
}
|
2759
|
-
: undefined,
|
3047
|
+
: undefined,
|
3048
|
+
fileHttpHeaders: options.contentType
|
2760
3049
|
? {
|
2761
3050
|
fileContentType: options.contentType,
|
2762
3051
|
}
|
2763
|
-
: undefined
|
3052
|
+
: undefined,
|
3053
|
+
...this.shareClientConfig,
|
3054
|
+
}));
|
2764
3055
|
return {
|
2765
3056
|
destinationFileClient: destFile,
|
2766
3057
|
fileRenameResponse: response,
|
@@ -2776,6 +3067,10 @@ exports.ShareFileClient = ShareFileClient;
|
|
2776
3067
|
* @see https://learn.microsoft.com/rest/api/storageservices/lease-share
|
2777
3068
|
*/
|
2778
3069
|
class ShareLeaseClient {
|
3070
|
+
_leaseId;
|
3071
|
+
_url;
|
3072
|
+
fileOrShare;
|
3073
|
+
shareClientConfig;
|
2779
3074
|
/**
|
2780
3075
|
* Gets the lease Id.
|
2781
3076
|
*
|
@@ -2822,7 +3117,12 @@ class ShareLeaseClient {
|
|
2822
3117
|
*/
|
2823
3118
|
async acquireLease(duration = -1, options = {}) {
|
2824
3119
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2825
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.acquireLease(
|
3120
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.acquireLease({
|
3121
|
+
...updatedOptions,
|
3122
|
+
...this.shareClientConfig,
|
3123
|
+
duration,
|
3124
|
+
proposedLeaseId: this._leaseId,
|
3125
|
+
}));
|
2826
3126
|
});
|
2827
3127
|
}
|
2828
3128
|
/**
|
@@ -2834,7 +3134,11 @@ class ShareLeaseClient {
|
|
2834
3134
|
*/
|
2835
3135
|
async changeLease(proposedLeaseId, options = {}) {
|
2836
3136
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2837
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.fileOrShare.changeLease(this._leaseId,
|
3137
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.fileOrShare.changeLease(this._leaseId, {
|
3138
|
+
...updatedOptions,
|
3139
|
+
...this.shareClientConfig,
|
3140
|
+
proposedLeaseId,
|
3141
|
+
}));
|
2838
3142
|
this._leaseId = proposedLeaseId;
|
2839
3143
|
return response;
|
2840
3144
|
});
|
@@ -2848,7 +3152,10 @@ class ShareLeaseClient {
|
|
2848
3152
|
*/
|
2849
3153
|
async releaseLease(options = {}) {
|
2850
3154
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
|
2851
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.releaseLease(this._leaseId,
|
3155
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.releaseLease(this._leaseId, {
|
3156
|
+
...updatedOptions,
|
3157
|
+
...this.shareClientConfig,
|
3158
|
+
}));
|
2852
3159
|
});
|
2853
3160
|
}
|
2854
3161
|
/**
|
@@ -2859,7 +3166,10 @@ class ShareLeaseClient {
|
|
2859
3166
|
*/
|
2860
3167
|
async breakLease(options = {}) {
|
2861
3168
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
|
2862
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.breakLease(
|
3169
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.breakLease({
|
3170
|
+
...updatedOptions,
|
3171
|
+
...this.shareClientConfig,
|
3172
|
+
}));
|
2863
3173
|
});
|
2864
3174
|
}
|
2865
3175
|
/**
|
@@ -2875,7 +3185,10 @@ class ShareLeaseClient {
|
|
2875
3185
|
if (isFile(this.fileOrShare)) {
|
2876
3186
|
throw new RangeError("The renewLease operation is not available for lease on file.");
|
2877
3187
|
}
|
2878
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.renewLease(this._leaseId,
|
3188
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.renewLease(this._leaseId, {
|
3189
|
+
...updatedOptions,
|
3190
|
+
...this.shareClientConfig,
|
3191
|
+
}));
|
2879
3192
|
});
|
2880
3193
|
}
|
2881
3194
|
}
|