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