@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.
package/dist/index.mjs CHANGED
@@ -9710,8 +9710,10 @@ var CadenzaService = class {
9710
9710
  this.bootstrap();
9711
9711
  this.validateName(tableName);
9712
9712
  this.validateName(operation);
9713
- const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${databaseServiceName ?? "default database service"}`;
9714
- const description = `Executes a ${operation} on table ${tableName} in ${databaseServiceName ?? "default database service"}`;
9713
+ const resolvedDatabaseServiceName = databaseServiceName ?? this.defaultDatabaseServiceName ?? void 0;
9714
+ const targetDatabaseServiceName = resolvedDatabaseServiceName ?? "default database service";
9715
+ const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${targetDatabaseServiceName}`;
9716
+ const description = `Executes a ${operation} on table ${tableName} in ${targetDatabaseServiceName}`;
9715
9717
  const taskName = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName}`;
9716
9718
  options = {
9717
9719
  concurrency: 100,
@@ -9735,7 +9737,7 @@ var CadenzaService = class {
9735
9737
  return new DatabaseTask(
9736
9738
  name,
9737
9739
  taskName,
9738
- databaseServiceName,
9740
+ resolvedDatabaseServiceName,
9739
9741
  description,
9740
9742
  queryData,
9741
9743
  options.concurrency,
@@ -10110,6 +10112,7 @@ var CadenzaService = class {
10110
10112
  this.bootstrap();
10111
10113
  this.validateName(name);
10112
10114
  this.validateServiceName(name);
10115
+ this.defaultDatabaseServiceName = name;
10113
10116
  const databaseController = DatabaseController.instance;
10114
10117
  const actorOptions = this.normalizePostgresActorOptions(name, {
10115
10118
  ...options,
@@ -10668,6 +10671,7 @@ var CadenzaService = class {
10668
10671
  this.serviceRegistry?.reset();
10669
10672
  this.isBootstrapped = false;
10670
10673
  this.serviceCreated = false;
10674
+ this.defaultDatabaseServiceName = null;
10671
10675
  this.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
10672
10676
  this.hydratedInquiryResults = /* @__PURE__ */ new Map();
10673
10677
  this.frontendSyncScheduled = false;
@@ -10675,6 +10679,7 @@ var CadenzaService = class {
10675
10679
  };
10676
10680
  CadenzaService.isBootstrapped = false;
10677
10681
  CadenzaService.serviceCreated = false;
10682
+ CadenzaService.defaultDatabaseServiceName = null;
10678
10683
  CadenzaService.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
10679
10684
  CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
10680
10685
  CadenzaService.frontendSyncScheduled = false;
@@ -10710,6 +10715,19 @@ function normalizeArrayResponse(value, keys) {
10710
10715
  }
10711
10716
  return [];
10712
10717
  }
10718
+ function buildQueryResponseKeys(tableName) {
10719
+ const camelCased = tableName.replace(
10720
+ /_([a-z])/g,
10721
+ (_match, char) => char.toUpperCase()
10722
+ );
10723
+ return [
10724
+ `${tableName}Rows`,
10725
+ `${tableName}s`,
10726
+ tableName,
10727
+ `${camelCased}s`,
10728
+ camelCased
10729
+ ];
10730
+ }
10713
10731
  function normalizeIntentMap(raw) {
10714
10732
  const intentName = String(raw.intentName ?? raw.intent_name ?? "").trim();
10715
10733
  const serviceName = String(raw.serviceName ?? raw.service_name ?? "").trim();
@@ -10779,12 +10797,7 @@ function createSSRInquiryBridge(options = {}) {
10779
10797
  { queryData },
10780
10798
  timeoutMs
10781
10799
  );
10782
- return normalizeArrayResponse(response, [
10783
- `${tableName}Rows`,
10784
- `${tableName}s`,
10785
- tableName,
10786
- tableName.replace(/_([a-z])/g, (_match, char) => char.toUpperCase())
10787
- ]);
10800
+ return normalizeArrayResponse(response, buildQueryResponseKeys(tableName));
10788
10801
  };
10789
10802
  return {
10790
10803
  async inquire(inquiry, context = {}, inquiryOptions = {}) {