@azure/storage-blob 12.23.0 → 12.24.0-beta.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 (34) hide show
  1. package/dist/index.js +199 -12
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/storage-blob/src/Clients.js +18 -0
  4. package/dist-esm/storage-blob/src/Clients.js.map +1 -1
  5. package/dist-esm/storage-blob/src/ContainerClient.js +18 -0
  6. package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
  7. package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
  8. package/dist-esm/storage-blob/src/generated/src/models/mappers.js +21 -0
  9. package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
  10. package/dist-esm/storage-blob/src/generated/src/models/parameters.js +1 -1
  11. package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
  12. package/dist-esm/storage-blob/src/generated/src/operations/blob.js +10 -2
  13. package/dist-esm/storage-blob/src/generated/src/operations/blob.js.map +1 -1
  14. package/dist-esm/storage-blob/src/generated/src/operations/container.js +10 -2
  15. package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
  16. package/dist-esm/storage-blob/src/generated/src/operations/service.js +10 -2
  17. package/dist-esm/storage-blob/src/generated/src/operations/service.js.map +1 -1
  18. package/dist-esm/storage-blob/src/generated/src/storageClient.js +2 -2
  19. package/dist-esm/storage-blob/src/generated/src/storageClient.js.map +1 -1
  20. package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
  21. package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +15 -0
  22. package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
  23. package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js +15 -0
  24. package/dist-esm/storage-blob/src/policies/StorageRetryPolicyV2.js.map +1 -1
  25. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js +2 -1
  26. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
  27. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js +2 -1
  28. package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicyV2.js.map +1 -1
  29. package/dist-esm/storage-blob/src/utils/SharedKeyComparator.js +73 -0
  30. package/dist-esm/storage-blob/src/utils/SharedKeyComparator.js.map +1 -0
  31. package/dist-esm/storage-blob/src/utils/constants.js +4 -1
  32. package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
  33. package/package.json +2 -2
  34. package/types/latest/storage-blob.d.ts +72 -6
package/dist/index.js CHANGED
@@ -91,7 +91,7 @@ class BaseRequestPolicy {
91
91
 
92
92
  // Copyright (c) Microsoft Corporation.
93
93
  // Licensed under the MIT license.
94
- const SDK_VERSION = "12.23.0";
94
+ const SDK_VERSION = "12.24.0-beta.1";
95
95
  const SERVICE_VERSION = "2024-05-04";
96
96
  const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
97
97
  const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
@@ -144,6 +144,7 @@ const HeaderConstants = {
144
144
  X_MS_DATE: "x-ms-date",
145
145
  X_MS_ERROR_CODE: "x-ms-error-code",
146
146
  X_MS_VERSION: "x-ms-version",
147
+ X_MS_CopySourceErrorCode: "x-ms-copy-source-error-code",
147
148
  };
148
149
  const ETagNone = "";
149
150
  const ETagAny = "*";
@@ -247,6 +248,8 @@ const StorageBlobLoggingAllowedHeaderNames = [
247
248
  "x-ms-source-if-unmodified-since",
248
249
  "x-ms-tag-count",
249
250
  "x-ms-encryption-key-sha256",
251
+ "x-ms-copy-source-error-code",
252
+ "x-ms-copy-source-status-code",
250
253
  "x-ms-if-tags",
251
254
  "x-ms-source-if-tags",
252
255
  ];
@@ -1189,6 +1192,21 @@ class StorageRetryPolicy extends BaseRequestPolicy {
1189
1192
  return true;
1190
1193
  }
1191
1194
  }
1195
+ // [Copy source error code] Feature is pending on service side, skip retry on copy source error for now.
1196
+ // if (response) {
1197
+ // // Retry select Copy Source Error Codes.
1198
+ // if (response?.status >= 400) {
1199
+ // const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);
1200
+ // if (copySourceError !== undefined) {
1201
+ // switch (copySourceError) {
1202
+ // case "InternalError":
1203
+ // case "OperationTimedOut":
1204
+ // case "ServerBusy":
1205
+ // return true;
1206
+ // }
1207
+ // }
1208
+ // }
1209
+ // }
1192
1210
  if ((err === null || err === void 0 ? void 0 : err.code) === "PARSE_ERROR" && (err === null || err === void 0 ? void 0 : err.message.startsWith(`Error "Error: Unclosed root tag`))) {
1193
1211
  logger.info("RetryPolicy: Incomplete XML response likely due to service timeout, will retry.");
1194
1212
  return true;
@@ -1274,6 +1292,79 @@ class CredentialPolicy extends BaseRequestPolicy {
1274
1292
  }
1275
1293
  }
1276
1294
 
1295
+ // Copyright (c) Microsoft Corporation.
1296
+ // Licensed under the MIT license.
1297
+ /*
1298
+ * We need to imitate .Net culture-aware sorting, which is used in storage service.
1299
+ * Below tables contain sort-keys for en-US culture.
1300
+ */
1301
+ const table_lv0 = new Uint32Array([
1302
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1303
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x71c, 0x0, 0x71f, 0x721,
1304
+ 0x723, 0x725, 0x0, 0x0, 0x0, 0x72d, 0x803, 0x0, 0x0, 0x733, 0x0, 0xd03, 0xd1a, 0xd1c, 0xd1e,
1305
+ 0xd20, 0xd22, 0xd24, 0xd26, 0xd28, 0xd2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe02, 0xe09, 0xe0a,
1306
+ 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70, 0xe7c, 0xe7e, 0xe89,
1307
+ 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x0, 0x0, 0x743, 0x744, 0x748,
1308
+ 0xe02, 0xe09, 0xe0a, 0xe1a, 0xe21, 0xe23, 0xe25, 0xe2c, 0xe32, 0xe35, 0xe36, 0xe48, 0xe51, 0xe70,
1309
+ 0xe7c, 0xe7e, 0xe89, 0xe8a, 0xe91, 0xe99, 0xe9f, 0xea2, 0xea4, 0xea6, 0xea7, 0xea9, 0x0, 0x74c,
1310
+ 0x0, 0x750, 0x0,
1311
+ ]);
1312
+ const table_lv2 = new Uint32Array([
1313
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1314
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1315
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1316
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
1317
+ 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12,
1318
+ 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1319
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1320
+ ]);
1321
+ const table_lv4 = new Uint32Array([
1322
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1323
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1324
+ 0x0, 0x8012, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8212, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1325
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1326
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1327
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1328
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1329
+ ]);
1330
+ function compareHeader(lhs, rhs) {
1331
+ if (isLessThan(lhs, rhs))
1332
+ return -1;
1333
+ return 1;
1334
+ }
1335
+ function isLessThan(lhs, rhs) {
1336
+ const tables = [table_lv0, table_lv2, table_lv4];
1337
+ let curr_level = 0;
1338
+ let i = 0;
1339
+ let j = 0;
1340
+ while (curr_level < tables.length) {
1341
+ if (curr_level === tables.length - 1 && i !== j) {
1342
+ return i > j;
1343
+ }
1344
+ const weight1 = i < lhs.length ? tables[curr_level][lhs[i].charCodeAt(0)] : 0x1;
1345
+ const weight2 = j < rhs.length ? tables[curr_level][rhs[j].charCodeAt(0)] : 0x1;
1346
+ if (weight1 === 0x1 && weight2 === 0x1) {
1347
+ i = 0;
1348
+ j = 0;
1349
+ ++curr_level;
1350
+ }
1351
+ else if (weight1 === weight2) {
1352
+ ++i;
1353
+ ++j;
1354
+ }
1355
+ else if (weight1 === 0) {
1356
+ ++i;
1357
+ }
1358
+ else if (weight2 === 0) {
1359
+ ++j;
1360
+ }
1361
+ else {
1362
+ return weight1 < weight2;
1363
+ }
1364
+ }
1365
+ return false;
1366
+ }
1367
+
1277
1368
  // Copyright (c) Microsoft Corporation.
1278
1369
  // Licensed under the MIT license.
1279
1370
  /**
@@ -1365,7 +1456,7 @@ class StorageSharedKeyCredentialPolicy extends CredentialPolicy {
1365
1456
  return value.name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE);
1366
1457
  });
1367
1458
  headersArray.sort((a, b) => {
1368
- return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
1459
+ return compareHeader(a.name.toLowerCase(), b.name.toLowerCase());
1369
1460
  });
1370
1461
  // Remove duplicate headers
1371
1462
  headersArray = headersArray.filter((value, index, array) => {
@@ -1631,6 +1722,21 @@ function storageRetryPolicy(options = {}) {
1631
1722
  return true;
1632
1723
  }
1633
1724
  }
1725
+ // [Copy source error code] Feature is pending on service side, skip retry on copy source error for now.
1726
+ // if (response) {
1727
+ // // Retry select Copy Source Error Codes.
1728
+ // if (response?.status >= 400) {
1729
+ // const copySourceError = response.headers.get(HeaderConstants.X_MS_CopySourceErrorCode);
1730
+ // if (copySourceError !== undefined) {
1731
+ // switch (copySourceError) {
1732
+ // case "InternalError":
1733
+ // case "OperationTimedOut":
1734
+ // case "ServerBusy":
1735
+ // return true;
1736
+ // }
1737
+ // }
1738
+ // }
1739
+ // }
1634
1740
  return false;
1635
1741
  }
1636
1742
  function calculateDelay(isPrimaryRetry, attempt) {
@@ -1782,7 +1888,7 @@ function storageSharedKeyCredentialPolicy(options) {
1782
1888
  }
1783
1889
  }
1784
1890
  headersArray.sort((a, b) => {
1785
- return a.name.toLowerCase().localeCompare(b.name.toLowerCase());
1891
+ return compareHeader(a.name.toLowerCase(), b.name.toLowerCase());
1786
1892
  });
1787
1893
  // Remove duplicate headers
1788
1894
  headersArray = headersArray.filter((value, index, array) => {
@@ -2434,6 +2540,13 @@ const StorageError = {
2434
2540
  name: "String",
2435
2541
  },
2436
2542
  },
2543
+ authenticationErrorDetail: {
2544
+ serializedName: "AuthenticationErrorDetail",
2545
+ xmlName: "AuthenticationErrorDetail",
2546
+ type: {
2547
+ name: "String",
2548
+ },
2549
+ },
2437
2550
  },
2438
2551
  },
2439
2552
  };
@@ -5878,6 +5991,13 @@ const ContainerGetAccountInfoHeaders = {
5878
5991
  ],
5879
5992
  },
5880
5993
  },
5994
+ isHierarchicalNamespaceEnabled: {
5995
+ serializedName: "x-ms-is-hns-enabled",
5996
+ xmlName: "x-ms-is-hns-enabled",
5997
+ type: {
5998
+ name: "Boolean",
5999
+ },
6000
+ },
5881
6001
  },
5882
6002
  },
5883
6003
  };
@@ -8042,6 +8162,13 @@ const BlobGetAccountInfoHeaders = {
8042
8162
  ],
8043
8163
  },
8044
8164
  },
8165
+ isHierarchicalNamespaceEnabled: {
8166
+ serializedName: "x-ms-is-hns-enabled",
8167
+ xmlName: "x-ms-is-hns-enabled",
8168
+ type: {
8169
+ name: "Boolean",
8170
+ },
8171
+ },
8045
8172
  },
8046
8173
  },
8047
8174
  };
@@ -10600,7 +10727,7 @@ const timeoutInSeconds = {
10600
10727
  const version = {
10601
10728
  parameterPath: "version",
10602
10729
  mapper: {
10603
- defaultValue: "2024-05-04",
10730
+ defaultValue: "2024-08-04",
10604
10731
  isConstant: true,
10605
10732
  serializedName: "x-ms-version",
10606
10733
  type: {
@@ -12371,9 +12498,17 @@ const getAccountInfoOperationSpec$2 = {
12371
12498
  headersMapper: ServiceGetAccountInfoExceptionHeaders,
12372
12499
  },
12373
12500
  },
12374
- queryParameters: [comp, restype1],
12501
+ queryParameters: [
12502
+ comp,
12503
+ timeoutInSeconds,
12504
+ restype1,
12505
+ ],
12375
12506
  urlParameters: [url],
12376
- headerParameters: [version, accept1],
12507
+ headerParameters: [
12508
+ version,
12509
+ requestId,
12510
+ accept1,
12511
+ ],
12377
12512
  isXML: true,
12378
12513
  serializer: xmlSerializer$5,
12379
12514
  };
@@ -13133,9 +13268,17 @@ const getAccountInfoOperationSpec$1 = {
13133
13268
  headersMapper: ContainerGetAccountInfoExceptionHeaders,
13134
13269
  },
13135
13270
  },
13136
- queryParameters: [comp, restype1],
13271
+ queryParameters: [
13272
+ comp,
13273
+ timeoutInSeconds,
13274
+ restype1,
13275
+ ],
13137
13276
  urlParameters: [url],
13138
- headerParameters: [version, accept1],
13277
+ headerParameters: [
13278
+ version,
13279
+ requestId,
13280
+ accept1,
13281
+ ],
13139
13282
  isXML: true,
13140
13283
  serializer: xmlSerializer$4,
13141
13284
  };
@@ -14013,9 +14156,17 @@ const getAccountInfoOperationSpec = {
14013
14156
  headersMapper: BlobGetAccountInfoExceptionHeaders,
14014
14157
  },
14015
14158
  },
14016
- queryParameters: [comp, restype1],
14159
+ queryParameters: [
14160
+ comp,
14161
+ timeoutInSeconds,
14162
+ restype1,
14163
+ ],
14017
14164
  urlParameters: [url],
14018
- headerParameters: [version, accept1],
14165
+ headerParameters: [
14166
+ version,
14167
+ requestId,
14168
+ accept1,
14169
+ ],
14019
14170
  isXML: true,
14020
14171
  serializer: xmlSerializer$3,
14021
14172
  };
@@ -15193,7 +15344,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
15193
15344
  const defaults = {
15194
15345
  requestContentType: "application/json; charset=utf-8",
15195
15346
  };
15196
- const packageDetails = `azsdk-js-azure-storage-blob/12.23.0`;
15347
+ const packageDetails = `azsdk-js-azure-storage-blob/12.24.0-beta.1`;
15197
15348
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
15198
15349
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
15199
15350
  : `${packageDetails}`;
@@ -15204,7 +15355,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
15204
15355
  // Parameter assignments
15205
15356
  this.url = url;
15206
15357
  // Assigning values to Constant parameters
15207
- this.version = options.version || "2023-11-03";
15358
+ this.version = options.version || "2024-08-04";
15208
15359
  this.service = new ServiceImpl(this);
15209
15360
  this.container = new ContainerImpl(this);
15210
15361
  this.blob = new BlobImpl(this);
@@ -20144,6 +20295,24 @@ class BlobClient extends StorageClient {
20144
20295
  }));
20145
20296
  });
20146
20297
  }
20298
+ /**
20299
+ * The Get Account Information operation returns the sku name and account kind
20300
+ * for the specified account.
20301
+ * The Get Account Information operation is available on service versions beginning
20302
+ * with version 2018-03-28.
20303
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information
20304
+ *
20305
+ * @param options - Options to the Service Get Account Info operation.
20306
+ * @returns Response data for the Service Get Account Info operation.
20307
+ */
20308
+ async getAccountInfo(options = {}) {
20309
+ return tracingClient.withSpan("BlobClient-getAccountInfo", options, async (updatedOptions) => {
20310
+ return assertResponse(await this.blobContext.getAccountInfo({
20311
+ abortSignal: options.abortSignal,
20312
+ tracingOptions: updatedOptions.tracingOptions,
20313
+ }));
20314
+ });
20315
+ }
20147
20316
  }
20148
20317
  /**
20149
20318
  * AppendBlobClient defines a set of operations applicable to append blobs.
@@ -23358,6 +23527,24 @@ class ContainerClient extends StorageClient {
23358
23527
  },
23359
23528
  };
23360
23529
  }
23530
+ /**
23531
+ * The Get Account Information operation returns the sku name and account kind
23532
+ * for the specified account.
23533
+ * The Get Account Information operation is available on service versions beginning
23534
+ * with version 2018-03-28.
23535
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-account-information
23536
+ *
23537
+ * @param options - Options to the Service Get Account Info operation.
23538
+ * @returns Response data for the Service Get Account Info operation.
23539
+ */
23540
+ async getAccountInfo(options = {}) {
23541
+ return tracingClient.withSpan("ContainerClient-getAccountInfo", options, async (updatedOptions) => {
23542
+ return assertResponse(await this.containerContext.getAccountInfo({
23543
+ abortSignal: options.abortSignal,
23544
+ tracingOptions: updatedOptions.tracingOptions,
23545
+ }));
23546
+ });
23547
+ }
23361
23548
  getContainerNameFromUrl() {
23362
23549
  let containerName;
23363
23550
  try {