@azure/storage-file-share 12.23.0-alpha.20240112.1 → 12.23.0-alpha.20240116.1

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