@azure/storage-blob 12.9.0-alpha.20220104.2 → 12.9.0-alpha.20220105.6
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 +47 -14
- package/dist/index.js.map +1 -1
- package/package.json +6 -7
package/dist/index.js
CHANGED
@@ -14004,9 +14004,17 @@ function ConvertInternalResponseOfListBlobHierarchy(internalResponse) {
|
|
14004
14004
|
} });
|
14005
14005
|
}
|
14006
14006
|
function decodeBase64String(value) {
|
14007
|
-
{
|
14007
|
+
if (coreHttp.isNode) {
|
14008
14008
|
return Buffer.from(value, "base64");
|
14009
14009
|
}
|
14010
|
+
else {
|
14011
|
+
const byteString = atob(value);
|
14012
|
+
const arr = new Uint8Array(byteString.length);
|
14013
|
+
for (let i = 0; i < byteString.length; i++) {
|
14014
|
+
arr[i] = byteString.charCodeAt(i);
|
14015
|
+
}
|
14016
|
+
return arr;
|
14017
|
+
}
|
14010
14018
|
}
|
14011
14019
|
function ParseBoolean(content) {
|
14012
14020
|
if (content === undefined)
|
@@ -14190,9 +14198,16 @@ class StorageBrowserPolicy extends coreHttp.BaseRequestPolicy {
|
|
14190
14198
|
* @param request -
|
14191
14199
|
*/
|
14192
14200
|
async sendRequest(request) {
|
14193
|
-
{
|
14201
|
+
if (coreHttp.isNode) {
|
14194
14202
|
return this._nextPolicy.sendRequest(request);
|
14195
14203
|
}
|
14204
|
+
if (request.method.toUpperCase() === "GET" || request.method.toUpperCase() === "HEAD") {
|
14205
|
+
request.url = setURLParameter(request.url, URLConstants.Parameters.FORCE_BROWSER_NO_CACHE, new Date().getTime().toString());
|
14206
|
+
}
|
14207
|
+
request.headers.remove(HeaderConstants.COOKIE);
|
14208
|
+
// According to XHR standards, content-length should be fully controlled by browsers
|
14209
|
+
request.headers.remove(HeaderConstants.CONTENT_LENGTH);
|
14210
|
+
return this._nextPolicy.sendRequest(request);
|
14196
14211
|
}
|
14197
14212
|
}
|
14198
14213
|
|
@@ -14530,7 +14545,7 @@ class TelemetryPolicy extends coreHttp.BaseRequestPolicy {
|
|
14530
14545
|
* @param request -
|
14531
14546
|
*/
|
14532
14547
|
async sendRequest(request) {
|
14533
|
-
{
|
14548
|
+
if (coreHttp.isNode) {
|
14534
14549
|
if (!request.headers) {
|
14535
14550
|
request.headers = new coreHttp.HttpHeaders();
|
14536
14551
|
}
|
@@ -14553,7 +14568,7 @@ class TelemetryPolicyFactory {
|
|
14553
14568
|
*/
|
14554
14569
|
constructor(telemetry) {
|
14555
14570
|
const userAgentInfo = [];
|
14556
|
-
{
|
14571
|
+
if (coreHttp.isNode) {
|
14557
14572
|
if (telemetry) {
|
14558
14573
|
const telemetryString = telemetry.userAgentPrefix || "";
|
14559
14574
|
if (telemetryString.length > 0 && userAgentInfo.indexOf(telemetryString) === -1) {
|
@@ -14671,7 +14686,7 @@ function newPipeline(credential, pipelineOptions = {}) {
|
|
14671
14686
|
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters,
|
14672
14687
|
}),
|
14673
14688
|
];
|
14674
|
-
{
|
14689
|
+
if (coreHttp.isNode) {
|
14675
14690
|
// policies only available in Node.js runtime, not in browsers
|
14676
14691
|
factories.push(coreHttp.proxyPolicy(pipelineOptions.proxyOptions));
|
14677
14692
|
factories.push(coreHttp.disableResponseDecompressionPolicy());
|
@@ -18856,12 +18871,15 @@ class BlobClient extends StorageClient {
|
|
18856
18871
|
const blobName = blobNameOrOptions;
|
18857
18872
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
18858
18873
|
if (extractedCreds.kind === "AccountConnString") {
|
18859
|
-
{
|
18874
|
+
if (coreHttp.isNode) {
|
18860
18875
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
18861
18876
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
18862
18877
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
18863
18878
|
pipeline = newPipeline(sharedKeyCredential, options);
|
18864
18879
|
}
|
18880
|
+
else {
|
18881
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
18882
|
+
}
|
18865
18883
|
}
|
18866
18884
|
else if (extractedCreds.kind === "SASConnString") {
|
18867
18885
|
url =
|
@@ -19008,7 +19026,7 @@ class BlobClient extends StorageClient {
|
|
19008
19026
|
}, range: offset === 0 && !count ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, rangeGetContentCRC64: options.rangeGetContentCrc64, snapshot: options.snapshot, cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
|
19009
19027
|
const wrappedRes = Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
|
19010
19028
|
// Return browser response immediately
|
19011
|
-
if (
|
19029
|
+
if (!coreHttp.isNode) {
|
19012
19030
|
return wrappedRes;
|
19013
19031
|
}
|
19014
19032
|
// We support retrying when download stream unexpected ends in Node.js runtime
|
@@ -19895,12 +19913,15 @@ class AppendBlobClient extends BlobClient {
|
|
19895
19913
|
const blobName = blobNameOrOptions;
|
19896
19914
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
19897
19915
|
if (extractedCreds.kind === "AccountConnString") {
|
19898
|
-
{
|
19916
|
+
if (coreHttp.isNode) {
|
19899
19917
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
19900
19918
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
19901
19919
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
19902
19920
|
pipeline = newPipeline(sharedKeyCredential, options);
|
19903
19921
|
}
|
19922
|
+
else {
|
19923
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
19924
|
+
}
|
19904
19925
|
}
|
19905
19926
|
else if (extractedCreds.kind === "SASConnString") {
|
19906
19927
|
url =
|
@@ -20146,12 +20167,15 @@ class BlockBlobClient extends BlobClient {
|
|
20146
20167
|
const blobName = blobNameOrOptions;
|
20147
20168
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
20148
20169
|
if (extractedCreds.kind === "AccountConnString") {
|
20149
|
-
{
|
20170
|
+
if (coreHttp.isNode) {
|
20150
20171
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
20151
20172
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
20152
20173
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
20153
20174
|
pipeline = newPipeline(sharedKeyCredential, options);
|
20154
20175
|
}
|
20176
|
+
else {
|
20177
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
20178
|
+
}
|
20155
20179
|
}
|
20156
20180
|
else if (extractedCreds.kind === "SASConnString") {
|
20157
20181
|
url =
|
@@ -20217,7 +20241,7 @@ class BlockBlobClient extends BlobClient {
|
|
20217
20241
|
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
20218
20242
|
const { span, updatedOptions } = createSpan("BlockBlobClient-query", options);
|
20219
20243
|
try {
|
20220
|
-
if (
|
20244
|
+
if (!coreHttp.isNode) {
|
20221
20245
|
throw new Error("This operation currently is only supported in Node.js.");
|
20222
20246
|
}
|
20223
20247
|
const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
|
@@ -20486,7 +20510,7 @@ class BlockBlobClient extends BlobClient {
|
|
20486
20510
|
async uploadData(data, options = {}) {
|
20487
20511
|
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadData", options);
|
20488
20512
|
try {
|
20489
|
-
if (
|
20513
|
+
if (coreHttp.isNode) {
|
20490
20514
|
let buffer;
|
20491
20515
|
if (data instanceof Buffer) {
|
20492
20516
|
buffer = data;
|
@@ -20791,12 +20815,15 @@ class PageBlobClient extends BlobClient {
|
|
20791
20815
|
const blobName = blobNameOrOptions;
|
20792
20816
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
20793
20817
|
if (extractedCreds.kind === "AccountConnString") {
|
20794
|
-
{
|
20818
|
+
if (coreHttp.isNode) {
|
20795
20819
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
20796
20820
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
20797
20821
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
20798
20822
|
pipeline = newPipeline(sharedKeyCredential, options);
|
20799
20823
|
}
|
20824
|
+
else {
|
20825
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
20826
|
+
}
|
20800
20827
|
}
|
20801
20828
|
else if (extractedCreds.kind === "SASConnString") {
|
20802
20829
|
url =
|
@@ -21814,12 +21841,15 @@ class ContainerClient extends StorageClient {
|
|
21814
21841
|
const containerName = credentialOrPipelineOrContainerName;
|
21815
21842
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
21816
21843
|
if (extractedCreds.kind === "AccountConnString") {
|
21817
|
-
{
|
21844
|
+
if (coreHttp.isNode) {
|
21818
21845
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
21819
21846
|
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
|
21820
21847
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
21821
21848
|
pipeline = newPipeline(sharedKeyCredential, options);
|
21822
21849
|
}
|
21850
|
+
else {
|
21851
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
21852
|
+
}
|
21823
21853
|
}
|
21824
21854
|
else if (extractedCreds.kind === "SASConnString") {
|
21825
21855
|
url =
|
@@ -23339,12 +23369,15 @@ class BlobServiceClient extends StorageClient {
|
|
23339
23369
|
options = options || {};
|
23340
23370
|
const extractedCreds = extractConnectionStringParts(connectionString);
|
23341
23371
|
if (extractedCreds.kind === "AccountConnString") {
|
23342
|
-
{
|
23372
|
+
if (coreHttp.isNode) {
|
23343
23373
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
23344
23374
|
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
23345
23375
|
const pipeline = newPipeline(sharedKeyCredential, options);
|
23346
23376
|
return new BlobServiceClient(extractedCreds.url, pipeline);
|
23347
23377
|
}
|
23378
|
+
else {
|
23379
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
23380
|
+
}
|
23348
23381
|
}
|
23349
23382
|
else if (extractedCreds.kind === "SASConnString") {
|
23350
23383
|
const pipeline = newPipeline(new AnonymousCredential(), options);
|