@azure/storage-blob 12.9.0-alpha.20220104.2 → 12.9.0-alpha.20220127.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 +7 -5
- package/README.md +11 -10
- package/dist/index.js +65 -20
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +3 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +12 -4
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +3 -1
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/package.json +33 -29
- package/{typings → types}/3.1/storage-blob.d.ts +24 -0
- /package/{typings → types}/latest/storage-blob.d.ts +0 -0
package/CHANGELOG.md
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
|
9
9
|
### Bugs Fixed
|
10
10
|
|
11
|
+
- Fixed a bug where customized `ProxyOptions` is overwrited by a default one when initializing `BlobServiceClient`, `BlobClient`, `AppendBlobClient`, `BlockBlobClient`, `PageBlobClient` or `ContainerClient` with connection string.
|
12
|
+
|
11
13
|
### Other Changes
|
12
14
|
|
13
15
|
## 12.9.0-beta.2 (2021-12-03)
|
@@ -266,20 +268,20 @@
|
|
266
268
|
Before this change the option is specified as
|
267
269
|
```js
|
268
270
|
blobServiceClient.listContainers({
|
269
|
-
include: "metadata"
|
271
|
+
include: "metadata",
|
270
272
|
});
|
271
273
|
```
|
272
274
|
After this change:
|
273
275
|
```js
|
274
276
|
blobServiceClient.listContainers({
|
275
|
-
includeMetadata: true
|
277
|
+
includeMetadata: true,
|
276
278
|
});
|
277
279
|
```
|
278
280
|
- For listing blobs
|
279
281
|
Before this change the option is specified as
|
280
282
|
```js
|
281
283
|
containerClient.listBlobsFlat({
|
282
|
-
include: ["snapshots", "metadata", "uncommittedblobs", "copy", "deleted"]
|
284
|
+
include: ["snapshots", "metadata", "uncommittedblobs", "copy", "deleted"],
|
283
285
|
});
|
284
286
|
```
|
285
287
|
After this change:
|
@@ -289,7 +291,7 @@
|
|
289
291
|
includeDeleted: true,
|
290
292
|
includeMetadata: true,
|
291
293
|
includeSnapshots: true,
|
292
|
-
includeUncommitedBlobs: true
|
294
|
+
includeUncommitedBlobs: true,
|
293
295
|
});
|
294
296
|
```
|
295
297
|
- [Breaking] `BlobClient.setTier()` is renamed to `BlobClient.setAccessTier()`.
|
@@ -414,7 +416,7 @@
|
|
414
416
|
- Connection string method is supported only in Node.js (not browsers).
|
415
417
|
- Creation/Deletion of child resources are duplicated to parent client type.
|
416
418
|
- HTTP proxy support is added (Node.js only).
|
417
|
-
- Please refer to the `proxyAuth.ts` sample in the `samples/typescript` folder.
|
419
|
+
- Please refer to the `proxyAuth.ts` sample in the `samples/v12/typescript` folder.
|
418
420
|
- Request and response headers are now logged at INFO level, with sensitive data redacted.
|
419
421
|
- `downloadToFile()` is added to `BlobClient`.
|
420
422
|
- Exported `HttpRequestBody` type to allow implementation of a customized HTTP client.
|
package/README.md
CHANGED
@@ -13,9 +13,10 @@ Use the client libraries in this package to:
|
|
13
13
|
- Create/Read/List/Update/Delete Append Blobs
|
14
14
|
|
15
15
|
Key links
|
16
|
-
|
17
|
-
- [
|
18
|
-
- [
|
16
|
+
|
17
|
+
- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob)
|
18
|
+
- [Package (npm)](https://www.npmjs.com/package/@azure/storage-blob/)
|
19
|
+
- [API Reference Documentation](https://docs.microsoft.com/javascript/api/@azure/storage-blob)
|
19
20
|
- [Product documentation](https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview)
|
20
21
|
- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples)
|
21
22
|
- [Azure Storage Blob REST APIs](https://docs.microsoft.com/rest/api/storageservices/blob-service-rest-api)
|
@@ -31,7 +32,7 @@ See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUP
|
|
31
32
|
|
32
33
|
### Prerequisites
|
33
34
|
|
34
|
-
- An [Azure subscription](https://azure.microsoft.com/free/)
|
35
|
+
- An [Azure subscription](https://azure.microsoft.com/free/)
|
35
36
|
- A [Storage Account](https://docs.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-portal)
|
36
37
|
|
37
38
|
### Install the package
|
@@ -192,7 +193,7 @@ const blobServiceClient = new BlobServiceClient(
|
|
192
193
|
);
|
193
194
|
```
|
194
195
|
|
195
|
-
See the [Azure AD Auth sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/javascript/azureAdAuth.js) for a complete example using this method.
|
196
|
+
See the [Azure AD Auth sample](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/v12/javascript/azureAdAuth.js) for a complete example using this method.
|
196
197
|
|
197
198
|
[Note - Above steps are only for Node.js]
|
198
199
|
|
@@ -352,7 +353,7 @@ async function main() {
|
|
352
353
|
main();
|
353
354
|
```
|
354
355
|
|
355
|
-
For a complete sample on iterating containers please see [samples/src/
|
356
|
+
For a complete sample on iterating containers please see [samples/v12/typescript/src/listContainers.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/v12/typescript/src/listContainers.ts).
|
356
357
|
|
357
358
|
### Create a blob by uploading data
|
358
359
|
|
@@ -414,7 +415,7 @@ async function main() {
|
|
414
415
|
main();
|
415
416
|
```
|
416
417
|
|
417
|
-
For a complete sample on iterating blobs please see [samples/src/
|
418
|
+
For a complete sample on iterating blobs please see [samples/v12/typescript/src/listBlobsFlat.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/v12/typescript/src/listBlobsFlat.ts).
|
418
419
|
|
419
420
|
### Download a blob and convert it to a string (Node.js)
|
420
421
|
|
@@ -503,7 +504,7 @@ async function main() {
|
|
503
504
|
main();
|
504
505
|
```
|
505
506
|
|
506
|
-
A complete example of
|
507
|
+
A complete example of simple scenarios is at [samples/v12/typescript/src/sharedKeyAuth.ts](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/samples/v12/typescript/src/sharedKeyAuth.ts).
|
507
508
|
|
508
509
|
## Troubleshooting
|
509
510
|
|
@@ -519,8 +520,8 @@ setLogLevel("info");
|
|
519
520
|
|
520
521
|
More code samples:
|
521
522
|
|
522
|
-
- [Blob Storage Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples/javascript)
|
523
|
-
- [Blob Storage Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples/typescript)
|
523
|
+
- [Blob Storage Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples/v12/javascript)
|
524
|
+
- [Blob Storage Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/samples/v12/typescript)
|
524
525
|
- [Blob Storage Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/test/)
|
525
526
|
|
526
527
|
## Contributing
|
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,17 @@ 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
|
-
options.proxyOptions
|
18877
|
+
if (!options.proxyOptions) {
|
18878
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
18879
|
+
}
|
18863
18880
|
pipeline = newPipeline(sharedKeyCredential, options);
|
18864
18881
|
}
|
18882
|
+
else {
|
18883
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
18884
|
+
}
|
18865
18885
|
}
|
18866
18886
|
else if (extractedCreds.kind === "SASConnString") {
|
18867
18887
|
url =
|
@@ -19008,7 +19028,7 @@ class BlobClient extends StorageClient {
|
|
19008
19028
|
}, range: offset === 0 && !count ? undefined : rangeToString({ offset, count }), rangeGetContentMD5: options.rangeGetContentMD5, rangeGetContentCRC64: options.rangeGetContentCrc64, snapshot: options.snapshot, cpkInfo: options.customerProvidedKey }, convertTracingToRequestOptionsBase(updatedOptions)));
|
19009
19029
|
const wrappedRes = Object.assign(Object.assign({}, res), { _response: res._response, objectReplicationDestinationPolicyId: res.objectReplicationPolicyId, objectReplicationSourceProperties: parseObjectReplicationRecord(res.objectReplicationRules) });
|
19010
19030
|
// Return browser response immediately
|
19011
|
-
if (
|
19031
|
+
if (!coreHttp.isNode) {
|
19012
19032
|
return wrappedRes;
|
19013
19033
|
}
|
19014
19034
|
// We support retrying when download stream unexpected ends in Node.js runtime
|
@@ -19895,12 +19915,17 @@ class AppendBlobClient extends BlobClient {
|
|
19895
19915
|
const blobName = blobNameOrOptions;
|
19896
19916
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
19897
19917
|
if (extractedCreds.kind === "AccountConnString") {
|
19898
|
-
{
|
19918
|
+
if (coreHttp.isNode) {
|
19899
19919
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
19900
19920
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
19901
|
-
options.proxyOptions
|
19921
|
+
if (!options.proxyOptions) {
|
19922
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
19923
|
+
}
|
19902
19924
|
pipeline = newPipeline(sharedKeyCredential, options);
|
19903
19925
|
}
|
19926
|
+
else {
|
19927
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
19928
|
+
}
|
19904
19929
|
}
|
19905
19930
|
else if (extractedCreds.kind === "SASConnString") {
|
19906
19931
|
url =
|
@@ -20146,12 +20171,17 @@ class BlockBlobClient extends BlobClient {
|
|
20146
20171
|
const blobName = blobNameOrOptions;
|
20147
20172
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
20148
20173
|
if (extractedCreds.kind === "AccountConnString") {
|
20149
|
-
{
|
20174
|
+
if (coreHttp.isNode) {
|
20150
20175
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
20151
20176
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
20152
|
-
options.proxyOptions
|
20177
|
+
if (!options.proxyOptions) {
|
20178
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
20179
|
+
}
|
20153
20180
|
pipeline = newPipeline(sharedKeyCredential, options);
|
20154
20181
|
}
|
20182
|
+
else {
|
20183
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
20184
|
+
}
|
20155
20185
|
}
|
20156
20186
|
else if (extractedCreds.kind === "SASConnString") {
|
20157
20187
|
url =
|
@@ -20217,7 +20247,7 @@ class BlockBlobClient extends BlobClient {
|
|
20217
20247
|
ensureCpkIfSpecified(options.customerProvidedKey, this.isHttps);
|
20218
20248
|
const { span, updatedOptions } = createSpan("BlockBlobClient-query", options);
|
20219
20249
|
try {
|
20220
|
-
if (
|
20250
|
+
if (!coreHttp.isNode) {
|
20221
20251
|
throw new Error("This operation currently is only supported in Node.js.");
|
20222
20252
|
}
|
20223
20253
|
const response = await this._blobContext.query(Object.assign({ abortSignal: options.abortSignal, queryRequest: {
|
@@ -20486,7 +20516,7 @@ class BlockBlobClient extends BlobClient {
|
|
20486
20516
|
async uploadData(data, options = {}) {
|
20487
20517
|
const { span, updatedOptions } = createSpan("BlockBlobClient-uploadData", options);
|
20488
20518
|
try {
|
20489
|
-
if (
|
20519
|
+
if (coreHttp.isNode) {
|
20490
20520
|
let buffer;
|
20491
20521
|
if (data instanceof Buffer) {
|
20492
20522
|
buffer = data;
|
@@ -20791,12 +20821,17 @@ class PageBlobClient extends BlobClient {
|
|
20791
20821
|
const blobName = blobNameOrOptions;
|
20792
20822
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
20793
20823
|
if (extractedCreds.kind === "AccountConnString") {
|
20794
|
-
{
|
20824
|
+
if (coreHttp.isNode) {
|
20795
20825
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
20796
20826
|
url = appendToURLPath(appendToURLPath(extractedCreds.url, encodeURIComponent(containerName)), encodeURIComponent(blobName));
|
20797
|
-
options.proxyOptions
|
20827
|
+
if (!options.proxyOptions) {
|
20828
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
20829
|
+
}
|
20798
20830
|
pipeline = newPipeline(sharedKeyCredential, options);
|
20799
20831
|
}
|
20832
|
+
else {
|
20833
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
20834
|
+
}
|
20800
20835
|
}
|
20801
20836
|
else if (extractedCreds.kind === "SASConnString") {
|
20802
20837
|
url =
|
@@ -21814,12 +21849,17 @@ class ContainerClient extends StorageClient {
|
|
21814
21849
|
const containerName = credentialOrPipelineOrContainerName;
|
21815
21850
|
const extractedCreds = extractConnectionStringParts(urlOrConnectionString);
|
21816
21851
|
if (extractedCreds.kind === "AccountConnString") {
|
21817
|
-
{
|
21852
|
+
if (coreHttp.isNode) {
|
21818
21853
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
21819
21854
|
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
|
21820
|
-
options.proxyOptions
|
21855
|
+
if (!options.proxyOptions) {
|
21856
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
21857
|
+
}
|
21821
21858
|
pipeline = newPipeline(sharedKeyCredential, options);
|
21822
21859
|
}
|
21860
|
+
else {
|
21861
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
21862
|
+
}
|
21823
21863
|
}
|
21824
21864
|
else if (extractedCreds.kind === "SASConnString") {
|
21825
21865
|
url =
|
@@ -23339,12 +23379,17 @@ class BlobServiceClient extends StorageClient {
|
|
23339
23379
|
options = options || {};
|
23340
23380
|
const extractedCreds = extractConnectionStringParts(connectionString);
|
23341
23381
|
if (extractedCreds.kind === "AccountConnString") {
|
23342
|
-
{
|
23382
|
+
if (coreHttp.isNode) {
|
23343
23383
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
23344
|
-
options.proxyOptions
|
23384
|
+
if (!options.proxyOptions) {
|
23385
|
+
options.proxyOptions = coreHttp.getDefaultProxySettings(extractedCreds.proxyUri);
|
23386
|
+
}
|
23345
23387
|
const pipeline = newPipeline(sharedKeyCredential, options);
|
23346
23388
|
return new BlobServiceClient(extractedCreds.url, pipeline);
|
23347
23389
|
}
|
23390
|
+
else {
|
23391
|
+
throw new Error("Account connection string is only supported in Node.js environment");
|
23392
|
+
}
|
23348
23393
|
}
|
23349
23394
|
else if (extractedCreds.kind === "SASConnString") {
|
23350
23395
|
const pipeline = newPipeline(new AnonymousCredential(), options);
|