@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.
- package/dist/{index-QGwgvVDY.d.ts → index-CwXlBXJf.d.ts} +2 -0
- package/dist/{index-C4ApiXHX.d.mts → index-ldPtIocV.d.mts} +2 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +100 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +100 -2
- package/dist/index.mjs.map +1 -1
- package/dist/sensors/index.d.mts +1 -1
- package/dist/sensors/index.d.ts +1 -1
- package/dist/sensors/index.js +100 -2
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +100 -2
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/sensors/index.mjs
CHANGED
|
@@ -1295,6 +1295,7 @@ var init_axis_chain_executor = __esm({
|
|
|
1295
1295
|
timestamp: startedAt,
|
|
1296
1296
|
chainId: envelope.chainId,
|
|
1297
1297
|
stepId: step.stepId,
|
|
1298
|
+
handler: step.handler,
|
|
1298
1299
|
intent: step.intent,
|
|
1299
1300
|
envelope,
|
|
1300
1301
|
step,
|
|
@@ -1329,6 +1330,7 @@ var init_axis_chain_executor = __esm({
|
|
|
1329
1330
|
timestamp: finishedAt,
|
|
1330
1331
|
chainId: envelope.chainId,
|
|
1331
1332
|
stepId: step.stepId,
|
|
1333
|
+
handler: step.handler,
|
|
1332
1334
|
intent: step.intent,
|
|
1333
1335
|
effect,
|
|
1334
1336
|
envelope,
|
|
@@ -1343,6 +1345,7 @@ var init_axis_chain_executor = __esm({
|
|
|
1343
1345
|
timestamp: finishedAt,
|
|
1344
1346
|
chainId: envelope.chainId,
|
|
1345
1347
|
stepId: step.stepId,
|
|
1348
|
+
handler: step.handler,
|
|
1346
1349
|
intent: step.intent,
|
|
1347
1350
|
envelope,
|
|
1348
1351
|
step,
|
|
@@ -1357,6 +1360,7 @@ var init_axis_chain_executor = __esm({
|
|
|
1357
1360
|
timestamp: finishedAt,
|
|
1358
1361
|
chainId: envelope.chainId,
|
|
1359
1362
|
stepId: step.stepId,
|
|
1363
|
+
handler: step.handler,
|
|
1360
1364
|
intent: step.intent,
|
|
1361
1365
|
effect,
|
|
1362
1366
|
envelope,
|
|
@@ -1387,6 +1391,7 @@ var init_axis_chain_executor = __esm({
|
|
|
1387
1391
|
timestamp: finishedAt,
|
|
1388
1392
|
chainId: envelope.chainId,
|
|
1389
1393
|
stepId: step.stepId,
|
|
1394
|
+
handler: step.handler,
|
|
1390
1395
|
intent: step.intent,
|
|
1391
1396
|
error: error.message,
|
|
1392
1397
|
envelope,
|
|
@@ -2605,6 +2610,8 @@ var init_intent_router = __esm({
|
|
|
2605
2610
|
this.handlers = /* @__PURE__ */ new Map();
|
|
2606
2611
|
/** Per-intent sensor refs (resolved through SensorRegistry at call time) */
|
|
2607
2612
|
this.intentSensors = /* @__PURE__ */ new Map();
|
|
2613
|
+
/** Per-intent handler identifier (e.g. UsersHandler.usersPage) */
|
|
2614
|
+
this.intentHandlerRefs = /* @__PURE__ */ new Map();
|
|
2608
2615
|
/** Per-intent body decoders */
|
|
2609
2616
|
this.intentDecoders = /* @__PURE__ */ new Map();
|
|
2610
2617
|
/** Per-intent TLV schemas */
|
|
@@ -2680,6 +2687,16 @@ var init_intent_router = __esm({
|
|
|
2680
2687
|
*/
|
|
2681
2688
|
register(intent, handler) {
|
|
2682
2689
|
this.handlers.set(intent, handler);
|
|
2690
|
+
if (typeof handler === "function" && handler.name) {
|
|
2691
|
+
this.intentHandlerRefs.set(intent, handler.name);
|
|
2692
|
+
} else if (handler && typeof handler === "object") {
|
|
2693
|
+
const objectName = handler.constructor?.name;
|
|
2694
|
+
if (objectName) {
|
|
2695
|
+
this.intentHandlerRefs.set(intent, `${objectName}.handle`);
|
|
2696
|
+
}
|
|
2697
|
+
} else {
|
|
2698
|
+
this.intentHandlerRefs.set(intent, `intent:${intent}`);
|
|
2699
|
+
}
|
|
2683
2700
|
}
|
|
2684
2701
|
/**
|
|
2685
2702
|
* Automatically registers all `@Intent`-decorated methods from a handler instance.
|
|
@@ -2710,6 +2727,10 @@ var init_intent_router = __esm({
|
|
|
2710
2727
|
} else {
|
|
2711
2728
|
this.register(intentName, fn);
|
|
2712
2729
|
}
|
|
2730
|
+
this.intentHandlerRefs.set(
|
|
2731
|
+
intentName,
|
|
2732
|
+
`${instance.constructor.name}.${String(route.methodName)}`
|
|
2733
|
+
);
|
|
2713
2734
|
this.registerIntentMeta(
|
|
2714
2735
|
intentName,
|
|
2715
2736
|
proto,
|
|
@@ -2750,15 +2771,18 @@ var init_intent_router = __esm({
|
|
|
2750
2771
|
async route(frame) {
|
|
2751
2772
|
const start = process.hrtime();
|
|
2752
2773
|
let intent = "unknown";
|
|
2774
|
+
let handlerRef;
|
|
2753
2775
|
try {
|
|
2754
2776
|
const intentBytes = frame.headers.get(TLV_INTENT);
|
|
2755
2777
|
if (!intentBytes) throw new Error("Missing intent");
|
|
2756
2778
|
intent = this.decoder.decode(intentBytes);
|
|
2779
|
+
handlerRef = this.intentHandlerRefs.get(intent);
|
|
2757
2780
|
const observerBindings = this.getObservers(intent);
|
|
2758
2781
|
await this.emitIntentObservers(observerBindings, {
|
|
2759
2782
|
event: "intent.received",
|
|
2760
2783
|
timestamp: Date.now(),
|
|
2761
2784
|
intent,
|
|
2785
|
+
handler: handlerRef,
|
|
2762
2786
|
frame
|
|
2763
2787
|
});
|
|
2764
2788
|
let effect;
|
|
@@ -2888,6 +2912,7 @@ var init_intent_router = __esm({
|
|
|
2888
2912
|
event: "intent.completed",
|
|
2889
2913
|
timestamp: Date.now(),
|
|
2890
2914
|
intent,
|
|
2915
|
+
handler: handlerRef,
|
|
2891
2916
|
frame,
|
|
2892
2917
|
effect,
|
|
2893
2918
|
metadata: effect.metadata
|
|
@@ -2899,6 +2924,7 @@ var init_intent_router = __esm({
|
|
|
2899
2924
|
event: "intent.failed",
|
|
2900
2925
|
timestamp: Date.now(),
|
|
2901
2926
|
intent,
|
|
2927
|
+
handler: handlerRef,
|
|
2902
2928
|
frame,
|
|
2903
2929
|
error: e.message
|
|
2904
2930
|
});
|
|
@@ -8232,6 +8258,61 @@ var init_disk_upload_file_store = __esm({
|
|
|
8232
8258
|
function unique(values) {
|
|
8233
8259
|
return Array.from(new Set(values));
|
|
8234
8260
|
}
|
|
8261
|
+
function matchesObserverIntent(intents, intent) {
|
|
8262
|
+
if (!intents || intents.length === 0) {
|
|
8263
|
+
return true;
|
|
8264
|
+
}
|
|
8265
|
+
if (!intent) {
|
|
8266
|
+
return false;
|
|
8267
|
+
}
|
|
8268
|
+
return intents.includes(intent);
|
|
8269
|
+
}
|
|
8270
|
+
function normalizeHandlerToken(value) {
|
|
8271
|
+
return value.trim().toLowerCase();
|
|
8272
|
+
}
|
|
8273
|
+
function matchesObserverHandler(handlers, handler) {
|
|
8274
|
+
if (!handlers || handlers.length === 0) {
|
|
8275
|
+
return true;
|
|
8276
|
+
}
|
|
8277
|
+
if (!handler) {
|
|
8278
|
+
return false;
|
|
8279
|
+
}
|
|
8280
|
+
const normalizedHandler = normalizeHandlerToken(handler);
|
|
8281
|
+
return handlers.some((candidate) => {
|
|
8282
|
+
if (!candidate) {
|
|
8283
|
+
return false;
|
|
8284
|
+
}
|
|
8285
|
+
const normalizedCandidate = normalizeHandlerToken(candidate);
|
|
8286
|
+
return normalizedHandler === normalizedCandidate || normalizedHandler.endsWith(`.${normalizedCandidate}`) || normalizedHandler.startsWith(`${normalizedCandidate}.`) || normalizedCandidate.endsWith(`.${normalizedHandler}`) || normalizedCandidate.startsWith(`${normalizedHandler}.`);
|
|
8287
|
+
});
|
|
8288
|
+
}
|
|
8289
|
+
function observerRefKey2(ref) {
|
|
8290
|
+
return typeof ref === "string" ? ref : ref.name || "(anonymous)";
|
|
8291
|
+
}
|
|
8292
|
+
function mergeBindingRefs(...bindingGroups) {
|
|
8293
|
+
const merged = /* @__PURE__ */ new Map();
|
|
8294
|
+
for (const bindings of bindingGroups) {
|
|
8295
|
+
for (const binding of bindings) {
|
|
8296
|
+
for (const ref of binding.refs) {
|
|
8297
|
+
const key = observerRefKey2(ref);
|
|
8298
|
+
const current = merged.get(key);
|
|
8299
|
+
if (!current) {
|
|
8300
|
+
merged.set(key, {
|
|
8301
|
+
refs: [ref],
|
|
8302
|
+
tags: binding.tags ? [...new Set(binding.tags)] : void 0,
|
|
8303
|
+
events: binding.events ? [...new Set(binding.events)] : void 0
|
|
8304
|
+
});
|
|
8305
|
+
continue;
|
|
8306
|
+
}
|
|
8307
|
+
current.tags = Array.from(
|
|
8308
|
+
/* @__PURE__ */ new Set([...current.tags || [], ...binding.tags || []])
|
|
8309
|
+
);
|
|
8310
|
+
current.events = current.events === void 0 || binding.events === void 0 ? void 0 : Array.from(/* @__PURE__ */ new Set([...current.events || [], ...binding.events]));
|
|
8311
|
+
}
|
|
8312
|
+
}
|
|
8313
|
+
}
|
|
8314
|
+
return Array.from(merged.values());
|
|
8315
|
+
}
|
|
8235
8316
|
var ObserverDispatcherService;
|
|
8236
8317
|
var init_observer_dispatcher_service = __esm({
|
|
8237
8318
|
"src/engine/observer-dispatcher.service.ts"() {
|
|
@@ -8242,9 +8323,20 @@ var init_observer_dispatcher_service = __esm({
|
|
|
8242
8323
|
this.logger = createAxisLogger(_ObserverDispatcherService.name);
|
|
8243
8324
|
}
|
|
8244
8325
|
async dispatch(bindings, context) {
|
|
8245
|
-
|
|
8326
|
+
const explicitBindings = bindings || [];
|
|
8327
|
+
const implicitRegistrations = this.getImplicitRegistrations();
|
|
8328
|
+
if (!explicitBindings.length && implicitRegistrations.length === 0) {
|
|
8329
|
+
return;
|
|
8330
|
+
}
|
|
8246
8331
|
const invoked = /* @__PURE__ */ new Set();
|
|
8247
|
-
|
|
8332
|
+
const implicitBindings = implicitRegistrations.map(
|
|
8333
|
+
(registration) => ({
|
|
8334
|
+
refs: [registration.instance.constructor],
|
|
8335
|
+
events: registration.events
|
|
8336
|
+
})
|
|
8337
|
+
);
|
|
8338
|
+
const merged = mergeBindingRefs(explicitBindings, implicitBindings);
|
|
8339
|
+
for (const binding of merged) {
|
|
8248
8340
|
if (binding.events && binding.events.length > 0 && !binding.events.includes(context.event)) {
|
|
8249
8341
|
continue;
|
|
8250
8342
|
}
|
|
@@ -8255,6 +8347,9 @@ var init_observer_dispatcher_service = __esm({
|
|
|
8255
8347
|
continue;
|
|
8256
8348
|
}
|
|
8257
8349
|
if (invoked.has(registration.name)) continue;
|
|
8350
|
+
if (!matchesObserverIntent(registration.intents, context.intent) || !matchesObserverHandler(registration.handlers, context.handler)) {
|
|
8351
|
+
continue;
|
|
8352
|
+
}
|
|
8258
8353
|
if (registration.events && registration.events.length > 0 && !registration.events.includes(context.event)) {
|
|
8259
8354
|
continue;
|
|
8260
8355
|
}
|
|
@@ -8280,6 +8375,9 @@ var init_observer_dispatcher_service = __esm({
|
|
|
8280
8375
|
}
|
|
8281
8376
|
}
|
|
8282
8377
|
}
|
|
8378
|
+
getImplicitRegistrations() {
|
|
8379
|
+
return this.registry.list();
|
|
8380
|
+
}
|
|
8283
8381
|
};
|
|
8284
8382
|
}
|
|
8285
8383
|
});
|