@nextera.one/axis-server-sdk 2.3.7 → 2.3.9
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-DRnTsYrk.d.ts → index-DPQEO0Qh.d.ts} +3 -0
- package/dist/{index-Bdahn8mq.d.mts → index-DfG00R_f.d.mts} +3 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +75 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -30
- 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 +75 -30
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +75 -30
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2514,6 +2514,10 @@ var init_intent_router = __esm({
|
|
|
2514
2514
|
this.handlerIntents = /* @__PURE__ */ new Map();
|
|
2515
2515
|
/** Handler class name → intent namespace prefix (from @Handler('auth')) */
|
|
2516
2516
|
this.handlerPrefixes = /* @__PURE__ */ new Map();
|
|
2517
|
+
/** Handler namespace prefix → handler class name, used by `handler...intent` lookup. */
|
|
2518
|
+
this.handlerByPrefix = /* @__PURE__ */ new Map();
|
|
2519
|
+
/** Intent → handler class name, avoids scanning handlerIntents for normal lookups. */
|
|
2520
|
+
this.handlerByIntent = /* @__PURE__ */ new Map();
|
|
2517
2521
|
/** Handler class name → class-level sensor bindings (from @HandlerSensors) */
|
|
2518
2522
|
this.handlerClassSensors = /* @__PURE__ */ new Map();
|
|
2519
2523
|
/** Handler class name → class-level observer bindings (from @Handler({ observe: [...] })) */
|
|
@@ -2523,35 +2527,37 @@ var init_intent_router = __esm({
|
|
|
2523
2527
|
this.sensorRegistry = sensorRegistry;
|
|
2524
2528
|
}
|
|
2525
2529
|
getSchema(intent) {
|
|
2526
|
-
return this.intentSchemas.get(intent);
|
|
2530
|
+
return this.intentSchemas.get(this.resolveIntentAlias(intent));
|
|
2527
2531
|
}
|
|
2528
2532
|
getValidators(intent) {
|
|
2529
|
-
return this.intentValidators.get(intent);
|
|
2533
|
+
return this.intentValidators.get(this.resolveIntentAlias(intent));
|
|
2530
2534
|
}
|
|
2531
2535
|
has(intent) {
|
|
2532
|
-
|
|
2536
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
2537
|
+
return this.handlers.has(resolved) || _IntentRouter.BUILTIN_INTENTS.has(resolved);
|
|
2533
2538
|
}
|
|
2534
2539
|
getRegisteredIntents() {
|
|
2535
2540
|
return [..._IntentRouter.BUILTIN_INTENTS, ...this.handlers.keys()];
|
|
2536
2541
|
}
|
|
2537
2542
|
getIntentEntry(intent) {
|
|
2538
|
-
|
|
2543
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
2544
|
+
if (!this.has(resolved)) return null;
|
|
2539
2545
|
return {
|
|
2540
|
-
schema: this.intentSchemas.get(
|
|
2541
|
-
validators: this.intentValidators.get(
|
|
2542
|
-
hasSensors: this.intentSensors.has(
|
|
2543
|
-
builtin: _IntentRouter.BUILTIN_INTENTS.has(
|
|
2544
|
-
kind: this.intentKinds.get(
|
|
2545
|
-
chain: this.intentChains.get(
|
|
2546
|
-
capsulePolicy: this.intentCapsulePolicies.get(
|
|
2547
|
-
observerCount: this.getObservers(
|
|
2546
|
+
schema: this.intentSchemas.get(resolved),
|
|
2547
|
+
validators: this.intentValidators.get(resolved),
|
|
2548
|
+
hasSensors: this.intentSensors.has(resolved),
|
|
2549
|
+
builtin: _IntentRouter.BUILTIN_INTENTS.has(resolved),
|
|
2550
|
+
kind: this.intentKinds.get(resolved),
|
|
2551
|
+
chain: this.intentChains.get(resolved),
|
|
2552
|
+
capsulePolicy: this.intentCapsulePolicies.get(resolved),
|
|
2553
|
+
observerCount: this.getObservers(resolved).length
|
|
2548
2554
|
};
|
|
2549
2555
|
}
|
|
2550
2556
|
getChainConfig(intent) {
|
|
2551
|
-
return this.intentChains.get(intent);
|
|
2557
|
+
return this.intentChains.get(this.resolveIntentAlias(intent));
|
|
2552
2558
|
}
|
|
2553
2559
|
getObservers(intent) {
|
|
2554
|
-
return this.intentObservers.get(intent) || [];
|
|
2560
|
+
return this.intentObservers.get(this.resolveIntentAlias(intent)) || [];
|
|
2555
2561
|
}
|
|
2556
2562
|
/**
|
|
2557
2563
|
* Registers a handler for a specific intent.
|
|
@@ -2594,6 +2600,14 @@ var init_intent_router = __esm({
|
|
|
2594
2600
|
);
|
|
2595
2601
|
const handlerSensors = Reflect.getMetadata(HANDLER_SENSORS_KEY, instance.constructor) || [];
|
|
2596
2602
|
const handlerObservers = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, instance.constructor) || [];
|
|
2603
|
+
if (prefix) {
|
|
2604
|
+
this.trackHandlerMeta(
|
|
2605
|
+
instance.constructor.name,
|
|
2606
|
+
prefix,
|
|
2607
|
+
handlerSensors,
|
|
2608
|
+
handlerObservers
|
|
2609
|
+
);
|
|
2610
|
+
}
|
|
2597
2611
|
const proto = Object.getPrototypeOf(instance);
|
|
2598
2612
|
for (const route of routes) {
|
|
2599
2613
|
const intentName = route.absolute ? route.action : `${prefix}.${route.action}`;
|
|
@@ -2653,7 +2667,7 @@ var init_intent_router = __esm({
|
|
|
2653
2667
|
try {
|
|
2654
2668
|
const intentBytes = frame.headers.get(TLV_INTENT);
|
|
2655
2669
|
if (!intentBytes) throw new Error("Missing intent");
|
|
2656
|
-
intent = this.decoder.decode(intentBytes);
|
|
2670
|
+
intent = this.resolveIntentAlias(this.decoder.decode(intentBytes));
|
|
2657
2671
|
handlerRef = this.intentHandlerRefs.get(intent);
|
|
2658
2672
|
const observerBindings = this.getObservers(intent);
|
|
2659
2673
|
await this.emitIntentObservers(observerBindings, {
|
|
@@ -2963,25 +2977,25 @@ var init_intent_router = __esm({
|
|
|
2963
2977
|
}
|
|
2964
2978
|
// ─── Policy Getters ────────────────────────────────────────────────────────
|
|
2965
2979
|
getSensitivity(intent) {
|
|
2966
|
-
return this.intentSensitivity.get(intent);
|
|
2980
|
+
return this.intentSensitivity.get(this.resolveIntentAlias(intent));
|
|
2967
2981
|
}
|
|
2968
2982
|
getContract(intent) {
|
|
2969
|
-
return this.intentContracts.get(intent);
|
|
2983
|
+
return this.intentContracts.get(this.resolveIntentAlias(intent));
|
|
2970
2984
|
}
|
|
2971
2985
|
getRequiredProof(intent) {
|
|
2972
|
-
return this.intentRequiredProof.get(intent);
|
|
2986
|
+
return this.intentRequiredProof.get(this.resolveIntentAlias(intent));
|
|
2973
2987
|
}
|
|
2974
2988
|
isPublic(intent) {
|
|
2975
|
-
return this.publicIntents.has(intent);
|
|
2989
|
+
return this.publicIntents.has(this.resolveIntentAlias(intent));
|
|
2976
2990
|
}
|
|
2977
2991
|
isAnonymous(intent) {
|
|
2978
|
-
return this.anonymousIntents.has(intent);
|
|
2992
|
+
return this.anonymousIntents.has(this.resolveIntentAlias(intent));
|
|
2979
2993
|
}
|
|
2980
2994
|
isAuthorized(intent) {
|
|
2981
|
-
return this.authorizedIntents.has(intent);
|
|
2995
|
+
return this.authorizedIntents.has(this.resolveIntentAlias(intent));
|
|
2982
2996
|
}
|
|
2983
2997
|
getRateLimit(intent) {
|
|
2984
|
-
return this.intentRateLimits.get(intent);
|
|
2998
|
+
return this.intentRateLimits.get(this.resolveIntentAlias(intent));
|
|
2985
2999
|
}
|
|
2986
3000
|
// ─── Handler-level Getters ─────────────────────────────────────────────────
|
|
2987
3001
|
/** All intents registered under the given handler class name. */
|
|
@@ -2990,10 +3004,8 @@ var init_intent_router = __esm({
|
|
|
2990
3004
|
}
|
|
2991
3005
|
/** Returns the handler class name that owns the given intent, or undefined if not found. */
|
|
2992
3006
|
getHandlerByIntent(intent) {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
}
|
|
2996
|
-
return void 0;
|
|
3007
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
3008
|
+
return this.handlerByIntent.get(resolved);
|
|
2997
3009
|
}
|
|
2998
3010
|
/** All registered handler class names. */
|
|
2999
3011
|
getRegisteredHandlers() {
|
|
@@ -3069,6 +3081,33 @@ var init_intent_router = __esm({
|
|
|
3069
3081
|
getHandlerClassObservers(handlerName) {
|
|
3070
3082
|
return this.handlerClassObservers.get(handlerName);
|
|
3071
3083
|
}
|
|
3084
|
+
/**
|
|
3085
|
+
* Resolves the optional `handler...intent` wire shorthand to a registered
|
|
3086
|
+
* canonical intent. Existing exact intent names always win.
|
|
3087
|
+
*/
|
|
3088
|
+
resolveIntentAlias(intent) {
|
|
3089
|
+
if (this.handlers.has(intent) || _IntentRouter.BUILTIN_INTENTS.has(intent)) {
|
|
3090
|
+
return intent;
|
|
3091
|
+
}
|
|
3092
|
+
const separator = "...";
|
|
3093
|
+
const separatorIndex = intent.indexOf(separator);
|
|
3094
|
+
if (separatorIndex <= 0) return intent;
|
|
3095
|
+
const handlerKey = intent.slice(0, separatorIndex);
|
|
3096
|
+
const action = intent.slice(separatorIndex + separator.length);
|
|
3097
|
+
if (!handlerKey || !action) return intent;
|
|
3098
|
+
const handlerName = this.handlerByPrefix.get(handlerKey) ?? (this.handlerIntents.has(handlerKey) ? handlerKey : void 0);
|
|
3099
|
+
if (!handlerName) return intent;
|
|
3100
|
+
const prefix = this.getHandlerPrefix(handlerName) ?? handlerKey;
|
|
3101
|
+
const handlerIntents = this.getHandlerIntents(handlerName);
|
|
3102
|
+
const prefixedIntent = `${prefix}.${action}`;
|
|
3103
|
+
if (handlerIntents.includes(prefixedIntent)) return prefixedIntent;
|
|
3104
|
+
if (handlerIntents.includes(action)) return action;
|
|
3105
|
+
const suffix = `.${action}`;
|
|
3106
|
+
const suffixMatches = handlerIntents.filter(
|
|
3107
|
+
(candidate) => candidate.endsWith(suffix)
|
|
3108
|
+
);
|
|
3109
|
+
return suffixMatches.length === 1 ? suffixMatches[0] : intent;
|
|
3110
|
+
}
|
|
3072
3111
|
/** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
|
|
3073
3112
|
getHandlerSummary(handlerName) {
|
|
3074
3113
|
const intents = this.getHandlerIntents(handlerName);
|
|
@@ -3145,6 +3184,7 @@ var init_intent_router = __esm({
|
|
|
3145
3184
|
}
|
|
3146
3185
|
}
|
|
3147
3186
|
trackHandlerIntent(handlerName, intent) {
|
|
3187
|
+
this.handlerByIntent.set(intent, handlerName);
|
|
3148
3188
|
const existing = this.handlerIntents.get(handlerName);
|
|
3149
3189
|
if (existing) {
|
|
3150
3190
|
if (!existing.includes(intent)) existing.push(intent);
|
|
@@ -3158,6 +3198,7 @@ var init_intent_router = __esm({
|
|
|
3158
3198
|
*/
|
|
3159
3199
|
trackHandlerMeta(className, prefix, sensors, observers) {
|
|
3160
3200
|
this.handlerPrefixes.set(className, prefix);
|
|
3201
|
+
this.handlerByPrefix.set(prefix, className);
|
|
3161
3202
|
if (sensors.length > 0) {
|
|
3162
3203
|
this.handlerClassSensors.set(
|
|
3163
3204
|
className,
|
|
@@ -8574,11 +8615,13 @@ var init_sensor_registry = __esm({
|
|
|
8574
8615
|
return this.sensorsByName.get(name);
|
|
8575
8616
|
}
|
|
8576
8617
|
getPreDecodeSensors() {
|
|
8577
|
-
return this.list().filter(
|
|
8618
|
+
return this.list().filter(
|
|
8619
|
+
(s) => this.isPreDecodeSensor(s)
|
|
8620
|
+
);
|
|
8578
8621
|
}
|
|
8579
8622
|
getPostDecodeSensors() {
|
|
8580
8623
|
return this.list().filter(
|
|
8581
|
-
(s) => (s
|
|
8624
|
+
(s) => this.isPostDecodeSensor(s)
|
|
8582
8625
|
);
|
|
8583
8626
|
}
|
|
8584
8627
|
getSensorCountByPhase() {
|
|
@@ -8594,11 +8637,13 @@ var init_sensor_registry = __esm({
|
|
|
8594
8637
|
}
|
|
8595
8638
|
isPreDecodeSensor(sensor) {
|
|
8596
8639
|
const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
|
|
8597
|
-
return phase === "PRE_DECODE"
|
|
8640
|
+
if (phase) return phase === "PRE_DECODE";
|
|
8641
|
+
return (sensor.order ?? 999) < 40;
|
|
8598
8642
|
}
|
|
8599
8643
|
isPostDecodeSensor(sensor) {
|
|
8600
8644
|
const phase = typeof sensor.phase === "string" ? sensor.phase : sensor.phase?.phase;
|
|
8601
|
-
return phase === "POST_DECODE"
|
|
8645
|
+
if (phase) return phase === "POST_DECODE";
|
|
8646
|
+
return (sensor.order ?? 999) >= 40;
|
|
8602
8647
|
}
|
|
8603
8648
|
indexSensor(sensor) {
|
|
8604
8649
|
this.sensorsByName.set(sensor.name, sensor);
|