@nextera.one/axis-server-sdk 2.3.9 → 2.3.12
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-DfG00R_f.d.mts → index-DZdmfbDZ.d.mts} +20 -1
- package/dist/{index-DPQEO0Qh.d.ts → index-D_6djkZB.d.ts} +20 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +146 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +146 -60
- 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 +146 -60
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +146 -60
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/sensors/index.mjs
CHANGED
|
@@ -450,6 +450,31 @@ var init_capsule_policy_decorator = __esm({
|
|
|
450
450
|
|
|
451
451
|
// src/decorators/intent-policy.decorator.ts
|
|
452
452
|
import "reflect-metadata";
|
|
453
|
+
function appendRequiredProof(target, propertyKey, proof) {
|
|
454
|
+
const existing = propertyKey !== void 0 ? Reflect.getMetadata(
|
|
455
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
456
|
+
target,
|
|
457
|
+
propertyKey
|
|
458
|
+
) ?? [] : Reflect.getMetadata(
|
|
459
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
460
|
+
target
|
|
461
|
+
) ?? [];
|
|
462
|
+
const merged = existing.includes(proof) ? existing : [...existing, proof];
|
|
463
|
+
if (propertyKey !== void 0) {
|
|
464
|
+
Reflect.defineMetadata(
|
|
465
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
466
|
+
merged,
|
|
467
|
+
target,
|
|
468
|
+
propertyKey
|
|
469
|
+
);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
Reflect.defineMetadata(
|
|
473
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
474
|
+
merged,
|
|
475
|
+
target
|
|
476
|
+
);
|
|
477
|
+
}
|
|
453
478
|
function Sensitivity(level) {
|
|
454
479
|
return ((target, propertyKey) => {
|
|
455
480
|
if (propertyKey !== void 0) {
|
|
@@ -498,56 +523,12 @@ function RequiredProof(proofs) {
|
|
|
498
523
|
}
|
|
499
524
|
function Capsule() {
|
|
500
525
|
return ((target, propertyKey) => {
|
|
501
|
-
|
|
502
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
503
|
-
target,
|
|
504
|
-
propertyKey
|
|
505
|
-
) ?? [] : Reflect.getMetadata(
|
|
506
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
507
|
-
target
|
|
508
|
-
) ?? [];
|
|
509
|
-
const merged = existing.includes("CAPSULE") ? existing : [...existing, "CAPSULE"];
|
|
510
|
-
if (propertyKey !== void 0) {
|
|
511
|
-
Reflect.defineMetadata(
|
|
512
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
513
|
-
merged,
|
|
514
|
-
target,
|
|
515
|
-
propertyKey
|
|
516
|
-
);
|
|
517
|
-
} else {
|
|
518
|
-
Reflect.defineMetadata(
|
|
519
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
520
|
-
merged,
|
|
521
|
-
target
|
|
522
|
-
);
|
|
523
|
-
}
|
|
526
|
+
appendRequiredProof(target, propertyKey, "CAPSULE");
|
|
524
527
|
});
|
|
525
528
|
}
|
|
526
529
|
function Witness() {
|
|
527
530
|
return ((target, propertyKey) => {
|
|
528
|
-
|
|
529
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
530
|
-
target,
|
|
531
|
-
propertyKey
|
|
532
|
-
) ?? [] : Reflect.getMetadata(
|
|
533
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
534
|
-
target
|
|
535
|
-
) ?? [];
|
|
536
|
-
const merged = existing.includes("WITNESS") ? existing : [...existing, "WITNESS"];
|
|
537
|
-
if (propertyKey !== void 0) {
|
|
538
|
-
Reflect.defineMetadata(
|
|
539
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
540
|
-
merged,
|
|
541
|
-
target,
|
|
542
|
-
propertyKey
|
|
543
|
-
);
|
|
544
|
-
} else {
|
|
545
|
-
Reflect.defineMetadata(
|
|
546
|
-
REQUIRED_PROOF_METADATA_KEY,
|
|
547
|
-
merged,
|
|
548
|
-
target
|
|
549
|
-
);
|
|
550
|
-
}
|
|
531
|
+
appendRequiredProof(target, propertyKey, "WITNESS");
|
|
551
532
|
});
|
|
552
533
|
}
|
|
553
534
|
function Axis() {
|
|
@@ -557,31 +538,37 @@ function Axis() {
|
|
|
557
538
|
}
|
|
558
539
|
function AxisPublic() {
|
|
559
540
|
return (target, propertyKey, descriptor) => {
|
|
560
|
-
if (
|
|
541
|
+
if (propertyKey !== void 0) {
|
|
561
542
|
Reflect.defineMetadata(AXIS_PUBLIC_KEY, true, target, propertyKey);
|
|
543
|
+
appendRequiredProof(target, propertyKey, "NONE");
|
|
562
544
|
return descriptor;
|
|
563
545
|
}
|
|
564
546
|
Reflect.defineMetadata(AXIS_PUBLIC_KEY, true, target);
|
|
547
|
+
appendRequiredProof(target, void 0, "NONE");
|
|
565
548
|
return target;
|
|
566
549
|
};
|
|
567
550
|
}
|
|
568
551
|
function AxisAuthorized() {
|
|
569
552
|
return (target, propertyKey, descriptor) => {
|
|
570
|
-
if (
|
|
553
|
+
if (propertyKey !== void 0) {
|
|
571
554
|
Reflect.defineMetadata(AXIS_AUTHORIZED_KEY, true, target, propertyKey);
|
|
555
|
+
appendRequiredProof(target, propertyKey, "AUTHORIZED");
|
|
572
556
|
return descriptor;
|
|
573
557
|
}
|
|
574
558
|
Reflect.defineMetadata(AXIS_AUTHORIZED_KEY, true, target);
|
|
559
|
+
appendRequiredProof(target, void 0, "AUTHORIZED");
|
|
575
560
|
return target;
|
|
576
561
|
};
|
|
577
562
|
}
|
|
578
563
|
function AxisAnonymous() {
|
|
579
564
|
return (target, propertyKey, descriptor) => {
|
|
580
|
-
if (
|
|
565
|
+
if (propertyKey !== void 0) {
|
|
581
566
|
Reflect.defineMetadata(AXIS_ANONYMOUS_KEY, true, target, propertyKey);
|
|
567
|
+
appendRequiredProof(target, propertyKey, "ANONYMOUS");
|
|
582
568
|
return descriptor;
|
|
583
569
|
}
|
|
584
570
|
Reflect.defineMetadata(AXIS_ANONYMOUS_KEY, true, target);
|
|
571
|
+
appendRequiredProof(target, void 0, "ANONYMOUS");
|
|
585
572
|
return target;
|
|
586
573
|
};
|
|
587
574
|
}
|
|
@@ -2536,6 +2523,22 @@ function sensorRefKey(ref) {
|
|
|
2536
2523
|
function sensorBindingKey(binding) {
|
|
2537
2524
|
return `${binding.when}:${sensorRefKey(binding.ref)}`;
|
|
2538
2525
|
}
|
|
2526
|
+
function mergeProofKinds(...proofGroups) {
|
|
2527
|
+
const merged = /* @__PURE__ */ new Set();
|
|
2528
|
+
for (const proofs of proofGroups) {
|
|
2529
|
+
for (const proof of proofs ?? []) {
|
|
2530
|
+
merged.add(proof);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
return Array.from(merged);
|
|
2534
|
+
}
|
|
2535
|
+
function accessProofKinds(isPublic, isAnonymous, isAuthorized) {
|
|
2536
|
+
const proofs = [];
|
|
2537
|
+
if (isPublic) proofs.push("NONE");
|
|
2538
|
+
if (isAnonymous) proofs.push("ANONYMOUS");
|
|
2539
|
+
if (isAuthorized) proofs.push("AUTHORIZED");
|
|
2540
|
+
return proofs;
|
|
2541
|
+
}
|
|
2539
2542
|
function mergeIntentSensorBindings(...sensorGroups) {
|
|
2540
2543
|
const merged = /* @__PURE__ */ new Map();
|
|
2541
2544
|
for (const group of sensorGroups) {
|
|
@@ -3070,10 +3073,6 @@ var init_intent_router = __esm({
|
|
|
3070
3073
|
REQUIRED_PROOF_METADATA_KEY,
|
|
3071
3074
|
proto.constructor
|
|
3072
3075
|
);
|
|
3073
|
-
const requiredProof = methodProof ?? classProof;
|
|
3074
|
-
if (requiredProof && requiredProof.length > 0) {
|
|
3075
|
-
this.intentRequiredProof.set(intent, requiredProof);
|
|
3076
|
-
}
|
|
3077
3076
|
const isPublicMethod = Reflect.getMetadata(
|
|
3078
3077
|
AXIS_PUBLIC_KEY,
|
|
3079
3078
|
proto,
|
|
@@ -3083,9 +3082,6 @@ var init_intent_router = __esm({
|
|
|
3083
3082
|
AXIS_PUBLIC_KEY,
|
|
3084
3083
|
proto.constructor
|
|
3085
3084
|
);
|
|
3086
|
-
if (isPublicMethod || isPublicClass) {
|
|
3087
|
-
this.publicIntents.add(intent);
|
|
3088
|
-
}
|
|
3089
3085
|
const isAnonMethod = Reflect.getMetadata(
|
|
3090
3086
|
AXIS_ANONYMOUS_KEY,
|
|
3091
3087
|
proto,
|
|
@@ -3095,9 +3091,6 @@ var init_intent_router = __esm({
|
|
|
3095
3091
|
AXIS_ANONYMOUS_KEY,
|
|
3096
3092
|
proto.constructor
|
|
3097
3093
|
);
|
|
3098
|
-
if (isAnonMethod || isAnonClass) {
|
|
3099
|
-
this.anonymousIntents.add(intent);
|
|
3100
|
-
}
|
|
3101
3094
|
const isAuthorizedMethod = Reflect.getMetadata(
|
|
3102
3095
|
AXIS_AUTHORIZED_KEY,
|
|
3103
3096
|
proto,
|
|
@@ -3107,7 +3100,25 @@ var init_intent_router = __esm({
|
|
|
3107
3100
|
AXIS_AUTHORIZED_KEY,
|
|
3108
3101
|
proto.constructor
|
|
3109
3102
|
);
|
|
3110
|
-
|
|
3103
|
+
const methodPolicyProof = mergeProofKinds(
|
|
3104
|
+
methodProof,
|
|
3105
|
+
accessProofKinds(isPublicMethod, isAnonMethod, isAuthorizedMethod)
|
|
3106
|
+
);
|
|
3107
|
+
const classPolicyProof = mergeProofKinds(
|
|
3108
|
+
classProof,
|
|
3109
|
+
accessProofKinds(isPublicClass, isAnonClass, isAuthorizedClass)
|
|
3110
|
+
);
|
|
3111
|
+
const requiredProof = methodPolicyProof.length ? methodPolicyProof : classPolicyProof;
|
|
3112
|
+
if (requiredProof.length > 0) {
|
|
3113
|
+
this.intentRequiredProof.set(intent, requiredProof);
|
|
3114
|
+
}
|
|
3115
|
+
if (requiredProof.includes("NONE")) {
|
|
3116
|
+
this.publicIntents.add(intent);
|
|
3117
|
+
}
|
|
3118
|
+
if (requiredProof.includes("ANONYMOUS")) {
|
|
3119
|
+
this.anonymousIntents.add(intent);
|
|
3120
|
+
}
|
|
3121
|
+
if (requiredProof.includes("AUTHORIZED")) {
|
|
3111
3122
|
this.authorizedIntents.add(intent);
|
|
3112
3123
|
}
|
|
3113
3124
|
const rateLimit = Reflect.getMetadata(
|
|
@@ -11811,6 +11822,80 @@ var require_intent_registry_sensor = __commonJS({
|
|
|
11811
11822
|
}
|
|
11812
11823
|
});
|
|
11813
11824
|
|
|
11825
|
+
// src/sensors/law-article-presence.sensor.ts
|
|
11826
|
+
var require_law_article_presence_sensor = __commonJS({
|
|
11827
|
+
"src/sensors/law-article-presence.sensor.ts"(exports) {
|
|
11828
|
+
"use strict";
|
|
11829
|
+
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
11830
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
11831
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
11832
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11833
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11834
|
+
};
|
|
11835
|
+
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
11836
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
11837
|
+
};
|
|
11838
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11839
|
+
exports.LawArticlePresenceSensor = void 0;
|
|
11840
|
+
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
11841
|
+
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
11842
|
+
var LawArticlePresenceSensor = class LawArticlePresenceSensor {
|
|
11843
|
+
constructor(options) {
|
|
11844
|
+
this.options = options;
|
|
11845
|
+
this.name = "LawArticlePresenceSensor";
|
|
11846
|
+
this.order = sensor_bands_1.BAND.IDENTITY + 27;
|
|
11847
|
+
}
|
|
11848
|
+
supports(input) {
|
|
11849
|
+
if (this.mode() === "off")
|
|
11850
|
+
return false;
|
|
11851
|
+
if (!input.intent)
|
|
11852
|
+
return false;
|
|
11853
|
+
if (this.exemptIntents().includes(input.intent))
|
|
11854
|
+
return false;
|
|
11855
|
+
return true;
|
|
11856
|
+
}
|
|
11857
|
+
async run(input) {
|
|
11858
|
+
const intent = input.intent;
|
|
11859
|
+
const count = await this.options.getLawArticleCount(intent, input);
|
|
11860
|
+
if (count > 0) {
|
|
11861
|
+
return {
|
|
11862
|
+
action: "ALLOW",
|
|
11863
|
+
meta: { lawArticles: count }
|
|
11864
|
+
};
|
|
11865
|
+
}
|
|
11866
|
+
const reason = `Intent '${intent}' has no law article mapping`;
|
|
11867
|
+
if (this.mode() === "strict") {
|
|
11868
|
+
return {
|
|
11869
|
+
action: "DENY",
|
|
11870
|
+
code: this.options.missingCode ?? "CAPSULE_NOT_LAWFUL",
|
|
11871
|
+
reason
|
|
11872
|
+
};
|
|
11873
|
+
}
|
|
11874
|
+
return {
|
|
11875
|
+
action: "FLAG",
|
|
11876
|
+
scoreDelta: this.options.auditScoreDelta ?? 5,
|
|
11877
|
+
reasons: ["LAW_ARTICLE_MISSING", reason],
|
|
11878
|
+
meta: { lawArticles: 0 }
|
|
11879
|
+
};
|
|
11880
|
+
}
|
|
11881
|
+
mode() {
|
|
11882
|
+
const configured = this.options.mode;
|
|
11883
|
+
if (typeof configured === "function")
|
|
11884
|
+
return configured();
|
|
11885
|
+
return configured ?? "audit";
|
|
11886
|
+
}
|
|
11887
|
+
exemptIntents() {
|
|
11888
|
+
return this.options.exemptIntents ?? ["system.ping"];
|
|
11889
|
+
}
|
|
11890
|
+
};
|
|
11891
|
+
exports.LawArticlePresenceSensor = LawArticlePresenceSensor;
|
|
11892
|
+
exports.LawArticlePresenceSensor = LawArticlePresenceSensor = __decorate([
|
|
11893
|
+
(0, sensor_decorator_1.Sensor)({ phase: "POST_DECODE" }),
|
|
11894
|
+
__metadata("design:paramtypes", [Object])
|
|
11895
|
+
], LawArticlePresenceSensor);
|
|
11896
|
+
}
|
|
11897
|
+
});
|
|
11898
|
+
|
|
11814
11899
|
// src/sensors/law-evaluation.sensor.ts
|
|
11815
11900
|
var require_law_evaluation_sensor = __commonJS({
|
|
11816
11901
|
"src/sensors/law-evaluation.sensor.ts"(exports) {
|
|
@@ -13282,6 +13367,7 @@ var init_sensors = __esm({
|
|
|
13282
13367
|
__reExport(sensors_exports, __toESM(require_header_tlv_limit_sensor()));
|
|
13283
13368
|
__reExport(sensors_exports, __toESM(require_intent_allowlist_sensor()));
|
|
13284
13369
|
__reExport(sensors_exports, __toESM(require_intent_registry_sensor()));
|
|
13370
|
+
__reExport(sensors_exports, __toESM(require_law_article_presence_sensor()));
|
|
13285
13371
|
__reExport(sensors_exports, __toESM(require_law_evaluation_sensor()));
|
|
13286
13372
|
__reExport(sensors_exports, __toESM(require_proof_presence_sensor()));
|
|
13287
13373
|
__reExport(sensors_exports, __toESM(require_protocol_strict_sensor()));
|