@ultimat3/action 31.55.0 → 31.57.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/README.md +2 -2
- package/package.json +9 -9
- package/src/action-decide-def.ts +11 -1
- package/src/action-decide-pins.ts +12 -2
- package/src/action.ts +1 -0
- package/src/invoke.ts +1 -1
package/README.md
CHANGED
|
@@ -386,8 +386,8 @@ no `.def`. A second authz path cannot be written without deleting that store.
|
|
|
386
386
|
| parse output | `X_OUTPUT_INVALID` — and fields the schema never declared are dropped |
|
|
387
387
|
|
|
388
388
|
**Who before what (`As of 2026-09`).** The actor half is the part of the policy that reads no
|
|
389
|
-
input: `can(p)` with no predicate, `
|
|
390
|
-
an actor without `p`. It is decided before the parse — `decideBeforeInput` in `@ultimat3/policy`,
|
|
389
|
+
input: `can(p)` with no predicate, `canActor(p, pred)` (a predicate typed to read only the actor),
|
|
390
|
+
`allow()`, `deny()`, their combinators, and `can(p, pred)` for an actor without `p`. It is decided before the parse — `decideBeforeInput` in `@ultimat3/policy`,
|
|
391
391
|
exact rather than a heuristic — so `can('refund:issue')` answers a customer's `{}` with 403, and a
|
|
392
392
|
staff caller's `{}` with the 400 naming each missing field. A predicate over `input` or `row` still
|
|
393
393
|
runs after the parse, on the parsed value. Same on HTTP, MCP (including the `invalid-args`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/action",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.57.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.57.0",
|
|
52
|
+
"@ultimat3/core": "31.57.0",
|
|
53
|
+
"@ultimat3/db": "31.57.0",
|
|
54
|
+
"@ultimat3/entity": "31.57.0",
|
|
55
|
+
"@ultimat3/http": "31.57.0",
|
|
56
|
+
"@ultimat3/policy": "31.57.0",
|
|
57
|
+
"@ultimat3/schema": "31.57.0",
|
|
58
|
+
"@ultimat3/storage": "31.57.0"
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/action-decide-def.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// The declaration `action()` types a handler by: `ActionDef` whose `handle` is handed
|
|
2
|
-
// `decide(rows)`. A pair beside `ActionDef`, never an edit of it: `ActionDef.handle` is also what
|
|
2
|
+
// `decide(rows)` and the caller's `idempotencyKey`. A pair beside `ActionDef`, never an edit of it: `ActionDef.handle` is also what
|
|
3
3
|
// app code CALLS on a declaration it holds, and a required `decide` there refuses a call written
|
|
4
4
|
// before it existed. `action()` reads these first; `ActionDef` stays assignable to them.
|
|
5
5
|
|
|
@@ -18,6 +18,16 @@ export interface ActionDecideArgs<TInput extends StandardSchemaV1, TRow = unknow
|
|
|
18
18
|
* assignable to the erased declaration every projection reads.
|
|
19
19
|
*/
|
|
20
20
|
decide(rows: readonly TRow[]): ActionDecision<TRow>;
|
|
21
|
+
/**
|
|
22
|
+
* The `Idempotency-Key` the caller sent, as sent — never the namespaced store key. `null` when
|
|
23
|
+
* none was sent or the action is not `idempotent: true`. A handler whose answer must not rest
|
|
24
|
+
* under a key (a dry run a later real call would replay) refuses on it. Here, not on `Ctx`:
|
|
25
|
+
* `Ctx` is core's, shared by every primitive, and only an action call carries the key.
|
|
26
|
+
* Optional in the TYPE only, so code that builds these arguments by hand (a test calling
|
|
27
|
+
* `def.handle({ input, ctx, decide })`) still compiles on a minor; every call hands it in, so
|
|
28
|
+
* read it as `idempotencyKey != null`.
|
|
29
|
+
*/
|
|
30
|
+
readonly idempotencyKey?: string | null;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
/** What `action({ … })` takes: `ActionDef`, its `handle` handed `decide`. */
|
|
@@ -53,6 +53,16 @@ export type _StreamDefIsADecidingDef = Assert<
|
|
|
53
53
|
type Decide = Parameters<DecidingActionDef<In, Out, Post>['handle']>[0]['decide'];
|
|
54
54
|
export type _DecideTakesRowsAlone = Assert<Identical<Parameters<Decide>, [rows: readonly Post[]]>>;
|
|
55
55
|
export type _DecideAnswersTheRows = Assert<Identical<ReturnType<Decide>, ActionDecision<Post>>>;
|
|
56
|
-
export type
|
|
57
|
-
Identical<
|
|
56
|
+
export type _DecideArgsAreTheRecordedOnesPlusDecideAndKey = Assert<
|
|
57
|
+
Identical<
|
|
58
|
+
Exclude<keyof ActionDecideArgs<In, Post>, keyof RecordedArgs>,
|
|
59
|
+
'decide' | 'idempotencyKey'
|
|
60
|
+
>
|
|
61
|
+
>;
|
|
62
|
+
/**
|
|
63
|
+
* The caller's key as sent, or `null`. Optional in the type, so a hand-built argument object from
|
|
64
|
+
* before it existed still compiles: added on a minor, the stable line's promise (wiki/Stability).
|
|
65
|
+
*/
|
|
66
|
+
export type _HandlerKeyIsStringOrNull = Assert<
|
|
67
|
+
Identical<ActionDecideArgs<In, Post>['idempotencyKey'], string | null | undefined>
|
|
58
68
|
>;
|
package/src/action.ts
CHANGED
package/src/invoke.ts
CHANGED
|
@@ -384,7 +384,7 @@ async function perform(
|
|
|
384
384
|
const override = drainsItsHandler(def) ? undefined : handlerOverrideOf(def);
|
|
385
385
|
const handle = override ?? def.handle.bind(def);
|
|
386
386
|
const produced = await judgedHandler(def, name, () =>
|
|
387
|
-
handle({ input, ctx: useContext(), decide }),
|
|
387
|
+
handle({ input, ctx: useContext(), decide, idempotencyKey: key }),
|
|
388
388
|
);
|
|
389
389
|
return validateOutput(def.output, produced, name);
|
|
390
390
|
};
|