@nextera.one/axis-server-sdk 2.0.0 → 2.1.1
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/README.md +52 -7
- package/dist/index.d.mts +445 -121
- package/dist/index.d.ts +445 -121
- package/dist/index.js +1734 -319
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1811 -392
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Root exports are split into two groups:
|
|
|
44
44
|
You can also import the grouped namespaces directly from the package root:
|
|
45
45
|
|
|
46
46
|
```ts
|
|
47
|
-
import { core, crypto, engine, sensors } from
|
|
47
|
+
import { core, crypto, engine, sensors } from "@nextera.one/axis-server-sdk";
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
## Shared Core API
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
getSignTarget,
|
|
63
63
|
signFrame,
|
|
64
64
|
verifyFrameSignature,
|
|
65
|
-
} from
|
|
65
|
+
} from "@nextera.one/axis-server-sdk/core";
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
Notes:
|
|
@@ -81,10 +81,10 @@ import {
|
|
|
81
81
|
Intent,
|
|
82
82
|
IntentRouter,
|
|
83
83
|
AxisEffect,
|
|
84
|
-
} from
|
|
85
|
-
import type { AxisBinaryFrame } from
|
|
84
|
+
} from "@nextera.one/axis-server-sdk";
|
|
85
|
+
import type { AxisBinaryFrame } from "@nextera.one/axis-server-sdk/core";
|
|
86
86
|
|
|
87
|
-
@Handler(
|
|
87
|
+
@Handler("system")
|
|
88
88
|
export class SystemHandler {
|
|
89
89
|
constructor(private readonly router: IntentRouter) {}
|
|
90
90
|
|
|
@@ -92,17 +92,62 @@ export class SystemHandler {
|
|
|
92
92
|
this.router.registerHandler(this);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
@Intent(
|
|
95
|
+
@Intent("ping", { frame: true })
|
|
96
96
|
async ping(frame: AxisBinaryFrame): Promise<AxisEffect> {
|
|
97
97
|
return {
|
|
98
98
|
ok: true,
|
|
99
|
-
effect:
|
|
99
|
+
effect: "PONG",
|
|
100
100
|
body: frame.body,
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## Intent Chains And Observers
|
|
107
|
+
|
|
108
|
+
The server SDK now supports first-class chain metadata and decorator-driven observer discovery.
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import {
|
|
112
|
+
AxisChainExecutor,
|
|
113
|
+
Chain,
|
|
114
|
+
Handler,
|
|
115
|
+
Intent,
|
|
116
|
+
Observer,
|
|
117
|
+
type AxisIntentObserver,
|
|
118
|
+
type AxisObserverContext,
|
|
119
|
+
} from "@nextera.one/axis-server-sdk";
|
|
120
|
+
|
|
121
|
+
@Observer({
|
|
122
|
+
name: "openlogs",
|
|
123
|
+
events: ["chain.completed", "step.failed"],
|
|
124
|
+
})
|
|
125
|
+
export class OpenLogsObserver implements AxisIntentObserver {
|
|
126
|
+
readonly name = "openlogs";
|
|
127
|
+
|
|
128
|
+
observe(context: AxisObserverContext) {
|
|
129
|
+
console.log(context.event, context.chainId, context.stepId);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@Handler("invoice")
|
|
134
|
+
@Observer(OpenLogsObserver)
|
|
135
|
+
export class InvoiceHandler {
|
|
136
|
+
@Intent("create")
|
|
137
|
+
@Chain({ mode: "strict", proofRequired: true })
|
|
138
|
+
async create(body: Uint8Array) {
|
|
139
|
+
return Buffer.from(body);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Runtime helpers:
|
|
145
|
+
|
|
146
|
+
- `ObserverDiscoveryService` registers all `@Observer({...})` providers at bootstrap.
|
|
147
|
+
- `IntentRouter.getObservers(intent)` returns the observer bindings discovered for an intent.
|
|
148
|
+
- `IntentRouter.getChainConfig(intent)` returns the normalized chain metadata for an intent.
|
|
149
|
+
- `AxisChainExecutor.execute(chainEnvelope)` runs dependency-aware chains in `strict`, `best_effort`, `parallel`, or `atomic` mode.
|
|
150
|
+
|
|
106
151
|
## Versioning
|
|
107
152
|
|
|
108
153
|
The server SDK may include additional server-only exports beyond the shared `./core` surface. For code intended to work across both client and server SDKs, prefer importing protocol primitives from `./core`.
|