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