@azure/storage-file-share 12.23.0-alpha.20240112.1 → 12.23.0-alpha.20240124.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +270 -472
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +1 -3
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +30 -35
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +81 -80
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +193 -302
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +132 -165
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +3 -10
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/Pipeline.js +10 -19
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -1
- package/dist-esm/storage-blob/src/StorageContextClient.js +1 -1
- package/dist-esm/storage-blob/src/StorageContextClient.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClient.js +3 -7
- package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +12 -10
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -1
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +3 -6
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/utils.common.js +11 -24
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
- package/dist-esm/storage-file-share/src/Clients.js +194 -367
- package/dist-esm/storage-file-share/src/Clients.js.map +1 -1
- package/dist-esm/storage-file-share/src/ShareServiceClient.js +43 -43
- package/dist-esm/storage-file-share/src/ShareServiceClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/StorageContextClient.js +1 -1
- package/dist-esm/storage-file-share/src/StorageContextClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js +3 -7
- package/dist-esm/storage-file-share/src/generated/src/storageClient.js.map +1 -1
- package/dist-esm/storage-file-share/src/utils/utils.common.js +10 -26
- package/dist-esm/storage-file-share/src/utils/utils.common.js.map +1 -1
- package/package.json +1 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT license.
|
3
|
+
import { __asyncGenerator, __asyncValues, __await } from "tslib";
|
3
4
|
import { isTokenCredential } from "@azure/core-auth";
|
4
5
|
import { isNode } from "@azure/core-util";
|
5
6
|
import { newPipeline, Pipeline } from "../../storage-blob/src/Pipeline";
|
@@ -10,7 +11,6 @@ import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/S
|
|
10
11
|
import { AnonymousCredential } from "../../storage-blob/src/credentials/AnonymousCredential";
|
11
12
|
import { tracingClient } from "./utils/tracing";
|
12
13
|
import { StorageClient } from "./StorageClient";
|
13
|
-
import "@azure/core-paging";
|
14
14
|
import { FileSystemAttributes } from "./FileSystemAttributes";
|
15
15
|
import { FileDownloadResponse } from "./FileDownloadResponse";
|
16
16
|
import { rangeToString } from "./Range";
|
@@ -105,10 +105,7 @@ export class ShareClient extends StorageClient {
|
|
105
105
|
*/
|
106
106
|
async create(options = {}) {
|
107
107
|
return tracingClient.withSpan("ShareClient-create", options, async (updatedOptions) => {
|
108
|
-
return assertResponse(await this.context.create({
|
109
|
-
...updatedOptions,
|
110
|
-
enabledProtocols: toShareProtocolsString(updatedOptions.protocols),
|
111
|
-
}));
|
108
|
+
return assertResponse(await this.context.create(Object.assign(Object.assign({}, updatedOptions), { enabledProtocols: toShareProtocolsString(updatedOptions.protocols) })));
|
112
109
|
});
|
113
110
|
}
|
114
111
|
/**
|
@@ -120,20 +117,14 @@ export class ShareClient extends StorageClient {
|
|
120
117
|
*/
|
121
118
|
async createIfNotExists(options = {}) {
|
122
119
|
return tracingClient.withSpan("ShareClient-createIfNotExists", options, async (updatedOptions) => {
|
120
|
+
var _a, _b;
|
123
121
|
try {
|
124
122
|
const res = await this.create(updatedOptions);
|
125
|
-
return {
|
126
|
-
succeeded: true,
|
127
|
-
...res,
|
128
|
-
};
|
123
|
+
return Object.assign({ succeeded: true }, res);
|
129
124
|
}
|
130
125
|
catch (e) {
|
131
|
-
if (e.details
|
132
|
-
return {
|
133
|
-
succeeded: false,
|
134
|
-
...e.response?.parsedHeaders,
|
135
|
-
_response: e.response,
|
136
|
-
};
|
126
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareAlreadyExists") {
|
127
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
137
128
|
}
|
138
129
|
throw e;
|
139
130
|
}
|
@@ -280,10 +271,7 @@ export class ShareClient extends StorageClient {
|
|
280
271
|
async getProperties(options = {}) {
|
281
272
|
return tracingClient.withSpan("ShareClient-getProperties", options, async (updatedOptions) => {
|
282
273
|
const res = assertResponse(await this.context.getProperties(updatedOptions));
|
283
|
-
return {
|
284
|
-
...res,
|
285
|
-
protocols: toShareProtocols(res.enabledProtocols),
|
286
|
-
};
|
274
|
+
return Object.assign(Object.assign({}, res), { protocols: toShareProtocols(res.enabledProtocols) });
|
287
275
|
});
|
288
276
|
}
|
289
277
|
/**
|
@@ -296,9 +284,7 @@ export class ShareClient extends StorageClient {
|
|
296
284
|
*/
|
297
285
|
async delete(options = {}) {
|
298
286
|
return tracingClient.withSpan("ShareClient-delete", options, async (updatedOptions) => {
|
299
|
-
return assertResponse(await this.context.delete({
|
300
|
-
...updatedOptions,
|
301
|
-
}));
|
287
|
+
return assertResponse(await this.context.delete(Object.assign({}, updatedOptions)));
|
302
288
|
});
|
303
289
|
}
|
304
290
|
/**
|
@@ -310,20 +296,14 @@ export class ShareClient extends StorageClient {
|
|
310
296
|
*/
|
311
297
|
async deleteIfExists(options = {}) {
|
312
298
|
return tracingClient.withSpan("ShareClient-deleteIfExists", options, async (updatedOptions) => {
|
299
|
+
var _a, _b;
|
313
300
|
try {
|
314
301
|
const res = await this.delete(updatedOptions);
|
315
|
-
return {
|
316
|
-
succeeded: true,
|
317
|
-
...res,
|
318
|
-
};
|
302
|
+
return Object.assign({ succeeded: true }, res);
|
319
303
|
}
|
320
304
|
catch (e) {
|
321
|
-
if (e.details
|
322
|
-
return {
|
323
|
-
succeeded: false,
|
324
|
-
...e.response?.parsedHeaders,
|
325
|
-
_response: e.response,
|
326
|
-
};
|
305
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ShareNotFound") {
|
306
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
327
307
|
}
|
328
308
|
throw e;
|
329
309
|
}
|
@@ -342,10 +322,7 @@ export class ShareClient extends StorageClient {
|
|
342
322
|
*/
|
343
323
|
async setMetadata(metadata, options = {}) {
|
344
324
|
return tracingClient.withSpan("ShareClient-setMetadata", options, async (updatedOptions) => {
|
345
|
-
return assertResponse(await this.context.setMetadata({
|
346
|
-
...updatedOptions,
|
347
|
-
metadata,
|
348
|
-
}));
|
325
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign({}, updatedOptions), { metadata })));
|
349
326
|
});
|
350
327
|
}
|
351
328
|
/**
|
@@ -362,9 +339,7 @@ export class ShareClient extends StorageClient {
|
|
362
339
|
*/
|
363
340
|
async getAccessPolicy(options = {}) {
|
364
341
|
return tracingClient.withSpan("ShareClient-getAccessPolicy", options, async (updatedOptions) => {
|
365
|
-
const response = assertResponse(await this.context.getAccessPolicy({
|
366
|
-
...updatedOptions,
|
367
|
-
}));
|
342
|
+
const response = assertResponse(await this.context.getAccessPolicy(Object.assign({}, updatedOptions)));
|
368
343
|
const res = {
|
369
344
|
_response: response._response,
|
370
345
|
date: response.date,
|
@@ -414,25 +389,23 @@ export class ShareClient extends StorageClient {
|
|
414
389
|
*/
|
415
390
|
async setAccessPolicy(shareAcl, options = {}) {
|
416
391
|
return tracingClient.withSpan("ShareClient-setAccessPolicy", options, async (updatedOptions) => {
|
392
|
+
var _a, _b, _c;
|
417
393
|
const acl = [];
|
418
394
|
for (const identifier of shareAcl || []) {
|
419
395
|
acl.push({
|
420
396
|
accessPolicy: {
|
421
|
-
expiresOn: identifier.accessPolicy
|
397
|
+
expiresOn: ((_a = identifier.accessPolicy) === null || _a === void 0 ? void 0 : _a.expiresOn)
|
422
398
|
? truncatedISO8061Date(identifier.accessPolicy.expiresOn)
|
423
399
|
: undefined,
|
424
|
-
permissions: identifier.accessPolicy
|
425
|
-
startsOn: identifier.accessPolicy
|
400
|
+
permissions: (_b = identifier.accessPolicy) === null || _b === void 0 ? void 0 : _b.permissions,
|
401
|
+
startsOn: ((_c = identifier.accessPolicy) === null || _c === void 0 ? void 0 : _c.startsOn)
|
426
402
|
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
|
427
403
|
: undefined,
|
428
404
|
},
|
429
405
|
id: identifier.id,
|
430
406
|
});
|
431
407
|
}
|
432
|
-
return assertResponse(await this.context.setAccessPolicy({
|
433
|
-
...updatedOptions,
|
434
|
-
shareAcl: acl,
|
435
|
-
}));
|
408
|
+
return assertResponse(await this.context.setAccessPolicy(Object.assign(Object.assign({}, updatedOptions), { shareAcl: acl })));
|
436
409
|
});
|
437
410
|
}
|
438
411
|
/**
|
@@ -457,10 +430,7 @@ export class ShareClient extends StorageClient {
|
|
457
430
|
*/
|
458
431
|
async setQuota(quotaInGB, options = {}) {
|
459
432
|
return tracingClient.withSpan("ShareClient-setQuota", options, async (updatedOptions) => {
|
460
|
-
return assertResponse(await this.context.setProperties({
|
461
|
-
...updatedOptions,
|
462
|
-
quota: quotaInGB,
|
463
|
-
}));
|
433
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, updatedOptions), { quota: quotaInGB })));
|
464
434
|
});
|
465
435
|
}
|
466
436
|
/**
|
@@ -471,11 +441,7 @@ export class ShareClient extends StorageClient {
|
|
471
441
|
*/
|
472
442
|
async setProperties(options = {}) {
|
473
443
|
return tracingClient.withSpan("ShareClient-setProperties", options, async (updatedOptions) => {
|
474
|
-
return assertResponse(await this.context.setProperties({
|
475
|
-
...options,
|
476
|
-
quota: options.quotaInGB,
|
477
|
-
tracingOptions: updatedOptions.tracingOptions,
|
478
|
-
}));
|
444
|
+
return assertResponse(await this.context.setProperties(Object.assign(Object.assign({}, options), { quota: options.quotaInGB, tracingOptions: updatedOptions.tracingOptions })));
|
479
445
|
});
|
480
446
|
}
|
481
447
|
/**
|
@@ -488,7 +454,7 @@ export class ShareClient extends StorageClient {
|
|
488
454
|
return tracingClient.withSpan("ShareClient-getStatistics", options, async (updatedOptions) => {
|
489
455
|
const response = assertResponse(await this.context.getStatistics(updatedOptions));
|
490
456
|
const GBBytes = 1024 * 1024 * 1024;
|
491
|
-
return {
|
457
|
+
return Object.assign(Object.assign({}, response), { shareUsage: Math.ceil(response.shareUsageBytes / GBBytes) });
|
492
458
|
});
|
493
459
|
}
|
494
460
|
/**
|
@@ -503,10 +469,7 @@ export class ShareClient extends StorageClient {
|
|
503
469
|
return tracingClient.withSpan("ShareClient-createPermission", options, async (updatedOptions) => {
|
504
470
|
return assertResponse(await this.context.createPermission({
|
505
471
|
permission: filePermission,
|
506
|
-
}, {
|
507
|
-
...updatedOptions,
|
508
|
-
...this.shareClientConfig,
|
509
|
-
}));
|
472
|
+
}, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
510
473
|
});
|
511
474
|
}
|
512
475
|
/**
|
@@ -519,10 +482,7 @@ export class ShareClient extends StorageClient {
|
|
519
482
|
*/
|
520
483
|
async getPermission(filePermissionKey, options = {}) {
|
521
484
|
return tracingClient.withSpan("ShareClient-getPermission", options, async (updatedOptions) => {
|
522
|
-
return assertResponse(await this.context.getPermission(filePermissionKey, {
|
523
|
-
...updatedOptions,
|
524
|
-
...this.shareClientConfig,
|
525
|
-
}));
|
485
|
+
return assertResponse(await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
526
486
|
});
|
527
487
|
}
|
528
488
|
/**
|
@@ -540,10 +500,7 @@ export class ShareClient extends StorageClient {
|
|
540
500
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
541
501
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
542
502
|
}
|
543
|
-
const sas = generateFileSASQueryParameters({
|
544
|
-
shareName: this.name,
|
545
|
-
...options,
|
546
|
-
}, this.credential).toString();
|
503
|
+
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.name }, options), this.credential).toString();
|
547
504
|
return appendToURLQuery(this.url, sas);
|
548
505
|
}
|
549
506
|
}
|
@@ -612,13 +569,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
612
569
|
return tracingClient.withSpan("ShareDirectoryClient-create", options, async (updatedOptions) => {
|
613
570
|
return assertResponse(await this.context.create(updatedOptions.fileAttributes
|
614
571
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
615
|
-
: FileAttributesNone, {
|
616
|
-
...updatedOptions,
|
617
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
618
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
619
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
620
|
-
...this.shareClientConfig,
|
621
|
-
}));
|
572
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
622
573
|
});
|
623
574
|
}
|
624
575
|
/**
|
@@ -630,20 +581,14 @@ export class ShareDirectoryClient extends StorageClient {
|
|
630
581
|
*/
|
631
582
|
async createIfNotExists(options = {}) {
|
632
583
|
return tracingClient.withSpan("ShareDirectoryClient-createIfNotExists", options, async (updatedOptions) => {
|
584
|
+
var _a, _b;
|
633
585
|
try {
|
634
586
|
const res = await this.create(updatedOptions);
|
635
|
-
return {
|
636
|
-
succeeded: true,
|
637
|
-
...res,
|
638
|
-
};
|
587
|
+
return Object.assign({ succeeded: true }, res);
|
639
588
|
}
|
640
589
|
catch (e) {
|
641
|
-
if (e.details
|
642
|
-
return {
|
643
|
-
succeeded: false,
|
644
|
-
...e.response?.parsedHeaders,
|
645
|
-
_response: e.response,
|
646
|
-
};
|
590
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceAlreadyExists") {
|
591
|
+
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
647
592
|
}
|
648
593
|
throw e;
|
649
594
|
}
|
@@ -661,13 +606,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
661
606
|
return tracingClient.withSpan("ShareDirectoryClient-setProperties", properties, async (updatedOptions) => {
|
662
607
|
return assertResponse(await this.context.setProperties(updatedOptions.fileAttributes
|
663
608
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
664
|
-
: FileAttributesPreserve, {
|
665
|
-
...updatedOptions,
|
666
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
667
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
668
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
669
|
-
...this.shareClientConfig,
|
670
|
-
}));
|
609
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
671
610
|
});
|
672
611
|
}
|
673
612
|
/**
|
@@ -800,7 +739,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
800
739
|
async exists(options = {}) {
|
801
740
|
return tracingClient.withSpan("ShareDirectoryClient-exists", options, async (updatedOptions) => {
|
802
741
|
try {
|
803
|
-
await this.getProperties({
|
742
|
+
await this.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
804
743
|
return true;
|
805
744
|
}
|
806
745
|
catch (e) {
|
@@ -822,7 +761,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
822
761
|
*/
|
823
762
|
async getProperties(options = {}) {
|
824
763
|
return tracingClient.withSpan("ShareDirectoryClient-getProperties", options, async (updatedOptions) => {
|
825
|
-
return assertResponse(await this.context.getProperties({
|
764
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
826
765
|
});
|
827
766
|
}
|
828
767
|
/**
|
@@ -835,7 +774,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
835
774
|
*/
|
836
775
|
async delete(options = {}) {
|
837
776
|
return tracingClient.withSpan("ShareDirectoryClient-delete", options, async (updatedOptions) => {
|
838
|
-
return assertResponse(await this.context.delete({
|
777
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
839
778
|
});
|
840
779
|
}
|
841
780
|
/**
|
@@ -847,21 +786,15 @@ export class ShareDirectoryClient extends StorageClient {
|
|
847
786
|
*/
|
848
787
|
async deleteIfExists(options = {}) {
|
849
788
|
return tracingClient.withSpan("ShareDirectoryClient-deleteIfExists", options, async (updatedOptions) => {
|
789
|
+
var _a, _b, _c;
|
850
790
|
try {
|
851
791
|
const res = await this.delete(updatedOptions);
|
852
|
-
return {
|
853
|
-
succeeded: true,
|
854
|
-
...res,
|
855
|
-
};
|
792
|
+
return Object.assign({ succeeded: true }, res);
|
856
793
|
}
|
857
794
|
catch (e) {
|
858
|
-
if (e.details
|
859
|
-
e.details
|
860
|
-
return {
|
861
|
-
succeeded: false,
|
862
|
-
...e.response?.parsedHeaders,
|
863
|
-
_response: e.response,
|
864
|
-
};
|
795
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
796
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
797
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
865
798
|
}
|
866
799
|
throw e;
|
867
800
|
}
|
@@ -877,11 +810,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
877
810
|
*/
|
878
811
|
async setMetadata(metadata, options = {}) {
|
879
812
|
return tracingClient.withSpan("ShareDirectoryClient-setMetadata", options, async (updatedOptions) => {
|
880
|
-
return assertResponse(await this.context.setMetadata({
|
881
|
-
...updatedOptions,
|
882
|
-
metadata,
|
883
|
-
...this.shareClientConfig,
|
884
|
-
}));
|
813
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
885
814
|
});
|
886
815
|
}
|
887
816
|
/**
|
@@ -896,35 +825,52 @@ export class ShareDirectoryClient extends StorageClient {
|
|
896
825
|
* items. The marker value is opaque to the client.
|
897
826
|
* @param options - Options to list files and directories operation.
|
898
827
|
*/
|
899
|
-
|
900
|
-
|
901
|
-
options.prefix
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
828
|
+
iterateFilesAndDirectoriesSegments(marker, options = {}) {
|
829
|
+
return __asyncGenerator(this, arguments, function* iterateFilesAndDirectoriesSegments_1() {
|
830
|
+
if (options.prefix === "") {
|
831
|
+
options.prefix = undefined;
|
832
|
+
}
|
833
|
+
let listFilesAndDirectoriesResponse;
|
834
|
+
do {
|
835
|
+
listFilesAndDirectoriesResponse = yield __await(this.listFilesAndDirectoriesSegment(marker, options));
|
836
|
+
marker = listFilesAndDirectoriesResponse.continuationToken;
|
837
|
+
yield yield __await(yield __await(listFilesAndDirectoriesResponse));
|
838
|
+
} while (marker);
|
839
|
+
});
|
909
840
|
}
|
910
841
|
/**
|
911
842
|
* Returns an AsyncIterableIterator for file and directory items
|
912
843
|
*
|
913
844
|
* @param options - Options to list files and directories operation.
|
914
845
|
*/
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
for await (const listFilesAndDirectoriesResponse of this.iterateFilesAndDirectoriesSegments(marker, options)) {
|
921
|
-
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
922
|
-
yield { kind: "file", ...file };
|
846
|
+
listFilesAndDirectoriesItems(options = {}) {
|
847
|
+
return __asyncGenerator(this, arguments, function* listFilesAndDirectoriesItems_1() {
|
848
|
+
var _a, e_1, _b, _c;
|
849
|
+
if (options.prefix === "") {
|
850
|
+
options.prefix = undefined;
|
923
851
|
}
|
924
|
-
|
925
|
-
|
852
|
+
let marker;
|
853
|
+
try {
|
854
|
+
for (var _d = true, _e = __asyncValues(this.iterateFilesAndDirectoriesSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
|
855
|
+
_c = _f.value;
|
856
|
+
_d = false;
|
857
|
+
const listFilesAndDirectoriesResponse = _c;
|
858
|
+
for (const file of listFilesAndDirectoriesResponse.segment.fileItems) {
|
859
|
+
yield yield __await(Object.assign({ kind: "file" }, file));
|
860
|
+
}
|
861
|
+
for (const directory of listFilesAndDirectoriesResponse.segment.directoryItems) {
|
862
|
+
yield yield __await(Object.assign({ kind: "directory" }, directory));
|
863
|
+
}
|
864
|
+
}
|
926
865
|
}
|
927
|
-
|
866
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
867
|
+
finally {
|
868
|
+
try {
|
869
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
870
|
+
}
|
871
|
+
finally { if (e_1) throw e_1.error; }
|
872
|
+
}
|
873
|
+
});
|
928
874
|
}
|
929
875
|
/**
|
930
876
|
* Returns an async iterable iterator to list all the files and directories
|
@@ -1033,10 +979,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1033
979
|
if (options.prefix === "") {
|
1034
980
|
options.prefix = undefined;
|
1035
981
|
}
|
1036
|
-
const updatedOptions = {
|
1037
|
-
...options,
|
1038
|
-
...(include.length > 0 ? { include: include } : {}),
|
1039
|
-
};
|
982
|
+
const updatedOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include: include } : {}));
|
1040
983
|
// AsyncIterableIterator to iterate over files and directories
|
1041
984
|
const iter = this.listFilesAndDirectoriesItems(updatedOptions);
|
1042
985
|
return {
|
@@ -1056,10 +999,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1056
999
|
* Return an AsyncIterableIterator that works a page at a time
|
1057
1000
|
*/
|
1058
1001
|
byPage: (settings = {}) => {
|
1059
|
-
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), {
|
1060
|
-
maxResults: settings.maxPageSize,
|
1061
|
-
...updatedOptions,
|
1062
|
-
});
|
1002
|
+
return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
|
1063
1003
|
},
|
1064
1004
|
};
|
1065
1005
|
}
|
@@ -1077,18 +1017,8 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1077
1017
|
options.prefix = undefined;
|
1078
1018
|
}
|
1079
1019
|
return tracingClient.withSpan("ShareDirectoryClient-listFilesAndDirectoriesSegment", options, async (updatedOptions) => {
|
1080
|
-
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment({
|
1081
|
-
|
1082
|
-
marker,
|
1083
|
-
...this.shareClientConfig,
|
1084
|
-
}));
|
1085
|
-
const wrappedResponse = {
|
1086
|
-
...ConvertInternalResponseOfListFiles(rawResponse),
|
1087
|
-
_response: {
|
1088
|
-
...rawResponse._response,
|
1089
|
-
parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody),
|
1090
|
-
}, // _response is made non-enumerable
|
1091
|
-
};
|
1020
|
+
const rawResponse = assertResponse(await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1021
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListFiles(rawResponse)), { _response: Object.assign(Object.assign({}, rawResponse._response), { parsedBody: ConvertInternalResponseOfListFiles(rawResponse._response.parsedBody) }) });
|
1092
1022
|
return wrappedResponse;
|
1093
1023
|
});
|
1094
1024
|
}
|
@@ -1102,30 +1032,47 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1102
1032
|
* set of list items.
|
1103
1033
|
* @param options - Options to list handles operation.
|
1104
1034
|
*/
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1035
|
+
iterateHandleSegments(marker, options = {}) {
|
1036
|
+
return __asyncGenerator(this, arguments, function* iterateHandleSegments_1() {
|
1037
|
+
let listHandlesResponse;
|
1038
|
+
if (!!marker || marker === undefined) {
|
1039
|
+
do {
|
1040
|
+
listHandlesResponse = yield __await(this.listHandlesSegment(marker, options));
|
1041
|
+
marker = listHandlesResponse.continuationToken;
|
1042
|
+
yield yield __await(yield __await(listHandlesResponse));
|
1043
|
+
} while (marker);
|
1044
|
+
}
|
1045
|
+
});
|
1114
1046
|
}
|
1115
1047
|
/**
|
1116
1048
|
* Returns an AsyncIterableIterator for handles
|
1117
1049
|
*
|
1118
1050
|
* @param options - Options to list handles operation.
|
1119
1051
|
*/
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1052
|
+
listHandleItems(options = {}) {
|
1053
|
+
return __asyncGenerator(this, arguments, function* listHandleItems_1() {
|
1054
|
+
var _a, e_2, _b, _c;
|
1055
|
+
let marker;
|
1056
|
+
try {
|
1057
|
+
for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
|
1058
|
+
_c = _f.value;
|
1059
|
+
_d = false;
|
1060
|
+
const listHandlesResponse = _c;
|
1061
|
+
if (listHandlesResponse.handleList) {
|
1062
|
+
for (const handle of listHandlesResponse.handleList) {
|
1063
|
+
yield yield __await(handle);
|
1064
|
+
}
|
1065
|
+
}
|
1126
1066
|
}
|
1127
1067
|
}
|
1128
|
-
|
1068
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
1069
|
+
finally {
|
1070
|
+
try {
|
1071
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
1072
|
+
}
|
1073
|
+
finally { if (e_2) throw e_2.error; }
|
1074
|
+
}
|
1075
|
+
});
|
1129
1076
|
}
|
1130
1077
|
/**
|
1131
1078
|
* Returns an async iterable iterator to list all the handles.
|
@@ -1223,10 +1170,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1223
1170
|
* Return an AsyncIterableIterator that works a page at a time
|
1224
1171
|
*/
|
1225
1172
|
byPage: (settings = {}) => {
|
1226
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
1227
|
-
maxResults: settings.maxPageSize,
|
1228
|
-
...options,
|
1229
|
-
});
|
1173
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, options));
|
1230
1174
|
},
|
1231
1175
|
};
|
1232
1176
|
}
|
@@ -1244,23 +1188,13 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1244
1188
|
async listHandlesSegment(marker, options = {}) {
|
1245
1189
|
return tracingClient.withSpan("ShareDirectoryClient-listHandlesSegment", options, async (updatedOptions) => {
|
1246
1190
|
marker = marker === "" ? undefined : marker;
|
1247
|
-
const response = assertResponse(await this.context.listHandles({
|
1248
|
-
...updatedOptions,
|
1249
|
-
marker,
|
1250
|
-
...this.shareClientConfig,
|
1251
|
-
}));
|
1191
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1252
1192
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
1253
1193
|
// response.handleList is an empty string
|
1254
1194
|
if (response.handleList === "") {
|
1255
1195
|
response.handleList = undefined;
|
1256
1196
|
}
|
1257
|
-
const wrappedResponse = {
|
1258
|
-
...ConvertInternalResponseOfListHandles(response),
|
1259
|
-
_response: {
|
1260
|
-
...response._response,
|
1261
|
-
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
1262
|
-
},
|
1263
|
-
};
|
1197
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
|
1264
1198
|
return wrappedResponse;
|
1265
1199
|
});
|
1266
1200
|
}
|
@@ -1277,19 +1211,12 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1277
1211
|
*/
|
1278
1212
|
async forceCloseHandlesSegment(marker, options = {}) {
|
1279
1213
|
return tracingClient.withSpan("ShareDirectoryClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
1214
|
+
var _a, _b;
|
1280
1215
|
if (marker === "") {
|
1281
1216
|
marker = undefined;
|
1282
1217
|
}
|
1283
|
-
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", {
|
1284
|
-
|
1285
|
-
marker,
|
1286
|
-
...this.shareClientConfig,
|
1287
|
-
}));
|
1288
|
-
return {
|
1289
|
-
...rawResponse,
|
1290
|
-
closedHandlesCount: rawResponse.numberOfHandlesClosed ?? 0,
|
1291
|
-
closeFailureCount: rawResponse.numberOfHandlesFailedToClose ?? 0,
|
1292
|
-
};
|
1218
|
+
const rawResponse = assertResponse(await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), { marker }), this.shareClientConfig)));
|
1219
|
+
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 });
|
1293
1220
|
});
|
1294
1221
|
}
|
1295
1222
|
/**
|
@@ -1334,10 +1261,7 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1334
1261
|
if (handleId === "*") {
|
1335
1262
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
1336
1263
|
}
|
1337
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
1338
|
-
...updatedOptions,
|
1339
|
-
...this.shareClientConfig,
|
1340
|
-
});
|
1264
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
1341
1265
|
const response = rawResponse;
|
1342
1266
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
1343
1267
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -1380,20 +1304,15 @@ export class ShareDirectoryClient extends StorageClient {
|
|
1380
1304
|
}
|
1381
1305
|
const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
1382
1306
|
return tracingClient.withSpan("ShareDirectoryClient-rename", options, async (updatedOptions) => {
|
1383
|
-
const response = assertResponse(await destDirectory.context.rename(this.url, {
|
1384
|
-
...updatedOptions,
|
1385
|
-
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1307
|
+
const response = assertResponse(await destDirectory.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
1386
1308
|
? {
|
1387
1309
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
1388
1310
|
}
|
1389
|
-
: undefined,
|
1390
|
-
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
1311
|
+
: undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
1391
1312
|
? {
|
1392
1313
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
1393
1314
|
}
|
1394
|
-
: undefined,
|
1395
|
-
...this.shareClientConfig,
|
1396
|
-
}));
|
1315
|
+
: undefined }), this.shareClientConfig)));
|
1397
1316
|
return {
|
1398
1317
|
destinationDirectoryClient: destDirectory,
|
1399
1318
|
directoryRenameResponse: response,
|
@@ -1489,13 +1408,7 @@ export class ShareFileClient extends StorageClient {
|
|
1489
1408
|
return tracingClient.withSpan("ShareFileClient-create", options, async (updatedOptions) => {
|
1490
1409
|
return assertResponse(await this.context.create(size, updatedOptions.fileAttributes
|
1491
1410
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1492
|
-
: FileAttributesNone, {
|
1493
|
-
...updatedOptions,
|
1494
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
1495
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
1496
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
1497
|
-
...this.shareClientConfig,
|
1498
|
-
}));
|
1411
|
+
: FileAttributesNone, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
1499
1412
|
});
|
1500
1413
|
}
|
1501
1414
|
/**
|
@@ -1565,14 +1478,9 @@ export class ShareFileClient extends StorageClient {
|
|
1565
1478
|
throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
|
1566
1479
|
}
|
1567
1480
|
const downloadFullFile = offset === 0 && !count;
|
1568
|
-
const res = assertResponse(await this.context.download({
|
1569
|
-
...updatedOptions,
|
1570
|
-
requestOptions: {
|
1481
|
+
const res = assertResponse(await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1571
1482
|
onDownloadProgress: isNode ? undefined : updatedOptions.onProgress, // for Node.js, progress is reported by RetriableReadableStream
|
1572
|
-
},
|
1573
|
-
range: downloadFullFile ? undefined : rangeToString({ offset, count }),
|
1574
|
-
...this.shareClientConfig,
|
1575
|
-
}));
|
1483
|
+
}, range: downloadFullFile ? undefined : rangeToString({ offset, count }) }), this.shareClientConfig)));
|
1576
1484
|
// Return browser response immediately
|
1577
1485
|
if (!isNode) {
|
1578
1486
|
return res;
|
@@ -1602,11 +1510,7 @@ export class ShareFileClient extends StorageClient {
|
|
1602
1510
|
// chunkDownloadOptions.range
|
1603
1511
|
// }, options: ${JSON.stringify(chunkDownloadOptions)}`
|
1604
1512
|
// );
|
1605
|
-
const downloadRes = await this.context.download({
|
1606
|
-
...updatedOptions,
|
1607
|
-
...updatedDownloadOptions,
|
1608
|
-
...this.shareClientConfig, // TODO: confirm whether this is needed
|
1609
|
-
});
|
1513
|
+
const downloadRes = await this.context.download(Object.assign(Object.assign(Object.assign({}, updatedOptions), updatedDownloadOptions), this.shareClientConfig));
|
1610
1514
|
if (!(downloadRes.etag === res.etag)) {
|
1611
1515
|
throw new Error("File has been modified concurrently");
|
1612
1516
|
}
|
@@ -1650,7 +1554,7 @@ export class ShareFileClient extends StorageClient {
|
|
1650
1554
|
*/
|
1651
1555
|
async getProperties(options = {}) {
|
1652
1556
|
return tracingClient.withSpan("ShareFileClient-getProperties", options, async (updatedOptions) => {
|
1653
|
-
return assertResponse(await this.context.getProperties({
|
1557
|
+
return assertResponse(await this.context.getProperties(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1654
1558
|
});
|
1655
1559
|
}
|
1656
1560
|
/**
|
@@ -1668,13 +1572,7 @@ export class ShareFileClient extends StorageClient {
|
|
1668
1572
|
return tracingClient.withSpan("ShareFileClient-setProperties", properties, async (updatedOptions) => {
|
1669
1573
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1670
1574
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1671
|
-
: FileAttributesPreserve, {
|
1672
|
-
...updatedOptions,
|
1673
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
1674
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
1675
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
1676
|
-
...this.shareClientConfig,
|
1677
|
-
}));
|
1575
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime) }), this.shareClientConfig)));
|
1678
1576
|
});
|
1679
1577
|
}
|
1680
1578
|
/**
|
@@ -1696,7 +1594,7 @@ export class ShareFileClient extends StorageClient {
|
|
1696
1594
|
*/
|
1697
1595
|
async delete(options = {}) {
|
1698
1596
|
return tracingClient.withSpan("ShareFileClient-delete", options, async (updatedOptions) => {
|
1699
|
-
return assertResponse(await this.context.delete({
|
1597
|
+
return assertResponse(await this.context.delete(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1700
1598
|
});
|
1701
1599
|
}
|
1702
1600
|
/**
|
@@ -1717,21 +1615,15 @@ export class ShareFileClient extends StorageClient {
|
|
1717
1615
|
*/
|
1718
1616
|
async deleteIfExists(options = {}) {
|
1719
1617
|
return tracingClient.withSpan("ShareFileClient-deleteIfExists", options, async (updatedOptions) => {
|
1618
|
+
var _a, _b, _c;
|
1720
1619
|
try {
|
1721
1620
|
const res = await this.delete(updatedOptions);
|
1722
|
-
return {
|
1723
|
-
succeeded: true,
|
1724
|
-
...res,
|
1725
|
-
};
|
1621
|
+
return Object.assign({ succeeded: true }, res);
|
1726
1622
|
}
|
1727
1623
|
catch (e) {
|
1728
|
-
if (e.details
|
1729
|
-
e.details
|
1730
|
-
return {
|
1731
|
-
succeeded: false,
|
1732
|
-
...e.response?.parsedHeaders,
|
1733
|
-
_response: e.response,
|
1734
|
-
};
|
1624
|
+
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ResourceNotFound" ||
|
1625
|
+
((_b = e.details) === null || _b === void 0 ? void 0 : _b.errorCode) === "ParentNotFound") {
|
1626
|
+
return Object.assign(Object.assign({ succeeded: false }, (_c = e.response) === null || _c === void 0 ? void 0 : _c.parsedHeaders), { _response: e.response });
|
1735
1627
|
}
|
1736
1628
|
throw e;
|
1737
1629
|
}
|
@@ -1755,14 +1647,7 @@ export class ShareFileClient extends StorageClient {
|
|
1755
1647
|
return tracingClient.withSpan("ShareFileClient-setHTTPHeaders", options, async (updatedOptions) => {
|
1756
1648
|
return assertResponse(await this.context.setHttpHeaders(updatedOptions.fileAttributes
|
1757
1649
|
? fileAttributesToString(updatedOptions.fileAttributes)
|
1758
|
-
: FileAttributesPreserve, {
|
1759
|
-
...updatedOptions,
|
1760
|
-
fileHttpHeaders,
|
1761
|
-
fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime),
|
1762
|
-
fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime),
|
1763
|
-
fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime),
|
1764
|
-
...this.shareClientConfig,
|
1765
|
-
}));
|
1650
|
+
: FileAttributesPreserve, Object.assign(Object.assign(Object.assign({}, updatedOptions), { fileHttpHeaders, fileCreatedOn: fileCreationTimeToString(updatedOptions.creationTime), fileLastWriteOn: fileLastWriteTimeToString(updatedOptions.lastWriteTime), fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime) }), this.shareClientConfig)));
|
1766
1651
|
});
|
1767
1652
|
}
|
1768
1653
|
/**
|
@@ -1783,14 +1668,7 @@ export class ShareFileClient extends StorageClient {
|
|
1783
1668
|
// FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
|
1784
1669
|
options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
|
1785
1670
|
return tracingClient.withSpan("ShareFileClient-resize", options, async (updatedOptions) => {
|
1786
|
-
return assertResponse(await this.context.setHttpHeaders(fileAttributesToString(updatedOptions.fileAttributes), {
|
1787
|
-
...updatedOptions,
|
1788
|
-
fileContentLength: length,
|
1789
|
-
fileChangeOn: fileChangeTimeToString(options.changeTime),
|
1790
|
-
fileCreatedOn: fileCreationTimeToString(options.creationTime),
|
1791
|
-
fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime),
|
1792
|
-
...this.shareClientConfig,
|
1793
|
-
}));
|
1671
|
+
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)));
|
1794
1672
|
});
|
1795
1673
|
}
|
1796
1674
|
/**
|
@@ -1806,11 +1684,7 @@ export class ShareFileClient extends StorageClient {
|
|
1806
1684
|
*/
|
1807
1685
|
async setMetadata(metadata = {}, options = {}) {
|
1808
1686
|
return tracingClient.withSpan("ShareFileClient-setMetadata", options, async (updatedOptions) => {
|
1809
|
-
return assertResponse(await this.context.setMetadata({
|
1810
|
-
...updatedOptions,
|
1811
|
-
metadata,
|
1812
|
-
...this.shareClientConfig,
|
1813
|
-
}));
|
1687
|
+
return assertResponse(await this.context.setMetadata(Object.assign(Object.assign(Object.assign({}, updatedOptions), { metadata }), this.shareClientConfig)));
|
1814
1688
|
});
|
1815
1689
|
}
|
1816
1690
|
/**
|
@@ -1851,14 +1725,9 @@ export class ShareFileClient extends StorageClient {
|
|
1851
1725
|
if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
|
1852
1726
|
throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
1853
1727
|
}
|
1854
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, {
|
1855
|
-
...updatedOptions,
|
1856
|
-
requestOptions: {
|
1728
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(Object.assign({}, updatedOptions), { requestOptions: {
|
1857
1729
|
onUploadProgress: updatedOptions.onProgress,
|
1858
|
-
},
|
1859
|
-
body,
|
1860
|
-
...this.shareClientConfig,
|
1861
|
-
}));
|
1730
|
+
}, body }), this.shareClientConfig)));
|
1862
1731
|
});
|
1863
1732
|
}
|
1864
1733
|
/**
|
@@ -1879,13 +1748,7 @@ export class ShareFileClient extends StorageClient {
|
|
1879
1748
|
if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
|
1880
1749
|
throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
|
1881
1750
|
}
|
1882
|
-
return assertResponse(await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, {
|
1883
|
-
...updatedOptions,
|
1884
|
-
sourceRange: rangeToString({ offset: sourceOffset, count }),
|
1885
|
-
sourceModifiedAccessConditions: updatedOptions.sourceConditions,
|
1886
|
-
copySourceAuthorization: httpAuthorizationToString(updatedOptions.sourceAuthorization),
|
1887
|
-
...this.shareClientConfig,
|
1888
|
-
}));
|
1751
|
+
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)));
|
1889
1752
|
});
|
1890
1753
|
}
|
1891
1754
|
/**
|
@@ -1901,7 +1764,7 @@ export class ShareFileClient extends StorageClient {
|
|
1901
1764
|
if (offset < 0 || contentLength <= 0) {
|
1902
1765
|
throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
|
1903
1766
|
}
|
1904
|
-
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, {
|
1767
|
+
return assertResponse(await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1905
1768
|
});
|
1906
1769
|
}
|
1907
1770
|
/**
|
@@ -1911,20 +1774,12 @@ export class ShareFileClient extends StorageClient {
|
|
1911
1774
|
*/
|
1912
1775
|
async getRangeList(options = {}) {
|
1913
1776
|
return tracingClient.withSpan("ShareFileClient-getRangeList", options, async (updatedOptions) => {
|
1914
|
-
const originalResponse = assertResponse(await this.context.getRangeList({
|
1915
|
-
...updatedOptions,
|
1916
|
-
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
1917
|
-
...this.shareClientConfig,
|
1918
|
-
}));
|
1777
|
+
const originalResponse = assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
1919
1778
|
// Only returns ranges, ignoring clearRanges.
|
1920
1779
|
const parsedBody = originalResponse._response.parsedBody.ranges
|
1921
1780
|
? originalResponse._response.parsedBody.ranges
|
1922
1781
|
: [];
|
1923
|
-
return {
|
1924
|
-
...originalResponse,
|
1925
|
-
_response: { ...originalResponse._response, parsedBody },
|
1926
|
-
rangeList: originalResponse.ranges ? originalResponse.ranges : [],
|
1927
|
-
};
|
1782
|
+
return Object.assign(Object.assign({}, originalResponse), { _response: Object.assign(Object.assign({}, originalResponse._response), { parsedBody }), rangeList: originalResponse.ranges ? originalResponse.ranges : [] });
|
1928
1783
|
});
|
1929
1784
|
}
|
1930
1785
|
/**
|
@@ -1935,12 +1790,7 @@ export class ShareFileClient extends StorageClient {
|
|
1935
1790
|
*/
|
1936
1791
|
async getRangeListDiff(prevShareSnapshot, options = {}) {
|
1937
1792
|
return tracingClient.withSpan("ShareFileClient-getRangeListDiff", options, async (updatedOptions) => {
|
1938
|
-
return assertResponse(await this.context.getRangeList({
|
1939
|
-
...updatedOptions,
|
1940
|
-
prevsharesnapshot: prevShareSnapshot,
|
1941
|
-
range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined,
|
1942
|
-
...this.shareClientConfig,
|
1943
|
-
}));
|
1793
|
+
return assertResponse(await this.context.getRangeList(Object.assign(Object.assign(Object.assign({}, updatedOptions), { prevsharesnapshot: prevShareSnapshot, range: updatedOptions.range ? rangeToString(updatedOptions.range) : undefined }), this.shareClientConfig)));
|
1944
1794
|
});
|
1945
1795
|
}
|
1946
1796
|
/**
|
@@ -1957,10 +1807,7 @@ export class ShareFileClient extends StorageClient {
|
|
1957
1807
|
*/
|
1958
1808
|
async startCopyFromURL(copySource, options = {}) {
|
1959
1809
|
return tracingClient.withSpan("ShareFileClient-startCopyFromURL", options, async (updatedOptions) => {
|
1960
|
-
return assertResponse(await this.context.startCopy(copySource, {
|
1961
|
-
...updatedOptions,
|
1962
|
-
...this.shareClientConfig,
|
1963
|
-
}));
|
1810
|
+
return assertResponse(await this.context.startCopy(copySource, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1964
1811
|
});
|
1965
1812
|
}
|
1966
1813
|
/**
|
@@ -1973,7 +1820,7 @@ export class ShareFileClient extends StorageClient {
|
|
1973
1820
|
*/
|
1974
1821
|
async abortCopyFromURL(copyId, options = {}) {
|
1975
1822
|
return tracingClient.withSpan("ShareFileClient-abortCopyFromURL", options, async (updatedOptions) => {
|
1976
|
-
return assertResponse(await this.context.abortCopy(copyId, {
|
1823
|
+
return assertResponse(await this.context.abortCopy(copyId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig)));
|
1977
1824
|
});
|
1978
1825
|
}
|
1979
1826
|
// High Level functions
|
@@ -2311,23 +2158,13 @@ export class ShareFileClient extends StorageClient {
|
|
2311
2158
|
async listHandlesSegment(marker, options = {}) {
|
2312
2159
|
return tracingClient.withSpan("ShareFileClient-listHandlesSegment", options, async (updatedOptions) => {
|
2313
2160
|
marker = marker === "" ? undefined : marker;
|
2314
|
-
const response = assertResponse(await this.context.listHandles({
|
2315
|
-
...updatedOptions,
|
2316
|
-
...this.shareClientConfig,
|
2317
|
-
marker,
|
2318
|
-
}));
|
2161
|
+
const response = assertResponse(await this.context.listHandles(Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker })));
|
2319
2162
|
// TODO: Protocol layer issue that when handle list is in returned XML
|
2320
2163
|
// response.handleList is an empty string
|
2321
2164
|
if (response.handleList === "") {
|
2322
2165
|
response.handleList = undefined;
|
2323
2166
|
}
|
2324
|
-
const wrappedResponse = {
|
2325
|
-
...ConvertInternalResponseOfListHandles(response),
|
2326
|
-
_response: {
|
2327
|
-
...response._response,
|
2328
|
-
parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody),
|
2329
|
-
},
|
2330
|
-
};
|
2167
|
+
const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListHandles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListHandles(response._response.parsedBody) }) });
|
2331
2168
|
return wrappedResponse;
|
2332
2169
|
});
|
2333
2170
|
}
|
@@ -2341,30 +2178,47 @@ export class ShareFileClient extends StorageClient {
|
|
2341
2178
|
* set of list items.
|
2342
2179
|
* @param options - Options to list handles operation.
|
2343
2180
|
*/
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2181
|
+
iterateHandleSegments(marker, options = {}) {
|
2182
|
+
return __asyncGenerator(this, arguments, function* iterateHandleSegments_2() {
|
2183
|
+
let listHandlesResponse;
|
2184
|
+
if (!!marker || marker === undefined) {
|
2185
|
+
do {
|
2186
|
+
listHandlesResponse = yield __await(this.listHandlesSegment(marker, options));
|
2187
|
+
marker = listHandlesResponse.continuationToken;
|
2188
|
+
yield yield __await(listHandlesResponse);
|
2189
|
+
} while (marker);
|
2190
|
+
}
|
2191
|
+
});
|
2353
2192
|
}
|
2354
2193
|
/**
|
2355
2194
|
* Returns an AsyncIterableIterator for handles
|
2356
2195
|
*
|
2357
2196
|
* @param options - Options to list handles operation.
|
2358
2197
|
*/
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2198
|
+
listHandleItems(options = {}) {
|
2199
|
+
return __asyncGenerator(this, arguments, function* listHandleItems_2() {
|
2200
|
+
var _a, e_3, _b, _c;
|
2201
|
+
let marker;
|
2202
|
+
try {
|
2203
|
+
for (var _d = true, _e = __asyncValues(this.iterateHandleSegments(marker, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
|
2204
|
+
_c = _f.value;
|
2205
|
+
_d = false;
|
2206
|
+
const listHandlesResponse = _c;
|
2207
|
+
if (listHandlesResponse.handleList) {
|
2208
|
+
for (const handle of listHandlesResponse.handleList) {
|
2209
|
+
yield yield __await(handle);
|
2210
|
+
}
|
2211
|
+
}
|
2365
2212
|
}
|
2366
2213
|
}
|
2367
|
-
|
2214
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
2215
|
+
finally {
|
2216
|
+
try {
|
2217
|
+
if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
|
2218
|
+
}
|
2219
|
+
finally { if (e_3) throw e_3.error; }
|
2220
|
+
}
|
2221
|
+
});
|
2368
2222
|
}
|
2369
2223
|
/**
|
2370
2224
|
* Returns an async iterable iterator to list all the handles.
|
@@ -2396,10 +2250,7 @@ export class ShareFileClient extends StorageClient {
|
|
2396
2250
|
* Return an AsyncIterableIterator that works a page at a time
|
2397
2251
|
*/
|
2398
2252
|
byPage: (settings = {}) => {
|
2399
|
-
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
|
2400
|
-
maxPageSize: settings.maxPageSize,
|
2401
|
-
...options,
|
2402
|
-
});
|
2253
|
+
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxPageSize: settings.maxPageSize }, options));
|
2403
2254
|
},
|
2404
2255
|
};
|
2405
2256
|
}
|
@@ -2417,11 +2268,7 @@ export class ShareFileClient extends StorageClient {
|
|
2417
2268
|
async forceCloseHandlesSegment(marker, options = {}) {
|
2418
2269
|
return tracingClient.withSpan("ShareFileClient-forceCloseHandlesSegment", options, async (updatedOptions) => {
|
2419
2270
|
marker = marker === "" ? undefined : marker;
|
2420
|
-
const rawResponse = await this.context.forceCloseHandles("*", {
|
2421
|
-
...updatedOptions,
|
2422
|
-
...this.shareClientConfig,
|
2423
|
-
marker,
|
2424
|
-
});
|
2271
|
+
const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig), { marker }));
|
2425
2272
|
const response = rawResponse;
|
2426
2273
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2427
2274
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2468,10 +2315,7 @@ export class ShareFileClient extends StorageClient {
|
|
2468
2315
|
if (handleId === "*") {
|
2469
2316
|
throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
|
2470
2317
|
}
|
2471
|
-
const rawResponse = await this.context.forceCloseHandles(handleId, {
|
2472
|
-
...updatedOptions,
|
2473
|
-
...this.shareClientConfig,
|
2474
|
-
});
|
2318
|
+
const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({}, updatedOptions), this.shareClientConfig));
|
2475
2319
|
const response = rawResponse;
|
2476
2320
|
response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
|
2477
2321
|
response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
|
@@ -2502,11 +2346,7 @@ export class ShareFileClient extends StorageClient {
|
|
2502
2346
|
if (!(this.credential instanceof StorageSharedKeyCredential)) {
|
2503
2347
|
throw RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
|
2504
2348
|
}
|
2505
|
-
const sas = generateFileSASQueryParameters({
|
2506
|
-
shareName: this.shareName,
|
2507
|
-
filePath: this.path,
|
2508
|
-
...options,
|
2509
|
-
}, this.credential).toString();
|
2349
|
+
const sas = generateFileSASQueryParameters(Object.assign({ shareName: this.shareName, filePath: this.path }, options), this.credential).toString();
|
2510
2350
|
return appendToURLQuery(this.url, sas);
|
2511
2351
|
}
|
2512
2352
|
/**
|
@@ -2545,25 +2385,19 @@ export class ShareFileClient extends StorageClient {
|
|
2545
2385
|
}
|
2546
2386
|
const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
|
2547
2387
|
return tracingClient.withSpan("ShareFileClient-rename", options, async (updatedOptions) => {
|
2548
|
-
const response = assertResponse(await destFile.context.rename(this.url, {
|
2549
|
-
...updatedOptions,
|
2550
|
-
sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2388
|
+
const response = assertResponse(await destFile.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
|
2551
2389
|
? {
|
2552
2390
|
sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
|
2553
2391
|
}
|
2554
|
-
: undefined,
|
2555
|
-
destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
2392
|
+
: undefined, destinationLeaseAccessConditions: updatedOptions.destinationLeaseAccessConditions
|
2556
2393
|
? {
|
2557
2394
|
destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
|
2558
2395
|
}
|
2559
|
-
: undefined,
|
2560
|
-
fileHttpHeaders: options.contentType
|
2396
|
+
: undefined, fileHttpHeaders: options.contentType
|
2561
2397
|
? {
|
2562
2398
|
fileContentType: options.contentType,
|
2563
2399
|
}
|
2564
|
-
: undefined,
|
2565
|
-
...this.shareClientConfig,
|
2566
|
-
}));
|
2400
|
+
: undefined }), this.shareClientConfig)));
|
2567
2401
|
return {
|
2568
2402
|
destinationFileClient: destFile,
|
2569
2403
|
fileRenameResponse: response,
|
@@ -2622,11 +2456,7 @@ export class ShareLeaseClient {
|
|
2622
2456
|
*/
|
2623
2457
|
async acquireLease(duration = -1, options = {}) {
|
2624
2458
|
return tracingClient.withSpan("ShareLeaseClient-acquireLease", options, async (updatedOptions) => {
|
2625
|
-
return assertResponse(await this.fileOrShare.acquireLease({
|
2626
|
-
...updatedOptions,
|
2627
|
-
duration,
|
2628
|
-
proposedLeaseId: this._leaseId,
|
2629
|
-
}));
|
2459
|
+
return assertResponse(await this.fileOrShare.acquireLease(Object.assign(Object.assign({}, updatedOptions), { duration, proposedLeaseId: this._leaseId })));
|
2630
2460
|
});
|
2631
2461
|
}
|
2632
2462
|
/**
|
@@ -2638,10 +2468,7 @@ export class ShareLeaseClient {
|
|
2638
2468
|
*/
|
2639
2469
|
async changeLease(proposedLeaseId, options = {}) {
|
2640
2470
|
return tracingClient.withSpan("ShareLeaseClient-changeLease", options, async (updatedOptions) => {
|
2641
|
-
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, {
|
2642
|
-
...updatedOptions,
|
2643
|
-
proposedLeaseId,
|
2644
|
-
}));
|
2471
|
+
const response = assertResponse(await this.fileOrShare.changeLease(this._leaseId, Object.assign(Object.assign({}, updatedOptions), { proposedLeaseId })));
|
2645
2472
|
this._leaseId = proposedLeaseId;
|
2646
2473
|
return response;
|
2647
2474
|
});
|