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

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