@nextera.one/axis-server-sdk 2.3.8 → 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 +67 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -26
- 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 +67 -26
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +67 -26
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/sensors/index.mjs
CHANGED
|
@@ -2658,6 +2658,10 @@ var init_intent_router = __esm({
|
|
|
2658
2658
|
this.handlerIntents = /* @__PURE__ */ new Map();
|
|
2659
2659
|
/** Handler class name → intent namespace prefix (from @Handler('auth')) */
|
|
2660
2660
|
this.handlerPrefixes = /* @__PURE__ */ new Map();
|
|
2661
|
+
/** Handler namespace prefix → handler class name, used by `handler...intent` lookup. */
|
|
2662
|
+
this.handlerByPrefix = /* @__PURE__ */ new Map();
|
|
2663
|
+
/** Intent → handler class name, avoids scanning handlerIntents for normal lookups. */
|
|
2664
|
+
this.handlerByIntent = /* @__PURE__ */ new Map();
|
|
2661
2665
|
/** Handler class name → class-level sensor bindings (from @HandlerSensors) */
|
|
2662
2666
|
this.handlerClassSensors = /* @__PURE__ */ new Map();
|
|
2663
2667
|
/** Handler class name → class-level observer bindings (from @Handler({ observe: [...] })) */
|
|
@@ -2667,35 +2671,37 @@ var init_intent_router = __esm({
|
|
|
2667
2671
|
this.sensorRegistry = sensorRegistry;
|
|
2668
2672
|
}
|
|
2669
2673
|
getSchema(intent) {
|
|
2670
|
-
return this.intentSchemas.get(intent);
|
|
2674
|
+
return this.intentSchemas.get(this.resolveIntentAlias(intent));
|
|
2671
2675
|
}
|
|
2672
2676
|
getValidators(intent) {
|
|
2673
|
-
return this.intentValidators.get(intent);
|
|
2677
|
+
return this.intentValidators.get(this.resolveIntentAlias(intent));
|
|
2674
2678
|
}
|
|
2675
2679
|
has(intent) {
|
|
2676
|
-
|
|
2680
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
2681
|
+
return this.handlers.has(resolved) || _IntentRouter.BUILTIN_INTENTS.has(resolved);
|
|
2677
2682
|
}
|
|
2678
2683
|
getRegisteredIntents() {
|
|
2679
2684
|
return [..._IntentRouter.BUILTIN_INTENTS, ...this.handlers.keys()];
|
|
2680
2685
|
}
|
|
2681
2686
|
getIntentEntry(intent) {
|
|
2682
|
-
|
|
2687
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
2688
|
+
if (!this.has(resolved)) return null;
|
|
2683
2689
|
return {
|
|
2684
|
-
schema: this.intentSchemas.get(
|
|
2685
|
-
validators: this.intentValidators.get(
|
|
2686
|
-
hasSensors: this.intentSensors.has(
|
|
2687
|
-
builtin: _IntentRouter.BUILTIN_INTENTS.has(
|
|
2688
|
-
kind: this.intentKinds.get(
|
|
2689
|
-
chain: this.intentChains.get(
|
|
2690
|
-
capsulePolicy: this.intentCapsulePolicies.get(
|
|
2691
|
-
observerCount: this.getObservers(
|
|
2690
|
+
schema: this.intentSchemas.get(resolved),
|
|
2691
|
+
validators: this.intentValidators.get(resolved),
|
|
2692
|
+
hasSensors: this.intentSensors.has(resolved),
|
|
2693
|
+
builtin: _IntentRouter.BUILTIN_INTENTS.has(resolved),
|
|
2694
|
+
kind: this.intentKinds.get(resolved),
|
|
2695
|
+
chain: this.intentChains.get(resolved),
|
|
2696
|
+
capsulePolicy: this.intentCapsulePolicies.get(resolved),
|
|
2697
|
+
observerCount: this.getObservers(resolved).length
|
|
2692
2698
|
};
|
|
2693
2699
|
}
|
|
2694
2700
|
getChainConfig(intent) {
|
|
2695
|
-
return this.intentChains.get(intent);
|
|
2701
|
+
return this.intentChains.get(this.resolveIntentAlias(intent));
|
|
2696
2702
|
}
|
|
2697
2703
|
getObservers(intent) {
|
|
2698
|
-
return this.intentObservers.get(intent) || [];
|
|
2704
|
+
return this.intentObservers.get(this.resolveIntentAlias(intent)) || [];
|
|
2699
2705
|
}
|
|
2700
2706
|
/**
|
|
2701
2707
|
* Registers a handler for a specific intent.
|
|
@@ -2738,6 +2744,14 @@ var init_intent_router = __esm({
|
|
|
2738
2744
|
);
|
|
2739
2745
|
const handlerSensors = Reflect.getMetadata(HANDLER_SENSORS_KEY, instance.constructor) || [];
|
|
2740
2746
|
const handlerObservers = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, instance.constructor) || [];
|
|
2747
|
+
if (prefix) {
|
|
2748
|
+
this.trackHandlerMeta(
|
|
2749
|
+
instance.constructor.name,
|
|
2750
|
+
prefix,
|
|
2751
|
+
handlerSensors,
|
|
2752
|
+
handlerObservers
|
|
2753
|
+
);
|
|
2754
|
+
}
|
|
2741
2755
|
const proto = Object.getPrototypeOf(instance);
|
|
2742
2756
|
for (const route of routes) {
|
|
2743
2757
|
const intentName = route.absolute ? route.action : `${prefix}.${route.action}`;
|
|
@@ -2797,7 +2811,7 @@ var init_intent_router = __esm({
|
|
|
2797
2811
|
try {
|
|
2798
2812
|
const intentBytes = frame.headers.get(TLV_INTENT);
|
|
2799
2813
|
if (!intentBytes) throw new Error("Missing intent");
|
|
2800
|
-
intent = this.decoder.decode(intentBytes);
|
|
2814
|
+
intent = this.resolveIntentAlias(this.decoder.decode(intentBytes));
|
|
2801
2815
|
handlerRef = this.intentHandlerRefs.get(intent);
|
|
2802
2816
|
const observerBindings = this.getObservers(intent);
|
|
2803
2817
|
await this.emitIntentObservers(observerBindings, {
|
|
@@ -3107,25 +3121,25 @@ var init_intent_router = __esm({
|
|
|
3107
3121
|
}
|
|
3108
3122
|
// ─── Policy Getters ────────────────────────────────────────────────────────
|
|
3109
3123
|
getSensitivity(intent) {
|
|
3110
|
-
return this.intentSensitivity.get(intent);
|
|
3124
|
+
return this.intentSensitivity.get(this.resolveIntentAlias(intent));
|
|
3111
3125
|
}
|
|
3112
3126
|
getContract(intent) {
|
|
3113
|
-
return this.intentContracts.get(intent);
|
|
3127
|
+
return this.intentContracts.get(this.resolveIntentAlias(intent));
|
|
3114
3128
|
}
|
|
3115
3129
|
getRequiredProof(intent) {
|
|
3116
|
-
return this.intentRequiredProof.get(intent);
|
|
3130
|
+
return this.intentRequiredProof.get(this.resolveIntentAlias(intent));
|
|
3117
3131
|
}
|
|
3118
3132
|
isPublic(intent) {
|
|
3119
|
-
return this.publicIntents.has(intent);
|
|
3133
|
+
return this.publicIntents.has(this.resolveIntentAlias(intent));
|
|
3120
3134
|
}
|
|
3121
3135
|
isAnonymous(intent) {
|
|
3122
|
-
return this.anonymousIntents.has(intent);
|
|
3136
|
+
return this.anonymousIntents.has(this.resolveIntentAlias(intent));
|
|
3123
3137
|
}
|
|
3124
3138
|
isAuthorized(intent) {
|
|
3125
|
-
return this.authorizedIntents.has(intent);
|
|
3139
|
+
return this.authorizedIntents.has(this.resolveIntentAlias(intent));
|
|
3126
3140
|
}
|
|
3127
3141
|
getRateLimit(intent) {
|
|
3128
|
-
return this.intentRateLimits.get(intent);
|
|
3142
|
+
return this.intentRateLimits.get(this.resolveIntentAlias(intent));
|
|
3129
3143
|
}
|
|
3130
3144
|
// ─── Handler-level Getters ─────────────────────────────────────────────────
|
|
3131
3145
|
/** All intents registered under the given handler class name. */
|
|
@@ -3134,10 +3148,8 @@ var init_intent_router = __esm({
|
|
|
3134
3148
|
}
|
|
3135
3149
|
/** Returns the handler class name that owns the given intent, or undefined if not found. */
|
|
3136
3150
|
getHandlerByIntent(intent) {
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
}
|
|
3140
|
-
return void 0;
|
|
3151
|
+
const resolved = this.resolveIntentAlias(intent);
|
|
3152
|
+
return this.handlerByIntent.get(resolved);
|
|
3141
3153
|
}
|
|
3142
3154
|
/** All registered handler class names. */
|
|
3143
3155
|
getRegisteredHandlers() {
|
|
@@ -3213,6 +3225,33 @@ var init_intent_router = __esm({
|
|
|
3213
3225
|
getHandlerClassObservers(handlerName) {
|
|
3214
3226
|
return this.handlerClassObservers.get(handlerName);
|
|
3215
3227
|
}
|
|
3228
|
+
/**
|
|
3229
|
+
* Resolves the optional `handler...intent` wire shorthand to a registered
|
|
3230
|
+
* canonical intent. Existing exact intent names always win.
|
|
3231
|
+
*/
|
|
3232
|
+
resolveIntentAlias(intent) {
|
|
3233
|
+
if (this.handlers.has(intent) || _IntentRouter.BUILTIN_INTENTS.has(intent)) {
|
|
3234
|
+
return intent;
|
|
3235
|
+
}
|
|
3236
|
+
const separator = "...";
|
|
3237
|
+
const separatorIndex = intent.indexOf(separator);
|
|
3238
|
+
if (separatorIndex <= 0) return intent;
|
|
3239
|
+
const handlerKey = intent.slice(0, separatorIndex);
|
|
3240
|
+
const action = intent.slice(separatorIndex + separator.length);
|
|
3241
|
+
if (!handlerKey || !action) return intent;
|
|
3242
|
+
const handlerName = this.handlerByPrefix.get(handlerKey) ?? (this.handlerIntents.has(handlerKey) ? handlerKey : void 0);
|
|
3243
|
+
if (!handlerName) return intent;
|
|
3244
|
+
const prefix = this.getHandlerPrefix(handlerName) ?? handlerKey;
|
|
3245
|
+
const handlerIntents = this.getHandlerIntents(handlerName);
|
|
3246
|
+
const prefixedIntent = `${prefix}.${action}`;
|
|
3247
|
+
if (handlerIntents.includes(prefixedIntent)) return prefixedIntent;
|
|
3248
|
+
if (handlerIntents.includes(action)) return action;
|
|
3249
|
+
const suffix = `.${action}`;
|
|
3250
|
+
const suffixMatches = handlerIntents.filter(
|
|
3251
|
+
(candidate) => candidate.endsWith(suffix)
|
|
3252
|
+
);
|
|
3253
|
+
return suffixMatches.length === 1 ? suffixMatches[0] : intent;
|
|
3254
|
+
}
|
|
3216
3255
|
/** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
|
|
3217
3256
|
getHandlerSummary(handlerName) {
|
|
3218
3257
|
const intents = this.getHandlerIntents(handlerName);
|
|
@@ -3289,6 +3328,7 @@ var init_intent_router = __esm({
|
|
|
3289
3328
|
}
|
|
3290
3329
|
}
|
|
3291
3330
|
trackHandlerIntent(handlerName, intent) {
|
|
3331
|
+
this.handlerByIntent.set(intent, handlerName);
|
|
3292
3332
|
const existing = this.handlerIntents.get(handlerName);
|
|
3293
3333
|
if (existing) {
|
|
3294
3334
|
if (!existing.includes(intent)) existing.push(intent);
|
|
@@ -3302,6 +3342,7 @@ var init_intent_router = __esm({
|
|
|
3302
3342
|
*/
|
|
3303
3343
|
trackHandlerMeta(className, prefix, sensors, observers) {
|
|
3304
3344
|
this.handlerPrefixes.set(className, prefix);
|
|
3345
|
+
this.handlerByPrefix.set(prefix, className);
|
|
3305
3346
|
if (sensors.length > 0) {
|
|
3306
3347
|
this.handlerClassSensors.set(
|
|
3307
3348
|
className,
|