@nextera.one/axis-server-sdk 2.3.2 → 2.3.4
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-DJbM2lNM.d.ts → index-CSIGjS-6.d.ts} +28 -0
- package/dist/{index-Bng8utj8.d.mts → index-Cv_XfeQi.d.mts} +28 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -4
- 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 +112 -0
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +113 -4
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2382,10 +2382,7 @@ var intent_router_exports = {};
|
|
|
2382
2382
|
__export(intent_router_exports, {
|
|
2383
2383
|
IntentRouter: () => IntentRouter
|
|
2384
2384
|
});
|
|
2385
|
-
import {
|
|
2386
|
-
decodeChainEnvelope,
|
|
2387
|
-
decodeChainRequest
|
|
2388
|
-
} from "@nextera.one/axis-protocol";
|
|
2385
|
+
import { decodeChainEnvelope, decodeChainRequest } from "@nextera.one/axis-protocol";
|
|
2389
2386
|
function observerRefKey(ref) {
|
|
2390
2387
|
return typeof ref === "string" ? ref : ref.name;
|
|
2391
2388
|
}
|
|
@@ -2513,6 +2510,8 @@ var init_intent_router = __esm({
|
|
|
2513
2510
|
this.cceHandlers = /* @__PURE__ */ new Map();
|
|
2514
2511
|
/** CCE pipeline configuration (set via configureCce) */
|
|
2515
2512
|
this.ccePipelineConfig = null;
|
|
2513
|
+
/** Reverse index: handler class name → list of registered intents */
|
|
2514
|
+
this.handlerIntents = /* @__PURE__ */ new Map();
|
|
2516
2515
|
this.dependencyResolver = dependencyResolver;
|
|
2517
2516
|
this.observerDispatcher = observerDispatcher;
|
|
2518
2517
|
this.sensorRegistry = sensorRegistry;
|
|
@@ -2602,6 +2601,7 @@ var init_intent_router = __esm({
|
|
|
2602
2601
|
intentName,
|
|
2603
2602
|
`${instance.constructor.name}.${String(route.methodName)}`
|
|
2604
2603
|
);
|
|
2604
|
+
this.trackHandlerIntent(instance.constructor.name, intentName);
|
|
2605
2605
|
this.registerIntentMeta(
|
|
2606
2606
|
intentName,
|
|
2607
2607
|
proto,
|
|
@@ -2625,6 +2625,7 @@ var init_intent_router = __esm({
|
|
|
2625
2625
|
handlerSensors,
|
|
2626
2626
|
handlerObservers
|
|
2627
2627
|
);
|
|
2628
|
+
this.trackHandlerIntent(instance.constructor.name, intentName);
|
|
2628
2629
|
}
|
|
2629
2630
|
}
|
|
2630
2631
|
/**
|
|
@@ -2976,6 +2977,106 @@ var init_intent_router = __esm({
|
|
|
2976
2977
|
getRateLimit(intent) {
|
|
2977
2978
|
return this.intentRateLimits.get(intent);
|
|
2978
2979
|
}
|
|
2980
|
+
// ─── Handler-level Getters ─────────────────────────────────────────────────
|
|
2981
|
+
/** All intents registered under the given handler class name. */
|
|
2982
|
+
getHandlerIntents(handlerName) {
|
|
2983
|
+
return this.handlerIntents.get(handlerName) ?? [];
|
|
2984
|
+
}
|
|
2985
|
+
/** Returns the handler class name that owns the given intent, or undefined if not found. */
|
|
2986
|
+
getHandlerByIntent(intent) {
|
|
2987
|
+
for (const [handlerName, intents] of this.handlerIntents) {
|
|
2988
|
+
if (intents.includes(intent)) return handlerName;
|
|
2989
|
+
}
|
|
2990
|
+
return void 0;
|
|
2991
|
+
}
|
|
2992
|
+
/** All registered handler class names. */
|
|
2993
|
+
getRegisteredHandlers() {
|
|
2994
|
+
return Array.from(this.handlerIntents.keys());
|
|
2995
|
+
}
|
|
2996
|
+
/** The system/builtin intents (ping, time, echo, chain, intent.exec). */
|
|
2997
|
+
getSystemIntents() {
|
|
2998
|
+
return [..._IntentRouter.BUILTIN_INTENTS];
|
|
2999
|
+
}
|
|
3000
|
+
/** True if every intent in the handler is public, or any one is public — returns true if ANY intent is @AxisPublic. */
|
|
3001
|
+
isHandlerPublic(handlerName) {
|
|
3002
|
+
return this.getHandlerIntents(handlerName).some((i) => this.isPublic(i));
|
|
3003
|
+
}
|
|
3004
|
+
/** True if any intent in the handler is @AxisAnonymous. */
|
|
3005
|
+
isHandlerAnonymous(handlerName) {
|
|
3006
|
+
return this.getHandlerIntents(handlerName).some((i) => this.isAnonymous(i));
|
|
3007
|
+
}
|
|
3008
|
+
/** True if any intent in the handler is @AxisAuthorized. */
|
|
3009
|
+
isHandlerAuthorized(handlerName) {
|
|
3010
|
+
return this.getHandlerIntents(handlerName).some(
|
|
3011
|
+
(i) => this.isAuthorized(i)
|
|
3012
|
+
);
|
|
3013
|
+
}
|
|
3014
|
+
/** Union of all required proof kinds across the handler's intents (deduplicated). */
|
|
3015
|
+
getHandlerProof(handlerName) {
|
|
3016
|
+
const all = this.getHandlerIntents(handlerName).flatMap(
|
|
3017
|
+
(i) => this.getRequiredProof(i) ?? []
|
|
3018
|
+
);
|
|
3019
|
+
if (all.length === 0) return void 0;
|
|
3020
|
+
return [...new Set(all)];
|
|
3021
|
+
}
|
|
3022
|
+
/** Contract from the first intent that has one (class-level contracts propagate to all intents). */
|
|
3023
|
+
getHandlerContract(handlerName) {
|
|
3024
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3025
|
+
const contract = this.getContract(intent);
|
|
3026
|
+
if (contract) return contract;
|
|
3027
|
+
}
|
|
3028
|
+
return void 0;
|
|
3029
|
+
}
|
|
3030
|
+
/** Sensitivity from the first intent that has one. */
|
|
3031
|
+
getHandlerSensitivity(handlerName) {
|
|
3032
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3033
|
+
const sensitivity = this.getSensitivity(intent);
|
|
3034
|
+
if (sensitivity) return sensitivity;
|
|
3035
|
+
}
|
|
3036
|
+
return void 0;
|
|
3037
|
+
}
|
|
3038
|
+
/** Rate limit from the first intent that has one. */
|
|
3039
|
+
getHandlerRateLimit(handlerName) {
|
|
3040
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3041
|
+
const rateLimit = this.getRateLimit(intent);
|
|
3042
|
+
if (rateLimit) return rateLimit;
|
|
3043
|
+
}
|
|
3044
|
+
return void 0;
|
|
3045
|
+
}
|
|
3046
|
+
/** Capsule policy from the first intent that has one. */
|
|
3047
|
+
getHandlerCapsulePolicy(handlerName) {
|
|
3048
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3049
|
+
const policy = this.intentCapsulePolicies.get(intent);
|
|
3050
|
+
if (policy) return policy;
|
|
3051
|
+
}
|
|
3052
|
+
return void 0;
|
|
3053
|
+
}
|
|
3054
|
+
/** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
|
|
3055
|
+
getHandlerSummary(handlerName) {
|
|
3056
|
+
const intents = this.getHandlerIntents(handlerName);
|
|
3057
|
+
if (intents.length === 0) return null;
|
|
3058
|
+
return {
|
|
3059
|
+
handler: handlerName,
|
|
3060
|
+
intents,
|
|
3061
|
+
isPublic: this.isHandlerPublic(handlerName),
|
|
3062
|
+
isAnonymous: this.isHandlerAnonymous(handlerName),
|
|
3063
|
+
isAuthorized: this.isHandlerAuthorized(handlerName),
|
|
3064
|
+
requiredProof: this.getHandlerProof(handlerName),
|
|
3065
|
+
contract: this.getHandlerContract(handlerName),
|
|
3066
|
+
sensitivity: this.getHandlerSensitivity(handlerName),
|
|
3067
|
+
rateLimit: this.getHandlerRateLimit(handlerName),
|
|
3068
|
+
capsulePolicy: this.getHandlerCapsulePolicy(handlerName)
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
/** Summary of all registered handlers keyed by handler class name. */
|
|
3072
|
+
getAllHandlerSummaries() {
|
|
3073
|
+
const result = /* @__PURE__ */ new Map();
|
|
3074
|
+
for (const handlerName of this.handlerIntents.keys()) {
|
|
3075
|
+
const summary = this.getHandlerSummary(handlerName);
|
|
3076
|
+
if (summary) result.set(handlerName, summary);
|
|
3077
|
+
}
|
|
3078
|
+
return result;
|
|
3079
|
+
}
|
|
2979
3080
|
async emitIntentObservers(bindings, context) {
|
|
2980
3081
|
if (!this.observerDispatcher) return;
|
|
2981
3082
|
await this.observerDispatcher.dispatch(
|
|
@@ -3022,6 +3123,14 @@ var init_intent_router = __esm({
|
|
|
3022
3123
|
}
|
|
3023
3124
|
}
|
|
3024
3125
|
}
|
|
3126
|
+
trackHandlerIntent(handlerName, intent) {
|
|
3127
|
+
const existing = this.handlerIntents.get(handlerName);
|
|
3128
|
+
if (existing) {
|
|
3129
|
+
if (!existing.includes(intent)) existing.push(intent);
|
|
3130
|
+
} else {
|
|
3131
|
+
this.handlerIntents.set(handlerName, [intent]);
|
|
3132
|
+
}
|
|
3133
|
+
}
|
|
3025
3134
|
resolveIntentSensor(ref) {
|
|
3026
3135
|
const registered = this.sensorRegistry?.resolve(ref);
|
|
3027
3136
|
if (registered) {
|