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