@azure/data-tables 13.0.1-alpha.20211214.2 → 13.0.1-alpha.20220103.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/README.md +49 -1
- package/dist/index.js +58 -59
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +16 -16
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TablePolicies.js +6 -6
- package/dist-esm/src/TablePolicies.js.map +1 -1
- package/dist-esm/src/TableServiceClient.js +7 -7
- package/dist-esm/src/TableServiceClient.js.map +1 -1
- package/dist-esm/src/TableTransaction.js +16 -15
- package/dist-esm/src/TableTransaction.js.map +1 -1
- package/dist-esm/src/cosmosPathPolicy.js +1 -1
- package/dist-esm/src/cosmosPathPolicy.js.map +1 -1
- package/dist-esm/src/generatedModels.js +1 -1
- package/dist-esm/src/generatedModels.js.map +1 -1
- package/dist-esm/src/sas/accountSasSignatureValues.js +3 -3
- package/dist-esm/src/sas/accountSasSignatureValues.js.map +1 -1
- package/dist-esm/src/sas/generateAccountSas.js +1 -1
- package/dist-esm/src/sas/generateAccountSas.js.map +1 -1
- package/dist-esm/src/sas/generateTableSas.js +1 -1
- package/dist-esm/src/sas/generateTableSas.js.map +1 -1
- package/dist-esm/src/sas/sasQueryParameters.js +2 -2
- package/dist-esm/src/sas/sasQueryParameters.js.map +1 -1
- package/dist-esm/src/sas/tableSasSignatureValues.js +2 -2
- package/dist-esm/src/sas/tableSasSignatureValues.js.map +1 -1
- package/dist-esm/src/serialization.js +4 -4
- package/dist-esm/src/serialization.js.map +1 -1
- package/dist-esm/src/tablesNamedCredentialPolicy.js +2 -2
- package/dist-esm/src/tablesNamedCredentialPolicy.js.map +1 -1
- package/dist-esm/src/tablesSASTokenPolicy.js +1 -1
- package/dist-esm/src/tablesSASTokenPolicy.js.map +1 -1
- package/dist-esm/src/utils/accountConnectionString.js +2 -2
- package/dist-esm/src/utils/accountConnectionString.js.map +1 -1
- package/dist-esm/src/utils/baseTransactionHeaders.js +1 -1
- package/dist-esm/src/utils/baseTransactionHeaders.js.map +1 -1
- package/dist-esm/src/utils/computeHMACSHA256.js +1 -3
- package/dist-esm/src/utils/computeHMACSHA256.js.map +1 -1
- package/dist-esm/src/utils/connectionString.js +1 -1
- package/dist-esm/src/utils/connectionString.js.map +1 -1
- package/dist-esm/src/utils/constants.js +2 -2
- package/dist-esm/src/utils/constants.js.map +1 -1
- package/dist-esm/src/utils/continuationToken.js +1 -1
- package/dist-esm/src/utils/continuationToken.js.map +1 -1
- package/dist-esm/src/utils/internalModels.js.map +1 -1
- package/dist-esm/src/utils/isCredential.js +1 -1
- package/dist-esm/src/utils/isCredential.js.map +1 -1
- package/dist-esm/src/utils/tracing.js +1 -1
- package/dist-esm/src/utils/tracing.js.map +1 -1
- package/dist-esm/src/utils/transactionHeaders.js.map +1 -1
- package/dist-esm/src/utils/transactionHelpers.js +1 -1
- package/dist-esm/src/utils/transactionHelpers.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/data-tables.d.ts +1 -0
- package/types/latest/data-tables.d.ts +1 -0
package/README.md
CHANGED
|
@@ -123,6 +123,24 @@ const { TableServiceClient, AzureNamedKeyCredential } = require("@azure/data-tab
|
|
|
123
123
|
|
|
124
124
|
The `TableServiceClient` requires a URL to the table service and an access credential. It also optionally accepts some settings in the `options` parameter.
|
|
125
125
|
|
|
126
|
+
#### `TableServiceClient` with AzureNamedKeyCredential
|
|
127
|
+
|
|
128
|
+
You can instantiate a `TableServiceClient` with a `AzureNamedKeyCredential` by passing account-name and account-key as arguments. (The account-name and account-key can be obtained from the azure portal.)
|
|
129
|
+
[ONLY AVAILABLE IN NODE.JS RUNTIME]
|
|
130
|
+
|
|
131
|
+
```javascript
|
|
132
|
+
const { TableServiceClient, AzureNamedKeyCredential } = require("@azure/data-tables");
|
|
133
|
+
|
|
134
|
+
const account = "<account>";
|
|
135
|
+
const accountKey = "<accountkey>";
|
|
136
|
+
|
|
137
|
+
const credential = new AzureNamedKeyCredential(account, accountKey);
|
|
138
|
+
const serviceClient = new TableServiceClient(
|
|
139
|
+
`https://${account}.table.core.windows.net`,
|
|
140
|
+
credential
|
|
141
|
+
);
|
|
142
|
+
```
|
|
143
|
+
|
|
126
144
|
#### `TableServiceClient` with TokenCredential (AAD)
|
|
127
145
|
|
|
128
146
|
Azure Tables provides integration with Azure Active Directory (Azure AD) for identity-based authentication of requests
|
|
@@ -220,7 +238,7 @@ const serviceClient = new TableServiceClient(
|
|
|
220
238
|
|
|
221
239
|
async function main() {
|
|
222
240
|
const tableName = `newtable`;
|
|
223
|
-
// If the table 'newTable' already exists, createTable doesn' throw
|
|
241
|
+
// If the table 'newTable' already exists, createTable doesn't throw
|
|
224
242
|
await serviceClient.createTable(tableName);
|
|
225
243
|
}
|
|
226
244
|
|
|
@@ -326,6 +344,36 @@ const clientWithSAS = new TableClient(
|
|
|
326
344
|
);
|
|
327
345
|
```
|
|
328
346
|
|
|
347
|
+
#### `TableClient` with TokenCredential (AAD)
|
|
348
|
+
|
|
349
|
+
Azure Tables provides integration with Azure Active Directory (Azure AD) for identity-based authentication of requests
|
|
350
|
+
to the Table service when targeting a Storage endpoint. With Azure AD, you can use role-based access control (RBAC) to
|
|
351
|
+
grant access to your Azure Table resources to users, groups, or applications.
|
|
352
|
+
|
|
353
|
+
To access a table resource with a `TokenCredential`, the authenticated identity should have either the "Storage Table Data Contributor" or "Storage Table Data Reader" role.
|
|
354
|
+
|
|
355
|
+
With the `@azure/identity` package, you can seamlessly authorize requests in both development and production environments.
|
|
356
|
+
To learn more about Azure AD integration in Azure Storage, see the [Azure.Identity README](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md)
|
|
357
|
+
|
|
358
|
+
```javascript
|
|
359
|
+
const { TableClient } = require("@azure/data-tables");
|
|
360
|
+
const { DefaultAzureCredential } = require("@azure/identity");
|
|
361
|
+
|
|
362
|
+
// DefaultAzureCredential expects the following three environment variables:
|
|
363
|
+
// - AZURE_TENANT_ID: The tenant ID in Azure Active Directory
|
|
364
|
+
// - AZURE_CLIENT_ID: The application (client) ID registered in the AAD tenant
|
|
365
|
+
// - AZURE_CLIENT_SECRET: The client secret for the registered application
|
|
366
|
+
const credential = new DefaultAzureCredential();
|
|
367
|
+
const account = "<account name>";
|
|
368
|
+
const tableName = "<tableName>";
|
|
369
|
+
|
|
370
|
+
const clientWithAAD = new TableClient(
|
|
371
|
+
`https://${account}.table.core.windows.net`,
|
|
372
|
+
tableName,
|
|
373
|
+
credential
|
|
374
|
+
);
|
|
375
|
+
```
|
|
376
|
+
|
|
329
377
|
#### List Entities in a table
|
|
330
378
|
|
|
331
379
|
You can list entities within a table by through a `TableClient` instance calling the `listEntities` function. This function returns a `PageableAsyncIterator` that you can consume using `for-await-of`
|
package/dist/index.js
CHANGED
|
@@ -246,7 +246,7 @@ class SasQueryParameters {
|
|
|
246
246
|
if (this.ipRangeInner) {
|
|
247
247
|
return {
|
|
248
248
|
end: this.ipRangeInner.end,
|
|
249
|
-
start: this.ipRangeInner.start
|
|
249
|
+
start: this.ipRangeInner.start,
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
return undefined;
|
|
@@ -281,7 +281,7 @@ class SasQueryParameters {
|
|
|
281
281
|
"rsct",
|
|
282
282
|
"saoid",
|
|
283
283
|
"scid",
|
|
284
|
-
"tn" // TableName
|
|
284
|
+
"tn", // TableName
|
|
285
285
|
];
|
|
286
286
|
const queries = [];
|
|
287
287
|
for (const param of params) {
|
|
@@ -427,7 +427,7 @@ const HeaderConstants = {
|
|
|
427
427
|
CONTENT_TRANSFER_ENCODING: "content-transfer-encoding",
|
|
428
428
|
DATE: "date",
|
|
429
429
|
X_MS_DATE: "x-ms-date",
|
|
430
|
-
X_MS_VERSION: "x-ms-version"
|
|
430
|
+
X_MS_VERSION: "x-ms-version",
|
|
431
431
|
};
|
|
432
432
|
const TablesLoggingAllowedHeaderNames = [
|
|
433
433
|
"Access-Control-Allow-Origin",
|
|
@@ -510,15 +510,13 @@ const TablesLoggingAllowedHeaderNames = [
|
|
|
510
510
|
"x-ms-source-if-none-match",
|
|
511
511
|
"x-ms-source-if-unmodified-since",
|
|
512
512
|
"x-ms-tag-count",
|
|
513
|
-
"x-ms-encryption-key-sha256"
|
|
513
|
+
"x-ms-encryption-key-sha256",
|
|
514
514
|
];
|
|
515
515
|
|
|
516
516
|
// Copyright (c) Microsoft Corporation.
|
|
517
517
|
function computeHMACSHA256(stringToSign, accountKey) {
|
|
518
518
|
const key = Buffer.from(accountKey, "base64");
|
|
519
|
-
return crypto.createHmac("sha256", key)
|
|
520
|
-
.update(stringToSign, "utf8")
|
|
521
|
-
.digest("base64");
|
|
519
|
+
return crypto.createHmac("sha256", key).update(stringToSign, "utf8").digest("base64");
|
|
522
520
|
}
|
|
523
521
|
|
|
524
522
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -553,7 +551,7 @@ function generateAccountSasQueryParameters(accountSasSignatureValues, credential
|
|
|
553
551
|
accountSasSignatureValues.ipRange ? ipRangeToString(accountSasSignatureValues.ipRange) : "",
|
|
554
552
|
accountSasSignatureValues.protocol ? accountSasSignatureValues.protocol : "",
|
|
555
553
|
version,
|
|
556
|
-
"" // Account SAS requires an additional newline character
|
|
554
|
+
"", // Account SAS requires an additional newline character
|
|
557
555
|
].join("\n");
|
|
558
556
|
const signature = computeHMACSHA256(stringToSign, credential.key);
|
|
559
557
|
return new SasQueryParameters(version, signature, {
|
|
@@ -563,7 +561,7 @@ function generateAccountSasQueryParameters(accountSasSignatureValues, credential
|
|
|
563
561
|
protocol: accountSasSignatureValues.protocol,
|
|
564
562
|
startsOn: accountSasSignatureValues.startsOn,
|
|
565
563
|
expiresOn: accountSasSignatureValues.expiresOn,
|
|
566
|
-
ipRange: accountSasSignatureValues.ipRange
|
|
564
|
+
ipRange: accountSasSignatureValues.ipRange,
|
|
567
565
|
});
|
|
568
566
|
}
|
|
569
567
|
|
|
@@ -691,7 +689,7 @@ function generateTableSasQueryParameters(tableName, credential, tableSasSignatur
|
|
|
691
689
|
startingPartitionKey,
|
|
692
690
|
startingRowKey,
|
|
693
691
|
endingPartitionKey,
|
|
694
|
-
endingRowKey
|
|
692
|
+
endingRowKey,
|
|
695
693
|
].join("\n");
|
|
696
694
|
const signature = computeHMACSHA256(stringToSign, credential.key);
|
|
697
695
|
return new SasQueryParameters(version, signature, {
|
|
@@ -701,7 +699,7 @@ function generateTableSasQueryParameters(tableName, credential, tableSasSignatur
|
|
|
701
699
|
expiresOn: tableSasSignatureValues.expiresOn,
|
|
702
700
|
ipRange: tableSasSignatureValues.ipRange,
|
|
703
701
|
identifier: tableSasSignatureValues.identifier,
|
|
704
|
-
tableName
|
|
702
|
+
tableName,
|
|
705
703
|
});
|
|
706
704
|
}
|
|
707
705
|
function getCanonicalName(accountName, tableName) {
|
|
@@ -3113,7 +3111,7 @@ class GeneratedClient extends GeneratedClientContext {
|
|
|
3113
3111
|
*/
|
|
3114
3112
|
const createSpan = coreTracing.createSpanFunction({
|
|
3115
3113
|
packagePrefix: "Azure.Data.Tables",
|
|
3116
|
-
namespace: "Microsoft.Data.Tables"
|
|
3114
|
+
namespace: "Microsoft.Data.Tables",
|
|
3117
3115
|
});
|
|
3118
3116
|
|
|
3119
3117
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -3128,7 +3126,7 @@ function fromAccountConnectionString(extractedCreds, options = {}) {
|
|
|
3128
3126
|
return {
|
|
3129
3127
|
url: extractedCreds.url,
|
|
3130
3128
|
options,
|
|
3131
|
-
credential: sharedKeyCredential
|
|
3129
|
+
credential: sharedKeyCredential,
|
|
3132
3130
|
};
|
|
3133
3131
|
}
|
|
3134
3132
|
function getAccountConnectionString(accountName, accountKey, defaultEndpointsProtocol, endpointSuffix, tableEndpoint) {
|
|
@@ -3154,7 +3152,7 @@ function getAccountConnectionString(accountName, accountKey, defaultEndpointsPro
|
|
|
3154
3152
|
kind: "AccountConnString",
|
|
3155
3153
|
url: tableEndpoint,
|
|
3156
3154
|
accountName,
|
|
3157
|
-
accountKey
|
|
3155
|
+
accountKey,
|
|
3158
3156
|
};
|
|
3159
3157
|
}
|
|
3160
3158
|
|
|
@@ -3182,7 +3180,7 @@ function getClientParamsFromConnectionString(connectionString, options = {}) {
|
|
|
3182
3180
|
else if (extractedCreds.kind === "SASConnString") {
|
|
3183
3181
|
return {
|
|
3184
3182
|
url: `${extractedCreds.url}?${extractedCreds.accountSas}`,
|
|
3185
|
-
options
|
|
3183
|
+
options,
|
|
3186
3184
|
};
|
|
3187
3185
|
}
|
|
3188
3186
|
else {
|
|
@@ -3350,7 +3348,7 @@ function tablesNamedKeyCredentialPolicy(credential) {
|
|
|
3350
3348
|
async sendRequest(request, next) {
|
|
3351
3349
|
signRequest(request);
|
|
3352
3350
|
return next(request);
|
|
3353
|
-
}
|
|
3351
|
+
},
|
|
3354
3352
|
};
|
|
3355
3353
|
}
|
|
3356
3354
|
function getAuthorizationHeader(request, credential) {
|
|
@@ -3367,7 +3365,7 @@ function getAuthorizationHeader(request, credential) {
|
|
|
3367
3365
|
}
|
|
3368
3366
|
const stringToSign = [
|
|
3369
3367
|
dateHeader,
|
|
3370
|
-
getCanonicalizedResourceString(request, credential)
|
|
3368
|
+
getCanonicalizedResourceString(request, credential),
|
|
3371
3369
|
].join("\n");
|
|
3372
3370
|
const signature = computeHMACSHA256(stringToSign, credential.key);
|
|
3373
3371
|
return `SharedKeyLite ${credential.name}:${signature}`;
|
|
@@ -3406,7 +3404,7 @@ function tablesSASTokenPolicy(credential) {
|
|
|
3406
3404
|
async sendRequest(request, next) {
|
|
3407
3405
|
signURLWithSAS(request, credential);
|
|
3408
3406
|
return next(request);
|
|
3409
|
-
}
|
|
3407
|
+
},
|
|
3410
3408
|
};
|
|
3411
3409
|
}
|
|
3412
3410
|
function signURLWithSAS(request, credential) {
|
|
@@ -3432,14 +3430,14 @@ class TableServiceClient {
|
|
|
3432
3430
|
const internalPipelineOptions = Object.assign(Object.assign(Object.assign({}, clientOptions), {
|
|
3433
3431
|
loggingOptions: {
|
|
3434
3432
|
logger: logger.info,
|
|
3435
|
-
additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames]
|
|
3433
|
+
additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],
|
|
3436
3434
|
},
|
|
3437
3435
|
deserializationOptions: {
|
|
3438
|
-
parseXML: coreXml.parseXML
|
|
3436
|
+
parseXML: coreXml.parseXML,
|
|
3439
3437
|
},
|
|
3440
3438
|
serializationOptions: {
|
|
3441
|
-
stringifyXML: coreXml.stringifyXML
|
|
3442
|
-
}
|
|
3439
|
+
stringifyXML: coreXml.stringifyXML,
|
|
3440
|
+
},
|
|
3443
3441
|
}), (coreAuth.isTokenCredential(credential) && { credential, credentialScopes: STORAGE_SCOPE }));
|
|
3444
3442
|
const client = new GeneratedClient(this.url, internalPipelineOptions);
|
|
3445
3443
|
if (coreAuth.isNamedKeyCredential(credential)) {
|
|
@@ -3568,7 +3566,7 @@ class TableServiceClient {
|
|
|
3568
3566
|
pageOptions.continuationToken = settings.continuationToken;
|
|
3569
3567
|
}
|
|
3570
3568
|
return this.listTablesPage(pageOptions);
|
|
3571
|
-
}
|
|
3569
|
+
},
|
|
3572
3570
|
};
|
|
3573
3571
|
}
|
|
3574
3572
|
listTablesAll(options) {
|
|
@@ -3637,7 +3635,7 @@ class TableServiceClient {
|
|
|
3637
3635
|
static fromConnectionString(connectionString,
|
|
3638
3636
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
3639
3637
|
options) {
|
|
3640
|
-
const { url, options: clientOptions, credential } = getClientParamsFromConnectionString(connectionString, options);
|
|
3638
|
+
const { url, options: clientOptions, credential, } = getClientParamsFromConnectionString(connectionString, options);
|
|
3641
3639
|
if (credential) {
|
|
3642
3640
|
return new TableServiceClient(url, credential, clientOptions);
|
|
3643
3641
|
}
|
|
@@ -3670,7 +3668,7 @@ function getTransactionBoundary(transactionId) {
|
|
|
3670
3668
|
function getInitialTransactionBody(transactionId, changesetId) {
|
|
3671
3669
|
const transactionBoundary = `batch_${transactionId}`;
|
|
3672
3670
|
return [
|
|
3673
|
-
`--${transactionBoundary}${TRANSACTION_HTTP_LINE_ENDING}${HeaderConstants.CONTENT_TYPE}: multipart/mixed; boundary=changeset_${changesetId}${TRANSACTION_HTTP_LINE_ENDING}${TRANSACTION_HTTP_LINE_ENDING}
|
|
3671
|
+
`--${transactionBoundary}${TRANSACTION_HTTP_LINE_ENDING}${HeaderConstants.CONTENT_TYPE}: multipart/mixed; boundary=changeset_${changesetId}${TRANSACTION_HTTP_LINE_ENDING}${TRANSACTION_HTTP_LINE_ENDING}`,
|
|
3674
3672
|
];
|
|
3675
3673
|
}
|
|
3676
3674
|
/**
|
|
@@ -3693,7 +3691,7 @@ const transactionRequestAssemblePolicyName = "transactionRequestAssemblePolicy";
|
|
|
3693
3691
|
const dummyResponse = {
|
|
3694
3692
|
request: coreRestPipeline.createPipelineRequest({ url: "FAKE" }),
|
|
3695
3693
|
status: 200,
|
|
3696
|
-
headers: coreRestPipeline.createHttpHeaders()
|
|
3694
|
+
headers: coreRestPipeline.createHttpHeaders(),
|
|
3697
3695
|
};
|
|
3698
3696
|
function transactionRequestAssemblePolicy(bodyParts, changesetId) {
|
|
3699
3697
|
return {
|
|
@@ -3703,7 +3701,7 @@ function transactionRequestAssemblePolicy(bodyParts, changesetId) {
|
|
|
3703
3701
|
bodyParts.push(subRequest);
|
|
3704
3702
|
// Intercept request from going to wire
|
|
3705
3703
|
return dummyResponse;
|
|
3706
|
-
}
|
|
3704
|
+
},
|
|
3707
3705
|
};
|
|
3708
3706
|
}
|
|
3709
3707
|
const transactionHeaderFilterPolicyName = "transactionHeaderFilterPolicy";
|
|
@@ -3714,7 +3712,7 @@ function transactionHeaderFilterPolicy() {
|
|
|
3714
3712
|
// The subrequests should not have the x-ms-version header.
|
|
3715
3713
|
request.headers.delete(HeaderConstants.X_MS_VERSION);
|
|
3716
3714
|
return next(request);
|
|
3717
|
-
}
|
|
3715
|
+
},
|
|
3718
3716
|
};
|
|
3719
3717
|
}
|
|
3720
3718
|
function getSubRequestUrl(url) {
|
|
@@ -3731,7 +3729,7 @@ function getNextSubrequestBodyPart(request, changesetId) {
|
|
|
3731
3729
|
const subRequest = [
|
|
3732
3730
|
subRequestPrefix,
|
|
3733
3731
|
"",
|
|
3734
|
-
`${request.method.toString()} ${subRequestUrl} ${TRANSACTION_HTTP_VERSION_1_1}
|
|
3732
|
+
`${request.method.toString()} ${subRequestUrl} ${TRANSACTION_HTTP_VERSION_1_1}`, // sub request start line with method,
|
|
3735
3733
|
];
|
|
3736
3734
|
// Add required headers
|
|
3737
3735
|
for (const [name, value] of request.headers) {
|
|
@@ -3758,7 +3756,7 @@ function cosmosPatchPolicy() {
|
|
|
3758
3756
|
request.headers.set("X-HTTP-Method", "MERGE");
|
|
3759
3757
|
}
|
|
3760
3758
|
return next(request);
|
|
3761
|
-
}
|
|
3759
|
+
},
|
|
3762
3760
|
};
|
|
3763
3761
|
}
|
|
3764
3762
|
|
|
@@ -3774,7 +3772,7 @@ function getBaseTransactionHeaders(transactionGuid) {
|
|
|
3774
3772
|
"x-ms-version": "2019-02-02",
|
|
3775
3773
|
DataServiceVersion: "3.0;",
|
|
3776
3774
|
MaxDataServiceVersion: "3.0;NetFx",
|
|
3777
|
-
"Content-Type": `multipart/mixed; boundary=batch_${transactionGuid}
|
|
3775
|
+
"Content-Type": `multipart/mixed; boundary=batch_${transactionGuid}`,
|
|
3778
3776
|
};
|
|
3779
3777
|
}
|
|
3780
3778
|
|
|
@@ -3854,7 +3852,8 @@ class InternalTableTransaction {
|
|
|
3854
3852
|
* @param partitionKey - partition key
|
|
3855
3853
|
* @param credential - credential to authenticate the transaction request
|
|
3856
3854
|
*/
|
|
3857
|
-
constructor(url, partitionKey, transactionId, changesetId, interceptClient, credential, allowInsecureConnection = false) {
|
|
3855
|
+
constructor(url, partitionKey, transactionId, changesetId, clientOptions, interceptClient, credential, allowInsecureConnection = false) {
|
|
3856
|
+
this.clientOptions = clientOptions;
|
|
3858
3857
|
this.credential = credential;
|
|
3859
3858
|
this.url = url;
|
|
3860
3859
|
this.interceptClient = interceptClient;
|
|
@@ -3890,7 +3889,7 @@ class InternalTableTransaction {
|
|
|
3890
3889
|
changesetId,
|
|
3891
3890
|
partitionKey,
|
|
3892
3891
|
pendingOperations,
|
|
3893
|
-
bodyParts
|
|
3892
|
+
bodyParts,
|
|
3894
3893
|
};
|
|
3895
3894
|
}
|
|
3896
3895
|
/**
|
|
@@ -3949,7 +3948,7 @@ class InternalTableTransaction {
|
|
|
3949
3948
|
async submitTransaction() {
|
|
3950
3949
|
await Promise.all(this.resetableState.pendingOperations);
|
|
3951
3950
|
const body = getTransactionHttpRequestBody(this.resetableState.bodyParts, this.resetableState.transactionId, this.resetableState.changesetId);
|
|
3952
|
-
const options =
|
|
3951
|
+
const options = this.clientOptions;
|
|
3953
3952
|
if (coreAuth.isTokenCredential(this.credential)) {
|
|
3954
3953
|
options.credentialScopes = STORAGE_SCOPE;
|
|
3955
3954
|
options.credential = this.credential;
|
|
@@ -3963,7 +3962,7 @@ class InternalTableTransaction {
|
|
|
3963
3962
|
body,
|
|
3964
3963
|
headers: coreRestPipeline.createHttpHeaders(headers),
|
|
3965
3964
|
tracingOptions: updatedOptions.tracingOptions,
|
|
3966
|
-
allowInsecureConnection: this.allowInsecureConnection
|
|
3965
|
+
allowInsecureConnection: this.allowInsecureConnection,
|
|
3967
3966
|
});
|
|
3968
3967
|
if (coreAuth.isNamedKeyCredential(this.credential)) {
|
|
3969
3968
|
const authHeader = getAuthorizationHeader(request, this.credential);
|
|
@@ -3979,7 +3978,7 @@ class InternalTableTransaction {
|
|
|
3979
3978
|
catch (error) {
|
|
3980
3979
|
span.setStatus({
|
|
3981
3980
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
3982
|
-
message: error.message
|
|
3981
|
+
message: error.message,
|
|
3983
3982
|
});
|
|
3984
3983
|
throw error;
|
|
3985
3984
|
}
|
|
@@ -4028,7 +4027,7 @@ function parseTransactionResponse(transactionResponse) {
|
|
|
4028
4027
|
return {
|
|
4029
4028
|
status,
|
|
4030
4029
|
subResponses: responses,
|
|
4031
|
-
getResponseForEntity: (rowKey) => responses.find((r) => r.rowKey === rowKey)
|
|
4030
|
+
getResponseForEntity: (rowKey) => responses.find((r) => r.rowKey === rowKey),
|
|
4032
4031
|
};
|
|
4033
4032
|
}
|
|
4034
4033
|
function handleBodyError(bodyAsText, statusCode, request, response) {
|
|
@@ -4052,7 +4051,7 @@ function handleBodyError(bodyAsText, statusCode, request, response) {
|
|
|
4052
4051
|
code,
|
|
4053
4052
|
statusCode,
|
|
4054
4053
|
request,
|
|
4055
|
-
response
|
|
4054
|
+
response,
|
|
4056
4055
|
});
|
|
4057
4056
|
}
|
|
4058
4057
|
/**
|
|
@@ -4065,7 +4064,7 @@ function prepateTransactionPipeline(pipeline, bodyParts, changesetId, isCosmos)
|
|
|
4065
4064
|
const policies = pipeline.getOrderedPolicies();
|
|
4066
4065
|
for (const policy of policies) {
|
|
4067
4066
|
pipeline.removePolicy({
|
|
4068
|
-
name: policy.name
|
|
4067
|
+
name: policy.name,
|
|
4069
4068
|
});
|
|
4070
4069
|
}
|
|
4071
4070
|
// With the clear state we now initialize the pipelines required for intercepting the requests.
|
|
@@ -4076,7 +4075,7 @@ function prepateTransactionPipeline(pipeline, bodyParts, changesetId, isCosmos)
|
|
|
4076
4075
|
if (isCosmos) {
|
|
4077
4076
|
pipeline.addPolicy(cosmosPatchPolicy(), {
|
|
4078
4077
|
afterPolicies: [transactionHeaderFilterPolicyName],
|
|
4079
|
-
beforePolicies: [coreClient.serializationPolicyName, transactionRequestAssemblePolicyName]
|
|
4078
|
+
beforePolicies: [coreClient.serializationPolicyName, transactionRequestAssemblePolicyName],
|
|
4080
4079
|
});
|
|
4081
4080
|
}
|
|
4082
4081
|
}
|
|
@@ -4114,7 +4113,7 @@ function encodeContinuationToken(nextPartitionKey = "", nextRowKey = "") {
|
|
|
4114
4113
|
}
|
|
4115
4114
|
const continuationToken = JSON.stringify({
|
|
4116
4115
|
nextPartitionKey,
|
|
4117
|
-
nextRowKey
|
|
4116
|
+
nextRowKey,
|
|
4118
4117
|
});
|
|
4119
4118
|
return base64Encode(continuationToken);
|
|
4120
4119
|
}
|
|
@@ -4136,7 +4135,7 @@ const propertyCaseMap = new Map([
|
|
|
4136
4135
|
["PartitionKey", "partitionKey"],
|
|
4137
4136
|
["RowKey", "rowKey"],
|
|
4138
4137
|
["odata.etag", "etag"],
|
|
4139
|
-
["Timestamp", "timestamp"]
|
|
4138
|
+
["Timestamp", "timestamp"],
|
|
4140
4139
|
]);
|
|
4141
4140
|
const Edm = {
|
|
4142
4141
|
Binary: "Edm.Binary",
|
|
@@ -4146,7 +4145,7 @@ const Edm = {
|
|
|
4146
4145
|
Guid: "Edm.Guid",
|
|
4147
4146
|
Int32: "Edm.Int32",
|
|
4148
4147
|
Int64: "Edm.Int64",
|
|
4149
|
-
String: "Edm.String"
|
|
4148
|
+
String: "Edm.String",
|
|
4150
4149
|
};
|
|
4151
4150
|
function serializePrimitive(value) {
|
|
4152
4151
|
const serializedValue = { value };
|
|
@@ -4312,7 +4311,7 @@ function serializeSignedIdentifiers(signedIdentifiers) {
|
|
|
4312
4311
|
: undefined;
|
|
4313
4312
|
return {
|
|
4314
4313
|
id,
|
|
4315
|
-
accessPolicy: Object.assign(Object.assign(Object.assign({}, (serializedExpiry && { expiry: serializedExpiry })), (serializedStart && { start: serializedStart })), rest)
|
|
4314
|
+
accessPolicy: Object.assign(Object.assign(Object.assign({}, (serializedExpiry && { expiry: serializedExpiry })), (serializedStart && { start: serializedStart })), rest),
|
|
4316
4315
|
};
|
|
4317
4316
|
});
|
|
4318
4317
|
}
|
|
@@ -4324,7 +4323,7 @@ function deserializeSignedIdentifier(signedIdentifiers) {
|
|
|
4324
4323
|
const deserializedExpiry = expiry ? new Date(expiry) : undefined;
|
|
4325
4324
|
return {
|
|
4326
4325
|
id,
|
|
4327
|
-
accessPolicy: Object.assign(Object.assign(Object.assign({}, (deserializedExpiry && { expiry: deserializedExpiry })), (deserializedStart && { start: deserializedStart })), restAcl)
|
|
4326
|
+
accessPolicy: Object.assign(Object.assign(Object.assign({}, (deserializedExpiry && { expiry: deserializedExpiry })), (deserializedStart && { start: deserializedStart })), restAcl),
|
|
4328
4327
|
};
|
|
4329
4328
|
});
|
|
4330
4329
|
}
|
|
@@ -4393,19 +4392,19 @@ class TableClient {
|
|
|
4393
4392
|
this.tableName = tableName;
|
|
4394
4393
|
const credential = isCredential(credentialOrOptions) ? credentialOrOptions : undefined;
|
|
4395
4394
|
this.credential = credential;
|
|
4396
|
-
|
|
4397
|
-
this.allowInsecureConnection = (_a = clientOptions.allowInsecureConnection) !== null && _a !== void 0 ? _a : false;
|
|
4398
|
-
clientOptions.endpoint = clientOptions.endpoint || this.url;
|
|
4399
|
-
const internalPipelineOptions = Object.assign(Object.assign(Object.assign({}, clientOptions), { loggingOptions: {
|
|
4395
|
+
this.clientOptions = (!isCredential(credentialOrOptions) ? credentialOrOptions : options) || {};
|
|
4396
|
+
this.allowInsecureConnection = (_a = this.clientOptions.allowInsecureConnection) !== null && _a !== void 0 ? _a : false;
|
|
4397
|
+
this.clientOptions.endpoint = this.clientOptions.endpoint || this.url;
|
|
4398
|
+
const internalPipelineOptions = Object.assign(Object.assign(Object.assign({}, this.clientOptions), { loggingOptions: {
|
|
4400
4399
|
logger: logger.info,
|
|
4401
|
-
additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames]
|
|
4400
|
+
additionalAllowedHeaderNames: [...TablesLoggingAllowedHeaderNames],
|
|
4402
4401
|
}, deserializationOptions: {
|
|
4403
|
-
parseXML: coreXml.parseXML
|
|
4402
|
+
parseXML: coreXml.parseXML,
|
|
4404
4403
|
}, serializationOptions: {
|
|
4405
|
-
stringifyXML: coreXml.stringifyXML
|
|
4404
|
+
stringifyXML: coreXml.stringifyXML,
|
|
4406
4405
|
} }), (coreAuth.isTokenCredential(this.credential) && {
|
|
4407
4406
|
credential: this.credential,
|
|
4408
|
-
credentialScopes: STORAGE_SCOPE
|
|
4407
|
+
credentialScopes: STORAGE_SCOPE,
|
|
4409
4408
|
}));
|
|
4410
4409
|
const generatedClient = new GeneratedClient(this.url, internalPipelineOptions);
|
|
4411
4410
|
if (coreAuth.isNamedKeyCredential(credential)) {
|
|
@@ -4601,7 +4600,7 @@ class TableClient {
|
|
|
4601
4600
|
pageOptions.continuationToken = settings.continuationToken;
|
|
4602
4601
|
}
|
|
4603
4602
|
return this.listEntitiesPage(tableName, pageOptions);
|
|
4604
|
-
}
|
|
4603
|
+
},
|
|
4605
4604
|
};
|
|
4606
4605
|
}
|
|
4607
4606
|
listEntitiesAll(tableName, options) {
|
|
@@ -4642,7 +4641,7 @@ class TableClient {
|
|
|
4642
4641
|
catch (e) {
|
|
4643
4642
|
span.setStatus({
|
|
4644
4643
|
code: coreTracing.SpanStatusCode.ERROR,
|
|
4645
|
-
message: e.message
|
|
4644
|
+
message: e.message,
|
|
4646
4645
|
});
|
|
4647
4646
|
throw e;
|
|
4648
4647
|
}
|
|
@@ -4661,13 +4660,13 @@ class TableClient {
|
|
|
4661
4660
|
listEntitiesOptions.nextRowKey = continuationToken.nextRowKey;
|
|
4662
4661
|
listEntitiesOptions.nextPartitionKey = continuationToken.nextPartitionKey;
|
|
4663
4662
|
}
|
|
4664
|
-
const { xMsContinuationNextPartitionKey: nextPartitionKey, xMsContinuationNextRowKey: nextRowKey, value } = await this.table.queryEntities(tableName, listEntitiesOptions);
|
|
4663
|
+
const { xMsContinuationNextPartitionKey: nextPartitionKey, xMsContinuationNextRowKey: nextRowKey, value, } = await this.table.queryEntities(tableName, listEntitiesOptions);
|
|
4665
4664
|
const tableEntities = deserializeObjectsArray(value !== null && value !== void 0 ? value : [], disableTypeConversion);
|
|
4666
4665
|
// Encode nextPartitionKey and nextRowKey as a single continuation token and add it as a
|
|
4667
4666
|
// property to the page.
|
|
4668
4667
|
const continuationToken = encodeContinuationToken(nextPartitionKey, nextRowKey);
|
|
4669
4668
|
const page = Object.assign([...tableEntities], {
|
|
4670
|
-
continuationToken
|
|
4669
|
+
continuationToken,
|
|
4671
4670
|
});
|
|
4672
4671
|
return page;
|
|
4673
4672
|
}
|
|
@@ -4953,7 +4952,7 @@ class TableClient {
|
|
|
4953
4952
|
const changesetId = Uuid.generateUuid();
|
|
4954
4953
|
if (!this.transactionClient) {
|
|
4955
4954
|
// Add pipeline
|
|
4956
|
-
this.transactionClient = new InternalTableTransaction(this.url, partitionKey, transactionId, changesetId, new TableClient(this.url, this.tableName), this.credential, this.allowInsecureConnection);
|
|
4955
|
+
this.transactionClient = new InternalTableTransaction(this.url, partitionKey, transactionId, changesetId, this.clientOptions, new TableClient(this.url, this.tableName), this.credential, this.allowInsecureConnection);
|
|
4957
4956
|
}
|
|
4958
4957
|
else {
|
|
4959
4958
|
this.transactionClient.reset(transactionId, changesetId, partitionKey);
|
|
@@ -4992,7 +4991,7 @@ class TableClient {
|
|
|
4992
4991
|
static fromConnectionString(connectionString, tableName,
|
|
4993
4992
|
// eslint-disable-next-line @azure/azure-sdk/ts-naming-options
|
|
4994
4993
|
options) {
|
|
4995
|
-
const { url, options: clientOptions, credential } = getClientParamsFromConnectionString(connectionString, options);
|
|
4994
|
+
const { url, options: clientOptions, credential, } = getClientParamsFromConnectionString(connectionString, options);
|
|
4996
4995
|
if (credential) {
|
|
4997
4996
|
return new TableClient(url, tableName, credential, clientOptions);
|
|
4998
4997
|
}
|