@nextera.one/axis-server-sdk 2.2.4 → 2.2.5

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.
@@ -1,4 +1,4 @@
1
- export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-C4ApiXHX.mjs';
1
+ export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-ldPtIocV.mjs';
2
2
  import '../axis-sensor-GBEI3Fab.mjs';
3
3
  import '../cce-pipeline-B-zUBHo3.mjs';
4
4
  import '@nextera.one/axis-protocol';
@@ -1,4 +1,4 @@
1
- export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-QGwgvVDY.js';
1
+ export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-CwXlBXJf.js';
2
2
  import '../axis-sensor-GBEI3Fab.js';
3
3
  import '../cce-pipeline-DbGBSsCG.js';
4
4
  import '@nextera.one/axis-protocol';
@@ -1221,6 +1221,7 @@ var init_axis_chain_executor = __esm({
1221
1221
  timestamp: startedAt,
1222
1222
  chainId: envelope.chainId,
1223
1223
  stepId: step.stepId,
1224
+ handler: step.handler,
1224
1225
  intent: step.intent,
1225
1226
  envelope,
1226
1227
  step,
@@ -1255,6 +1256,7 @@ var init_axis_chain_executor = __esm({
1255
1256
  timestamp: finishedAt,
1256
1257
  chainId: envelope.chainId,
1257
1258
  stepId: step.stepId,
1259
+ handler: step.handler,
1258
1260
  intent: step.intent,
1259
1261
  effect,
1260
1262
  envelope,
@@ -1269,6 +1271,7 @@ var init_axis_chain_executor = __esm({
1269
1271
  timestamp: finishedAt,
1270
1272
  chainId: envelope.chainId,
1271
1273
  stepId: step.stepId,
1274
+ handler: step.handler,
1272
1275
  intent: step.intent,
1273
1276
  envelope,
1274
1277
  step,
@@ -1283,6 +1286,7 @@ var init_axis_chain_executor = __esm({
1283
1286
  timestamp: finishedAt,
1284
1287
  chainId: envelope.chainId,
1285
1288
  stepId: step.stepId,
1289
+ handler: step.handler,
1286
1290
  intent: step.intent,
1287
1291
  effect,
1288
1292
  envelope,
@@ -1313,6 +1317,7 @@ var init_axis_chain_executor = __esm({
1313
1317
  timestamp: finishedAt,
1314
1318
  chainId: envelope.chainId,
1315
1319
  stepId: step.stepId,
1320
+ handler: step.handler,
1316
1321
  intent: step.intent,
1317
1322
  error: error.message,
1318
1323
  envelope,
@@ -2532,6 +2537,8 @@ var init_intent_router = __esm({
2532
2537
  this.handlers = /* @__PURE__ */ new Map();
2533
2538
  /** Per-intent sensor refs (resolved through SensorRegistry at call time) */
2534
2539
  this.intentSensors = /* @__PURE__ */ new Map();
2540
+ /** Per-intent handler identifier (e.g. UsersHandler.usersPage) */
2541
+ this.intentHandlerRefs = /* @__PURE__ */ new Map();
2535
2542
  /** Per-intent body decoders */
2536
2543
  this.intentDecoders = /* @__PURE__ */ new Map();
2537
2544
  /** Per-intent TLV schemas */
@@ -2607,6 +2614,16 @@ var init_intent_router = __esm({
2607
2614
  */
2608
2615
  register(intent, handler) {
2609
2616
  this.handlers.set(intent, handler);
2617
+ if (typeof handler === "function" && handler.name) {
2618
+ this.intentHandlerRefs.set(intent, handler.name);
2619
+ } else if (handler && typeof handler === "object") {
2620
+ const objectName = handler.constructor?.name;
2621
+ if (objectName) {
2622
+ this.intentHandlerRefs.set(intent, `${objectName}.handle`);
2623
+ }
2624
+ } else {
2625
+ this.intentHandlerRefs.set(intent, `intent:${intent}`);
2626
+ }
2610
2627
  }
2611
2628
  /**
2612
2629
  * Automatically registers all `@Intent`-decorated methods from a handler instance.
@@ -2637,6 +2654,10 @@ var init_intent_router = __esm({
2637
2654
  } else {
2638
2655
  this.register(intentName, fn);
2639
2656
  }
2657
+ this.intentHandlerRefs.set(
2658
+ intentName,
2659
+ `${instance.constructor.name}.${String(route.methodName)}`
2660
+ );
2640
2661
  this.registerIntentMeta(
2641
2662
  intentName,
2642
2663
  proto,
@@ -2677,15 +2698,18 @@ var init_intent_router = __esm({
2677
2698
  async route(frame) {
2678
2699
  const start = process.hrtime();
2679
2700
  let intent = "unknown";
2701
+ let handlerRef;
2680
2702
  try {
2681
2703
  const intentBytes = frame.headers.get(import_axis_protocol.TLV_INTENT);
2682
2704
  if (!intentBytes) throw new Error("Missing intent");
2683
2705
  intent = this.decoder.decode(intentBytes);
2706
+ handlerRef = this.intentHandlerRefs.get(intent);
2684
2707
  const observerBindings = this.getObservers(intent);
2685
2708
  await this.emitIntentObservers(observerBindings, {
2686
2709
  event: "intent.received",
2687
2710
  timestamp: Date.now(),
2688
2711
  intent,
2712
+ handler: handlerRef,
2689
2713
  frame
2690
2714
  });
2691
2715
  let effect;
@@ -2815,6 +2839,7 @@ var init_intent_router = __esm({
2815
2839
  event: "intent.completed",
2816
2840
  timestamp: Date.now(),
2817
2841
  intent,
2842
+ handler: handlerRef,
2818
2843
  frame,
2819
2844
  effect,
2820
2845
  metadata: effect.metadata
@@ -2826,6 +2851,7 @@ var init_intent_router = __esm({
2826
2851
  event: "intent.failed",
2827
2852
  timestamp: Date.now(),
2828
2853
  intent,
2854
+ handler: handlerRef,
2829
2855
  frame,
2830
2856
  error: e.message
2831
2857
  });
@@ -8159,6 +8185,61 @@ var init_disk_upload_file_store = __esm({
8159
8185
  function unique(values) {
8160
8186
  return Array.from(new Set(values));
8161
8187
  }
8188
+ function matchesObserverIntent(intents, intent) {
8189
+ if (!intents || intents.length === 0) {
8190
+ return true;
8191
+ }
8192
+ if (!intent) {
8193
+ return false;
8194
+ }
8195
+ return intents.includes(intent);
8196
+ }
8197
+ function normalizeHandlerToken(value) {
8198
+ return value.trim().toLowerCase();
8199
+ }
8200
+ function matchesObserverHandler(handlers, handler) {
8201
+ if (!handlers || handlers.length === 0) {
8202
+ return true;
8203
+ }
8204
+ if (!handler) {
8205
+ return false;
8206
+ }
8207
+ const normalizedHandler = normalizeHandlerToken(handler);
8208
+ return handlers.some((candidate) => {
8209
+ if (!candidate) {
8210
+ return false;
8211
+ }
8212
+ const normalizedCandidate = normalizeHandlerToken(candidate);
8213
+ return normalizedHandler === normalizedCandidate || normalizedHandler.endsWith(`.${normalizedCandidate}`) || normalizedHandler.startsWith(`${normalizedCandidate}.`) || normalizedCandidate.endsWith(`.${normalizedHandler}`) || normalizedCandidate.startsWith(`${normalizedHandler}.`);
8214
+ });
8215
+ }
8216
+ function observerRefKey2(ref) {
8217
+ return typeof ref === "string" ? ref : ref.name || "(anonymous)";
8218
+ }
8219
+ function mergeBindingRefs(...bindingGroups) {
8220
+ const merged = /* @__PURE__ */ new Map();
8221
+ for (const bindings of bindingGroups) {
8222
+ for (const binding of bindings) {
8223
+ for (const ref of binding.refs) {
8224
+ const key = observerRefKey2(ref);
8225
+ const current = merged.get(key);
8226
+ if (!current) {
8227
+ merged.set(key, {
8228
+ refs: [ref],
8229
+ tags: binding.tags ? [...new Set(binding.tags)] : void 0,
8230
+ events: binding.events ? [...new Set(binding.events)] : void 0
8231
+ });
8232
+ continue;
8233
+ }
8234
+ current.tags = Array.from(
8235
+ /* @__PURE__ */ new Set([...current.tags || [], ...binding.tags || []])
8236
+ );
8237
+ current.events = current.events === void 0 || binding.events === void 0 ? void 0 : Array.from(/* @__PURE__ */ new Set([...current.events || [], ...binding.events]));
8238
+ }
8239
+ }
8240
+ }
8241
+ return Array.from(merged.values());
8242
+ }
8162
8243
  var ObserverDispatcherService;
8163
8244
  var init_observer_dispatcher_service = __esm({
8164
8245
  "src/engine/observer-dispatcher.service.ts"() {
@@ -8169,9 +8250,20 @@ var init_observer_dispatcher_service = __esm({
8169
8250
  this.logger = createAxisLogger(_ObserverDispatcherService.name);
8170
8251
  }
8171
8252
  async dispatch(bindings, context) {
8172
- if (!bindings || bindings.length === 0) return;
8253
+ const explicitBindings = bindings || [];
8254
+ const implicitRegistrations = this.getImplicitRegistrations();
8255
+ if (!explicitBindings.length && implicitRegistrations.length === 0) {
8256
+ return;
8257
+ }
8173
8258
  const invoked = /* @__PURE__ */ new Set();
8174
- for (const binding of bindings) {
8259
+ const implicitBindings = implicitRegistrations.map(
8260
+ (registration) => ({
8261
+ refs: [registration.instance.constructor],
8262
+ events: registration.events
8263
+ })
8264
+ );
8265
+ const merged = mergeBindingRefs(explicitBindings, implicitBindings);
8266
+ for (const binding of merged) {
8175
8267
  if (binding.events && binding.events.length > 0 && !binding.events.includes(context.event)) {
8176
8268
  continue;
8177
8269
  }
@@ -8182,6 +8274,9 @@ var init_observer_dispatcher_service = __esm({
8182
8274
  continue;
8183
8275
  }
8184
8276
  if (invoked.has(registration.name)) continue;
8277
+ if (!matchesObserverIntent(registration.intents, context.intent) || !matchesObserverHandler(registration.handlers, context.handler)) {
8278
+ continue;
8279
+ }
8185
8280
  if (registration.events && registration.events.length > 0 && !registration.events.includes(context.event)) {
8186
8281
  continue;
8187
8282
  }
@@ -8207,6 +8302,9 @@ var init_observer_dispatcher_service = __esm({
8207
8302
  }
8208
8303
  }
8209
8304
  }
8305
+ getImplicitRegistrations() {
8306
+ return this.registry.list();
8307
+ }
8210
8308
  };
8211
8309
  }
8212
8310
  });