@azure/storage-file-share 12.8.0-beta.1 → 12.8.1-alpha.20211025.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 (40) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/dist/index.js +57 -31
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/Clients.js +30 -10
  5. package/dist-esm/src/Clients.js.map +1 -1
  6. package/dist-esm/src/Range.js.map +1 -1
  7. package/dist-esm/src/SASQueryParameters.js +1 -1
  8. package/dist-esm/src/SASQueryParameters.js.map +1 -1
  9. package/dist-esm/src/ShareClientInternal.js +1 -1
  10. package/dist-esm/src/ShareClientInternal.js.map +1 -1
  11. package/dist-esm/src/ShareSASPermissions.js.map +1 -1
  12. package/dist-esm/src/ShareServiceClient.js +8 -2
  13. package/dist-esm/src/ShareServiceClient.js.map +1 -1
  14. package/dist-esm/src/credentials/Credential.js +1 -5
  15. package/dist-esm/src/credentials/Credential.js.map +1 -1
  16. package/dist-esm/src/generated/src/storageClientContext.js +1 -1
  17. package/dist-esm/src/generated/src/storageClientContext.js.map +1 -1
  18. package/dist-esm/src/generatedModels.js.map +1 -1
  19. package/dist-esm/src/models.js.map +1 -1
  20. package/dist-esm/src/policies/AnonymousCredentialPolicy.js +2 -0
  21. package/dist-esm/src/policies/AnonymousCredentialPolicy.js.map +1 -1
  22. package/dist-esm/src/policies/StorageBrowserPolicy.js +2 -0
  23. package/dist-esm/src/policies/StorageBrowserPolicy.js.map +1 -1
  24. package/dist-esm/src/policies/StorageRetryPolicy.js +1 -1
  25. package/dist-esm/src/policies/StorageRetryPolicy.js.map +1 -1
  26. package/dist-esm/src/policies/StorageSharedKeyCredentialPolicy.js +1 -1
  27. package/dist-esm/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
  28. package/dist-esm/src/utils/RetriableReadableStream.js +2 -3
  29. package/dist-esm/src/utils/RetriableReadableStream.js.map +1 -1
  30. package/dist-esm/src/utils/constants.js +1 -1
  31. package/dist-esm/src/utils/constants.js.map +1 -1
  32. package/dist-esm/src/utils/tracing.js +1 -0
  33. package/dist-esm/src/utils/tracing.js.map +1 -1
  34. package/dist-esm/src/utils/utils.browser.js +12 -4
  35. package/dist-esm/src/utils/utils.browser.js.map +1 -1
  36. package/dist-esm/src/utils/utils.common.js +5 -30
  37. package/dist-esm/src/utils/utils.common.js.map +1 -1
  38. package/package.json +12 -13
  39. package/typings/3.1/storage-file-share.d.ts +16 -15
  40. package/typings/latest/storage-file-share.d.ts +28 -16
package/CHANGELOG.md CHANGED
@@ -1,6 +1,28 @@
1
1
  # Release History
2
2
 
3
- ## 12.8.0-beta.1 (2021-07-26)
3
+ ## 12.8.1 (Unreleased)
4
+
5
+ ### Features Added
6
+
7
+ ### Breaking Changes
8
+
9
+ ### Bugs Fixed
10
+
11
+ ### Other Changes
12
+
13
+ ## 12.8.0 (2021-09-10)
14
+
15
+ ### Features Added
16
+
17
+ - Includes all features released in 12.8.0-beta.1.
18
+
19
+ ## 12.7.0 (2021-08-02)
20
+
21
+ - Support for Node.js 8 and IE 11 has been dropped. Please see our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
22
+ - Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features
23
+ - Updated our internal core package dependencies to their latest versions in order to add support for Opentelemetry 1.0.0 which is compatible with the latest versions of our other client libraries.
24
+
25
+ ## 12.8.0-beta.1 (2021-07-28)
4
26
 
5
27
  ### Features Added
6
28
 
@@ -8,7 +30,6 @@
8
30
  - Added support for including additional information in `ShareDirectoryClient.listFilesAndDirectories()`.
9
31
  - Added support for OAuth in copying source in `ShareFileClient.uploadRangeFromURL()` when source is a Blob.
10
32
  - With the dropping of support for Node.js versions that are no longer in LTS, the dependency on `@types/node` has been updated to version 12. Read our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.
11
- - Changed TS compilation target to ES2017 in order to produce smaller bundles and use more native platform features
12
33
 
13
34
  ## 12.6.0 (2021-06-09)
14
35
 
package/dist/index.js CHANGED
@@ -311,7 +311,7 @@ function ipRangeToString(ipRange) {
311
311
 
312
312
  // Copyright (c) Microsoft Corporation.
313
313
  // Licensed under the MIT license.
314
- const SDK_VERSION = "12.8.0-beta.1";
314
+ const SDK_VERSION = "12.8.1";
315
315
  const SERVICE_VERSION = "2020-10-02";
316
316
  const FILE_MAX_SIZE_BYTES = 4 * 1024 * 1024 * 1024 * 1024; // 4TB
317
317
  const FILE_RANGE_MAX_SIZE_BYTES = 4 * 1024 * 1024; // 4MB
@@ -681,6 +681,7 @@ function truncatedISO8061Date(date, withMilliseconds = true) {
681
681
  */
682
682
  async function delay(timeInMs, aborter, abortError) {
683
683
  return new Promise((resolve, reject) => {
684
+ /* eslint-disable-next-line prefer-const */
684
685
  let timeout;
685
686
  const abortHandler = () => {
686
687
  if (timeout !== undefined) {
@@ -694,6 +695,7 @@ async function delay(timeInMs, aborter, abortError) {
694
695
  }
695
696
  resolve();
696
697
  };
698
+ /* eslint-disable-next-line prefer-const */
697
699
  timeout = setTimeout(resolveHandler, timeInMs);
698
700
  if (aborter !== undefined) {
699
701
  aborter.addEventListener("abort", abortHandler);
@@ -732,10 +734,10 @@ function getAccountNameFromUrl(url) {
732
734
  }
733
735
  }
734
736
  function isIpEndpointStyle(parsedUrl) {
735
- if (parsedUrl.getHost() == undefined) {
737
+ if (parsedUrl.getHost() === undefined) {
736
738
  return false;
737
739
  }
738
- const host = parsedUrl.getHost() + (parsedUrl.getPort() == undefined ? "" : ":" + parsedUrl.getPort());
740
+ const host = parsedUrl.getHost() + (parsedUrl.getPort() === undefined ? "" : ":" + parsedUrl.getPort());
739
741
  // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.
740
742
  // Case 2: localhost(:port), use broad regex to match port part.
741
743
  // Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
@@ -798,9 +800,7 @@ function getShareNameAndPathFromUrl(url) {
798
800
  }
799
801
  }
800
802
  function httpAuthorizationToString(httpAuthorization) {
801
- return httpAuthorization
802
- ? httpAuthorization.scheme + " " + httpAuthorization.parameter
803
- : undefined;
803
+ return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
804
804
  }
805
805
 
806
806
  // Copyright (c) Microsoft Corporation.
@@ -817,7 +817,7 @@ function httpAuthorizationToString(httpAuthorization) {
817
817
  /**
818
818
  * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly
819
819
  * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link FileSASSignatureValues}
820
- * types. Once generated, it can be encoded into a {@code String} and appended to a URL directly (though caution should
820
+ * types. Once generated, it can be encoded into a {@link String} and appended to a URL directly (though caution should
821
821
  * be taken here in case there are existing query parameters, which might affect the appropriate means of appending
822
822
  * these query parameters).
823
823
  *
@@ -9184,6 +9184,8 @@ class StorageBrowserPolicy extends coreHttp.BaseRequestPolicy {
9184
9184
  * @param nextPolicy -
9185
9185
  * @param options -
9186
9186
  */
9187
+ // The base class has a protected constructor. Adding a public one to enable constructing of this class.
9188
+ /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/
9187
9189
  constructor(nextPolicy, options) {
9188
9190
  super(nextPolicy, options);
9189
9191
  }
@@ -9311,7 +9313,7 @@ class StorageRetryPolicy extends coreHttp.BaseRequestPolicy {
9311
9313
  }
9312
9314
  }
9313
9315
  await this.delay(isPrimaryRetry, attempt, request.abortSignal);
9314
- return await this.attemptSendRequest(request, secondaryHas404, ++attempt);
9316
+ return this.attemptSendRequest(request, secondaryHas404, ++attempt);
9315
9317
  }
9316
9318
  /**
9317
9319
  * Decide whether to retry according to last HTTP response and retry counters.
@@ -9539,6 +9541,8 @@ class AnonymousCredentialPolicy extends CredentialPolicy {
9539
9541
  * @param nextPolicy -
9540
9542
  * @param options -
9541
9543
  */
9544
+ // The base class has a protected constructor. Adding a public one to enable constructing of this class.
9545
+ /* eslint-disable-next-line @typescript-eslint/no-useless-constructor*/
9542
9546
  constructor(nextPolicy, options) {
9543
9547
  super(nextPolicy, options);
9544
9548
  }
@@ -9557,11 +9561,7 @@ class Credential {
9557
9561
  * @param _nextPolicy -
9558
9562
  * @param _options -
9559
9563
  */
9560
- create(
9561
- // tslint:disable-next-line:variable-name
9562
- _nextPolicy,
9563
- // tslint:disable-next-line:variable-name
9564
- _options) {
9564
+ create(_nextPolicy, _options) {
9565
9565
  throw new Error("Method should be implemented in children classes.");
9566
9566
  }
9567
9567
  }
@@ -9777,7 +9777,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
9777
9777
  if (queries) {
9778
9778
  const queryKeys = [];
9779
9779
  for (const key in queries) {
9780
- if (queries.hasOwnProperty(key)) {
9780
+ if (Object.prototype.hasOwnProperty.call(queries, key)) {
9781
9781
  const lowercaseKey = key.toLowerCase();
9782
9782
  lowercaseQueries[lowercaseKey] = queries[key];
9783
9783
  queryKeys.push(lowercaseKey);
@@ -9849,6 +9849,7 @@ const createSpan = coreTracing.createSpanFunction({
9849
9849
  function convertTracingToRequestOptionsBase(options) {
9850
9850
  var _a, _b;
9851
9851
  return {
9852
+ // By passing spanOptions if they exist at runtime, we're backwards compatible with @azure/core-tracing@preview.13 and earlier.
9852
9853
  spanOptions: (_a = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _a === void 0 ? void 0 : _a.spanOptions,
9853
9854
  tracingContext: (_b = options === null || options === void 0 ? void 0 : options.tracingOptions) === null || _b === void 0 ? void 0 : _b.tracingContext
9854
9855
  };
@@ -9862,7 +9863,7 @@ function convertTracingToRequestOptionsBase(options) {
9862
9863
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
9863
9864
  */
9864
9865
  const packageName = "azure-storage-file-share";
9865
- const packageVersion = "12.7.0-beta.1";
9866
+ const packageVersion = "12.8.1";
9866
9867
  class StorageClientContext extends coreHttp.ServiceClient {
9867
9868
  /**
9868
9869
  * Initializes a new instance of the StorageClientContext class.
@@ -10160,15 +10161,14 @@ class RetriableReadableStream extends stream.Readable {
10160
10161
  this.setSourceDataHandler();
10161
10162
  this.setSourceEndHandler();
10162
10163
  this.setSourceErrorHandler();
10164
+ return;
10163
10165
  })
10164
10166
  .catch((error) => {
10165
10167
  this.emit("error", error);
10166
10168
  });
10167
10169
  }
10168
10170
  else {
10169
- this.emit("error", new Error(
10170
- // tslint:disable-next-line:max-line-length
10171
- `Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this
10171
+ this.emit("error", new Error(`Data corruption failure: received less data than required and reached maxRetires limitation. Received data offset: ${this
10172
10172
  .offset - 1}, data needed offset: ${this.end}, retries: ${this.retries}, max retries: ${this.maxRetryRequests}`));
10173
10173
  }
10174
10174
  }
@@ -11109,7 +11109,10 @@ const fsCreateReadStream = fs.createReadStream;
11109
11109
  * A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
11110
11110
  */
11111
11111
  class ShareClient extends StorageClient {
11112
- constructor(urlOrConnectionString, credentialOrPipelineOrShareName, options) {
11112
+ constructor(urlOrConnectionString, credentialOrPipelineOrShareName,
11113
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
11114
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
11115
+ options) {
11113
11116
  let pipeline;
11114
11117
  let url;
11115
11118
  if (credentialOrPipelineOrShareName instanceof Pipeline) {
@@ -11234,6 +11237,8 @@ class ShareClient extends StorageClient {
11234
11237
  * @param directoryName - A directory name
11235
11238
  * @returns The ShareDirectoryClient object for the given directory name.
11236
11239
  */
11240
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
11241
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
11237
11242
  getDirectoryClient(directoryName) {
11238
11243
  return new ShareDirectoryClient(appendToURLPath(this.url, encodeURIComponent(directoryName)), this.pipeline);
11239
11244
  }
@@ -11243,6 +11248,8 @@ class ShareClient extends StorageClient {
11243
11248
  *
11244
11249
  * @readonly A new ShareDirectoryClient object for the root directory.
11245
11250
  */
11251
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
11252
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
11246
11253
  get rootDirectoryClient() {
11247
11254
  return this.getDirectoryClient("");
11248
11255
  }
@@ -12071,6 +12078,8 @@ class ShareDirectoryClient extends StorageClient {
12071
12078
  * console.log("Updated file successfully!")
12072
12079
  * ```
12073
12080
  */
12081
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
12082
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
12074
12083
  getFileClient(fileName) {
12075
12084
  return new ShareFileClient(appendToURLPath(this.url, encodeURIComponent(fileName)), this.pipeline);
12076
12085
  }
@@ -12663,8 +12672,12 @@ class ShareDirectoryClient extends StorageClient {
12663
12672
  do {
12664
12673
  const response = await this.forceCloseHandlesSegment(marker, updatedOptions);
12665
12674
  marker = response.marker;
12666
- response.closedHandlesCount && (handlesClosed += response.closedHandlesCount);
12667
- response.closeFailureCount && (numberOfHandlesFailedToClose += response.closeFailureCount);
12675
+ if (response.closedHandlesCount) {
12676
+ handlesClosed += response.closedHandlesCount;
12677
+ }
12678
+ if (response.closeFailureCount) {
12679
+ numberOfHandlesFailedToClose += response.closeFailureCount;
12680
+ }
12668
12681
  } while (marker);
12669
12682
  return { closedHandlesCount: handlesClosed, closeFailureCount: numberOfHandlesFailedToClose };
12670
12683
  }
@@ -12717,7 +12730,10 @@ class ShareDirectoryClient extends StorageClient {
12717
12730
  * A ShareFileClient represents a URL to an Azure Storage file.
12718
12731
  */
12719
12732
  class ShareFileClient extends StorageClient {
12720
- constructor(url, credentialOrPipeline, options) {
12733
+ constructor(url, credentialOrPipeline,
12734
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
12735
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
12736
+ options) {
12721
12737
  let pipeline;
12722
12738
  if (credentialOrPipeline instanceof Pipeline) {
12723
12739
  pipeline = credentialOrPipeline;
@@ -12902,7 +12918,7 @@ class ShareFileClient extends StorageClient {
12902
12918
  throw new RangeError(`File download response doesn't contain valid content length header`);
12903
12919
  }
12904
12920
  return new FileDownloadResponse(res, async (start) => {
12905
- const updatedOptions = {
12921
+ const updatedDownloadOptions = {
12906
12922
  range: rangeToString({
12907
12923
  count: offset + res.contentLength - start,
12908
12924
  offset: start
@@ -12911,10 +12927,10 @@ class ShareFileClient extends StorageClient {
12911
12927
  // Debug purpose only
12912
12928
  // console.log(
12913
12929
  // `Read from internal stream, range: ${
12914
- // updatedOptions.range
12915
- // }, options: ${JSON.stringify(updatedOptions)}`
12930
+ // chunkDownloadOptions.range
12931
+ // }, options: ${JSON.stringify(chunkDownloadOptions)}`
12916
12932
  // );
12917
- const downloadRes = await this.context.download(Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, updatedOptions), convertTracingToRequestOptionsBase(updatedOptions)));
12933
+ const downloadRes = await this.context.download(Object.assign(Object.assign({ abortSignal: options.abortSignal, leaseAccessConditions: options.leaseAccessConditions }, updatedDownloadOptions), convertTracingToRequestOptionsBase(updatedDownloadOptions)));
12918
12934
  if (!(downloadRes.etag === res.etag)) {
12919
12935
  throw new Error("File has been modified concurrently");
12920
12936
  }
@@ -13974,8 +13990,12 @@ class ShareFileClient extends StorageClient {
13974
13990
  do {
13975
13991
  const response = await this.forceCloseHandlesSegment(marker, { tracingOptions: updatedOptions.tracingOptions });
13976
13992
  marker = response.marker;
13977
- response.closedHandlesCount && (handlesClosed += response.closedHandlesCount);
13978
- response.closeFailureCount && (numberOfHandlesFailedToClose += response.closeFailureCount);
13993
+ if (response.closedHandlesCount) {
13994
+ handlesClosed += response.closedHandlesCount;
13995
+ }
13996
+ if (response.closeFailureCount) {
13997
+ numberOfHandlesFailedToClose += response.closeFailureCount;
13998
+ }
13979
13999
  } while (marker);
13980
14000
  return {
13981
14001
  closedHandlesCount: handlesClosed,
@@ -14228,7 +14248,7 @@ class ShareClientInternal extends StorageClient {
14228
14248
  this.context = new Share(this.storageClientContext);
14229
14249
  }
14230
14250
  async restore(options = {}) {
14231
- return await this.context.restore(options);
14251
+ return this.context.restore(options);
14232
14252
  }
14233
14253
  }
14234
14254
 
@@ -14238,7 +14258,10 @@ class ShareClientInternal extends StorageClient {
14238
14258
  * to manipulate file shares.
14239
14259
  */
14240
14260
  class ShareServiceClient extends StorageClient {
14241
- constructor(url, credentialOrPipeline, options) {
14261
+ constructor(url, credentialOrPipeline,
14262
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
14263
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
14264
+ options) {
14242
14265
  let pipeline;
14243
14266
  if (credentialOrPipeline instanceof Pipeline) {
14244
14267
  pipeline = credentialOrPipeline;
@@ -14266,7 +14289,10 @@ class ShareServiceClient extends StorageClient {
14266
14289
  * @param options - Options to configure the HTTP pipeline.
14267
14290
  * @returns A new ShareServiceClient from the given connection string.
14268
14291
  */
14269
- static fromConnectionString(connectionString, options) {
14292
+ static fromConnectionString(connectionString,
14293
+ // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
14294
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
14295
+ options) {
14270
14296
  const extractedCreds = extractConnectionStringParts(connectionString);
14271
14297
  if (extractedCreds.kind === "AccountConnString") {
14272
14298
  {