@azure/storage-blob 12.9.0-beta.1 → 12.9.0-beta.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History
2
2
 
3
+ ## 12.9.0-beta.2 (2021-12-03)
4
+
5
+ ### Features Added
6
+
7
+ - Added support for service version 2021-02-12
8
+ - Added support for listing system containers with `BlobServiceClient.listContainers()`.
9
+ - Added support for blob names container invalid XML characters.
10
+
3
11
  ## 12.9.0-beta.1 (2021-11-09)
4
12
 
5
13
  ### Features Added
package/dist/index.js CHANGED
@@ -970,10 +970,10 @@ const BlobItemInternal = {
970
970
  modelProperties: {
971
971
  name: {
972
972
  serializedName: "Name",
973
- required: true,
974
973
  xmlName: "Name",
975
974
  type: {
976
- name: "String"
975
+ name: "Composite",
976
+ className: "BlobName"
977
977
  }
978
978
  },
979
979
  deleted: {
@@ -1048,6 +1048,30 @@ const BlobItemInternal = {
1048
1048
  }
1049
1049
  }
1050
1050
  };
1051
+ const BlobName = {
1052
+ serializedName: "BlobName",
1053
+ type: {
1054
+ name: "Composite",
1055
+ className: "BlobName",
1056
+ modelProperties: {
1057
+ encoded: {
1058
+ serializedName: "Encoded",
1059
+ xmlName: "Encoded",
1060
+ xmlIsAttribute: true,
1061
+ type: {
1062
+ name: "Boolean"
1063
+ }
1064
+ },
1065
+ content: {
1066
+ serializedName: "content",
1067
+ xmlName: "content",
1068
+ type: {
1069
+ name: "String"
1070
+ }
1071
+ }
1072
+ }
1073
+ }
1074
+ };
1051
1075
  const BlobPropertiesInternal = {
1052
1076
  serializedName: "BlobPropertiesInternal",
1053
1077
  xmlName: "Properties",
@@ -1491,10 +1515,10 @@ const BlobPrefix = {
1491
1515
  modelProperties: {
1492
1516
  name: {
1493
1517
  serializedName: "Name",
1494
- required: true,
1495
1518
  xmlName: "Name",
1496
1519
  type: {
1497
- name: "String"
1520
+ name: "Composite",
1521
+ className: "BlobName"
1498
1522
  }
1499
1523
  }
1500
1524
  }
@@ -8149,6 +8173,7 @@ var Mappers = /*#__PURE__*/Object.freeze({
8149
8173
  ListBlobsFlatSegmentResponse: ListBlobsFlatSegmentResponse,
8150
8174
  BlobFlatListSegment: BlobFlatListSegment,
8151
8175
  BlobItemInternal: BlobItemInternal,
8176
+ BlobName: BlobName,
8152
8177
  BlobPropertiesInternal: BlobPropertiesInternal,
8153
8178
  ListBlobsHierarchySegmentResponse: ListBlobsHierarchySegmentResponse,
8154
8179
  BlobHierarchyListSegment: BlobHierarchyListSegment,
@@ -8387,7 +8412,7 @@ const timeoutInSeconds = {
8387
8412
  const version = {
8388
8413
  parameterPath: "version",
8389
8414
  mapper: {
8390
- defaultValue: "2020-12-06",
8415
+ defaultValue: "2021-02-12",
8391
8416
  isConstant: true,
8392
8417
  serializedName: "x-ms-version",
8393
8418
  type: {
@@ -8482,7 +8507,7 @@ const include = {
8482
8507
  element: {
8483
8508
  type: {
8484
8509
  name: "Enum",
8485
- allowedValues: ["metadata", "deleted"]
8510
+ allowedValues: ["metadata", "deleted", "system"]
8486
8511
  }
8487
8512
  }
8488
8513
  }
@@ -13158,8 +13183,8 @@ const logger = logger$1.createClientLogger("storage-blob");
13158
13183
 
13159
13184
  // Copyright (c) Microsoft Corporation.
13160
13185
  // Licensed under the MIT license.
13161
- const SDK_VERSION = "12.9.0-beta.1";
13162
- const SERVICE_VERSION = "2020-12-06";
13186
+ const SDK_VERSION = "12.9.0-beta.2";
13187
+ const SERVICE_VERSION = "2021-02-12";
13163
13188
  const BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES = 256 * 1024 * 1024; // 256MB
13164
13189
  const BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES = 4000 * 1024 * 1024; // 4000MB
13165
13190
  const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -13947,6 +13972,194 @@ function attachCredential(thing, credential) {
13947
13972
  function httpAuthorizationToString(httpAuthorization) {
13948
13973
  return httpAuthorization ? httpAuthorization.scheme + " " + httpAuthorization.value : undefined;
13949
13974
  }
13975
+ function BlobNameToString(name) {
13976
+ if (name.encoded) {
13977
+ return decodeURIComponent(name.content);
13978
+ }
13979
+ else {
13980
+ return name.content;
13981
+ }
13982
+ }
13983
+ function ConvertInternalResponseOfListBlobFlat(internalResponse) {
13984
+ return Object.assign(Object.assign({}, internalResponse), { segment: {
13985
+ blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
13986
+ const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
13987
+ return blobItem;
13988
+ })
13989
+ } });
13990
+ }
13991
+ function ConvertInternalResponseOfListBlobHierarchy(internalResponse) {
13992
+ var _a;
13993
+ return Object.assign(Object.assign({}, internalResponse), { segment: {
13994
+ blobPrefixes: (_a = internalResponse.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
13995
+ const blobPrefix = {
13996
+ name: BlobNameToString(blobPrefixInternal.name)
13997
+ };
13998
+ return blobPrefix;
13999
+ }),
14000
+ blobItems: internalResponse.segment.blobItems.map((blobItemInteral) => {
14001
+ const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name) });
14002
+ return blobItem;
14003
+ })
14004
+ } });
14005
+ }
14006
+ function decodeBase64String(value) {
14007
+ {
14008
+ return Buffer.from(value, "base64");
14009
+ }
14010
+ }
14011
+ function ParseBoolean(content) {
14012
+ if (content === undefined)
14013
+ return undefined;
14014
+ if (content === "true")
14015
+ return true;
14016
+ if (content === "false")
14017
+ return false;
14018
+ return undefined;
14019
+ }
14020
+ function ParseBlobName(blobNameInXML) {
14021
+ if (blobNameInXML["$"] !== undefined && blobNameInXML["#"] !== undefined) {
14022
+ return {
14023
+ encoded: ParseBoolean(blobNameInXML["$"]["Encoded"]),
14024
+ content: blobNameInXML["#"]
14025
+ };
14026
+ }
14027
+ else {
14028
+ return {
14029
+ encoded: false,
14030
+ content: blobNameInXML
14031
+ };
14032
+ }
14033
+ }
14034
+ function ParseBlobItem(blobInXML) {
14035
+ const blobPropertiesInXML = blobInXML["Properties"];
14036
+ const blobProperties = {
14037
+ createdOn: new Date(blobPropertiesInXML["Creation-Time"]),
14038
+ lastModified: new Date(blobPropertiesInXML["Last-Modified"]),
14039
+ etag: blobPropertiesInXML["Etag"],
14040
+ contentLength: blobPropertiesInXML["Content-Length"] === undefined
14041
+ ? undefined
14042
+ : parseFloat(blobPropertiesInXML["Content-Length"]),
14043
+ contentType: blobPropertiesInXML["Content-Type"],
14044
+ contentEncoding: blobPropertiesInXML["Content-Encoding"],
14045
+ contentLanguage: blobPropertiesInXML["Content-Language"],
14046
+ contentMD5: decodeBase64String(blobPropertiesInXML["Content-MD5"]),
14047
+ contentDisposition: blobPropertiesInXML["Content-Disposition"],
14048
+ cacheControl: blobPropertiesInXML["Cache-Control"],
14049
+ blobSequenceNumber: blobPropertiesInXML["x-ms-blob-sequence-number"] === undefined
14050
+ ? undefined
14051
+ : parseFloat(blobPropertiesInXML["x-ms-blob-sequence-number"]),
14052
+ blobType: blobPropertiesInXML["BlobType"],
14053
+ leaseStatus: blobPropertiesInXML["LeaseStatus"],
14054
+ leaseState: blobPropertiesInXML["LeaseState"],
14055
+ leaseDuration: blobPropertiesInXML["LeaseDuration"],
14056
+ copyId: blobPropertiesInXML["CopyId"],
14057
+ copyStatus: blobPropertiesInXML["CopyStatus"],
14058
+ copySource: blobPropertiesInXML["CopySource"],
14059
+ copyProgress: blobPropertiesInXML["CopyProgress"],
14060
+ copyCompletedOn: blobPropertiesInXML["CopyCompletionTime"] === undefined
14061
+ ? undefined
14062
+ : new Date(blobPropertiesInXML["CopyCompletionTime"]),
14063
+ copyStatusDescription: blobPropertiesInXML["CopyStatusDescription"],
14064
+ serverEncrypted: ParseBoolean(blobPropertiesInXML["ServerEncrypted"]),
14065
+ incrementalCopy: ParseBoolean(blobPropertiesInXML["IncrementalCopy"]),
14066
+ destinationSnapshot: blobPropertiesInXML["DestinationSnapshot"],
14067
+ deletedOn: blobPropertiesInXML["DeletedTime"] === undefined
14068
+ ? undefined
14069
+ : new Date(blobPropertiesInXML["DeletedTime"]),
14070
+ remainingRetentionDays: blobPropertiesInXML["RemainingRetentionDays"] === undefined
14071
+ ? undefined
14072
+ : parseFloat(blobPropertiesInXML["RemainingRetentionDays"]),
14073
+ accessTier: blobPropertiesInXML["AccessTier"],
14074
+ accessTierInferred: ParseBoolean(blobPropertiesInXML["AccessTierInferred"]),
14075
+ archiveStatus: blobPropertiesInXML["ArchiveStatus"],
14076
+ customerProvidedKeySha256: blobPropertiesInXML["CustomerProvidedKeySha256"],
14077
+ encryptionScope: blobPropertiesInXML["EncryptionScope"],
14078
+ accessTierChangedOn: blobPropertiesInXML["AccessTierChangeTime"] === undefined
14079
+ ? undefined
14080
+ : new Date(blobPropertiesInXML["AccessTierChangeTime"]),
14081
+ tagCount: blobPropertiesInXML["TagCount"] === undefined
14082
+ ? undefined
14083
+ : parseFloat(blobPropertiesInXML["TagCount"]),
14084
+ expiresOn: blobPropertiesInXML["Expiry-Time"] === undefined
14085
+ ? undefined
14086
+ : new Date(blobPropertiesInXML["Expiry-Time"]),
14087
+ isSealed: ParseBoolean(blobPropertiesInXML["Sealed"]),
14088
+ rehydratePriority: blobPropertiesInXML["RehydratePriority"],
14089
+ lastAccessedOn: blobPropertiesInXML["LastAccessTime"] === undefined
14090
+ ? undefined
14091
+ : new Date(blobPropertiesInXML["LastAccessTime"]),
14092
+ immutabilityPolicyExpiresOn: blobPropertiesInXML["ImmutabilityPolicyUntilDate"] === undefined
14093
+ ? undefined
14094
+ : new Date(blobPropertiesInXML["ImmutabilityPolicyUntilDate"]),
14095
+ immutabilityPolicyMode: blobPropertiesInXML["ImmutabilityPolicyMode"],
14096
+ legalHold: ParseBoolean(blobPropertiesInXML["LegalHold"])
14097
+ };
14098
+ return {
14099
+ name: ParseBlobName(blobInXML["Name"]),
14100
+ deleted: ParseBoolean(blobInXML["Deleted"]),
14101
+ snapshot: blobInXML["Snapshot"],
14102
+ versionId: blobInXML["VersionId"],
14103
+ isCurrentVersion: ParseBoolean(blobInXML["IsCurrentVersion"]),
14104
+ properties: blobProperties,
14105
+ metadata: blobInXML["Metadata"],
14106
+ blobTags: ParseBlobTags(blobInXML["Tags"]),
14107
+ objectReplicationMetadata: blobInXML["OrMetadata"],
14108
+ hasVersionsOnly: ParseBoolean(blobInXML["HasVersionsOnly"])
14109
+ };
14110
+ }
14111
+ function ParseBlobPrefix(blobPrefixInXML) {
14112
+ return {
14113
+ name: ParseBlobName(blobPrefixInXML["Name"])
14114
+ };
14115
+ }
14116
+ function ParseBlobTag(blobTagInXML) {
14117
+ return {
14118
+ key: blobTagInXML["Key"],
14119
+ value: blobTagInXML["Value"]
14120
+ };
14121
+ }
14122
+ function ParseBlobTags(blobTagsInXML) {
14123
+ if (blobTagsInXML === undefined ||
14124
+ blobTagsInXML["TagSet"] === undefined ||
14125
+ blobTagsInXML["TagSet"]["Tag"] === undefined) {
14126
+ return undefined;
14127
+ }
14128
+ const blobTagSet = [];
14129
+ if (blobTagsInXML["TagSet"]["Tag"] instanceof Array) {
14130
+ blobTagsInXML["TagSet"]["Tag"].forEach((blobTagInXML) => {
14131
+ blobTagSet.push(ParseBlobTag(blobTagInXML));
14132
+ });
14133
+ }
14134
+ else {
14135
+ blobTagSet.push(ParseBlobTag(blobTagsInXML["TagSet"]["Tag"]));
14136
+ }
14137
+ return { blobTagSet: blobTagSet };
14138
+ }
14139
+ function ProcessBlobItems(blobArrayInXML) {
14140
+ const blobItems = [];
14141
+ if (blobArrayInXML instanceof Array) {
14142
+ blobArrayInXML.forEach((blobInXML) => {
14143
+ blobItems.push(ParseBlobItem(blobInXML));
14144
+ });
14145
+ }
14146
+ else {
14147
+ blobItems.push(ParseBlobItem(blobArrayInXML));
14148
+ }
14149
+ return blobItems;
14150
+ }
14151
+ function ProcessBlobPrefixes(blobPrefixesInXML) {
14152
+ const blobPrefixes = [];
14153
+ if (blobPrefixesInXML instanceof Array) {
14154
+ blobPrefixesInXML.forEach((blobPrefixInXML) => {
14155
+ blobPrefixes.push(ParseBlobPrefix(blobPrefixInXML));
14156
+ });
14157
+ }
14158
+ else {
14159
+ blobPrefixes.push(ParseBlobPrefix(blobPrefixesInXML));
14160
+ }
14161
+ return blobPrefixes;
14162
+ }
13950
14163
 
13951
14164
  // Copyright (c) Microsoft Corporation.
13952
14165
  /**
@@ -14649,7 +14862,7 @@ class StorageSharedKeyCredential extends Credential {
14649
14862
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
14650
14863
  */
14651
14864
  const packageName = "azure-storage-blob";
14652
- const packageVersion = "12.9.0-beta.1";
14865
+ const packageVersion = "12.9.0-beta.2";
14653
14866
  class StorageClientContext extends coreHttp.ServiceClient {
14654
14867
  /**
14655
14868
  * Initializes a new instance of the StorageClientContext class.
@@ -14675,7 +14888,7 @@ class StorageClientContext extends coreHttp.ServiceClient {
14675
14888
  // Parameter assignments
14676
14889
  this.url = url;
14677
14890
  // Assigning values to Constant parameters
14678
- this.version = options.version || "2020-12-06";
14891
+ this.version = options.version || "2021-02-12";
14679
14892
  }
14680
14893
  }
14681
14894
 
@@ -22119,8 +22332,12 @@ class ContainerClient extends StorageClient {
22119
22332
  const { span, updatedOptions } = createSpan("ContainerClient-listBlobFlatSegment", options);
22120
22333
  try {
22121
22334
  const response = await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
22122
- const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
22123
- const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
22335
+ response.segment.blobItems = [];
22336
+ if (response.segment["Blob"] !== undefined) {
22337
+ response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
22338
+ }
22339
+ const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobFlat(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
22340
+ const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
22124
22341
  return blobItem;
22125
22342
  }) }) });
22126
22343
  return wrappedResponse;
@@ -22148,12 +22365,26 @@ class ContainerClient extends StorageClient {
22148
22365
  * @param options - Options to Container List Blob Hierarchy Segment operation.
22149
22366
  */
22150
22367
  async listBlobHierarchySegment(delimiter, marker, options = {}) {
22368
+ var _a;
22151
22369
  const { span, updatedOptions } = createSpan("ContainerClient-listBlobHierarchySegment", options);
22152
22370
  try {
22153
22371
  const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
22154
- const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
22155
- const blobItem = Object.assign(Object.assign({}, blobItemInteral), { tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
22372
+ response.segment.blobItems = [];
22373
+ if (response.segment["Blob"] !== undefined) {
22374
+ response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
22375
+ }
22376
+ response.segment.blobPrefixes = [];
22377
+ if (response.segment["BlobPrefix"] !== undefined) {
22378
+ response.segment.blobPrefixes = ProcessBlobPrefixes(response.segment["BlobPrefix"]);
22379
+ }
22380
+ const wrappedResponse = Object.assign(Object.assign({}, response), { _response: Object.assign(Object.assign({}, response._response), { parsedBody: ConvertInternalResponseOfListBlobHierarchy(response._response.parsedBody) }), segment: Object.assign(Object.assign({}, response.segment), { blobItems: response.segment.blobItems.map((blobItemInteral) => {
22381
+ const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
22156
22382
  return blobItem;
22383
+ }), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
22384
+ const blobPrefix = {
22385
+ name: BlobNameToString(blobPrefixInternal.name)
22386
+ };
22387
+ return blobPrefix;
22157
22388
  }) }) });
22158
22389
  return wrappedResponse;
22159
22390
  }
@@ -23729,6 +23960,9 @@ class BlobServiceClient extends StorageClient {
23729
23960
  if (options.includeMetadata) {
23730
23961
  include.push("metadata");
23731
23962
  }
23963
+ if (options.includeSystem) {
23964
+ include.push("system");
23965
+ }
23732
23966
  // AsyncIterableIterator to iterate over containers
23733
23967
  const listSegmentOptions = Object.assign(Object.assign({}, options), (include.length > 0 ? { include } : {}));
23734
23968
  const iter = this.listItems(listSegmentOptions);