@azure/storage-file-share 12.29.0-beta.1 → 12.29.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.js +32 -34
- package/dist/browser/AccountSASPermissions.js.map +1 -1
- package/dist/browser/AccountSASResourceTypes.js +12 -14
- 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 +1 -1
- package/dist/browser/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/AccountSASSignatureValues.js.map +1 -1
- package/dist/browser/Clients.d.ts +3 -2
- package/dist/browser/Clients.d.ts.map +1 -1
- package/dist/browser/Clients.js +555 -242
- 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 +1 -1
- package/dist/browser/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/browser/FileSASSignatureValues.js.map +1 -1
- package/dist/browser/FileSystemAttributes.js +43 -45
- 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/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.js +20 -22
- package/dist/browser/ShareSASPermissions.js.map +1 -1
- package/dist/browser/ShareServiceClient.d.ts +1 -1
- package/dist/browser/ShareServiceClient.d.ts.map +1 -1
- package/dist/browser/ShareServiceClient.js +66 -50
- 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.js +31 -15
- package/dist/browser/utils/utils.common.js.map +1 -1
- package/dist/commonjs/AccountSASPermissions.js +32 -34
- package/dist/commonjs/AccountSASPermissions.js.map +1 -1
- package/dist/commonjs/AccountSASResourceTypes.js +12 -14
- 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 +1 -1
- package/dist/commonjs/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/AccountSASSignatureValues.js.map +1 -1
- package/dist/commonjs/Clients.d.ts +3 -2
- package/dist/commonjs/Clients.d.ts.map +1 -1
- package/dist/commonjs/Clients.js +567 -254
- 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 +1 -1
- package/dist/commonjs/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/commonjs/FileSASSignatureValues.js.map +1 -1
- package/dist/commonjs/FileSystemAttributes.js +43 -45
- 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/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.js +20 -22
- package/dist/commonjs/ShareSASPermissions.js.map +1 -1
- package/dist/commonjs/ShareServiceClient.d.ts +1 -1
- package/dist/commonjs/ShareServiceClient.d.ts.map +1 -1
- package/dist/commonjs/ShareServiceClient.js +72 -56
- 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.js +31 -15
- 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.js +32 -34
- package/dist/esm/AccountSASPermissions.js.map +1 -1
- package/dist/esm/AccountSASResourceTypes.js +12 -14
- 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 +1 -1
- package/dist/esm/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/AccountSASSignatureValues.js.map +1 -1
- package/dist/esm/Clients.d.ts +3 -2
- package/dist/esm/Clients.d.ts.map +1 -1
- package/dist/esm/Clients.js +555 -242
- 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 +1 -1
- package/dist/esm/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/esm/FileSASSignatureValues.js.map +1 -1
- package/dist/esm/FileSystemAttributes.js +43 -45
- 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/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.js +20 -22
- package/dist/esm/ShareSASPermissions.js.map +1 -1
- package/dist/esm/ShareServiceClient.d.ts +1 -1
- package/dist/esm/ShareServiceClient.d.ts.map +1 -1
- package/dist/esm/ShareServiceClient.js +66 -50
- 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.js +31 -15
- 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.js +32 -34
- package/dist/react-native/AccountSASPermissions.js.map +1 -1
- package/dist/react-native/AccountSASResourceTypes.js +12 -14
- 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 +1 -1
- package/dist/react-native/AccountSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/AccountSASSignatureValues.js.map +1 -1
- package/dist/react-native/Clients.d.ts +3 -2
- package/dist/react-native/Clients.d.ts.map +1 -1
- package/dist/react-native/Clients.js +555 -242
- 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 +1 -1
- package/dist/react-native/FileSASSignatureValues.d.ts.map +1 -1
- package/dist/react-native/FileSASSignatureValues.js.map +1 -1
- package/dist/react-native/FileSystemAttributes.js +43 -45
- 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/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.js +20 -22
- package/dist/react-native/ShareSASPermissions.js.map +1 -1
- package/dist/react-native/ShareServiceClient.d.ts +1 -1
- package/dist/react-native/ShareServiceClient.d.ts.map +1 -1
- package/dist/react-native/ShareServiceClient.js +66 -50
- 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.js +31 -15
- 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 +36 -36
- 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 -218
- 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 -174
- 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 -223
- 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 -178
- 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 -218
- 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 -174
- 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 -218
- 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 -174
- 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");
|
@@ -106,7 +111,11 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -118,14 +127,20 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
}
|
@@ -272,7 +287,11 @@ 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
|
/**
|
@@ -285,7 +304,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -297,15 +319,21 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
297
319
|
*/
|
298
320
|
async deleteIfExists(options = {}) {
|
299
321
|
return tracing_js_1.tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
300
|
-
var _a, _b, _c;
|
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
|
-
|
308
|
-
return
|
330
|
+
if (e.details?.errorCode === "ShareNotFound" ||
|
331
|
+
e.details?.errorCode === "ShareSnapshotNotFound") {
|
332
|
+
return {
|
333
|
+
succeeded: false,
|
334
|
+
...e.response?.parsedHeaders,
|
335
|
+
_response: e.response,
|
336
|
+
};
|
309
337
|
}
|
310
338
|
throw e;
|
311
339
|
}
|
@@ -324,7 +352,11 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
324
352
|
*/
|
325
353
|
async setMetadata(metadata, options = {}) {
|
326
354
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
327
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
355
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
356
|
+
...updatedOptions,
|
357
|
+
...this.shareClientConfig,
|
358
|
+
metadata,
|
359
|
+
}));
|
328
360
|
});
|
329
361
|
}
|
330
362
|
/**
|
@@ -341,7 +373,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
341
373
|
*/
|
342
374
|
async getAccessPolicy(options = {}) {
|
343
375
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
344
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.getAccessPolicy(
|
376
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.getAccessPolicy({
|
377
|
+
...updatedOptions,
|
378
|
+
...this.shareClientConfig,
|
379
|
+
}));
|
345
380
|
const res = {
|
346
381
|
_response: response._response,
|
347
382
|
date: response.date,
|
@@ -391,23 +426,26 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
391
426
|
*/
|
392
427
|
async setAccessPolicy(shareAcl, options = {}) {
|
393
428
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
394
|
-
var _a, _b, _c;
|
395
429
|
const acl = [];
|
396
430
|
for (const identifier of shareAcl || []) {
|
397
431
|
acl.push({
|
398
432
|
accessPolicy: {
|
399
|
-
expiresOn:
|
433
|
+
expiresOn: identifier.accessPolicy?.expiresOn
|
400
434
|
? (0, utils_common_js_1.truncatedISO8061Date)(identifier.accessPolicy.expiresOn)
|
401
435
|
: undefined,
|
402
|
-
permissions:
|
403
|
-
startsOn:
|
436
|
+
permissions: identifier.accessPolicy?.permissions,
|
437
|
+
startsOn: identifier.accessPolicy?.startsOn
|
404
438
|
? (0, utils_common_js_1.truncatedISO8061Date)(identifier.accessPolicy.startsOn)
|
405
439
|
: undefined,
|
406
440
|
},
|
407
441
|
id: identifier.id,
|
408
442
|
});
|
409
443
|
}
|
410
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setAccessPolicy(
|
444
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setAccessPolicy({
|
445
|
+
...updatedOptions,
|
446
|
+
...this.shareClientConfig,
|
447
|
+
shareAcl: acl,
|
448
|
+
}));
|
411
449
|
});
|
412
450
|
}
|
413
451
|
/**
|
@@ -418,7 +456,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
418
456
|
*/
|
419
457
|
async createSnapshot(options = {}) {
|
420
458
|
return tracing_js_1.tracingClient.withSpan("ShareClient-createSnapshot", options, async (updatedOptions) => {
|
421
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.createSnapshot(
|
459
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.createSnapshot({
|
460
|
+
...updatedOptions,
|
461
|
+
...this.shareClientConfig,
|
462
|
+
}));
|
422
463
|
});
|
423
464
|
}
|
424
465
|
/**
|
@@ -432,7 +473,11 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
432
473
|
*/
|
433
474
|
async setQuota(quotaInGB, options = {}) {
|
434
475
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
435
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties(
|
476
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties({
|
477
|
+
...updatedOptions,
|
478
|
+
...this.shareClientConfig,
|
479
|
+
quota: quotaInGB,
|
480
|
+
}));
|
436
481
|
});
|
437
482
|
}
|
438
483
|
/**
|
@@ -443,7 +488,12 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
443
488
|
*/
|
444
489
|
async setProperties(options = {}) {
|
445
490
|
return tracing_js_1.tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
446
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties(
|
491
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setProperties({
|
492
|
+
...options,
|
493
|
+
...this.shareClientConfig,
|
494
|
+
quota: options.quotaInGB,
|
495
|
+
tracingOptions: updatedOptions.tracingOptions,
|
496
|
+
}));
|
447
497
|
});
|
448
498
|
}
|
449
499
|
/**
|
@@ -454,9 +504,12 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
454
504
|
*/
|
455
505
|
async getStatistics(options = {}) {
|
456
506
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
457
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.getStatistics(
|
507
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.getStatistics({
|
508
|
+
...updatedOptions,
|
509
|
+
...this.shareClientConfig,
|
510
|
+
}));
|
458
511
|
const GBBytes = 1024 * 1024 * 1024;
|
459
|
-
return
|
512
|
+
return { ...response, shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) };
|
460
513
|
});
|
461
514
|
}
|
462
515
|
/**
|
@@ -469,7 +522,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
469
522
|
*/
|
470
523
|
async createPermission(filePermission, options = {}) {
|
471
524
|
return tracing_js_1.tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
472
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.createPermission((0, utils_common_js_1.asSharePermission)(filePermission),
|
525
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.createPermission((0, utils_common_js_1.asSharePermission)(filePermission), {
|
526
|
+
...updatedOptions,
|
527
|
+
...this.shareClientConfig,
|
528
|
+
}));
|
473
529
|
});
|
474
530
|
}
|
475
531
|
/**
|
@@ -482,7 +538,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
482
538
|
*/
|
483
539
|
async getPermission(filePermissionKey, options = {}) {
|
484
540
|
return tracing_js_1.tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
485
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getPermission(filePermissionKey,
|
541
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getPermission(filePermissionKey, {
|
542
|
+
...updatedOptions,
|
543
|
+
...this.shareClientConfig,
|
544
|
+
}));
|
486
545
|
});
|
487
546
|
}
|
488
547
|
/**
|
@@ -506,10 +565,13 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
506
565
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
507
566
|
*/
|
508
567
|
generateSasUrl(options) {
|
509
|
-
if (!(this.credential instanceof
|
568
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
510
569
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
511
570
|
}
|
512
|
-
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)(
|
571
|
+
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)({
|
572
|
+
shareName: this.name,
|
573
|
+
...options,
|
574
|
+
}, this.credential).toString();
|
513
575
|
return (0, utils_common_js_1.appendToURLQuery)(this.url, sas);
|
514
576
|
}
|
515
577
|
/**
|
@@ -525,10 +587,13 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
525
587
|
*/
|
526
588
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
527
589
|
generateSasStringToSign(options) {
|
528
|
-
if (!(this.credential instanceof
|
590
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
529
591
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
530
592
|
}
|
531
|
-
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)(
|
593
|
+
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)({
|
594
|
+
shareName: this.name,
|
595
|
+
...options,
|
596
|
+
}, this.credential).stringToSign;
|
532
597
|
}
|
533
598
|
}
|
534
599
|
exports.ShareClient = ShareClient;
|
@@ -536,6 +601,14 @@ exports.ShareClient = ShareClient;
|
|
536
601
|
* A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories.
|
537
602
|
*/
|
538
603
|
class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
604
|
+
/**
|
605
|
+
* context provided by protocol layer.
|
606
|
+
*/
|
607
|
+
context;
|
608
|
+
_shareName;
|
609
|
+
_path;
|
610
|
+
_name;
|
611
|
+
shareClientConfig;
|
539
612
|
/**
|
540
613
|
* The share name corresponding to this directory client
|
541
614
|
*/
|
@@ -562,13 +635,13 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
562
635
|
if ((0, Pipeline_js_1.isPipelineLike)(credentialOrPipeline)) {
|
563
636
|
pipeline = credentialOrPipeline;
|
564
637
|
}
|
565
|
-
else if (credentialOrPipeline instanceof
|
638
|
+
else if (credentialOrPipeline instanceof storage_common_1.Credential ||
|
566
639
|
(0, core_auth_1.isTokenCredential)(credentialOrPipeline)) {
|
567
640
|
pipeline = (0, Pipeline_js_1.newPipeline)(credentialOrPipeline, options);
|
568
641
|
}
|
569
642
|
else {
|
570
643
|
// The second parameter is undefined. Use anonymous credential.
|
571
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
644
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
572
645
|
}
|
573
646
|
super(url, pipeline);
|
574
647
|
({
|
@@ -591,16 +664,29 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
591
664
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions)(options);
|
592
665
|
}
|
593
666
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
594
|
-
|
595
|
-
|
667
|
+
const rawResponse = await this.context.create({
|
668
|
+
...updatedOptions,
|
669
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
670
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
671
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
672
|
+
fileAttributes: updatedOptions.fileAttributes
|
596
673
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
597
|
-
: undefined,
|
598
|
-
|
674
|
+
: undefined,
|
675
|
+
owner: updatedOptions.posixProperties?.owner,
|
676
|
+
group: updatedOptions.posixProperties?.group,
|
677
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
678
|
+
...this.shareClientConfig,
|
679
|
+
});
|
680
|
+
const wrappedRes = {
|
681
|
+
...rawResponse,
|
682
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
683
|
+
posixProperties: {
|
599
684
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
600
685
|
fileType: rawResponse.nfsFileType,
|
601
686
|
owner: rawResponse.owner,
|
602
687
|
group: rawResponse.group,
|
603
|
-
}
|
688
|
+
},
|
689
|
+
};
|
604
690
|
return (0, utils_common_js_1.assertResponse)(wrappedRes);
|
605
691
|
});
|
606
692
|
}
|
@@ -613,14 +699,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
613
699
|
*/
|
614
700
|
async createIfNotExists(options = {}) {
|
615
701
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
616
|
-
var _a, _b;
|
617
702
|
try {
|
618
703
|
const res = await this.create(updatedOptions);
|
619
|
-
return
|
704
|
+
return {
|
705
|
+
succeeded: true,
|
706
|
+
...res,
|
707
|
+
};
|
620
708
|
}
|
621
709
|
catch (e) {
|
622
|
-
if (
|
623
|
-
return
|
710
|
+
if (e.details?.errorCode === "ResourceAlreadyExists") {
|
711
|
+
return {
|
712
|
+
succeeded: false,
|
713
|
+
...e.response?.parsedHeaders,
|
714
|
+
_response: e.response,
|
715
|
+
};
|
624
716
|
}
|
625
717
|
throw e;
|
626
718
|
}
|
@@ -636,15 +728,28 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
636
728
|
async setProperties(properties = {}) {
|
637
729
|
properties = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(properties);
|
638
730
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
639
|
-
|
640
|
-
|
731
|
+
const rawResponse = await this.context.setProperties({
|
732
|
+
...updatedOptions,
|
733
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
734
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
735
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
736
|
+
fileAttributes: updatedOptions.fileAttributes
|
641
737
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
642
|
-
: undefined,
|
643
|
-
|
738
|
+
: undefined,
|
739
|
+
owner: updatedOptions.posixProperties?.owner,
|
740
|
+
group: updatedOptions.posixProperties?.group,
|
741
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
742
|
+
...this.shareClientConfig,
|
743
|
+
});
|
744
|
+
return (0, utils_common_js_1.assertResponse)({
|
745
|
+
...rawResponse,
|
746
|
+
_response: rawResponse._response,
|
747
|
+
posixProperties: {
|
644
748
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
645
749
|
owner: rawResponse.owner,
|
646
750
|
group: rawResponse.group,
|
647
|
-
}
|
751
|
+
},
|
752
|
+
});
|
648
753
|
});
|
649
754
|
}
|
650
755
|
/**
|
@@ -805,7 +910,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
805
910
|
async exists(options = {}) {
|
806
911
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
807
912
|
try {
|
808
|
-
await this.getProperties(
|
913
|
+
await this.getProperties({ ...updatedOptions, ...this.shareClientConfig });
|
809
914
|
return true;
|
810
915
|
}
|
811
916
|
catch (e) {
|
@@ -827,13 +932,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
827
932
|
*/
|
828
933
|
async getProperties(options = {}) {
|
829
934
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
830
|
-
const rawResponse = await this.context.getProperties(
|
831
|
-
|
935
|
+
const rawResponse = await this.context.getProperties({
|
936
|
+
...updatedOptions,
|
937
|
+
...this.shareClientConfig,
|
938
|
+
});
|
939
|
+
return (0, utils_common_js_1.assertResponse)({
|
940
|
+
...rawResponse,
|
941
|
+
_response: rawResponse._response,
|
942
|
+
posixProperties: {
|
832
943
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
833
944
|
owner: rawResponse.owner,
|
834
945
|
group: rawResponse.group,
|
835
946
|
fileType: rawResponse.nfsFileType,
|
836
|
-
}
|
947
|
+
},
|
948
|
+
});
|
837
949
|
});
|
838
950
|
}
|
839
951
|
/**
|
@@ -846,7 +958,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
846
958
|
*/
|
847
959
|
async delete(options = {}) {
|
848
960
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
849
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.delete(
|
961
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
850
962
|
});
|
851
963
|
}
|
852
964
|
/**
|
@@ -858,15 +970,21 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
858
970
|
*/
|
859
971
|
async deleteIfExists(options = {}) {
|
860
972
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
861
|
-
var _a, _b, _c;
|
862
973
|
try {
|
863
974
|
const res = await this.delete(updatedOptions);
|
864
|
-
return
|
975
|
+
return {
|
976
|
+
succeeded: true,
|
977
|
+
...res,
|
978
|
+
};
|
865
979
|
}
|
866
980
|
catch (e) {
|
867
|
-
if (
|
868
|
-
|
869
|
-
return
|
981
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
982
|
+
e.details?.errorCode === "ParentNotFound") {
|
983
|
+
return {
|
984
|
+
succeeded: false,
|
985
|
+
...e.response?.parsedHeaders,
|
986
|
+
_response: e.response,
|
987
|
+
};
|
870
988
|
}
|
871
989
|
throw e;
|
872
990
|
}
|
@@ -882,7 +1000,11 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
882
1000
|
*/
|
883
1001
|
async setMetadata(metadata, options = {}) {
|
884
1002
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
885
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
1003
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
1004
|
+
...updatedOptions,
|
1005
|
+
metadata,
|
1006
|
+
...this.shareClientConfig,
|
1007
|
+
}));
|
886
1008
|
});
|
887
1009
|
}
|
888
1010
|
/**
|
@@ -897,52 +1019,35 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
897
1019
|
* items. The marker value is opaque to the client.
|
898
1020
|
* @param options - Options to list files and directories operation.
|
899
1021
|
*/
|
900
|
-
iterateFilesAndDirectoriesSegments(
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
} while (marker);
|
911
|
-
});
|
1022
|
+
async *iterateFilesAndDirectoriesSegments(marker, options = {}) {
|
1023
|
+
if (options.prefix === "") {
|
1024
|
+
options.prefix = undefined;
|
1025
|
+
}
|
1026
|
+
let listFilesAndDirectoriesResponse;
|
1027
|
+
do {
|
1028
|
+
listFilesAndDirectoriesResponse = await this.listFilesAndDirectoriesSegment(marker, options);
|
1029
|
+
marker = listFilesAndDirectoriesResponse.continuationToken;
|
1030
|
+
yield await listFilesAndDirectoriesResponse;
|
1031
|
+
} while (marker);
|
912
1032
|
}
|
913
1033
|
/**
|
914
1034
|
* Returns an AsyncIterableIterator for file and directory items
|
915
1035
|
*
|
916
1036
|
* @param options - Options to list files and directories operation.
|
917
1037
|
*/
|
918
|
-
listFilesAndDirectoriesItems() {
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
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) {
|
927
|
-
_c = _f.value;
|
928
|
-
_d = false;
|
929
|
-
const listFilesAndDirectoriesResponse = _c;
|
930
|
-
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
931
|
-
yield yield tslib_1.__await(Object.assign({ kind: "file" }, file));
|
932
|
-
}
|
933
|
-
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
934
|
-
yield yield tslib_1.__await(Object.assign({ kind: "directory" }, directory));
|
935
|
-
}
|
936
|
-
}
|
1038
|
+
async *listFilesAndDirectoriesItems(options = {}) {
|
1039
|
+
if (options.prefix === "") {
|
1040
|
+
options.prefix = undefined;
|
1041
|
+
}
|
1042
|
+
let marker;
|
1043
|
+
for await (const listFilesAndDirectoriesResponse of this.iterateFilesAndDirectoriesSegments(marker, options)) {
|
1044
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
1045
|
+
yield { kind: "file", ...file };
|
937
1046
|
}
|
938
|
-
|
939
|
-
|
940
|
-
try {
|
941
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
942
|
-
}
|
943
|
-
finally { if (e_1) throw e_1.error; }
|
1047
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
1048
|
+
yield { kind: "directory", ...directory };
|
944
1049
|
}
|
945
|
-
}
|
1050
|
+
}
|
946
1051
|
}
|
947
1052
|
/**
|
948
1053
|
* Returns an async iterable iterator to list all the files and directories
|
@@ -1110,7 +1215,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1110
1215
|
if (options.prefix === "") {
|
1111
1216
|
options.prefix = undefined;
|
1112
1217
|
}
|
1113
|
-
const updatedOptions =
|
1218
|
+
const updatedOptions = {
|
1219
|
+
...options,
|
1220
|
+
...(include.length > 0 ? { include: include } : {}),
|
1221
|
+
};
|
1114
1222
|
// AsyncIterableIterator to iterate over files and directories
|
1115
1223
|
const iter = this.listFilesAndDirectoriesItems(updatedOptions);
|
1116
1224
|
return {
|
@@ -1130,7 +1238,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1130
1238
|
* Return an AsyncIterableIterator that works a page at a time
|
1131
1239
|
*/
|
1132
1240
|
byPage: (settings = {}) => {
|
1133
|
-
return this.iterateFilesAndDirectoriesSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
1241
|
+
return this.iterateFilesAndDirectoriesSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
1242
|
+
maxResults: settings.maxPageSize,
|
1243
|
+
...updatedOptions,
|
1244
|
+
});
|
1134
1245
|
},
|
1135
1246
|
};
|
1136
1247
|
}
|
@@ -1148,8 +1259,18 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1148
1259
|
options.prefix = undefined;
|
1149
1260
|
}
|
1150
1261
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1151
|
-
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.listFilesAndDirectoriesSegment(
|
1152
|
-
|
1262
|
+
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.listFilesAndDirectoriesSegment({
|
1263
|
+
...updatedOptions,
|
1264
|
+
marker,
|
1265
|
+
...this.shareClientConfig,
|
1266
|
+
}));
|
1267
|
+
const wrappedResponse = {
|
1268
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListFiles)(rawResponse),
|
1269
|
+
_response: {
|
1270
|
+
...rawResponse._response,
|
1271
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListFiles)(rawResponse._response.parsedBody),
|
1272
|
+
}, // _response is made non-enumerable
|
1273
|
+
};
|
1153
1274
|
return wrappedResponse;
|
1154
1275
|
});
|
1155
1276
|
}
|
@@ -1163,47 +1284,30 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1163
1284
|
* set of list items.
|
1164
1285
|
* @param options - Options to list handles operation.
|
1165
1286
|
*/
|
1166
|
-
iterateHandleSegments(
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
}
|
1176
|
-
});
|
1287
|
+
async *iterateHandleSegments(marker, options = {}) {
|
1288
|
+
let listHandlesResponse;
|
1289
|
+
if (!!marker || marker === undefined) {
|
1290
|
+
do {
|
1291
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
1292
|
+
marker = listHandlesResponse.continuationToken;
|
1293
|
+
yield await listHandlesResponse;
|
1294
|
+
} while (marker);
|
1295
|
+
}
|
1177
1296
|
}
|
1178
1297
|
/**
|
1179
1298
|
* Returns an AsyncIterableIterator for handles
|
1180
1299
|
*
|
1181
1300
|
* @param options - Options to list handles operation.
|
1182
1301
|
*/
|
1183
|
-
listHandleItems() {
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
_c = _f.value;
|
1190
|
-
_d = false;
|
1191
|
-
const listHandlesResponse = _c;
|
1192
|
-
if (listHandlesResponse.handleList) {
|
1193
|
-
for (const handle of listHandlesResponse.handleList) {
|
1194
|
-
yield yield tslib_1.__await(handle);
|
1195
|
-
}
|
1196
|
-
}
|
1302
|
+
async *listHandleItems(options = {}) {
|
1303
|
+
let marker;
|
1304
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
1305
|
+
if (listHandlesResponse.handleList) {
|
1306
|
+
for (const handle of listHandlesResponse.handleList) {
|
1307
|
+
yield handle;
|
1197
1308
|
}
|
1198
1309
|
}
|
1199
|
-
|
1200
|
-
finally {
|
1201
|
-
try {
|
1202
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
1203
|
-
}
|
1204
|
-
finally { if (e_2) throw e_2.error; }
|
1205
|
-
}
|
1206
|
-
});
|
1310
|
+
}
|
1207
1311
|
}
|
1208
1312
|
/**
|
1209
1313
|
* Returns an async iterable iterator to list all the handles.
|
@@ -1348,7 +1452,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1348
1452
|
* Return an AsyncIterableIterator that works a page at a time
|
1349
1453
|
*/
|
1350
1454
|
byPage: (settings = {}) => {
|
1351
|
-
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
1455
|
+
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
1456
|
+
maxResults: settings.maxPageSize,
|
1457
|
+
...options,
|
1458
|
+
});
|
1352
1459
|
},
|
1353
1460
|
};
|
1354
1461
|
}
|
@@ -1366,13 +1473,23 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1366
1473
|
async listHandlesSegment(marker, options = {}) {
|
1367
1474
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1368
1475
|
marker = marker === "" ? undefined : marker;
|
1369
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles(
|
1476
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles({
|
1477
|
+
...updatedOptions,
|
1478
|
+
marker,
|
1479
|
+
...this.shareClientConfig,
|
1480
|
+
}));
|
1370
1481
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1371
1482
|
// response.handleList is an empty string
|
1372
1483
|
if (response.handleList === "") {
|
1373
1484
|
response.handleList = undefined;
|
1374
1485
|
}
|
1375
|
-
const wrappedResponse =
|
1486
|
+
const wrappedResponse = {
|
1487
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response),
|
1488
|
+
_response: {
|
1489
|
+
...response._response,
|
1490
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response._response.parsedBody),
|
1491
|
+
},
|
1492
|
+
};
|
1376
1493
|
return wrappedResponse;
|
1377
1494
|
});
|
1378
1495
|
}
|
@@ -1389,12 +1506,19 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1389
1506
|
*/
|
1390
1507
|
async forceCloseHandlesSegment(marker, options = {}) {
|
1391
1508
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
1392
|
-
var _a, _b;
|
1393
1509
|
if (marker === "") {
|
1394
1510
|
marker = undefined;
|
1395
1511
|
}
|
1396
|
-
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.forceCloseHandles("*",
|
1397
|
-
|
1512
|
+
const rawResponse = (0, utils_common_js_1.assertResponse)(await this.context.forceCloseHandles("*", {
|
1513
|
+
...updatedOptions,
|
1514
|
+
marker,
|
1515
|
+
...this.shareClientConfig,
|
1516
|
+
}));
|
1517
|
+
return {
|
1518
|
+
...rawResponse,
|
1519
|
+
closedHandlesCount: rawResponse.numberOfHandlesClosed ?? 0,
|
1520
|
+
closeFailureCount: rawResponse.numberOfHandlesFailedToClose ?? 0,
|
1521
|
+
};
|
1398
1522
|
});
|
1399
1523
|
}
|
1400
1524
|
/**
|
@@ -1439,7 +1563,10 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1439
1563
|
if (handleId === "*") {
|
1440
1564
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1441
1565
|
}
|
1442
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
1566
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
1567
|
+
...updatedOptions,
|
1568
|
+
...this.shareClientConfig,
|
1569
|
+
});
|
1443
1570
|
const response = rawResponse;
|
1444
1571
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1445
1572
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -1495,15 +1622,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
1495
1622
|
}
|
1496
1623
|
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
1497
1624
|
return tracing_js_1.tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1498
|
-
const response = (0, utils_common_js_1.assertResponse)(await destDirectory.context.rename(this.url,
|
1625
|
+
const response = (0, utils_common_js_1.assertResponse)(await destDirectory.context.rename(this.url, {
|
1626
|
+
...updatedOptions,
|
1627
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1499
1628
|
? {
|
1500
1629
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1501
1630
|
}
|
1502
|
-
: undefined,
|
1631
|
+
: undefined,
|
1632
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
1503
1633
|
? {
|
1504
1634
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1505
1635
|
}
|
1506
|
-
: undefined
|
1636
|
+
: undefined,
|
1637
|
+
...this.shareClientConfig,
|
1638
|
+
}));
|
1507
1639
|
return {
|
1508
1640
|
destinationDirectoryClient: destDirectory,
|
1509
1641
|
directoryRenameResponse: response,
|
@@ -1516,6 +1648,14 @@ exports.ShareDirectoryClient = ShareDirectoryClient;
|
|
1516
1648
|
* A ShareFileClient represents a URL to an Azure Storage file.
|
1517
1649
|
*/
|
1518
1650
|
class ShareFileClient extends StorageClient_js_1.StorageClient {
|
1651
|
+
/**
|
1652
|
+
* context provided by protocol layer.
|
1653
|
+
*/
|
1654
|
+
context;
|
1655
|
+
_shareName;
|
1656
|
+
_path;
|
1657
|
+
_name;
|
1658
|
+
shareClientConfig;
|
1519
1659
|
/**
|
1520
1660
|
* The share name corresponding to this file client
|
1521
1661
|
*/
|
@@ -1542,13 +1682,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1542
1682
|
if ((0, Pipeline_js_1.isPipelineLike)(credentialOrPipeline)) {
|
1543
1683
|
pipeline = credentialOrPipeline;
|
1544
1684
|
}
|
1545
|
-
else if (credentialOrPipeline instanceof
|
1685
|
+
else if (credentialOrPipeline instanceof storage_common_1.Credential ||
|
1546
1686
|
(0, core_auth_1.isTokenCredential)(credentialOrPipeline)) {
|
1547
1687
|
pipeline = (0, Pipeline_js_1.newPipeline)(credentialOrPipeline, options);
|
1548
1688
|
}
|
1549
1689
|
else {
|
1550
1690
|
// The second parameter is undefined. Use anonymous credential.
|
1551
|
-
pipeline = (0, Pipeline_js_1.newPipeline)(new
|
1691
|
+
pipeline = (0, Pipeline_js_1.newPipeline)(new storage_common_3.AnonymousCredential(), options);
|
1552
1692
|
}
|
1553
1693
|
super(url, pipeline);
|
1554
1694
|
({
|
@@ -1613,16 +1753,30 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1613
1753
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectoryCreateCommonOptions)(options);
|
1614
1754
|
options.fileHttpHeaders = options.fileHttpHeaders || {};
|
1615
1755
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1616
|
-
|
1617
|
-
|
1756
|
+
const rawResponse = await this.context.create(size, {
|
1757
|
+
...updatedOptions,
|
1758
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
1759
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
1760
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
1761
|
+
fileAttributes: updatedOptions.fileAttributes
|
1618
1762
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1619
|
-
: undefined,
|
1620
|
-
|
1763
|
+
: undefined,
|
1764
|
+
owner: updatedOptions.posixProperties?.owner,
|
1765
|
+
group: updatedOptions.posixProperties?.group,
|
1766
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
1767
|
+
nfsFileType: updatedOptions.posixProperties?.fileType,
|
1768
|
+
...this.shareClientConfig,
|
1769
|
+
});
|
1770
|
+
const wrappedRes = {
|
1771
|
+
...rawResponse,
|
1772
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1773
|
+
posixProperties: {
|
1621
1774
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1622
1775
|
fileType: rawResponse.nfsFileType,
|
1623
1776
|
owner: rawResponse.owner,
|
1624
1777
|
group: rawResponse.group,
|
1625
|
-
}
|
1778
|
+
},
|
1779
|
+
};
|
1626
1780
|
return (0, utils_common_js_1.assertResponse)(wrappedRes);
|
1627
1781
|
});
|
1628
1782
|
}
|
@@ -1712,15 +1866,24 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1712
1866
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1713
1867
|
}
|
1714
1868
|
const downloadFullFile = offset === 0 && !count;
|
1715
|
-
const rawResponse = await this.context.download(
|
1869
|
+
const rawResponse = await this.context.download({
|
1870
|
+
...updatedOptions,
|
1871
|
+
requestOptions: {
|
1716
1872
|
onDownloadProgress: core_util_1.isNodeLike ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1717
|
-
},
|
1718
|
-
|
1873
|
+
},
|
1874
|
+
range: downloadFullFile ? undefined : (0, Range_js_1.rangeToString)({ offset, count }),
|
1875
|
+
...this.shareClientConfig,
|
1876
|
+
});
|
1877
|
+
const res = (0, utils_common_js_1.assertResponse)({
|
1878
|
+
...rawResponse,
|
1879
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1880
|
+
posixProperties: {
|
1719
1881
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1720
1882
|
owner: rawResponse.owner,
|
1721
1883
|
group: rawResponse.group,
|
1722
1884
|
linkCount: rawResponse.linkCount,
|
1723
|
-
}
|
1885
|
+
},
|
1886
|
+
});
|
1724
1887
|
// Return browser response immediately
|
1725
1888
|
if (!core_util_1.isNodeLike) {
|
1726
1889
|
return res;
|
@@ -1750,7 +1913,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1750
1913
|
// chunkDownloadOptions.range
|
1751
1914
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1752
1915
|
// );
|
1753
|
-
const downloadRes = await this.context.download(
|
1916
|
+
const downloadRes = await this.context.download({
|
1917
|
+
...updatedOptions,
|
1918
|
+
...updatedDownloadOptions,
|
1919
|
+
...this.shareClientConfig, // TODO: confirm whether this is needed
|
1920
|
+
});
|
1754
1921
|
if (!(downloadRes.etag === res.etag)) {
|
1755
1922
|
throw new Error("File has been modified concurrently");
|
1756
1923
|
}
|
@@ -1794,14 +1961,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1794
1961
|
*/
|
1795
1962
|
async getProperties(options = {}) {
|
1796
1963
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1797
|
-
const rawResponse = await this.context.getProperties(
|
1798
|
-
|
1964
|
+
const rawResponse = await this.context.getProperties({
|
1965
|
+
...updatedOptions,
|
1966
|
+
...this.shareClientConfig,
|
1967
|
+
});
|
1968
|
+
return (0, utils_common_js_1.assertResponse)({
|
1969
|
+
...rawResponse,
|
1970
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
1971
|
+
posixProperties: {
|
1799
1972
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1800
1973
|
fileType: rawResponse.nfsFileType,
|
1801
1974
|
owner: rawResponse.owner,
|
1802
1975
|
group: rawResponse.group,
|
1803
1976
|
linkCount: rawResponse.linkCount,
|
1804
|
-
}
|
1977
|
+
},
|
1978
|
+
});
|
1805
1979
|
});
|
1806
1980
|
}
|
1807
1981
|
/**
|
@@ -1817,16 +1991,29 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1817
1991
|
properties = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(properties);
|
1818
1992
|
properties.fileHttpHeaders = properties.fileHttpHeaders || {};
|
1819
1993
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1820
|
-
|
1821
|
-
|
1994
|
+
const rawResponse = await this.context.setHttpHeaders({
|
1995
|
+
...updatedOptions,
|
1996
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
1997
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
1998
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
1999
|
+
fileAttributes: updatedOptions.fileAttributes
|
1822
2000
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1823
|
-
: undefined,
|
1824
|
-
|
2001
|
+
: undefined,
|
2002
|
+
owner: updatedOptions.posixProperties?.owner,
|
2003
|
+
group: updatedOptions.posixProperties?.group,
|
2004
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2005
|
+
...this.shareClientConfig,
|
2006
|
+
});
|
2007
|
+
return (0, utils_common_js_1.assertResponse)({
|
2008
|
+
...rawResponse,
|
2009
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2010
|
+
posixProperties: {
|
1825
2011
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1826
2012
|
owner: rawResponse.owner,
|
1827
2013
|
group: rawResponse.group,
|
1828
2014
|
linkCount: rawResponse.linkCount,
|
1829
|
-
}
|
2015
|
+
},
|
2016
|
+
});
|
1830
2017
|
});
|
1831
2018
|
}
|
1832
2019
|
/**
|
@@ -1848,7 +2035,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1848
2035
|
*/
|
1849
2036
|
async delete(options = {}) {
|
1850
2037
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1851
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.delete(
|
2038
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.delete({ ...updatedOptions, ...this.shareClientConfig }));
|
1852
2039
|
});
|
1853
2040
|
}
|
1854
2041
|
/**
|
@@ -1869,15 +2056,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1869
2056
|
*/
|
1870
2057
|
async deleteIfExists(options = {}) {
|
1871
2058
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
1872
|
-
var _a, _b, _c;
|
1873
2059
|
try {
|
1874
2060
|
const res = await this.delete(updatedOptions);
|
1875
|
-
return
|
2061
|
+
return {
|
2062
|
+
succeeded: true,
|
2063
|
+
...res,
|
2064
|
+
};
|
1876
2065
|
}
|
1877
2066
|
catch (e) {
|
1878
|
-
if (
|
1879
|
-
|
1880
|
-
return
|
2067
|
+
if (e.details?.errorCode === "ResourceNotFound" ||
|
2068
|
+
e.details?.errorCode === "ParentNotFound") {
|
2069
|
+
return {
|
2070
|
+
succeeded: false,
|
2071
|
+
...e.response?.parsedHeaders,
|
2072
|
+
_response: e.response,
|
2073
|
+
};
|
1881
2074
|
}
|
1882
2075
|
throw e;
|
1883
2076
|
}
|
@@ -1899,16 +2092,30 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1899
2092
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved
|
1900
2093
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(options);
|
1901
2094
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1902
|
-
|
1903
|
-
|
2095
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2096
|
+
...updatedOptions,
|
2097
|
+
fileHttpHeaders,
|
2098
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(updatedOptions.creationTime),
|
2099
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(updatedOptions.lastWriteTime),
|
2100
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(updatedOptions.changeTime),
|
2101
|
+
fileAttributes: updatedOptions.fileAttributes
|
1904
2102
|
? (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes)
|
1905
|
-
: undefined,
|
1906
|
-
|
2103
|
+
: undefined,
|
2104
|
+
owner: updatedOptions.posixProperties?.owner,
|
2105
|
+
group: updatedOptions.posixProperties?.group,
|
2106
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2107
|
+
...this.shareClientConfig,
|
2108
|
+
});
|
2109
|
+
return (0, utils_common_js_1.assertResponse)({
|
2110
|
+
...rawResponse,
|
2111
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2112
|
+
posixProperties: {
|
1907
2113
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1908
2114
|
owner: rawResponse.owner,
|
1909
2115
|
group: rawResponse.group,
|
1910
2116
|
linkCount: rawResponse.linkCount,
|
1911
|
-
}
|
2117
|
+
},
|
2118
|
+
});
|
1912
2119
|
});
|
1913
2120
|
}
|
1914
2121
|
/**
|
@@ -1929,14 +2136,28 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1929
2136
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1930
2137
|
options = (0, models_js_1.validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions)(options);
|
1931
2138
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
2139
|
+
const rawResponse = await this.context.setHttpHeaders({
|
2140
|
+
...updatedOptions,
|
2141
|
+
fileContentLength: length,
|
2142
|
+
fileChangeOn: (0, models_js_1.fileChangeTimeToString)(options.changeTime),
|
2143
|
+
fileCreatedOn: (0, models_js_1.fileCreationTimeToString)(options.creationTime),
|
2144
|
+
fileLastWriteOn: (0, models_js_1.fileLastWriteTimeToString)(options.lastWriteTime),
|
2145
|
+
fileAttributes: (0, models_js_1.fileAttributesToString)(updatedOptions.fileAttributes),
|
2146
|
+
owner: updatedOptions.posixProperties?.owner,
|
2147
|
+
group: updatedOptions.posixProperties?.group,
|
2148
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(options.posixProperties?.fileMode),
|
2149
|
+
...this.shareClientConfig,
|
2150
|
+
});
|
2151
|
+
return (0, utils_common_js_1.assertResponse)({
|
2152
|
+
...rawResponse,
|
2153
|
+
_response: rawResponse._response,
|
2154
|
+
posixProperties: {
|
1935
2155
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
1936
2156
|
owner: rawResponse.owner,
|
1937
2157
|
group: rawResponse.group,
|
1938
2158
|
linkCount: rawResponse.linkCount,
|
1939
|
-
}
|
2159
|
+
},
|
2160
|
+
});
|
1940
2161
|
});
|
1941
2162
|
}
|
1942
2163
|
/**
|
@@ -1952,7 +2173,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
1952
2173
|
*/
|
1953
2174
|
async setMetadata(metadata = {}, options = {}) {
|
1954
2175
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1955
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata(
|
2176
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.setMetadata({
|
2177
|
+
...updatedOptions,
|
2178
|
+
metadata,
|
2179
|
+
...this.shareClientConfig,
|
2180
|
+
}));
|
1956
2181
|
});
|
1957
2182
|
}
|
1958
2183
|
/**
|
@@ -2008,9 +2233,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2008
2233
|
if (contentLength > constants_js_1.FILE_RANGE_MAX_SIZE_BYTES) {
|
2009
2234
|
throw new RangeError(`offset must be < ${constants_js_1.FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2010
2235
|
}
|
2011
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "update", contentLength,
|
2236
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "update", contentLength, {
|
2237
|
+
...updatedOptions,
|
2238
|
+
requestOptions: {
|
2012
2239
|
onUploadProgress: updatedOptions.onProgress,
|
2013
|
-
},
|
2240
|
+
},
|
2241
|
+
body,
|
2242
|
+
...this.shareClientConfig,
|
2243
|
+
}));
|
2014
2244
|
});
|
2015
2245
|
}
|
2016
2246
|
/**
|
@@ -2031,7 +2261,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2031
2261
|
if (count <= 0 || count > constants_js_1.FILE_RANGE_MAX_SIZE_BYTES) {
|
2032
2262
|
throw new RangeError(`count must be > 0 and <= ${constants_js_1.FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
2033
2263
|
}
|
2034
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRangeFromURL((0, Range_js_1.rangeToString)({ offset: destOffset, count }), sourceURL, 0,
|
2264
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRangeFromURL((0, Range_js_1.rangeToString)({ offset: destOffset, count }), sourceURL, 0, {
|
2265
|
+
...updatedOptions,
|
2266
|
+
sourceRange: (0, Range_js_1.rangeToString)({ offset: sourceOffset, count }),
|
2267
|
+
sourceModifiedAccessConditions: updatedOptions.sourceConditions,
|
2268
|
+
copySourceAuthorization: (0, utils_common_js_1.httpAuthorizationToString)(updatedOptions.sourceAuthorization),
|
2269
|
+
...this.shareClientConfig,
|
2270
|
+
}));
|
2035
2271
|
});
|
2036
2272
|
}
|
2037
2273
|
/**
|
@@ -2047,7 +2283,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2047
2283
|
if (offset < 0 || contentLength <= 0) {
|
2048
2284
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
2049
2285
|
}
|
2050
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "clear", 0,
|
2286
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.uploadRange((0, Range_js_1.rangeToString)({ count: contentLength, offset }), "clear", 0, { ...updatedOptions, ...this.shareClientConfig }));
|
2051
2287
|
});
|
2052
2288
|
}
|
2053
2289
|
/**
|
@@ -2057,12 +2293,20 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2057
2293
|
*/
|
2058
2294
|
async getRangeList(options = {}) {
|
2059
2295
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
2060
|
-
const originalResponse = (0, utils_common_js_1.assertResponse)(await this.context.getRangeList(
|
2296
|
+
const originalResponse = (0, utils_common_js_1.assertResponse)(await this.context.getRangeList({
|
2297
|
+
...updatedOptions,
|
2298
|
+
range: updatedOptions.range ? (0, Range_js_1.rangeToString)(updatedOptions.range) : undefined,
|
2299
|
+
...this.shareClientConfig,
|
2300
|
+
}));
|
2061
2301
|
// Only returns ranges, ignoring clearRanges.
|
2062
2302
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
2063
2303
|
? originalResponse._response.parsedBody.ranges
|
2064
2304
|
: [];
|
2065
|
-
return
|
2305
|
+
return {
|
2306
|
+
...originalResponse,
|
2307
|
+
_response: { ...originalResponse._response, parsedBody },
|
2308
|
+
rangeList: originalResponse.ranges ? originalResponse.ranges : [],
|
2309
|
+
};
|
2066
2310
|
});
|
2067
2311
|
}
|
2068
2312
|
/**
|
@@ -2073,7 +2317,13 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2073
2317
|
*/
|
2074
2318
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
2075
2319
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
2076
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getRangeList(
|
2320
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getRangeList({
|
2321
|
+
...updatedOptions,
|
2322
|
+
prevsharesnapshot: prevShareSnapshot,
|
2323
|
+
supportRename: options.includeRenames,
|
2324
|
+
range: updatedOptions.range ? (0, Range_js_1.rangeToString)(updatedOptions.range) : undefined,
|
2325
|
+
...this.shareClientConfig,
|
2326
|
+
}));
|
2077
2327
|
});
|
2078
2328
|
}
|
2079
2329
|
/**
|
@@ -2090,8 +2340,15 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2090
2340
|
*/
|
2091
2341
|
async startCopyFromURL(copySource, options = {}) {
|
2092
2342
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
2093
|
-
|
2094
|
-
|
2343
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.startCopy(copySource, {
|
2344
|
+
...updatedOptions,
|
2345
|
+
...this.shareClientConfig,
|
2346
|
+
owner: updatedOptions.posixProperties?.owner,
|
2347
|
+
group: updatedOptions.posixProperties?.group,
|
2348
|
+
fileMode: (0, utils_common_js_1.toOctalFileMode)(updatedOptions.posixProperties?.fileMode),
|
2349
|
+
fileModeCopyMode: updatedOptions.fileModeCopyMode,
|
2350
|
+
fileOwnerCopyMode: updatedOptions.fileOwnerCopyMode,
|
2351
|
+
}));
|
2095
2352
|
});
|
2096
2353
|
}
|
2097
2354
|
/**
|
@@ -2104,7 +2361,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2104
2361
|
*/
|
2105
2362
|
async abortCopyFromURL(copyId, options = {}) {
|
2106
2363
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
2107
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.abortCopy(copyId,
|
2364
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.abortCopy(copyId, { ...updatedOptions, ...this.shareClientConfig }));
|
2108
2365
|
});
|
2109
2366
|
}
|
2110
2367
|
// High Level functions
|
@@ -2442,13 +2699,23 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2442
2699
|
async listHandlesSegment(marker, options = {}) {
|
2443
2700
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2444
2701
|
marker = marker === "" ? undefined : marker;
|
2445
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles(
|
2702
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.context.listHandles({
|
2703
|
+
...updatedOptions,
|
2704
|
+
...this.shareClientConfig,
|
2705
|
+
marker,
|
2706
|
+
}));
|
2446
2707
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2447
2708
|
// response.handleList is an empty string
|
2448
2709
|
if (response.handleList === "") {
|
2449
2710
|
response.handleList = undefined;
|
2450
2711
|
}
|
2451
|
-
const wrappedResponse =
|
2712
|
+
const wrappedResponse = {
|
2713
|
+
...(0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response),
|
2714
|
+
_response: {
|
2715
|
+
...response._response,
|
2716
|
+
parsedBody: (0, utils_common_js_1.ConvertInternalResponseOfListHandles)(response._response.parsedBody),
|
2717
|
+
},
|
2718
|
+
};
|
2452
2719
|
return wrappedResponse;
|
2453
2720
|
});
|
2454
2721
|
}
|
@@ -2462,47 +2729,30 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2462
2729
|
* set of list items.
|
2463
2730
|
* @param options - Options to list handles operation.
|
2464
2731
|
*/
|
2465
|
-
iterateHandleSegments(
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
}
|
2475
|
-
});
|
2732
|
+
async *iterateHandleSegments(marker, options = {}) {
|
2733
|
+
let listHandlesResponse;
|
2734
|
+
if (!!marker || marker === undefined) {
|
2735
|
+
do {
|
2736
|
+
listHandlesResponse = await this.listHandlesSegment(marker, options);
|
2737
|
+
marker = listHandlesResponse.continuationToken;
|
2738
|
+
yield listHandlesResponse;
|
2739
|
+
} while (marker);
|
2740
|
+
}
|
2476
2741
|
}
|
2477
2742
|
/**
|
2478
2743
|
* Returns an AsyncIterableIterator for handles
|
2479
2744
|
*
|
2480
2745
|
* @param options - Options to list handles operation.
|
2481
2746
|
*/
|
2482
|
-
listHandleItems() {
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
_c = _f.value;
|
2489
|
-
_d = false;
|
2490
|
-
const listHandlesResponse = _c;
|
2491
|
-
if (listHandlesResponse.handleList) {
|
2492
|
-
for (const handle of listHandlesResponse.handleList) {
|
2493
|
-
yield yield tslib_1.__await(handle);
|
2494
|
-
}
|
2495
|
-
}
|
2747
|
+
async *listHandleItems(options = {}) {
|
2748
|
+
let marker;
|
2749
|
+
for await (const listHandlesResponse of this.iterateHandleSegments(marker, options)) {
|
2750
|
+
if (listHandlesResponse.handleList) {
|
2751
|
+
for (const handle of listHandlesResponse.handleList) {
|
2752
|
+
yield handle;
|
2496
2753
|
}
|
2497
2754
|
}
|
2498
|
-
|
2499
|
-
finally {
|
2500
|
-
try {
|
2501
|
-
if (!_d && !_a && (_b = _e.return)) yield tslib_1.__await(_b.call(_e));
|
2502
|
-
}
|
2503
|
-
finally { if (e_3) throw e_3.error; }
|
2504
|
-
}
|
2505
|
-
});
|
2755
|
+
}
|
2506
2756
|
}
|
2507
2757
|
/**
|
2508
2758
|
* Returns an async iterable iterator to list all the handles.
|
@@ -2534,7 +2784,10 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2534
2784
|
* Return an AsyncIterableIterator that works a page at a time
|
2535
2785
|
*/
|
2536
2786
|
byPage: (settings = {}) => {
|
2537
|
-
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken),
|
2787
|
+
return this.iterateHandleSegments((0, utils_common_js_1.removeEmptyString)(settings.continuationToken), {
|
2788
|
+
maxPageSize: settings.maxPageSize,
|
2789
|
+
...options,
|
2790
|
+
});
|
2538
2791
|
},
|
2539
2792
|
};
|
2540
2793
|
}
|
@@ -2552,7 +2805,11 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2552
2805
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2553
2806
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2554
2807
|
marker = marker === "" ? undefined : marker;
|
2555
|
-
const rawResponse = await this.context.forceCloseHandles("*",
|
2808
|
+
const rawResponse = await this.context.forceCloseHandles("*", {
|
2809
|
+
...updatedOptions,
|
2810
|
+
...this.shareClientConfig,
|
2811
|
+
marker,
|
2812
|
+
});
|
2556
2813
|
const response = rawResponse;
|
2557
2814
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2558
2815
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2599,7 +2856,10 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2599
2856
|
if (handleId === "*") {
|
2600
2857
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
2601
2858
|
}
|
2602
|
-
const rawResponse = await this.context.forceCloseHandles(handleId,
|
2859
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
2860
|
+
...updatedOptions,
|
2861
|
+
...this.shareClientConfig,
|
2862
|
+
});
|
2603
2863
|
const response = rawResponse;
|
2604
2864
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2605
2865
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2614,14 +2874,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2614
2874
|
*/
|
2615
2875
|
async createHardLink(targetFile, options = {}) {
|
2616
2876
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-createHardLink", options, async (updatedOptions) => {
|
2617
|
-
const rawResponse = await this.context.createHardLink(targetFile,
|
2618
|
-
|
2877
|
+
const rawResponse = await this.context.createHardLink(targetFile, {
|
2878
|
+
...updatedOptions,
|
2879
|
+
...this.shareClientConfig,
|
2880
|
+
});
|
2881
|
+
return (0, utils_common_js_1.assertResponse)({
|
2882
|
+
...rawResponse,
|
2883
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2884
|
+
posixProperties: {
|
2619
2885
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
2620
2886
|
fileType: rawResponse.nfsFileType,
|
2621
2887
|
owner: rawResponse.owner,
|
2622
2888
|
group: rawResponse.group,
|
2623
2889
|
linkCount: rawResponse.linkCount,
|
2624
|
-
}
|
2890
|
+
},
|
2891
|
+
});
|
2625
2892
|
});
|
2626
2893
|
}
|
2627
2894
|
/**
|
@@ -2633,13 +2900,20 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2633
2900
|
*/
|
2634
2901
|
async createSymbolicLink(linkText, options = {}) {
|
2635
2902
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-createSymbolicLink", options, async (updatedOptions) => {
|
2636
|
-
const rawResponse = await this.context.createSymbolicLink(linkText,
|
2637
|
-
|
2903
|
+
const rawResponse = await this.context.createSymbolicLink(linkText, {
|
2904
|
+
...updatedOptions,
|
2905
|
+
...this.shareClientConfig,
|
2906
|
+
});
|
2907
|
+
return (0, utils_common_js_1.assertResponse)({
|
2908
|
+
...rawResponse,
|
2909
|
+
_response: rawResponse._response, // _response is made non-enumerable,
|
2910
|
+
posixProperties: {
|
2638
2911
|
fileMode: (0, utils_common_js_1.parseOctalFileMode)(rawResponse.fileMode),
|
2639
2912
|
owner: rawResponse.owner,
|
2640
2913
|
group: rawResponse.group,
|
2641
2914
|
fileType: rawResponse.nfsFileType,
|
2642
|
-
}
|
2915
|
+
},
|
2916
|
+
});
|
2643
2917
|
});
|
2644
2918
|
}
|
2645
2919
|
/**
|
@@ -2648,7 +2922,10 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2648
2922
|
*/
|
2649
2923
|
async getSymbolicLink(options = {}) {
|
2650
2924
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-getSymbolicLink", options, async (updatedOptions) => {
|
2651
|
-
return (0, utils_common_js_1.assertResponse)(await this.context.getSymbolicLink(
|
2925
|
+
return (0, utils_common_js_1.assertResponse)(await this.context.getSymbolicLink({
|
2926
|
+
...updatedOptions,
|
2927
|
+
...this.shareClientConfig,
|
2928
|
+
}));
|
2652
2929
|
});
|
2653
2930
|
}
|
2654
2931
|
/**
|
@@ -2672,10 +2949,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2672
2949
|
* @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
|
2673
2950
|
*/
|
2674
2951
|
generateSasUrl(options) {
|
2675
|
-
if (!(this.credential instanceof
|
2952
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
2676
2953
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2677
2954
|
}
|
2678
|
-
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)(
|
2955
|
+
const sas = (0, FileSASSignatureValues_js_1.generateFileSASQueryParameters)({
|
2956
|
+
shareName: this.shareName,
|
2957
|
+
filePath: this.path,
|
2958
|
+
...options,
|
2959
|
+
}, this.credential).toString();
|
2679
2960
|
return (0, utils_common_js_1.appendToURLQuery)(this.url, sas);
|
2680
2961
|
}
|
2681
2962
|
/**
|
@@ -2691,10 +2972,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2691
2972
|
*/
|
2692
2973
|
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
|
2693
2974
|
generateSasStringToSign(options) {
|
2694
|
-
if (!(this.credential instanceof
|
2975
|
+
if (!(this.credential instanceof storage_common_2.StorageSharedKeyCredential)) {
|
2695
2976
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2696
2977
|
}
|
2697
|
-
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)(
|
2978
|
+
return (0, FileSASSignatureValues_js_1.generateFileSASQueryParametersInternal)({
|
2979
|
+
shareName: this.shareName,
|
2980
|
+
filePath: this.path,
|
2981
|
+
...options,
|
2982
|
+
}, this.credential).stringToSign;
|
2698
2983
|
}
|
2699
2984
|
/**
|
2700
2985
|
* Renames a file.
|
@@ -2749,19 +3034,25 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
2749
3034
|
}
|
2750
3035
|
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
2751
3036
|
return tracing_js_1.tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2752
|
-
const response = (0, utils_common_js_1.assertResponse)(await destFile.context.rename(this.url,
|
3037
|
+
const response = (0, utils_common_js_1.assertResponse)(await destFile.context.rename(this.url, {
|
3038
|
+
...updatedOptions,
|
3039
|
+
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2753
3040
|
? {
|
2754
3041
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
2755
3042
|
}
|
2756
|
-
: undefined,
|
3043
|
+
: undefined,
|
3044
|
+
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
2757
3045
|
? {
|
2758
3046
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
2759
3047
|
}
|
2760
|
-
: undefined,
|
3048
|
+
: undefined,
|
3049
|
+
fileHttpHeaders: options.contentType
|
2761
3050
|
? {
|
2762
3051
|
fileContentType: options.contentType,
|
2763
3052
|
}
|
2764
|
-
: undefined
|
3053
|
+
: undefined,
|
3054
|
+
...this.shareClientConfig,
|
3055
|
+
}));
|
2765
3056
|
return {
|
2766
3057
|
destinationFileClient: destFile,
|
2767
3058
|
fileRenameResponse: response,
|
@@ -2777,6 +3068,10 @@ exports.ShareFileClient = ShareFileClient;
|
|
2777
3068
|
* @see https://learn.microsoft.com/rest/api/storageservices/lease-share
|
2778
3069
|
*/
|
2779
3070
|
class ShareLeaseClient {
|
3071
|
+
_leaseId;
|
3072
|
+
_url;
|
3073
|
+
fileOrShare;
|
3074
|
+
shareClientConfig;
|
2780
3075
|
/**
|
2781
3076
|
* Gets the lease Id.
|
2782
3077
|
*
|
@@ -2823,7 +3118,12 @@ class ShareLeaseClient {
|
|
2823
3118
|
*/
|
2824
3119
|
async acquireLease(duration = -1, options = {}) {
|
2825
3120
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2826
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.acquireLease(
|
3121
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.acquireLease({
|
3122
|
+
...updatedOptions,
|
3123
|
+
...this.shareClientConfig,
|
3124
|
+
duration,
|
3125
|
+
proposedLeaseId: this._leaseId,
|
3126
|
+
}));
|
2827
3127
|
});
|
2828
3128
|
}
|
2829
3129
|
/**
|
@@ -2835,7 +3135,11 @@ class ShareLeaseClient {
|
|
2835
3135
|
*/
|
2836
3136
|
async changeLease(proposedLeaseId, options = {}) {
|
2837
3137
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2838
|
-
const response = (0, utils_common_js_1.assertResponse)(await this.fileOrShare.changeLease(this._leaseId,
|
3138
|
+
const response = (0, utils_common_js_1.assertResponse)(await this.fileOrShare.changeLease(this._leaseId, {
|
3139
|
+
...updatedOptions,
|
3140
|
+
...this.shareClientConfig,
|
3141
|
+
proposedLeaseId,
|
3142
|
+
}));
|
2839
3143
|
this._leaseId = proposedLeaseId;
|
2840
3144
|
return response;
|
2841
3145
|
});
|
@@ -2849,7 +3153,10 @@ class ShareLeaseClient {
|
|
2849
3153
|
*/
|
2850
3154
|
async releaseLease(options = {}) {
|
2851
3155
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-releaseLease", options, async (updatedOptions) => {
|
2852
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.releaseLease(this._leaseId,
|
3156
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.releaseLease(this._leaseId, {
|
3157
|
+
...updatedOptions,
|
3158
|
+
...this.shareClientConfig,
|
3159
|
+
}));
|
2853
3160
|
});
|
2854
3161
|
}
|
2855
3162
|
/**
|
@@ -2860,7 +3167,10 @@ class ShareLeaseClient {
|
|
2860
3167
|
*/
|
2861
3168
|
async breakLease(options = {}) {
|
2862
3169
|
return tracing_js_1.tracingClient.withSpan("ShareLeaseClient-breakLease", options, async (updatedOptions) => {
|
2863
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.breakLease(
|
3170
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.breakLease({
|
3171
|
+
...updatedOptions,
|
3172
|
+
...this.shareClientConfig,
|
3173
|
+
}));
|
2864
3174
|
});
|
2865
3175
|
}
|
2866
3176
|
/**
|
@@ -2876,7 +3186,10 @@ class ShareLeaseClient {
|
|
2876
3186
|
if (isFile(this.fileOrShare)) {
|
2877
3187
|
throw new RangeError("The renewLease operation is not available for lease on file.");
|
2878
3188
|
}
|
2879
|
-
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.renewLease(this._leaseId,
|
3189
|
+
return (0, utils_common_js_1.assertResponse)(await this.fileOrShare.renewLease(this._leaseId, {
|
3190
|
+
...updatedOptions,
|
3191
|
+
...this.shareClientConfig,
|
3192
|
+
}));
|
2880
3193
|
});
|
2881
3194
|
}
|
2882
3195
|
}
|