@azure/storage-blob 12.9.0-beta.1 → 12.9.0-beta.4
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 +34 -5
- package/README.md +11 -10
- package/dist/index.js +1339 -464
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob/src/BatchResponseParser.js +2 -2
- package/dist-esm/storage-blob/src/BatchResponseParser.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatch.js +8 -8
- package/dist-esm/storage-blob/src/BlobBatch.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobBatchClient.js +2 -2
- package/dist-esm/storage-blob/src/BlobBatchClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js +1 -1
- package/dist-esm/storage-blob/src/BlobDownloadResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobLeaseClient.js +5 -5
- package/dist-esm/storage-blob/src/BlobLeaseClient.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobQueryResponse.browser.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobQueryResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/BlobServiceClient.js +25 -20
- package/dist-esm/storage-blob/src/BlobServiceClient.js.map +1 -1
- package/dist-esm/storage-blob/src/Clients.js +105 -100
- package/dist-esm/storage-blob/src/Clients.js.map +1 -1
- package/dist-esm/storage-blob/src/ContainerClient.js +262 -41
- package/dist-esm/storage-blob/src/ContainerClient.js.map +1 -1
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js +3 -3
- package/dist-esm/storage-blob/src/PageBlobRangeResponse.js.map +1 -1
- package/dist-esm/storage-blob/src/Pipeline.js +9 -7
- package/dist-esm/storage-blob/src/Pipeline.js.map +1 -1
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js +1 -1
- package/dist-esm/storage-blob/src/TelemetryPolicyFactory.js.map +1 -1
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js +1 -3
- package/dist-esm/storage-blob/src/credentials/StorageSharedKeyCredential.js.map +1 -1
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js +1 -3
- package/dist-esm/storage-blob/src/credentials/UserDelegationKeyCredential.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/index.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js +81 -4
- package/dist-esm/storage-blob/src/generated/src/models/mappers.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js +2 -2
- package/dist-esm/storage-blob/src/generated/src/models/parameters.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/operations/container.js +41 -0
- package/dist-esm/storage-blob/src/generated/src/operations/container.js.map +1 -1
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js +2 -2
- package/dist-esm/storage-blob/src/generated/src/storageClientContext.js.map +1 -1
- package/dist-esm/storage-blob/src/generatedModels.js.map +1 -1
- package/dist-esm/storage-blob/src/index.browser.js +1 -1
- package/dist-esm/storage-blob/src/index.browser.js.map +1 -1
- package/dist-esm/storage-blob/src/index.js +1 -1
- package/dist-esm/storage-blob/src/index.js.map +1 -1
- package/dist-esm/storage-blob/src/models.js +14 -0
- package/dist-esm/storage-blob/src/models.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js +245 -0
- package/dist-esm/storage-blob/src/policies/StorageBearerTokenChallengeAuthenticationPolicy.js.map +1 -0
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/StorageBrowserPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js +5 -5
- package/dist-esm/storage-blob/src/policies/StorageRetryPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js +4 -2
- package/dist-esm/storage-blob/src/policies/StorageSharedKeyCredentialPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js +1 -1
- package/dist-esm/storage-blob/src/policies/TelemetryPolicy.js.map +1 -1
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js +3 -3
- package/dist-esm/storage-blob/src/pollers/BlobStartCopyFromUrlPoller.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js +2 -2
- package/dist-esm/storage-blob/src/sas/AccountSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js +11 -6
- package/dist-esm/storage-blob/src/sas/BlobSASSignatureValues.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js +13 -0
- package/dist-esm/storage-blob/src/sas/ContainerSASPermissions.js.map +1 -1
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js +2 -2
- package/dist-esm/storage-blob/src/sas/SASQueryParameters.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/Batch.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js +1 -1
- package/dist-esm/storage-blob/src/utils/BlobQuickQueryStream.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/Mutex.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js +1 -2
- package/dist-esm/storage-blob/src/utils/RetriableReadableStream.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/constants.js +9 -8
- package/dist-esm/storage-blob/src/utils/constants.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/tracing.js +2 -2
- package/dist-esm/storage-blob/src/utils/tracing.js.map +1 -1
- package/dist-esm/storage-blob/src/utils/utils.common.js +212 -16
- package/dist-esm/storage-blob/src/utils/utils.common.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroParser.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReader.js +8 -8
- package/dist-esm/storage-internal-avro/src/AvroReader.js.map +1 -1
- package/package.json +40 -49
- package/{typings → types}/3.1/storage-blob.d.ts +226 -9
- package/{typings → types}/latest/storage-blob.d.ts +206 -11
@@ -1,5 +1,5 @@
|
|
1
1
|
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
|
2
|
-
import { getDefaultProxySettings, isNode, isTokenCredential, URLBuilder } from "@azure/core-http";
|
2
|
+
import { getDefaultProxySettings, isNode, isTokenCredential, URLBuilder, } from "@azure/core-http";
|
3
3
|
import { SpanStatusCode } from "@azure/core-tracing";
|
4
4
|
import { AnonymousCredential } from "./credentials/AnonymousCredential";
|
5
5
|
import { StorageSharedKeyCredential } from "./credentials/StorageSharedKeyCredential";
|
@@ -7,10 +7,10 @@ import { Container } from "./generated/src/operations";
|
|
7
7
|
import { newPipeline, isPipelineLike } from "./Pipeline";
|
8
8
|
import { StorageClient } from "./StorageClient";
|
9
9
|
import { convertTracingToRequestOptionsBase, createSpan } from "./utils/tracing";
|
10
|
-
import { appendToURLPath, appendToURLQuery, extractConnectionStringParts, isIpEndpointStyle, parseObjectReplicationRecord, toTags, truncatedISO8061Date } from "./utils/utils.common";
|
10
|
+
import { appendToURLPath, appendToURLQuery, BlobNameToString, ConvertInternalResponseOfListBlobFlat, ConvertInternalResponseOfListBlobHierarchy, extractConnectionStringParts, isIpEndpointStyle, parseObjectReplicationRecord, ProcessBlobItems, ProcessBlobPrefixes, toTags, truncatedISO8061Date, } from "./utils/utils.common";
|
11
11
|
import { generateBlobSASQueryParameters } from "./sas/BlobSASSignatureValues";
|
12
12
|
import { BlobLeaseClient } from "./BlobLeaseClient";
|
13
|
-
import { AppendBlobClient, BlobClient, BlockBlobClient, PageBlobClient } from "./Clients";
|
13
|
+
import { AppendBlobClient, BlobClient, BlockBlobClient, PageBlobClient, } from "./Clients";
|
14
14
|
import { BlobBatchClient } from "./BlobBatchClient";
|
15
15
|
/**
|
16
16
|
* A ContainerClient represents a URL to the Azure Storage container allowing you to manipulate its blobs.
|
@@ -51,7 +51,9 @@ export class ContainerClient extends StorageClient {
|
|
51
51
|
if (isNode) {
|
52
52
|
const sharedKeyCredential = new StorageSharedKeyCredential(extractedCreds.accountName, extractedCreds.accountKey);
|
53
53
|
url = appendToURLPath(extractedCreds.url, encodeURIComponent(containerName));
|
54
|
-
options.proxyOptions
|
54
|
+
if (!options.proxyOptions) {
|
55
|
+
options.proxyOptions = getDefaultProxySettings(extractedCreds.proxyUri);
|
56
|
+
}
|
55
57
|
pipeline = newPipeline(sharedKeyCredential, options);
|
56
58
|
}
|
57
59
|
else {
|
@@ -108,7 +110,7 @@ export class ContainerClient extends StorageClient {
|
|
108
110
|
catch (e) {
|
109
111
|
span.setStatus({
|
110
112
|
code: SpanStatusCode.ERROR,
|
111
|
-
message: e.message
|
113
|
+
message: e.message,
|
112
114
|
});
|
113
115
|
throw e;
|
114
116
|
}
|
@@ -128,20 +130,19 @@ export class ContainerClient extends StorageClient {
|
|
128
130
|
const { span, updatedOptions } = createSpan("ContainerClient-createIfNotExists", options);
|
129
131
|
try {
|
130
132
|
const res = await this.create(updatedOptions);
|
131
|
-
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response
|
132
|
-
});
|
133
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
133
134
|
}
|
134
135
|
catch (e) {
|
135
136
|
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerAlreadyExists") {
|
136
137
|
span.setStatus({
|
137
138
|
code: SpanStatusCode.ERROR,
|
138
|
-
message: "Expected exception when creating a container only if it does not already exist."
|
139
|
+
message: "Expected exception when creating a container only if it does not already exist.",
|
139
140
|
});
|
140
141
|
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
141
142
|
}
|
142
143
|
span.setStatus({
|
143
144
|
code: SpanStatusCode.ERROR,
|
144
|
-
message: e.message
|
145
|
+
message: e.message,
|
145
146
|
});
|
146
147
|
throw e;
|
147
148
|
}
|
@@ -163,7 +164,7 @@ export class ContainerClient extends StorageClient {
|
|
163
164
|
try {
|
164
165
|
await this.getProperties({
|
165
166
|
abortSignal: options.abortSignal,
|
166
|
-
tracingOptions: updatedOptions.tracingOptions
|
167
|
+
tracingOptions: updatedOptions.tracingOptions,
|
167
168
|
});
|
168
169
|
return true;
|
169
170
|
}
|
@@ -171,13 +172,13 @@ export class ContainerClient extends StorageClient {
|
|
171
172
|
if (e.statusCode === 404) {
|
172
173
|
span.setStatus({
|
173
174
|
code: SpanStatusCode.ERROR,
|
174
|
-
message: "Expected exception when checking container existence"
|
175
|
+
message: "Expected exception when checking container existence",
|
175
176
|
});
|
176
177
|
return false;
|
177
178
|
}
|
178
179
|
span.setStatus({
|
179
180
|
code: SpanStatusCode.ERROR,
|
180
|
-
message: e.message
|
181
|
+
message: e.message,
|
181
182
|
});
|
182
183
|
throw e;
|
183
184
|
}
|
@@ -251,7 +252,7 @@ export class ContainerClient extends StorageClient {
|
|
251
252
|
catch (e) {
|
252
253
|
span.setStatus({
|
253
254
|
code: SpanStatusCode.ERROR,
|
254
|
-
message: e.message
|
255
|
+
message: e.message,
|
255
256
|
});
|
256
257
|
throw e;
|
257
258
|
}
|
@@ -277,7 +278,7 @@ export class ContainerClient extends StorageClient {
|
|
277
278
|
catch (e) {
|
278
279
|
span.setStatus({
|
279
280
|
code: SpanStatusCode.ERROR,
|
280
|
-
message: e.message
|
281
|
+
message: e.message,
|
281
282
|
});
|
282
283
|
throw e;
|
283
284
|
}
|
@@ -297,20 +298,19 @@ export class ContainerClient extends StorageClient {
|
|
297
298
|
const { span, updatedOptions } = createSpan("ContainerClient-deleteIfExists", options);
|
298
299
|
try {
|
299
300
|
const res = await this.delete(updatedOptions);
|
300
|
-
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response
|
301
|
-
});
|
301
|
+
return Object.assign(Object.assign({ succeeded: true }, res), { _response: res._response });
|
302
302
|
}
|
303
303
|
catch (e) {
|
304
304
|
if (((_a = e.details) === null || _a === void 0 ? void 0 : _a.errorCode) === "ContainerNotFound") {
|
305
305
|
span.setStatus({
|
306
306
|
code: SpanStatusCode.ERROR,
|
307
|
-
message: "Expected exception when deleting a container only if it exists."
|
307
|
+
message: "Expected exception when deleting a container only if it exists.",
|
308
308
|
});
|
309
309
|
return Object.assign(Object.assign({ succeeded: false }, (_b = e.response) === null || _b === void 0 ? void 0 : _b.parsedHeaders), { _response: e.response });
|
310
310
|
}
|
311
311
|
span.setStatus({
|
312
312
|
code: SpanStatusCode.ERROR,
|
313
|
-
message: e.message
|
313
|
+
message: e.message,
|
314
314
|
});
|
315
315
|
throw e;
|
316
316
|
}
|
@@ -344,7 +344,7 @@ export class ContainerClient extends StorageClient {
|
|
344
344
|
catch (e) {
|
345
345
|
span.setStatus({
|
346
346
|
code: SpanStatusCode.ERROR,
|
347
|
-
message: e.message
|
347
|
+
message: e.message,
|
348
348
|
});
|
349
349
|
throw e;
|
350
350
|
}
|
@@ -380,13 +380,13 @@ export class ContainerClient extends StorageClient {
|
|
380
380
|
requestId: response.requestId,
|
381
381
|
clientRequestId: response.clientRequestId,
|
382
382
|
signedIdentifiers: [],
|
383
|
-
version: response.version
|
383
|
+
version: response.version,
|
384
384
|
};
|
385
385
|
for (const identifier of response) {
|
386
386
|
let accessPolicy = undefined;
|
387
387
|
if (identifier.accessPolicy) {
|
388
388
|
accessPolicy = {
|
389
|
-
permissions: identifier.accessPolicy.permissions
|
389
|
+
permissions: identifier.accessPolicy.permissions,
|
390
390
|
};
|
391
391
|
if (identifier.accessPolicy.expiresOn) {
|
392
392
|
accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn);
|
@@ -397,7 +397,7 @@ export class ContainerClient extends StorageClient {
|
|
397
397
|
}
|
398
398
|
res.signedIdentifiers.push({
|
399
399
|
accessPolicy,
|
400
|
-
id: identifier.id
|
400
|
+
id: identifier.id,
|
401
401
|
});
|
402
402
|
}
|
403
403
|
return res;
|
@@ -405,7 +405,7 @@ export class ContainerClient extends StorageClient {
|
|
405
405
|
catch (e) {
|
406
406
|
span.setStatus({
|
407
407
|
code: SpanStatusCode.ERROR,
|
408
|
-
message: e.message
|
408
|
+
message: e.message,
|
409
409
|
});
|
410
410
|
throw e;
|
411
411
|
}
|
@@ -444,9 +444,9 @@ export class ContainerClient extends StorageClient {
|
|
444
444
|
permissions: identifier.accessPolicy.permissions,
|
445
445
|
startsOn: identifier.accessPolicy.startsOn
|
446
446
|
? truncatedISO8061Date(identifier.accessPolicy.startsOn)
|
447
|
-
: ""
|
447
|
+
: "",
|
448
448
|
},
|
449
|
-
id: identifier.id
|
449
|
+
id: identifier.id,
|
450
450
|
});
|
451
451
|
}
|
452
452
|
return await this.containerContext.setAccessPolicy(Object.assign({ abortSignal: options.abortSignal, access, containerAcl: acl, leaseAccessConditions: options.conditions, modifiedAccessConditions: options.conditions }, convertTracingToRequestOptionsBase(updatedOptions)));
|
@@ -454,7 +454,7 @@ export class ContainerClient extends StorageClient {
|
|
454
454
|
catch (e) {
|
455
455
|
span.setStatus({
|
456
456
|
code: SpanStatusCode.ERROR,
|
457
|
-
message: e.message
|
457
|
+
message: e.message,
|
458
458
|
});
|
459
459
|
throw e;
|
460
460
|
}
|
@@ -500,13 +500,13 @@ export class ContainerClient extends StorageClient {
|
|
500
500
|
const response = await blockBlobClient.upload(body, contentLength, updatedOptions);
|
501
501
|
return {
|
502
502
|
blockBlobClient,
|
503
|
-
response
|
503
|
+
response,
|
504
504
|
};
|
505
505
|
}
|
506
506
|
catch (e) {
|
507
507
|
span.setStatus({
|
508
508
|
code: SpanStatusCode.ERROR,
|
509
|
-
message: e.message
|
509
|
+
message: e.message,
|
510
510
|
});
|
511
511
|
throw e;
|
512
512
|
}
|
@@ -537,7 +537,7 @@ export class ContainerClient extends StorageClient {
|
|
537
537
|
catch (e) {
|
538
538
|
span.setStatus({
|
539
539
|
code: SpanStatusCode.ERROR,
|
540
|
-
message: e.message
|
540
|
+
message: e.message,
|
541
541
|
});
|
542
542
|
throw e;
|
543
543
|
}
|
@@ -559,8 +559,12 @@ export class ContainerClient extends StorageClient {
|
|
559
559
|
const { span, updatedOptions } = createSpan("ContainerClient-listBlobFlatSegment", options);
|
560
560
|
try {
|
561
561
|
const response = await this.containerContext.listBlobFlatSegment(Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
|
562
|
-
|
563
|
-
|
562
|
+
response.segment.blobItems = [];
|
563
|
+
if (response.segment["Blob"] !== undefined) {
|
564
|
+
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
|
565
|
+
}
|
566
|
+
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) => {
|
567
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
|
564
568
|
return blobItem;
|
565
569
|
}) }) });
|
566
570
|
return wrappedResponse;
|
@@ -568,7 +572,7 @@ export class ContainerClient extends StorageClient {
|
|
568
572
|
catch (e) {
|
569
573
|
span.setStatus({
|
570
574
|
code: SpanStatusCode.ERROR,
|
571
|
-
message: e.message
|
575
|
+
message: e.message,
|
572
576
|
});
|
573
577
|
throw e;
|
574
578
|
}
|
@@ -588,19 +592,33 @@ export class ContainerClient extends StorageClient {
|
|
588
592
|
* @param options - Options to Container List Blob Hierarchy Segment operation.
|
589
593
|
*/
|
590
594
|
async listBlobHierarchySegment(delimiter, marker, options = {}) {
|
595
|
+
var _a;
|
591
596
|
const { span, updatedOptions } = createSpan("ContainerClient-listBlobHierarchySegment", options);
|
592
597
|
try {
|
593
598
|
const response = await this.containerContext.listBlobHierarchySegment(delimiter, Object.assign(Object.assign({ marker }, options), convertTracingToRequestOptionsBase(updatedOptions)));
|
594
|
-
|
595
|
-
|
599
|
+
response.segment.blobItems = [];
|
600
|
+
if (response.segment["Blob"] !== undefined) {
|
601
|
+
response.segment.blobItems = ProcessBlobItems(response.segment["Blob"]);
|
602
|
+
}
|
603
|
+
response.segment.blobPrefixes = [];
|
604
|
+
if (response.segment["BlobPrefix"] !== undefined) {
|
605
|
+
response.segment.blobPrefixes = ProcessBlobPrefixes(response.segment["BlobPrefix"]);
|
606
|
+
}
|
607
|
+
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) => {
|
608
|
+
const blobItem = Object.assign(Object.assign({}, blobItemInteral), { name: BlobNameToString(blobItemInteral.name), tags: toTags(blobItemInteral.blobTags), objectReplicationSourceProperties: parseObjectReplicationRecord(blobItemInteral.objectReplicationMetadata) });
|
596
609
|
return blobItem;
|
610
|
+
}), blobPrefixes: (_a = response.segment.blobPrefixes) === null || _a === void 0 ? void 0 : _a.map((blobPrefixInternal) => {
|
611
|
+
const blobPrefix = {
|
612
|
+
name: BlobNameToString(blobPrefixInternal.name),
|
613
|
+
};
|
614
|
+
return blobPrefix;
|
597
615
|
}) }) });
|
598
616
|
return wrappedResponse;
|
599
617
|
}
|
600
618
|
catch (e) {
|
601
619
|
span.setStatus({
|
602
620
|
code: SpanStatusCode.ERROR,
|
603
|
-
message: e.message
|
621
|
+
message: e.message,
|
604
622
|
});
|
605
623
|
throw e;
|
606
624
|
}
|
@@ -782,7 +800,7 @@ export class ContainerClient extends StorageClient {
|
|
782
800
|
*/
|
783
801
|
byPage: (settings = {}) => {
|
784
802
|
return this.listSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
|
785
|
-
}
|
803
|
+
},
|
786
804
|
};
|
787
805
|
}
|
788
806
|
/**
|
@@ -856,7 +874,7 @@ export class ContainerClient extends StorageClient {
|
|
856
874
|
* if (item.kind === "prefix") {
|
857
875
|
* console.log(`\tBlobPrefix: ${item.name}`);
|
858
876
|
* } else {
|
859
|
-
* console.log(`\tBlobItem: name - ${item.name}
|
877
|
+
* console.log(`\tBlobItem: name - ${item.name}`);
|
860
878
|
* }
|
861
879
|
* }
|
862
880
|
* ```
|
@@ -871,7 +889,7 @@ export class ContainerClient extends StorageClient {
|
|
871
889
|
* if (item.kind === "prefix") {
|
872
890
|
* console.log(`\tBlobPrefix: ${item.name}`);
|
873
891
|
* } else {
|
874
|
-
* console.log(`\tBlobItem: name - ${item.name}
|
892
|
+
* console.log(`\tBlobItem: name - ${item.name}`);
|
875
893
|
* }
|
876
894
|
* entity = await iter.next();
|
877
895
|
* }
|
@@ -889,7 +907,7 @@ export class ContainerClient extends StorageClient {
|
|
889
907
|
* }
|
890
908
|
* }
|
891
909
|
* for (const blob of response.segment.blobItems) {
|
892
|
-
* console.log(`\tBlobItem: name - ${blob.name}
|
910
|
+
* console.log(`\tBlobItem: name - ${blob.name}`);
|
893
911
|
* }
|
894
912
|
* }
|
895
913
|
* ```
|
@@ -900,7 +918,9 @@ export class ContainerClient extends StorageClient {
|
|
900
918
|
* console.log("Listing blobs by hierarchy by page, specifying a prefix and a max page size");
|
901
919
|
*
|
902
920
|
* let i = 1;
|
903
|
-
* for await (const response of containerClient
|
921
|
+
* for await (const response of containerClient
|
922
|
+
* .listBlobsByHierarchy("/", { prefix: "prefix2/sub1/" })
|
923
|
+
* .byPage({ maxPageSize: 2 })) {
|
904
924
|
* console.log(`Page ${i++}`);
|
905
925
|
* const segment = response.segment;
|
906
926
|
*
|
@@ -911,7 +931,7 @@ export class ContainerClient extends StorageClient {
|
|
911
931
|
* }
|
912
932
|
*
|
913
933
|
* for (const blob of response.segment.blobItems) {
|
914
|
-
* console.log(`\tBlobItem: name - ${blob.name}
|
934
|
+
* console.log(`\tBlobItem: name - ${blob.name}`);
|
915
935
|
* }
|
916
936
|
* }
|
917
937
|
* ```
|
@@ -978,7 +998,208 @@ export class ContainerClient extends StorageClient {
|
|
978
998
|
*/
|
979
999
|
byPage: (settings = {}) => {
|
980
1000
|
return this.listHierarchySegments(delimiter, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, updatedOptions));
|
1001
|
+
},
|
1002
|
+
};
|
1003
|
+
}
|
1004
|
+
/**
|
1005
|
+
* The Filter Blobs operation enables callers to list blobs in the container whose tags
|
1006
|
+
* match a given search expression.
|
1007
|
+
*
|
1008
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
1009
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
1010
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
1011
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
1012
|
+
* @param marker - A string value that identifies the portion of
|
1013
|
+
* the list of blobs to be returned with the next listing operation. The
|
1014
|
+
* operation returns the continuationToken value within the response body if the
|
1015
|
+
* listing operation did not return all blobs remaining to be listed
|
1016
|
+
* with the current page. The continuationToken value can be used as the value for
|
1017
|
+
* the marker parameter in a subsequent call to request the next page of list
|
1018
|
+
* items. The marker value is opaque to the client.
|
1019
|
+
* @param options - Options to find blobs by tags.
|
1020
|
+
*/
|
1021
|
+
async findBlobsByTagsSegment(tagFilterSqlExpression, marker, options = {}) {
|
1022
|
+
const { span, updatedOptions } = createSpan("ContainerClient-findBlobsByTagsSegment", options);
|
1023
|
+
try {
|
1024
|
+
const response = await this.containerContext.filterBlobs(Object.assign({ abortSignal: options.abortSignal, where: tagFilterSqlExpression, marker, maxPageSize: options.maxPageSize }, convertTracingToRequestOptionsBase(updatedOptions)));
|
1025
|
+
const wrappedResponse = Object.assign(Object.assign({}, response), { _response: response._response, blobs: response.blobs.map((blob) => {
|
1026
|
+
var _a;
|
1027
|
+
let tagValue = "";
|
1028
|
+
if (((_a = blob.tags) === null || _a === void 0 ? void 0 : _a.blobTagSet.length) === 1) {
|
1029
|
+
tagValue = blob.tags.blobTagSet[0].value;
|
1030
|
+
}
|
1031
|
+
return Object.assign(Object.assign({}, blob), { tags: toTags(blob.tags), tagValue });
|
1032
|
+
}) });
|
1033
|
+
return wrappedResponse;
|
1034
|
+
}
|
1035
|
+
catch (e) {
|
1036
|
+
span.setStatus({
|
1037
|
+
code: SpanStatusCode.ERROR,
|
1038
|
+
message: e.message,
|
1039
|
+
});
|
1040
|
+
throw e;
|
1041
|
+
}
|
1042
|
+
finally {
|
1043
|
+
span.end();
|
1044
|
+
}
|
1045
|
+
}
|
1046
|
+
/**
|
1047
|
+
* Returns an AsyncIterableIterator for ContainerFindBlobsByTagsSegmentResponse.
|
1048
|
+
*
|
1049
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
1050
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
1051
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
1052
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
1053
|
+
* @param marker - A string value that identifies the portion of
|
1054
|
+
* the list of blobs to be returned with the next listing operation. The
|
1055
|
+
* operation returns the continuationToken value within the response body if the
|
1056
|
+
* listing operation did not return all blobs remaining to be listed
|
1057
|
+
* with the current page. The continuationToken value can be used as the value for
|
1058
|
+
* the marker parameter in a subsequent call to request the next page of list
|
1059
|
+
* items. The marker value is opaque to the client.
|
1060
|
+
* @param options - Options to find blobs by tags.
|
1061
|
+
*/
|
1062
|
+
findBlobsByTagsSegments(tagFilterSqlExpression, marker, options = {}) {
|
1063
|
+
return __asyncGenerator(this, arguments, function* findBlobsByTagsSegments_1() {
|
1064
|
+
let response;
|
1065
|
+
if (!!marker || marker === undefined) {
|
1066
|
+
do {
|
1067
|
+
response = yield __await(this.findBlobsByTagsSegment(tagFilterSqlExpression, marker, options));
|
1068
|
+
response.blobs = response.blobs || [];
|
1069
|
+
marker = response.continuationToken;
|
1070
|
+
yield yield __await(response);
|
1071
|
+
} while (marker);
|
981
1072
|
}
|
1073
|
+
});
|
1074
|
+
}
|
1075
|
+
/**
|
1076
|
+
* Returns an AsyncIterableIterator for blobs.
|
1077
|
+
*
|
1078
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
1079
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
1080
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
1081
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
1082
|
+
* @param options - Options to findBlobsByTagsItems.
|
1083
|
+
*/
|
1084
|
+
findBlobsByTagsItems(tagFilterSqlExpression, options = {}) {
|
1085
|
+
return __asyncGenerator(this, arguments, function* findBlobsByTagsItems_1() {
|
1086
|
+
var e_3, _a;
|
1087
|
+
let marker;
|
1088
|
+
try {
|
1089
|
+
for (var _b = __asyncValues(this.findBlobsByTagsSegments(tagFilterSqlExpression, marker, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
1090
|
+
const segment = _c.value;
|
1091
|
+
yield __await(yield* __asyncDelegator(__asyncValues(segment.blobs)));
|
1092
|
+
}
|
1093
|
+
}
|
1094
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
1095
|
+
finally {
|
1096
|
+
try {
|
1097
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
1098
|
+
}
|
1099
|
+
finally { if (e_3) throw e_3.error; }
|
1100
|
+
}
|
1101
|
+
});
|
1102
|
+
}
|
1103
|
+
/**
|
1104
|
+
* Returns an async iterable iterator to find all blobs with specified tag
|
1105
|
+
* under the specified container.
|
1106
|
+
*
|
1107
|
+
* .byPage() returns an async iterable iterator to list the blobs in pages.
|
1108
|
+
*
|
1109
|
+
* Example using `for await` syntax:
|
1110
|
+
*
|
1111
|
+
* ```js
|
1112
|
+
* let i = 1;
|
1113
|
+
* for await (const blob of containerClient.findBlobsByTags("tagkey='tagvalue'")) {
|
1114
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1115
|
+
* }
|
1116
|
+
* ```
|
1117
|
+
*
|
1118
|
+
* Example using `iter.next()`:
|
1119
|
+
*
|
1120
|
+
* ```js
|
1121
|
+
* let i = 1;
|
1122
|
+
* const iter = containerClient.findBlobsByTags("tagkey='tagvalue'");
|
1123
|
+
* let blobItem = await iter.next();
|
1124
|
+
* while (!blobItem.done) {
|
1125
|
+
* console.log(`Blob ${i++}: ${blobItem.value.name}`);
|
1126
|
+
* blobItem = await iter.next();
|
1127
|
+
* }
|
1128
|
+
* ```
|
1129
|
+
*
|
1130
|
+
* Example using `byPage()`:
|
1131
|
+
*
|
1132
|
+
* ```js
|
1133
|
+
* // passing optional maxPageSize in the page settings
|
1134
|
+
* let i = 1;
|
1135
|
+
* for await (const response of containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 20 })) {
|
1136
|
+
* if (response.blobs) {
|
1137
|
+
* for (const blob of response.blobs) {
|
1138
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1139
|
+
* }
|
1140
|
+
* }
|
1141
|
+
* }
|
1142
|
+
* ```
|
1143
|
+
*
|
1144
|
+
* Example using paging with a marker:
|
1145
|
+
*
|
1146
|
+
* ```js
|
1147
|
+
* let i = 1;
|
1148
|
+
* let iterator = containerClient.findBlobsByTags("tagkey='tagvalue'").byPage({ maxPageSize: 2 });
|
1149
|
+
* let response = (await iterator.next()).value;
|
1150
|
+
*
|
1151
|
+
* // Prints 2 blob names
|
1152
|
+
* if (response.blobs) {
|
1153
|
+
* for (const blob of response.blobs) {
|
1154
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1155
|
+
* }
|
1156
|
+
* }
|
1157
|
+
*
|
1158
|
+
* // Gets next marker
|
1159
|
+
* let marker = response.continuationToken;
|
1160
|
+
* // Passing next marker as continuationToken
|
1161
|
+
* iterator = containerClient
|
1162
|
+
* .findBlobsByTags("tagkey='tagvalue'")
|
1163
|
+
* .byPage({ continuationToken: marker, maxPageSize: 10 });
|
1164
|
+
* response = (await iterator.next()).value;
|
1165
|
+
*
|
1166
|
+
* // Prints blob names
|
1167
|
+
* if (response.blobs) {
|
1168
|
+
* for (const blob of response.blobs) {
|
1169
|
+
* console.log(`Blob ${i++}: ${blob.name}`);
|
1170
|
+
* }
|
1171
|
+
* }
|
1172
|
+
* ```
|
1173
|
+
*
|
1174
|
+
* @param tagFilterSqlExpression - The where parameter enables the caller to query blobs whose tags match a given expression.
|
1175
|
+
* The given expression must evaluate to true for a blob to be returned in the results.
|
1176
|
+
* The[OData - ABNF] filter syntax rule defines the formal grammar for the value of the where query parameter;
|
1177
|
+
* however, only a subset of the OData filter syntax is supported in the Blob service.
|
1178
|
+
* @param options - Options to find blobs by tags.
|
1179
|
+
*/
|
1180
|
+
findBlobsByTags(tagFilterSqlExpression, options = {}) {
|
1181
|
+
// AsyncIterableIterator to iterate over blobs
|
1182
|
+
const listSegmentOptions = Object.assign({}, options);
|
1183
|
+
const iter = this.findBlobsByTagsItems(tagFilterSqlExpression, listSegmentOptions);
|
1184
|
+
return {
|
1185
|
+
/**
|
1186
|
+
* The next method, part of the iteration protocol
|
1187
|
+
*/
|
1188
|
+
next() {
|
1189
|
+
return iter.next();
|
1190
|
+
},
|
1191
|
+
/**
|
1192
|
+
* The connection to the async iterator, part of the iteration protocol
|
1193
|
+
*/
|
1194
|
+
[Symbol.asyncIterator]() {
|
1195
|
+
return this;
|
1196
|
+
},
|
1197
|
+
/**
|
1198
|
+
* Return an AsyncIterableIterator that works a page at a time
|
1199
|
+
*/
|
1200
|
+
byPage: (settings = {}) => {
|
1201
|
+
return this.findBlobsByTagsSegments(tagFilterSqlExpression, settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, listSegmentOptions));
|
1202
|
+
},
|
982
1203
|
};
|
983
1204
|
}
|
984
1205
|
getContainerNameFromUrl() {
|