@irogane/kaji 0.3.0 → 0.3.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 +5 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,10 +26,9 @@ your process — no server, database, or control plane.
|
|
|
26
26
|
|
|
27
27
|
## Install
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
is published.
|
|
29
|
+
```bash
|
|
30
|
+
npm install @irogane/kaji
|
|
31
|
+
```
|
|
33
32
|
|
|
34
33
|
## Minimal example
|
|
35
34
|
|
|
@@ -118,7 +117,7 @@ after `execute()` has started all settle `unknown`, never `failed`.
|
|
|
118
117
|
Kaji never infers a known failure from an error's class, message, or
|
|
119
118
|
status code; only application code that can prove no side effect
|
|
120
119
|
committed may throw `knownFailure()`. See the
|
|
121
|
-
[execution outcomes guide](https://kaji.build/docs/concepts/
|
|
120
|
+
[execution outcomes guide](https://kaji.build/docs/concepts/executor)
|
|
122
121
|
for the full model.
|
|
123
122
|
|
|
124
123
|
## memoryStore()
|
|
@@ -136,7 +135,7 @@ const kaji = createKaji({ store: memoryStore() });
|
|
|
136
135
|
development, tests, and examples — it is not durable and does not
|
|
137
136
|
coordinate across processes or instances. A production deployment needs
|
|
138
137
|
an `ExecutionStore` backed by durable, atomic storage; see
|
|
139
|
-
[
|
|
138
|
+
[architecture](https://kaji.build/docs/architecture).
|
|
140
139
|
|
|
141
140
|
## What Kaji is not
|
|
142
141
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/execution
|
|
1
|
+
//#region src/execution/context.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* The information a capability's `execute` function needs to run safely.
|
|
4
4
|
*
|
|
@@ -69,7 +69,7 @@ type Capability<Input, Result> = {
|
|
|
69
69
|
*/
|
|
70
70
|
declare function capability<Input, Result>(definition: CapabilityDefinition<Input, Result>): Capability<Input, Result>;
|
|
71
71
|
//#endregion
|
|
72
|
-
//#region src/approval.d.ts
|
|
72
|
+
//#region src/execution/approval.d.ts
|
|
73
73
|
/**
|
|
74
74
|
* What Kaji tells an application's `approve` handler about one request
|
|
75
75
|
* requiring approval, per docs/api.md's inline `createKaji()` contract.
|
|
@@ -89,7 +89,7 @@ type ApprovalDecision = {
|
|
|
89
89
|
};
|
|
90
90
|
type ApproveHandler = (request: ApprovalRequest) => ApprovalDecision | Promise<ApprovalDecision>;
|
|
91
91
|
//#endregion
|
|
92
|
-
//#region src/execution
|
|
92
|
+
//#region src/execution/request.d.ts
|
|
93
93
|
/**
|
|
94
94
|
* One caller's request to run a capability, as frozen by docs/api.md.
|
|
95
95
|
* `principalId` and `idempotencyKey` are supplied by the caller — Kaji
|
|
@@ -103,7 +103,7 @@ type ExecutionRequest = {
|
|
|
103
103
|
readonly signal?: AbortSignal;
|
|
104
104
|
};
|
|
105
105
|
//#endregion
|
|
106
|
-
//#region src/execution
|
|
106
|
+
//#region src/execution/result.d.ts
|
|
107
107
|
/**
|
|
108
108
|
* The minimal facts Kaji knows about one governed execution.
|
|
109
109
|
*
|
|
@@ -139,7 +139,7 @@ type ExecutionResult<Result> = {
|
|
|
139
139
|
readonly evidence: ExecutionEvidence;
|
|
140
140
|
};
|
|
141
141
|
//#endregion
|
|
142
|
-
//#region src/
|
|
142
|
+
//#region src/store/store.d.ts
|
|
143
143
|
/**
|
|
144
144
|
* The material identity of one intended operation: which capability, which
|
|
145
145
|
* principal, which caller-supplied idempotency key, and a fingerprint of
|
|
@@ -241,7 +241,7 @@ declare class KnownFailure extends Error {
|
|
|
241
241
|
*/
|
|
242
242
|
declare function knownFailure(cause: unknown): KnownFailure;
|
|
243
243
|
//#endregion
|
|
244
|
-
//#region src/memory
|
|
244
|
+
//#region src/store/memory.d.ts
|
|
245
245
|
/**
|
|
246
246
|
* A process-local reference `ExecutionStore`. It has no external
|
|
247
247
|
* persistence, no cross-process visibility, and no durability guarantee —
|
package/dist/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ function capabilityDefinition(capability$1) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
//#endregion
|
|
32
|
-
//#region src/approval.ts
|
|
32
|
+
//#region src/execution/approval.ts
|
|
33
33
|
/**
|
|
34
34
|
* Resolves whether a request that requires approval may proceed.
|
|
35
35
|
*
|
|
@@ -67,7 +67,7 @@ async function resolveApproval(approve, request) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
//#endregion
|
|
70
|
-
//#region src/
|
|
70
|
+
//#region src/execution/signal.ts
|
|
71
71
|
/**
|
|
72
72
|
* Combines the caller's signal (if any) with Kaji's optional `timeoutMs`
|
|
73
73
|
* into one effective `AbortSignal`, using only native `AbortSignal`/
|
|
@@ -89,7 +89,7 @@ function effectiveSignal(callerSignal, timeoutMs) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
|
-
//#region src/fingerprint.ts
|
|
92
|
+
//#region src/store/fingerprint.ts
|
|
93
93
|
/**
|
|
94
94
|
* Thrown when a value falls outside the durable value domain — plain
|
|
95
95
|
* JSON-shaped data — and cannot be fingerprinted deterministically.
|
|
@@ -194,7 +194,7 @@ function validateInput(parser, input) {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
//#endregion
|
|
197
|
-
//#region src/execute.ts
|
|
197
|
+
//#region src/execution/execute.ts
|
|
198
198
|
/**
|
|
199
199
|
* Runs the one canonical Kaji execution path for one request, in the exact
|
|
200
200
|
* order docs/api.md freezes: validate, claim idempotency, authorize,
|
|
@@ -382,7 +382,7 @@ function createKaji(options) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
|
-
//#region src/memory
|
|
385
|
+
//#region src/store/memory.ts
|
|
386
386
|
/**
|
|
387
387
|
* A process-local reference `ExecutionStore`. It has no external
|
|
388
388
|
* persistence, no cross-process visibility, and no durability guarantee —
|