@nextera.one/axis-server-sdk 2.3.14 → 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,
@@ -2659,6 +2680,15 @@ var init_intent_router = __esm({
2659
2680
  const resolved = this.resolveIntentAlias(intent);
2660
2681
  return this.handlers.has(resolved) || isBuiltinIntent(resolved);
2661
2682
  }
2683
+ /**
2684
+ * True only when the application registered a concrete handler.
2685
+ * Unlike `has()`, this intentionally ignores SDK built-in fallbacks so
2686
+ * discovery layers can override simple built-ins such as `system.ping`.
2687
+ */
2688
+ hasRegisteredHandler(intent) {
2689
+ const resolved = this.resolveIntentAlias(intent);
2690
+ return this.handlers.has(resolved);
2691
+ }
2662
2692
  getRegisteredIntents() {
2663
2693
  return [...BUILTIN_INTENTS, ...this.handlers.keys()];
2664
2694
  }
@@ -3058,9 +3088,11 @@ var init_intent_router = __esm({
3058
3088
  if (contract) {
3059
3089
  this.intentContracts.set(intent, contract);
3060
3090
  }
3091
+ const inlineRequiredProof = normalizeRequiredProof(meta?.requiredProof);
3061
3092
  const proofPolicy = resolveIntentProofPolicy(proto, methodName);
3062
- if (proofPolicy.requiredProof.length > 0) {
3063
- this.intentRequiredProof.set(intent, proofPolicy.requiredProof);
3093
+ const requiredProof = inlineRequiredProof ?? proofPolicy.requiredProof;
3094
+ if (requiredProof.length > 0) {
3095
+ this.intentRequiredProof.set(intent, requiredProof);
3064
3096
  }
3065
3097
  const rateLimit = Reflect.getMetadata(
3066
3098
  AXIS_RATE_LIMIT_KEY,