@nextera.one/axis-server-sdk 2.2.3 → 2.2.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-B2G6cbRL.d.mts → index-C4ApiXHX.d.mts} +38 -25
- package/dist/{index-DbSxdR0f.d.ts → index-QGwgvVDY.d.ts} +38 -25
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +162 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -92
- 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 +160 -96
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +156 -92
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/sensors/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-C4ApiXHX.mjs';
|
|
2
2
|
import '../axis-sensor-GBEI3Fab.mjs';
|
|
3
3
|
import '../cce-pipeline-B-zUBHo3.mjs';
|
|
4
4
|
import '@nextera.one/axis-protocol';
|
package/dist/sensors/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-QGwgvVDY.js';
|
|
2
2
|
import '../axis-sensor-GBEI3Fab.js';
|
|
3
3
|
import '../cce-pipeline-DbGBSsCG.js';
|
|
4
4
|
import '@nextera.one/axis-protocol';
|
package/dist/sensors/index.js
CHANGED
|
@@ -525,17 +525,76 @@ var init_intent_policy_decorator = __esm({
|
|
|
525
525
|
}
|
|
526
526
|
});
|
|
527
527
|
|
|
528
|
-
// src/decorators/handler.decorator.ts
|
|
529
|
-
function
|
|
528
|
+
// src/decorators/handler-sensors.decorator.ts
|
|
529
|
+
function HandlerSensors(sensors) {
|
|
530
530
|
return (target) => {
|
|
531
|
-
Reflect.defineMetadata(
|
|
531
|
+
Reflect.defineMetadata(HANDLER_SENSORS_KEY, sensors, target);
|
|
532
532
|
};
|
|
533
533
|
}
|
|
534
|
-
var import_reflect_metadata5,
|
|
535
|
-
var
|
|
536
|
-
"src/decorators/handler.decorator.ts"() {
|
|
534
|
+
var import_reflect_metadata5, HANDLER_SENSORS_KEY;
|
|
535
|
+
var init_handler_sensors_decorator = __esm({
|
|
536
|
+
"src/decorators/handler-sensors.decorator.ts"() {
|
|
537
537
|
import_reflect_metadata5 = require("reflect-metadata");
|
|
538
|
-
|
|
538
|
+
HANDLER_SENSORS_KEY = "axis:handler:sensors";
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// src/decorators/observer.decorator.ts
|
|
543
|
+
function isBindingOptions(value) {
|
|
544
|
+
return !!value && typeof value === "object" && "use" in value;
|
|
545
|
+
}
|
|
546
|
+
function isDefinitionOptions(value) {
|
|
547
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && !isBindingOptions(value);
|
|
548
|
+
}
|
|
549
|
+
function toObserverBinding(input) {
|
|
550
|
+
if (!input) return null;
|
|
551
|
+
if (isBindingOptions(input)) {
|
|
552
|
+
const refs = Array.isArray(input.use) ? input.use : [input.use];
|
|
553
|
+
return { refs, tags: input.tags, events: input.events };
|
|
554
|
+
}
|
|
555
|
+
if (Array.isArray(input)) {
|
|
556
|
+
return { refs: input };
|
|
557
|
+
}
|
|
558
|
+
if (typeof input === "function" || typeof input === "string") {
|
|
559
|
+
return { refs: [input] };
|
|
560
|
+
}
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
function Observer(input) {
|
|
564
|
+
return ((target, propertyKey) => {
|
|
565
|
+
const binding = toObserverBinding(input);
|
|
566
|
+
if (binding) {
|
|
567
|
+
if (propertyKey !== void 0) {
|
|
568
|
+
const existing2 = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target, propertyKey) || [];
|
|
569
|
+
existing2.push(binding);
|
|
570
|
+
Reflect.defineMetadata(
|
|
571
|
+
OBSERVER_BINDINGS_KEY,
|
|
572
|
+
existing2,
|
|
573
|
+
target,
|
|
574
|
+
propertyKey
|
|
575
|
+
);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
|
|
579
|
+
existing.push(binding);
|
|
580
|
+
Reflect.defineMetadata(OBSERVER_BINDINGS_KEY, existing, target);
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
if (propertyKey !== void 0) {
|
|
584
|
+
throw new Error(
|
|
585
|
+
"@Observer method usage must reference one or more observer classes or names"
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
const definition = isDefinitionOptions(input) ? input : {};
|
|
589
|
+
Reflect.defineMetadata(OBSERVER_METADATA_KEY, definition, target);
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
var import_reflect_metadata6, OBSERVER_METADATA_KEY, OBSERVER_BINDINGS_KEY;
|
|
593
|
+
var init_observer_decorator = __esm({
|
|
594
|
+
"src/decorators/observer.decorator.ts"() {
|
|
595
|
+
import_reflect_metadata6 = require("reflect-metadata");
|
|
596
|
+
OBSERVER_METADATA_KEY = "axis:observer";
|
|
597
|
+
OBSERVER_BINDINGS_KEY = "axis:observer:bindings";
|
|
539
598
|
}
|
|
540
599
|
});
|
|
541
600
|
|
|
@@ -545,15 +604,30 @@ function IntentBody(decoder) {
|
|
|
545
604
|
Reflect.defineMetadata(INTENT_BODY_KEY, decoder, target, propertyKey);
|
|
546
605
|
};
|
|
547
606
|
}
|
|
548
|
-
var
|
|
607
|
+
var import_reflect_metadata7, INTENT_BODY_KEY;
|
|
549
608
|
var init_intent_body_decorator = __esm({
|
|
550
609
|
"src/decorators/intent-body.decorator.ts"() {
|
|
551
|
-
|
|
610
|
+
import_reflect_metadata7 = require("reflect-metadata");
|
|
552
611
|
INTENT_BODY_KEY = "axis:intent:body";
|
|
553
612
|
}
|
|
554
613
|
});
|
|
555
614
|
|
|
556
615
|
// src/decorators/intent.decorator.ts
|
|
616
|
+
function isIntentSensorBindingOptions(value) {
|
|
617
|
+
return !!value && typeof value === "object" && !Array.isArray(value) && "use" in value;
|
|
618
|
+
}
|
|
619
|
+
function toIntentSensorBinding(input) {
|
|
620
|
+
if (isIntentSensorBindingOptions(input)) {
|
|
621
|
+
return {
|
|
622
|
+
ref: input.use,
|
|
623
|
+
when: input.when || "before"
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
ref: input,
|
|
628
|
+
when: "before"
|
|
629
|
+
};
|
|
630
|
+
}
|
|
557
631
|
function Intent(action, options) {
|
|
558
632
|
return (target, propertyKey) => {
|
|
559
633
|
const metadata = { intent: action, ...options };
|
|
@@ -591,10 +665,10 @@ function Intent(action, options) {
|
|
|
591
665
|
Reflect.defineMetadata(INTENT_ROUTES_KEY, routes, target.constructor);
|
|
592
666
|
};
|
|
593
667
|
}
|
|
594
|
-
var
|
|
668
|
+
var import_reflect_metadata8, INTENT_METADATA_KEY, INTENT_ROUTES_KEY;
|
|
595
669
|
var init_intent_decorator = __esm({
|
|
596
670
|
"src/decorators/intent.decorator.ts"() {
|
|
597
|
-
|
|
671
|
+
import_reflect_metadata8 = require("reflect-metadata");
|
|
598
672
|
init_intent_body_decorator();
|
|
599
673
|
init_intent_policy_decorator();
|
|
600
674
|
INTENT_METADATA_KEY = "axis:intent";
|
|
@@ -602,90 +676,62 @@ var init_intent_decorator = __esm({
|
|
|
602
676
|
}
|
|
603
677
|
});
|
|
604
678
|
|
|
605
|
-
// src/decorators/
|
|
606
|
-
function
|
|
607
|
-
return (target
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
if (isBindingOptions(input)) {
|
|
629
|
-
const refs = Array.isArray(input.use) ? input.use : [input.use];
|
|
630
|
-
return { refs, tags: input.tags, events: input.events };
|
|
631
|
-
}
|
|
632
|
-
if (Array.isArray(input)) {
|
|
633
|
-
return { refs: input };
|
|
634
|
-
}
|
|
635
|
-
if (typeof input === "function" || typeof input === "string") {
|
|
636
|
-
return { refs: [input] };
|
|
637
|
-
}
|
|
638
|
-
return null;
|
|
639
|
-
}
|
|
640
|
-
function Observer(input) {
|
|
641
|
-
return ((target, propertyKey) => {
|
|
642
|
-
const binding = toBinding(input);
|
|
643
|
-
if (binding) {
|
|
644
|
-
if (propertyKey !== void 0) {
|
|
645
|
-
const existing2 = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target, propertyKey) || [];
|
|
646
|
-
existing2.push(binding);
|
|
647
|
-
Reflect.defineMetadata(
|
|
648
|
-
OBSERVER_BINDINGS_KEY,
|
|
649
|
-
existing2,
|
|
650
|
-
target,
|
|
651
|
-
propertyKey
|
|
652
|
-
);
|
|
653
|
-
return;
|
|
654
|
-
}
|
|
655
|
-
const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
|
|
656
|
-
existing.push(binding);
|
|
657
|
-
Reflect.defineMetadata(OBSERVER_BINDINGS_KEY, existing, target);
|
|
658
|
-
return;
|
|
679
|
+
// src/decorators/handler.decorator.ts
|
|
680
|
+
function Handler(intentOrOptions, options) {
|
|
681
|
+
return (target) => {
|
|
682
|
+
const intent = typeof intentOrOptions === "string" ? intentOrOptions : void 0;
|
|
683
|
+
const handlerOptions = typeof intentOrOptions === "string" ? options : intentOrOptions;
|
|
684
|
+
const sensorBindings = Array.isArray(handlerOptions?.is) ? handlerOptions.is.map(
|
|
685
|
+
(input) => toIntentSensorBinding(input)
|
|
686
|
+
) : [];
|
|
687
|
+
const observerBindings = Array.isArray(
|
|
688
|
+
handlerOptions?.observe
|
|
689
|
+
) ? handlerOptions.observe.map((input) => toObserverBinding(input)).filter((binding) => !!binding) : [];
|
|
690
|
+
Reflect.defineMetadata(
|
|
691
|
+
HANDLER_METADATA_KEY,
|
|
692
|
+
{ intent, ...handlerOptions || {} },
|
|
693
|
+
target
|
|
694
|
+
);
|
|
695
|
+
if (sensorBindings.length > 0) {
|
|
696
|
+
const existing = Reflect.getMetadata(HANDLER_SENSORS_KEY, target) || [];
|
|
697
|
+
Reflect.defineMetadata(
|
|
698
|
+
HANDLER_SENSORS_KEY,
|
|
699
|
+
[...existing, ...sensorBindings],
|
|
700
|
+
target
|
|
701
|
+
);
|
|
659
702
|
}
|
|
660
|
-
if (
|
|
661
|
-
|
|
662
|
-
|
|
703
|
+
if (observerBindings.length > 0) {
|
|
704
|
+
const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
|
|
705
|
+
Reflect.defineMetadata(
|
|
706
|
+
OBSERVER_BINDINGS_KEY,
|
|
707
|
+
[...existing, ...observerBindings],
|
|
708
|
+
target
|
|
663
709
|
);
|
|
664
710
|
}
|
|
665
|
-
|
|
666
|
-
Reflect.defineMetadata(OBSERVER_METADATA_KEY, definition, target);
|
|
667
|
-
});
|
|
711
|
+
};
|
|
668
712
|
}
|
|
669
|
-
var import_reflect_metadata9,
|
|
670
|
-
var
|
|
671
|
-
"src/decorators/
|
|
713
|
+
var import_reflect_metadata9, HANDLER_METADATA_KEY;
|
|
714
|
+
var init_handler_decorator = __esm({
|
|
715
|
+
"src/decorators/handler.decorator.ts"() {
|
|
672
716
|
import_reflect_metadata9 = require("reflect-metadata");
|
|
673
|
-
|
|
674
|
-
|
|
717
|
+
init_handler_sensors_decorator();
|
|
718
|
+
init_observer_decorator();
|
|
719
|
+
init_intent_decorator();
|
|
720
|
+
HANDLER_METADATA_KEY = "axis:handler";
|
|
675
721
|
}
|
|
676
722
|
});
|
|
677
723
|
|
|
678
|
-
// src/decorators/
|
|
679
|
-
function
|
|
680
|
-
return (target) => {
|
|
681
|
-
Reflect.defineMetadata(
|
|
724
|
+
// src/decorators/intent-sensors.decorator.ts
|
|
725
|
+
function IntentSensors(sensors) {
|
|
726
|
+
return (target, propertyKey) => {
|
|
727
|
+
Reflect.defineMetadata(INTENT_SENSORS_KEY, sensors, target, propertyKey);
|
|
682
728
|
};
|
|
683
729
|
}
|
|
684
|
-
var import_reflect_metadata10,
|
|
685
|
-
var
|
|
686
|
-
"src/decorators/
|
|
730
|
+
var import_reflect_metadata10, INTENT_SENSORS_KEY;
|
|
731
|
+
var init_intent_sensors_decorator = __esm({
|
|
732
|
+
"src/decorators/intent-sensors.decorator.ts"() {
|
|
687
733
|
import_reflect_metadata10 = require("reflect-metadata");
|
|
688
|
-
|
|
734
|
+
INTENT_SENSORS_KEY = "axis:intent:sensors";
|
|
689
735
|
}
|
|
690
736
|
});
|
|
691
737
|
|
|
@@ -2398,15 +2444,19 @@ function observerRefKey(ref) {
|
|
|
2398
2444
|
function sensorRefKey(ref) {
|
|
2399
2445
|
return typeof ref === "string" ? ref : ref.name;
|
|
2400
2446
|
}
|
|
2401
|
-
function
|
|
2447
|
+
function sensorBindingKey(binding) {
|
|
2448
|
+
return `${binding.when}:${sensorRefKey(binding.ref)}`;
|
|
2449
|
+
}
|
|
2450
|
+
function mergeIntentSensorBindings(...sensorGroups) {
|
|
2402
2451
|
const merged = /* @__PURE__ */ new Map();
|
|
2403
2452
|
for (const group of sensorGroups) {
|
|
2404
2453
|
if (!Array.isArray(group)) continue;
|
|
2405
|
-
for (const
|
|
2406
|
-
const
|
|
2454
|
+
for (const input of group) {
|
|
2455
|
+
const binding = toIntentSensorBinding(input);
|
|
2456
|
+
const key = sensorBindingKey(binding);
|
|
2407
2457
|
const existing = merged.get(key);
|
|
2408
|
-
if (!existing || typeof existing === "string" && typeof ref !== "string") {
|
|
2409
|
-
merged.set(key,
|
|
2458
|
+
if (!existing || typeof existing.ref === "string" && typeof binding.ref !== "string") {
|
|
2459
|
+
merged.set(key, binding);
|
|
2410
2460
|
}
|
|
2411
2461
|
}
|
|
2412
2462
|
}
|
|
@@ -2710,9 +2760,9 @@ var init_intent_router = __esm({
|
|
|
2710
2760
|
if (!handler) {
|
|
2711
2761
|
throw new Error(`Intent not found: ${intent}`);
|
|
2712
2762
|
}
|
|
2713
|
-
const
|
|
2714
|
-
if (
|
|
2715
|
-
await this.runIntentSensors(
|
|
2763
|
+
const sensorBindings = this.intentSensors.get(intent);
|
|
2764
|
+
if (sensorBindings && sensorBindings.length > 0) {
|
|
2765
|
+
await this.runIntentSensors(sensorBindings, intent, frame, "before");
|
|
2716
2766
|
}
|
|
2717
2767
|
const decoder = this.intentDecoders.get(intent);
|
|
2718
2768
|
let decodedBody = frame.body;
|
|
@@ -2754,6 +2804,12 @@ var init_intent_router = __esm({
|
|
|
2754
2804
|
);
|
|
2755
2805
|
}
|
|
2756
2806
|
}
|
|
2807
|
+
if (sensorBindings && sensorBindings.length > 0) {
|
|
2808
|
+
await this.runIntentSensors(sensorBindings, intent, frame, "after", {
|
|
2809
|
+
decodedBody,
|
|
2810
|
+
effect
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2757
2813
|
}
|
|
2758
2814
|
await this.emitIntentObservers(observerBindings, {
|
|
2759
2815
|
event: "intent.completed",
|
|
@@ -2797,7 +2853,7 @@ var init_intent_router = __esm({
|
|
|
2797
2853
|
methodName
|
|
2798
2854
|
);
|
|
2799
2855
|
const meta = Reflect.getMetadata(INTENT_METADATA_KEY, proto, methodName);
|
|
2800
|
-
const combined =
|
|
2856
|
+
const combined = mergeIntentSensorBindings(
|
|
2801
2857
|
handlerSensors,
|
|
2802
2858
|
Array.isArray(intentSensors) ? intentSensors : void 0,
|
|
2803
2859
|
Array.isArray(meta?.is) ? meta.is : void 0
|
|
@@ -2939,8 +2995,10 @@ var init_intent_router = __esm({
|
|
|
2939
2995
|
if (!this.observerDispatcher || bindings.length === 0) return;
|
|
2940
2996
|
await this.observerDispatcher.dispatch(bindings, context);
|
|
2941
2997
|
}
|
|
2942
|
-
async runIntentSensors(
|
|
2943
|
-
for (const
|
|
2998
|
+
async runIntentSensors(sensorBindings, intent, frame, stage, extras) {
|
|
2999
|
+
for (const binding of sensorBindings) {
|
|
3000
|
+
if (binding.when !== stage && binding.when !== "both") continue;
|
|
3001
|
+
const sensorRef = binding.ref;
|
|
2944
3002
|
const sensor = this.resolveIntentSensor(sensorRef);
|
|
2945
3003
|
const sensorName = sensorRefKey(sensorRef);
|
|
2946
3004
|
if (!sensor) {
|
|
@@ -2957,9 +3015,12 @@ var init_intent_router = __esm({
|
|
|
2957
3015
|
frameBody: frame.body,
|
|
2958
3016
|
metadata: {
|
|
2959
3017
|
phase: "intent",
|
|
3018
|
+
stage,
|
|
2960
3019
|
intent,
|
|
2961
3020
|
schema: this.getSchema(intent),
|
|
2962
|
-
validators: this.getValidators(intent)
|
|
3021
|
+
validators: this.getValidators(intent),
|
|
3022
|
+
decodedBody: extras?.decodedBody,
|
|
3023
|
+
effect: extras?.effect
|
|
2963
3024
|
}
|
|
2964
3025
|
};
|
|
2965
3026
|
if (sensor.supports && !sensor.supports(sensorInput)) continue;
|
|
@@ -10607,6 +10668,8 @@ __export(index_exports, {
|
|
|
10607
10668
|
startStage: () => startStage,
|
|
10608
10669
|
tieKnot: () => tieKnot,
|
|
10609
10670
|
tlv: () => tlv,
|
|
10671
|
+
toIntentSensorBinding: () => toIntentSensorBinding,
|
|
10672
|
+
toObserverBinding: () => toObserverBinding,
|
|
10610
10673
|
u64be: () => u64be,
|
|
10611
10674
|
unpackPasskeyLoginOptionsReq: () => unpackPasskeyLoginOptionsReq,
|
|
10612
10675
|
unpackPasskeyLoginVerifyReq: () => unpackPasskeyLoginVerifyReq,
|
|
@@ -10638,6 +10701,7 @@ var init_index = __esm({
|
|
|
10638
10701
|
init_intent_body_decorator();
|
|
10639
10702
|
init_intent_sensors_decorator();
|
|
10640
10703
|
init_observer_decorator();
|
|
10704
|
+
init_observer_decorator();
|
|
10641
10705
|
init_handler_sensors_decorator();
|
|
10642
10706
|
init_sensor_decorator();
|
|
10643
10707
|
import_tlv_field2 = __toESM(require_tlv_field_decorator());
|