@nextera.one/axis-server-sdk 2.3.15 → 2.3.17
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-ogUOoBI-.d.mts → index-D4Oz7vc1.d.mts} +4 -1
- package/dist/{index-Dd-WVBj9.d.ts → index-DwBRLF9t.d.ts} +4 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -10
- 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 +34 -9
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +38 -10
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -129,15 +129,19 @@ var init_capsule_policy_decorator = __esm({
|
|
|
129
129
|
|
|
130
130
|
// src/decorators/intent-policy.decorator.ts
|
|
131
131
|
import "reflect-metadata";
|
|
132
|
+
function normalizeRequiredProof(proofs) {
|
|
133
|
+
if (proofs === void 0) return void 0;
|
|
134
|
+
const normalized = Array.from(
|
|
135
|
+
new Set(Array.isArray(proofs) ? proofs : [proofs])
|
|
136
|
+
);
|
|
137
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
138
|
+
}
|
|
132
139
|
function appendRequiredProof(target, propertyKey, proof) {
|
|
133
140
|
const existing = propertyKey !== void 0 ? Reflect.getMetadata(
|
|
134
141
|
REQUIRED_PROOF_METADATA_KEY,
|
|
135
142
|
target,
|
|
136
143
|
propertyKey
|
|
137
|
-
) ?? [] : Reflect.getMetadata(
|
|
138
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
139
|
-
target
|
|
140
|
-
) ?? [];
|
|
144
|
+
) ?? [] : Reflect.getMetadata(REQUIRED_PROOF_METADATA_KEY, target) ?? [];
|
|
141
145
|
const merged = existing.includes(proof) ? existing : [...existing, proof];
|
|
142
146
|
if (propertyKey !== void 0) {
|
|
143
147
|
Reflect.defineMetadata(
|
|
@@ -377,7 +381,12 @@ function toIntentSensorBinding(input) {
|
|
|
377
381
|
}
|
|
378
382
|
function Intent(action, options) {
|
|
379
383
|
return (target, propertyKey) => {
|
|
380
|
-
const
|
|
384
|
+
const requiredProof = normalizeRequiredProof(options?.requiredProof);
|
|
385
|
+
const metadata = {
|
|
386
|
+
intent: action,
|
|
387
|
+
...options,
|
|
388
|
+
...requiredProof ? { requiredProof } : {}
|
|
389
|
+
};
|
|
381
390
|
Reflect.defineMetadata(INTENT_METADATA_KEY, metadata, target, propertyKey);
|
|
382
391
|
if (options?.decoder) {
|
|
383
392
|
Reflect.defineMetadata(
|
|
@@ -395,6 +404,14 @@ function Intent(action, options) {
|
|
|
395
404
|
propertyKey
|
|
396
405
|
);
|
|
397
406
|
}
|
|
407
|
+
if (requiredProof) {
|
|
408
|
+
Reflect.defineMetadata(
|
|
409
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
410
|
+
requiredProof,
|
|
411
|
+
target,
|
|
412
|
+
propertyKey
|
|
413
|
+
);
|
|
414
|
+
}
|
|
398
415
|
const routes = Reflect.getMetadata(INTENT_ROUTES_KEY, target.constructor) || [];
|
|
399
416
|
routes.push({
|
|
400
417
|
action,
|
|
@@ -403,6 +420,7 @@ function Intent(action, options) {
|
|
|
403
420
|
frame: options?.frame,
|
|
404
421
|
kind: options?.kind,
|
|
405
422
|
sensitivity: options?.sensitivity,
|
|
423
|
+
requiredProof,
|
|
406
424
|
chain: options?.chain,
|
|
407
425
|
bodyProfile: options?.bodyProfile,
|
|
408
426
|
tlv: options?.tlv,
|
|
@@ -2509,7 +2527,10 @@ var intent_router_exports = {};
|
|
|
2509
2527
|
__export(intent_router_exports, {
|
|
2510
2528
|
IntentRouter: () => IntentRouter
|
|
2511
2529
|
});
|
|
2512
|
-
import {
|
|
2530
|
+
import {
|
|
2531
|
+
decodeChainEnvelope,
|
|
2532
|
+
decodeChainRequest
|
|
2533
|
+
} from "@nextera.one/axis-protocol";
|
|
2513
2534
|
function observerRefKey(ref) {
|
|
2514
2535
|
return typeof ref === "string" ? ref : ref.name;
|
|
2515
2536
|
}
|
|
@@ -2701,7 +2722,9 @@ var init_intent_router = __esm({
|
|
|
2701
2722
|
*/
|
|
2702
2723
|
register(intent, handler) {
|
|
2703
2724
|
if (this.handlers.has(intent)) {
|
|
2704
|
-
this.logger.warn(
|
|
2725
|
+
this.logger.warn(
|
|
2726
|
+
`Intent ${intent} is already registered; replacing handler`
|
|
2727
|
+
);
|
|
2705
2728
|
}
|
|
2706
2729
|
this.handlers.set(intent, handler);
|
|
2707
2730
|
if (typeof handler === "function" && handler.name) {
|
|
@@ -2972,7 +2995,9 @@ var init_intent_router = __esm({
|
|
|
2972
2995
|
body: bodyRes
|
|
2973
2996
|
};
|
|
2974
2997
|
}
|
|
2975
|
-
throw new Error(
|
|
2998
|
+
throw new Error(
|
|
2999
|
+
`Handler for ${intent} does not implement handle or execute`
|
|
3000
|
+
);
|
|
2976
3001
|
}
|
|
2977
3002
|
logIntent(intent, start, ok, error) {
|
|
2978
3003
|
const diff = process.hrtime(start);
|
|
@@ -3067,9 +3092,11 @@ var init_intent_router = __esm({
|
|
|
3067
3092
|
if (contract) {
|
|
3068
3093
|
this.intentContracts.set(intent, contract);
|
|
3069
3094
|
}
|
|
3095
|
+
const inlineRequiredProof = normalizeRequiredProof(meta?.requiredProof);
|
|
3070
3096
|
const proofPolicy = resolveIntentProofPolicy(proto, methodName);
|
|
3071
|
-
|
|
3072
|
-
|
|
3097
|
+
const requiredProof = inlineRequiredProof ?? proofPolicy.requiredProof;
|
|
3098
|
+
if (requiredProof.length > 0) {
|
|
3099
|
+
this.intentRequiredProof.set(intent, requiredProof);
|
|
3073
3100
|
}
|
|
3074
3101
|
const rateLimit = Reflect.getMetadata(
|
|
3075
3102
|
AXIS_RATE_LIMIT_KEY,
|
|
@@ -3678,6 +3705,7 @@ var init_intent_router = __esm({
|
|
|
3678
3705
|
intent: meta.intent,
|
|
3679
3706
|
version: 1,
|
|
3680
3707
|
bodyProfile: meta.bodyProfile || "TLV_MAP",
|
|
3708
|
+
dtoName: meta.dto.name || void 0,
|
|
3681
3709
|
fields: extracted.fields.map((f) => ({
|
|
3682
3710
|
name: f.name,
|
|
3683
3711
|
tlv: f.tag,
|