@azure/storage-file-share 12.23.0-alpha.20240112.1 → 12.23.0-alpha.20240124.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/index.js +270 -472
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +1 -3
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +30 -35
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +81 -80
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +193 -302
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +132 -165
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +3 -10
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/Pipeline.js +10 -19
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -1
- package/dist-esm/storage-blob/src/StorageContextClient.js +1 -1
- package/dist-esm/storage-blob/src/StorageContextClient.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +3 -7
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +12 -10
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -1
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +3 -6
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/utils.common.js +11 -24
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
- package/dist-esm/storage-file-share/src/Clients.js +194 -367
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -1
- package/dist-esm/storage-file-share/src/ShareServiceClient.js +43 -43
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/StorageContextClient.js +1 -1
- package/dist-esm/storage-file-share/src/StorageContextClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js +3 -7
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/utils/utils.common.js +10 -26
- package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
5
5
|
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
6
6
|
var coreUtil = require('@azure/core-util');
|
7
|
+
var tslib = require('tslib');
|
7
8
|
var coreAuth = require('@azure/core-auth');
|
8
9
|
var coreHttpCompat = require('@azure/core-http-compat');
|
9
10
|
var coreClient = require('@azure/core-client');
|
@@ -12,7 +13,6 @@ var logger$2 = require('@azure/logger');
|
|
12
13
|
var abortController = require('@azure/abort-controller');
|
13
14
|
var crypto = require('crypto');
|
14
15
|
var coreTracing = require('@azure/core-tracing');
|
15
|
-
require('@azure/core-paging');
|
16
16
|
var stream = require('stream');
|
17
17
|
var events = require('events');
|
18
18
|
var fs = require('fs');
|
@@ -757,30 +757,19 @@ function StringEncodedToString(name) {
|
|
757
757
|
}
|
758
758
|
}
|
759
759
|
function ConvertInternalResponseOfListFiles(internalResponse) {
|
760
|
-
const wrappedResponse = {
|
761
|
-
...internalResponse,
|
762
|
-
prefix: undefined,
|
763
|
-
directoryPath: StringEncodedToString({
|
760
|
+
const wrappedResponse = Object.assign(Object.assign({}, internalResponse), { prefix: undefined, directoryPath: StringEncodedToString({
|
764
761
|
encoded: internalResponse.encoded,
|
765
762
|
content: internalResponse.directoryPath,
|
766
|
-
}),
|
767
|
-
segment: {
|
763
|
+
}), segment: {
|
768
764
|
fileItems: internalResponse.segment.fileItems.map((fileItemInternal) => {
|
769
|
-
const fileItem = {
|
770
|
-
...fileItemInternal,
|
771
|
-
name: StringEncodedToString(fileItemInternal.name),
|
772
|
-
};
|
765
|
+
const fileItem = Object.assign(Object.assign({}, fileItemInternal), { name: StringEncodedToString(fileItemInternal.name) });
|
773
766
|
return fileItem;
|
774
767
|
}),
|
775
768
|
directoryItems: internalResponse.segment.directoryItems.map((directoryItemInternal) => {
|
776
|
-
const directoryItem = {
|
777
|
-
...directoryItemInternal,
|
778
|
-
name: StringEncodedToString(directoryItemInternal.name),
|
779
|
-
};
|
769
|
+
const directoryItem = Object.assign(Object.assign({}, directoryItemInternal), { name: StringEncodedToString(directoryItemInternal.name) });
|
780
770
|
return directoryItem;
|
781
771
|
}),
|
782
|
-
}
|
783
|
-
};
|
772
|
+
} });
|
784
773
|
delete wrappedResponse.encoded;
|
785
774
|
const listResponse = wrappedResponse;
|
786
775
|
if (internalResponse.prefix) {
|
@@ -789,18 +778,12 @@ function ConvertInternalResponseOfListFiles(internalResponse) {
|
|
789
778
|
return listResponse;
|
790
779
|
}
|
791
780
|
function ConvertInternalResponseOfListHandles(internalResponse) {
|
792
|
-
const wrappedResponse = {
|
793
|
-
...internalResponse,
|
794
|
-
handleList: internalResponse.handleList
|
781
|
+
const wrappedResponse = Object.assign(Object.assign({}, internalResponse), { handleList: internalResponse.handleList
|
795
782
|
? internalResponse.handleList.map((handleItemInternal) => {
|
796
|
-
const handleItem = {
|
797
|
-
...handleItemInternal,
|
798
|
-
path: StringEncodedToString(handleItemInternal.path),
|
799
|
-
};
|
783
|
+
const handleItem = Object.assign(Object.assign({}, handleItemInternal), { path: StringEncodedToString(handleItemInternal.path) });
|
800
784
|
return handleItem;
|
801
785
|
})
|
802
|
-
: undefined
|
803
|
-
};
|
786
|
+
: undefined });
|
804
787
|
return wrappedResponse;
|
805
788
|
}
|
806
789
|
/**
|
@@ -1790,7 +1773,7 @@ class StorageRetryPolicy extends BaseRequestPolicy {
|
|
1790
1773
|
return true;
|
1791
1774
|
}
|
1792
1775
|
}
|
1793
|
-
if (err
|
1776
|
+
if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : err.message.startsWith(`Error "Error: Unclosed root tag`))) {
|
1794
1777
|
logger$1.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
|
1795
1778
|
return true;
|
1796
1779
|
}
|
@@ -2189,13 +2172,15 @@ const RETRY_ABORT_ERROR = new abortController.AbortError("The operation was abor
|
|
2189
2172
|
* Retry policy with exponential retry and linear retry implemented.
|
2190
2173
|
*/
|
2191
2174
|
function storageRetryPolicy(options = {}) {
|
2192
|
-
|
2193
|
-
const
|
2194
|
-
const
|
2195
|
-
const
|
2196
|
-
const
|
2197
|
-
const
|
2175
|
+
var _a, _b, _c, _d, _e, _f;
|
2176
|
+
const retryPolicyType = (_a = options.retryPolicyType) !== null && _a !== void 0 ? _a : DEFAULT_RETRY_OPTIONS.retryPolicyType;
|
2177
|
+
const maxTries = (_b = options.maxTries) !== null && _b !== void 0 ? _b : DEFAULT_RETRY_OPTIONS.maxTries;
|
2178
|
+
const retryDelayInMs = (_c = options.retryDelayInMs) !== null && _c !== void 0 ? _c : DEFAULT_RETRY_OPTIONS.retryDelayInMs;
|
2179
|
+
const maxRetryDelayInMs = (_d = options.maxRetryDelayInMs) !== null && _d !== void 0 ? _d : DEFAULT_RETRY_OPTIONS.maxRetryDelayInMs;
|
2180
|
+
const secondaryHost = (_e = options.secondaryHost) !== null && _e !== void 0 ? _e : DEFAULT_RETRY_OPTIONS.secondaryHost;
|
2181
|
+
const tryTimeoutInMs = (_f = options.tryTimeoutInMs) !== null && _f !== void 0 ? _f : DEFAULT_RETRY_OPTIONS.tryTimeoutInMs;
|
2198
2182
|
function shouldRetry({ isPrimaryRetry, attempt, response, error, }) {
|
2183
|
+
var _a, _b;
|
2199
2184
|
if (attempt >= maxTries) {
|
2200
2185
|
logger$1.info(`RetryPolicy: Attempt(s) ${attempt} >= maxTries ${maxTries}, no further try.`);
|
2201
2186
|
return false;
|
@@ -2209,8 +2194,8 @@ function storageRetryPolicy(options = {}) {
|
|
2209
2194
|
return true;
|
2210
2195
|
}
|
2211
2196
|
}
|
2212
|
-
if (error
|
2213
|
-
error
|
2197
|
+
if ((error === null || error === void 0 ? void 0 : error.code) === "PARSE_ERROR" &&
|
2198
|
+
(error === null || error === void 0 ? void 0 : error.message.startsWith(`Error "Error: Unclosed root tag`))) {
|
2214
2199
|
logger$1.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
|
2215
2200
|
return true;
|
2216
2201
|
}
|
@@ -2219,7 +2204,7 @@ function storageRetryPolicy(options = {}) {
|
|
2219
2204
|
// the resource was not found. This may be due to replication delay. So, in this
|
2220
2205
|
// case, we'll never try the secondary again for this operation.
|
2221
2206
|
if (response || error) {
|
2222
|
-
const statusCode = response
|
2207
|
+
const statusCode = (_b = (_a = response === null || response === void 0 ? void 0 : response.status) !== null && _a !== void 0 ? _a : error === null || error === void 0 ? void 0 : error.statusCode) !== null && _b !== void 0 ? _b : 0;
|
2223
2208
|
if (!isPrimaryRetry && statusCode === 404) {
|
2224
2209
|
logger$1.info(`RetryPolicy: Secondary access with 404, will retry.`);
|
2225
2210
|
return true;
|
@@ -2296,7 +2281,7 @@ function storageRetryPolicy(options = {}) {
|
|
2296
2281
|
if (response) {
|
2297
2282
|
return response;
|
2298
2283
|
}
|
2299
|
-
throw error
|
2284
|
+
throw error !== null && error !== void 0 ? error : new coreRestPipeline.RestError("RetryPolicy failed without known error.");
|
2300
2285
|
},
|
2301
2286
|
};
|
2302
2287
|
}
|
@@ -2578,7 +2563,8 @@ function processDownlevelPipeline(pipeline) {
|
|
2578
2563
|
return undefined;
|
2579
2564
|
}
|
2580
2565
|
function getCoreClientOptions(pipeline) {
|
2581
|
-
|
2566
|
+
var _a;
|
2567
|
+
const _b = pipeline.options, { httpClient: v1Client } = _b, restOptions = tslib.__rest(_b, ["httpClient"]);
|
2582
2568
|
let httpClient = pipeline._coreHttpClient;
|
2583
2569
|
if (!httpClient) {
|
2584
2570
|
httpClient = v1Client ? coreHttpCompat.convertHttpClient(v1Client) : getCachedDefaultHttpClient();
|
@@ -2590,17 +2576,13 @@ function getCoreClientOptions(pipeline) {
|
|
2590
2576
|
const userAgentPrefix = restOptions.userAgentOptions && restOptions.userAgentOptions.userAgentPrefix
|
2591
2577
|
? `${restOptions.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
2592
2578
|
: `${packageDetails}`;
|
2593
|
-
corePipeline = coreClient.createClientPipeline({
|
2594
|
-
...restOptions,
|
2595
|
-
loggingOptions: {
|
2579
|
+
corePipeline = coreClient.createClientPipeline(Object.assign(Object.assign({}, restOptions), { loggingOptions: {
|
2596
2580
|
additionalAllowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
|
2597
2581
|
additionalAllowedQueryParameters: StorageBlobLoggingAllowedQueryParameters,
|
2598
2582
|
logger: logger$1.info,
|
2599
|
-
},
|
2600
|
-
userAgentOptions: {
|
2583
|
+
}, userAgentOptions: {
|
2601
2584
|
userAgentPrefix,
|
2602
|
-
},
|
2603
|
-
serializationOptions: {
|
2585
|
+
}, serializationOptions: {
|
2604
2586
|
stringifyXML: coreXml.stringifyXML,
|
2605
2587
|
serializerOptions: {
|
2606
2588
|
xml: {
|
@@ -2609,8 +2591,7 @@ function getCoreClientOptions(pipeline) {
|
|
2609
2591
|
xmlCharKey: "#",
|
2610
2592
|
},
|
2611
2593
|
},
|
2612
|
-
},
|
2613
|
-
deserializationOptions: {
|
2594
|
+
}, deserializationOptions: {
|
2614
2595
|
parseXML: coreXml.parseXML,
|
2615
2596
|
serializerOptions: {
|
2616
2597
|
xml: {
|
@@ -2619,8 +2600,7 @@ function getCoreClientOptions(pipeline) {
|
|
2619
2600
|
xmlCharKey: "#",
|
2620
2601
|
},
|
2621
2602
|
},
|
2622
|
-
}
|
2623
|
-
});
|
2603
|
+
} }));
|
2624
2604
|
corePipeline.removePolicy({ phase: "Retry" });
|
2625
2605
|
corePipeline.removePolicy({ name: coreRestPipeline.decompressResponsePolicyName });
|
2626
2606
|
corePipeline.addPolicy(storageRetryPolicy(restOptions.retryOptions), { phase: "Retry" });
|
@@ -2633,7 +2613,7 @@ function getCoreClientOptions(pipeline) {
|
|
2633
2613
|
if (coreAuth.isTokenCredential(credential)) {
|
2634
2614
|
corePipeline.addPolicy(coreRestPipeline.bearerTokenAuthenticationPolicy({
|
2635
2615
|
credential,
|
2636
|
-
scopes: restOptions.audience
|
2616
|
+
scopes: (_a = restOptions.audience) !== null && _a !== void 0 ? _a : StorageOAuthScopes,
|
2637
2617
|
challengeCallbacks: { authorizeRequestOnChallenge: coreClient.authorizeRequestOnTenantChallenge },
|
2638
2618
|
}), { phase: "Sign" });
|
2639
2619
|
}
|
@@ -2645,12 +2625,7 @@ function getCoreClientOptions(pipeline) {
|
|
2645
2625
|
}
|
2646
2626
|
pipeline._corePipeline = corePipeline;
|
2647
2627
|
}
|
2648
|
-
return {
|
2649
|
-
...restOptions,
|
2650
|
-
allowInsecureConnection: true,
|
2651
|
-
httpClient,
|
2652
|
-
pipeline: corePipeline,
|
2653
|
-
};
|
2628
|
+
return Object.assign(Object.assign({}, restOptions), { allowInsecureConnection: true, httpClient, pipeline: corePipeline });
|
2654
2629
|
}
|
2655
2630
|
function getCredentialFromPipeline(pipeline) {
|
2656
2631
|
// see if we squirreled one away on the type itself
|
@@ -11110,6 +11085,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
|
|
11110
11085
|
* @param options The parameter options
|
11111
11086
|
*/
|
11112
11087
|
constructor(url, options) {
|
11088
|
+
var _a, _b;
|
11113
11089
|
if (url === undefined) {
|
11114
11090
|
throw new Error("'url' cannot be null");
|
11115
11091
|
}
|
@@ -11124,14 +11100,9 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
|
|
11124
11100
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
11125
11101
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
11126
11102
|
: `${packageDetails}`;
|
11127
|
-
const optionsWithDefaults = {
|
11128
|
-
...defaults,
|
11129
|
-
...options,
|
11130
|
-
userAgentOptions: {
|
11103
|
+
const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
|
11131
11104
|
userAgentPrefix
|
11132
|
-
},
|
11133
|
-
endpoint: options.endpoint ?? options.baseUri ?? "{url}"
|
11134
|
-
};
|
11105
|
+
}, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{url}" });
|
11135
11106
|
super(optionsWithDefaults);
|
11136
11107
|
// Parameter assignments
|
11137
11108
|
this.url = url;
|
@@ -11152,7 +11123,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
|
|
11152
11123
|
*/
|
11153
11124
|
class StorageContextClient extends StorageClient$1 {
|
11154
11125
|
async sendOperationRequest(operationArguments, operationSpec) {
|
11155
|
-
const operationSpecToSend = {
|
11126
|
+
const operationSpecToSend = Object.assign({}, operationSpec);
|
11156
11127
|
if (operationSpecToSend.path === "/{shareName}" ||
|
11157
11128
|
operationSpecToSend.path === "/{shareName}/{directory}" ||
|
11158
11129
|
operationSpecToSend.path === "/{shareName}/{directory}/{fileName}") {
|
@@ -12480,10 +12451,7 @@ class ShareClient extends StorageClient {
|
|
12480
12451
|
*/
|
12481
12452
|
async create(options = {}) {
|
12482
12453
|
return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
12483
|
-
return assertResponse(await this.context.create({
|
12484
|
-
...updatedOptions,
|
12485
|
-
enabledProtocols: toShareProtocolsString(updatedOptions.protocols),
|
12486
|
-
}));
|
12454
|
+
return assertResponse(await this.context.create(Object.assign(Object.assign({}, updatedOptions), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
|
12487
12455
|
});
|
12488
12456
|
}
|
12489
12457
|
/**
|
@@ -12495,20 +12463,14 @@ class ShareClient extends StorageClient {
|
|
12495
12463
|
*/
|
12496
12464
|
async createIfNotExists(options = {}) {
|
12497
12465
|
return tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
|
12466
|
+
var _a, _b;
|
12498
12467
|
try {
|
12499
12468
|
const res = await this.create(updatedOptions);
|
12500
|
-
return {
|
12501
|
-
succeeded: true,
|
12502
|
-
...res,
|
12503
|
-
};
|
12469
|
+
return Object.assign({ succeeded: true }, res);
|
12504
12470
|
}
|
12505
12471
|
catch (e) {
|
12506
|
-
if (e.details
|
12507
|
-
return {
|
12508
|
-
succeeded: false,
|
12509
|
-
...e.response?.parsedHeaders,
|
12510
|
-
_response: e.response,
|
12511
|
-
};
|
12472
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareAlreadyExists") {
|
12473
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
12512
12474
|
}
|
12513
12475
|
throw e;
|
12514
12476
|
}
|
@@ -12655,10 +12617,7 @@ class ShareClient extends StorageClient {
|
|
12655
12617
|
async getProperties(options = {}) {
|
12656
12618
|
return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
12657
12619
|
const res = assertResponse(await this.context.getProperties(updatedOptions));
|
12658
|
-
return {
|
12659
|
-
...res,
|
12660
|
-
protocols: toShareProtocols(res.enabledProtocols),
|
12661
|
-
};
|
12620
|
+
return Object.assign(Object.assign({}, res), { protocols: toShareProtocols(res.enabledProtocols) });
|
12662
12621
|
});
|
12663
12622
|
}
|
12664
12623
|
/**
|
@@ -12671,9 +12630,7 @@ class ShareClient extends StorageClient {
|
|
12671
12630
|
*/
|
12672
12631
|
async delete(options = {}) {
|
12673
12632
|
return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
12674
|
-
return assertResponse(await this.context.delete({
|
12675
|
-
...updatedOptions,
|
12676
|
-
}));
|
12633
|
+
return assertResponse(await this.context.delete(Object.assign({}, updatedOptions)));
|
12677
12634
|
});
|
12678
12635
|
}
|
12679
12636
|
/**
|
@@ -12685,20 +12642,14 @@ class ShareClient extends StorageClient {
|
|
12685
12642
|
*/
|
12686
12643
|
async deleteIfExists(options = {}) {
|
12687
12644
|
return tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
12645
|
+
var _a, _b;
|
12688
12646
|
try {
|
12689
12647
|
const res = await this.delete(updatedOptions);
|
12690
|
-
return {
|
12691
|
-
succeeded: true,
|
12692
|
-
...res,
|
12693
|
-
};
|
12648
|
+
return Object.assign({ succeeded: true }, res);
|
12694
12649
|
}
|
12695
12650
|
catch (e) {
|
12696
|
-
if (e.details
|
12697
|
-
return {
|
12698
|
-
succeeded: false,
|
12699
|
-
...e.response?.parsedHeaders,
|
12700
|
-
_response: e.response,
|
12701
|
-
};
|
12651
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareNotFound") {
|
12652
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
12702
12653
|
}
|
12703
12654
|
throw e;
|
12704
12655
|
}
|
@@ -12717,10 +12668,7 @@ class ShareClient extends StorageClient {
|
|
12717
12668
|
*/
|
12718
12669
|
async setMetadata(metadata, options = {}) {
|
12719
12670
|
return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
12720
|
-
return assertResponse(await this.context.setMetadata({
|
12721
|
-
...updatedOptions,
|
12722
|
-
metadata,
|
12723
|
-
}));
|
12671
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
12724
12672
|
});
|
12725
12673
|
}
|
12726
12674
|
/**
|
@@ -12737,9 +12685,7 @@ class ShareClient extends StorageClient {
|
|
12737
12685
|
*/
|
12738
12686
|
async getAccessPolicy(options = {}) {
|
12739
12687
|
return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
12740
|
-
const response = assertResponse(await this.context.getAccessPolicy({
|
12741
|
-
...updatedOptions,
|
12742
|
-
}));
|
12688
|
+
const response = assertResponse(await this.context.getAccessPolicy(Object.assign({}, updatedOptions)));
|
12743
12689
|
const res = {
|
12744
12690
|
_response: response._response,
|
12745
12691
|
date: response.date,
|
@@ -12789,25 +12735,23 @@ class ShareClient extends StorageClient {
|
|
12789
12735
|
*/
|
12790
12736
|
async setAccessPolicy(shareAcl, options = {}) {
|
12791
12737
|
return tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
12738
|
+
var _a, _b, _c;
|
12792
12739
|
const acl = [];
|
12793
12740
|
for (const identifier of shareAcl || []) {
|
12794
12741
|
acl.push({
|
12795
12742
|
accessPolicy: {
|
12796
|
-
expiresOn: identifier.accessPolicy
|
12743
|
+
expiresOn: ((_a = identifier.accessPolicy) === null || _a === void 0 ? void 0 : _a.expiresOn)
|
12797
12744
|
? truncatedISO8061Date(identifier.accessPolicy.expiresOn)
|
12798
12745
|
: undefined,
|
12799
|
-
permissions: identifier.accessPolicy
|
12800
|
-
startsOn: identifier.accessPolicy
|
12746
|
+
permissions: (_b = identifier.accessPolicy) === null || _b === void 0 ? void 0 : _b.permissions,
|
12747
|
+
startsOn: ((_c = identifier.accessPolicy) === null || _c === void 0 ? void 0 : _c.startsOn)
|
12801
12748
|
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
|
12802
12749
|
: undefined,
|
12803
12750
|
},
|
12804
12751
|
id: identifier.id,
|
12805
12752
|
});
|
12806
12753
|
}
|
12807
|
-
return assertResponse(await this.context.setAccessPolicy({
|
12808
|
-
...updatedOptions,
|
12809
|
-
shareAcl: acl,
|
12810
|
-
}));
|
12754
|
+
return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign({}, updatedOptions), { shareAcl: acl })));
|
12811
12755
|
});
|
12812
12756
|
}
|
12813
12757
|
/**
|
@@ -12832,10 +12776,7 @@ class ShareClient extends StorageClient {
|
|
12832
12776
|
*/
|
12833
12777
|
async setQuota(quotaInGB, options = {}) {
|
12834
12778
|
return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
12835
|
-
return assertResponse(await this.context.setProperties({
|
12836
|
-
...updatedOptions,
|
12837
|
-
quota: quotaInGB,
|
12838
|
-
}));
|
12779
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, updatedOptions), { quota: quotaInGB })));
|
12839
12780
|
});
|
12840
12781
|
}
|
12841
12782
|
/**
|
@@ -12846,11 +12787,7 @@ class ShareClient extends StorageClient {
|
|
12846
12787
|
*/
|
12847
12788
|
async setProperties(options = {}) {
|
12848
12789
|
return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
12849
|
-
return assertResponse(await this.context.setProperties({
|
12850
|
-
...options,
|
12851
|
-
quota: options.quotaInGB,
|
12852
|
-
tracingOptions: updatedOptions.tracingOptions,
|
12853
|
-
}));
|
12790
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, options), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
|
12854
12791
|
});
|
12855
12792
|
}
|
12856
12793
|
/**
|
@@ -12863,7 +12800,7 @@ class ShareClient extends StorageClient {
|
|
12863
12800
|
return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
12864
12801
|
const response = assertResponse(await this.context.getStatistics(updatedOptions));
|
12865
12802
|
const GBBytes = 1024 * 1024 * 1024;
|
12866
|
-
return {
|
12803
|
+
return Object.assign(Object.assign({}, response), { shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) });
|
12867
12804
|
});
|
12868
12805
|
}
|
12869
12806
|
/**
|
@@ -12878,10 +12815,7 @@ class ShareClient extends StorageClient {
|
|
12878
12815
|
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
12879
12816
|
return assertResponse(await this.context.createPermission({
|
12880
12817
|
permission: filePermission,
|
12881
|
-
}, {
|
12882
|
-
...updatedOptions,
|
12883
|
-
...this.shareClientConfig,
|
12884
|
-
}));
|
12818
|
+
}, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
12885
12819
|
});
|
12886
12820
|
}
|
12887
12821
|
/**
|
@@ -12894,10 +12828,7 @@ class ShareClient extends StorageClient {
|
|
12894
12828
|
*/
|
12895
12829
|
async getPermission(filePermissionKey, options = {}) {
|
12896
12830
|
return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
12897
|
-
return assertResponse(await this.context.getPermission(filePermissionKey, {
|
12898
|
-
...updatedOptions,
|
12899
|
-
...this.shareClientConfig,
|
12900
|
-
}));
|
12831
|
+
return assertResponse(await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
12901
12832
|
});
|
12902
12833
|
}
|
12903
12834
|
/**
|
@@ -12915,10 +12846,7 @@ class ShareClient extends StorageClient {
|
|
12915
12846
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
12916
12847
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
12917
12848
|
}
|
12918
|
-
const sas = generateFileSASQueryParameters({
|
12919
|
-
shareName: this.name,
|
12920
|
-
...options,
|
12921
|
-
}, this.credential).toString();
|
12849
|
+
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.name }, options), this.credential).toString();
|
12922
12850
|
return appendToURLQuery(this.url, sas);
|
12923
12851
|
}
|
12924
12852
|
}
|
@@ -12987,13 +12915,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
12987
12915
|
return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
12988
12916
|
return assertResponse(await this.context.create(updatedOptions.fileAttributes
|
12989
12917
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
12990
|
-
: FileAttributesNone, {
|
12991
|
-
...updatedOptions,
|
12992
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
12993
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
12994
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
12995
|
-
...this.shareClientConfig,
|
12996
|
-
}));
|
12918
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
12997
12919
|
});
|
12998
12920
|
}
|
12999
12921
|
/**
|
@@ -13005,20 +12927,14 @@ class ShareDirectoryClient extends StorageClient {
|
|
13005
12927
|
*/
|
13006
12928
|
async createIfNotExists(options = {}) {
|
13007
12929
|
return tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
12930
|
+
var _a, _b;
|
13008
12931
|
try {
|
13009
12932
|
const res = await this.create(updatedOptions);
|
13010
|
-
return {
|
13011
|
-
succeeded: true,
|
13012
|
-
...res,
|
13013
|
-
};
|
12933
|
+
return Object.assign({ succeeded: true }, res);
|
13014
12934
|
}
|
13015
12935
|
catch (e) {
|
13016
|
-
if (e.details
|
13017
|
-
return {
|
13018
|
-
succeeded: false,
|
13019
|
-
...e.response?.parsedHeaders,
|
13020
|
-
_response: e.response,
|
13021
|
-
};
|
12936
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceAlreadyExists") {
|
12937
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
13022
12938
|
}
|
13023
12939
|
throw e;
|
13024
12940
|
}
|
@@ -13036,13 +12952,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13036
12952
|
return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
13037
12953
|
return assertResponse(await this.context.setProperties(updatedOptions.fileAttributes
|
13038
12954
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
13039
|
-
: FileAttributesPreserve, {
|
13040
|
-
...updatedOptions,
|
13041
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
13042
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
13043
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
13044
|
-
...this.shareClientConfig,
|
13045
|
-
}));
|
12955
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
13046
12956
|
});
|
13047
12957
|
}
|
13048
12958
|
/**
|
@@ -13175,7 +13085,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13175
13085
|
async exists(options = {}) {
|
13176
13086
|
return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
13177
13087
|
try {
|
13178
|
-
await this.getProperties({
|
13088
|
+
await this.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
13179
13089
|
return true;
|
13180
13090
|
}
|
13181
13091
|
catch (e) {
|
@@ -13197,7 +13107,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13197
13107
|
*/
|
13198
13108
|
async getProperties(options = {}) {
|
13199
13109
|
return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
13200
|
-
return assertResponse(await this.context.getProperties({
|
13110
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
13201
13111
|
});
|
13202
13112
|
}
|
13203
13113
|
/**
|
@@ -13210,7 +13120,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13210
13120
|
*/
|
13211
13121
|
async delete(options = {}) {
|
13212
13122
|
return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
13213
|
-
return assertResponse(await this.context.delete({
|
13123
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
13214
13124
|
});
|
13215
13125
|
}
|
13216
13126
|
/**
|
@@ -13222,21 +13132,15 @@ class ShareDirectoryClient extends StorageClient {
|
|
13222
13132
|
*/
|
13223
13133
|
async deleteIfExists(options = {}) {
|
13224
13134
|
return tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
13135
|
+
var _a, _b, _c;
|
13225
13136
|
try {
|
13226
13137
|
const res = await this.delete(updatedOptions);
|
13227
|
-
return {
|
13228
|
-
succeeded: true,
|
13229
|
-
...res,
|
13230
|
-
};
|
13138
|
+
return Object.assign({ succeeded: true }, res);
|
13231
13139
|
}
|
13232
13140
|
catch (e) {
|
13233
|
-
if (e.details
|
13234
|
-
e.details
|
13235
|
-
return {
|
13236
|
-
succeeded: false,
|
13237
|
-
...e.response?.parsedHeaders,
|
13238
|
-
_response: e.response,
|
13239
|
-
};
|
13141
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
13142
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
13143
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
13240
13144
|
}
|
13241
13145
|
throw e;
|
13242
13146
|
}
|
@@ -13252,11 +13156,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13252
13156
|
*/
|
13253
13157
|
async setMetadata(metadata, options = {}) {
|
13254
13158
|
return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
13255
|
-
return assertResponse(await this.context.setMetadata({
|
13256
|
-
...updatedOptions,
|
13257
|
-
metadata,
|
13258
|
-
...this.shareClientConfig,
|
13259
|
-
}));
|
13159
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
13260
13160
|
});
|
13261
13161
|
}
|
13262
13162
|
/**
|
@@ -13271,35 +13171,52 @@ class ShareDirectoryClient extends StorageClient {
|
|
13271
13171
|
* items. The marker value is opaque to the client.
|
13272
13172
|
* @param options - Options to list files and directories operation.
|
13273
13173
|
*/
|
13274
|
-
|
13275
|
-
|
13276
|
-
options.prefix
|
13277
|
-
|
13278
|
-
|
13279
|
-
|
13280
|
-
|
13281
|
-
|
13282
|
-
|
13283
|
-
|
13174
|
+
iterateFilesAndDirectoriesSegments(marker, options = {}) {
|
13175
|
+
return tslib.__asyncGenerator(this, arguments, function* iterateFilesAndDirectoriesSegments_1() {
|
13176
|
+
if (options.prefix === "") {
|
13177
|
+
options.prefix = undefined;
|
13178
|
+
}
|
13179
|
+
let listFilesAndDirectoriesResponse;
|
13180
|
+
do {
|
13181
|
+
listFilesAndDirectoriesResponse = yield tslib.__await(this.listFilesAndDirectoriesSegment(marker, options));
|
13182
|
+
marker = listFilesAndDirectoriesResponse.continuationToken;
|
13183
|
+
yield yield tslib.__await(yield tslib.__await(listFilesAndDirectoriesResponse));
|
13184
|
+
} while (marker);
|
13185
|
+
});
|
13284
13186
|
}
|
13285
13187
|
/**
|
13286
13188
|
* Returns an AsyncIterableIterator for file and directory items
|
13287
13189
|
*
|
13288
13190
|
* @param options - Options to list files and directories operation.
|
13289
13191
|
*/
|
13290
|
-
|
13291
|
-
|
13292
|
-
|
13293
|
-
|
13294
|
-
|
13295
|
-
for await (const listFilesAndDirectoriesResponse of this.iterateFilesAndDirectoriesSegments(marker, options)) {
|
13296
|
-
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
13297
|
-
yield { kind: "file", ...file };
|
13192
|
+
listFilesAndDirectoriesItems(options = {}) {
|
13193
|
+
return tslib.__asyncGenerator(this, arguments, function* listFilesAndDirectoriesItems_1() {
|
13194
|
+
var _a, e_1, _b, _c;
|
13195
|
+
if (options.prefix === "") {
|
13196
|
+
options.prefix = undefined;
|
13298
13197
|
}
|
13299
|
-
|
13300
|
-
|
13198
|
+
let marker;
|
13199
|
+
try {
|
13200
|
+
for (var _d = true, _e = tslib.__asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
13201
|
+
_c = _f.value;
|
13202
|
+
_d = false;
|
13203
|
+
const listFilesAndDirectoriesResponse = _c;
|
13204
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
13205
|
+
yield yield tslib.__await(Object.assign({ kind: "file" }, file));
|
13206
|
+
}
|
13207
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
13208
|
+
yield yield tslib.__await(Object.assign({ kind: "directory" }, directory));
|
13209
|
+
}
|
13210
|
+
}
|
13301
13211
|
}
|
13302
|
-
|
13212
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
13213
|
+
finally {
|
13214
|
+
try {
|
13215
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
13216
|
+
}
|
13217
|
+
finally { if (e_1) throw e_1.error; }
|
13218
|
+
}
|
13219
|
+
});
|
13303
13220
|
}
|
13304
13221
|
/**
|
13305
13222
|
* Returns an async iterable iterator to list all the files and directories
|
@@ -13408,10 +13325,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13408
13325
|
if (options.prefix === "") {
|
13409
13326
|
options.prefix = undefined;
|
13410
13327
|
}
|
13411
|
-
const updatedOptions = {
|
13412
|
-
...options,
|
13413
|
-
...(include.length > 0 ? { include: include } : {}),
|
13414
|
-
};
|
13328
|
+
const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
|
13415
13329
|
// AsyncIterableIterator to iterate over files and directories
|
13416
13330
|
const iter = this.listFilesAndDirectoriesItems(updatedOptions);
|
13417
13331
|
return {
|
@@ -13431,10 +13345,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13431
13345
|
* Return an AsyncIterableIterator that works a page at a time
|
13432
13346
|
*/
|
13433
13347
|
byPage: (settings = {}) => {
|
13434
|
-
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), {
|
13435
|
-
maxResults: settings.maxPageSize,
|
13436
|
-
...updatedOptions,
|
13437
|
-
});
|
13348
|
+
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
|
13438
13349
|
},
|
13439
13350
|
};
|
13440
13351
|
}
|
@@ -13452,18 +13363,8 @@ class ShareDirectoryClient extends StorageClient {
|
|
13452
13363
|
options.prefix = undefined;
|
13453
13364
|
}
|
13454
13365
|
return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
13455
|
-
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment({
|
13456
|
-
|
13457
|
-
marker,
|
13458
|
-
...this.shareClientConfig,
|
13459
|
-
}));
|
13460
|
-
const wrappedResponse = {
|
13461
|
-
...ConvertInternalResponseOfListFiles(rawResponse),
|
13462
|
-
_response: {
|
13463
|
-
...rawResponse._response,
|
13464
|
-
parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody),
|
13465
|
-
}, // _response is made non-enumerable
|
13466
|
-
};
|
13366
|
+
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
13367
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListFiles(rawResponse)), { _response: Object.assign(Object.assign({}, rawResponse._response), { parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody) }) });
|
13467
13368
|
return wrappedResponse;
|
13468
13369
|
});
|
13469
13370
|
}
|
@@ -13477,30 +13378,47 @@ class ShareDirectoryClient extends StorageClient {
|
|
13477
13378
|
* set of list items.
|
13478
13379
|
* @param options - Options to list handles operation.
|
13479
13380
|
*/
|
13480
|
-
|
13481
|
-
|
13482
|
-
|
13483
|
-
|
13484
|
-
|
13485
|
-
|
13486
|
-
|
13487
|
-
|
13488
|
-
|
13381
|
+
iterateHandleSegments(marker, options = {}) {
|
13382
|
+
return tslib.__asyncGenerator(this, arguments, function* iterateHandleSegments_1() {
|
13383
|
+
let listHandlesResponse;
|
13384
|
+
if (!!marker || marker === undefined) {
|
13385
|
+
do {
|
13386
|
+
listHandlesResponse = yield tslib.__await(this.listHandlesSegment(marker, options));
|
13387
|
+
marker = listHandlesResponse.continuationToken;
|
13388
|
+
yield yield tslib.__await(yield tslib.__await(listHandlesResponse));
|
13389
|
+
} while (marker);
|
13390
|
+
}
|
13391
|
+
});
|
13489
13392
|
}
|
13490
13393
|
/**
|
13491
13394
|
* Returns an AsyncIterableIterator for handles
|
13492
13395
|
*
|
13493
13396
|
* @param options - Options to list handles operation.
|
13494
13397
|
*/
|
13495
|
-
|
13496
|
-
|
13497
|
-
|
13498
|
-
|
13499
|
-
|
13500
|
-
|
13398
|
+
listHandleItems(options = {}) {
|
13399
|
+
return tslib.__asyncGenerator(this, arguments, function* listHandleItems_1() {
|
13400
|
+
var _a, e_2, _b, _c;
|
13401
|
+
let marker;
|
13402
|
+
try {
|
13403
|
+
for (var _d = true, _e = tslib.__asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
13404
|
+
_c = _f.value;
|
13405
|
+
_d = false;
|
13406
|
+
const listHandlesResponse = _c;
|
13407
|
+
if (listHandlesResponse.handleList) {
|
13408
|
+
for (const handle of listHandlesResponse.handleList) {
|
13409
|
+
yield yield tslib.__await(handle);
|
13410
|
+
}
|
13411
|
+
}
|
13501
13412
|
}
|
13502
13413
|
}
|
13503
|
-
|
13414
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
13415
|
+
finally {
|
13416
|
+
try {
|
13417
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
13418
|
+
}
|
13419
|
+
finally { if (e_2) throw e_2.error; }
|
13420
|
+
}
|
13421
|
+
});
|
13504
13422
|
}
|
13505
13423
|
/**
|
13506
13424
|
* Returns an async iterable iterator to list all the handles.
|
@@ -13598,10 +13516,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13598
13516
|
* Return an AsyncIterableIterator that works a page at a time
|
13599
13517
|
*/
|
13600
13518
|
byPage: (settings = {}) => {
|
13601
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
13602
|
-
maxResults: settings.maxPageSize,
|
13603
|
-
...options,
|
13604
|
-
});
|
13519
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, options));
|
13605
13520
|
},
|
13606
13521
|
};
|
13607
13522
|
}
|
@@ -13619,23 +13534,13 @@ class ShareDirectoryClient extends StorageClient {
|
|
13619
13534
|
async listHandlesSegment(marker, options = {}) {
|
13620
13535
|
return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
13621
13536
|
marker = marker === "" ? undefined : marker;
|
13622
|
-
const response = assertResponse(await this.context.listHandles({
|
13623
|
-
...updatedOptions,
|
13624
|
-
marker,
|
13625
|
-
...this.shareClientConfig,
|
13626
|
-
}));
|
13537
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
13627
13538
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
13628
13539
|
// response.handleList is an empty string
|
13629
13540
|
if (response.handleList === "") {
|
13630
13541
|
response.handleList = undefined;
|
13631
13542
|
}
|
13632
|
-
const wrappedResponse = {
|
13633
|
-
...ConvertInternalResponseOfListHandles(response),
|
13634
|
-
_response: {
|
13635
|
-
...response._response,
|
13636
|
-
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
13637
|
-
},
|
13638
|
-
};
|
13543
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
|
13639
13544
|
return wrappedResponse;
|
13640
13545
|
});
|
13641
13546
|
}
|
@@ -13652,19 +13557,12 @@ class ShareDirectoryClient extends StorageClient {
|
|
13652
13557
|
*/
|
13653
13558
|
async forceCloseHandlesSegment(marker, options = {}) {
|
13654
13559
|
return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
13560
|
+
var _a, _b;
|
13655
13561
|
if (marker === "") {
|
13656
13562
|
marker = undefined;
|
13657
13563
|
}
|
13658
|
-
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", {
|
13659
|
-
|
13660
|
-
marker,
|
13661
|
-
...this.shareClientConfig,
|
13662
|
-
}));
|
13663
|
-
return {
|
13664
|
-
...rawResponse,
|
13665
|
-
closedHandlesCount: rawResponse.numberOfHandlesClosed ?? 0,
|
13666
|
-
closeFailureCount: rawResponse.numberOfHandlesFailedToClose ?? 0,
|
13667
|
-
};
|
13564
|
+
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
13565
|
+
return Object.assign(Object.assign({}, rawResponse), { closedHandlesCount: (_a = rawResponse.numberOfHandlesClosed) !== null && _a !== void 0 ? _a : 0, closeFailureCount: (_b = rawResponse.numberOfHandlesFailedToClose) !== null && _b !== void 0 ? _b : 0 });
|
13668
13566
|
});
|
13669
13567
|
}
|
13670
13568
|
/**
|
@@ -13709,10 +13607,7 @@ class ShareDirectoryClient extends StorageClient {
|
|
13709
13607
|
if (handleId === "*") {
|
13710
13608
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
13711
13609
|
}
|
13712
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
13713
|
-
...updatedOptions,
|
13714
|
-
...this.shareClientConfig,
|
13715
|
-
});
|
13610
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
13716
13611
|
const response = rawResponse;
|
13717
13612
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
13718
13613
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -13755,20 +13650,15 @@ class ShareDirectoryClient extends StorageClient {
|
|
13755
13650
|
}
|
13756
13651
|
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
13757
13652
|
return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
13758
|
-
const response = assertResponse(await destDirectory.context.rename(this.url, {
|
13759
|
-
...updatedOptions,
|
13760
|
-
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
13653
|
+
const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
13761
13654
|
? {
|
13762
13655
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
13763
13656
|
}
|
13764
|
-
: undefined,
|
13765
|
-
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
13657
|
+
: undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
13766
13658
|
? {
|
13767
13659
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
13768
13660
|
}
|
13769
|
-
: undefined,
|
13770
|
-
...this.shareClientConfig,
|
13771
|
-
}));
|
13661
|
+
: undefined }), this.shareClientConfig)));
|
13772
13662
|
return {
|
13773
13663
|
destinationDirectoryClient: destDirectory,
|
13774
13664
|
directoryRenameResponse: response,
|
@@ -13864,13 +13754,7 @@ class ShareFileClient extends StorageClient {
|
|
13864
13754
|
return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
13865
13755
|
return assertResponse(await this.context.create(size, updatedOptions.fileAttributes
|
13866
13756
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
13867
|
-
: FileAttributesNone, {
|
13868
|
-
...updatedOptions,
|
13869
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
13870
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
13871
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
13872
|
-
...this.shareClientConfig,
|
13873
|
-
}));
|
13757
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
13874
13758
|
});
|
13875
13759
|
}
|
13876
13760
|
/**
|
@@ -13940,14 +13824,9 @@ class ShareFileClient extends StorageClient {
|
|
13940
13824
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
13941
13825
|
}
|
13942
13826
|
const downloadFullFile = offset === 0 && !count;
|
13943
|
-
const res = assertResponse(await this.context.download({
|
13944
|
-
...updatedOptions,
|
13945
|
-
requestOptions: {
|
13827
|
+
const res = assertResponse(await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
13946
13828
|
onDownloadProgress: coreUtil.isNode ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
13947
|
-
},
|
13948
|
-
range: downloadFullFile ? undefined : rangeToString({ offset, count }),
|
13949
|
-
...this.shareClientConfig,
|
13950
|
-
}));
|
13829
|
+
}, range: downloadFullFile ? undefined : rangeToString({ offset, count }) }), this.shareClientConfig)));
|
13951
13830
|
// Return browser response immediately
|
13952
13831
|
if (!coreUtil.isNode) {
|
13953
13832
|
return res;
|
@@ -13977,11 +13856,7 @@ class ShareFileClient extends StorageClient {
|
|
13977
13856
|
// chunkDownloadOptions.range
|
13978
13857
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
13979
13858
|
// );
|
13980
|
-
const downloadRes = await this.context.download({
|
13981
|
-
...updatedOptions,
|
13982
|
-
...updatedDownloadOptions,
|
13983
|
-
...this.shareClientConfig, // TODO: confirm whether this is needed
|
13984
|
-
});
|
13859
|
+
const downloadRes = await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions), this.shareClientConfig));
|
13985
13860
|
if (!(downloadRes.etag === res.etag)) {
|
13986
13861
|
throw new Error("File has been modified concurrently");
|
13987
13862
|
}
|
@@ -14025,7 +13900,7 @@ class ShareFileClient extends StorageClient {
|
|
14025
13900
|
*/
|
14026
13901
|
async getProperties(options = {}) {
|
14027
13902
|
return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
14028
|
-
return assertResponse(await this.context.getProperties({
|
13903
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
14029
13904
|
});
|
14030
13905
|
}
|
14031
13906
|
/**
|
@@ -14043,13 +13918,7 @@ class ShareFileClient extends StorageClient {
|
|
14043
13918
|
return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
14044
13919
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
14045
13920
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
14046
|
-
: FileAttributesPreserve, {
|
14047
|
-
...updatedOptions,
|
14048
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
14049
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
14050
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
14051
|
-
...this.shareClientConfig,
|
14052
|
-
}));
|
13921
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
14053
13922
|
});
|
14054
13923
|
}
|
14055
13924
|
/**
|
@@ -14071,7 +13940,7 @@ class ShareFileClient extends StorageClient {
|
|
14071
13940
|
*/
|
14072
13941
|
async delete(options = {}) {
|
14073
13942
|
return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
14074
|
-
return assertResponse(await this.context.delete({
|
13943
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
14075
13944
|
});
|
14076
13945
|
}
|
14077
13946
|
/**
|
@@ -14092,21 +13961,15 @@ class ShareFileClient extends StorageClient {
|
|
14092
13961
|
*/
|
14093
13962
|
async deleteIfExists(options = {}) {
|
14094
13963
|
return tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
13964
|
+
var _a, _b, _c;
|
14095
13965
|
try {
|
14096
13966
|
const res = await this.delete(updatedOptions);
|
14097
|
-
return {
|
14098
|
-
succeeded: true,
|
14099
|
-
...res,
|
14100
|
-
};
|
13967
|
+
return Object.assign({ succeeded: true }, res);
|
14101
13968
|
}
|
14102
13969
|
catch (e) {
|
14103
|
-
if (e.details
|
14104
|
-
e.details
|
14105
|
-
return {
|
14106
|
-
succeeded: false,
|
14107
|
-
...e.response?.parsedHeaders,
|
14108
|
-
_response: e.response,
|
14109
|
-
};
|
13970
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
13971
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
13972
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
14110
13973
|
}
|
14111
13974
|
throw e;
|
14112
13975
|
}
|
@@ -14130,14 +13993,7 @@ class ShareFileClient extends StorageClient {
|
|
14130
13993
|
return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
14131
13994
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
14132
13995
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
14133
|
-
: FileAttributesPreserve, {
|
14134
|
-
...updatedOptions,
|
14135
|
-
fileHttpHeaders,
|
14136
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
14137
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
14138
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
14139
|
-
...this.shareClientConfig,
|
14140
|
-
}));
|
13996
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime) }), this.shareClientConfig)));
|
14141
13997
|
});
|
14142
13998
|
}
|
14143
13999
|
/**
|
@@ -14158,14 +14014,7 @@ class ShareFileClient extends StorageClient {
|
|
14158
14014
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
14159
14015
|
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
14160
14016
|
return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
14161
|
-
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), {
|
14162
|
-
...updatedOptions,
|
14163
|
-
fileContentLength: length,
|
14164
|
-
fileChangeOn: fileChangeTimeToString(options.changeTime),
|
14165
|
-
fileCreatedOn: fileCreationTimeToString(options.creationTime),
|
14166
|
-
fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime),
|
14167
|
-
...this.shareClientConfig,
|
14168
|
-
}));
|
14017
|
+
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileContentLength: length, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }), this.shareClientConfig)));
|
14169
14018
|
});
|
14170
14019
|
}
|
14171
14020
|
/**
|
@@ -14181,11 +14030,7 @@ class ShareFileClient extends StorageClient {
|
|
14181
14030
|
*/
|
14182
14031
|
async setMetadata(metadata = {}, options = {}) {
|
14183
14032
|
return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
14184
|
-
return assertResponse(await this.context.setMetadata({
|
14185
|
-
...updatedOptions,
|
14186
|
-
metadata,
|
14187
|
-
...this.shareClientConfig,
|
14188
|
-
}));
|
14033
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
14189
14034
|
});
|
14190
14035
|
}
|
14191
14036
|
/**
|
@@ -14226,14 +14071,9 @@ class ShareFileClient extends StorageClient {
|
|
14226
14071
|
if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
|
14227
14072
|
throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
14228
14073
|
}
|
14229
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, {
|
14230
|
-
...updatedOptions,
|
14231
|
-
requestOptions: {
|
14074
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
14232
14075
|
onUploadProgress: updatedOptions.onProgress,
|
14233
|
-
},
|
14234
|
-
body,
|
14235
|
-
...this.shareClientConfig,
|
14236
|
-
}));
|
14076
|
+
}, body }), this.shareClientConfig)));
|
14237
14077
|
});
|
14238
14078
|
}
|
14239
14079
|
/**
|
@@ -14254,13 +14094,7 @@ class ShareFileClient extends StorageClient {
|
|
14254
14094
|
if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
|
14255
14095
|
throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
14256
14096
|
}
|
14257
|
-
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, {
|
14258
|
-
...updatedOptions,
|
14259
|
-
sourceRange: rangeToString({ offset: sourceOffset, count }),
|
14260
|
-
sourceModifiedAccessConditions: updatedOptions.sourceConditions,
|
14261
|
-
copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization),
|
14262
|
-
...this.shareClientConfig,
|
14263
|
-
}));
|
14097
|
+
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: updatedOptions.sourceConditions, copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization) }), this.shareClientConfig)));
|
14264
14098
|
});
|
14265
14099
|
}
|
14266
14100
|
/**
|
@@ -14276,7 +14110,7 @@ class ShareFileClient extends StorageClient {
|
|
14276
14110
|
if (offset < 0 || contentLength <= 0) {
|
14277
14111
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
14278
14112
|
}
|
14279
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, {
|
14113
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
14280
14114
|
});
|
14281
14115
|
}
|
14282
14116
|
/**
|
@@ -14286,20 +14120,12 @@ class ShareFileClient extends StorageClient {
|
|
14286
14120
|
*/
|
14287
14121
|
async getRangeList(options = {}) {
|
14288
14122
|
return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
14289
|
-
const originalResponse = assertResponse(await this.context.getRangeList({
|
14290
|
-
...updatedOptions,
|
14291
|
-
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
14292
|
-
...this.shareClientConfig,
|
14293
|
-
}));
|
14123
|
+
const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
14294
14124
|
// Only returns ranges, ignoring clearRanges.
|
14295
14125
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
14296
14126
|
? originalResponse._response.parsedBody.ranges
|
14297
14127
|
: [];
|
14298
|
-
return {
|
14299
|
-
...originalResponse,
|
14300
|
-
_response: { ...originalResponse._response, parsedBody },
|
14301
|
-
rangeList: originalResponse.ranges ? originalResponse.ranges : [],
|
14302
|
-
};
|
14128
|
+
return Object.assign(Object.assign({}, originalResponse), { _response: Object.assign(Object.assign({}, originalResponse._response), { parsedBody }), rangeList: originalResponse.ranges ? originalResponse.ranges : [] });
|
14303
14129
|
});
|
14304
14130
|
}
|
14305
14131
|
/**
|
@@ -14310,12 +14136,7 @@ class ShareFileClient extends StorageClient {
|
|
14310
14136
|
*/
|
14311
14137
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
14312
14138
|
return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
14313
|
-
return assertResponse(await this.context.getRangeList({
|
14314
|
-
...updatedOptions,
|
14315
|
-
prevsharesnapshot: prevShareSnapshot,
|
14316
|
-
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
14317
|
-
...this.shareClientConfig,
|
14318
|
-
}));
|
14139
|
+
return assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
14319
14140
|
});
|
14320
14141
|
}
|
14321
14142
|
/**
|
@@ -14332,10 +14153,7 @@ class ShareFileClient extends StorageClient {
|
|
14332
14153
|
*/
|
14333
14154
|
async startCopyFromURL(copySource, options = {}) {
|
14334
14155
|
return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
14335
|
-
return assertResponse(await this.context.startCopy(copySource, {
|
14336
|
-
...updatedOptions,
|
14337
|
-
...this.shareClientConfig,
|
14338
|
-
}));
|
14156
|
+
return assertResponse(await this.context.startCopy(copySource, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
14339
14157
|
});
|
14340
14158
|
}
|
14341
14159
|
/**
|
@@ -14348,7 +14166,7 @@ class ShareFileClient extends StorageClient {
|
|
14348
14166
|
*/
|
14349
14167
|
async abortCopyFromURL(copyId, options = {}) {
|
14350
14168
|
return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
14351
|
-
return assertResponse(await this.context.abortCopy(copyId, {
|
14169
|
+
return assertResponse(await this.context.abortCopy(copyId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
14352
14170
|
});
|
14353
14171
|
}
|
14354
14172
|
// High Level functions
|
@@ -14686,23 +14504,13 @@ class ShareFileClient extends StorageClient {
|
|
14686
14504
|
async listHandlesSegment(marker, options = {}) {
|
14687
14505
|
return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
14688
14506
|
marker = marker === "" ? undefined : marker;
|
14689
|
-
const response = assertResponse(await this.context.listHandles({
|
14690
|
-
...updatedOptions,
|
14691
|
-
...this.shareClientConfig,
|
14692
|
-
marker,
|
14693
|
-
}));
|
14507
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker })));
|
14694
14508
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
14695
14509
|
// response.handleList is an empty string
|
14696
14510
|
if (response.handleList === "") {
|
14697
14511
|
response.handleList = undefined;
|
14698
14512
|
}
|
14699
|
-
const wrappedResponse = {
|
14700
|
-
...ConvertInternalResponseOfListHandles(response),
|
14701
|
-
_response: {
|
14702
|
-
...response._response,
|
14703
|
-
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
14704
|
-
},
|
14705
|
-
};
|
14513
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
|
14706
14514
|
return wrappedResponse;
|
14707
14515
|
});
|
14708
14516
|
}
|
@@ -14716,30 +14524,47 @@ class ShareFileClient extends StorageClient {
|
|
14716
14524
|
* set of list items.
|
14717
14525
|
* @param options - Options to list handles operation.
|
14718
14526
|
*/
|
14719
|
-
|
14720
|
-
|
14721
|
-
|
14722
|
-
|
14723
|
-
|
14724
|
-
|
14725
|
-
|
14726
|
-
|
14727
|
-
|
14527
|
+
iterateHandleSegments(marker, options = {}) {
|
14528
|
+
return tslib.__asyncGenerator(this, arguments, function* iterateHandleSegments_2() {
|
14529
|
+
let listHandlesResponse;
|
14530
|
+
if (!!marker || marker === undefined) {
|
14531
|
+
do {
|
14532
|
+
listHandlesResponse = yield tslib.__await(this.listHandlesSegment(marker, options));
|
14533
|
+
marker = listHandlesResponse.continuationToken;
|
14534
|
+
yield yield tslib.__await(listHandlesResponse);
|
14535
|
+
} while (marker);
|
14536
|
+
}
|
14537
|
+
});
|
14728
14538
|
}
|
14729
14539
|
/**
|
14730
14540
|
* Returns an AsyncIterableIterator for handles
|
14731
14541
|
*
|
14732
14542
|
* @param options - Options to list handles operation.
|
14733
14543
|
*/
|
14734
|
-
|
14735
|
-
|
14736
|
-
|
14737
|
-
|
14738
|
-
|
14739
|
-
|
14544
|
+
listHandleItems(options = {}) {
|
14545
|
+
return tslib.__asyncGenerator(this, arguments, function* listHandleItems_2() {
|
14546
|
+
var _a, e_3, _b, _c;
|
14547
|
+
let marker;
|
14548
|
+
try {
|
14549
|
+
for (var _d = true, _e = tslib.__asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
14550
|
+
_c = _f.value;
|
14551
|
+
_d = false;
|
14552
|
+
const listHandlesResponse = _c;
|
14553
|
+
if (listHandlesResponse.handleList) {
|
14554
|
+
for (const handle of listHandlesResponse.handleList) {
|
14555
|
+
yield yield tslib.__await(handle);
|
14556
|
+
}
|
14557
|
+
}
|
14740
14558
|
}
|
14741
14559
|
}
|
14742
|
-
|
14560
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
14561
|
+
finally {
|
14562
|
+
try {
|
14563
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
14564
|
+
}
|
14565
|
+
finally { if (e_3) throw e_3.error; }
|
14566
|
+
}
|
14567
|
+
});
|
14743
14568
|
}
|
14744
14569
|
/**
|
14745
14570
|
* Returns an async iterable iterator to list all the handles.
|
@@ -14771,10 +14596,7 @@ class ShareFileClient extends StorageClient {
|
|
14771
14596
|
* Return an AsyncIterableIterator that works a page at a time
|
14772
14597
|
*/
|
14773
14598
|
byPage: (settings = {}) => {
|
14774
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
14775
|
-
maxPageSize: settings.maxPageSize,
|
14776
|
-
...options,
|
14777
|
-
});
|
14599
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxPageSize: settings.maxPageSize }, options));
|
14778
14600
|
},
|
14779
14601
|
};
|
14780
14602
|
}
|
@@ -14792,11 +14614,7 @@ class ShareFileClient extends StorageClient {
|
|
14792
14614
|
async forceCloseHandlesSegment(marker, options = {}) {
|
14793
14615
|
return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
14794
14616
|
marker = marker === "" ? undefined : marker;
|
14795
|
-
const rawResponse = await this.context.forceCloseHandles("*", {
|
14796
|
-
...updatedOptions,
|
14797
|
-
...this.shareClientConfig,
|
14798
|
-
marker,
|
14799
|
-
});
|
14617
|
+
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker }));
|
14800
14618
|
const response = rawResponse;
|
14801
14619
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
14802
14620
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -14843,10 +14661,7 @@ class ShareFileClient extends StorageClient {
|
|
14843
14661
|
if (handleId === "*") {
|
14844
14662
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
14845
14663
|
}
|
14846
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
14847
|
-
...updatedOptions,
|
14848
|
-
...this.shareClientConfig,
|
14849
|
-
});
|
14664
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
14850
14665
|
const response = rawResponse;
|
14851
14666
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
14852
14667
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -14877,11 +14692,7 @@ class ShareFileClient extends StorageClient {
|
|
14877
14692
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
14878
14693
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
14879
14694
|
}
|
14880
|
-
const sas = generateFileSASQueryParameters({
|
14881
|
-
shareName: this.shareName,
|
14882
|
-
filePath: this.path,
|
14883
|
-
...options,
|
14884
|
-
}, this.credential).toString();
|
14695
|
+
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).toString();
|
14885
14696
|
return appendToURLQuery(this.url, sas);
|
14886
14697
|
}
|
14887
14698
|
/**
|
@@ -14920,25 +14731,19 @@ class ShareFileClient extends StorageClient {
|
|
14920
14731
|
}
|
14921
14732
|
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
14922
14733
|
return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
14923
|
-
const response = assertResponse(await destFile.context.rename(this.url, {
|
14924
|
-
...updatedOptions,
|
14925
|
-
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
14734
|
+
const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
14926
14735
|
? {
|
14927
14736
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
14928
14737
|
}
|
14929
|
-
: undefined,
|
14930
|
-
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
14738
|
+
: undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
14931
14739
|
? {
|
14932
14740
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
14933
14741
|
}
|
14934
|
-
: undefined,
|
14935
|
-
fileHttpHeaders: options.contentType
|
14742
|
+
: undefined, fileHttpHeaders: options.contentType
|
14936
14743
|
? {
|
14937
14744
|
fileContentType: options.contentType,
|
14938
14745
|
}
|
14939
|
-
: undefined,
|
14940
|
-
...this.shareClientConfig,
|
14941
|
-
}));
|
14746
|
+
: undefined }), this.shareClientConfig)));
|
14942
14747
|
return {
|
14943
14748
|
destinationFileClient: destFile,
|
14944
14749
|
fileRenameResponse: response,
|
@@ -14997,11 +14802,7 @@ class ShareLeaseClient {
|
|
14997
14802
|
*/
|
14998
14803
|
async acquireLease(duration = -1, options = {}) {
|
14999
14804
|
return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
15000
|
-
return assertResponse(await this.fileOrShare.acquireLease({
|
15001
|
-
...updatedOptions,
|
15002
|
-
duration,
|
15003
|
-
proposedLeaseId: this._leaseId,
|
15004
|
-
}));
|
14805
|
+
return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign({}, updatedOptions), { duration, proposedLeaseId: this._leaseId })));
|
15005
14806
|
});
|
15006
14807
|
}
|
15007
14808
|
/**
|
@@ -15013,10 +14814,7 @@ class ShareLeaseClient {
|
|
15013
14814
|
*/
|
15014
14815
|
async changeLease(proposedLeaseId, options = {}) {
|
15015
14816
|
return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
15016
|
-
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, {
|
15017
|
-
...updatedOptions,
|
15018
|
-
proposedLeaseId,
|
15019
|
-
}));
|
14817
|
+
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), { proposedLeaseId })));
|
15020
14818
|
this._leaseId = proposedLeaseId;
|
15021
14819
|
return response;
|
15022
14820
|
});
|
@@ -15232,32 +15030,49 @@ class ShareServiceClient extends StorageClient {
|
|
15232
15030
|
* items. The marker value is opaque to the client.
|
15233
15031
|
* @param options - Options to list shares operation.
|
15234
15032
|
*/
|
15235
|
-
|
15236
|
-
|
15237
|
-
options.prefix
|
15238
|
-
|
15239
|
-
|
15240
|
-
|
15241
|
-
|
15242
|
-
|
15243
|
-
|
15244
|
-
|
15033
|
+
listSegments(marker, options = {}) {
|
15034
|
+
return tslib.__asyncGenerator(this, arguments, function* listSegments_1() {
|
15035
|
+
if (options.prefix === "") {
|
15036
|
+
options.prefix = undefined;
|
15037
|
+
}
|
15038
|
+
let listSharesSegmentResponse;
|
15039
|
+
do {
|
15040
|
+
listSharesSegmentResponse = yield tslib.__await(this.listSharesSegment(marker, options));
|
15041
|
+
marker = listSharesSegmentResponse.continuationToken;
|
15042
|
+
yield yield tslib.__await(yield tslib.__await(listSharesSegmentResponse));
|
15043
|
+
} while (marker);
|
15044
|
+
});
|
15245
15045
|
}
|
15246
15046
|
/**
|
15247
15047
|
* Returns an AsyncIterableIterator for share items
|
15248
15048
|
*
|
15249
15049
|
* @param options - Options to list shares operation.
|
15250
15050
|
*/
|
15251
|
-
|
15252
|
-
|
15253
|
-
|
15254
|
-
|
15255
|
-
|
15256
|
-
for await (const segment of this.listSegments(marker, options)) {
|
15257
|
-
if (segment.shareItems) {
|
15258
|
-
yield* segment.shareItems;
|
15051
|
+
listItems(options = {}) {
|
15052
|
+
return tslib.__asyncGenerator(this, arguments, function* listItems_1() {
|
15053
|
+
var _a, e_1, _b, _c;
|
15054
|
+
if (options.prefix === "") {
|
15055
|
+
options.prefix = undefined;
|
15259
15056
|
}
|
15260
|
-
|
15057
|
+
let marker;
|
15058
|
+
try {
|
15059
|
+
for (var _d = true, _e = tslib.__asyncValues(this.listSegments(marker, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
|
15060
|
+
_c = _f.value;
|
15061
|
+
_d = false;
|
15062
|
+
const segment = _c;
|
15063
|
+
if (segment.shareItems) {
|
15064
|
+
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(segment.shareItems)));
|
15065
|
+
}
|
15066
|
+
}
|
15067
|
+
}
|
15068
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
15069
|
+
finally {
|
15070
|
+
try {
|
15071
|
+
if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
|
15072
|
+
}
|
15073
|
+
finally { if (e_1) throw e_1.error; }
|
15074
|
+
}
|
15075
|
+
});
|
15261
15076
|
}
|
15262
15077
|
/**
|
15263
15078
|
* Returns an async iterable iterator to list all the shares
|
@@ -15347,10 +15162,7 @@ class ShareServiceClient extends StorageClient {
|
|
15347
15162
|
if (options.includeDeleted) {
|
15348
15163
|
include.push("deleted");
|
15349
15164
|
}
|
15350
|
-
const updatedOptions = {
|
15351
|
-
...options,
|
15352
|
-
...(include.length > 0 ? { include: include } : {}),
|
15353
|
-
};
|
15165
|
+
const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
|
15354
15166
|
// AsyncIterableIterator to iterate over queues
|
15355
15167
|
const iter = this.listItems(updatedOptions);
|
15356
15168
|
return {
|
@@ -15370,10 +15182,7 @@ class ShareServiceClient extends StorageClient {
|
|
15370
15182
|
* Return an AsyncIterableIterator that works a page at a time
|
15371
15183
|
*/
|
15372
15184
|
byPage: (settings = {}) => {
|
15373
|
-
return this.listSegments(removeEmptyString(settings.continuationToken), {
|
15374
|
-
maxResults: settings.maxPageSize,
|
15375
|
-
...updatedOptions,
|
15376
|
-
});
|
15185
|
+
return this.listSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
|
15377
15186
|
},
|
15378
15187
|
};
|
15379
15188
|
}
|
@@ -15395,10 +15204,7 @@ class ShareServiceClient extends StorageClient {
|
|
15395
15204
|
options.prefix = undefined;
|
15396
15205
|
}
|
15397
15206
|
return tracingClient.withSpan("ShareServiceClient-listSharesSegment", options, async (updatedOptions) => {
|
15398
|
-
const res = assertResponse(await this.serviceContext.listSharesSegment({
|
15399
|
-
...updatedOptions,
|
15400
|
-
marker,
|
15401
|
-
}));
|
15207
|
+
const res = assertResponse(await this.serviceContext.listSharesSegment(Object.assign(Object.assign({}, updatedOptions), { marker })));
|
15402
15208
|
// parse protocols
|
15403
15209
|
if (res.shareItems) {
|
15404
15210
|
for (let i = 0; i < res.shareItems.length; i++) {
|
@@ -15422,11 +15228,7 @@ class ShareServiceClient extends StorageClient {
|
|
15422
15228
|
async undeleteShare(deletedShareName, deletedShareVersion, options = {}) {
|
15423
15229
|
return tracingClient.withSpan("ShareServiceClient-undeleteShare", options, async (updatedOptions) => {
|
15424
15230
|
const shareClient = this.getShareClient(deletedShareName);
|
15425
|
-
await new ShareClientInternal(shareClient.url, this.pipeline).restore({
|
15426
|
-
...updatedOptions,
|
15427
|
-
deletedShareName: deletedShareName,
|
15428
|
-
deletedShareVersion: deletedShareVersion,
|
15429
|
-
});
|
15231
|
+
await new ShareClientInternal(shareClient.url, this.pipeline).restore(Object.assign(Object.assign({}, updatedOptions), { deletedShareName: deletedShareName, deletedShareVersion: deletedShareVersion }));
|
15430
15232
|
return shareClient;
|
15431
15233
|
});
|
15432
15234
|
}
|
@@ -15452,13 +15254,9 @@ class ShareServiceClient extends StorageClient {
|
|
15452
15254
|
const now = new Date();
|
15453
15255
|
expiresOn = new Date(now.getTime() + 3600 * 1000);
|
15454
15256
|
}
|
15455
|
-
const sas = generateAccountSASQueryParameters({
|
15456
|
-
permissions,
|
15257
|
+
const sas = generateAccountSASQueryParameters(Object.assign({ permissions,
|
15457
15258
|
expiresOn,
|
15458
|
-
resourceTypes,
|
15459
|
-
services: AccountSASServices.parse("f").toString(),
|
15460
|
-
...options,
|
15461
|
-
}, this.credential).toString();
|
15259
|
+
resourceTypes, services: AccountSASServices.parse("f").toString() }, options), this.credential).toString();
|
15462
15260
|
return appendToURLQuery(this.url, sas);
|
15463
15261
|
}
|
15464
15262
|
}
|