@azure/storage-file-datalake 12.12.0 → 12.13.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.
package/dist/index.js CHANGED
@@ -123,8 +123,8 @@ class AnonymousCredential extends Credential {
123
123
 
124
124
  // Copyright (c) Microsoft Corporation.
125
125
  // Licensed under the MIT license.
126
- const SDK_VERSION = "12.12.0";
127
- const SERVICE_VERSION = "2021-12-02";
126
+ const SDK_VERSION = "12.13.0";
127
+ const SERVICE_VERSION = "2022-11-02";
128
128
  const KB = 1024;
129
129
  const MB = KB * 1024;
130
130
  const DEFAULT_HIGH_LEVEL_CONCURRENCY = 5;
@@ -766,6 +766,7 @@ function isIpEndpointStyle(parsedUrl) {
766
766
  return (/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) ||
767
767
  (parsedUrl.getPort() !== undefined && PathStylePorts.includes(parsedUrl.getPort())));
768
768
  }
769
+ const BugTimeBeginningInMS = 13322188800000;
769
770
  /**
770
771
  * This is to convert a Windows File Time ticks to a Date object.
771
772
  */
@@ -779,7 +780,14 @@ function windowsFileTimeTicksToTime(timeNumber) {
779
780
  // since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC).
780
781
  // Date accepts a value that represents miliseconds from 12:00 A.M. January 1, 1970
781
782
  // Here should correct the year number after converting.
782
- const date = new Date(timeNumberInternal / 10000);
783
+ const timeNumerInMs = timeNumberInternal / 10000;
784
+ const date = new Date(timeNumerInMs);
785
+ // When initializing date from a miliseconds number the day after 2023-03-01 is still 2023-03-01.
786
+ // For example, 13322188799999 is 2023-03-01T23:59:59.999Z, while 13322188800000 is 2023-03-01T00:00:00.000Z
787
+ // Here is to work around the bug.
788
+ if (timeNumerInMs >= BugTimeBeginningInMS) {
789
+ date.setUTCDate(date.getUTCDate() + 1);
790
+ }
783
791
  date.setUTCFullYear(date.getUTCFullYear() - 369);
784
792
  return date;
785
793
  }
@@ -801,6 +809,22 @@ function EscapePath(pathName) {
801
809
  }
802
810
  return split.join("/");
803
811
  }
812
+ /**
813
+ * Parse value of encryption context from headers in raw response.
814
+ */
815
+ function ParseEncryptionContextHeaderValue(rawResponse) {
816
+ const response = rawResponse;
817
+ if (rawResponse._response) {
818
+ const headers = rawResponse._response.headers;
819
+ if (headers) {
820
+ response.encryptionContext = headers.get("x-ms-encryption-context");
821
+ if (response._response.parsedHeaders) {
822
+ response._response.parsedHeaders.encryptionContext = response.encryptionContext;
823
+ }
824
+ }
825
+ }
826
+ return response;
827
+ }
804
828
 
805
829
  /**
806
830
  * StorageSharedKeyCredentialPolicy is a policy used to sign HTTP request with a shared key.
@@ -1311,6 +1335,13 @@ const Path$1 = {
1311
1335
  type: {
1312
1336
  name: "String"
1313
1337
  }
1338
+ },
1339
+ encryptionContext: {
1340
+ serializedName: "EncryptionContext",
1341
+ xmlName: "EncryptionContext",
1342
+ type: {
1343
+ name: "String"
1344
+ }
1314
1345
  }
1315
1346
  }
1316
1347
  }
@@ -3674,7 +3705,7 @@ const timeout = {
3674
3705
  const version = {
3675
3706
  parameterPath: "version",
3676
3707
  mapper: {
3677
- defaultValue: "2021-12-02",
3708
+ defaultValue: "2022-11-02",
3678
3709
  isConstant: true,
3679
3710
  serializedName: "x-ms-version",
3680
3711
  type: {
@@ -4144,6 +4175,16 @@ const expiresOn = {
4144
4175
  }
4145
4176
  }
4146
4177
  };
4178
+ const encryptionContext = {
4179
+ parameterPath: ["options", "encryptionContext"],
4180
+ mapper: {
4181
+ serializedName: "x-ms-encryption-context",
4182
+ xmlName: "x-ms-encryption-context",
4183
+ type: {
4184
+ name: "String"
4185
+ }
4186
+ }
4187
+ };
4147
4188
  const contentType1 = {
4148
4189
  parameterPath: ["options", "contentType"],
4149
4190
  mapper: {
@@ -4992,7 +5033,8 @@ const createOperationSpec = {
4992
5033
  proposedLeaseId,
4993
5034
  leaseDuration,
4994
5035
  expiryOptions,
4995
- expiresOn
5036
+ expiresOn,
5037
+ encryptionContext
4996
5038
  ],
4997
5039
  serializer
4998
5040
  };
@@ -5839,7 +5881,7 @@ function attachCredential(thing, credential) {
5839
5881
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
5840
5882
  */
5841
5883
  const packageName = "azure-storage-datalake";
5842
- const packageVersion = "12.12.0";
5884
+ const packageVersion = "12.13.0";
5843
5885
  class StorageClientContext extends coreHttp__namespace.ServiceClient {
5844
5886
  /**
5845
5887
  * Initializes a new instance of the StorageClientContext class.
@@ -5865,7 +5907,7 @@ class StorageClientContext extends coreHttp__namespace.ServiceClient {
5865
5907
  // Parameter assignments
5866
5908
  this.url = url;
5867
5909
  // Assigning values to Constant parameters
5868
- this.version = options.version || "2021-12-02";
5910
+ this.version = options.version || "2022-11-02";
5869
5911
  this.resource = options.resource || "filesystem";
5870
5912
  }
5871
5913
  }
@@ -8527,7 +8569,8 @@ class DataLakePathClient extends StorageClient {
8527
8569
  async getProperties(options = {}) {
8528
8570
  const { span, updatedOptions } = createSpan("DataLakePathClient-getProperties", options);
8529
8571
  try {
8530
- return await this.blobClient.getProperties(Object.assign(Object.assign({}, options), { customerProvidedKey: toBlobCpkInfo(options.customerProvidedKey), tracingOptions: updatedOptions.tracingOptions }));
8572
+ const response = (await this.blobClient.getProperties(Object.assign(Object.assign({}, options), { customerProvidedKey: toBlobCpkInfo(options.customerProvidedKey), tracingOptions: updatedOptions.tracingOptions })));
8573
+ return ParseEncryptionContextHeaderValue(response);
8531
8574
  }
8532
8575
  catch (e) {
8533
8576
  span.setStatus({
@@ -8871,7 +8914,7 @@ class DataLakeFileClient extends DataLakePathClient {
8871
8914
  const { span, updatedOptions } = createSpan("DataLakeFileClient-read", options);
8872
8915
  try {
8873
8916
  const rawResponse = await this.blockBlobClientInternal.download(offset, count, Object.assign(Object.assign({}, updatedOptions), { customerProvidedKey: toBlobCpkInfo(updatedOptions.customerProvidedKey) }));
8874
- const response = rawResponse;
8917
+ const response = ParseEncryptionContextHeaderValue(rawResponse);
8875
8918
  if (!coreHttp.isNode && !response.contentAsBlob) {
8876
8919
  response.contentAsBlob = rawResponse.blobBody;
8877
8920
  }
@@ -9047,6 +9090,7 @@ class DataLakeFileClient extends DataLakePathClient {
9047
9090
  pathHttpHeaders: options.pathHttpHeaders,
9048
9091
  customerProvidedKey: updatedOptions.customerProvidedKey,
9049
9092
  tracingOptions: updatedOptions.tracingOptions,
9093
+ encryptionContext: updatedOptions.encryptionContext,
9050
9094
  });
9051
9095
  // append() with empty data would return error, so do not continue
9052
9096
  if (size === 0) {
@@ -9171,6 +9215,7 @@ class DataLakeFileClient extends DataLakePathClient {
9171
9215
  pathHttpHeaders: options.pathHttpHeaders,
9172
9216
  customerProvidedKey: options.customerProvidedKey,
9173
9217
  tracingOptions: updatedOptions.tracingOptions,
9218
+ encryptionContext: updatedOptions.encryptionContext,
9174
9219
  });
9175
9220
  // After the File is Create, Lease ID is the only valid request parameter.
9176
9221
  options.conditions = { leaseId: (_a = options.conditions) === null || _a === void 0 ? void 0 : _a.leaseId };