@nextera.one/axis-server-sdk 2.3.15 → 2.3.16

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.mjs CHANGED
@@ -129,6 +129,13 @@ 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,
@@ -377,7 +384,12 @@ function toIntentSensorBinding(input) {
377
384
  }
378
385
  function Intent(action, options) {
379
386
  return (target, propertyKey) => {
380
- const metadata = { intent: action, ...options };
387
+ const requiredProof = normalizeRequiredProof(options?.requiredProof);
388
+ const metadata = {
389
+ intent: action,
390
+ ...options,
391
+ ...requiredProof ? { requiredProof } : {}
392
+ };
381
393
  Reflect.defineMetadata(INTENT_METADATA_KEY, metadata, target, propertyKey);
382
394
  if (options?.decoder) {
383
395
  Reflect.defineMetadata(
@@ -395,6 +407,14 @@ function Intent(action, options) {
395
407
  propertyKey
396
408
  );
397
409
  }
410
+ if (requiredProof) {
411
+ Reflect.defineMetadata(
412
+ REQUIRED_PROOF_METADATA_KEY,
413
+ requiredProof,
414
+ target,
415
+ propertyKey
416
+ );
417
+ }
398
418
  const routes = Reflect.getMetadata(INTENT_ROUTES_KEY, target.constructor) || [];
399
419
  routes.push({
400
420
  action,
@@ -403,6 +423,7 @@ function Intent(action, options) {
403
423
  frame: options?.frame,
404
424
  kind: options?.kind,
405
425
  sensitivity: options?.sensitivity,
426
+ requiredProof,
406
427
  chain: options?.chain,
407
428
  bodyProfile: options?.bodyProfile,
408
429
  tlv: options?.tlv,
@@ -3067,9 +3088,11 @@ var init_intent_router = __esm({
3067
3088
  if (contract) {
3068
3089
  this.intentContracts.set(intent, contract);
3069
3090
  }
3091
+ const inlineRequiredProof = normalizeRequiredProof(meta?.requiredProof);
3070
3092
  const proofPolicy = resolveIntentProofPolicy(proto, methodName);
3071
- if (proofPolicy.requiredProof.length > 0) {
3072
- this.intentRequiredProof.set(intent, proofPolicy.requiredProof);
3093
+ const requiredProof = inlineRequiredProof ?? proofPolicy.requiredProof;
3094
+ if (requiredProof.length > 0) {
3095
+ this.intentRequiredProof.set(intent, requiredProof);
3073
3096
  }
3074
3097
  const rateLimit = Reflect.getMetadata(
3075
3098
  AXIS_RATE_LIMIT_KEY,