@azure/data-tables 13.0.2-alpha.20220211.1 → 13.1.0-alpha.20220218.1
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 -1
- package/dist/index.js +176 -247
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +71 -138
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TableServiceClient.js +37 -78
- package/dist-esm/src/TableServiceClient.js.map +1 -1
- package/dist-esm/src/TableTransaction.js +11 -23
- package/dist-esm/src/TableTransaction.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/secondaryEndpointPolicy.js +46 -0
- package/dist-esm/src/secondaryEndpointPolicy.js.map +1 -0
- package/dist-esm/src/utils/connectionString.js.map +1 -1
- package/dist-esm/src/utils/errorHelpers.js +1 -3
- package/dist-esm/src/utils/errorHelpers.js.map +1 -1
- package/dist-esm/src/utils/tracing.js +5 -4
- package/dist-esm/src/utils/tracing.js.map +1 -1
- package/package.json +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
## 13.0
|
|
3
|
+
## 13.1.0 (Unreleased)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
6
|
|
|
@@ -8,8 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
### Bugs Fixed
|
|
10
10
|
|
|
11
|
+
- Fix issue with `getStatistics()` operation consistently failing and added test. [#20398](https://github.com/Azure/azure-sdk-for-js/pull/20398)
|
|
12
|
+
|
|
11
13
|
### Other Changes
|
|
12
14
|
|
|
15
|
+
- Updated our `@azure/core-tracing` dependency to the latest version (1.0.0-preview.14)
|
|
16
|
+
- Notable changes include Removal of `@opentelemetry/api` as a transitive dependency and ensuring that the active context is properly propagated.
|
|
17
|
+
- Customers who would like to continue using OpenTelemetry driven tracing should visit our [OpenTelemetry Instrumentation](https://www.npmjs.com/package/@azure/opentelemetry-instrumentation-azure-sdk) package for instructions.
|
|
18
|
+
|
|
13
19
|
## 13.0.1 (2022-01-12)
|
|
14
20
|
|
|
15
21
|
### Bugs Fixed
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,10 @@ require('@azure/core-paging');
|
|
|
7
7
|
var coreAuth = require('@azure/core-auth');
|
|
8
8
|
var coreXml = require('@azure/core-xml');
|
|
9
9
|
var coreClient = require('@azure/core-client');
|
|
10
|
-
var coreTracing = require('@azure/core-tracing');
|
|
11
10
|
var url$1 = require('url');
|
|
12
11
|
var logger$1 = require('@azure/logger');
|
|
13
12
|
var crypto = require('crypto');
|
|
13
|
+
var coreTracing = require('@azure/core-tracing');
|
|
14
14
|
var coreRestPipeline = require('@azure/core-rest-pipeline');
|
|
15
15
|
var uuid = require('uuid');
|
|
16
16
|
|
|
@@ -761,6 +761,52 @@ function generateTableSas(tableName, credential, options = {}) {
|
|
|
761
761
|
return sas;
|
|
762
762
|
}
|
|
763
763
|
|
|
764
|
+
// Copyright (c) Microsoft Corporation.
|
|
765
|
+
// Licensed under the MIT license.
|
|
766
|
+
/**
|
|
767
|
+
* The programmatic identifier of the tablesSecondaryEndpointPolicy.
|
|
768
|
+
*/
|
|
769
|
+
const tablesSecondaryEndpointPolicyName = "tablesSecondaryEndpointPolicy";
|
|
770
|
+
const SecondaryLocationHeaderName = "tables-secondary-endpoint";
|
|
771
|
+
const SecondaryLocationAccountSuffix = "-secondary";
|
|
772
|
+
/**
|
|
773
|
+
* Policy that would replace the Primary Endpoint with the secondary endpoint
|
|
774
|
+
* when the `tables-secondary-endpoint` is set in the request
|
|
775
|
+
*/
|
|
776
|
+
const tablesSecondaryEndpointPolicy = {
|
|
777
|
+
name: tablesSecondaryEndpointPolicyName,
|
|
778
|
+
sendRequest: async (req, next) => {
|
|
779
|
+
// Only replace the URL if the SecondaryLocationHeader is set
|
|
780
|
+
if (req.headers.get(SecondaryLocationHeaderName)) {
|
|
781
|
+
// Since the header is for internal use only, clean it up.
|
|
782
|
+
req.headers.delete(SecondaryLocationHeaderName);
|
|
783
|
+
// Calculate and update the secondary url
|
|
784
|
+
req.url = getSecondaryUrlFromPrimary(req.url);
|
|
785
|
+
}
|
|
786
|
+
return next(req);
|
|
787
|
+
},
|
|
788
|
+
};
|
|
789
|
+
/**
|
|
790
|
+
* Utility function that injects the SecondaryEndpointHeader into an operation options
|
|
791
|
+
*/
|
|
792
|
+
function injectSecondaryEndpointHeader(options) {
|
|
793
|
+
var _a;
|
|
794
|
+
const headerToInject = { [SecondaryLocationHeaderName]: "true" };
|
|
795
|
+
return Object.assign(Object.assign({}, options), { requestOptions: Object.assign(Object.assign({}, options.requestOptions), { customHeaders: Object.assign(Object.assign({}, (_a = options.requestOptions) === null || _a === void 0 ? void 0 : _a.customHeaders), headerToInject) }) });
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Utility function that calculates the secondary URL for a table instance given the primary URL.
|
|
799
|
+
*/
|
|
800
|
+
function getSecondaryUrlFromPrimary(primaryUrl) {
|
|
801
|
+
const parsedPrimaryUrl = new URL(primaryUrl);
|
|
802
|
+
const host = parsedPrimaryUrl.hostname.split(".");
|
|
803
|
+
if (host.length > 1) {
|
|
804
|
+
host[0] = `${host[0]}${SecondaryLocationAccountSuffix}`;
|
|
805
|
+
}
|
|
806
|
+
parsedPrimaryUrl.hostname = host.join(".");
|
|
807
|
+
return parsedPrimaryUrl.toString();
|
|
808
|
+
}
|
|
809
|
+
|
|
764
810
|
/*
|
|
765
811
|
* Copyright (c) Microsoft Corporation.
|
|
766
812
|
* Licensed under the MIT License.
|
|
@@ -3090,7 +3136,7 @@ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
|
|
|
3090
3136
|
const defaults = {
|
|
3091
3137
|
requestContentType: "application/json; charset=utf-8"
|
|
3092
3138
|
};
|
|
3093
|
-
const packageDetails = `azsdk-js-data-tables/13.0
|
|
3139
|
+
const packageDetails = `azsdk-js-data-tables/13.1.0`;
|
|
3094
3140
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
3095
3141
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
3096
3142
|
: `${packageDetails}`;
|
|
@@ -3126,16 +3172,6 @@ class GeneratedClient extends GeneratedClientContext {
|
|
|
3126
3172
|
}
|
|
3127
3173
|
}
|
|
3128
3174
|
|
|
3129
|
-
// Copyright (c) Microsoft Corporation.
|
|
3130
|
-
/**
|
|
3131
|
-
* Creates a span using the global tracer.
|
|
3132
|
-
* @internal
|
|
3133
|
-
*/
|
|
3134
|
-
const createSpan = coreTracing.createSpanFunction({
|
|
3135
|
-
packagePrefix: "Azure.Data.Tables",
|
|
3136
|
-
namespace: "Microsoft.Data.Tables",
|
|
3137
|
-
});
|
|
3138
|
-
|
|
3139
3175
|
// Copyright (c) Microsoft Corporation.
|
|
3140
3176
|
/**
|
|
3141
3177
|
* Gets client parameters from an Account Connection String
|
|
@@ -3308,8 +3344,9 @@ function getAccountNameFromUrl(url) {
|
|
|
3308
3344
|
}
|
|
3309
3345
|
|
|
3310
3346
|
// Copyright (c) Microsoft Corporation.
|
|
3347
|
+
// Licensed under the MIT license.
|
|
3311
3348
|
function handleTableAlreadyExists(error, options = {}) {
|
|
3312
|
-
var _a, _b
|
|
3349
|
+
var _a, _b;
|
|
3313
3350
|
const responseError = getErrorResponse(error);
|
|
3314
3351
|
if (responseError &&
|
|
3315
3352
|
responseError.status === 409 &&
|
|
@@ -3320,7 +3357,6 @@ function handleTableAlreadyExists(error, options = {}) {
|
|
|
3320
3357
|
}
|
|
3321
3358
|
}
|
|
3322
3359
|
else {
|
|
3323
|
-
options === null || options === void 0 ? void 0 : options.span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: (_c = error) === null || _c === void 0 ? void 0 : _c.message });
|
|
3324
3360
|
throw error;
|
|
3325
3361
|
}
|
|
3326
3362
|
}
|
|
@@ -3438,6 +3474,17 @@ function signURLWithSAS(request, credential) {
|
|
|
3438
3474
|
request.url = url.toString();
|
|
3439
3475
|
}
|
|
3440
3476
|
|
|
3477
|
+
// Copyright (c) Microsoft Corporation.
|
|
3478
|
+
/**
|
|
3479
|
+
* A tracing client that can be used to manage spans.
|
|
3480
|
+
* @internal
|
|
3481
|
+
*/
|
|
3482
|
+
const tracingClient = coreTracing.createTracingClient({
|
|
3483
|
+
namespace: "Microsoft.Data.Tables",
|
|
3484
|
+
packageName: "@azure/data-tables",
|
|
3485
|
+
packageVersion: "13.1.0",
|
|
3486
|
+
});
|
|
3487
|
+
|
|
3441
3488
|
// Copyright (c) Microsoft Corporation.
|
|
3442
3489
|
/**
|
|
3443
3490
|
* A TableServiceClient represents a Client to the Azure Tables service allowing you
|
|
@@ -3462,6 +3509,7 @@ class TableServiceClient {
|
|
|
3462
3509
|
},
|
|
3463
3510
|
}), (coreAuth.isTokenCredential(credential) && { credential, credentialScopes: STORAGE_SCOPE }));
|
|
3464
3511
|
const client = new GeneratedClient(this.url, internalPipelineOptions);
|
|
3512
|
+
client.pipeline.addPolicy(tablesSecondaryEndpointPolicy);
|
|
3465
3513
|
if (coreAuth.isNamedKeyCredential(credential)) {
|
|
3466
3514
|
client.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));
|
|
3467
3515
|
}
|
|
@@ -3478,35 +3526,15 @@ class TableServiceClient {
|
|
|
3478
3526
|
* @param options - The options parameters.
|
|
3479
3527
|
*/
|
|
3480
3528
|
async getStatistics(options = {}) {
|
|
3481
|
-
|
|
3482
|
-
try {
|
|
3483
|
-
return await this.service.getStatistics(updatedOptions);
|
|
3484
|
-
}
|
|
3485
|
-
catch (e) {
|
|
3486
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
3487
|
-
throw e;
|
|
3488
|
-
}
|
|
3489
|
-
finally {
|
|
3490
|
-
span.end();
|
|
3491
|
-
}
|
|
3529
|
+
return tracingClient.withSpan("TableServiceClient.getStatistics", options, (updatedOptions) => this.service.getStatistics(injectSecondaryEndpointHeader(updatedOptions)));
|
|
3492
3530
|
}
|
|
3493
3531
|
/**
|
|
3494
3532
|
* Gets the properties of an account's Table service, including properties for Analytics and CORS
|
|
3495
3533
|
* (Cross-Origin Resource Sharing) rules.
|
|
3496
3534
|
* @param options - The options parameters.
|
|
3497
3535
|
*/
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
try {
|
|
3501
|
-
return await this.service.getProperties(updatedOptions);
|
|
3502
|
-
}
|
|
3503
|
-
catch (e) {
|
|
3504
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
3505
|
-
throw e;
|
|
3506
|
-
}
|
|
3507
|
-
finally {
|
|
3508
|
-
span.end();
|
|
3509
|
-
}
|
|
3536
|
+
getProperties(options = {}) {
|
|
3537
|
+
return tracingClient.withSpan("TableServiceClient.getProperties", options, (updatedOptions) => this.service.getProperties(updatedOptions));
|
|
3510
3538
|
}
|
|
3511
3539
|
/**
|
|
3512
3540
|
* Sets properties for an account's Table service endpoint, including properties for Analytics and CORS
|
|
@@ -3514,58 +3542,43 @@ class TableServiceClient {
|
|
|
3514
3542
|
* @param properties - The Table Service properties.
|
|
3515
3543
|
* @param options - The options parameters.
|
|
3516
3544
|
*/
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
try {
|
|
3520
|
-
return await this.service.setProperties(properties, updatedOptions);
|
|
3521
|
-
}
|
|
3522
|
-
catch (e) {
|
|
3523
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
3524
|
-
throw e;
|
|
3525
|
-
}
|
|
3526
|
-
finally {
|
|
3527
|
-
span.end();
|
|
3528
|
-
}
|
|
3545
|
+
setProperties(properties, options = {}) {
|
|
3546
|
+
return tracingClient.withSpan("TableServiceClient.setProperties", options, (updatedOptions) => this.service.setProperties(properties, updatedOptions));
|
|
3529
3547
|
}
|
|
3530
3548
|
/**
|
|
3531
3549
|
* Creates a new table under the given account.
|
|
3532
3550
|
* @param name - The name of the table.
|
|
3533
3551
|
* @param options - The options parameters.
|
|
3534
3552
|
*/
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
span.end();
|
|
3545
|
-
}
|
|
3553
|
+
createTable(name, options = {}) {
|
|
3554
|
+
return tracingClient.withSpan("TableServiceClient.createTable", options, async (updatedOptions) => {
|
|
3555
|
+
try {
|
|
3556
|
+
await this.table.create({ name }, updatedOptions);
|
|
3557
|
+
}
|
|
3558
|
+
catch (e) {
|
|
3559
|
+
handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: name }));
|
|
3560
|
+
}
|
|
3561
|
+
});
|
|
3546
3562
|
}
|
|
3547
3563
|
/**
|
|
3548
3564
|
* Operation permanently deletes the specified table.
|
|
3549
3565
|
* @param name - The name of the table.
|
|
3550
3566
|
* @param options - The options parameters.
|
|
3551
3567
|
*/
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
}
|
|
3557
|
-
catch (e) {
|
|
3558
|
-
if (e.statusCode === 404) {
|
|
3559
|
-
logger.info("TableServiceClient-deleteTable: Table doesn't exist");
|
|
3568
|
+
deleteTable(name, options = {}) {
|
|
3569
|
+
return tracingClient.withSpan("TableServiceClient.deleteTable", options, async (updatedOptions) => {
|
|
3570
|
+
try {
|
|
3571
|
+
await this.table.delete(name, updatedOptions);
|
|
3560
3572
|
}
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3573
|
+
catch (e) {
|
|
3574
|
+
if (e.statusCode === 404) {
|
|
3575
|
+
logger.info("TableServiceClient.deleteTable: Table doesn't exist");
|
|
3576
|
+
}
|
|
3577
|
+
else {
|
|
3578
|
+
throw e;
|
|
3579
|
+
}
|
|
3564
3580
|
}
|
|
3565
|
-
}
|
|
3566
|
-
finally {
|
|
3567
|
-
span.end();
|
|
3568
|
-
}
|
|
3581
|
+
});
|
|
3569
3582
|
}
|
|
3570
3583
|
/**
|
|
3571
3584
|
* Queries tables under the given account.
|
|
@@ -3617,22 +3630,15 @@ class TableServiceClient {
|
|
|
3617
3630
|
}
|
|
3618
3631
|
listTablesPage(options = {}) {
|
|
3619
3632
|
return tslib.__asyncGenerator(this, arguments, function* listTablesPage_1() {
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3633
|
+
let result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions)));
|
|
3634
|
+
yield yield tslib.__await(result);
|
|
3635
|
+
while (result.continuationToken) {
|
|
3636
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
|
|
3637
|
+
result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
|
|
3638
|
+
span.setAttribute("continuationToken", updatedOptions.continuationToken);
|
|
3639
|
+
return this._listTables(updatedOptions);
|
|
3640
|
+
}));
|
|
3623
3641
|
yield yield tslib.__await(result);
|
|
3624
|
-
while (result.continuationToken) {
|
|
3625
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
|
|
3626
|
-
result = yield tslib.__await(this._listTables(optionsWithContinuation));
|
|
3627
|
-
yield yield tslib.__await(result);
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
catch (e) {
|
|
3631
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
3632
|
-
throw e;
|
|
3633
|
-
}
|
|
3634
|
-
finally {
|
|
3635
|
-
span.end();
|
|
3636
3642
|
}
|
|
3637
3643
|
});
|
|
3638
3644
|
}
|
|
@@ -3970,29 +3976,18 @@ class InternalTableTransaction {
|
|
|
3970
3976
|
await Promise.all(this.resetableState.pendingOperations);
|
|
3971
3977
|
const body = getTransactionHttpRequestBody(this.resetableState.bodyParts, this.resetableState.transactionId, this.resetableState.changesetId);
|
|
3972
3978
|
const headers = getTransactionHeaders(this.resetableState.transactionId);
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
try {
|
|
3979
|
+
return tracingClient.withSpan("TableTransaction.submitTransaction", {}, async (updatedOptions) => {
|
|
3980
|
+
const request = coreRestPipeline.createPipelineRequest({
|
|
3981
|
+
url: this.url,
|
|
3982
|
+
method: "POST",
|
|
3983
|
+
body,
|
|
3984
|
+
headers: coreRestPipeline.createHttpHeaders(headers),
|
|
3985
|
+
tracingOptions: updatedOptions.tracingOptions,
|
|
3986
|
+
allowInsecureConnection: this.allowInsecureConnection,
|
|
3987
|
+
});
|
|
3983
3988
|
const rawTransactionResponse = await this.client.sendRequest(request);
|
|
3984
3989
|
return parseTransactionResponse(rawTransactionResponse);
|
|
3985
|
-
}
|
|
3986
|
-
catch (error) {
|
|
3987
|
-
span.setStatus({
|
|
3988
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
3989
|
-
message: error.message,
|
|
3990
|
-
});
|
|
3991
|
-
throw error;
|
|
3992
|
-
}
|
|
3993
|
-
finally {
|
|
3994
|
-
span.end();
|
|
3995
|
-
}
|
|
3990
|
+
});
|
|
3996
3991
|
}
|
|
3997
3992
|
checkPartitionKey(partitionKey) {
|
|
3998
3993
|
if (this.resetableState.partitionKey !== partitionKey) {
|
|
@@ -4453,23 +4448,17 @@ class TableClient {
|
|
|
4453
4448
|
* ```
|
|
4454
4449
|
*/
|
|
4455
4450
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
}
|
|
4461
|
-
catch (e) {
|
|
4462
|
-
if (e.statusCode === 404) {
|
|
4463
|
-
logger.info("TableClient-deleteTable: Table doesn't exist");
|
|
4451
|
+
deleteTable(options = {}) {
|
|
4452
|
+
return tracingClient.withSpan("TableClient.deleteTable", options, async (updatedOptions) => {
|
|
4453
|
+
try {
|
|
4454
|
+
await this.table.delete(this.tableName, updatedOptions);
|
|
4464
4455
|
}
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4456
|
+
catch (e) {
|
|
4457
|
+
if (e.statusCode === 404) {
|
|
4458
|
+
logger.info("TableClient.deleteTable: Table doesn't exist");
|
|
4459
|
+
}
|
|
4468
4460
|
}
|
|
4469
|
-
}
|
|
4470
|
-
finally {
|
|
4471
|
-
span.end();
|
|
4472
|
-
}
|
|
4461
|
+
});
|
|
4473
4462
|
}
|
|
4474
4463
|
/**
|
|
4475
4464
|
* Creates a table with the tableName passed to the client constructor
|
|
@@ -4497,17 +4486,15 @@ class TableClient {
|
|
|
4497
4486
|
* ```
|
|
4498
4487
|
*/
|
|
4499
4488
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
span.end();
|
|
4510
|
-
}
|
|
4489
|
+
createTable(options = {}) {
|
|
4490
|
+
return tracingClient.withSpan("TableClient.createTable", options, async (updatedOptions) => {
|
|
4491
|
+
try {
|
|
4492
|
+
await this.table.create({ name: this.tableName }, updatedOptions);
|
|
4493
|
+
}
|
|
4494
|
+
catch (e) {
|
|
4495
|
+
handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: this.tableName }));
|
|
4496
|
+
}
|
|
4497
|
+
});
|
|
4511
4498
|
}
|
|
4512
4499
|
/**
|
|
4513
4500
|
* Returns a single entity in the table.
|
|
@@ -4536,30 +4523,22 @@ class TableClient {
|
|
|
4536
4523
|
* console.log(entity);
|
|
4537
4524
|
* ```
|
|
4538
4525
|
*/
|
|
4539
|
-
|
|
4526
|
+
getEntity(partitionKey, rowKey,
|
|
4540
4527
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4541
4528
|
options = {}) {
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4529
|
+
return tracingClient.withSpan("TableClient.getEntity", options, async (updatedOptions) => {
|
|
4530
|
+
let parsedBody;
|
|
4531
|
+
function onResponse(rawResponse, flatResponse) {
|
|
4532
|
+
parsedBody = rawResponse.parsedBody;
|
|
4533
|
+
if (updatedOptions.onResponse) {
|
|
4534
|
+
updatedOptions.onResponse(rawResponse, flatResponse);
|
|
4535
|
+
}
|
|
4548
4536
|
}
|
|
4549
|
-
|
|
4550
|
-
try {
|
|
4551
|
-
const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
|
|
4537
|
+
const { disableTypeConversion, queryOptions } = updatedOptions, getEntityOptions = tslib.__rest(updatedOptions, ["disableTypeConversion", "queryOptions"]);
|
|
4552
4538
|
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
|
|
4553
4539
|
const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
|
|
4554
4540
|
return tableEntity;
|
|
4555
|
-
}
|
|
4556
|
-
catch (e) {
|
|
4557
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
4558
|
-
throw e;
|
|
4559
|
-
}
|
|
4560
|
-
finally {
|
|
4561
|
-
span.end();
|
|
4562
|
-
}
|
|
4541
|
+
});
|
|
4563
4542
|
}
|
|
4564
4543
|
/**
|
|
4565
4544
|
* Queries entities in a table.
|
|
@@ -4637,25 +4616,15 @@ class TableClient {
|
|
|
4637
4616
|
}
|
|
4638
4617
|
listEntitiesPage(tableName, options = {}) {
|
|
4639
4618
|
return tslib.__asyncGenerator(this, arguments, function* listEntitiesPage_1() {
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4619
|
+
let result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions)));
|
|
4620
|
+
yield yield tslib.__await(result);
|
|
4621
|
+
while (result.continuationToken) {
|
|
4622
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
|
|
4623
|
+
result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
|
|
4624
|
+
span.setAttribute("continuationToken", result.continuationToken);
|
|
4625
|
+
return this._listEntities(tableName, updatedOptions);
|
|
4626
|
+
}));
|
|
4643
4627
|
yield yield tslib.__await(result);
|
|
4644
|
-
while (result.continuationToken) {
|
|
4645
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
|
|
4646
|
-
result = yield tslib.__await(this._listEntities(tableName, optionsWithContinuation));
|
|
4647
|
-
yield yield tslib.__await(result);
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
catch (e) {
|
|
4651
|
-
span.setStatus({
|
|
4652
|
-
code: coreTracing.SpanStatusCode.ERROR,
|
|
4653
|
-
message: e.message,
|
|
4654
|
-
});
|
|
4655
|
-
throw e;
|
|
4656
|
-
}
|
|
4657
|
-
finally {
|
|
4658
|
-
span.end();
|
|
4659
4628
|
}
|
|
4660
4629
|
});
|
|
4661
4630
|
}
|
|
@@ -4703,21 +4672,13 @@ class TableClient {
|
|
|
4703
4672
|
* await client.createEntity({partitionKey: "p1", rowKey: "r1", foo: "Hello!"});
|
|
4704
4673
|
* ```
|
|
4705
4674
|
*/
|
|
4706
|
-
|
|
4675
|
+
createEntity(entity,
|
|
4707
4676
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4708
4677
|
options = {}) {
|
|
4709
|
-
|
|
4710
|
-
try {
|
|
4678
|
+
return tracingClient.withSpan("TableClient.createEntity", options, (updatedOptions) => {
|
|
4711
4679
|
const createTableEntity = tslib.__rest(updatedOptions || {}, []);
|
|
4712
|
-
return
|
|
4713
|
-
}
|
|
4714
|
-
catch (e) {
|
|
4715
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
4716
|
-
throw e;
|
|
4717
|
-
}
|
|
4718
|
-
finally {
|
|
4719
|
-
span.end();
|
|
4720
|
-
}
|
|
4680
|
+
return this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
|
|
4681
|
+
});
|
|
4721
4682
|
}
|
|
4722
4683
|
/**
|
|
4723
4684
|
* Deletes the specified entity in the table.
|
|
@@ -4744,22 +4705,14 @@ class TableClient {
|
|
|
4744
4705
|
* await client.deleteEntity("<partitionKey>", "<rowKey>")
|
|
4745
4706
|
* ```
|
|
4746
4707
|
*/
|
|
4747
|
-
|
|
4708
|
+
deleteEntity(partitionKey, rowKey,
|
|
4748
4709
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4749
4710
|
options = {}) {
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
|
|
4711
|
+
return tracingClient.withSpan("TableClient.deleteEntity", options, (updatedOptions) => {
|
|
4712
|
+
const { etag = "*" } = updatedOptions, rest = tslib.__rest(updatedOptions, ["etag"]);
|
|
4753
4713
|
const deleteOptions = Object.assign({}, rest);
|
|
4754
|
-
return
|
|
4755
|
-
}
|
|
4756
|
-
catch (e) {
|
|
4757
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
4758
|
-
throw e;
|
|
4759
|
-
}
|
|
4760
|
-
finally {
|
|
4761
|
-
span.end();
|
|
4762
|
-
}
|
|
4714
|
+
return this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
|
|
4715
|
+
});
|
|
4763
4716
|
}
|
|
4764
4717
|
/**
|
|
4765
4718
|
* Update an entity in the table.
|
|
@@ -4800,29 +4753,25 @@ class TableClient {
|
|
|
4800
4753
|
* await client.updateEntity(entity, "Replace")
|
|
4801
4754
|
* ```
|
|
4802
4755
|
*/
|
|
4803
|
-
|
|
4756
|
+
updateEntity(entity, mode = "Merge",
|
|
4804
4757
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4805
4758
|
options = {}) {
|
|
4806
|
-
|
|
4807
|
-
try {
|
|
4759
|
+
return tracingClient.withSpan("TableClient.updateEntity", options, async (updatedOptions) => {
|
|
4808
4760
|
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4809
4761
|
const rowKey = escapeQuotes(entity.rowKey);
|
|
4810
4762
|
const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
|
|
4811
4763
|
if (mode === "Merge") {
|
|
4812
|
-
return
|
|
4764
|
+
return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4813
4765
|
}
|
|
4814
4766
|
if (mode === "Replace") {
|
|
4815
|
-
return
|
|
4767
|
+
return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4816
4768
|
}
|
|
4817
4769
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4818
|
-
}
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
}
|
|
4823
|
-
finally {
|
|
4824
|
-
span.end();
|
|
4825
|
-
}
|
|
4770
|
+
}, {
|
|
4771
|
+
spanAttributes: {
|
|
4772
|
+
updateEntityMode: mode,
|
|
4773
|
+
},
|
|
4774
|
+
});
|
|
4826
4775
|
}
|
|
4827
4776
|
/**
|
|
4828
4777
|
* Upsert an entity in the table.
|
|
@@ -4859,66 +4808,46 @@ class TableClient {
|
|
|
4859
4808
|
* await client.upsertEntity(entity, "Replace")
|
|
4860
4809
|
* ```
|
|
4861
4810
|
*/
|
|
4862
|
-
|
|
4811
|
+
upsertEntity(entity, mode = "Merge",
|
|
4863
4812
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4864
4813
|
options = {}) {
|
|
4865
|
-
|
|
4866
|
-
try {
|
|
4814
|
+
return tracingClient.withSpan("TableClient.upsertEntity", options, async (updatedOptions) => {
|
|
4867
4815
|
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4868
4816
|
const rowKey = escapeQuotes(entity.rowKey);
|
|
4869
4817
|
if (mode === "Merge") {
|
|
4870
|
-
return
|
|
4818
|
+
return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4871
4819
|
}
|
|
4872
4820
|
if (mode === "Replace") {
|
|
4873
|
-
return
|
|
4821
|
+
return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4874
4822
|
}
|
|
4875
4823
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4876
|
-
}
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
}
|
|
4881
|
-
finally {
|
|
4882
|
-
span.end();
|
|
4883
|
-
}
|
|
4824
|
+
}, {
|
|
4825
|
+
spanAttributes: {
|
|
4826
|
+
upsertEntityMode: mode,
|
|
4827
|
+
},
|
|
4828
|
+
});
|
|
4884
4829
|
}
|
|
4885
4830
|
/**
|
|
4886
4831
|
* Retrieves details about any stored access policies specified on the table that may be used with
|
|
4887
4832
|
* Shared Access Signatures.
|
|
4888
4833
|
* @param options - The options parameters.
|
|
4889
4834
|
*/
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
try {
|
|
4835
|
+
getAccessPolicy(options = {}) {
|
|
4836
|
+
return tracingClient.withSpan("TableClient.getAccessPolicy", options, async (updatedOptions) => {
|
|
4893
4837
|
const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);
|
|
4894
4838
|
return deserializeSignedIdentifier(signedIdentifiers);
|
|
4895
|
-
}
|
|
4896
|
-
catch (e) {
|
|
4897
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
4898
|
-
throw e;
|
|
4899
|
-
}
|
|
4900
|
-
finally {
|
|
4901
|
-
span.end();
|
|
4902
|
-
}
|
|
4839
|
+
});
|
|
4903
4840
|
}
|
|
4904
4841
|
/**
|
|
4905
4842
|
* Sets stored access policies for the table that may be used with Shared Access Signatures.
|
|
4906
4843
|
* @param tableAcl - The Access Control List for the table.
|
|
4907
4844
|
* @param options - The options parameters.
|
|
4908
4845
|
*/
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
try {
|
|
4846
|
+
setAccessPolicy(tableAcl, options = {}) {
|
|
4847
|
+
return tracingClient.withSpan("TableClient.setAccessPolicy", options, (updatedOptions) => {
|
|
4912
4848
|
const serlializedAcl = serializeSignedIdentifiers(tableAcl);
|
|
4913
|
-
return
|
|
4914
|
-
}
|
|
4915
|
-
catch (e) {
|
|
4916
|
-
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
4917
|
-
throw e;
|
|
4918
|
-
}
|
|
4919
|
-
finally {
|
|
4920
|
-
span.end();
|
|
4921
|
-
}
|
|
4849
|
+
return this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
|
|
4850
|
+
});
|
|
4922
4851
|
}
|
|
4923
4852
|
/**
|
|
4924
4853
|
* Submits a Transaction which is composed of a set of actions. You can provide the actions as a list
|