@azure/storage-file-share 12.13.0 → 12.14.0

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 (29) hide show
  1. package/dist/index.js +199 -69
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/Clients.js +52 -46
  4. package/dist-esm/src/Clients.js.map +1 -1
  5. package/dist-esm/src/Pipeline.js +7 -4
  6. package/dist-esm/src/Pipeline.js.map +1 -1
  7. package/dist-esm/src/ShareServiceClient.js +7 -5
  8. package/dist-esm/src/ShareServiceClient.js.map +1 -1
  9. package/dist-esm/src/generated/src/models/index.js.map +1 -1
  10. package/dist-esm/src/generated/src/models/parameters.js +31 -1
  11. package/dist-esm/src/generated/src/models/parameters.js.map +1 -1
  12. package/dist-esm/src/generated/src/operations/directory.js +29 -4
  13. package/dist-esm/src/generated/src/operations/directory.js.map +1 -1
  14. package/dist-esm/src/generated/src/operations/file.js +49 -8
  15. package/dist-esm/src/generated/src/operations/file.js.map +1 -1
  16. package/dist-esm/src/generated/src/operations/share.js +3 -1
  17. package/dist-esm/src/generated/src/operations/share.js.map +1 -1
  18. package/dist-esm/src/generated/src/storageClientContext.js +2 -2
  19. package/dist-esm/src/generated/src/storageClientContext.js.map +1 -1
  20. package/dist-esm/src/generatedModels.js +5 -1
  21. package/dist-esm/src/generatedModels.js.map +1 -1
  22. package/dist-esm/src/models.js.map +1 -1
  23. package/dist-esm/src/utils/constants.js +6 -2
  24. package/dist-esm/src/utils/constants.js.map +1 -1
  25. package/dist-esm/src/utils/utils.common.js +10 -0
  26. package/dist-esm/src/utils/utils.common.js.map +1 -1
  27. package/package.json +3 -2
  28. package/types/3.1/storage-file-share.d.ts +62 -13
  29. package/types/latest/storage-file-share.d.ts +66 -13
package/dist/index.js CHANGED
@@ -334,13 +334,17 @@ function ipRangeToString(ipRange) {
334
334
 
335
335
  // Copyright (c) Microsoft Corporation.
336
336
  // Licensed under the MIT license.
337
- const SDK_VERSION = "12.13.0";
338
- const SERVICE_VERSION = "2021-12-02";
337
+ const SDK_VERSION = "12.14.0";
338
+ const SERVICE_VERSION = "2022-11-02";
339
339
  const FILE_MAX_SIZE_BYTES = 4 * 1024 * 1024 * 1024 * 1024; // 4TB
340
340
  const FILE_RANGE_MAX_SIZE_BYTES = 4 * 1024 * 1024; // 4MB
341
341
  const DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 5;
342
342
  const DEFAULT_HIGH_LEVEL_CONCURRENCY = 5;
343
343
  const REQUEST_TIMEOUT = 100 * 1000; // In ms
344
+ /**
345
+ * The OAuth scope to use with Azure Storage.
346
+ */
347
+ const StorageOAuthScopes = "https://storage.azure.com/.default";
344
348
  const URLConstants = {
345
349
  Parameters: {
346
350
  FORCE_BROWSER_NO_CACHE: "_",
@@ -851,6 +855,16 @@ function getShareNameAndPathFromUrl(url) {
851
855
  throw new Error("Unable to extract shareName and filePath/directoryPath with provided information.");
852
856
  }
853
857
  }
858
+ /**
859
+ * Attach a TokenCredential to an object.
860
+ *
861
+ * @param thing -
862
+ * @param credential -
863
+ */
864
+ function attachCredential(thing, credential) {
865
+ thing.credential = credential;
866
+ return thing;
867
+ }
854
868
  function httpAuthorizationToString(httpAuthorization) {
855
869
  return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
856
870
  }
@@ -6759,7 +6773,7 @@ const timeoutInSeconds = {
6759
6773
  const version = {
6760
6774
  parameterPath: "version",
6761
6775
  mapper: {
6762
- defaultValue: "2021-12-02",
6776
+ defaultValue: "2022-11-02",
6763
6777
  isConstant: true,
6764
6778
  serializedName: "x-ms-version",
6765
6779
  type: {
@@ -7082,6 +7096,16 @@ const comp4 = {
7082
7096
  }
7083
7097
  }
7084
7098
  };
7099
+ const fileRequestIntent = {
7100
+ parameterPath: ["options", "fileRequestIntent"],
7101
+ mapper: {
7102
+ serializedName: "x-ms-file-request-intent",
7103
+ xmlName: "x-ms-file-request-intent",
7104
+ type: {
7105
+ name: "String"
7106
+ }
7107
+ }
7108
+ };
7085
7109
  const accept2 = {
7086
7110
  parameterPath: "accept",
7087
7111
  mapper: {
@@ -7197,6 +7221,16 @@ const restype2 = {
7197
7221
  }
7198
7222
  }
7199
7223
  };
7224
+ const allowTrailingDot = {
7225
+ parameterPath: ["options", "allowTrailingDot"],
7226
+ mapper: {
7227
+ serializedName: "x-ms-allow-trailing-dot",
7228
+ xmlName: "x-ms-allow-trailing-dot",
7229
+ type: {
7230
+ name: "Boolean"
7231
+ }
7232
+ }
7233
+ };
7200
7234
  const filePermission = {
7201
7235
  parameterPath: ["options", "filePermission"],
7202
7236
  mapper: {
@@ -7435,6 +7469,16 @@ const fileChangeTime = {
7435
7469
  }
7436
7470
  }
7437
7471
  };
7472
+ const allowSourceTrailingDot = {
7473
+ parameterPath: ["options", "allowSourceTrailingDot"],
7474
+ mapper: {
7475
+ serializedName: "x-ms-source-allow-trailing-dot",
7476
+ xmlName: "x-ms-source-allow-trailing-dot",
7477
+ type: {
7478
+ name: "Boolean"
7479
+ }
7480
+ }
7481
+ };
7438
7482
  const fileContentLength = {
7439
7483
  parameterPath: "fileContentLength",
7440
7484
  mapper: {
@@ -8428,7 +8472,8 @@ const createPermissionOperationSpec = {
8428
8472
  headerParameters: [
8429
8473
  contentType,
8430
8474
  accept,
8431
- version
8475
+ version,
8476
+ fileRequestIntent
8432
8477
  ],
8433
8478
  isXML: false,
8434
8479
  contentType: "application/xml; charset=utf-8",
@@ -8455,6 +8500,7 @@ const getPermissionOperationSpec = {
8455
8500
  urlParameters: [url],
8456
8501
  headerParameters: [
8457
8502
  version,
8503
+ fileRequestIntent,
8458
8504
  accept2,
8459
8505
  filePermissionKey
8460
8506
  ],
@@ -8782,6 +8828,8 @@ const createOperationSpec$1 = {
8782
8828
  version,
8783
8829
  accept1,
8784
8830
  metadata,
8831
+ fileRequestIntent,
8832
+ allowTrailingDot,
8785
8833
  filePermission,
8786
8834
  filePermissionKey1,
8787
8835
  fileAttributes,
@@ -8810,7 +8858,12 @@ const getPropertiesOperationSpec$1 = {
8810
8858
  restype2
8811
8859
  ],
8812
8860
  urlParameters: [url],
8813
- headerParameters: [version, accept1],
8861
+ headerParameters: [
8862
+ version,
8863
+ accept1,
8864
+ fileRequestIntent,
8865
+ allowTrailingDot
8866
+ ],
8814
8867
  isXML: true,
8815
8868
  serializer: xmlSerializer$1
8816
8869
  };
@@ -8828,7 +8881,12 @@ const deleteOperationSpec$1 = {
8828
8881
  },
8829
8882
  queryParameters: [timeoutInSeconds, restype2],
8830
8883
  urlParameters: [url],
8831
- headerParameters: [version, accept1],
8884
+ headerParameters: [
8885
+ version,
8886
+ accept1,
8887
+ fileRequestIntent,
8888
+ allowTrailingDot
8889
+ ],
8832
8890
  isXML: true,
8833
8891
  serializer: xmlSerializer$1
8834
8892
  };
@@ -8853,6 +8911,8 @@ const setPropertiesOperationSpec = {
8853
8911
  headerParameters: [
8854
8912
  version,
8855
8913
  accept1,
8914
+ fileRequestIntent,
8915
+ allowTrailingDot,
8856
8916
  filePermission,
8857
8917
  filePermissionKey1,
8858
8918
  fileAttributes,
@@ -8884,7 +8944,9 @@ const setMetadataOperationSpec$1 = {
8884
8944
  headerParameters: [
8885
8945
  version,
8886
8946
  accept1,
8887
- metadata
8947
+ metadata,
8948
+ fileRequestIntent,
8949
+ allowTrailingDot
8888
8950
  ],
8889
8951
  isXML: true,
8890
8952
  serializer: xmlSerializer$1
@@ -8916,6 +8978,8 @@ const listFilesAndDirectoriesSegmentOperationSpec = {
8916
8978
  headerParameters: [
8917
8979
  version,
8918
8980
  accept1,
8981
+ fileRequestIntent,
8982
+ allowTrailingDot,
8919
8983
  includeExtendedInfo
8920
8984
  ],
8921
8985
  isXML: true,
@@ -8945,6 +9009,8 @@ const listHandlesOperationSpec$1 = {
8945
9009
  headerParameters: [
8946
9010
  version,
8947
9011
  accept1,
9012
+ fileRequestIntent,
9013
+ allowTrailingDot,
8948
9014
  recursive
8949
9015
  ],
8950
9016
  isXML: true,
@@ -8972,6 +9038,8 @@ const forceCloseHandlesOperationSpec$1 = {
8972
9038
  headerParameters: [
8973
9039
  version,
8974
9040
  accept1,
9041
+ fileRequestIntent,
9042
+ allowTrailingDot,
8975
9043
  recursive,
8976
9044
  handleId
8977
9045
  ],
@@ -9000,6 +9068,8 @@ const renameOperationSpec$1 = {
9000
9068
  version,
9001
9069
  accept1,
9002
9070
  metadata,
9071
+ fileRequestIntent,
9072
+ allowTrailingDot,
9003
9073
  filePermission,
9004
9074
  filePermissionKey1,
9005
9075
  renameSource,
@@ -9010,7 +9080,8 @@ const renameOperationSpec$1 = {
9010
9080
  fileAttributes1,
9011
9081
  fileCreationTime,
9012
9082
  fileLastWriteTime,
9013
- fileChangeTime
9083
+ fileChangeTime,
9084
+ allowSourceTrailingDot
9014
9085
  ],
9015
9086
  isXML: true,
9016
9087
  serializer: xmlSerializer$1
@@ -9294,6 +9365,8 @@ const createOperationSpec = {
9294
9365
  accept1,
9295
9366
  metadata,
9296
9367
  leaseId,
9368
+ fileRequestIntent,
9369
+ allowTrailingDot,
9297
9370
  filePermission,
9298
9371
  filePermissionKey1,
9299
9372
  fileAttributes,
@@ -9341,6 +9414,8 @@ const downloadOperationSpec = {
9341
9414
  version,
9342
9415
  accept1,
9343
9416
  leaseId,
9417
+ fileRequestIntent,
9418
+ allowTrailingDot,
9344
9419
  range,
9345
9420
  rangeGetContentMD5
9346
9421
  ],
@@ -9364,7 +9439,9 @@ const getPropertiesOperationSpec = {
9364
9439
  headerParameters: [
9365
9440
  version,
9366
9441
  accept1,
9367
- leaseId
9442
+ leaseId,
9443
+ fileRequestIntent,
9444
+ allowTrailingDot
9368
9445
  ],
9369
9446
  isXML: true,
9370
9447
  serializer: xmlSerializer
@@ -9386,7 +9463,9 @@ const deleteOperationSpec = {
9386
9463
  headerParameters: [
9387
9464
  version,
9388
9465
  accept1,
9389
- leaseId
9466
+ leaseId,
9467
+ fileRequestIntent,
9468
+ allowTrailingDot
9390
9469
  ],
9391
9470
  isXML: true,
9392
9471
  serializer: xmlSerializer
@@ -9409,6 +9488,8 @@ const setHttpHeadersOperationSpec = {
9409
9488
  version,
9410
9489
  accept1,
9411
9490
  leaseId,
9491
+ fileRequestIntent,
9492
+ allowTrailingDot,
9412
9493
  filePermission,
9413
9494
  filePermissionKey1,
9414
9495
  fileAttributes,
@@ -9444,7 +9525,9 @@ const setMetadataOperationSpec = {
9444
9525
  version,
9445
9526
  accept1,
9446
9527
  metadata,
9447
- leaseId
9528
+ leaseId,
9529
+ fileRequestIntent,
9530
+ allowTrailingDot
9448
9531
  ],
9449
9532
  isXML: true,
9450
9533
  serializer: xmlSerializer
@@ -9469,7 +9552,9 @@ const acquireLeaseOperationSpec = {
9469
9552
  action,
9470
9553
  duration,
9471
9554
  proposedLeaseId,
9472
- requestId
9555
+ requestId,
9556
+ fileRequestIntent,
9557
+ allowTrailingDot
9473
9558
  ],
9474
9559
  isXML: true,
9475
9560
  serializer: xmlSerializer
@@ -9493,7 +9578,9 @@ const releaseLeaseOperationSpec = {
9493
9578
  accept1,
9494
9579
  requestId,
9495
9580
  action1,
9496
- leaseId1
9581
+ leaseId1,
9582
+ fileRequestIntent,
9583
+ allowTrailingDot
9497
9584
  ],
9498
9585
  isXML: true,
9499
9586
  serializer: xmlSerializer
@@ -9518,7 +9605,9 @@ const changeLeaseOperationSpec = {
9518
9605
  proposedLeaseId,
9519
9606
  requestId,
9520
9607
  leaseId1,
9521
- action2
9608
+ action2,
9609
+ fileRequestIntent,
9610
+ allowTrailingDot
9522
9611
  ],
9523
9612
  isXML: true,
9524
9613
  serializer: xmlSerializer
@@ -9542,7 +9631,9 @@ const breakLeaseOperationSpec = {
9542
9631
  accept1,
9543
9632
  leaseId,
9544
9633
  requestId,
9545
- action4
9634
+ action4,
9635
+ fileRequestIntent,
9636
+ allowTrailingDot
9546
9637
  ],
9547
9638
  isXML: true,
9548
9639
  serializer: xmlSerializer
@@ -9565,6 +9656,8 @@ const uploadRangeOperationSpec = {
9565
9656
  headerParameters: [
9566
9657
  version,
9567
9658
  leaseId,
9659
+ fileRequestIntent,
9660
+ allowTrailingDot,
9568
9661
  contentType1,
9569
9662
  accept3,
9570
9663
  range1,
@@ -9595,6 +9688,8 @@ const uploadRangeFromURLOperationSpec = {
9595
9688
  version,
9596
9689
  accept1,
9597
9690
  leaseId,
9691
+ allowTrailingDot,
9692
+ allowSourceTrailingDot,
9598
9693
  range1,
9599
9694
  contentLength,
9600
9695
  fileLastWrittenMode,
@@ -9633,6 +9728,8 @@ const getRangeListOperationSpec = {
9633
9728
  version,
9634
9729
  accept1,
9635
9730
  leaseId,
9731
+ fileRequestIntent,
9732
+ allowTrailingDot,
9636
9733
  range
9637
9734
  ],
9638
9735
  isXML: true,
@@ -9657,12 +9754,15 @@ const startCopyOperationSpec = {
9657
9754
  accept1,
9658
9755
  metadata,
9659
9756
  leaseId,
9757
+ fileRequestIntent,
9758
+ allowTrailingDot,
9660
9759
  filePermission,
9661
9760
  filePermissionKey1,
9662
9761
  fileAttributes1,
9663
9762
  fileCreationTime,
9664
9763
  fileLastWriteTime,
9665
9764
  fileChangeTime,
9765
+ allowSourceTrailingDot,
9666
9766
  copySource,
9667
9767
  filePermissionCopyMode,
9668
9768
  ignoreReadOnly1,
@@ -9693,6 +9793,8 @@ const abortCopyOperationSpec = {
9693
9793
  version,
9694
9794
  accept1,
9695
9795
  leaseId,
9796
+ fileRequestIntent,
9797
+ allowTrailingDot,
9696
9798
  copyActionAbortConstant
9697
9799
  ],
9698
9800
  isXML: true,
@@ -9719,7 +9821,12 @@ const listHandlesOperationSpec = {
9719
9821
  comp9
9720
9822
  ],
9721
9823
  urlParameters: [url],
9722
- headerParameters: [version, accept1],
9824
+ headerParameters: [
9825
+ version,
9826
+ accept1,
9827
+ fileRequestIntent,
9828
+ allowTrailingDot
9829
+ ],
9723
9830
  isXML: true,
9724
9831
  serializer: xmlSerializer
9725
9832
  };
@@ -9745,6 +9852,8 @@ const forceCloseHandlesOperationSpec = {
9745
9852
  headerParameters: [
9746
9853
  version,
9747
9854
  accept1,
9855
+ fileRequestIntent,
9856
+ allowTrailingDot,
9748
9857
  handleId
9749
9858
  ],
9750
9859
  isXML: true,
@@ -9768,6 +9877,8 @@ const renameOperationSpec = {
9768
9877
  version,
9769
9878
  accept1,
9770
9879
  metadata,
9880
+ fileRequestIntent,
9881
+ allowTrailingDot,
9771
9882
  filePermission,
9772
9883
  filePermissionKey1,
9773
9884
  renameSource,
@@ -9779,6 +9890,7 @@ const renameOperationSpec = {
9779
9890
  fileCreationTime,
9780
9891
  fileLastWriteTime,
9781
9892
  fileChangeTime,
9893
+ allowSourceTrailingDot,
9782
9894
  fileContentType
9783
9895
  ],
9784
9896
  isXML: true,
@@ -10244,7 +10356,7 @@ class Pipeline {
10244
10356
  this.factories = factories;
10245
10357
  // when options.httpClient is not specified, passing in a DefaultHttpClient instance to
10246
10358
  // avoid each client creating its own http client.
10247
- this.options = Object.assign(Object.assign({}, options), { httpClient: options.httpClient || getCachedDefaultHttpClient() });
10359
+ this.options = Object.assign(Object.assign({}, options), { httpClient: options.httpClient || getCachedDefaultHttpClient(), shareTokenIntent: options.shareTokenIntent });
10248
10360
  }
10249
10361
  /**
10250
10362
  * Transfer Pipeline object to ServiceClientOptions object which required by
@@ -10293,7 +10405,9 @@ function newPipeline(credential, pipelineOptions = {}) {
10293
10405
  factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions));
10294
10406
  factories.push(coreHttp.disableResponseDecompressionPolicy());
10295
10407
  }
10296
- factories.push(credential);
10408
+ factories.push(coreHttp.isTokenCredential(credential)
10409
+ ? attachCredential(coreHttp.bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes), credential)
10410
+ : credential);
10297
10411
  return new Pipeline(factories, pipelineOptions);
10298
10412
  }
10299
10413
 
@@ -10502,7 +10616,7 @@ function convertTracingToRequestOptionsBase(options) {
10502
10616
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
10503
10617
  */
10504
10618
  const packageName = "azure-storage-file-share";
10505
- const packageVersion = "12.13.0";
10619
+ const packageVersion = "12.14.0";
10506
10620
  class StorageClientContext extends coreHttp__namespace.ServiceClient {
10507
10621
  /**
10508
10622
  * Initializes a new instance of the StorageClientContext class.
@@ -10528,7 +10642,7 @@ class StorageClientContext extends coreHttp__namespace.ServiceClient {
10528
10642
  // Parameter assignments
10529
10643
  this.url = url;
10530
10644
  // Assigning values to Constant parameters
10531
- this.version = options.version || "2021-12-02";
10645
+ this.version = options.version || "2022-11-02";
10532
10646
  this.fileRangeWriteFromUrl = options.fileRangeWriteFromUrl || "update";
10533
10647
  }
10534
10648
  }
@@ -11767,7 +11881,8 @@ class ShareClient extends StorageClient {
11767
11881
  url = urlOrConnectionString;
11768
11882
  pipeline = credentialOrPipelineOrShareName;
11769
11883
  }
11770
- else if (credentialOrPipelineOrShareName instanceof Credential) {
11884
+ else if (credentialOrPipelineOrShareName instanceof Credential ||
11885
+ coreHttp.isTokenCredential(credentialOrPipelineOrShareName)) {
11771
11886
  // (url: string, credential?: Credential, options?: StoragePipelineOptions)
11772
11887
  url = urlOrConnectionString;
11773
11888
  pipeline = newPipeline(credentialOrPipelineOrShareName, options);
@@ -11807,6 +11922,7 @@ class ShareClient extends StorageClient {
11807
11922
  }
11808
11923
  super(url, pipeline);
11809
11924
  this._name = getShareNameAndPathFromUrl(this.url).shareName;
11925
+ this.shareClientConfig = options;
11810
11926
  this.context = new Share(this.storageClientContext);
11811
11927
  }
11812
11928
  /**
@@ -11823,7 +11939,7 @@ class ShareClient extends StorageClient {
11823
11939
  * @returns A new ShareClient object identical to the source but with the specified snapshot timestamp
11824
11940
  */
11825
11941
  withSnapshot(snapshot) {
11826
- return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);
11942
+ return new ShareClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline, this.shareClientConfig);
11827
11943
  }
11828
11944
  /**
11829
11945
  * Creates a new share under the specified account. If the share with
@@ -11890,7 +12006,7 @@ class ShareClient extends StorageClient {
11890
12006
  // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
11891
12007
  /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
11892
12008
  getDirectoryClient(directoryName) {
11893
- return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline);
12009
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline, this.shareClientConfig);
11894
12010
  }
11895
12011
  /**
11896
12012
  * Gets the directory client for the root directory of this share.
@@ -12387,7 +12503,7 @@ class ShareClient extends StorageClient {
12387
12503
  try {
12388
12504
  return await this.context.createPermission({
12389
12505
  permission: filePermission,
12390
- }, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
12506
+ }, Object.assign(Object.assign({ abortSignal: options.abortSignal }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12391
12507
  }
12392
12508
  catch (e) {
12393
12509
  span.setStatus({
@@ -12411,7 +12527,7 @@ class ShareClient extends StorageClient {
12411
12527
  async getPermission(filePermissionKey, options = {}) {
12412
12528
  const { span, updatedOptions } = createSpan("ShareClient-getPermission", options);
12413
12529
  try {
12414
- return await this.context.getPermission(filePermissionKey, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
12530
+ return await this.context.getPermission(filePermissionKey, Object.assign(Object.assign({ abortSignal: options.abortSignal }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12415
12531
  }
12416
12532
  catch (e) {
12417
12533
  span.setStatus({
@@ -12452,7 +12568,8 @@ class ShareDirectoryClient extends StorageClient {
12452
12568
  if (credentialOrPipeline instanceof Pipeline) {
12453
12569
  pipeline = credentialOrPipeline;
12454
12570
  }
12455
- else if (credentialOrPipeline instanceof Credential) {
12571
+ else if (credentialOrPipeline instanceof Credential ||
12572
+ coreHttp.isTokenCredential(credentialOrPipeline)) {
12456
12573
  pipeline = newPipeline(credentialOrPipeline, options);
12457
12574
  }
12458
12575
  else {
@@ -12465,6 +12582,7 @@ class ShareDirectoryClient extends StorageClient {
12465
12582
  shareName: this._shareName,
12466
12583
  path: this._path,
12467
12584
  } = getShareNameAndPathFromUrl(this.url));
12585
+ this.shareClientConfig = options;
12468
12586
  this.context = new Directory(this.storageClientContext);
12469
12587
  }
12470
12588
  /**
@@ -12504,7 +12622,7 @@ class ShareDirectoryClient extends StorageClient {
12504
12622
  }
12505
12623
  return await this.context.create(options.fileAttributes
12506
12624
  ? fileAttributesToString(options.fileAttributes)
12507
- : FileAttributesNone, Object.assign({ abortSignal: options.abortSignal, metadata: options.metadata, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }, convertTracingToRequestOptionsBase(updatedOptions)));
12625
+ : FileAttributesNone, Object.assign(Object.assign({ abortSignal: options.abortSignal, metadata: options.metadata, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12508
12626
  }
12509
12627
  catch (e) {
12510
12628
  span.setStatus({
@@ -12562,7 +12680,7 @@ class ShareDirectoryClient extends StorageClient {
12562
12680
  properties = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(properties);
12563
12681
  return await this.context.setProperties(properties.fileAttributes
12564
12682
  ? fileAttributesToString(properties.fileAttributes)
12565
- : FileAttributesPreserve, Object.assign({ abortSignal: properties.abortSignal, filePermission: properties.filePermission, filePermissionKey: properties.filePermissionKey, fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(properties.creationTime), fileLastWriteOn: fileLastWriteTimeToString(properties.lastWriteTime) }, convertTracingToRequestOptionsBase(updatedOptions)));
12683
+ : FileAttributesPreserve, Object.assign(Object.assign({ abortSignal: properties.abortSignal, filePermission: properties.filePermission, filePermissionKey: properties.filePermissionKey, fileChangeOn: fileChangeTimeToString(updatedOptions.changeTime), fileCreatedOn: fileCreationTimeToString(properties.creationTime), fileLastWriteOn: fileLastWriteTimeToString(properties.lastWriteTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12566
12684
  }
12567
12685
  catch (e) {
12568
12686
  span.setStatus({
@@ -12590,7 +12708,7 @@ class ShareDirectoryClient extends StorageClient {
12590
12708
  * ```
12591
12709
  */
12592
12710
  getDirectoryClient(subDirectoryName) {
12593
- return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline);
12711
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline, this.shareClientConfig);
12594
12712
  }
12595
12713
  /**
12596
12714
  * Creates a new subdirectory under this directory.
@@ -12735,7 +12853,7 @@ class ShareDirectoryClient extends StorageClient {
12735
12853
  // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
12736
12854
  /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
12737
12855
  getFileClient(fileName) {
12738
- return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline);
12856
+ return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline, this.shareClientConfig);
12739
12857
  }
12740
12858
  /**
12741
12859
  * Returns true if the specified directory exists; false otherwise.
@@ -12785,7 +12903,7 @@ class ShareDirectoryClient extends StorageClient {
12785
12903
  async getProperties(options = {}) {
12786
12904
  const { span, updatedOptions } = createSpan("ShareDirectoryClient-getProperties", options);
12787
12905
  try {
12788
- return await this.context.getProperties(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
12906
+ return await this.context.getProperties(Object.assign(Object.assign({ abortSignal: options.abortSignal }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12789
12907
  }
12790
12908
  catch (e) {
12791
12909
  span.setStatus({
@@ -12809,7 +12927,7 @@ class ShareDirectoryClient extends StorageClient {
12809
12927
  async delete(options = {}) {
12810
12928
  const { span, updatedOptions } = createSpan("ShareDirectoryClient-delete", options);
12811
12929
  try {
12812
- return await this.context.delete(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
12930
+ return await this.context.delete(Object.assign(Object.assign({ abortSignal: options.abortSignal }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12813
12931
  }
12814
12932
  catch (e) {
12815
12933
  span.setStatus({
@@ -12866,7 +12984,7 @@ class ShareDirectoryClient extends StorageClient {
12866
12984
  async setMetadata(metadata, options = {}) {
12867
12985
  const { span, updatedOptions } = createSpan("ShareDirectoryClient-setMetadata", options);
12868
12986
  try {
12869
- return await this.context.setMetadata(Object.assign({ abortSignal: options.abortSignal, metadata }, convertTracingToRequestOptionsBase(updatedOptions)));
12987
+ return await this.context.setMetadata(Object.assign(Object.assign({ abortSignal: options.abortSignal, metadata }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
12870
12988
  }
12871
12989
  catch (e) {
12872
12990
  span.setStatus({
@@ -13082,7 +13200,7 @@ class ShareDirectoryClient extends StorageClient {
13082
13200
  options.prefix = undefined;
13083
13201
  }
13084
13202
  try {
13085
- const response = await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
13203
+ const response = await this.context.listFilesAndDirectoriesSegment(Object.assign(Object.assign(Object.assign({ marker }, options), this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13086
13204
  const wrappedResponse = Object.assign(Object.assign({}, ConvertInternalResponseOfListFiles(response)), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListFiles(response._response.parsedBody) }) });
13087
13205
  return wrappedResponse;
13088
13206
  }
@@ -13262,7 +13380,7 @@ class ShareDirectoryClient extends StorageClient {
13262
13380
  const { span, updatedOptions } = createSpan("ShareDirectoryClient-listHandlesSegment", options);
13263
13381
  try {
13264
13382
  marker = marker === "" ? undefined : marker;
13265
- const response = await this.context.listHandles(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
13383
+ const response = await this.context.listHandles(Object.assign(Object.assign(Object.assign({ marker }, options), this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13266
13384
  // TODO: Protocol layer issue that when handle list is in returned XML
13267
13385
  // response.handleList is an empty string
13268
13386
  if (response.handleList === "") {
@@ -13297,7 +13415,7 @@ class ShareDirectoryClient extends StorageClient {
13297
13415
  const { span, updatedOptions } = createSpan("ShareDirectoryClient-forceCloseHandlesSegment", options);
13298
13416
  try {
13299
13417
  marker = marker === "" ? undefined : marker;
13300
- const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
13418
+ const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)), this.shareClientConfig));
13301
13419
  const response = rawResponse;
13302
13420
  response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
13303
13421
  response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
@@ -13365,7 +13483,7 @@ class ShareDirectoryClient extends StorageClient {
13365
13483
  if (handleId === "*") {
13366
13484
  throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
13367
13485
  }
13368
- const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
13486
+ const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)), this.shareClientConfig));
13369
13487
  const response = rawResponse;
13370
13488
  response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
13371
13489
  response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
@@ -13417,9 +13535,9 @@ class ShareDirectoryClient extends StorageClient {
13417
13535
  else {
13418
13536
  throw new RangeError("Destination path should not contain more than one query string");
13419
13537
  }
13420
- const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline);
13538
+ const destDirectory = new ShareDirectoryClient(destinationUrl, this.pipeline, this.shareClientConfig);
13421
13539
  try {
13422
- const response = await destDirectory.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
13540
+ const response = await destDirectory.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
13423
13541
  ? {
13424
13542
  sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
13425
13543
  }
@@ -13427,7 +13545,7 @@ class ShareDirectoryClient extends StorageClient {
13427
13545
  ? {
13428
13546
  destinationLeaseId: updatedOptions.destinationLeaseAccessConditions.leaseId,
13429
13547
  }
13430
- : undefined }));
13548
+ : undefined }), this.shareClientConfig));
13431
13549
  return {
13432
13550
  destinationDirectoryClient: destDirectory,
13433
13551
  directoryRenameResponse: response,
@@ -13457,7 +13575,8 @@ class ShareFileClient extends StorageClient {
13457
13575
  if (credentialOrPipeline instanceof Pipeline) {
13458
13576
  pipeline = credentialOrPipeline;
13459
13577
  }
13460
- else if (credentialOrPipeline instanceof Credential) {
13578
+ else if (credentialOrPipeline instanceof Credential ||
13579
+ coreHttp.isTokenCredential(credentialOrPipeline)) {
13461
13580
  pipeline = newPipeline(credentialOrPipeline, options);
13462
13581
  }
13463
13582
  else {
@@ -13470,6 +13589,7 @@ class ShareFileClient extends StorageClient {
13470
13589
  shareName: this._shareName,
13471
13590
  path: this._path,
13472
13591
  } = getShareNameAndPathFromUrl(this.url));
13592
+ this.shareClientConfig = options;
13473
13593
  this.context = new File(this.storageClientContext);
13474
13594
  }
13475
13595
  /**
@@ -13498,7 +13618,7 @@ class ShareFileClient extends StorageClient {
13498
13618
  * @returns A new ShareFileClient object identical to the source but with the specified share snapshot timestamp.
13499
13619
  */
13500
13620
  withShareSnapshot(shareSnapshot) {
13501
- return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline);
13621
+ return new ShareFileClient(setURLParameter(this.url, URLConstants.Parameters.SHARE_SNAPSHOT, shareSnapshot.length === 0 ? undefined : shareSnapshot), this.pipeline, this.shareClientConfig);
13502
13622
  }
13503
13623
  /**
13504
13624
  * Creates a new file or replaces a file. Note it only initializes the file with no content.
@@ -13532,7 +13652,7 @@ class ShareFileClient extends StorageClient {
13532
13652
  options.fileHttpHeaders = options.fileHttpHeaders || {};
13533
13653
  return await this.context.create(size, options.fileAttributes
13534
13654
  ? fileAttributesToString(options.fileAttributes)
13535
- : FileAttributesNone, Object.assign({ abortSignal: options.abortSignal, fileHttpHeaders: options.fileHttpHeaders, metadata: options.metadata, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime), leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
13655
+ : FileAttributesNone, Object.assign(Object.assign({ abortSignal: options.abortSignal, fileHttpHeaders: options.fileHttpHeaders, metadata: options.metadata, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime), leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13536
13656
  }
13537
13657
  catch (e) {
13538
13658
  span.setStatus({
@@ -13613,9 +13733,9 @@ class ShareFileClient extends StorageClient {
13613
13733
  throw new RangeError(`rangeGetContentMD5 only works with partial data downloading`);
13614
13734
  }
13615
13735
  const downloadFullFile = offset === 0 && !count;
13616
- const res = await this.context.download(Object.assign({ abortSignal: options.abortSignal, requestOptions: {
13736
+ const res = await this.context.download(Object.assign(Object.assign({ abortSignal: options.abortSignal, requestOptions: {
13617
13737
  onDownloadProgress: coreHttp.isNode ? undefined : options.onProgress, // for Node.js, progress is reported by RetriableReadableStream
13618
- }, range: downloadFullFile ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
13738
+ }, range: downloadFullFile ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)), this.shareClientConfig));
13619
13739
  // Return browser response immediately
13620
13740
  if (!coreHttp.isNode) {
13621
13741
  return res;
@@ -13714,7 +13834,7 @@ class ShareFileClient extends StorageClient {
13714
13834
  async getProperties(options = {}) {
13715
13835
  const { span, updatedOptions } = createSpan("ShareFileClient-getProperties", options);
13716
13836
  try {
13717
- return this.context.getProperties(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
13837
+ return this.context.getProperties(Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13718
13838
  }
13719
13839
  catch (e) {
13720
13840
  span.setStatus({
@@ -13743,7 +13863,7 @@ class ShareFileClient extends StorageClient {
13743
13863
  properties.fileHttpHeaders = properties.fileHttpHeaders || {};
13744
13864
  return await this.context.setHttpHeaders(properties.fileAttributes
13745
13865
  ? fileAttributesToString(properties.fileAttributes)
13746
- : FileAttributesPreserve, Object.assign({ abortSignal: properties.abortSignal, fileHttpHeaders: properties.fileHttpHeaders, filePermission: properties.filePermission, filePermissionKey: properties.filePermissionKey, leaseAccessConditions: properties.leaseAccessConditions, fileChangeOn: fileChangeTimeToString(properties.changeTime), fileCreatedOn: fileCreationTimeToString(properties.creationTime), fileLastWriteOn: fileLastWriteTimeToString(properties.lastWriteTime) }, convertTracingToRequestOptionsBase(updatedOptions)));
13866
+ : FileAttributesPreserve, Object.assign(Object.assign({ abortSignal: properties.abortSignal, fileHttpHeaders: properties.fileHttpHeaders, filePermission: properties.filePermission, filePermissionKey: properties.filePermissionKey, leaseAccessConditions: properties.leaseAccessConditions, fileChangeOn: fileChangeTimeToString(properties.changeTime), fileCreatedOn: fileCreationTimeToString(properties.creationTime), fileLastWriteOn: fileLastWriteTimeToString(properties.lastWriteTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13747
13867
  }
13748
13868
  catch (e) {
13749
13869
  span.setStatus({
@@ -13776,7 +13896,7 @@ class ShareFileClient extends StorageClient {
13776
13896
  async delete(options = {}) {
13777
13897
  const { span, updatedOptions } = createSpan("ShareFileClient-delete", options);
13778
13898
  try {
13779
- return await this.context.delete(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
13899
+ return await this.context.delete(Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13780
13900
  }
13781
13901
  catch (e) {
13782
13902
  span.setStatus({
@@ -13850,7 +13970,7 @@ class ShareFileClient extends StorageClient {
13850
13970
  options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
13851
13971
  return await this.context.setHttpHeaders(options.fileAttributes
13852
13972
  ? fileAttributesToString(options.fileAttributes)
13853
- : FileAttributesPreserve, Object.assign({ abortSignal: options.abortSignal, fileHttpHeaders, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, leaseAccessConditions: options.leaseAccessConditions, fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime), fileChangeOn: fileChangeTimeToString(options.changeTime) }, convertTracingToRequestOptionsBase(updatedOptions)));
13973
+ : FileAttributesPreserve, Object.assign(Object.assign({ abortSignal: options.abortSignal, fileHttpHeaders, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, leaseAccessConditions: options.leaseAccessConditions, fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime), fileChangeOn: fileChangeTimeToString(options.changeTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13854
13974
  }
13855
13975
  catch (e) {
13856
13976
  span.setStatus({
@@ -13882,7 +14002,7 @@ class ShareFileClient extends StorageClient {
13882
14002
  }
13883
14003
  // FileAttributes, filePermission, createTime, lastWriteTime will all be preserved.
13884
14004
  options = validateAndSetDefaultsForFileAndDirectorySetPropertiesCommonOptions(options);
13885
- return await this.context.setHttpHeaders(fileAttributesToString(options.fileAttributes), Object.assign({ abortSignal: options.abortSignal, fileContentLength: length, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, leaseAccessConditions: options.leaseAccessConditions, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }, convertTracingToRequestOptionsBase(updatedOptions)));
14005
+ return await this.context.setHttpHeaders(fileAttributesToString(options.fileAttributes), Object.assign(Object.assign({ abortSignal: options.abortSignal, fileContentLength: length, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, leaseAccessConditions: options.leaseAccessConditions, fileChangeOn: fileChangeTimeToString(options.changeTime), fileCreatedOn: fileCreationTimeToString(options.creationTime), fileLastWriteOn: fileLastWriteTimeToString(options.lastWriteTime) }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13886
14006
  }
13887
14007
  catch (e) {
13888
14008
  span.setStatus({
@@ -13909,7 +14029,7 @@ class ShareFileClient extends StorageClient {
13909
14029
  async setMetadata(metadata = {}, options = {}) {
13910
14030
  const { span, updatedOptions } = createSpan("ShareFileClient-setMetadata", options);
13911
14031
  try {
13912
- return await this.context.setMetadata(Object.assign({ abortSignal: options.abortSignal, metadata, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
14032
+ return await this.context.setMetadata(Object.assign(Object.assign({ abortSignal: options.abortSignal, metadata, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
13913
14033
  }
13914
14034
  catch (e) {
13915
14035
  span.setStatus({
@@ -13961,9 +14081,9 @@ class ShareFileClient extends StorageClient {
13961
14081
  if (contentLength > FILE_RANGE_MAX_SIZE_BYTES) {
13962
14082
  throw new RangeError(`offset must be < ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
13963
14083
  }
13964
- return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign({ abortSignal: options.abortSignal, contentMD5: options.contentMD5, requestOptions: {
14084
+ return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "update", contentLength, Object.assign(Object.assign(Object.assign({ abortSignal: options.abortSignal, contentMD5: options.contentMD5, requestOptions: {
13965
14085
  onUploadProgress: options.onProgress,
13966
- }, body: body }, convertTracingToRequestOptionsBase(updatedOptions)), { leaseAccessConditions: options.leaseAccessConditions, fileLastWrittenMode: options.fileLastWrittenMode }));
14086
+ }, body: body }, convertTracingToRequestOptionsBase(updatedOptions)), { leaseAccessConditions: options.leaseAccessConditions, fileLastWrittenMode: options.fileLastWrittenMode }), this.shareClientConfig));
13967
14087
  }
13968
14088
  catch (e) {
13969
14089
  span.setStatus({
@@ -13995,7 +14115,7 @@ class ShareFileClient extends StorageClient {
13995
14115
  if (count <= 0 || count > FILE_RANGE_MAX_SIZE_BYTES) {
13996
14116
  throw new RangeError(`count must be > 0 and <= ${FILE_RANGE_MAX_SIZE_BYTES} bytes`);
13997
14117
  }
13998
- return await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign({ abortSignal: options.abortSignal, sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: options.sourceConditions, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), fileLastWrittenMode: options.fileLastWrittenMode }, options), convertTracingToRequestOptionsBase(updatedOptions)));
14118
+ return await this.context.uploadRangeFromURL(rangeToString({ offset: destOffset, count }), sourceURL, 0, Object.assign(Object.assign(Object.assign({ abortSignal: options.abortSignal, sourceRange: rangeToString({ offset: sourceOffset, count }), sourceModifiedAccessConditions: options.sourceConditions, copySourceAuthorization: httpAuthorizationToString(options.sourceAuthorization), fileLastWrittenMode: options.fileLastWrittenMode }, this.shareClientConfig), options), convertTracingToRequestOptionsBase(updatedOptions)));
13999
14119
  }
14000
14120
  catch (e) {
14001
14121
  span.setStatus({
@@ -14022,7 +14142,7 @@ class ShareFileClient extends StorageClient {
14022
14142
  if (offset < 0 || contentLength <= 0) {
14023
14143
  throw new RangeError(`offset must >= 0 and contentLength must be > 0`);
14024
14144
  }
14025
- return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)), { leaseAccessConditions: options.leaseAccessConditions, fileLastWrittenMode: options.fileLastWrittenMode }));
14145
+ return await this.context.uploadRange(rangeToString({ count: contentLength, offset }), "clear", 0, Object.assign(Object.assign(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)), { leaseAccessConditions: options.leaseAccessConditions, fileLastWrittenMode: options.fileLastWrittenMode }), this.shareClientConfig));
14026
14146
  }
14027
14147
  catch (e) {
14028
14148
  span.setStatus({
@@ -14043,7 +14163,7 @@ class ShareFileClient extends StorageClient {
14043
14163
  async getRangeList(options = {}) {
14044
14164
  const { span, updatedOptions } = createSpan("ShareFileClient-getRangeList", options);
14045
14165
  try {
14046
- const originalResponse = await this.context.getRangeList(Object.assign({ abortSignal: options.abortSignal, range: options.range ? rangeToString(options.range) : undefined, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
14166
+ const originalResponse = await this.context.getRangeList(Object.assign(Object.assign({ abortSignal: options.abortSignal, range: options.range ? rangeToString(options.range) : undefined, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
14047
14167
  // Only returns ranges, ignoring clearRanges.
14048
14168
  const parsedBody = originalResponse._response.parsedBody.ranges
14049
14169
  ? originalResponse._response.parsedBody.ranges
@@ -14070,7 +14190,7 @@ class ShareFileClient extends StorageClient {
14070
14190
  async getRangeListDiff(prevShareSnapshot, options = {}) {
14071
14191
  const { span, updatedOptions } = createSpan("ShareFileClient-getRangeListDiff", options);
14072
14192
  try {
14073
- return await this.context.getRangeList(Object.assign(Object.assign(Object.assign({ prevsharesnapshot: prevShareSnapshot }, options), { range: options.range ? rangeToString(options.range) : undefined }), convertTracingToRequestOptionsBase(updatedOptions)));
14193
+ return await this.context.getRangeList(Object.assign(Object.assign(Object.assign(Object.assign({ prevsharesnapshot: prevShareSnapshot }, options), { range: options.range ? rangeToString(options.range) : undefined }), this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
14074
14194
  }
14075
14195
  catch (e) {
14076
14196
  span.setStatus({
@@ -14098,7 +14218,7 @@ class ShareFileClient extends StorageClient {
14098
14218
  async startCopyFromURL(copySource, options = {}) {
14099
14219
  const { span, updatedOptions } = createSpan("ShareFileClient-startCopyFromURL", options);
14100
14220
  try {
14101
- return await this.context.startCopy(copySource, Object.assign({ abortSignal: options.abortSignal, metadata: options.metadata, leaseAccessConditions: options.leaseAccessConditions, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, copyFileSmbInfo: options.copyFileSmbInfo }, convertTracingToRequestOptionsBase(updatedOptions)));
14221
+ return await this.context.startCopy(copySource, Object.assign(Object.assign({ abortSignal: options.abortSignal, metadata: options.metadata, leaseAccessConditions: options.leaseAccessConditions, filePermission: options.filePermission, filePermissionKey: options.filePermissionKey, copyFileSmbInfo: options.copyFileSmbInfo }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
14102
14222
  }
14103
14223
  catch (e) {
14104
14224
  span.setStatus({
@@ -14122,7 +14242,7 @@ class ShareFileClient extends StorageClient {
14122
14242
  async abortCopyFromURL(copyId, options = {}) {
14123
14243
  const { span, updatedOptions } = createSpan("ShareFileClient-abortCopyFromURL", options);
14124
14244
  try {
14125
- return await this.context.abortCopy(copyId, Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, convertTracingToRequestOptionsBase(updatedOptions)));
14245
+ return await this.context.abortCopy(copyId, Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
14126
14246
  }
14127
14247
  catch (e) {
14128
14248
  span.setStatus({
@@ -14559,7 +14679,7 @@ class ShareFileClient extends StorageClient {
14559
14679
  const { span, updatedOptions } = createSpan("ShareFileClient-listHandlesSegment", options);
14560
14680
  try {
14561
14681
  marker = marker === "" ? undefined : marker;
14562
- const response = await this.context.listHandles(Object.assign(Object.assign({ abortSignal: options.abortSignal, marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
14682
+ const response = await this.context.listHandles(Object.assign(Object.assign(Object.assign({ abortSignal: options.abortSignal, marker }, options), convertTracingToRequestOptionsBase(updatedOptions)), this.shareClientConfig));
14563
14683
  // TODO: Protocol layer issue that when handle list is in returned XML
14564
14684
  // response.handleList is an empty string
14565
14685
  if (response.handleList === "") {
@@ -14678,7 +14798,7 @@ class ShareFileClient extends StorageClient {
14678
14798
  const { span, updatedOptions } = createSpan("ShareFileClient-forceCloseHandlesSegment", options);
14679
14799
  try {
14680
14800
  marker = marker === "" ? undefined : marker;
14681
- const rawResponse = await this.context.forceCloseHandles("*", Object.assign({ abortSignal: options.abortSignal, marker }, convertTracingToRequestOptionsBase(updatedOptions)));
14801
+ const rawResponse = await this.context.forceCloseHandles("*", Object.assign(Object.assign({ abortSignal: options.abortSignal, marker }, this.shareClientConfig), convertTracingToRequestOptionsBase(updatedOptions)));
14682
14802
  const response = rawResponse;
14683
14803
  response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
14684
14804
  response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
@@ -14747,7 +14867,7 @@ class ShareFileClient extends StorageClient {
14747
14867
  if (handleId === "*") {
14748
14868
  throw new RangeError(`Parameter handleID should be a specified handle ID. Use forceCloseHandlesSegment() to close all handles.`);
14749
14869
  }
14750
- const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)));
14870
+ const rawResponse = await this.context.forceCloseHandles(handleId, Object.assign(Object.assign({ abortSignal: options.abortSignal }, convertTracingToRequestOptionsBase(updatedOptions)), this.shareClientConfig));
14751
14871
  const response = rawResponse;
14752
14872
  response.closedHandlesCount = rawResponse.numberOfHandlesClosed || 0;
14753
14873
  response.closeFailureCount = rawResponse.numberOfHandlesFailedToClose || 0;
@@ -14826,9 +14946,9 @@ class ShareFileClient extends StorageClient {
14826
14946
  else {
14827
14947
  throw new RangeError("Destination path should not contain more than one query string");
14828
14948
  }
14829
- const destFile = new ShareFileClient(destinationUrl, this.pipeline);
14949
+ const destFile = new ShareFileClient(destinationUrl, this.pipeline, this.shareClientConfig);
14830
14950
  try {
14831
- const response = await destFile.context.rename(this.url, Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
14951
+ const response = await destFile.context.rename(this.url, Object.assign(Object.assign(Object.assign({}, updatedOptions), { sourceLeaseAccessConditions: updatedOptions.sourceLeaseAccessConditions
14832
14952
  ? {
14833
14953
  sourceLeaseId: updatedOptions.sourceLeaseAccessConditions.leaseId,
14834
14954
  }
@@ -14840,7 +14960,7 @@ class ShareFileClient extends StorageClient {
14840
14960
  ? {
14841
14961
  fileContentType: options.contentType,
14842
14962
  }
14843
- : undefined }));
14963
+ : undefined }), this.shareClientConfig));
14844
14964
  return {
14845
14965
  destinationFileClient: destFile,
14846
14966
  fileRenameResponse: response,
@@ -15052,7 +15172,8 @@ class ShareServiceClient extends StorageClient {
15052
15172
  if (credentialOrPipeline instanceof Pipeline) {
15053
15173
  pipeline = credentialOrPipeline;
15054
15174
  }
15055
- else if (credentialOrPipeline instanceof Credential) {
15175
+ else if (credentialOrPipeline instanceof Credential ||
15176
+ coreHttp.isTokenCredential(credentialOrPipeline)) {
15056
15177
  pipeline = newPipeline(credentialOrPipeline, options);
15057
15178
  }
15058
15179
  else {
@@ -15060,6 +15181,7 @@ class ShareServiceClient extends StorageClient {
15060
15181
  pipeline = newPipeline(new AnonymousCredential(), options);
15061
15182
  }
15062
15183
  super(url, pipeline);
15184
+ this.shareClientConfig = options;
15063
15185
  this.serviceContext = new Service(this.storageClientContext);
15064
15186
  }
15065
15187
  /**
@@ -15084,7 +15206,7 @@ class ShareServiceClient extends StorageClient {
15084
15206
  if (coreHttp.isNode) {
15085
15207
  const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
15086
15208
  const pipeline = newPipeline(sharedKeyCredential, options);
15087
- return new ShareServiceClient(extractedCreds.url, pipeline);
15209
+ return new ShareServiceClient(extractedCreds.url, pipeline, options);
15088
15210
  }
15089
15211
  else {
15090
15212
  throw new Error("Account connection string is only supported in Node.js environment");
@@ -15092,7 +15214,7 @@ class ShareServiceClient extends StorageClient {
15092
15214
  }
15093
15215
  else if (extractedCreds.kind === "SASConnString") {
15094
15216
  const pipeline = newPipeline(new AnonymousCredential(), options);
15095
- return new ShareServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline);
15217
+ return new ShareServiceClient(extractedCreds.url + "?" + extractedCreds.accountSas, pipeline, options);
15096
15218
  }
15097
15219
  else {
15098
15220
  throw new Error("Connection string must be either an Account connection string or a SAS connection string");
@@ -15113,7 +15235,7 @@ class ShareServiceClient extends StorageClient {
15113
15235
  * ```
15114
15236
  */
15115
15237
  getShareClient(shareName) {
15116
- return new ShareClient(appendToURLPath(this.url, shareName), this.pipeline);
15238
+ return new ShareClient(appendToURLPath(this.url, shareName), this.pipeline, this.shareClientConfig);
15117
15239
  }
15118
15240
  /**
15119
15241
  * Creates a Share.
@@ -15479,6 +15601,14 @@ class ShareServiceClient extends StorageClient {
15479
15601
  }
15480
15602
  }
15481
15603
 
15604
+ // Copyright (c) Microsoft Corporation.
15605
+ // Licensed under the MIT license.
15606
+ /** Known values of {@link ShareTokenIntent} that the service accepts. */
15607
+ exports.KnownShareTokenIntent = void 0;
15608
+ (function (KnownShareTokenIntent) {
15609
+ KnownShareTokenIntent["Backup"] = "backup";
15610
+ })(exports.KnownShareTokenIntent || (exports.KnownShareTokenIntent = {}));
15611
+
15482
15612
  Object.defineProperty(exports, 'BaseRequestPolicy', {
15483
15613
  enumerable: true,
15484
15614
  get: function () { return coreHttp.BaseRequestPolicy; }