@cadenza.io/service 1.13.5 → 1.13.7
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 +11 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1141,7 +1141,7 @@ var RestController = class _RestController {
|
|
|
1141
1141
|
if (process.env.NODE_ENV === "development") {
|
|
1142
1142
|
address = "localhost";
|
|
1143
1143
|
} else if (process.env.IS_DOCKER === "true") {
|
|
1144
|
-
address = process.env.
|
|
1144
|
+
address = process.env.CADENZA_SERVER_URL || "localhost";
|
|
1145
1145
|
}
|
|
1146
1146
|
} else {
|
|
1147
1147
|
address = ((_b2 = server == null ? void 0 : server.address()) == null ? void 0 : _b2.address) || "";
|
|
@@ -1172,7 +1172,7 @@ var RestController = class _RestController {
|
|
|
1172
1172
|
address = httpsServer.address();
|
|
1173
1173
|
} else if (((_a2 = httpsServer == null ? void 0 : httpsServer.address()) == null ? void 0 : _a2.address) === "::") {
|
|
1174
1174
|
if (process.env.IS_DOCKER === "true") {
|
|
1175
|
-
address = process.env.
|
|
1175
|
+
address = process.env.CADENZA_SERVER_URL || "localhost";
|
|
1176
1176
|
}
|
|
1177
1177
|
} else {
|
|
1178
1178
|
address = ((_b2 = httpsServer == null ? void 0 : httpsServer.address()) == null ? void 0 : _b2.address) || "";
|
|
@@ -2810,18 +2810,26 @@ var DatabaseController = class _DatabaseController {
|
|
|
2810
2810
|
if (transaction) yield client.query("BEGIN");
|
|
2811
2811
|
const resolvedData = yield this.resolveNestedData(data, tableName);
|
|
2812
2812
|
const params = Object.values(resolvedData);
|
|
2813
|
+
let offset = 0;
|
|
2813
2814
|
const setClause = Object.entries(Object.keys(resolvedData)).map(([i, key]) => {
|
|
2814
2815
|
const value = resolvedData[key];
|
|
2816
|
+
const offsetIndex = parseInt(i) - offset;
|
|
2815
2817
|
if (value.__effect === "increment") {
|
|
2818
|
+
params.splice(offsetIndex, 1);
|
|
2819
|
+
offset++;
|
|
2816
2820
|
return `${(0, import_lodash_es.snakeCase)(key)} = ${(0, import_lodash_es.snakeCase)(key)} + 1`;
|
|
2817
2821
|
}
|
|
2818
2822
|
if (value.__effect === "decrement") {
|
|
2823
|
+
params.splice(offsetIndex, 1);
|
|
2824
|
+
offset++;
|
|
2819
2825
|
return `${(0, import_lodash_es.snakeCase)(key)} = ${(0, import_lodash_es.snakeCase)(key)} - 1`;
|
|
2820
2826
|
}
|
|
2821
2827
|
if (value.__effect === "set") {
|
|
2828
|
+
params.splice(offsetIndex, 1);
|
|
2829
|
+
offset++;
|
|
2822
2830
|
return `${(0, import_lodash_es.snakeCase)(key)} = ${value.__value}`;
|
|
2823
2831
|
}
|
|
2824
|
-
return `${(0, import_lodash_es.snakeCase)(key)} = $${
|
|
2832
|
+
return `${(0, import_lodash_es.snakeCase)(key)} = $${offsetIndex + 1}`;
|
|
2825
2833
|
}).join(", ");
|
|
2826
2834
|
const whereClause = this.buildWhereClause(filter, params);
|
|
2827
2835
|
const sql = `UPDATE ${tableName} SET ${setClause} ${whereClause} RETURNING *;`;
|