@executablemd/durable-streams 0.11.0 → 0.12.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/esm/guard.js +2 -2
- package/esm/position.js +2 -2
- package/esm/replay-guard.js +1 -1
- package/esm/retained.js +4 -4
- package/package.json +1 -1
- package/types/guard.d.ts +2 -2
- package/types/position.d.ts +2 -2
- package/types/replay-guard.d.ts +1 -1
- package/types/retained.d.ts +3 -3
package/esm/guard.js
CHANGED
|
@@ -48,7 +48,7 @@ export function establishJournalProvenance(stream) {
|
|
|
48
48
|
/**
|
|
49
49
|
* Carry an exact source stream's provenance onto a trusted wrapper of it.
|
|
50
50
|
*
|
|
51
|
-
* Preservation is visible composition rather than new
|
|
51
|
+
* Preservation is visible composition rather than a new claim: it transfers
|
|
52
52
|
* only the witness already associated with that exact source, so an unproven
|
|
53
53
|
* source leaves the target unproven. The target is returned so the wrapping
|
|
54
54
|
* site reads as one expression.
|
|
@@ -57,7 +57,7 @@ export function preserveJournalProvenance(source, target) {
|
|
|
57
57
|
journalProvenances.preserve(source, target);
|
|
58
58
|
return target;
|
|
59
59
|
}
|
|
60
|
-
/** @internal The live durable path reads provenance without receiving stream
|
|
60
|
+
/** @internal The live durable path reads provenance without receiving the stream itself. */
|
|
61
61
|
export function getJournalProvenance(stream) {
|
|
62
62
|
return journalProvenances.get(stream);
|
|
63
63
|
}
|
package/esm/position.js
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
* — which is what makes the index a coroutine reaches at one point in its
|
|
22
22
|
* procedure the same index it reaches there next time.
|
|
23
23
|
*
|
|
24
|
-
* ## Observation, never
|
|
24
|
+
* ## Observation, never enforcement
|
|
25
25
|
*
|
|
26
26
|
* A position describes where execution is. It authorizes nothing, proves
|
|
27
27
|
* nothing about who is executing, and is not durable state: it is derived by
|
|
28
28
|
* counting what the journal already holds. Anything that must be trusted is
|
|
29
|
-
* checked by whoever owns the
|
|
29
|
+
* checked by whoever owns the decision to check it.
|
|
30
30
|
*/
|
|
31
31
|
import { DurableContext } from "./context.js";
|
|
32
32
|
/**
|
package/esm/replay-guard.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* (e.g., content hash, status code). There is no separate metadata field —
|
|
13
13
|
* inputs belong in the effect description, outputs belong in the result.
|
|
14
14
|
*
|
|
15
|
-
* A guard is **composable policy, not
|
|
15
|
+
* A guard is **composable policy, not enforcement**. Guards compose through
|
|
16
16
|
* `Api.around`, and a handler installed further out may decline to call `next`.
|
|
17
17
|
* That is what composition is for, and it is why an invariant that must not be
|
|
18
18
|
* negotiable — durable identity above all — belongs somewhere a caller cannot
|
package/esm/retained.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Retained events — what a run reads a journal as.
|
|
3
3
|
*
|
|
4
4
|
* A journal is data supplied by a backend, and every phase of a replay reads
|
|
5
|
-
* the same events: a private
|
|
5
|
+
* the same events: a private admission gate, the replay index, public guard
|
|
6
6
|
* policy, and the replay path itself. If those are separate reads of the
|
|
7
7
|
* backend's own objects, a source that answers differently between them decides
|
|
8
8
|
* one thing for validation and another for execution, and nothing downstream
|
|
@@ -135,7 +135,7 @@ function detachResult(result) {
|
|
|
135
135
|
if (status === "ok") {
|
|
136
136
|
// Every successful shape, including the one that settled to nothing. A
|
|
137
137
|
// `Result<void>` carries no value to detach, but the envelope is still
|
|
138
|
-
//
|
|
138
|
+
// the retained settlement — left writable, a caller of a public observation could add one
|
|
139
139
|
// before replay reads it.
|
|
140
140
|
if (!("value" in result)) {
|
|
141
141
|
return Object.freeze({ status });
|
|
@@ -339,7 +339,7 @@ function isRetained(event) {
|
|
|
339
339
|
* history the execution already validated: the authoritative graph is what
|
|
340
340
|
* admission accepted and what replay consumes, and a guard that could rewrite a
|
|
341
341
|
* root selection or an effect description after admission would hold exactly
|
|
342
|
-
* the
|
|
342
|
+
* the enforcement the private gate exists to keep out of public hands.
|
|
343
343
|
*
|
|
344
344
|
* So policy reads a copy. It is deep and mutable, so middleware may compose over
|
|
345
345
|
* it as freely as it likes, and nothing it does reaches replay.
|
|
@@ -375,7 +375,7 @@ function observeDescription(description) {
|
|
|
375
375
|
*
|
|
376
376
|
* The authoritative copy is frozen so policy cannot rewrite it. A document
|
|
377
377
|
* that resumes on a restored binding writes to it, so what a workflow receives
|
|
378
|
-
* is a fresh copy taken from that
|
|
378
|
+
* is a fresh copy taken from that retained history rather than the retained history itself.
|
|
379
379
|
*/
|
|
380
380
|
export function consumable(result) {
|
|
381
381
|
if (result.status === "ok") {
|
package/package.json
CHANGED
package/types/guard.d.ts
CHANGED
|
@@ -33,13 +33,13 @@ export declare function establishJournalProvenance(stream: DurableStream): Journ
|
|
|
33
33
|
/**
|
|
34
34
|
* Carry an exact source stream's provenance onto a trusted wrapper of it.
|
|
35
35
|
*
|
|
36
|
-
* Preservation is visible composition rather than new
|
|
36
|
+
* Preservation is visible composition rather than a new claim: it transfers
|
|
37
37
|
* only the witness already associated with that exact source, so an unproven
|
|
38
38
|
* source leaves the target unproven. The target is returned so the wrapping
|
|
39
39
|
* site reads as one expression.
|
|
40
40
|
*/
|
|
41
41
|
export declare function preserveJournalProvenance(source: DurableStream, target: DurableStream): DurableStream;
|
|
42
|
-
/** @internal The live durable path reads provenance without receiving stream
|
|
42
|
+
/** @internal The live durable path reads provenance without receiving the stream itself. */
|
|
43
43
|
export declare function getJournalProvenance(stream: DurableStream): JournalProvenance | undefined;
|
|
44
44
|
export interface DurableEventRejectionOccurrence {
|
|
45
45
|
rejected: boolean;
|
package/types/position.d.ts
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
* — which is what makes the index a coroutine reaches at one point in its
|
|
22
22
|
* procedure the same index it reaches there next time.
|
|
23
23
|
*
|
|
24
|
-
* ## Observation, never
|
|
24
|
+
* ## Observation, never enforcement
|
|
25
25
|
*
|
|
26
26
|
* A position describes where execution is. It authorizes nothing, proves
|
|
27
27
|
* nothing about who is executing, and is not durable state: it is derived by
|
|
28
28
|
* counting what the journal already holds. Anything that must be trusted is
|
|
29
|
-
* checked by whoever owns the
|
|
29
|
+
* checked by whoever owns the decision to check it.
|
|
30
30
|
*/
|
|
31
31
|
import { type Operation } from "effection";
|
|
32
32
|
import type { CoroutineId } from "./types.js";
|
package/types/replay-guard.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* (e.g., content hash, status code). There is no separate metadata field —
|
|
13
13
|
* inputs belong in the effect description, outputs belong in the result.
|
|
14
14
|
*
|
|
15
|
-
* A guard is **composable policy, not
|
|
15
|
+
* A guard is **composable policy, not enforcement**. Guards compose through
|
|
16
16
|
* `Api.around`, and a handler installed further out may decline to call `next`.
|
|
17
17
|
* That is what composition is for, and it is why an invariant that must not be
|
|
18
18
|
* negotiable — durable identity above all — belongs somewhere a caller cannot
|
package/types/retained.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Retained events — what a run reads a journal as.
|
|
3
3
|
*
|
|
4
4
|
* A journal is data supplied by a backend, and every phase of a replay reads
|
|
5
|
-
* the same events: a private
|
|
5
|
+
* the same events: a private admission gate, the replay index, public guard
|
|
6
6
|
* policy, and the replay path itself. If those are separate reads of the
|
|
7
7
|
* backend's own objects, a source that answers differently between them decides
|
|
8
8
|
* one thing for validation and another for execution, and nothing downstream
|
|
@@ -67,7 +67,7 @@ export declare function retainEvents(events: readonly DurableEvent[]): DurableEv
|
|
|
67
67
|
* history the execution already validated: the authoritative graph is what
|
|
68
68
|
* admission accepted and what replay consumes, and a guard that could rewrite a
|
|
69
69
|
* root selection or an effect description after admission would hold exactly
|
|
70
|
-
* the
|
|
70
|
+
* the enforcement the private gate exists to keep out of public hands.
|
|
71
71
|
*
|
|
72
72
|
* So policy reads a copy. It is deep and mutable, so middleware may compose over
|
|
73
73
|
* it as freely as it likes, and nothing it does reaches replay.
|
|
@@ -78,6 +78,6 @@ export declare function observeEvent(event: DurableEvent): DurableEvent;
|
|
|
78
78
|
*
|
|
79
79
|
* The authoritative copy is frozen so policy cannot rewrite it. A document
|
|
80
80
|
* that resumes on a restored binding writes to it, so what a workflow receives
|
|
81
|
-
* is a fresh copy taken from that
|
|
81
|
+
* is a fresh copy taken from that retained history rather than the retained history itself.
|
|
82
82
|
*/
|
|
83
83
|
export declare function consumable(result: Result): Result;
|