@ultimat3/action 31.20.0 → 31.22.0
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/CLAUDE.md +1 -1
- package/README.md +2 -0
- package/package.json +9 -9
- package/src/errors.ts +6 -1
- package/src/loader.ts +3 -1
- package/src/registry.ts +12 -0
package/CLAUDE.md
CHANGED
|
@@ -49,7 +49,7 @@ Owns the `action` + `mutator` primitives and five projections. Tier 3. The MCP t
|
|
|
49
49
|
| `declared-errors-contract.ts` | `.contract()`'s source scan |
|
|
50
50
|
| `openapi-errors.ts` | core's builder bound to http's status and `problemTypeFor` |
|
|
51
51
|
| `idempotency.ts` | the store SEAM: types, the installed-store slot, the scope declaration + `assertIdempotencyScope`, and `withIdempotency` — the replay-or-run gate |
|
|
52
|
-
| `loader.ts` | `@ultimat3/action/loader`: `registerAction`/`registerActions` for `x`'s loader and framework fixtures
|
|
52
|
+
| `loader.ts` | `@ultimat3/action/loader`: `registerAction`/`registerActions` for `x`'s loader and framework fixtures; test-only `restoreActions`. Never the barrel — `defineApi` is an app's one path (`loader.test.ts`) |
|
|
53
53
|
| `adapter.ts` | `@ultimat3/action/adapter`: both stores' installers (each returns a release removing that install alone) + resets, port types, store errors, and `overrideHandler`. Never the barrel |
|
|
54
54
|
| `handler-override.ts` | the slot `overrideHandler` writes: a test double where `handle` is, keyed by the stored declaration and read per call by `invoke` (`run`) and, for a stream, by the drain (`action-stream.ts`) — so policy, parse, meter, idempotency and output parse still run on every surface. `@ultimat3/testing`'s `stub()` is its one caller (`handler-override.test.ts`) |
|
|
55
55
|
| `idempotency-key.ts` | the namespaced key — action + actor + the caller's key, as one JSON tuple — and the refusal of one that names no request |
|
package/README.md
CHANGED
|
@@ -107,6 +107,8 @@ names deriving one route collide with `X_ACTION_PATH_DUPLICATE` — `pluralize`
|
|
|
107
107
|
go through core's `primitiveRegistrar(kind)`, because this package may not import `@ultimat3/query`
|
|
108
108
|
or `@ultimat3/jobs` sideways. It is not on the `.` barrel: `defineApi` is the one path an app has,
|
|
109
109
|
and `x`'s module loader imports `registerAction`/`registerActions` from `@ultimat3/action/loader`.
|
|
110
|
+
Beside them, test-only: `restoreActions(listActions())` makes the registry exactly what was read,
|
|
111
|
+
each action back through `registerAction`'s checks — the rerun seam's writer.
|
|
110
112
|
|
|
111
113
|
## Call it — `rpc`
|
|
112
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/action",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.22.0",
|
|
4
4
|
"description": "The action primitive: one declaration projected to route, OpenAPI, client, MCP tool, job handle, tests",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"test": "bun test"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@ultimat3/cache": "31.
|
|
52
|
-
"@ultimat3/core": "31.
|
|
53
|
-
"@ultimat3/db": "31.
|
|
54
|
-
"@ultimat3/entity": "31.
|
|
55
|
-
"@ultimat3/http": "31.
|
|
56
|
-
"@ultimat3/policy": "31.
|
|
57
|
-
"@ultimat3/schema": "31.
|
|
58
|
-
"@ultimat3/storage": "31.
|
|
51
|
+
"@ultimat3/cache": "31.22.0",
|
|
52
|
+
"@ultimat3/core": "31.22.0",
|
|
53
|
+
"@ultimat3/db": "31.22.0",
|
|
54
|
+
"@ultimat3/entity": "31.22.0",
|
|
55
|
+
"@ultimat3/http": "31.22.0",
|
|
56
|
+
"@ultimat3/policy": "31.22.0",
|
|
57
|
+
"@ultimat3/schema": "31.22.0",
|
|
58
|
+
"@ultimat3/storage": "31.22.0"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/errors.ts
CHANGED
|
@@ -170,7 +170,12 @@ export class InputInvalidError extends UltimateError {
|
|
|
170
170
|
super({
|
|
171
171
|
code: 'X_INPUT_INVALID',
|
|
172
172
|
cause: `input for ${subject} "${name}" failed validation: ${detail}`,
|
|
173
|
-
|
|
173
|
+
// A tool's schema is the one `tools/list` publishes — `x actions show` knows actions alone,
|
|
174
|
+
// so it answered a dev tool's refused arguments (`schema.describe {entity}`) with nothing.
|
|
175
|
+
fix:
|
|
176
|
+
subject === 'tool'
|
|
177
|
+
? `{"jsonrpc":"2.0","id":1,"method":"tools/list"} # the inputSchema of ${renderFixShellArg(name, '<tool-name>')} names every field: correct the ones in cause, then call it again`
|
|
178
|
+
: `x actions show ${renderFixShellArg(name, '<action-name>')} --json # prints the expected input schema`,
|
|
174
179
|
// A remote caller holds the published schema — the MCP `inputSchema`, the OpenAPI request
|
|
175
180
|
// body — and cannot run `x actions show`.
|
|
176
181
|
callerFix:
|
package/src/loader.ts
CHANGED
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
// framework's own fixtures. Never the `.` barrel: an app hands its modules to `defineApi`, the one
|
|
3
3
|
// registration path (axiom 1), and that reaches these through the same registry.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// `restoreActions` is test-only, and here for the reason the other two are: it writes the registry.
|
|
6
|
+
// `@ultimat3/testing`'s rerun seam hands back what `listActions()` read, through `registerAction`.
|
|
7
|
+
export { registerAction, registerActions, restoreActions } from './registry';
|
package/src/registry.ts
CHANGED
|
@@ -182,6 +182,18 @@ export function resetActions(): void {
|
|
|
182
182
|
clearToolGates();
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Test-only: the registry becomes exactly `actions`, each under the name it carries — what
|
|
187
|
+
* `listActions()` read earlier. Unlike `resetActions` it keeps the path style, the API declaration
|
|
188
|
+
* and the tool gates, and every action goes back in through `registerAction`, so no boot check is
|
|
189
|
+
* skipped. `@ultimat3/testing`'s rerun seam forgets one test file's names with it.
|
|
190
|
+
*/
|
|
191
|
+
export function restoreActions(actions: readonly AnyAction[]): void {
|
|
192
|
+
registry.clear();
|
|
193
|
+
paths.clear();
|
|
194
|
+
for (const target of actions) registerAction(target.name, target);
|
|
195
|
+
}
|
|
196
|
+
|
|
185
197
|
function byName(a: readonly [string, AnyAction], b: readonly [string, AnyAction]): number {
|
|
186
198
|
return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
187
199
|
}
|