@nextera.one/axis-server-sdk 2.3.1 → 2.3.3
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-Bng8utj8.d.mts → index-D_Av0pG-.d.mts} +27 -0
- package/dist/{index-DJbM2lNM.d.ts → index-wh9piy0E.d.ts} +27 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +105 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +106 -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 +105 -0
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +106 -4
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/sensors/index.mjs
CHANGED
|
@@ -2530,10 +2530,7 @@ var intent_router_exports = {};
|
|
|
2530
2530
|
__export(intent_router_exports, {
|
|
2531
2531
|
IntentRouter: () => IntentRouter
|
|
2532
2532
|
});
|
|
2533
|
-
import {
|
|
2534
|
-
decodeChainEnvelope,
|
|
2535
|
-
decodeChainRequest
|
|
2536
|
-
} from "@nextera.one/axis-protocol";
|
|
2533
|
+
import { decodeChainEnvelope, decodeChainRequest } from "@nextera.one/axis-protocol";
|
|
2537
2534
|
function observerRefKey(ref) {
|
|
2538
2535
|
return typeof ref === "string" ? ref : ref.name;
|
|
2539
2536
|
}
|
|
@@ -2661,6 +2658,8 @@ var init_intent_router = __esm({
|
|
|
2661
2658
|
this.cceHandlers = /* @__PURE__ */ new Map();
|
|
2662
2659
|
/** CCE pipeline configuration (set via configureCce) */
|
|
2663
2660
|
this.ccePipelineConfig = null;
|
|
2661
|
+
/** Reverse index: handler class name → list of registered intents */
|
|
2662
|
+
this.handlerIntents = /* @__PURE__ */ new Map();
|
|
2664
2663
|
this.dependencyResolver = dependencyResolver;
|
|
2665
2664
|
this.observerDispatcher = observerDispatcher;
|
|
2666
2665
|
this.sensorRegistry = sensorRegistry;
|
|
@@ -2750,6 +2749,7 @@ var init_intent_router = __esm({
|
|
|
2750
2749
|
intentName,
|
|
2751
2750
|
`${instance.constructor.name}.${String(route.methodName)}`
|
|
2752
2751
|
);
|
|
2752
|
+
this.trackHandlerIntent(instance.constructor.name, intentName);
|
|
2753
2753
|
this.registerIntentMeta(
|
|
2754
2754
|
intentName,
|
|
2755
2755
|
proto,
|
|
@@ -2773,6 +2773,7 @@ var init_intent_router = __esm({
|
|
|
2773
2773
|
handlerSensors,
|
|
2774
2774
|
handlerObservers
|
|
2775
2775
|
);
|
|
2776
|
+
this.trackHandlerIntent(instance.constructor.name, intentName);
|
|
2776
2777
|
}
|
|
2777
2778
|
}
|
|
2778
2779
|
/**
|
|
@@ -3124,6 +3125,99 @@ var init_intent_router = __esm({
|
|
|
3124
3125
|
getRateLimit(intent) {
|
|
3125
3126
|
return this.intentRateLimits.get(intent);
|
|
3126
3127
|
}
|
|
3128
|
+
// ─── Handler-level Getters ─────────────────────────────────────────────────
|
|
3129
|
+
/** All intents registered under the given handler class name. */
|
|
3130
|
+
getHandlerIntents(handlerName) {
|
|
3131
|
+
return this.handlerIntents.get(handlerName) ?? [];
|
|
3132
|
+
}
|
|
3133
|
+
/** All registered handler class names. */
|
|
3134
|
+
getRegisteredHandlers() {
|
|
3135
|
+
return Array.from(this.handlerIntents.keys());
|
|
3136
|
+
}
|
|
3137
|
+
/** The system/builtin intents (ping, time, echo, chain, intent.exec). */
|
|
3138
|
+
getSystemIntents() {
|
|
3139
|
+
return [..._IntentRouter.BUILTIN_INTENTS];
|
|
3140
|
+
}
|
|
3141
|
+
/** True if every intent in the handler is public, or any one is public — returns true if ANY intent is @AxisPublic. */
|
|
3142
|
+
isHandlerPublic(handlerName) {
|
|
3143
|
+
return this.getHandlerIntents(handlerName).some((i) => this.isPublic(i));
|
|
3144
|
+
}
|
|
3145
|
+
/** True if any intent in the handler is @AxisAnonymous. */
|
|
3146
|
+
isHandlerAnonymous(handlerName) {
|
|
3147
|
+
return this.getHandlerIntents(handlerName).some((i) => this.isAnonymous(i));
|
|
3148
|
+
}
|
|
3149
|
+
/** True if any intent in the handler is @AxisAuthorized. */
|
|
3150
|
+
isHandlerAuthorized(handlerName) {
|
|
3151
|
+
return this.getHandlerIntents(handlerName).some(
|
|
3152
|
+
(i) => this.isAuthorized(i)
|
|
3153
|
+
);
|
|
3154
|
+
}
|
|
3155
|
+
/** Union of all required proof kinds across the handler's intents (deduplicated). */
|
|
3156
|
+
getHandlerProof(handlerName) {
|
|
3157
|
+
const all = this.getHandlerIntents(handlerName).flatMap(
|
|
3158
|
+
(i) => this.getRequiredProof(i) ?? []
|
|
3159
|
+
);
|
|
3160
|
+
if (all.length === 0) return void 0;
|
|
3161
|
+
return [...new Set(all)];
|
|
3162
|
+
}
|
|
3163
|
+
/** Contract from the first intent that has one (class-level contracts propagate to all intents). */
|
|
3164
|
+
getHandlerContract(handlerName) {
|
|
3165
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3166
|
+
const contract = this.getContract(intent);
|
|
3167
|
+
if (contract) return contract;
|
|
3168
|
+
}
|
|
3169
|
+
return void 0;
|
|
3170
|
+
}
|
|
3171
|
+
/** Sensitivity from the first intent that has one. */
|
|
3172
|
+
getHandlerSensitivity(handlerName) {
|
|
3173
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3174
|
+
const sensitivity = this.getSensitivity(intent);
|
|
3175
|
+
if (sensitivity) return sensitivity;
|
|
3176
|
+
}
|
|
3177
|
+
return void 0;
|
|
3178
|
+
}
|
|
3179
|
+
/** Rate limit from the first intent that has one. */
|
|
3180
|
+
getHandlerRateLimit(handlerName) {
|
|
3181
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3182
|
+
const rateLimit = this.getRateLimit(intent);
|
|
3183
|
+
if (rateLimit) return rateLimit;
|
|
3184
|
+
}
|
|
3185
|
+
return void 0;
|
|
3186
|
+
}
|
|
3187
|
+
/** Capsule policy from the first intent that has one. */
|
|
3188
|
+
getHandlerCapsulePolicy(handlerName) {
|
|
3189
|
+
for (const intent of this.getHandlerIntents(handlerName)) {
|
|
3190
|
+
const policy = this.intentCapsulePolicies.get(intent);
|
|
3191
|
+
if (policy) return policy;
|
|
3192
|
+
}
|
|
3193
|
+
return void 0;
|
|
3194
|
+
}
|
|
3195
|
+
/** Full summary of a handler's registered intents and aggregated policies. Returns null if unknown. */
|
|
3196
|
+
getHandlerSummary(handlerName) {
|
|
3197
|
+
const intents = this.getHandlerIntents(handlerName);
|
|
3198
|
+
if (intents.length === 0) return null;
|
|
3199
|
+
return {
|
|
3200
|
+
handler: handlerName,
|
|
3201
|
+
intents,
|
|
3202
|
+
isPublic: this.isHandlerPublic(handlerName),
|
|
3203
|
+
isAnonymous: this.isHandlerAnonymous(handlerName),
|
|
3204
|
+
isAuthorized: this.isHandlerAuthorized(handlerName),
|
|
3205
|
+
requiredProof: this.getHandlerProof(handlerName),
|
|
3206
|
+
contract: this.getHandlerContract(handlerName),
|
|
3207
|
+
sensitivity: this.getHandlerSensitivity(handlerName),
|
|
3208
|
+
rateLimit: this.getHandlerRateLimit(handlerName),
|
|
3209
|
+
capsulePolicy: this.getHandlerCapsulePolicy(handlerName)
|
|
3210
|
+
};
|
|
3211
|
+
}
|
|
3212
|
+
/** Summary of all registered handlers keyed by handler class name. */
|
|
3213
|
+
getAllHandlerSummaries() {
|
|
3214
|
+
const result = /* @__PURE__ */ new Map();
|
|
3215
|
+
for (const handlerName of this.handlerIntents.keys()) {
|
|
3216
|
+
const summary = this.getHandlerSummary(handlerName);
|
|
3217
|
+
if (summary) result.set(handlerName, summary);
|
|
3218
|
+
}
|
|
3219
|
+
return result;
|
|
3220
|
+
}
|
|
3127
3221
|
async emitIntentObservers(bindings, context) {
|
|
3128
3222
|
if (!this.observerDispatcher) return;
|
|
3129
3223
|
await this.observerDispatcher.dispatch(
|
|
@@ -3170,6 +3264,14 @@ var init_intent_router = __esm({
|
|
|
3170
3264
|
}
|
|
3171
3265
|
}
|
|
3172
3266
|
}
|
|
3267
|
+
trackHandlerIntent(handlerName, intent) {
|
|
3268
|
+
const existing = this.handlerIntents.get(handlerName);
|
|
3269
|
+
if (existing) {
|
|
3270
|
+
if (!existing.includes(intent)) existing.push(intent);
|
|
3271
|
+
} else {
|
|
3272
|
+
this.handlerIntents.set(handlerName, [intent]);
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3173
3275
|
resolveIntentSensor(ref) {
|
|
3174
3276
|
const registered = this.sensorRegistry?.resolve(ref);
|
|
3175
3277
|
if (registered) {
|