@azure/data-tables 13.0.2-alpha.20220125.1 → 13.1.0-alpha.20220216.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/dist/index.js CHANGED
@@ -3,17 +3,37 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var tslib = require('tslib');
6
- var coreAuth = require('@azure/core-auth');
7
- var crypto = require('crypto');
8
6
  require('@azure/core-paging');
7
+ var coreAuth = require('@azure/core-auth');
9
8
  var coreXml = require('@azure/core-xml');
10
9
  var coreClient = require('@azure/core-client');
11
- var coreTracing = require('@azure/core-tracing');
12
10
  var url$1 = require('url');
13
11
  var logger$1 = require('@azure/logger');
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
 
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
36
+
17
37
  /*
18
38
  * Copyright (c) Microsoft Corporation.
19
39
  * Licensed under the MIT License.
@@ -34,6 +54,8 @@ var KnownResponseFormat;
34
54
  KnownResponseFormat["ReturnNoContent"] = "return-no-content";
35
55
  KnownResponseFormat["ReturnContent"] = "return-content";
36
56
  })(KnownResponseFormat || (KnownResponseFormat = {}));
57
+ /** Known values of {@link GeoReplicationStatusType} that the service accepts. */
58
+ exports.KnownGeoReplicationStatusType = void 0;
37
59
  (function (KnownGeoReplicationStatusType) {
38
60
  KnownGeoReplicationStatusType["Live"] = "live";
39
61
  KnownGeoReplicationStatusType["Bootstrap"] = "bootstrap";
@@ -2596,8 +2618,8 @@ class TableImpl {
2596
2618
  }
2597
2619
  }
2598
2620
  // Operation Specifications
2599
- const xmlSerializer = coreClient.createSerializer(Mappers, /* isXml */ true);
2600
- const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
2621
+ const xmlSerializer$1 = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
2622
+ const serializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
2601
2623
  const queryOperationSpec = {
2602
2624
  path: "/Tables",
2603
2625
  httpMethod: "GET",
@@ -2897,7 +2919,7 @@ const getAccessPolicyOperationSpec = {
2897
2919
  accept2
2898
2920
  ],
2899
2921
  isXML: true,
2900
- serializer: xmlSerializer
2922
+ serializer: xmlSerializer$1
2901
2923
  };
2902
2924
  const setAccessPolicyOperationSpec = {
2903
2925
  path: "/{table}",
@@ -2923,7 +2945,7 @@ const setAccessPolicyOperationSpec = {
2923
2945
  isXML: true,
2924
2946
  contentType: "application/xml; charset=utf-8",
2925
2947
  mediaType: "xml",
2926
- serializer: xmlSerializer
2948
+ serializer: xmlSerializer$1
2927
2949
  };
2928
2950
 
2929
2951
  /*
@@ -2969,7 +2991,7 @@ class ServiceImpl {
2969
2991
  }
2970
2992
  }
2971
2993
  // Operation Specifications
2972
- const xmlSerializer$1 = coreClient.createSerializer(Mappers, /* isXml */ true);
2994
+ const xmlSerializer = coreClient__namespace.createSerializer(Mappers, /* isXml */ true);
2973
2995
  const setPropertiesOperationSpec = {
2974
2996
  path: "/",
2975
2997
  httpMethod: "PUT",
@@ -2994,7 +3016,7 @@ const setPropertiesOperationSpec = {
2994
3016
  isXML: true,
2995
3017
  contentType: "application/xml; charset=utf-8",
2996
3018
  mediaType: "xml",
2997
- serializer: xmlSerializer$1
3019
+ serializer: xmlSerializer
2998
3020
  };
2999
3021
  const getPropertiesOperationSpec = {
3000
3022
  path: "/",
@@ -3017,7 +3039,7 @@ const getPropertiesOperationSpec = {
3017
3039
  accept2
3018
3040
  ],
3019
3041
  isXML: true,
3020
- serializer: xmlSerializer$1
3042
+ serializer: xmlSerializer
3021
3043
  };
3022
3044
  const getStatisticsOperationSpec = {
3023
3045
  path: "/",
@@ -3040,7 +3062,7 @@ const getStatisticsOperationSpec = {
3040
3062
  accept2
3041
3063
  ],
3042
3064
  isXML: true,
3043
- serializer: xmlSerializer$1
3065
+ serializer: xmlSerializer
3044
3066
  };
3045
3067
 
3046
3068
  /*
@@ -3051,7 +3073,7 @@ const getStatisticsOperationSpec = {
3051
3073
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
3052
3074
  */
3053
3075
  /** @internal */
3054
- class GeneratedClientContext extends coreClient.ServiceClient {
3076
+ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
3055
3077
  /**
3056
3078
  * Initializes a new instance of the GeneratedClientContext class.
3057
3079
  * @param url The URL of the service account or table that is the target of the desired operation.
@@ -3068,7 +3090,7 @@ class GeneratedClientContext extends coreClient.ServiceClient {
3068
3090
  const defaults = {
3069
3091
  requestContentType: "application/json; charset=utf-8"
3070
3092
  };
3071
- const packageDetails = `azsdk-js-data-tables/13.0.2`;
3093
+ const packageDetails = `azsdk-js-data-tables/13.1.0`;
3072
3094
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3073
3095
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3074
3096
  : `${packageDetails}`;
@@ -3104,16 +3126,6 @@ class GeneratedClient extends GeneratedClientContext {
3104
3126
  }
3105
3127
  }
3106
3128
 
3107
- // Copyright (c) Microsoft Corporation.
3108
- /**
3109
- * Creates a span using the global tracer.
3110
- * @internal
3111
- */
3112
- const createSpan = coreTracing.createSpanFunction({
3113
- packagePrefix: "Azure.Data.Tables",
3114
- namespace: "Microsoft.Data.Tables",
3115
- });
3116
-
3117
3129
  // Copyright (c) Microsoft Corporation.
3118
3130
  /**
3119
3131
  * Gets client parameters from an Account Connection String
@@ -3286,8 +3298,9 @@ function getAccountNameFromUrl(url) {
3286
3298
  }
3287
3299
 
3288
3300
  // Copyright (c) Microsoft Corporation.
3301
+ // Licensed under the MIT license.
3289
3302
  function handleTableAlreadyExists(error, options = {}) {
3290
- var _a, _b, _c;
3303
+ var _a, _b;
3291
3304
  const responseError = getErrorResponse(error);
3292
3305
  if (responseError &&
3293
3306
  responseError.status === 409 &&
@@ -3298,7 +3311,6 @@ function handleTableAlreadyExists(error, options = {}) {
3298
3311
  }
3299
3312
  }
3300
3313
  else {
3301
- 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 });
3302
3314
  throw error;
3303
3315
  }
3304
3316
  }
@@ -3416,6 +3428,17 @@ function signURLWithSAS(request, credential) {
3416
3428
  request.url = url.toString();
3417
3429
  }
3418
3430
 
3431
+ // Copyright (c) Microsoft Corporation.
3432
+ /**
3433
+ * A tracing client that can be used to manage spans.
3434
+ * @internal
3435
+ */
3436
+ const tracingClient = coreTracing.createTracingClient({
3437
+ namespace: "Microsoft.Data.Tables",
3438
+ packageName: "@azure/data-tables",
3439
+ packageVersion: "13.1.0",
3440
+ });
3441
+
3419
3442
  // Copyright (c) Microsoft Corporation.
3420
3443
  /**
3421
3444
  * A TableServiceClient represents a Client to the Azure Tables service allowing you
@@ -3455,36 +3478,16 @@ class TableServiceClient {
3455
3478
  * secondary location endpoint when read-access geo-redundant replication is enabled for the account.
3456
3479
  * @param options - The options parameters.
3457
3480
  */
3458
- async getStatistics(options = {}) {
3459
- const { span, updatedOptions } = createSpan("TableServiceClient-getStatistics", options);
3460
- try {
3461
- return await this.service.getStatistics(updatedOptions);
3462
- }
3463
- catch (e) {
3464
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3465
- throw e;
3466
- }
3467
- finally {
3468
- span.end();
3469
- }
3481
+ getStatistics(options = {}) {
3482
+ return tracingClient.withSpan("TableServiceClient.getStatistics", options, (updatedOptions) => this.service.getStatistics(updatedOptions));
3470
3483
  }
3471
3484
  /**
3472
3485
  * Gets the properties of an account's Table service, including properties for Analytics and CORS
3473
3486
  * (Cross-Origin Resource Sharing) rules.
3474
3487
  * @param options - The options parameters.
3475
3488
  */
3476
- async getProperties(options = {}) {
3477
- const { span, updatedOptions } = createSpan("TableServiceClient-getProperties", options);
3478
- try {
3479
- return await this.service.getProperties(updatedOptions);
3480
- }
3481
- catch (e) {
3482
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3483
- throw e;
3484
- }
3485
- finally {
3486
- span.end();
3487
- }
3489
+ getProperties(options = {}) {
3490
+ return tracingClient.withSpan("TableServiceClient.getProperties", options, (updatedOptions) => this.service.getProperties(updatedOptions));
3488
3491
  }
3489
3492
  /**
3490
3493
  * Sets properties for an account's Table service endpoint, including properties for Analytics and CORS
@@ -3492,58 +3495,43 @@ class TableServiceClient {
3492
3495
  * @param properties - The Table Service properties.
3493
3496
  * @param options - The options parameters.
3494
3497
  */
3495
- async setProperties(properties, options = {}) {
3496
- const { span, updatedOptions } = createSpan("TableServiceClient-setProperties", options);
3497
- try {
3498
- return await this.service.setProperties(properties, updatedOptions);
3499
- }
3500
- catch (e) {
3501
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3502
- throw e;
3503
- }
3504
- finally {
3505
- span.end();
3506
- }
3498
+ setProperties(properties, options = {}) {
3499
+ return tracingClient.withSpan("TableServiceClient.setProperties", options, (updatedOptions) => this.service.setProperties(properties, updatedOptions));
3507
3500
  }
3508
3501
  /**
3509
3502
  * Creates a new table under the given account.
3510
3503
  * @param name - The name of the table.
3511
3504
  * @param options - The options parameters.
3512
3505
  */
3513
- async createTable(name, options = {}) {
3514
- const { span, updatedOptions } = createSpan("TableServiceClient-createTable", options);
3515
- try {
3516
- await this.table.create({ name }, Object.assign({}, updatedOptions));
3517
- }
3518
- catch (e) {
3519
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: name }));
3520
- }
3521
- finally {
3522
- span.end();
3523
- }
3506
+ createTable(name, options = {}) {
3507
+ return tracingClient.withSpan("TableServiceClient.createTable", options, async (updatedOptions) => {
3508
+ try {
3509
+ await this.table.create({ name }, updatedOptions);
3510
+ }
3511
+ catch (e) {
3512
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: name }));
3513
+ }
3514
+ });
3524
3515
  }
3525
3516
  /**
3526
3517
  * Operation permanently deletes the specified table.
3527
3518
  * @param name - The name of the table.
3528
3519
  * @param options - The options parameters.
3529
3520
  */
3530
- async deleteTable(name, options = {}) {
3531
- const { span, updatedOptions } = createSpan("TableServiceClient-deleteTable", options);
3532
- try {
3533
- await this.table.delete(name, updatedOptions);
3534
- }
3535
- catch (e) {
3536
- if (e.statusCode === 404) {
3537
- logger.info("TableServiceClient-deleteTable: Table doesn't exist");
3521
+ deleteTable(name, options = {}) {
3522
+ return tracingClient.withSpan("TableServiceClient.deleteTable", options, async (updatedOptions) => {
3523
+ try {
3524
+ await this.table.delete(name, updatedOptions);
3538
3525
  }
3539
- else {
3540
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3541
- throw e;
3526
+ catch (e) {
3527
+ if (e.statusCode === 404) {
3528
+ logger.info("TableServiceClient-deleteTable: Table doesn't exist");
3529
+ }
3530
+ else {
3531
+ throw e;
3532
+ }
3542
3533
  }
3543
- }
3544
- finally {
3545
- span.end();
3546
- }
3534
+ });
3547
3535
  }
3548
3536
  /**
3549
3537
  * Queries tables under the given account.
@@ -3595,22 +3583,15 @@ class TableServiceClient {
3595
3583
  }
3596
3584
  listTablesPage(options = {}) {
3597
3585
  return tslib.__asyncGenerator(this, arguments, function* listTablesPage_1() {
3598
- const { span, updatedOptions } = createSpan("TableServiceClient-listTablesPage", options);
3599
- try {
3600
- let result = yield tslib.__await(this._listTables(updatedOptions));
3586
+ let result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions)));
3587
+ yield yield tslib.__await(result);
3588
+ while (result.continuationToken) {
3589
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
3590
+ result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
3591
+ span.setAttribute("continuationToken", updatedOptions.continuationToken);
3592
+ return this._listTables(updatedOptions);
3593
+ }));
3601
3594
  yield yield tslib.__await(result);
3602
- while (result.continuationToken) {
3603
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
3604
- result = yield tslib.__await(this._listTables(optionsWithContinuation));
3605
- yield yield tslib.__await(result);
3606
- }
3607
- }
3608
- catch (e) {
3609
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
3610
- throw e;
3611
- }
3612
- finally {
3613
- span.end();
3614
3595
  }
3615
3596
  });
3616
3597
  }
@@ -3852,9 +3833,8 @@ class InternalTableTransaction {
3852
3833
  * @param partitionKey - partition key
3853
3834
  * @param credential - credential to authenticate the transaction request
3854
3835
  */
3855
- constructor(url, partitionKey, transactionId, changesetId, clientOptions, interceptClient, credential, allowInsecureConnection = false) {
3856
- this.clientOptions = clientOptions;
3857
- this.credential = credential;
3836
+ constructor(url, partitionKey, transactionId, changesetId, client, interceptClient, credential, allowInsecureConnection = false) {
3837
+ this.client = client;
3858
3838
  this.url = url;
3859
3839
  this.interceptClient = interceptClient;
3860
3840
  this.allowInsecureConnection = allowInsecureConnection;
@@ -3948,43 +3928,19 @@ class InternalTableTransaction {
3948
3928
  async submitTransaction() {
3949
3929
  await Promise.all(this.resetableState.pendingOperations);
3950
3930
  const body = getTransactionHttpRequestBody(this.resetableState.bodyParts, this.resetableState.transactionId, this.resetableState.changesetId);
3951
- const options = this.clientOptions;
3952
- if (coreAuth.isTokenCredential(this.credential)) {
3953
- options.credentialScopes = STORAGE_SCOPE;
3954
- options.credential = this.credential;
3955
- }
3956
- const client = new coreClient.ServiceClient(options);
3957
3931
  const headers = getTransactionHeaders(this.resetableState.transactionId);
3958
- const { span, updatedOptions } = createSpan("TableTransaction-submitTransaction", {});
3959
- const request = coreRestPipeline.createPipelineRequest({
3960
- url: this.url,
3961
- method: "POST",
3962
- body,
3963
- headers: coreRestPipeline.createHttpHeaders(headers),
3964
- tracingOptions: updatedOptions.tracingOptions,
3965
- allowInsecureConnection: this.allowInsecureConnection,
3966
- });
3967
- if (coreAuth.isNamedKeyCredential(this.credential)) {
3968
- const authHeader = getAuthorizationHeader(request, this.credential);
3969
- request.headers.set("Authorization", authHeader);
3970
- }
3971
- else if (coreAuth.isSASCredential(this.credential)) {
3972
- signURLWithSAS(request, this.credential);
3973
- }
3974
- try {
3975
- const rawTransactionResponse = await client.sendRequest(request);
3976
- return parseTransactionResponse(rawTransactionResponse);
3977
- }
3978
- catch (error) {
3979
- span.setStatus({
3980
- code: coreTracing.SpanStatusCode.ERROR,
3981
- message: error.message,
3932
+ return tracingClient.withSpan("TableTransaction.submitTransaction", {}, async (updatedOptions) => {
3933
+ const request = coreRestPipeline.createPipelineRequest({
3934
+ url: this.url,
3935
+ method: "POST",
3936
+ body,
3937
+ headers: coreRestPipeline.createHttpHeaders(headers),
3938
+ tracingOptions: updatedOptions.tracingOptions,
3939
+ allowInsecureConnection: this.allowInsecureConnection,
3982
3940
  });
3983
- throw error;
3984
- }
3985
- finally {
3986
- span.end();
3987
- }
3941
+ const rawTransactionResponse = await this.client.sendRequest(request);
3942
+ return parseTransactionResponse(rawTransactionResponse);
3943
+ });
3988
3944
  }
3989
3945
  checkPartitionKey(partitionKey) {
3990
3946
  if (this.resetableState.partitionKey !== partitionKey) {
@@ -4416,6 +4372,7 @@ class TableClient {
4416
4372
  if (isCosmosEndpoint(this.url)) {
4417
4373
  generatedClient.pipeline.addPolicy(cosmosPatchPolicy());
4418
4374
  }
4375
+ this.generatedClient = generatedClient;
4419
4376
  this.table = generatedClient.table;
4420
4377
  this.pipeline = generatedClient.pipeline;
4421
4378
  }
@@ -4444,23 +4401,17 @@ class TableClient {
4444
4401
  * ```
4445
4402
  */
4446
4403
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4447
- async deleteTable(options = {}) {
4448
- const { span, updatedOptions } = createSpan("TableClient-deleteTable", options);
4449
- try {
4450
- await this.table.delete(this.tableName, updatedOptions);
4451
- }
4452
- catch (e) {
4453
- if (e.statusCode === 404) {
4454
- logger.info("TableClient-deleteTable: Table doesn't exist");
4404
+ deleteTable(options = {}) {
4405
+ return tracingClient.withSpan("TableClient.deleteTable", options, async (updatedOptions) => {
4406
+ try {
4407
+ await this.table.delete(this.tableName, updatedOptions);
4455
4408
  }
4456
- else {
4457
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4458
- throw e;
4409
+ catch (e) {
4410
+ if (e.statusCode === 404) {
4411
+ logger.info("TableClient.deleteTable: Table doesn't exist");
4412
+ }
4459
4413
  }
4460
- }
4461
- finally {
4462
- span.end();
4463
- }
4414
+ });
4464
4415
  }
4465
4416
  /**
4466
4417
  * Creates a table with the tableName passed to the client constructor
@@ -4488,17 +4439,15 @@ class TableClient {
4488
4439
  * ```
4489
4440
  */
4490
4441
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4491
- async createTable(options = {}) {
4492
- const { span, updatedOptions } = createSpan("TableClient-createTable", options);
4493
- try {
4494
- await this.table.create({ name: this.tableName }, updatedOptions);
4495
- }
4496
- catch (e) {
4497
- handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { span, logger, tableName: this.tableName }));
4498
- }
4499
- finally {
4500
- span.end();
4501
- }
4442
+ createTable(options = {}) {
4443
+ return tracingClient.withSpan("TableClient.createTable", options, async (updatedOptions) => {
4444
+ try {
4445
+ await this.table.create({ name: this.tableName }, updatedOptions);
4446
+ }
4447
+ catch (e) {
4448
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: this.tableName }));
4449
+ }
4450
+ });
4502
4451
  }
4503
4452
  /**
4504
4453
  * Returns a single entity in the table.
@@ -4527,30 +4476,22 @@ class TableClient {
4527
4476
  * console.log(entity);
4528
4477
  * ```
4529
4478
  */
4530
- async getEntity(partitionKey, rowKey,
4479
+ getEntity(partitionKey, rowKey,
4531
4480
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4532
4481
  options = {}) {
4533
- const { span, updatedOptions } = createSpan("TableClient-getEntity", options);
4534
- let parsedBody;
4535
- function onResponse(rawResponse, flatResponse) {
4536
- parsedBody = rawResponse.parsedBody;
4537
- if (updatedOptions.onResponse) {
4538
- updatedOptions.onResponse(rawResponse, flatResponse);
4482
+ return tracingClient.withSpan("TableClient.getEntity", options, async (updatedOptions) => {
4483
+ let parsedBody;
4484
+ function onResponse(rawResponse, flatResponse) {
4485
+ parsedBody = rawResponse.parsedBody;
4486
+ if (updatedOptions.onResponse) {
4487
+ updatedOptions.onResponse(rawResponse, flatResponse);
4488
+ }
4539
4489
  }
4540
- }
4541
- try {
4542
- const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
4490
+ const { disableTypeConversion, queryOptions } = updatedOptions, getEntityOptions = tslib.__rest(updatedOptions, ["disableTypeConversion", "queryOptions"]);
4543
4491
  await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
4544
4492
  const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
4545
4493
  return tableEntity;
4546
- }
4547
- catch (e) {
4548
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4549
- throw e;
4550
- }
4551
- finally {
4552
- span.end();
4553
- }
4494
+ });
4554
4495
  }
4555
4496
  /**
4556
4497
  * Queries entities in a table.
@@ -4628,25 +4569,15 @@ class TableClient {
4628
4569
  }
4629
4570
  listEntitiesPage(tableName, options = {}) {
4630
4571
  return tslib.__asyncGenerator(this, arguments, function* listEntitiesPage_1() {
4631
- const { span, updatedOptions } = createSpan("TableClient-listEntitiesPage", options);
4632
- try {
4633
- let result = yield tslib.__await(this._listEntities(tableName, updatedOptions));
4572
+ let result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions)));
4573
+ yield yield tslib.__await(result);
4574
+ while (result.continuationToken) {
4575
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
4576
+ result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
4577
+ span.setAttribute("continuationToken", result.continuationToken);
4578
+ return this._listEntities(tableName, updatedOptions);
4579
+ }));
4634
4580
  yield yield tslib.__await(result);
4635
- while (result.continuationToken) {
4636
- const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
4637
- result = yield tslib.__await(this._listEntities(tableName, optionsWithContinuation));
4638
- yield yield tslib.__await(result);
4639
- }
4640
- }
4641
- catch (e) {
4642
- span.setStatus({
4643
- code: coreTracing.SpanStatusCode.ERROR,
4644
- message: e.message,
4645
- });
4646
- throw e;
4647
- }
4648
- finally {
4649
- span.end();
4650
4581
  }
4651
4582
  });
4652
4583
  }
@@ -4694,21 +4625,13 @@ class TableClient {
4694
4625
  * await client.createEntity({partitionKey: "p1", rowKey: "r1", foo: "Hello!"});
4695
4626
  * ```
4696
4627
  */
4697
- async createEntity(entity,
4628
+ createEntity(entity,
4698
4629
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4699
4630
  options = {}) {
4700
- const { span, updatedOptions } = createSpan("TableClient-createEntity", options);
4701
- try {
4631
+ return tracingClient.withSpan("TableClient.createEntity", options, (updatedOptions) => {
4702
4632
  const createTableEntity = tslib.__rest(updatedOptions || {}, []);
4703
- return await this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4704
- }
4705
- catch (e) {
4706
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4707
- throw e;
4708
- }
4709
- finally {
4710
- span.end();
4711
- }
4633
+ return this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4634
+ });
4712
4635
  }
4713
4636
  /**
4714
4637
  * Deletes the specified entity in the table.
@@ -4735,22 +4658,14 @@ class TableClient {
4735
4658
  * await client.deleteEntity("<partitionKey>", "<rowKey>")
4736
4659
  * ```
4737
4660
  */
4738
- async deleteEntity(partitionKey, rowKey,
4661
+ deleteEntity(partitionKey, rowKey,
4739
4662
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4740
4663
  options = {}) {
4741
- const { span, updatedOptions } = createSpan("TableClient-deleteEntity", options);
4742
- try {
4743
- const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
4664
+ return tracingClient.withSpan("TableClient.deleteEntity", options, (updatedOptions) => {
4665
+ const { etag = "*" } = updatedOptions, rest = tslib.__rest(updatedOptions, ["etag"]);
4744
4666
  const deleteOptions = Object.assign({}, rest);
4745
- return await this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4746
- }
4747
- catch (e) {
4748
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4749
- throw e;
4750
- }
4751
- finally {
4752
- span.end();
4753
- }
4667
+ return this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4668
+ });
4754
4669
  }
4755
4670
  /**
4756
4671
  * Update an entity in the table.
@@ -4791,29 +4706,25 @@ class TableClient {
4791
4706
  * await client.updateEntity(entity, "Replace")
4792
4707
  * ```
4793
4708
  */
4794
- async updateEntity(entity, mode = "Merge",
4709
+ updateEntity(entity, mode = "Merge",
4795
4710
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4796
4711
  options = {}) {
4797
- const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
4798
- try {
4712
+ return tracingClient.withSpan("TableClient.updateEntity", options, async (updatedOptions) => {
4799
4713
  const partitionKey = escapeQuotes(entity.partitionKey);
4800
4714
  const rowKey = escapeQuotes(entity.rowKey);
4801
4715
  const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
4802
4716
  if (mode === "Merge") {
4803
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4717
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4804
4718
  }
4805
4719
  if (mode === "Replace") {
4806
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4720
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4807
4721
  }
4808
4722
  throw new Error(`Unexpected value for update mode: ${mode}`);
4809
- }
4810
- catch (e) {
4811
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4812
- throw e;
4813
- }
4814
- finally {
4815
- span.end();
4816
- }
4723
+ }, {
4724
+ spanAttributes: {
4725
+ updateEntityMode: mode,
4726
+ },
4727
+ });
4817
4728
  }
4818
4729
  /**
4819
4730
  * Upsert an entity in the table.
@@ -4850,66 +4761,46 @@ class TableClient {
4850
4761
  * await client.upsertEntity(entity, "Replace")
4851
4762
  * ```
4852
4763
  */
4853
- async upsertEntity(entity, mode = "Merge",
4764
+ upsertEntity(entity, mode = "Merge",
4854
4765
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4855
4766
  options = {}) {
4856
- const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
4857
- try {
4767
+ return tracingClient.withSpan("TableClient.upsertEntity", options, async (updatedOptions) => {
4858
4768
  const partitionKey = escapeQuotes(entity.partitionKey);
4859
4769
  const rowKey = escapeQuotes(entity.rowKey);
4860
4770
  if (mode === "Merge") {
4861
- return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4771
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4862
4772
  }
4863
4773
  if (mode === "Replace") {
4864
- return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4774
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4865
4775
  }
4866
4776
  throw new Error(`Unexpected value for update mode: ${mode}`);
4867
- }
4868
- catch (e) {
4869
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4870
- throw e;
4871
- }
4872
- finally {
4873
- span.end();
4874
- }
4777
+ }, {
4778
+ spanAttributes: {
4779
+ upsertEntityMode: mode,
4780
+ },
4781
+ });
4875
4782
  }
4876
4783
  /**
4877
4784
  * Retrieves details about any stored access policies specified on the table that may be used with
4878
4785
  * Shared Access Signatures.
4879
4786
  * @param options - The options parameters.
4880
4787
  */
4881
- async getAccessPolicy(options = {}) {
4882
- const { span, updatedOptions } = createSpan("TableClient-getAccessPolicy", options);
4883
- try {
4788
+ getAccessPolicy(options = {}) {
4789
+ return tracingClient.withSpan("TableClient.getAccessPolicy", options, async (updatedOptions) => {
4884
4790
  const signedIdentifiers = await this.table.getAccessPolicy(this.tableName, updatedOptions);
4885
4791
  return deserializeSignedIdentifier(signedIdentifiers);
4886
- }
4887
- catch (e) {
4888
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4889
- throw e;
4890
- }
4891
- finally {
4892
- span.end();
4893
- }
4792
+ });
4894
4793
  }
4895
4794
  /**
4896
4795
  * Sets stored access policies for the table that may be used with Shared Access Signatures.
4897
4796
  * @param tableAcl - The Access Control List for the table.
4898
4797
  * @param options - The options parameters.
4899
4798
  */
4900
- async setAccessPolicy(tableAcl, options = {}) {
4901
- const { span, updatedOptions } = createSpan("TableClient-setAccessPolicy", options);
4902
- try {
4799
+ setAccessPolicy(tableAcl, options = {}) {
4800
+ return tracingClient.withSpan("TableClient.setAccessPolicy", options, (updatedOptions) => {
4903
4801
  const serlializedAcl = serializeSignedIdentifiers(tableAcl);
4904
- return await this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4905
- }
4906
- catch (e) {
4907
- span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
4908
- throw e;
4909
- }
4910
- finally {
4911
- span.end();
4912
- }
4802
+ return this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4803
+ });
4913
4804
  }
4914
4805
  /**
4915
4806
  * Submits a Transaction which is composed of a set of actions. You can provide the actions as a list
@@ -4952,7 +4843,7 @@ class TableClient {
4952
4843
  const changesetId = Uuid.generateUuid();
4953
4844
  if (!this.transactionClient) {
4954
4845
  // Add pipeline
4955
- this.transactionClient = new InternalTableTransaction(this.url, partitionKey, transactionId, changesetId, this.clientOptions, new TableClient(this.url, this.tableName), this.credential, this.allowInsecureConnection);
4846
+ this.transactionClient = new InternalTableTransaction(this.url, partitionKey, transactionId, changesetId, this.generatedClient, new TableClient(this.url, this.tableName), this.credential, this.allowInsecureConnection);
4956
4847
  }
4957
4848
  else {
4958
4849
  this.transactionClient.reset(transactionId, changesetId, partitionKey);
@@ -5003,21 +4894,15 @@ class TableClient {
5003
4894
 
5004
4895
  Object.defineProperty(exports, 'AzureNamedKeyCredential', {
5005
4896
  enumerable: true,
5006
- get: function () {
5007
- return coreAuth.AzureNamedKeyCredential;
5008
- }
4897
+ get: function () { return coreAuth.AzureNamedKeyCredential; }
5009
4898
  });
5010
4899
  Object.defineProperty(exports, 'AzureSASCredential', {
5011
4900
  enumerable: true,
5012
- get: function () {
5013
- return coreAuth.AzureSASCredential;
5014
- }
4901
+ get: function () { return coreAuth.AzureSASCredential; }
5015
4902
  });
5016
4903
  Object.defineProperty(exports, 'RestError', {
5017
4904
  enumerable: true,
5018
- get: function () {
5019
- return coreRestPipeline.RestError;
5020
- }
4905
+ get: function () { return coreRestPipeline.RestError; }
5021
4906
  });
5022
4907
  exports.TableClient = TableClient;
5023
4908
  exports.TableServiceClient = TableServiceClient;