@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.d.mts CHANGED
@@ -593,6 +593,7 @@ declare class CadenzaService {
593
593
  static serviceRegistry: ServiceRegistry;
594
594
  protected static isBootstrapped: boolean;
595
595
  protected static serviceCreated: boolean;
596
+ protected static defaultDatabaseServiceName: string | null;
596
597
  protected static warnedInvalidMetaIntentResponderKeys: Set<string>;
597
598
  protected static hydratedInquiryResults: Map<string, AnyObject>;
598
599
  protected static frontendSyncScheduled: boolean;
package/dist/index.d.ts CHANGED
@@ -593,6 +593,7 @@ declare class CadenzaService {
593
593
  static serviceRegistry: ServiceRegistry;
594
594
  protected static isBootstrapped: boolean;
595
595
  protected static serviceCreated: boolean;
596
+ protected static defaultDatabaseServiceName: string | null;
596
597
  protected static warnedInvalidMetaIntentResponderKeys: Set<string>;
597
598
  protected static hydratedInquiryResults: Map<string, AnyObject>;
598
599
  protected static frontendSyncScheduled: boolean;
package/dist/index.js CHANGED
@@ -9761,8 +9761,10 @@ var CadenzaService = class {
9761
9761
  this.bootstrap();
9762
9762
  this.validateName(tableName);
9763
9763
  this.validateName(operation);
9764
- const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${databaseServiceName ?? "default database service"}`;
9765
- const description = `Executes a ${operation} on table ${tableName} in ${databaseServiceName ?? "default database service"}`;
9764
+ const resolvedDatabaseServiceName = databaseServiceName ?? this.defaultDatabaseServiceName ?? void 0;
9765
+ const targetDatabaseServiceName = resolvedDatabaseServiceName ?? "default database service";
9766
+ const name = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName} in ${targetDatabaseServiceName}`;
9767
+ const description = `Executes a ${operation} on table ${tableName} in ${targetDatabaseServiceName}`;
9766
9768
  const taskName = `${operation.charAt(0).toUpperCase() + operation.slice(1)} ${tableName}`;
9767
9769
  options = {
9768
9770
  concurrency: 100,
@@ -9786,7 +9788,7 @@ var CadenzaService = class {
9786
9788
  return new DatabaseTask(
9787
9789
  name,
9788
9790
  taskName,
9789
- databaseServiceName,
9791
+ resolvedDatabaseServiceName,
9790
9792
  description,
9791
9793
  queryData,
9792
9794
  options.concurrency,
@@ -10161,6 +10163,7 @@ var CadenzaService = class {
10161
10163
  this.bootstrap();
10162
10164
  this.validateName(name);
10163
10165
  this.validateServiceName(name);
10166
+ this.defaultDatabaseServiceName = name;
10164
10167
  const databaseController = DatabaseController.instance;
10165
10168
  const actorOptions = this.normalizePostgresActorOptions(name, {
10166
10169
  ...options,
@@ -10719,6 +10722,7 @@ var CadenzaService = class {
10719
10722
  this.serviceRegistry?.reset();
10720
10723
  this.isBootstrapped = false;
10721
10724
  this.serviceCreated = false;
10725
+ this.defaultDatabaseServiceName = null;
10722
10726
  this.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
10723
10727
  this.hydratedInquiryResults = /* @__PURE__ */ new Map();
10724
10728
  this.frontendSyncScheduled = false;
@@ -10726,6 +10730,7 @@ var CadenzaService = class {
10726
10730
  };
10727
10731
  CadenzaService.isBootstrapped = false;
10728
10732
  CadenzaService.serviceCreated = false;
10733
+ CadenzaService.defaultDatabaseServiceName = null;
10729
10734
  CadenzaService.warnedInvalidMetaIntentResponderKeys = /* @__PURE__ */ new Set();
10730
10735
  CadenzaService.hydratedInquiryResults = /* @__PURE__ */ new Map();
10731
10736
  CadenzaService.frontendSyncScheduled = false;
@@ -10755,6 +10760,19 @@ function normalizeArrayResponse(value, keys) {
10755
10760
  }
10756
10761
  return [];
10757
10762
  }
10763
+ function buildQueryResponseKeys(tableName) {
10764
+ const camelCased = tableName.replace(
10765
+ /_([a-z])/g,
10766
+ (_match, char) => char.toUpperCase()
10767
+ );
10768
+ return [
10769
+ `${tableName}Rows`,
10770
+ `${tableName}s`,
10771
+ tableName,
10772
+ `${camelCased}s`,
10773
+ camelCased
10774
+ ];
10775
+ }
10758
10776
  function normalizeIntentMap(raw) {
10759
10777
  const intentName = String(raw.intentName ?? raw.intent_name ?? "").trim();
10760
10778
  const serviceName = String(raw.serviceName ?? raw.service_name ?? "").trim();
@@ -10824,12 +10842,7 @@ function createSSRInquiryBridge(options = {}) {
10824
10842
  { queryData },
10825
10843
  timeoutMs
10826
10844
  );
10827
- return normalizeArrayResponse(response, [
10828
- `${tableName}Rows`,
10829
- `${tableName}s`,
10830
- tableName,
10831
- tableName.replace(/_([a-z])/g, (_match, char) => char.toUpperCase())
10832
- ]);
10845
+ return normalizeArrayResponse(response, buildQueryResponseKeys(tableName));
10833
10846
  };
10834
10847
  return {
10835
10848
  async inquire(inquiry, context = {}, inquiryOptions = {}) {