@azure/data-tables 12.2.0-alpha.20211104.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 +4 -1
- package/dist/index.js +41 -40
- 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/generated/generatedClientContext.js +1 -1
- package/dist-esm/src/generated/generatedClientContext.js.map +1 -1
- package/dist-esm/src/odata.js +4 -1
- package/dist-esm/src/odata.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 13.0.0 (Unreleased)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
6
|
|
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
### Breaking Changes
|
|
11
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
|
+
|
|
12
14
|
### Bugs Fixed
|
|
13
15
|
|
|
14
16
|
- Document usage of SDK with Azurite. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
15
17
|
- Issue #17407 - Correctly handle etag in select filter. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
16
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)
|
|
17
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)
|
|
18
21
|
|
|
19
22
|
### Other Changes
|
|
20
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}`;
|
|
@@ -4323,6 +4323,36 @@ function decodeContinuationToken(encodedToken) {
|
|
|
4323
4323
|
return continuationToken;
|
|
4324
4324
|
}
|
|
4325
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
|
+
|
|
4326
4356
|
// Copyright (c) Microsoft Corporation.
|
|
4327
4357
|
/**
|
|
4328
4358
|
* A TableClient represents a Client to the Azure Tables service allowing you
|
|
@@ -4489,7 +4519,7 @@ class TableClient {
|
|
|
4489
4519
|
}
|
|
4490
4520
|
try {
|
|
4491
4521
|
const _a = updatedOptions || {}, { disableTypeConversion, queryOptions } = _a, getEntityOptions = tslib.__rest(_a, ["disableTypeConversion", "queryOptions"]);
|
|
4492
|
-
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 }));
|
|
4493
4523
|
const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
|
|
4494
4524
|
return tableEntity;
|
|
4495
4525
|
}
|
|
@@ -4691,7 +4721,7 @@ class TableClient {
|
|
|
4691
4721
|
try {
|
|
4692
4722
|
const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
|
|
4693
4723
|
const deleteOptions = Object.assign({}, rest);
|
|
4694
|
-
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);
|
|
4695
4725
|
}
|
|
4696
4726
|
catch (e) {
|
|
4697
4727
|
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
@@ -4745,15 +4775,14 @@ class TableClient {
|
|
|
4745
4775
|
options = {}) {
|
|
4746
4776
|
const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
|
|
4747
4777
|
try {
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
}
|
|
4778
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4779
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4751
4780
|
const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
|
|
4752
4781
|
if (mode === "Merge") {
|
|
4753
|
-
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));
|
|
4754
4783
|
}
|
|
4755
4784
|
if (mode === "Replace") {
|
|
4756
|
-
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));
|
|
4757
4786
|
}
|
|
4758
4787
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4759
4788
|
}
|
|
@@ -4805,14 +4834,13 @@ class TableClient {
|
|
|
4805
4834
|
options = {}) {
|
|
4806
4835
|
const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
|
|
4807
4836
|
try {
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
}
|
|
4837
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4838
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4811
4839
|
if (mode === "Merge") {
|
|
4812
|
-
return await this.table.mergeEntity(this.tableName,
|
|
4840
|
+
return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4813
4841
|
}
|
|
4814
4842
|
if (mode === "Replace") {
|
|
4815
|
-
return await this.table.updateEntity(this.tableName,
|
|
4843
|
+
return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4816
4844
|
}
|
|
4817
4845
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4818
4846
|
}
|
|
@@ -4952,33 +4980,6 @@ class TableClient {
|
|
|
4952
4980
|
}
|
|
4953
4981
|
}
|
|
4954
4982
|
|
|
4955
|
-
// Copyright (c) Microsoft Corporation.
|
|
4956
|
-
// Licensed under the MIT license.
|
|
4957
|
-
function escapeQuotesIfString(input, previous) {
|
|
4958
|
-
let result = input;
|
|
4959
|
-
if (typeof input === "string") {
|
|
4960
|
-
result = input.replace(/'/g, "''");
|
|
4961
|
-
// check if we need to escape this literal
|
|
4962
|
-
if (!previous.trim().endsWith("'")) {
|
|
4963
|
-
result = `'${result}'`;
|
|
4964
|
-
}
|
|
4965
|
-
}
|
|
4966
|
-
return result;
|
|
4967
|
-
}
|
|
4968
|
-
/**
|
|
4969
|
-
* Escapes an odata filter expression to avoid errors with quoting string literals.
|
|
4970
|
-
*/
|
|
4971
|
-
function odata(strings, ...values) {
|
|
4972
|
-
const results = [];
|
|
4973
|
-
for (let i = 0; i < strings.length; i++) {
|
|
4974
|
-
results.push(strings[i]);
|
|
4975
|
-
if (i < values.length) {
|
|
4976
|
-
results.push(escapeQuotesIfString(values[i], strings[i]));
|
|
4977
|
-
}
|
|
4978
|
-
}
|
|
4979
|
-
return results.join("");
|
|
4980
|
-
}
|
|
4981
|
-
|
|
4982
4983
|
Object.defineProperty(exports, 'AzureNamedKeyCredential', {
|
|
4983
4984
|
enumerable: true,
|
|
4984
4985
|
get: function () {
|