@azure/storage-blob 12.24.1-alpha.20240807.2 → 12.25.0-beta.1

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -91,8 +91,8 @@ class BaseRequestPolicy {
91
91
 
92
92
  // Copyright (c) Microsoft Corporation.
93
93
  // Licensed under the MIT license.
94
- const SDK_VERSION = "12.24.1";
95
- const SERVICE_VERSION = "2024-08-04";
94
+ const SDK_VERSION = "12.25.0-beta.1";
95
+ const SERVICE_VERSION = "2024-11-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
98
98
  const BLOCK_BLOB_MAX_BLOCKS = 50000;
@@ -10754,7 +10754,7 @@ const timeoutInSeconds = {
10754
10754
  const version = {
10755
10755
  parameterPath: "version",
10756
10756
  mapper: {
10757
- defaultValue: "2024-08-04",
10757
+ defaultValue: "2024-11-04",
10758
10758
  isConstant: true,
10759
10759
  serializedName: "x-ms-version",
10760
10760
  type: {
@@ -15371,7 +15371,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
15371
15371
  const defaults = {
15372
15372
  requestContentType: "application/json; charset=utf-8",
15373
15373
  };
15374
- const packageDetails = `azsdk-js-azure-storage-blob/12.24.0`;
15374
+ const packageDetails = `azsdk-js-azure-storage-blob/12.25.0-beta.1`;
15375
15375
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
15376
15376
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
15377
15377
  : `${packageDetails}`;
@@ -15382,7 +15382,7 @@ let StorageClient$1 = class StorageClient extends coreHttpCompat__namespace.Exte
15382
15382
  // Parameter assignments
15383
15383
  this.url = url;
15384
15384
  // Assigning values to Constant parameters
15385
- this.version = options.version || "2024-08-04";
15385
+ this.version = options.version || "2024-11-04";
15386
15386
  this.service = new ServiceImpl(this);
15387
15387
  this.container = new ContainerImpl(this);
15388
15388
  this.blob = new BlobImpl(this);
@@ -16140,6 +16140,9 @@ class SASQueryParameters {
16140
16140
  // Copyright (c) Microsoft Corporation.
16141
16141
  // Licensed under the MIT license.
16142
16142
  function generateBlobSASQueryParameters(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) {
16143
+ return generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName).sasQueryParameters;
16144
+ }
16145
+ function generateBlobSASQueryParametersInternal(blobSASSignatureValues, sharedKeyCredentialOrUserDelegationKey, accountName) {
16143
16146
  const version = blobSASSignatureValues.version ? blobSASSignatureValues.version : SERVICE_VERSION;
16144
16147
  const sharedKeyCredential = sharedKeyCredentialOrUserDelegationKey instanceof StorageSharedKeyCredential
16145
16148
  ? sharedKeyCredentialOrUserDelegationKey
@@ -16244,7 +16247,10 @@ function generateBlobSASQueryParameters20150405(blobSASSignatureValues, sharedKe
16244
16247
  blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
16245
16248
  ].join("\n");
16246
16249
  const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
16247
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
16250
+ return {
16251
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType),
16252
+ stringToSign: stringToSign,
16253
+ };
16248
16254
  }
16249
16255
  /**
16250
16256
  * ONLY AVAILABLE IN NODE.JS RUNTIME.
@@ -16313,7 +16319,10 @@ function generateBlobSASQueryParameters20181109(blobSASSignatureValues, sharedKe
16313
16319
  blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
16314
16320
  ].join("\n");
16315
16321
  const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
16316
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType);
16322
+ return {
16323
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType),
16324
+ stringToSign: stringToSign,
16325
+ };
16317
16326
  }
16318
16327
  /**
16319
16328
  * ONLY AVAILABLE IN NODE.JS RUNTIME.
@@ -16383,7 +16392,10 @@ function generateBlobSASQueryParameters20201206(blobSASSignatureValues, sharedKe
16383
16392
  blobSASSignatureValues.contentType ? blobSASSignatureValues.contentType : "",
16384
16393
  ].join("\n");
16385
16394
  const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
16386
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope);
16395
+ return {
16396
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, undefined, undefined, undefined, blobSASSignatureValues.encryptionScope),
16397
+ stringToSign: stringToSign,
16398
+ };
16387
16399
  }
16388
16400
  /**
16389
16401
  * ONLY AVAILABLE IN NODE.JS RUNTIME.
@@ -16459,7 +16471,10 @@ function generateBlobSASQueryParametersUDK20181109(blobSASSignatureValues, userD
16459
16471
  blobSASSignatureValues.contentType,
16460
16472
  ].join("\n");
16461
16473
  const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
16462
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey);
16474
+ return {
16475
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey),
16476
+ stringToSign: stringToSign,
16477
+ };
16463
16478
  }
16464
16479
  /**
16465
16480
  * ONLY AVAILABLE IN NODE.JS RUNTIME.
@@ -16538,7 +16553,10 @@ function generateBlobSASQueryParametersUDK20200210(blobSASSignatureValues, userD
16538
16553
  blobSASSignatureValues.contentType,
16539
16554
  ].join("\n");
16540
16555
  const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
16541
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId);
16556
+ return {
16557
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId),
16558
+ stringToSign: stringToSign,
16559
+ };
16542
16560
  }
16543
16561
  /**
16544
16562
  * ONLY AVAILABLE IN NODE.JS RUNTIME.
@@ -16618,7 +16636,10 @@ function generateBlobSASQueryParametersUDK20201206(blobSASSignatureValues, userD
16618
16636
  blobSASSignatureValues.contentType,
16619
16637
  ].join("\n");
16620
16638
  const signature = userDelegationKeyCredential.computeHMACSHA256(stringToSign);
16621
- return new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope);
16639
+ return {
16640
+ sasQueryParameters: new SASQueryParameters(blobSASSignatureValues.version, signature, verifiedPermissions, undefined, undefined, blobSASSignatureValues.protocol, blobSASSignatureValues.startsOn, blobSASSignatureValues.expiresOn, blobSASSignatureValues.ipRange, blobSASSignatureValues.identifier, resource, blobSASSignatureValues.cacheControl, blobSASSignatureValues.contentDisposition, blobSASSignatureValues.contentEncoding, blobSASSignatureValues.contentLanguage, blobSASSignatureValues.contentType, userDelegationKeyCredential.userDelegationKey, blobSASSignatureValues.preauthorizedAgentObjectId, blobSASSignatureValues.correlationId, blobSASSignatureValues.encryptionScope),
16641
+ stringToSign: stringToSign,
16642
+ };
16622
16643
  }
16623
16644
  function getCanonicalName(accountName, containerName, blobName) {
16624
16645
  // Container: "/blob/account/containerName"
@@ -20284,6 +20305,24 @@ class BlobClient extends StorageClient {
20284
20305
  resolve(appendToURLQuery(this.url, sas));
20285
20306
  });
20286
20307
  }
20308
+ /**
20309
+ * Only available for BlobClient constructed with a shared key credential.
20310
+ *
20311
+ * Generates string to sign for a Blob Service Shared Access Signature (SAS) URI based on
20312
+ * the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
20313
+ *
20314
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
20315
+ *
20316
+ * @param options - Optional parameters.
20317
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
20318
+ */
20319
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
20320
+ generateSasStringToSign(options) {
20321
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
20322
+ throw new RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
20323
+ }
20324
+ return generateBlobSASQueryParametersInternal(Object.assign({ containerName: this._containerName, blobName: this._name, snapshotTime: this._snapshot, versionId: this._versionId }, options), this.credential).stringToSign;
20325
+ }
20287
20326
  /**
20288
20327
  * Delete the immutablility policy on the blob.
20289
20328
  *
@@ -23629,6 +23668,24 @@ class ContainerClient extends StorageClient {
23629
23668
  resolve(appendToURLQuery(this.url, sas));
23630
23669
  });
23631
23670
  }
23671
+ /**
23672
+ * Only available for ContainerClient constructed with a shared key credential.
23673
+ *
23674
+ * Generates string to sign for a Blob Container Service Shared Access Signature (SAS) URI
23675
+ * based on the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
23676
+ *
23677
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
23678
+ *
23679
+ * @param options - Optional parameters.
23680
+ * @returns The SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
23681
+ */
23682
+ /* eslint-disable-next-line @azure/azure-sdk/ts-naming-options*/
23683
+ generateSasStringToSign(options) {
23684
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
23685
+ throw new RangeError("Can only generate the SAS when the client is initialized with a shared key credential");
23686
+ }
23687
+ return generateBlobSASQueryParametersInternal(Object.assign({ containerName: this._containerName }, options), this.credential).stringToSign;
23688
+ }
23632
23689
  /**
23633
23690
  * Creates a BlobBatchClient object to conduct batch operations.
23634
23691
  *
@@ -24034,6 +24091,10 @@ class AccountSASServices {
24034
24091
  * @param sharedKeyCredential -
24035
24092
  */
24036
24093
  function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyCredential) {
24094
+ return generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential)
24095
+ .sasQueryParameters;
24096
+ }
24097
+ function generateAccountSASQueryParametersInternal(accountSASSignatureValues, sharedKeyCredential) {
24037
24098
  const version = accountSASSignatureValues.version
24038
24099
  ? accountSASSignatureValues.version
24039
24100
  : SERVICE_VERSION;
@@ -24103,7 +24164,10 @@ function generateAccountSASQueryParameters(accountSASSignatureValues, sharedKeyC
24103
24164
  ].join("\n");
24104
24165
  }
24105
24166
  const signature = sharedKeyCredential.computeHMACSHA256(stringToSign);
24106
- return new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope);
24167
+ return {
24168
+ sasQueryParameters: new SASQueryParameters(version, signature, parsedPermissions.toString(), parsedServices, parsedResourceTypes, accountSASSignatureValues.protocol, accountSASSignatureValues.startsOn, accountSASSignatureValues.expiresOn, accountSASSignatureValues.ipRange, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, accountSASSignatureValues.encryptionScope),
24169
+ stringToSign: stringToSign,
24170
+ };
24107
24171
  }
24108
24172
 
24109
24173
  /**
@@ -24778,6 +24842,32 @@ class BlobServiceClient extends StorageClient {
24778
24842
  resourceTypes, services: AccountSASServices.parse("b").toString() }, options), this.credential).toString();
24779
24843
  return appendToURLQuery(this.url, sas);
24780
24844
  }
24845
+ /**
24846
+ * Only available for BlobServiceClient constructed with a shared key credential.
24847
+ *
24848
+ * Generates string to sign for a Blob account Shared Access Signature (SAS) URI based on
24849
+ * the client properties and parameters passed in. The SAS is signed by the shared key credential of the client.
24850
+ *
24851
+ * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-account-sas
24852
+ *
24853
+ * @param expiresOn - Optional. The time at which the shared access signature becomes invalid. Default to an hour later if not provided.
24854
+ * @param permissions - Specifies the list of permissions to be associated with the SAS.
24855
+ * @param resourceTypes - Specifies the resource types associated with the shared access signature.
24856
+ * @param options - Optional parameters.
24857
+ * @returns An account SAS URI consisting of the URI to the resource represented by this client, followed by the generated SAS token.
24858
+ */
24859
+ generateSasStringToSign(expiresOn, permissions = AccountSASPermissions.parse("r"), resourceTypes = "sco", options = {}) {
24860
+ if (!(this.credential instanceof StorageSharedKeyCredential)) {
24861
+ throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
24862
+ }
24863
+ if (expiresOn === undefined) {
24864
+ const now = new Date();
24865
+ expiresOn = new Date(now.getTime() + 3600 * 1000);
24866
+ }
24867
+ return generateAccountSASQueryParametersInternal(Object.assign({ permissions,
24868
+ expiresOn,
24869
+ resourceTypes, services: AccountSASServices.parse("b").toString() }, options), this.credential).stringToSign;
24870
+ }
24781
24871
  }
24782
24872
 
24783
24873
  // Copyright (c) Microsoft Corporation.