@azure/data-tables 13.1.2 → 13.2.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/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist-esm/src/TableClient.js +2 -2
- package/dist-esm/src/TableClient.js.map +1 -1
- package/dist-esm/src/TableTransaction.js +7 -3
- package/dist-esm/src/TableTransaction.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 +9 -2
- package/dist-esm/src/odata.js.map +1 -1
- package/dist-esm/src/utils/tracing.js +1 -1
- package/dist-esm/src/utils/tracing.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/data-tables.d.ts +14 -1
- package/types/latest/data-tables.d.ts +10 -2
package/dist/index.js
CHANGED
|
@@ -3502,7 +3502,7 @@ function signURLWithSAS(request, credential) {
|
|
|
3502
3502
|
const tracingClient = coreTracing.createTracingClient({
|
|
3503
3503
|
namespace: "Microsoft.Data.Tables",
|
|
3504
3504
|
packageName: "@azure/data-tables",
|
|
3505
|
-
packageVersion: "13.
|
|
3505
|
+
packageVersion: "13.2.0",
|
|
3506
3506
|
});
|
|
3507
3507
|
|
|
3508
3508
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -3884,10 +3884,14 @@ class TableTransaction {
|
|
|
3884
3884
|
/**
|
|
3885
3885
|
* Adds an update action to the transaction
|
|
3886
3886
|
* @param entity - entity to update
|
|
3887
|
-
* @param
|
|
3887
|
+
* @param updateModeOrOptions - update mode or update options
|
|
3888
|
+
* @param updateOptions - options for the update operation
|
|
3888
3889
|
*/
|
|
3889
|
-
updateEntity(entity,
|
|
3890
|
-
|
|
3890
|
+
updateEntity(entity, updateModeOrOptions, updateOptions) {
|
|
3891
|
+
// UpdateMode is a string union
|
|
3892
|
+
const realUpdateMode = typeof updateModeOrOptions === "string" ? updateModeOrOptions : undefined;
|
|
3893
|
+
const realUpdateOptions = typeof updateModeOrOptions === "object" ? updateModeOrOptions : updateOptions;
|
|
3894
|
+
this.actions.push(["update", entity, realUpdateMode !== null && realUpdateMode !== void 0 ? realUpdateMode : "Merge", realUpdateOptions !== null && realUpdateOptions !== void 0 ? realUpdateOptions : {}]);
|
|
3891
3895
|
}
|
|
3892
3896
|
/**
|
|
3893
3897
|
* Adds an upsert action to the transaction, which inserts if the entity doesn't exist or updates the existing one
|
|
@@ -4384,7 +4388,7 @@ function escapeQuotesIfString(input, previous) {
|
|
|
4384
4388
|
if (typeof input === "string") {
|
|
4385
4389
|
result = escapeQuotes(input);
|
|
4386
4390
|
// check if we need to escape this literal
|
|
4387
|
-
if (!previous.trim().endsWith("'")) {
|
|
4391
|
+
if (previous !== "" && !previous.trim().endsWith("'")) {
|
|
4388
4392
|
result = `'${result}'`;
|
|
4389
4393
|
}
|
|
4390
4394
|
}
|
|
@@ -4393,15 +4397,22 @@ function escapeQuotesIfString(input, previous) {
|
|
|
4393
4397
|
function escapeQuotes(input) {
|
|
4394
4398
|
return input.replace(/'/g, "''");
|
|
4395
4399
|
}
|
|
4400
|
+
function encodeDate(input) {
|
|
4401
|
+
return input instanceof Date ? `datetime'${input.toISOString()}'` : input;
|
|
4402
|
+
}
|
|
4396
4403
|
/**
|
|
4397
4404
|
* Escapes an odata filter expression to avoid errors with quoting string literals.
|
|
4405
|
+
* Encodes Date objects.
|
|
4398
4406
|
*/
|
|
4399
4407
|
function odata(strings, ...values) {
|
|
4408
|
+
const fixEncoding = (value, string) => {
|
|
4409
|
+
return encodeDate(escapeQuotesIfString(value, string));
|
|
4410
|
+
};
|
|
4400
4411
|
const results = [];
|
|
4401
4412
|
for (let i = 0; i < strings.length; i++) {
|
|
4402
4413
|
results.push(strings[i]);
|
|
4403
4414
|
if (i < values.length) {
|
|
4404
|
-
results.push(
|
|
4415
|
+
results.push(fixEncoding(values[i], strings[i]));
|
|
4405
4416
|
}
|
|
4406
4417
|
}
|
|
4407
4418
|
return results.join("");
|
|
@@ -4926,7 +4937,7 @@ class TableClient {
|
|
|
4926
4937
|
this.transactionClient.reset(transactionId, changesetId, partitionKey);
|
|
4927
4938
|
}
|
|
4928
4939
|
for (const item of actions) {
|
|
4929
|
-
const [action, entity, updateMode = "Merge"] = item;
|
|
4940
|
+
const [action, entity, updateMode = "Merge", updateOptions] = item;
|
|
4930
4941
|
switch (action) {
|
|
4931
4942
|
case "create":
|
|
4932
4943
|
this.transactionClient.createEntity(entity);
|
|
@@ -4935,7 +4946,7 @@ class TableClient {
|
|
|
4935
4946
|
this.transactionClient.deleteEntity(entity.partitionKey, entity.rowKey);
|
|
4936
4947
|
break;
|
|
4937
4948
|
case "update":
|
|
4938
|
-
this.transactionClient.updateEntity(entity, updateMode);
|
|
4949
|
+
this.transactionClient.updateEntity(entity, updateMode, updateOptions);
|
|
4939
4950
|
break;
|
|
4940
4951
|
case "upsert":
|
|
4941
4952
|
this.transactionClient.upsertEntity(entity, updateMode);
|