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