@azure/data-tables 12.2.0-alpha.20211104.1 → 13.0.0
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 +12 -2
- package/dist/index.js +49 -45
- 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/index.js +1 -0
- package/dist-esm/src/index.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/dist-esm/src/serialization.js +2 -5
- package/dist-esm/src/serialization.js.map +1 -1
- package/package.json +4 -4
- package/types/3.1/data-tables.d.ts +3 -1
- package/types/latest/data-tables.d.ts +4 -1
- package/types/latest/tsdoc-metadata.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 13.0.0 (2021-11-11)
|
|
4
|
+
|
|
5
|
+
### Acknowledgments
|
|
6
|
+
|
|
7
|
+
Thank you to our developer community members who helped to make the Azure Tables client library better with their contributions to this release:
|
|
8
|
+
|
|
9
|
+
- Daniel Hensby _([GitHub](https://github.com/dhensby))_
|
|
4
10
|
|
|
5
11
|
### Features Added
|
|
6
12
|
|
|
@@ -9,15 +15,19 @@
|
|
|
9
15
|
|
|
10
16
|
### Breaking Changes
|
|
11
17
|
|
|
18
|
+
- Encode single quote where the partition/row key is used to format the URL - i.e. upsert, update and delete. For more details see Issue [#3356](https://github.com/Azure/azure-sdk/issues/3356). Fixed in [#18520](https://github.com/Azure/azure-sdk-for-js/pull/18520)
|
|
19
|
+
- Setting a binary property on an entity without automatic type conversion takes raw string instead of Uint8Array [#18251](https://github.com/Azure/azure-sdk-for-js/pull/18251)
|
|
20
|
+
|
|
12
21
|
### Bugs Fixed
|
|
13
22
|
|
|
14
23
|
- Document usage of SDK with Azurite. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
15
24
|
- Issue #17407 - Correctly handle etag in select filter. [#18211](https://github.com/Azure/azure-sdk-for-js/pull/18211)
|
|
16
25
|
- 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
26
|
- 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)
|
|
27
|
+
- Issue #18521 - `upsertEntity` doesn't work with "" for partition or row keys. [#18586](https://github.com/Azure/azure-sdk-for-js/pull/18586)
|
|
18
28
|
|
|
19
29
|
### Other Changes
|
|
20
|
-
|
|
30
|
+
- Export RestError [#18635](https://github.com/Azure/azure-sdk-for-js/pull/18635). (A community contribution, courtesy of _[dhensby](https://github.com/dhensby))_
|
|
21
31
|
## 12.1.2 (2021-09-07)
|
|
22
32
|
|
|
23
33
|
### Bugs Fixed
|
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}`;
|
|
@@ -4124,14 +4124,11 @@ function serializeObject(obj) {
|
|
|
4124
4124
|
obj.type === "Guid" ||
|
|
4125
4125
|
obj.type === "Int32" ||
|
|
4126
4126
|
obj.type === "Int64" ||
|
|
4127
|
-
obj.type === "String"
|
|
4127
|
+
obj.type === "String" ||
|
|
4128
|
+
obj.type === "Binary") {
|
|
4128
4129
|
serializedValue.value = obj.value;
|
|
4129
4130
|
serializedValue.type = Edm[obj.type];
|
|
4130
4131
|
}
|
|
4131
|
-
else if (obj.type === "Binary") {
|
|
4132
|
-
serializedValue.value = base64Encode(obj.value);
|
|
4133
|
-
serializedValue.type = Edm.Binary;
|
|
4134
|
-
}
|
|
4135
4132
|
else {
|
|
4136
4133
|
throw new Error(`Unknown EDM type ${typeof obj.value}`);
|
|
4137
4134
|
}
|
|
@@ -4323,6 +4320,36 @@ function decodeContinuationToken(encodedToken) {
|
|
|
4323
4320
|
return continuationToken;
|
|
4324
4321
|
}
|
|
4325
4322
|
|
|
4323
|
+
// Copyright (c) Microsoft Corporation.
|
|
4324
|
+
// Licensed under the MIT license.
|
|
4325
|
+
function escapeQuotesIfString(input, previous) {
|
|
4326
|
+
let result = input;
|
|
4327
|
+
if (typeof input === "string") {
|
|
4328
|
+
result = escapeQuotes(input);
|
|
4329
|
+
// check if we need to escape this literal
|
|
4330
|
+
if (!previous.trim().endsWith("'")) {
|
|
4331
|
+
result = `'${result}'`;
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
return result;
|
|
4335
|
+
}
|
|
4336
|
+
function escapeQuotes(input) {
|
|
4337
|
+
return input.replace(/'/g, "''");
|
|
4338
|
+
}
|
|
4339
|
+
/**
|
|
4340
|
+
* Escapes an odata filter expression to avoid errors with quoting string literals.
|
|
4341
|
+
*/
|
|
4342
|
+
function odata(strings, ...values) {
|
|
4343
|
+
const results = [];
|
|
4344
|
+
for (let i = 0; i < strings.length; i++) {
|
|
4345
|
+
results.push(strings[i]);
|
|
4346
|
+
if (i < values.length) {
|
|
4347
|
+
results.push(escapeQuotesIfString(values[i], strings[i]));
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
return results.join("");
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4326
4353
|
// Copyright (c) Microsoft Corporation.
|
|
4327
4354
|
/**
|
|
4328
4355
|
* A TableClient represents a Client to the Azure Tables service allowing you
|
|
@@ -4489,7 +4516,7 @@ class TableClient {
|
|
|
4489
4516
|
}
|
|
4490
4517
|
try {
|
|
4491
4518
|
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 }));
|
|
4519
|
+
await this.table.queryEntitiesWithPartitionAndRowKey(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), Object.assign(Object.assign({}, getEntityOptions), { queryOptions: serializeQueryOptions(queryOptions || {}), onResponse }));
|
|
4493
4520
|
const tableEntity = deserialize(parsedBody, disableTypeConversion !== null && disableTypeConversion !== void 0 ? disableTypeConversion : false);
|
|
4494
4521
|
return tableEntity;
|
|
4495
4522
|
}
|
|
@@ -4691,7 +4718,7 @@ class TableClient {
|
|
|
4691
4718
|
try {
|
|
4692
4719
|
const _a = updatedOptions || {}, { etag = "*" } = _a, rest = tslib.__rest(_a, ["etag"]);
|
|
4693
4720
|
const deleteOptions = Object.assign({}, rest);
|
|
4694
|
-
return await this.table.deleteEntity(this.tableName, partitionKey, rowKey, etag, deleteOptions);
|
|
4721
|
+
return await this.table.deleteEntity(this.tableName, escapeQuotes(partitionKey), escapeQuotes(rowKey), etag, deleteOptions);
|
|
4695
4722
|
}
|
|
4696
4723
|
catch (e) {
|
|
4697
4724
|
span.setStatus({ code: coreTracing.SpanStatusCode.ERROR, message: e.message });
|
|
@@ -4745,15 +4772,14 @@ class TableClient {
|
|
|
4745
4772
|
options = {}) {
|
|
4746
4773
|
const { span, updatedOptions } = createSpan(`TableClient-updateEntity-${mode}`, options);
|
|
4747
4774
|
try {
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
}
|
|
4775
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4776
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4751
4777
|
const _a = updatedOptions || {}, { etag = "*" } = _a, updateEntityOptions = tslib.__rest(_a, ["etag"]);
|
|
4752
4778
|
if (mode === "Merge") {
|
|
4753
|
-
return await this.table.mergeEntity(this.tableName,
|
|
4779
|
+
return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4754
4780
|
}
|
|
4755
4781
|
if (mode === "Replace") {
|
|
4756
|
-
return await this.table.updateEntity(this.tableName,
|
|
4782
|
+
return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity), ifMatch: etag }, updateEntityOptions));
|
|
4757
4783
|
}
|
|
4758
4784
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4759
4785
|
}
|
|
@@ -4805,14 +4831,13 @@ class TableClient {
|
|
|
4805
4831
|
options = {}) {
|
|
4806
4832
|
const { span, updatedOptions } = createSpan(`TableClient-upsertEntity-${mode}`, options);
|
|
4807
4833
|
try {
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
}
|
|
4834
|
+
const partitionKey = escapeQuotes(entity.partitionKey);
|
|
4835
|
+
const rowKey = escapeQuotes(entity.rowKey);
|
|
4811
4836
|
if (mode === "Merge") {
|
|
4812
|
-
return await this.table.mergeEntity(this.tableName,
|
|
4837
|
+
return await this.table.mergeEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4813
4838
|
}
|
|
4814
4839
|
if (mode === "Replace") {
|
|
4815
|
-
return await this.table.updateEntity(this.tableName,
|
|
4840
|
+
return await this.table.updateEntity(this.tableName, partitionKey, rowKey, Object.assign({ tableEntityProperties: serialize(entity) }, updatedOptions));
|
|
4816
4841
|
}
|
|
4817
4842
|
throw new Error(`Unexpected value for update mode: ${mode}`);
|
|
4818
4843
|
}
|
|
@@ -4952,33 +4977,6 @@ class TableClient {
|
|
|
4952
4977
|
}
|
|
4953
4978
|
}
|
|
4954
4979
|
|
|
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
4980
|
Object.defineProperty(exports, 'AzureNamedKeyCredential', {
|
|
4983
4981
|
enumerable: true,
|
|
4984
4982
|
get: function () {
|
|
@@ -4991,6 +4989,12 @@ Object.defineProperty(exports, 'AzureSASCredential', {
|
|
|
4991
4989
|
return coreAuth.AzureSASCredential;
|
|
4992
4990
|
}
|
|
4993
4991
|
});
|
|
4992
|
+
Object.defineProperty(exports, 'RestError', {
|
|
4993
|
+
enumerable: true,
|
|
4994
|
+
get: function () {
|
|
4995
|
+
return coreRestPipeline.RestError;
|
|
4996
|
+
}
|
|
4997
|
+
});
|
|
4994
4998
|
exports.TableClient = TableClient;
|
|
4995
4999
|
exports.TableServiceClient = TableServiceClient;
|
|
4996
5000
|
exports.TableTransaction = TableTransaction;
|