@ultimat3/action 22.6.2 → 22.7.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/package.json +7 -7
- package/src/http-path.ts +10 -0
- package/src/http.ts +7 -1
- package/src/index.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/action",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.7.0",
|
|
4
4
|
"description": "The action primitive: one declaration projected to route, OpenAPI, client, MCP tool, job handle, tests",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"test": "bun test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@ultimat3/cache": "22.
|
|
38
|
-
"@ultimat3/core": "22.
|
|
39
|
-
"@ultimat3/entity": "22.
|
|
40
|
-
"@ultimat3/http": "22.
|
|
41
|
-
"@ultimat3/policy": "22.
|
|
42
|
-
"@ultimat3/schema": "22.
|
|
37
|
+
"@ultimat3/cache": "22.7.0",
|
|
38
|
+
"@ultimat3/core": "22.7.0",
|
|
39
|
+
"@ultimat3/entity": "22.7.0",
|
|
40
|
+
"@ultimat3/http": "22.7.0",
|
|
41
|
+
"@ultimat3/policy": "22.7.0",
|
|
42
|
+
"@ultimat3/schema": "22.7.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/http-path.ts
CHANGED
|
@@ -70,6 +70,16 @@ export function setActionPathStyle(next: unknown): ActionPathStyle {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/** Test seam, beside `resetRegistry`. */
|
|
73
|
+
/**
|
|
74
|
+
* Forget which paths were handed out, keeping the style. `@ultimat3/testing` calls it between two
|
|
75
|
+
* test files of one worker (22.7, no `--isolate`): a path an earlier FILE derived is not one this
|
|
76
|
+
* file's boot handed out, and the app's `defineApi({ pathStyle })` — evaluated once per worker, by
|
|
77
|
+
* whichever file first imports it — must not be refused over it.
|
|
78
|
+
*/
|
|
79
|
+
export function forgetHandedOutActionPaths(): void {
|
|
80
|
+
handedOut.clear();
|
|
81
|
+
}
|
|
82
|
+
|
|
73
83
|
export function resetActionPathStyle(): void {
|
|
74
84
|
style = 'resource';
|
|
75
85
|
handedOut.clear();
|
package/src/http.ts
CHANGED
|
@@ -56,7 +56,13 @@ async function writeOriginOf(req: UltimateRequest): Promise<string | undefined>
|
|
|
56
56
|
* kebab-cased (`updateUserProfile` -> `/api/user-profiles/update`). See `naming.ts`.
|
|
57
57
|
*/
|
|
58
58
|
export function toRoute(target: AnyAction): Route {
|
|
59
|
-
|
|
59
|
+
// The handle's OWN pin first: an action projected before (or without) being seated under its
|
|
60
|
+
// name still has the path it declared. Reading only the seated registry answered the style's
|
|
61
|
+
// derived path for an unseated pinned action — right by coincidence under `resource`, wrong
|
|
62
|
+
// under `readable` (a shared test worker whose app declared it, 22.7).
|
|
63
|
+
const pinned = defOf(target).http?.path;
|
|
64
|
+
const path = pinned ?? servedActionRoute(actionName(target)).path;
|
|
65
|
+
return projectRoute(target, path, (req) => req.bodyRaw());
|
|
60
66
|
}
|
|
61
67
|
|
|
62
68
|
/**
|
package/src/index.ts
CHANGED
|
@@ -152,7 +152,7 @@ export {
|
|
|
152
152
|
} from './http';
|
|
153
153
|
/** `http: { path }` on an action pins its URL; the app's `pathStyle` derives every other one. */
|
|
154
154
|
export type { ActionHttp } from './http-path';
|
|
155
|
-
export { actionPathStyle } from './http-path';
|
|
155
|
+
export { actionPathStyle, forgetHandedOutActionPaths } from './http-path';
|
|
156
156
|
/**
|
|
157
157
|
* The idempotency seam. `withIdempotency` and `IDEMPOTENCY_HEADER` are both public, so a plain
|
|
158
158
|
* mutating `route` can reserve-and-replay exactly as an action does — `idempotencyKeyFor` is the
|