@azure/storage-file-share 12.28.0-alpha.20250619.1 → 12.28.0-alpha.20250718.2
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 +1 -1
- package/dist/browser/Clients.d.ts.map +1 -1
- package/dist/browser/Clients.js +554 -241
- 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 +14 -3
- 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/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 +1 -1
- package/dist/commonjs/Clients.d.ts.map +1 -1
- package/dist/commonjs/Clients.js +566 -253
- 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 +14 -3
- 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/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 +1 -1
- package/dist/esm/Clients.d.ts.map +1 -1
- package/dist/esm/Clients.js +554 -241
- 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 +14 -3
- 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/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 +1 -1
- package/dist/react-native/Clients.d.ts.map +1 -1
- package/dist/react-native/Clients.js +554 -241
- 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 +14 -3
- 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/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 +3 -3
- 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");
|
@@ -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,14 +319,20 @@ 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;
|
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
|
}
|
@@ -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
|
/**
|
@@ -340,7 +372,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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,
|
@@ -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,9 +503,12 @@ 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
|
/**
|
@@ -468,7 +521,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -481,7 +537,10 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -505,10 +564,13 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -524,10 +586,13 @@ class ShareClient extends StorageClient_js_1.StorageClient {
|
|
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
|
({
|
@@ -590,16 +663,29 @@ 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
|
}
|
@@ -612,14 +698,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
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
|
}
|
@@ -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
|
/**
|
@@ -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) {
|
@@ -826,13 +931,20 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -845,7 +957,7 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -857,15 +969,21 @@ class ShareDirectoryClient extends StorageClient_js_1.StorageClient {
|
|
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
|
}
|
@@ -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,7 +1237,10 @@ 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
|
}
|
@@ -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,7 +1451,10 @@ 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
|
}
|
@@ -1365,13 +1472,23 @@ 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
|
}
|
@@ -1388,12 +1505,19 @@ 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
|
/**
|
@@ -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
|
({
|
@@ -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
|
}
|
@@ -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
|
}
|
@@ -1793,14 +1960,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -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
|
/**
|
@@ -1847,7 +2034,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -1868,15 +2055,21 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
}
|
@@ -1898,16 +2091,30 @@ 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
|
/**
|
@@ -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
|
/**
|
@@ -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,8 +2339,15 @@ 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
|
/**
|
@@ -2103,7 +2360,7 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
@@ -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,7 +2783,10 @@ 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
|
}
|
@@ -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;
|
@@ -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
|
/**
|
@@ -2671,10 +2948,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
/**
|
@@ -2690,10 +2971,14 @@ class ShareFileClient extends StorageClient_js_1.StorageClient {
|
|
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
|
}
|