@azure/data-tables 12.2.0-alpha.20211022.1 → 13.0.0-alpha.20211109.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/CHANGELOG.md +9 -3
- package/dist/index.js +53 -48
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +11 -12
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TableServiceClient.js +13 -9
- package/dist-esm/src/TableServiceClient.js.map +1 -1
- package/dist-esm/src/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/models.js.map +1 -1
- package/dist-esm/src/odata.js +4 -1
- package/dist-esm/src/odata.js.map +1 -1
- package/package.json +3 -3
- package/types/3.1/data-tables.d.ts +10 -1
- package/types/latest/data-tables.d.ts +11 -1
- package/types/latest/tsdoc-metadata.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 13.0.0 (Unreleased)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
- TableClient `listEntities` expose and can take as PageSetting `continuationToken` as a `PageSetting` when using `byPage`. [#18179](https://github.com/Azure/azure-sdk-for-js/pull/18179)
|
|
8
|
+
- TableServiceClient `listTables` expose and can take PageSetting `continuationToken` as a `PageSetting` when using `byPage`. [#18277](https://github.com/Azure/azure-sdk-for-js/pull/18277)
|
|
7
9
|
|
|
8
10
|
### Breaking Changes
|
|
9
11
|
|
|
12
|
+
- Encode single quote where the partition/row key is used to format the URL - i.e. upsert, update and delete. For more details see [#3356](https://github.com/Azure/azure-sdk/issues/3356)
|
|
13
|
+
|
|
10
14
|
### Bugs Fixed
|
|
15
|
+
|
|
11
16
|
- Document usage of SDK with Azurite. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
12
17
|
- Issue #17407 - Correctly handle etag in select filter. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
13
|
-
- Issue #18079
|
|
18
|
+
- Issue #18079 - Correctly handle creating entities with properties containing empty strings "". Fixes Insert throws "Unknown EDM type object" error with property value { value: "", type: "String" }. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
14
19
|
- Issue #18148 - Correctly deserialize Decimal numbers checking for isSafeInteger. Fixes listEntities always returns an Int32 type for a value of "1.23456789012346e+24". [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
20
|
+
- Issue #18521 - `upsertEntity` doesn't work with "" for partition or row keys. [#18586](https://github.com/Azure/azure-sdk-for-js/pull/18586)
|
|
15
21
|
|
|
16
22
|
### Other Changes
|
|
17
23
|
|
package/dist/index.js
CHANGED
|
@@ -3068,7 +3068,7 @@ class GeneratedClientContext extends coreClient.ServiceClient {
|
|
|
3068
3068
|
const defaults = {
|
|
3069
3069
|
requestContentType: "application/json; charset=utf-8"
|
|
3070
3070
|
};
|
|
3071
|
-
const packageDetails = `azsdk-js-data-tables/
|
|
3071
|
+
const packageDetails = `azsdk-js-data-tables/13.0.0`;
|
|
3072
3072
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
3073
3073
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
3074
3074
|
: `${packageDetails}`;
|
|
@@ -3534,6 +3534,9 @@ class TableServiceClient {
|
|
|
3534
3534
|
},
|
|
3535
3535
|
byPage: (settings) => {
|
|
3536
3536
|
const pageOptions = Object.assign(Object.assign({}, options), { queryOptions: { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize } });
|
|
3537
|
+
if (settings === null || settings === void 0 ? void 0 : settings.continuationToken) {
|
|
3538
|
+
pageOptions.continuationToken = settings.continuationToken;
|
|
3539
|
+
}
|
|
3537
3540
|
return this.listTablesPage(pageOptions);
|
|
3538
3541
|
}
|
|
3539
3542
|
};
|
|
@@ -3542,10 +3545,10 @@ class TableServiceClient {
|
|
|
3542
3545
|
return tslib.__asyncGenerator(this, arguments, function* listTablesAll_1() {
|
|
3543
3546
|
var e_1, _a;
|
|
3544
3547
|
const firstPage = yield tslib.__await(this._listTables(options));
|
|
3545
|
-
const {
|
|
3548
|
+
const { continuationToken } = firstPage;
|
|
3546
3549
|
yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(firstPage)));
|
|
3547
|
-
if (
|
|
3548
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, options), {
|
|
3550
|
+
if (continuationToken) {
|
|
3551
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, options), { continuationToken });
|
|
3549
3552
|
try {
|
|
3550
3553
|
for (var _b = tslib.__asyncValues(this.listTablesPage(optionsWithContinuation)), _c; _c = yield tslib.__await(_b.next()), !_c.done;) {
|
|
3551
3554
|
const page = _c.value;
|
|
@@ -3568,8 +3571,8 @@ class TableServiceClient {
|
|
|
3568
3571
|
try {
|
|
3569
3572
|
let result = yield tslib.__await(this._listTables(updatedOptions));
|
|
3570
3573
|
yield yield tslib.__await(result);
|
|
3571
|
-
while (result.
|
|
3572
|
-
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), {
|
|
3574
|
+
while (result.continuationToken) {
|
|
3575
|
+
const optionsWithContinuation = Object.assign(Object.assign({}, updatedOptions), { continuationToken: result.continuationToken });
|
|
3573
3576
|
result = yield tslib.__await(this._listTables(optionsWithContinuation));
|
|
3574
3577
|
yield yield tslib.__await(result);
|
|
3575
3578
|
}
|
|
@@ -3583,9 +3586,10 @@ class TableServiceClient {
|
|
|
3583
3586
|
}
|
|
3584
3587
|
});
|
|
3585
3588
|
}
|
|
3586
|
-
async _listTables(options) {
|
|
3587
|
-
const {
|
|
3588
|
-
|
|
3589
|
+
async _listTables(options = {}) {
|
|
3590
|
+
const { continuationToken: nextTableName } = options, listOptions = tslib.__rest(options, ["continuationToken"]);
|
|
3591
|
+
const { xMsContinuationNextTableName: continuationToken, value = [] } = await this.table.query(Object.assign(Object.assign({}, listOptions), { nextTableName }));
|
|
3592
|
+
return Object.assign([...value], { continuationToken });
|
|
3589
3593
|
}
|
|
3590
3594
|
/**
|
|
3591
3595
|
*
|
|
@@ -4319,6 +4323,36 @@ function decodeContinuationToken(encodedToken) {
|
|
|
4319
4323
|
return continuationToken;
|
|
4320
4324
|
}
|
|
4321
4325
|
|
|
4326
|
+
// Copyright (c) Microsoft Corporation.
|
|
4327
|
+
// Licensed under the MIT license.
|
|
4328
|
+
function escapeQuotesIfString(input, previous) {
|
|
4329
|
+
let result = input;
|
|
4330
|
+
if (typeof input === "string") {
|
|
4331
|
+
result = escapeQuotes(input);
|
|
4332
|
+
// check if we need to escape this literal
|
|
4333
|
+
if (!previous.trim().endsWith("'")) {
|
|
4334
|
+
result = `'${result}'`;
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
return result;
|
|
4338
|
+
}
|
|
4339
|
+
function escapeQuotes(input) {
|
|
4340
|
+
return input.replace(/'/g, "''");
|
|
4341
|
+
}
|
|
4342
|
+
/**
|
|
4343
|
+
* Escapes an odata filter expression to avoid errors with quoting string literals.
|
|
4344
|
+
*/
|
|
4345
|
+
function odata(strings, ...values) {
|
|
4346
|
+
const results = [];
|
|
4347
|
+
for (let i = 0; i < strings.length; i++) {
|
|
4348
|
+
results.push(strings[i]);
|
|
4349
|
+
if (i < values.length) {
|
|
4350
|
+
results.push(escapeQuotesIfString(values[i], strings[i]));
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
return results.join("");
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4322
4356
|
// Copyright (c) Microsoft Corporation.
|
|
4323
4357
|
/**
|
|
4324
4358
|
* A TableClient represents a Client to the Azure Tables service allowing you
|
|
@@ -4485,7 +4519,7 @@ class TableClient {
|
|
|
4485
4519
|
}
|
|
4486
4520
|
try {
|
|
4487
4521
|
const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
|
|
4488
|
-
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, partitionKey, rowKey, Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
|
|
4522
|
+
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
|
|
4489
4523
|
const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
|
|
4490
4524
|
return tableEntity;
|
|
4491
4525
|
}
|
|
@@ -4687,7 +4721,7 @@ class TableClient {
|
|
|
4687
4721
|
try {
|
|
4688
4722
|
const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
|
|
4689
4723
|
const deleteOptions = Object.assign({}, rest);
|
|
4690
|
-
return await this.table.deleteEntity(this.tableName, partitionKey, rowKey, etag, deleteOptions);
|
|
4724
|
+
return await this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
|
|
4691
4725
|
}
|
|
4692
4726
|
catch (e) {
|
|
4693
4727
|
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
@@ -4741,15 +4775,14 @@ class TableClient {
|
|
|
4741
4775
|
options = {}) {
|
|
4742
4776
|
const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
|
|
4743
4777
|
try {
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
}
|
|
4778
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4779
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4747
4780
|
const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
|
|
4748
4781
|
if (mode === "Merge") {
|
|
4749
|
-
return await this.table.mergeEntity(this.tableName,
|
|
4782
|
+
return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4750
4783
|
}
|
|
4751
4784
|
if (mode === "Replace") {
|
|
4752
|
-
return await this.table.updateEntity(this.tableName,
|
|
4785
|
+
return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4753
4786
|
}
|
|
4754
4787
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4755
4788
|
}
|
|
@@ -4801,14 +4834,13 @@ class TableClient {
|
|
|
4801
4834
|
options = {}) {
|
|
4802
4835
|
const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
|
|
4803
4836
|
try {
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
}
|
|
4837
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4838
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4807
4839
|
if (mode === "Merge") {
|
|
4808
|
-
return await this.table.mergeEntity(this.tableName,
|
|
4840
|
+
return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4809
4841
|
}
|
|
4810
4842
|
if (mode === "Replace") {
|
|
4811
|
-
return await this.table.updateEntity(this.tableName,
|
|
4843
|
+
return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4812
4844
|
}
|
|
4813
4845
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4814
4846
|
}
|
|
@@ -4948,33 +4980,6 @@ class TableClient {
|
|
|
4948
4980
|
}
|
|
4949
4981
|
}
|
|
4950
4982
|
|
|
4951
|
-
// Copyright (c) Microsoft Corporation.
|
|
4952
|
-
// Licensed under the MIT license.
|
|
4953
|
-
function escapeQuotesIfString(input, previous) {
|
|
4954
|
-
let result = input;
|
|
4955
|
-
if (typeof input === "string") {
|
|
4956
|
-
result = input.replace(/'/g, "''");
|
|
4957
|
-
// check if we need to escape this literal
|
|
4958
|
-
if (!previous.trim().endsWith("'")) {
|
|
4959
|
-
result = `'${result}'`;
|
|
4960
|
-
}
|
|
4961
|
-
}
|
|
4962
|
-
return result;
|
|
4963
|
-
}
|
|
4964
|
-
/**
|
|
4965
|
-
* Escapes an odata filter expression to avoid errors with quoting string literals.
|
|
4966
|
-
*/
|
|
4967
|
-
function odata(strings, ...values) {
|
|
4968
|
-
const results = [];
|
|
4969
|
-
for (let i = 0; i < strings.length; i++) {
|
|
4970
|
-
results.push(strings[i]);
|
|
4971
|
-
if (i < values.length) {
|
|
4972
|
-
results.push(escapeQuotesIfString(values[i], strings[i]));
|
|
4973
|
-
}
|
|
4974
|
-
}
|
|
4975
|
-
return results.join("");
|
|
4976
|
-
}
|
|
4977
|
-
|
|
4978
4983
|
Object.defineProperty(exports, 'AzureNamedKeyCredential', {
|
|
4979
4984
|
enumerable: true,
|
|
4980
4985
|
get: function () {
|