@cadenza.io/service 1.9.17 → 1.9.18

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 CHANGED
@@ -2952,7 +2952,7 @@ var DatabaseController = class _DatabaseController {
2952
2952
  const resolvedData = yield this.resolveNestedData(data, tableName);
2953
2953
  const isBatch = Array.isArray(resolvedData);
2954
2954
  const rows = isBatch ? resolvedData : [resolvedData];
2955
- const sql = `INSERT INTO ${tableName} (${Object.keys(rows[0]).join(", ")}) VALUES `;
2955
+ const sql = `INSERT INTO ${tableName} (${Object.keys(rows[0]).map(snakeCase_default).join(", ")}) VALUES `;
2956
2956
  const values = rows.map(
2957
2957
  (row) => `(${Object.values(row).map((value, i) => {
2958
2958
  if (typeof value === "object" && (value == null ? void 0 : value.__effect)) {
@@ -2992,6 +2992,7 @@ var DatabaseController = class _DatabaseController {
2992
2992
  onConflictSql += ` DO NOTHING`;
2993
2993
  }
2994
2994
  }
2995
+ console.log("insert", tableName, sql, params);
2995
2996
  const result = yield client.query(
2996
2997
  `${sql} ${values}${onConflictSql} RETURNING ${fields.length ? fields.join(", ") : "*"}`,
2997
2998
  params
@@ -3111,14 +3112,11 @@ var DatabaseController = class _DatabaseController {
3111
3112
  if (typeof value === "object" && value !== null && "subOperation" in value) {
3112
3113
  const subOp = value;
3113
3114
  const subResult = yield this.executeSubOperation(subOp);
3114
- resolved[snakeCase_default(key)] = (_a2 = subResult[subOp.return || "full"]) != null ? _a2 : subResult;
3115
+ resolved[key] = (_a2 = subResult[subOp.return || "full"]) != null ? _a2 : subResult;
3115
3116
  } else if (typeof value === "string" && ["increment", "decrement", "set"].includes(value)) {
3116
- resolved[snakeCase_default(key)] = { __effect: value };
3117
+ resolved[key] = { __effect: value };
3117
3118
  } else if (typeof value === "object") {
3118
- resolved[snakeCase_default(key)] = yield this.resolveNestedData(
3119
- value,
3120
- tableName
3121
- );
3119
+ resolved[key] = yield this.resolveNestedData(value, tableName);
3122
3120
  }
3123
3121
  }
3124
3122
  return resolved;
@@ -3490,7 +3488,7 @@ var CadenzaService = class {
3490
3488
  * @throws Error if name invalid or duplicate.
3491
3489
  */
3492
3490
  static createCadenzaService(serviceName, description = "", options = {}) {
3493
- var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j;
3491
+ var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k;
3494
3492
  if (this.serviceCreated) return;
3495
3493
  this.bootstrap();
3496
3494
  import_core3.default.validateName(serviceName);
@@ -3555,7 +3553,7 @@ var CadenzaService = class {
3555
3553
  data: {
3556
3554
  name: serviceName,
3557
3555
  description,
3558
- displayName: options.displayName,
3556
+ displayName: (_j = options.displayName) != null ? _j : "",
3559
3557
  isMeta: options.isMeta
3560
3558
  },
3561
3559
  __serviceName: serviceName,
@@ -3565,7 +3563,7 @@ var CadenzaService = class {
3565
3563
  __securityProfile: options.securityProfile,
3566
3564
  __networkMode: options.networkMode,
3567
3565
  __retryCount: options.retryCount,
3568
- __cadenzaDBConnect: (_j = options.cadenzaDB) == null ? void 0 : _j.connect
3566
+ __cadenzaDBConnect: (_k = options.cadenzaDB) == null ? void 0 : _k.connect
3569
3567
  });
3570
3568
  import_core3.default.createEphemeralMetaTask("Initiate controllers", () => {
3571
3569
  console.log("Initiating controllers...");