@cadenza.io/service 2.17.11 → 2.17.13

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.
@@ -7320,8 +7320,10 @@ var CadenzaService = class {
7320
7320
  this.bootstrap();
7321
7321
  this.validateName(tableName);
7322
7322
  this.validateName(operation);
7323
- const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${databaseServiceName ?? "default database service"}`;
7324
- const description = `Executes a ${operation} on table ${tableName} in ${databaseServiceName ?? "default database service"}`;
7323
+ const resolvedDatabaseServiceName = databaseServiceName ?? this.defaultDatabaseServiceName ?? void 0;
7324
+ const targetDatabaseServiceName = resolvedDatabaseServiceName ?? "default database service";
7325
+ const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${targetDatabaseServiceName}`;
7326
+ const description = `Executes a ${operation} on table ${tableName} in ${targetDatabaseServiceName}`;
7325
7327
  const taskName = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName}`;
7326
7328
  options = {
7327
7329
  concurrency: 100,
@@ -7345,7 +7347,7 @@ var CadenzaService = class {
7345
7347
  return new DatabaseTask(
7346
7348
  name,
7347
7349
  taskName,
7348
- databaseServiceName,
7350
+ resolvedDatabaseServiceName,
7349
7351
  description,
7350
7352
  queryData,
7351
7353
  options.concurrency,
@@ -7720,6 +7722,7 @@ var CadenzaService = class {
7720
7722
  this.bootstrap();
7721
7723
  this.validateName(name);
7722
7724
  this.validateServiceName(name);
7725
+ this.defaultDatabaseServiceName = name;
7723
7726
  const databaseController = DatabaseController.instance;
7724
7727
  const actorOptions = this.normalizePostgresActorOptions(name, {
7725
7728
  ...options,
@@ -8278,6 +8281,7 @@ var CadenzaService = class {
8278
8281
  this.serviceRegistry?.reset();
8279
8282
  this.isBootstrapped = false;
8280
8283
  this.serviceCreated = false;
8284
+ this.defaultDatabaseServiceName = null;
8281
8285
  this.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
8282
8286
  this.hydratedInquiryResults = /* @__PURE__ */ new Map();
8283
8287
  this.frontendSyncScheduled = false;
@@ -8285,6 +8289,7 @@ var CadenzaService = class {
8285
8289
  };
8286
8290
  CadenzaService.isBootstrapped = false;
8287
8291
  CadenzaService.serviceCreated = false;
8292
+ CadenzaService.defaultDatabaseServiceName = null;
8288
8293
  CadenzaService.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
8289
8294
  CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
8290
8295
  CadenzaService.frontendSyncScheduled = false;
@@ -8314,6 +8319,19 @@ function normalizeArrayResponse(value, keys) {
8314
8319
  }
8315
8320
  return [];
8316
8321
  }
8322
+ function buildQueryResponseKeys(tableName) {
8323
+ const camelCased = tableName.replace(
8324
+ /_([a-z])/g,
8325
+ (_match, char) => char.toUpperCase()
8326
+ );
8327
+ return [
8328
+ `${tableName}Rows`,
8329
+ `${tableName}s`,
8330
+ tableName,
8331
+ `${camelCased}s`,
8332
+ camelCased
8333
+ ];
8334
+ }
8317
8335
  function normalizeIntentMap(raw) {
8318
8336
  const intentName = String(raw.intentName ?? raw.intent_name ?? "").trim();
8319
8337
  const serviceName = String(raw.serviceName ?? raw.service_name ?? "").trim();
@@ -8383,12 +8401,7 @@ function createSSRInquiryBridge(options = {}) {
8383
8401
  { queryData },
8384
8402
  timeoutMs
8385
8403
  );
8386
- return normalizeArrayResponse(response, [
8387
- `${tableName}Rows`,
8388
- `${tableName}s`,
8389
- tableName,
8390
- tableName.replace(/_([a-z])/g, (_match, char) => char.toUpperCase())
8391
- ]);
8404
+ return normalizeArrayResponse(response, buildQueryResponseKeys(tableName));
8392
8405
  };
8393
8406
  return {
8394
8407
  async inquire(inquiry, context = {}, inquiryOptions = {}) {