@azure/data-tables 13.2.3-alpha.20240115.1 → 13.2.3-alpha.20240117.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.
Files changed (31) hide show
  1. package/dist/index.js +150 -216
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/TableClient.js +61 -87
  4. package/dist-esm/src/TableClient.js.map +1 -1
  5. package/dist-esm/src/TableServiceClient.js +48 -48
  6. package/dist-esm/src/TableServiceClient.js.map +1 -1
  7. package/dist-esm/src/TableTransaction.js +8 -11
  8. package/dist-esm/src/TableTransaction.js.map +1 -1
  9. package/dist-esm/src/generated/generatedClient.js +3 -7
  10. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  11. package/dist-esm/src/generated/generatedClientContext.js +2 -7
  12. package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
  13. package/dist-esm/src/generated/models/mappers.js +2 -5
  14. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  15. package/dist-esm/src/sas/generateAccountSas.js +3 -8
  16. package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
  17. package/dist-esm/src/sas/generateTableSas.js +2 -5
  18. package/dist-esm/src/sas/generateTableSas.js.map +1 -1
  19. package/dist-esm/src/sas/tableSasSignatureValues.js +7 -6
  20. package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
  21. package/dist-esm/src/secondaryEndpointPolicy.js +2 -10
  22. package/dist-esm/src/secondaryEndpointPolicy.js.map +1 -1
  23. package/dist-esm/src/serialization.js +10 -16
  24. package/dist-esm/src/serialization.js.map +1 -1
  25. package/dist-esm/src/utils/continuationToken.js +1 -5
  26. package/dist-esm/src/utils/continuationToken.js.map +1 -1
  27. package/dist-esm/src/utils/errorHelpers.js +4 -3
  28. package/dist-esm/src/utils/errorHelpers.js.map +1 -1
  29. package/dist-esm/src/utils/transactionHeaders.js +2 -5
  30. package/dist-esm/src/utils/transactionHeaders.js.map +1 -1
  31. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var tslib = require('tslib');
5
6
  require('@azure/core-paging');
6
7
  var coreAuth = require('@azure/core-auth');
7
8
  var coreXml = require('@azure/core-xml');
@@ -619,7 +620,7 @@ function generateAccountSasQueryParameters(accountSasSignatureValues, credential
619
620
  * @returns An account SAS token
620
621
  */
621
622
  function generateAccountSas(credential, options = {}) {
622
- const { expiresOn, permissions = accountSasPermissionsFromString("rl"), resourceTypes = "sco", services = accountSasServicesFromString("t"), ...rest } = options;
623
+ const { expiresOn, permissions = accountSasPermissionsFromString("rl"), resourceTypes = "sco", services = accountSasServicesFromString("t") } = options, rest = tslib.__rest(options, ["expiresOn", "permissions", "resourceTypes", "services"]);
623
624
  if (!coreAuth.isNamedKeyCredential(credential)) {
624
625
  throw RangeError("Can only generate the account SAS when the client is initialized with a shared key credential");
625
626
  }
@@ -628,13 +629,7 @@ function generateAccountSas(credential, options = {}) {
628
629
  const now = new Date();
629
630
  expiry = new Date(now.getTime() + 3600 * 1000);
630
631
  }
631
- const sas = generateAccountSasQueryParameters({
632
- permissions,
633
- expiresOn: expiry,
634
- resourceTypes,
635
- services: accountSasServicesToString(services),
636
- ...rest,
637
- }, credential).toString();
632
+ const sas = generateAccountSasQueryParameters(Object.assign({ permissions, expiresOn: expiry, resourceTypes, services: accountSasServicesToString(services) }, rest), credential).toString();
638
633
  return sas;
639
634
  }
640
635
 
@@ -709,7 +704,8 @@ function tableSasPermissionsToString(permissions) {
709
704
  * **Note**: When identifier is not provided, permissions has a default value of "read" and expiresOn of one hour from the time the token is generated.
710
705
  */
711
706
  function generateTableSasQueryParameters(tableName, credential, tableSasSignatureValues) {
712
- const version = tableSasSignatureValues.version ?? SERVICE_VERSION;
707
+ var _a, _b, _c, _d, _e, _f;
708
+ const version = (_a = tableSasSignatureValues.version) !== null && _a !== void 0 ? _a : SERVICE_VERSION;
713
709
  if (credential === undefined) {
714
710
  throw TypeError("Invalid NamedKeyCredential");
715
711
  }
@@ -724,13 +720,13 @@ function generateTableSasQueryParameters(tableName, credential, tableSasSignatur
724
720
  ? truncatedISO8061Date(tableSasSignatureValues.expiresOn, false /** withMilliseconds */)
725
721
  : "";
726
722
  const canonicalizedResource = getCanonicalName(credential.name, tableName);
727
- const signedIdentifier = tableSasSignatureValues.identifier ?? "";
723
+ const signedIdentifier = (_b = tableSasSignatureValues.identifier) !== null && _b !== void 0 ? _b : "";
728
724
  const signedIP = ipRangeToString(tableSasSignatureValues.ipRange);
729
725
  const signedProtocol = tableSasSignatureValues.protocol || "";
730
- const startingPartitionKey = tableSasSignatureValues.startPartitionKey ?? "";
731
- const startingRowKey = tableSasSignatureValues.startRowKey ?? "";
732
- const endingPartitionKey = tableSasSignatureValues.endPartitionKey ?? "";
733
- const endingRowKey = tableSasSignatureValues.endRowKey ?? "";
726
+ const startingPartitionKey = (_c = tableSasSignatureValues.startPartitionKey) !== null && _c !== void 0 ? _c : "";
727
+ const startingRowKey = (_d = tableSasSignatureValues.startRowKey) !== null && _d !== void 0 ? _d : "";
728
+ const endingPartitionKey = (_e = tableSasSignatureValues.endPartitionKey) !== null && _e !== void 0 ? _e : "";
729
+ const endingRowKey = (_f = tableSasSignatureValues.endRowKey) !== null && _f !== void 0 ? _f : "";
734
730
  const stringToSign = [
735
731
  signedPermissions,
736
732
  signedStart,
@@ -793,11 +789,8 @@ function generateTableSas(tableName, credential, options = {}) {
793
789
  expiresOn = new Date(now.getTime() + 3600 * 1000);
794
790
  }
795
791
  }
796
- const sas = generateTableSasQueryParameters(tableName, credential, {
797
- ...options,
798
- expiresOn,
799
- permissions,
800
- }).toString();
792
+ const sas = generateTableSasQueryParameters(tableName, credential, Object.assign(Object.assign({}, options), { expiresOn,
793
+ permissions })).toString();
801
794
  return sas;
802
795
  }
803
796
 
@@ -830,17 +823,9 @@ const tablesSecondaryEndpointPolicy = {
830
823
  * Utility function that injects the SecondaryEndpointHeader into an operation options
831
824
  */
832
825
  function injectSecondaryEndpointHeader(options) {
826
+ var _a;
833
827
  const headerToInject = { [SecondaryLocationHeaderName]: "true" };
834
- return {
835
- ...options,
836
- requestOptions: {
837
- ...options.requestOptions,
838
- customHeaders: {
839
- ...options.requestOptions?.customHeaders,
840
- ...headerToInject,
841
- },
842
- },
843
- };
828
+ 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) }) });
844
829
  }
845
830
  /**
846
831
  * Utility function that calculates the secondary URL for a table instance given the primary URL.
@@ -1364,16 +1349,13 @@ const TableResponse = {
1364
1349
  type: {
1365
1350
  name: "Composite",
1366
1351
  className: "TableResponse",
1367
- modelProperties: {
1368
- ...TableResponseProperties.type.modelProperties,
1369
- odataMetadata: {
1352
+ modelProperties: Object.assign(Object.assign({}, TableResponseProperties.type.modelProperties), { odataMetadata: {
1370
1353
  serializedName: "odata\\.metadata",
1371
1354
  xmlName: "odata\\.metadata",
1372
1355
  type: {
1373
1356
  name: "String"
1374
1357
  }
1375
- }
1376
- }
1358
+ } })
1377
1359
  }
1378
1360
  };
1379
1361
  const TableQueryHeaders = {
@@ -3177,6 +3159,7 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
3177
3159
  * @param options The parameter options
3178
3160
  */
3179
3161
  constructor(url, options) {
3162
+ var _a, _b;
3180
3163
  if (url === undefined) {
3181
3164
  throw new Error("'url' cannot be null");
3182
3165
  }
@@ -3191,14 +3174,9 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
3191
3174
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
3192
3175
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
3193
3176
  : `${packageDetails}`;
3194
- const optionsWithDefaults = {
3195
- ...defaults,
3196
- ...options,
3197
- userAgentOptions: {
3177
+ const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
3198
3178
  userAgentPrefix
3199
- },
3200
- baseUri: options.endpoint ?? options.baseUri ?? "{url}"
3201
- };
3179
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{url}" });
3202
3180
  super(optionsWithDefaults);
3203
3181
  // Parameter assignments
3204
3182
  this.url = url;
@@ -3406,11 +3384,12 @@ function getAccountNameFromUrl(url) {
3406
3384
  // Copyright (c) Microsoft Corporation.
3407
3385
  // Licensed under the MIT license.
3408
3386
  function handleTableAlreadyExists(error, options = {}) {
3387
+ var _a, _b;
3409
3388
  const responseError = getErrorResponse(error);
3410
3389
  if (responseError &&
3411
3390
  responseError.status === 409 &&
3412
- responseError.parsedBody.odataError?.code === "TableAlreadyExists") {
3413
- options.logger?.info(`Table ${options.tableName} already Exists`);
3391
+ ((_a = responseError.parsedBody.odataError) === null || _a === void 0 ? void 0 : _a.code) === "TableAlreadyExists") {
3392
+ (_b = options.logger) === null || _b === void 0 ? void 0 : _b.info(`Table ${options.tableName} already Exists`);
3414
3393
  if (options.onResponse) {
3415
3394
  options.onResponse(responseError, {});
3416
3395
  }
@@ -3433,7 +3412,7 @@ function isRestError(error) {
3433
3412
  return error.name === "RestError";
3434
3413
  }
3435
3414
  function isTableServiceErrorResponse(errorResponseBody) {
3436
- return Boolean(errorResponseBody?.odataError);
3415
+ return Boolean(errorResponseBody === null || errorResponseBody === void 0 ? void 0 : errorResponseBody.odataError);
3437
3416
  }
3438
3417
 
3439
3418
  // Copyright (c) Microsoft Corporation.
@@ -3578,20 +3557,14 @@ class TableServiceClient {
3578
3557
  this.url = url;
3579
3558
  const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;
3580
3559
  const clientOptions = (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};
3581
- const internalPipelineOptions = {
3582
- ...clientOptions,
3583
- endpoint: clientOptions.endpoint || this.url,
3584
- loggingOptions: {
3560
+ const internalPipelineOptions = Object.assign(Object.assign({}, clientOptions), { endpoint: clientOptions.endpoint || this.url, loggingOptions: {
3585
3561
  logger: logger.info,
3586
3562
  additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],
3587
- },
3588
- deserializationOptions: {
3563
+ }, deserializationOptions: {
3589
3564
  parseXML: coreXml.parseXML,
3590
- },
3591
- serializationOptions: {
3565
+ }, serializationOptions: {
3592
3566
  stringifyXML: coreXml.stringifyXML,
3593
- },
3594
- };
3567
+ } });
3595
3568
  const client = new GeneratedClient(this.url, internalPipelineOptions);
3596
3569
  client.pipeline.addPolicy(tablesSecondaryEndpointPolicy);
3597
3570
  if (coreAuth.isNamedKeyCredential(credential)) {
@@ -3603,7 +3576,7 @@ class TableServiceClient {
3603
3576
  if (coreAuth.isTokenCredential(credential)) {
3604
3577
  setTokenChallengeAuthenticationPolicy(client.pipeline, credential, STORAGE_SCOPE);
3605
3578
  }
3606
- if (options?.version) {
3579
+ if (options === null || options === void 0 ? void 0 : options.version) {
3607
3580
  client.pipeline.addPolicy(apiVersionPolicy(options.version));
3608
3581
  }
3609
3582
  this.pipeline = client.pipeline;
@@ -3646,7 +3619,7 @@ class TableServiceClient {
3646
3619
  await this.table.create({ name }, updatedOptions);
3647
3620
  }
3648
3621
  catch (e) {
3649
- handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: name });
3622
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: name }));
3650
3623
  }
3651
3624
  });
3652
3625
  }
@@ -3686,52 +3659,57 @@ class TableServiceClient {
3686
3659
  return this;
3687
3660
  },
3688
3661
  byPage: (settings) => {
3689
- const pageOptions = {
3690
- ...options,
3691
- queryOptions: { ...options?.queryOptions, top: settings?.maxPageSize },
3692
- };
3693
- if (settings?.continuationToken) {
3662
+ const pageOptions = Object.assign(Object.assign({}, options), { queryOptions: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.queryOptions), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize }) });
3663
+ if (settings === null || settings === void 0 ? void 0 : settings.continuationToken) {
3694
3664
  pageOptions.continuationToken = settings.continuationToken;
3695
3665
  }
3696
3666
  return this.listTablesPage(pageOptions);
3697
3667
  },
3698
3668
  };
3699
3669
  }
3700
- async *listTablesAll(options) {
3701
- const firstPage = await this._listTables(options);
3702
- const { continuationToken } = firstPage;
3703
- yield* firstPage;
3704
- if (continuationToken) {
3705
- const optionsWithContinuation = {
3706
- ...options,
3707
- continuationToken,
3708
- };
3709
- for await (const page of this.listTablesPage(optionsWithContinuation)) {
3710
- yield* page;
3670
+ listTablesAll(options) {
3671
+ return tslib.__asyncGenerator(this, arguments, function* listTablesAll_1() {
3672
+ var _a, e_1, _b, _c;
3673
+ const firstPage = yield tslib.__await(this._listTables(options));
3674
+ const { continuationToken } = firstPage;
3675
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(firstPage)));
3676
+ if (continuationToken) {
3677
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken });
3678
+ try {
3679
+ for (var _d = true, _e = tslib.__asyncValues(this.listTablesPage(optionsWithContinuation)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
3680
+ _c = _f.value;
3681
+ _d = false;
3682
+ const page = _c;
3683
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3684
+ }
3685
+ }
3686
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
3687
+ finally {
3688
+ try {
3689
+ if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
3690
+ }
3691
+ finally { if (e_1) throw e_1.error; }
3692
+ }
3711
3693
  }
3712
- }
3694
+ });
3713
3695
  }
3714
- async *listTablesPage(options = {}) {
3715
- let result = await tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions));
3716
- yield result;
3717
- while (result.continuationToken) {
3718
- const optionsWithContinuation = {
3719
- ...options,
3720
- continuationToken: result.continuationToken,
3721
- };
3722
- result = await tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
3723
- span.setAttribute("continuationToken", updatedOptions.continuationToken);
3724
- return this._listTables(updatedOptions);
3725
- });
3726
- yield result;
3727
- }
3696
+ listTablesPage(options = {}) {
3697
+ return tslib.__asyncGenerator(this, arguments, function* listTablesPage_1() {
3698
+ let result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", options, (updatedOptions) => this._listTables(updatedOptions)));
3699
+ yield yield tslib.__await(result);
3700
+ while (result.continuationToken) {
3701
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
3702
+ result = yield tslib.__await(tracingClient.withSpan("TableServiceClient.listTablesPage", optionsWithContinuation, async (updatedOptions, span) => {
3703
+ span.setAttribute("continuationToken", updatedOptions.continuationToken);
3704
+ return this._listTables(updatedOptions);
3705
+ }));
3706
+ yield yield tslib.__await(result);
3707
+ }
3708
+ });
3728
3709
  }
3729
3710
  async _listTables(options = {}) {
3730
- const { continuationToken: nextTableName, ...listOptions } = options;
3731
- const { xMsContinuationNextTableName: continuationToken, value = [] } = await this.table.query({
3732
- ...listOptions,
3733
- nextTableName,
3734
- });
3711
+ const { continuationToken: nextTableName } = options, listOptions = tslib.__rest(options, ["continuationToken"]);
3712
+ const { xMsContinuationNextTableName: continuationToken, value = [] } = await this.table.query(Object.assign(Object.assign({}, listOptions), { nextTableName }));
3735
3713
  return Object.assign([...value], { continuationToken });
3736
3714
  }
3737
3715
  /**
@@ -3901,12 +3879,9 @@ function getBaseTransactionHeaders(transactionGuid) {
3901
3879
  */
3902
3880
  function getTransactionHeaders(transactionGuid) {
3903
3881
  const baseHeaders = getBaseTransactionHeaders(transactionGuid);
3904
- return {
3905
- ...baseHeaders,
3882
+ return Object.assign(Object.assign({}, baseHeaders), {
3906
3883
  // The below headers are not supported in the browser as they are flagged as "unsafe headers"
3907
- "Accept-Charset": "UTF-8",
3908
- Connection: "Keep-Alive",
3909
- };
3884
+ "Accept-Charset": "UTF-8", Connection: "Keep-Alive" });
3910
3885
  }
3911
3886
 
3912
3887
  // Copyright (c) Microsoft Corporation.
@@ -3932,7 +3907,7 @@ function isCosmosEndpoint(url) {
3932
3907
  */
3933
3908
  class TableTransaction {
3934
3909
  constructor(actions) {
3935
- this.actions = actions ?? [];
3910
+ this.actions = actions !== null && actions !== void 0 ? actions : [];
3936
3911
  }
3937
3912
  /**
3938
3913
  * Adds a create action to the transaction
@@ -3959,7 +3934,7 @@ class TableTransaction {
3959
3934
  // UpdateMode is a string union
3960
3935
  const realUpdateMode = typeof updateModeOrOptions === "string" ? updateModeOrOptions : undefined;
3961
3936
  const realUpdateOptions = typeof updateModeOrOptions === "object" ? updateModeOrOptions : updateOptions;
3962
- this.actions.push(["update", entity, realUpdateMode ?? "Merge", realUpdateOptions ?? {}]);
3937
+ this.actions.push(["update", entity, realUpdateMode !== null && realUpdateMode !== void 0 ? realUpdateMode : "Merge", realUpdateOptions !== null && realUpdateOptions !== void 0 ? realUpdateOptions : {}]);
3963
3938
  }
3964
3939
  /**
3965
3940
  * Adds an upsert action to the transaction, which inserts if the entity doesn't exist or updates the existing one
@@ -4105,7 +4080,7 @@ function parseTransactionResponse(transactionResponse) {
4105
4080
  const subResponses = splitBody.slice(1, splitBody.length - 1);
4106
4081
  const responses = subResponses.map((subResponse) => {
4107
4082
  const statusMatch = subResponse.match(/HTTP\/1.1 ([0-9]*)/);
4108
- if (statusMatch?.length !== 2) {
4083
+ if ((statusMatch === null || statusMatch === void 0 ? void 0 : statusMatch.length) !== 2) {
4109
4084
  throw new Error(`Couldn't extract status from sub-response:\n ${subResponse}`);
4110
4085
  }
4111
4086
  const subResponseStatus = Number.parseInt(statusMatch[1]);
@@ -4113,16 +4088,12 @@ function parseTransactionResponse(transactionResponse) {
4113
4088
  throw new Error(`Expected sub-response status to be an integer ${subResponseStatus}`);
4114
4089
  }
4115
4090
  const bodyMatch = subResponse.match(/\{(.*)\}/);
4116
- if (bodyMatch?.length === 2) {
4091
+ if ((bodyMatch === null || bodyMatch === void 0 ? void 0 : bodyMatch.length) === 2) {
4117
4092
  handleBodyError(bodyMatch[0], subResponseStatus, transactionResponse.request, transactionResponse);
4118
4093
  }
4119
4094
  const etagMatch = subResponse.match(/ETag: (.*)/);
4120
4095
  const rowKeyMatch = subResponse.match(/RowKey='(.*)'/);
4121
- return {
4122
- status: subResponseStatus,
4123
- ...(rowKeyMatch?.length === 2 && { rowKey: rowKeyMatch[1] }),
4124
- ...(etagMatch?.length === 2 && { etag: etagMatch[1] }),
4125
- };
4096
+ return Object.assign(Object.assign({ status: subResponseStatus }, ((rowKeyMatch === null || rowKeyMatch === void 0 ? void 0 : rowKeyMatch.length) === 2 && { rowKey: rowKeyMatch[1] })), ((etagMatch === null || etagMatch === void 0 ? void 0 : etagMatch.length) === 2 && { etag: etagMatch[1] }));
4126
4097
  });
4127
4098
  return {
4128
4099
  status,
@@ -4131,11 +4102,12 @@ function parseTransactionResponse(transactionResponse) {
4131
4102
  };
4132
4103
  }
4133
4104
  function handleBodyError(bodyAsText, statusCode, request, response) {
4105
+ var _a, _b;
4134
4106
  let parsedError;
4135
4107
  try {
4136
4108
  parsedError = JSON.parse(bodyAsText);
4137
4109
  }
4138
- catch {
4110
+ catch (_c) {
4139
4111
  parsedError = {};
4140
4112
  }
4141
4113
  let message = "Transaction Failed";
@@ -4143,7 +4115,7 @@ function handleBodyError(bodyAsText, statusCode, request, response) {
4143
4115
  // Only transaction sub-responses return body
4144
4116
  if (parsedError && parsedError["odata.error"]) {
4145
4117
  const error = parsedError["odata.error"];
4146
- message = error.message?.value ?? message;
4118
+ message = (_b = (_a = error.message) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : message;
4147
4119
  code = error.code;
4148
4120
  }
4149
4121
  throw new coreRestPipeline.RestError(message, {
@@ -4211,11 +4183,7 @@ function encodeContinuationToken(nextPartitionKey, nextRowKey) {
4211
4183
  if (!nextPartitionKey) {
4212
4184
  return undefined;
4213
4185
  }
4214
- const continuationToken = {
4215
- nextPartitionKey,
4216
- // Only add nextRowKey if the value is not null, undefined or empty string.
4217
- ...(nextRowKey && { nextRowKey }),
4218
- };
4186
+ const continuationToken = Object.assign({ nextPartitionKey }, (nextRowKey && { nextRowKey }));
4219
4187
  return base64Encode(JSON.stringify(continuationToken));
4220
4188
  }
4221
4189
  /**
@@ -4294,7 +4262,7 @@ function serializeObject(obj) {
4294
4262
  return serializedValue;
4295
4263
  }
4296
4264
  function getSerializedValue(value) {
4297
- if (typeof value === "object" && value?.value !== undefined && value?.type !== undefined) {
4265
+ if (typeof value === "object" && (value === null || value === void 0 ? void 0 : value.value) !== undefined && (value === null || value === void 0 ? void 0 : value.type) !== undefined) {
4298
4266
  return serializeObject(value);
4299
4267
  }
4300
4268
  else {
@@ -4344,10 +4312,11 @@ function getTypedObject(value, type, disableTypeConversion) {
4344
4312
  }
4345
4313
  }
4346
4314
  function deserialize(obj, disableTypeConversion = false) {
4315
+ var _a;
4347
4316
  const deserialized = {};
4348
4317
  for (const [key, value] of Object.entries(obj)) {
4349
4318
  if (key.indexOf("@odata.type") === -1) {
4350
- const transformedKey = propertyCaseMap.get(key) ?? key;
4319
+ const transformedKey = (_a = propertyCaseMap.get(key)) !== null && _a !== void 0 ? _a : key;
4351
4320
  let typedValue = value;
4352
4321
  if (`${key}@odata.type` in obj) {
4353
4322
  const type = obj[`${key}@odata.type`];
@@ -4403,7 +4372,7 @@ function deserializeObjectsArray(objArray, disableTypeConversion) {
4403
4372
  function serializeSignedIdentifiers(signedIdentifiers) {
4404
4373
  return signedIdentifiers.map((acl) => {
4405
4374
  const { id, accessPolicy } = acl;
4406
- const { start, expiry, ...rest } = accessPolicy ?? {};
4375
+ const _a = accessPolicy !== null && accessPolicy !== void 0 ? accessPolicy : {}, { start, expiry } = _a, rest = tslib.__rest(_a, ["start", "expiry"]);
4407
4376
  const serializedStart = start
4408
4377
  ? truncatedISO8061Date(start, false /** withMilliseconds */)
4409
4378
  : undefined;
@@ -4412,33 +4381,25 @@ function serializeSignedIdentifiers(signedIdentifiers) {
4412
4381
  : undefined;
4413
4382
  return {
4414
4383
  id,
4415
- accessPolicy: {
4416
- ...(serializedExpiry && { expiry: serializedExpiry }),
4417
- ...(serializedStart && { start: serializedStart }),
4418
- ...rest,
4419
- },
4384
+ accessPolicy: Object.assign(Object.assign(Object.assign({}, (serializedExpiry && { expiry: serializedExpiry })), (serializedStart && { start: serializedStart })), rest),
4420
4385
  };
4421
4386
  });
4422
4387
  }
4423
4388
  function deserializeSignedIdentifier(signedIdentifiers) {
4424
4389
  return signedIdentifiers.map((si) => {
4425
4390
  const { id, accessPolicy } = si;
4426
- const { start, expiry, ...restAcl } = accessPolicy ?? {};
4391
+ const _a = accessPolicy !== null && accessPolicy !== void 0 ? accessPolicy : {}, { start, expiry } = _a, restAcl = tslib.__rest(_a, ["start", "expiry"]);
4427
4392
  const deserializedStart = start ? new Date(start) : undefined;
4428
4393
  const deserializedExpiry = expiry ? new Date(expiry) : undefined;
4429
4394
  return {
4430
4395
  id,
4431
- accessPolicy: {
4432
- ...(deserializedExpiry && { expiry: deserializedExpiry }),
4433
- ...(deserializedStart && { start: deserializedStart }),
4434
- ...restAcl,
4435
- },
4396
+ accessPolicy: Object.assign(Object.assign(Object.assign({}, (deserializedExpiry && { expiry: deserializedExpiry })), (deserializedStart && { start: deserializedStart })), restAcl),
4436
4397
  };
4437
4398
  });
4438
4399
  }
4439
4400
  function serializeQueryOptions(query) {
4440
- const { select, ...queryOptions } = query;
4441
- const mappedQuery = { ...queryOptions };
4401
+ const { select } = query, queryOptions = tslib.__rest(query, ["select"]);
4402
+ const mappedQuery = Object.assign({}, queryOptions);
4442
4403
  // Properties that are always returned by the service but are not allowed in select
4443
4404
  const excludeFromSelect = ["etag", "odata.etag"];
4444
4405
  if (select) {
@@ -4505,26 +4466,21 @@ function odata(strings, ...values) {
4505
4466
  */
4506
4467
  class TableClient {
4507
4468
  constructor(url, tableName, credentialOrOptions, options = {}) {
4469
+ var _a;
4508
4470
  this.url = url;
4509
4471
  this.tableName = tableName;
4510
4472
  const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;
4511
4473
  this.credential = credential;
4512
4474
  this.clientOptions = (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};
4513
- this.allowInsecureConnection = this.clientOptions.allowInsecureConnection ?? false;
4514
- const internalPipelineOptions = {
4515
- ...this.clientOptions,
4516
- endpoint: this.clientOptions.endpoint || this.url,
4517
- loggingOptions: {
4475
+ this.allowInsecureConnection = (_a = this.clientOptions.allowInsecureConnection) !== null && _a !== void 0 ? _a : false;
4476
+ const internalPipelineOptions = Object.assign(Object.assign({}, this.clientOptions), { endpoint: this.clientOptions.endpoint || this.url, loggingOptions: {
4518
4477
  logger: logger.info,
4519
4478
  additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],
4520
- },
4521
- deserializationOptions: {
4479
+ }, deserializationOptions: {
4522
4480
  parseXML: coreXml.parseXML,
4523
- },
4524
- serializationOptions: {
4481
+ }, serializationOptions: {
4525
4482
  stringifyXML: coreXml.stringifyXML,
4526
- },
4527
- };
4483
+ } });
4528
4484
  const generatedClient = new GeneratedClient(this.url, internalPipelineOptions);
4529
4485
  if (coreAuth.isNamedKeyCredential(credential)) {
4530
4486
  generatedClient.pipeline.addPolicy(tablesNamedKeyCredentialPolicy(credential));
@@ -4617,7 +4573,7 @@ class TableClient {
4617
4573
  await this.table.create({ name: this.tableName }, updatedOptions);
4618
4574
  }
4619
4575
  catch (e) {
4620
- handleTableAlreadyExists(e, { ...updatedOptions, logger, tableName: this.tableName });
4576
+ handleTableAlreadyExists(e, Object.assign(Object.assign({}, updatedOptions), { logger, tableName: this.tableName }));
4621
4577
  }
4622
4578
  });
4623
4579
  }
@@ -4659,13 +4615,9 @@ class TableClient {
4659
4615
  updatedOptions.onResponse(rawResponse, flatResponse);
4660
4616
  }
4661
4617
  }
4662
- const { disableTypeConversion, queryOptions, ...getEntityOptions } = updatedOptions;
4663
- await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), {
4664
- ...getEntityOptions,
4665
- queryOptions: serializeQueryOptions(queryOptions || {}),
4666
- onResponse,
4667
- });
4668
- const tableEntity = deserialize(parsedBody, disableTypeConversion ?? false);
4618
+ const { disableTypeConversion, queryOptions } = updatedOptions, getEntityOptions = tslib.__rest(updatedOptions, ["disableTypeConversion", "queryOptions"]);
4619
+ await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
4620
+ const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
4669
4621
  return tableEntity;
4670
4622
  });
4671
4623
  }
@@ -4712,52 +4664,57 @@ class TableClient {
4712
4664
  return this;
4713
4665
  },
4714
4666
  byPage: (settings) => {
4715
- const pageOptions = {
4716
- ...options,
4717
- queryOptions: { ...options.queryOptions, top: settings?.maxPageSize },
4718
- };
4719
- if (settings?.continuationToken) {
4667
+ const pageOptions = Object.assign(Object.assign({}, options), { queryOptions: Object.assign(Object.assign({}, options.queryOptions), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize }) });
4668
+ if (settings === null || settings === void 0 ? void 0 : settings.continuationToken) {
4720
4669
  pageOptions.continuationToken = settings.continuationToken;
4721
4670
  }
4722
4671
  return this.listEntitiesPage(tableName, pageOptions);
4723
4672
  },
4724
4673
  };
4725
4674
  }
4726
- async *listEntitiesAll(tableName, options) {
4727
- const firstPage = await this._listEntities(tableName, options);
4728
- yield* firstPage;
4729
- if (firstPage.continuationToken) {
4730
- const optionsWithContinuation = {
4731
- ...options,
4732
- continuationToken: firstPage.continuationToken,
4733
- };
4734
- for await (const page of this.listEntitiesPage(tableName, optionsWithContinuation)) {
4735
- yield* page;
4675
+ listEntitiesAll(tableName, options) {
4676
+ return tslib.__asyncGenerator(this, arguments, function* listEntitiesAll_1() {
4677
+ var _a, e_1, _b, _c;
4678
+ const firstPage = yield tslib.__await(this._listEntities(tableName, options));
4679
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(firstPage)));
4680
+ if (firstPage.continuationToken) {
4681
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: firstPage.continuationToken });
4682
+ try {
4683
+ for (var _d = true, _e = tslib.__asyncValues(this.listEntitiesPage(tableName, optionsWithContinuation)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
4684
+ _c = _f.value;
4685
+ _d = false;
4686
+ const page = _c;
4687
+ yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
4688
+ }
4689
+ }
4690
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4691
+ finally {
4692
+ try {
4693
+ if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
4694
+ }
4695
+ finally { if (e_1) throw e_1.error; }
4696
+ }
4736
4697
  }
4737
- }
4698
+ });
4738
4699
  }
4739
- async *listEntitiesPage(tableName, options = {}) {
4740
- let result = await tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions));
4741
- yield result;
4742
- while (result.continuationToken) {
4743
- const optionsWithContinuation = {
4744
- ...options,
4745
- continuationToken: result.continuationToken,
4746
- };
4747
- result = await tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
4748
- span.setAttribute("continuationToken", result.continuationToken);
4749
- return this._listEntities(tableName, updatedOptions);
4750
- });
4751
- yield result;
4752
- }
4700
+ listEntitiesPage(tableName, options = {}) {
4701
+ return tslib.__asyncGenerator(this, arguments, function* listEntitiesPage_1() {
4702
+ let result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", options, (updatedOptions) => this._listEntities(tableName, updatedOptions)));
4703
+ yield yield tslib.__await(result);
4704
+ while (result.continuationToken) {
4705
+ const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken: result.continuationToken });
4706
+ result = yield tslib.__await(tracingClient.withSpan("TableClient.listEntitiesPage", optionsWithContinuation, (updatedOptions, span) => {
4707
+ span.setAttribute("continuationToken", result.continuationToken);
4708
+ return this._listEntities(tableName, updatedOptions);
4709
+ }));
4710
+ yield yield tslib.__await(result);
4711
+ }
4712
+ });
4753
4713
  }
4754
4714
  async _listEntities(tableName, options = {}) {
4755
4715
  const { disableTypeConversion = false } = options;
4756
4716
  const queryOptions = serializeQueryOptions(options.queryOptions || {});
4757
- const listEntitiesOptions = {
4758
- ...options,
4759
- queryOptions,
4760
- };
4717
+ const listEntitiesOptions = Object.assign(Object.assign({}, options), { queryOptions });
4761
4718
  // If a continuation token is used, decode it and set the next row and partition key
4762
4719
  if (options.continuationToken) {
4763
4720
  const continuationToken = decodeContinuationToken(options.continuationToken);
@@ -4765,7 +4722,7 @@ class TableClient {
4765
4722
  listEntitiesOptions.nextPartitionKey = continuationToken.nextPartitionKey;
4766
4723
  }
4767
4724
  const { xMsContinuationNextPartitionKey: nextPartitionKey, xMsContinuationNextRowKey: nextRowKey, value, } = await this.table.queryEntities(tableName, listEntitiesOptions);
4768
- const tableEntities = deserializeObjectsArray(value ?? [], disableTypeConversion);
4725
+ const tableEntities = deserializeObjectsArray(value !== null && value !== void 0 ? value : [], disableTypeConversion);
4769
4726
  // Encode nextPartitionKey and nextRowKey as a single continuation token and add it as a
4770
4727
  // property to the page.
4771
4728
  const continuationToken = encodeContinuationToken(nextPartitionKey, nextRowKey);
@@ -4802,12 +4759,8 @@ class TableClient {
4802
4759
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4803
4760
  options = {}) {
4804
4761
  return tracingClient.withSpan("TableClient.createEntity", options, (updatedOptions) => {
4805
- const { ...createTableEntity } = updatedOptions || {};
4806
- return this.table.insertEntity(this.tableName, {
4807
- ...createTableEntity,
4808
- tableEntityProperties: serialize(entity),
4809
- responsePreference: "return-no-content",
4810
- });
4762
+ const createTableEntity = tslib.__rest(updatedOptions || {}, []);
4763
+ return this.table.insertEntity(this.tableName, Object.assign(Object.assign({}, createTableEntity), { tableEntityProperties: serialize(entity), responsePreference: "return-no-content" }));
4811
4764
  });
4812
4765
  }
4813
4766
  /**
@@ -4839,10 +4792,8 @@ class TableClient {
4839
4792
  // eslint-disable-next-line @azure/azure-sdk/ts-naming-options
4840
4793
  options = {}) {
4841
4794
  return tracingClient.withSpan("TableClient.deleteEntity", options, (updatedOptions) => {
4842
- const { etag = "*", ...rest } = updatedOptions;
4843
- const deleteOptions = {
4844
- ...rest,
4845
- };
4795
+ const { etag = "*" } = updatedOptions, rest = tslib.__rest(updatedOptions, ["etag"]);
4796
+ const deleteOptions = Object.assign({}, rest);
4846
4797
  return this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
4847
4798
  });
4848
4799
  }
@@ -4891,20 +4842,12 @@ class TableClient {
4891
4842
  return tracingClient.withSpan("TableClient.updateEntity", options, async (updatedOptions) => {
4892
4843
  const partitionKey = escapeQuotes(entity.partitionKey);
4893
4844
  const rowKey = escapeQuotes(entity.rowKey);
4894
- const { etag = "*", ...updateEntityOptions } = updatedOptions || {};
4845
+ const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
4895
4846
  if (mode === "Merge") {
4896
- return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {
4897
- tableEntityProperties: serialize(entity),
4898
- ifMatch: etag,
4899
- ...updateEntityOptions,
4900
- });
4847
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4901
4848
  }
4902
4849
  if (mode === "Replace") {
4903
- return this.table.updateEntity(this.tableName, partitionKey, rowKey, {
4904
- tableEntityProperties: serialize(entity),
4905
- ifMatch: etag,
4906
- ...updateEntityOptions,
4907
- });
4850
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
4908
4851
  }
4909
4852
  throw new Error(`Unexpected value for update mode: ${mode}`);
4910
4853
  }, {
@@ -4955,16 +4898,10 @@ class TableClient {
4955
4898
  const partitionKey = escapeQuotes(entity.partitionKey);
4956
4899
  const rowKey = escapeQuotes(entity.rowKey);
4957
4900
  if (mode === "Merge") {
4958
- return this.table.mergeEntity(this.tableName, partitionKey, rowKey, {
4959
- tableEntityProperties: serialize(entity),
4960
- ...updatedOptions,
4961
- });
4901
+ return this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4962
4902
  }
4963
4903
  if (mode === "Replace") {
4964
- return this.table.updateEntity(this.tableName, partitionKey, rowKey, {
4965
- tableEntityProperties: serialize(entity),
4966
- ...updatedOptions,
4967
- });
4904
+ return this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
4968
4905
  }
4969
4906
  throw new Error(`Unexpected value for update mode: ${mode}`);
4970
4907
  }, {
@@ -4992,10 +4929,7 @@ class TableClient {
4992
4929
  setAccessPolicy(tableAcl, options = {}) {
4993
4930
  return tracingClient.withSpan("TableClient.setAccessPolicy", options, (updatedOptions) => {
4994
4931
  const serlializedAcl = serializeSignedIdentifiers(tableAcl);
4995
- return this.table.setAccessPolicy(this.tableName, {
4996
- ...updatedOptions,
4997
- tableAcl: serlializedAcl,
4998
- });
4932
+ return this.table.setAccessPolicy(this.tableName, Object.assign(Object.assign({}, updatedOptions), { tableAcl: serlializedAcl }));
4999
4933
  });
5000
4934
  }
5001
4935
  /**