@kairos-es/core 1.0.0-alpha.4 → 1.0.0-alpha.6
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 +3 -3
- package/dist/cjs/AppendCondition.js +1 -3
- package/dist/cjs/AppendCondition.js.map +1 -1
- package/dist/cjs/AppendIsOwned.js +6 -6
- package/dist/cjs/AppendIsOwned.js.map +1 -1
- package/dist/cjs/ContractStore.js +2 -2
- package/dist/cjs/ContractStore.js.map +1 -1
- package/dist/cjs/DcbEventStore.js +1 -1
- package/dist/cjs/DcbEventStore.js.map +1 -1
- package/dist/cjs/Event.js +29 -13
- package/dist/cjs/Event.js.map +1 -1
- package/dist/cjs/Query.js +1 -1
- package/dist/cjs/Query.js.map +1 -1
- package/dist/cjs/SubscribeMachine.js +158 -67
- package/dist/cjs/SubscribeMachine.js.map +1 -1
- package/dist/cjs/inMemory.js +4 -4
- package/dist/cjs/inMemory.js.map +1 -1
- package/dist/cjs/retryOnConflict.js +4 -10
- package/dist/cjs/retryOnConflict.js.map +1 -1
- package/dist/cjs/testing.js +2 -2
- package/dist/cjs/testing.js.map +1 -1
- package/dist/{dts → dts-cjs}/AppendCondition.d.ts +5 -7
- package/dist/{dts → dts-cjs}/AppendCondition.d.ts.map +1 -1
- package/dist/{dts → dts-cjs}/AppendIsOwned.d.ts +6 -6
- package/dist/{dts → dts-cjs}/AppendIsOwned.d.ts.map +1 -1
- package/dist/{dts → dts-cjs}/ContractStore.d.ts +3 -2
- package/dist/dts-cjs/ContractStore.d.ts.map +1 -0
- package/dist/{dts → dts-cjs}/DcbEventStore.d.ts +2 -2
- package/dist/{dts → dts-cjs}/DcbEventStore.d.ts.map +1 -1
- package/dist/{dts → dts-cjs}/Event.d.ts +31 -20
- package/dist/dts-cjs/Event.d.ts.map +1 -0
- package/dist/{dts → dts-cjs}/Query.d.ts +5 -5
- package/dist/dts-cjs/SubscribeMachine.d.ts +289 -0
- package/dist/dts-cjs/SubscribeMachine.d.ts.map +1 -0
- package/dist/{dts → dts-cjs}/inMemory.d.ts.map +1 -1
- package/dist/{dts → dts-cjs}/index.d.ts +1 -1
- package/dist/dts-cjs/package.json +3 -0
- package/dist/{dts → dts-cjs}/retryOnConflict.d.ts +1 -7
- package/dist/dts-cjs/retryOnConflict.d.ts.map +1 -0
- package/dist/{dts → dts-cjs}/testing.d.ts +1 -1
- package/dist/dts-esm/AppendCondition.d.ts +21 -0
- package/dist/dts-esm/AppendCondition.d.ts.map +1 -0
- package/dist/dts-esm/AppendIsOwned.d.ts +78 -0
- package/dist/dts-esm/AppendIsOwned.d.ts.map +1 -0
- package/dist/dts-esm/ContractStore.d.ts +62 -0
- package/dist/dts-esm/ContractStore.d.ts.map +1 -0
- package/dist/dts-esm/DcbEventStore.d.ts +64 -0
- package/dist/dts-esm/DcbEventStore.d.ts.map +1 -0
- package/dist/dts-esm/Event.d.ts +174 -0
- package/dist/dts-esm/Event.d.ts.map +1 -0
- package/dist/dts-esm/Projection.d.ts +124 -0
- package/dist/dts-esm/Projection.d.ts.map +1 -0
- package/dist/dts-esm/Query.d.ts +180 -0
- package/dist/dts-esm/Query.d.ts.map +1 -0
- package/dist/dts-esm/SubscribeMachine.d.ts +289 -0
- package/dist/dts-esm/SubscribeMachine.d.ts.map +1 -0
- package/dist/dts-esm/errors.d.ts +17 -0
- package/dist/dts-esm/errors.d.ts.map +1 -0
- package/dist/dts-esm/inMemory.d.ts +76 -0
- package/dist/dts-esm/inMemory.d.ts.map +1 -0
- package/dist/dts-esm/index.d.ts +40 -0
- package/dist/dts-esm/index.d.ts.map +1 -0
- package/dist/dts-esm/package.json +3 -0
- package/dist/dts-esm/retryOnConflict.d.ts +64 -0
- package/dist/dts-esm/retryOnConflict.d.ts.map +1 -0
- package/dist/dts-esm/testing.d.ts +39 -0
- package/dist/dts-esm/testing.d.ts.map +1 -0
- package/dist/esm/AppendCondition.js +1 -3
- package/dist/esm/AppendCondition.js.map +1 -1
- package/dist/esm/AppendIsOwned.js +6 -6
- package/dist/esm/AppendIsOwned.js.map +1 -1
- package/dist/esm/ContractStore.js +2 -2
- package/dist/esm/ContractStore.js.map +1 -1
- package/dist/esm/DcbEventStore.js +1 -1
- package/dist/esm/DcbEventStore.js.map +1 -1
- package/dist/esm/Event.js +30 -14
- package/dist/esm/Event.js.map +1 -1
- package/dist/esm/Query.js +1 -1
- package/dist/esm/Query.js.map +1 -1
- package/dist/esm/SubscribeMachine.js +157 -67
- package/dist/esm/SubscribeMachine.js.map +1 -1
- package/dist/esm/inMemory.js +5 -5
- package/dist/esm/inMemory.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/retryOnConflict.js +4 -10
- package/dist/esm/retryOnConflict.js.map +1 -1
- package/dist/esm/testing.js +2 -2
- package/dist/esm/testing.js.map +1 -1
- package/package.json +21 -11
- package/src/AppendCondition.ts +1 -1
- package/src/AppendIsOwned.ts +7 -7
- package/src/ContractStore.ts +5 -4
- package/src/DcbEventStore.ts +3 -3
- package/src/Event.ts +49 -14
- package/src/Query.ts +1 -1
- package/src/SubscribeMachine.ts +278 -96
- package/src/inMemory.ts +6 -6
- package/src/index.ts +1 -1
- package/src/retryOnConflict.ts +6 -11
- package/src/testing.ts +2 -2
- package/testing/package.json +1 -1
- package/dist/dts/ContractStore.d.ts.map +0 -1
- package/dist/dts/Event.d.ts.map +0 -1
- package/dist/dts/SubscribeMachine.d.ts +0 -179
- package/dist/dts/SubscribeMachine.d.ts.map +0 -1
- package/dist/dts/retryOnConflict.d.ts.map +0 -1
- /package/dist/{dts → dts-cjs}/Projection.d.ts +0 -0
- /package/dist/{dts → dts-cjs}/Projection.d.ts.map +0 -0
- /package/dist/{dts → dts-cjs}/Query.d.ts.map +0 -0
- /package/dist/{dts → dts-cjs}/errors.d.ts +0 -0
- /package/dist/{dts → dts-cjs}/errors.d.ts.map +0 -0
- /package/dist/{dts → dts-cjs}/inMemory.d.ts +0 -0
- /package/dist/{dts → dts-cjs}/index.d.ts.map +0 -0
- /package/dist/{dts → dts-cjs}/testing.d.ts.map +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `retryOnConflict` — the decider-level retry for `AppendConditionFailed`
|
|
3
|
+
* (ADR-0008).
|
|
4
|
+
*
|
|
5
|
+
* `append` surfaces a conflict as a SIGNAL only: a tagged `AppendConditionFailed`
|
|
6
|
+
* flattened to the tripped condition, carrying no conflicting position,
|
|
7
|
+
* deliberately so that a retry cannot resume from a stale conflict point. A
|
|
8
|
+
* correct DCB retry must therefore re-derive its append-condition lower bound
|
|
9
|
+
* from a FRESH READ to the current head — which means re-running the whole
|
|
10
|
+
* read-decide-append cycle, not re-submitting the same events.
|
|
11
|
+
*
|
|
12
|
+
* That is why this is a combinator over a command and NOT a `Layer` decorating
|
|
13
|
+
* `DcbEventStore.append`. A decorator sees only the events and the condition; it
|
|
14
|
+
* cannot re-read the log and it cannot re-decide, so it is STRUCTURALLY incapable
|
|
15
|
+
* of a correct DCB retry — the only thing it could do is re-submit against a
|
|
16
|
+
* condition that is already known to be stale, which either fails again forever
|
|
17
|
+
* or, worse, succeeds against a boundary the decision was never made under. No
|
|
18
|
+
* retrying `Layer` is shipped, and if a production command-runner service ever
|
|
19
|
+
* emerges, a `Layer` over THAT (a whole cycle) is the shape to add.
|
|
20
|
+
*
|
|
21
|
+
* It lives HERE, in `@kairos-es/core`, because conflict retry is a WRITE-side
|
|
22
|
+
* concern and core is where the write side is defined: core declares the `append`
|
|
23
|
+
* contract, defines the `AppendConditionFailed` this combinator matches, and
|
|
24
|
+
* already peers `effect` for `Schedule`, so the move costs nothing and adds no
|
|
25
|
+
* dependency in either direction. It shipped from `@kairos-es/read` first on the
|
|
26
|
+
* argument that it added no peer surface there either — true, but an argument for
|
|
27
|
+
* where it MAY live, not where it SHOULD. What that home actually cost was a
|
|
28
|
+
* write-only consumer having to depend on the READ package to retry its own
|
|
29
|
+
* appends, for a combinator that touches no projection, no checkpoint and no view
|
|
30
|
+
* (ADR-0008, homing amended).
|
|
31
|
+
*
|
|
32
|
+
* Core stays pure with it here. `Schedule`'s driver reads the time through
|
|
33
|
+
* `Clock.currentTimeMillis` and sleeps through `Clock.sleep`, both resolved from
|
|
34
|
+
* the fibre's default services, so `TestClock` still governs every delay; the
|
|
35
|
+
* jitter draws from `Random.next`, a default service on the same footing as the
|
|
36
|
+
* clock rather than a host `Math.random`. No `node:*`, no wall-clock reading, no
|
|
37
|
+
* ungoverned RNG.
|
|
38
|
+
*/
|
|
39
|
+
import { Effect, Schedule } from 'effect';
|
|
40
|
+
import type { AppendConditionFailed } from './errors.js';
|
|
41
|
+
/**
|
|
42
|
+
* Retry `command` while — and only while — it fails `AppendConditionFailed`.
|
|
43
|
+
*
|
|
44
|
+
* `command` must be the WHOLE read-decide-append cycle (read a decision model to
|
|
45
|
+
* the current head, decide, append under that read's condition), because each
|
|
46
|
+
* retry's correctness comes from the re-read: the fresh read re-derives the
|
|
47
|
+
* append condition's `after` from the new head, so the retried append is judged
|
|
48
|
+
* against the boundary the retried decision was actually made under. Wrapping only
|
|
49
|
+
* the `append` re-submits a stale condition and is wrong.
|
|
50
|
+
*
|
|
51
|
+
* A non-conflict `E` is preserved on the error channel and escapes IMMEDIATELY
|
|
52
|
+
* with zero retries: the `while` predicate is false for it, so a domain rejection
|
|
53
|
+
* ("course is full") never pays a backoff and never retries into a decision the
|
|
54
|
+
* log has already refused. `A`, the non-conflict `E`, and `R` all pass through
|
|
55
|
+
* untouched.
|
|
56
|
+
*
|
|
57
|
+
* The predicate matches on the `_tag` rather than `instanceof`. The tag is the
|
|
58
|
+
* error's identity across module realms, and a published package ships dual
|
|
59
|
+
* ESM/CJS, so an `instanceof` check can see two distinct classes for the same
|
|
60
|
+
* error when a consumer's graph loads both builds — a conflict would then escape
|
|
61
|
+
* unretried and silently.
|
|
62
|
+
*/
|
|
63
|
+
export declare const retryOnConflict: <A, E, R>(command: Effect.Effect<A, AppendConditionFailed | E, R>, schedule?: Schedule.Schedule<unknown, AppendConditionFailed | E, never, R>) => Effect.Effect<A, AppendConditionFailed | E, R>;
|
|
64
|
+
//# sourceMappingURL=retryOnConflict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retryOnConflict.d.ts","sourceRoot":"","sources":["../../src/retryOnConflict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,EAAE,MAAM,EAAa,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAqBrD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EACrC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,qBAAqB,GAAG,CAAC,EAAE,CAAC,CAAC,EACvD,WAAU,QAAQ,CAAC,QAAQ,CACzB,OAAO,EACP,qBAAqB,GAAG,CAAC,EACzB,KAAK,EACL,CAAC,CACgB,KAClB,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,qBAAqB,GAAG,CAAC,EAAE,CAAC,CAI5C,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic test-support utilities, shared across every kairos-es suite via
|
|
3
|
+
* the published `@kairos-es/core/testing` subpath.
|
|
4
|
+
*
|
|
5
|
+
* WHY a published subpath rather than a test-only package: three suites (core's
|
|
6
|
+
* own tests, the store contract suite, and the codec's `UuidTest` layer) each
|
|
7
|
+
* carried a byte-identical copy of the same counter-based uuid scheme and the
|
|
8
|
+
* `EPOCH` domain time. Copies drift. The one place every consumer already
|
|
9
|
+
* depends on is `@kairos-es/core`, so the single source of truth lives here as a
|
|
10
|
+
* *published* subpath — never a runtime dependency from a published package onto
|
|
11
|
+
* an unpublished/test-only one, which would create a packaging cycle.
|
|
12
|
+
*
|
|
13
|
+
* Everything here is PURE and DETERMINISTIC: no RNG, no wall-clock. That is the
|
|
14
|
+
* whole point — suites must produce the same bytes and positions on every run,
|
|
15
|
+
* so `data`/`uuid`/`occurredAt` never introduce nondeterminism into assertions.
|
|
16
|
+
*/
|
|
17
|
+
import { DateTime } from 'effect';
|
|
18
|
+
/**
|
|
19
|
+
* A fixed domain time (`DateTime` at the Unix epoch) for test events.
|
|
20
|
+
*
|
|
21
|
+
* Ordering in the log is by `position` alone, so an event's `occurredAt` is
|
|
22
|
+
* informational; pinning it to the epoch keeps serialised bytes and comparisons
|
|
23
|
+
* stable across runs. Built via `DateTime.makeUnsafe(0)` (the value is a
|
|
24
|
+
* compile-time constant, not read from the host clock).
|
|
25
|
+
*/
|
|
26
|
+
export declare const EPOCH: DateTime.Utc;
|
|
27
|
+
/**
|
|
28
|
+
* Build a fresh, deterministic uuid generator: a zero-based counter producing
|
|
29
|
+
* RFC-4122 v4-shaped ids `00000000-0000-4000-8000-<counter as 12 hex digits>`,
|
|
30
|
+
* starting at `...000000000000` and incrementing on each call.
|
|
31
|
+
*
|
|
32
|
+
* A *factory* (not a shared singleton) so each layer/suite instance owns its own
|
|
33
|
+
* counter and the sequence is repeatable in isolation — two independent suites
|
|
34
|
+
* do not interfere, yet each is stable on its own. No RNG: the ids are
|
|
35
|
+
* comparable and predictable, which is what assertions need, while still being
|
|
36
|
+
* distinct enough to tell events apart.
|
|
37
|
+
*/
|
|
38
|
+
export declare const makeSequentialUuid: () => (() => string);
|
|
39
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEjC;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,cAAyB,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,QAAO,CAAC,MAAM,MAAM,CAOlD,CAAA"}
|
|
@@ -12,8 +12,6 @@ import { Position } from "./Event.js";
|
|
|
12
12
|
import { Query } from "./Query.js";
|
|
13
13
|
export const AppendCondition = /*#__PURE__*/Schema.Struct({
|
|
14
14
|
failIfEventsMatch: Query,
|
|
15
|
-
after: /*#__PURE__*/Schema.
|
|
16
|
-
exact: true
|
|
17
|
-
})
|
|
15
|
+
after: /*#__PURE__*/Schema.optionalKey(Position)
|
|
18
16
|
});
|
|
19
17
|
//# sourceMappingURL=AppendCondition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppendCondition.js","names":["Schema","Position","Query","AppendCondition","Struct","failIfEventsMatch","after","
|
|
1
|
+
{"version":3,"file":"AppendCondition.js","names":["Schema","Position","Query","AppendCondition","Struct","failIfEventsMatch","after","optionalKey"],"sources":["../../src/AppendCondition.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;AASA,SAASA,MAAM,QAAQ,QAAQ;AAC/B,SAASC,QAAQ,QAAQ,YAAS;AAClC,SAASC,KAAK,QAAQ,YAAS;AAE/B,OAAO,MAAMC,eAAe,gBAAGH,MAAM,CAACI,MAAM,CAAC;EAC3CC,iBAAiB,EAAEH,KAAK;EACxBI,KAAK,eAAEN,MAAM,CAACO,WAAW,CAACN,QAAQ;CACnC,CAAC","ignoreList":[]}
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
*
|
|
31
31
|
* ## Present means refused, so a sanctioned append REMOVES the marker
|
|
32
32
|
*
|
|
33
|
-
* The check reads the
|
|
33
|
+
* The check reads the service through `Effect.serviceOption`, so its ABSENCE is the
|
|
34
34
|
* normal case and costs the `append` signature nothing — `DcbEventStore.append`
|
|
35
35
|
* keeps `R = never` and no caller provides anything. Presence is what refuses.
|
|
36
36
|
*
|
|
37
37
|
* That shape decides how the two legitimate appends inside a bracket get through,
|
|
38
38
|
* and there is only one route: run with the marker STRIPPED from the context
|
|
39
|
-
* (`Effect.
|
|
39
|
+
* (`Effect.updateContext` over `Context.omit(AppendIsOwned)`). The bracket's own
|
|
40
40
|
* closing append is issued outside the scope it provided the marker in, and the
|
|
41
|
-
* codec's escape hatch strips it explicitly. Neither needs a second
|
|
41
|
+
* codec's escape hatch strips it explicitly. Neither needs a second service, a
|
|
42
42
|
* sanctioning flag or a mutable cell, and there is no way to be exempt by
|
|
43
43
|
* accident: an append is either lexically outside the marked region or it says in
|
|
44
44
|
* as many words that it is removing the marker.
|
|
@@ -49,10 +49,10 @@ import { Context, Effect } from 'effect';
|
|
|
49
49
|
* owns it.
|
|
50
50
|
*
|
|
51
51
|
* `by` is a human-readable owner name and exists for the defect message alone —
|
|
52
|
-
* the refusal is decided by the
|
|
52
|
+
* the refusal is decided by the service's PRESENCE, never by this value, so nothing
|
|
53
53
|
* branches on it and no caller need agree on a vocabulary for it.
|
|
54
54
|
*/
|
|
55
|
-
export class AppendIsOwned extends /*#__PURE__*/Context.
|
|
55
|
+
export class AppendIsOwned extends /*#__PURE__*/Context.Service()('@kairos-es/core/AppendIsOwned') {}
|
|
56
56
|
/**
|
|
57
57
|
* Die if an append is already owned here; do nothing otherwise.
|
|
58
58
|
*
|
|
@@ -65,7 +65,7 @@ export class AppendIsOwned extends /*#__PURE__*/Context.Tag('@kairos-es/core/App
|
|
|
65
65
|
* its escape hatch for a deliberate second append — which is what makes a defect
|
|
66
66
|
* affordable here.
|
|
67
67
|
*
|
|
68
|
-
* `Effect.serviceOption` is what keeps this free: it reads the
|
|
68
|
+
* `Effect.serviceOption` is what keeps this free: it reads the service if present and
|
|
69
69
|
* adds NOTHING to the requirement channel, so every existing append is unchanged
|
|
70
70
|
* and unprovisioned.
|
|
71
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppendIsOwned.js","names":["Context","Effect","AppendIsOwned","
|
|
1
|
+
{"version":3,"file":"AppendIsOwned.js","names":["Context","Effect","AppendIsOwned","Service","assertAppendNotOwned","flatMap","serviceOption","owner","_tag","void","die","Error","value","by"],"sources":["../../src/AppendIsOwned.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,SAASA,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAExC;;;;;;;;AAQA,OAAM,MAAOC,aAAc,sBAAQF,OAAO,CAACG,OAAO,EAG/C,CAAC,+BAA+B,CAAC;AAEpC;;;;;;;;;;;;;;;;AAgBA,OAAO,MAAMC,oBAAoB,gBAAwBH,MAAM,CAACI,OAAO,cACrEJ,MAAM,CAACK,aAAa,CAACJ,aAAa,CAAC,EAClCK,KAAK,IACJA,KAAK,CAACC,IAAI,KAAK,MAAM,GACjBP,MAAM,CAACQ,IAAI,GACXR,MAAM,CAACS,GAAG,CACR,IAAIC,KAAK,CACP,kEAAkEJ,KAAK,CAACK,KAAK,CAACC,EAAE,MAAM,GACpF,4EAA4E,GAC5E,0EAA0E,GAC1E,4EAA4E,GAC5E,0EAA0E,GAC1E,sEAAsE,CACzE,CACF,CACR","ignoreList":[]}
|
|
@@ -22,7 +22,7 @@ export const makeContractStore = raw => ({
|
|
|
22
22
|
append: (events, condition) =>
|
|
23
23
|
// The ownership refusal runs FIRST and sits OUTSIDE the suspend, because it is
|
|
24
24
|
// the only one of append's checks that is EFFECTFUL: it consults a
|
|
25
|
-
// `Context.
|
|
25
|
+
// `Context.Service` rather than inspecting the arguments. `Effect.flatMap` over an
|
|
26
26
|
// already-lazy effect defers it exactly as the suspend defers the throws below,
|
|
27
27
|
// so nothing runs at the call site either way; what it buys is that the
|
|
28
28
|
// "you are inside a bracket" defect arrives before any argument is judged, which
|
|
@@ -77,7 +77,7 @@ export const makeContractStore = raw => ({
|
|
|
77
77
|
// engine's channel simply answers false and dies as it should. It also
|
|
78
78
|
// narrows the raw `AppendConditionFailed | E` to the contract's single
|
|
79
79
|
// error, which is what keeps `append` at `E = AppendConditionFailed`.
|
|
80
|
-
return Effect.
|
|
80
|
+
return Effect.catch(raw.append(events, condition), error => Predicate.isTagged('AppendConditionFailed')(error) ? Effect.fail(error) : Effect.die(error));
|
|
81
81
|
})),
|
|
82
82
|
subscribe: (query, after) =>
|
|
83
83
|
// `Effect.sync` runs when the stream is executed; a throw from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractStore.js","names":["Effect","Predicate","Schema","Stream","AppendCondition","assertAppendNotOwned","ReadLimit","assertServableQuery","decodeReadLimit","decodeUnknownSync","makeContractStore","raw","read","query","options","suspend","limit","undefined","orDie","append","events","condition","flatMap","length","Error","unknown","Object","keys","find","key","hasOwn","fields","JSON","stringify","failIfEventsMatch","
|
|
1
|
+
{"version":3,"file":"ContractStore.js","names":["Effect","Predicate","Schema","Stream","AppendCondition","assertAppendNotOwned","ReadLimit","assertServableQuery","decodeReadLimit","decodeUnknownSync","makeContractStore","raw","read","query","options","suspend","limit","undefined","orDie","append","events","condition","flatMap","length","Error","unknown","Object","keys","find","key","hasOwn","fields","JSON","stringify","failIfEventsMatch","catch","error","isTagged","fail","die","subscribe","after","unwrap","sync"],"sources":["../../src/ContractStore.ts"],"sourcesContent":[null],"mappings":"AAsCA,SAASA,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAC1D,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,oBAAoB,QAAQ,oBAAiB;AAGtD,SAASC,SAAS,QAAQ,YAAS;AAEnC,SAASC,mBAAmB,QAAoB,YAAS;AAEzD;AACA,MAAMC,eAAe,gBAAGN,MAAM,CAACO,iBAAiB,CAACH,SAAS,CAAC;AAwB3D;;;;AAIA,OAAO,MAAMI,iBAAiB,GAC5BC,GAAwB,KACM;EAC9BC,IAAI,EAAEA,CAACC,KAAK,EAAEC,OAAO,KACnBd,MAAM,CAACe,OAAO,CAAC,MAAK;IAClB;IACAR,mBAAmB,CAACM,KAAK,CAAC;IAC1B,IAAIC,OAAO,EAAEE,KAAK,KAAK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BAAuB,CAAC,CAACD,KAAK,CAAC,GAC9CpC,MAAM,CAACsC,IAAI,CAACF,KAAK,CAAC,GAClBpC,MAAM,CAACuC,GAAG,CAACH,KAAK,CAAC,CACtB;EACH,CAAC,CAAC,CACH;EAEHI,SAAS,EAAEA,CAAC3B,KAAK,EAAE4B,KAAK;EACtB;EACA;EACA;EACA;EACAtC,MAAM,CAACuC,MAAM,CACX1C,MAAM,CAAC2C,IAAI,CAAC,MAAK;IACfpC,mBAAmB,CAACM,KAAK,CAAC;IAC1B,OAAOV,MAAM,CAACe,KAAK,CAACP,GAAG,CAAC6B,SAAS,CAAC3B,KAAK,EAAE4B,KAAK,CAAC,CAAC;EAClD,CAAC,CAAC;CAEP,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Context } from 'effect';
|
|
2
|
-
export class DcbEventStore extends /*#__PURE__*/Context.
|
|
2
|
+
export class DcbEventStore extends /*#__PURE__*/Context.Service()('@kairos-es/core/DcbEventStore') {}
|
|
3
3
|
//# sourceMappingURL=DcbEventStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DcbEventStore.js","names":["Context","DcbEventStore","
|
|
1
|
+
{"version":3,"file":"DcbEventStore.js","names":["Context","DcbEventStore","Service"],"sources":["../../src/DcbEventStore.ts"],"sourcesContent":[null],"mappings":"AAiBA,SAASA,OAAO,QAAQ,QAAQ;AA2BhC,OAAM,MAAOC,aAAc,sBAAQD,OAAO,CAACE,OAAO,EAgC/C,CAAC,+BAA+B,CAAC","ignoreList":[]}
|
package/dist/esm/Event.js
CHANGED
|
@@ -6,17 +6,34 @@
|
|
|
6
6
|
* payloads into these bytes. Ordering is by `position` alone; `occurredAt` is
|
|
7
7
|
* producer-supplied domain time and is informational only.
|
|
8
8
|
*/
|
|
9
|
-
import { Schema } from 'effect';
|
|
9
|
+
import { BigInt as BigInt_, Effect, Option, Schema, SchemaIssue, SchemaTransformation } from 'effect';
|
|
10
10
|
/**
|
|
11
11
|
* A position in the single global event log: a branded, non-negative `bigint`.
|
|
12
12
|
*
|
|
13
13
|
* The log is 64-bit (`bigserial` in Postgres) and exceeds JS `number` safety at
|
|
14
14
|
* 2^53, so positions are a `bigint`. They are compared, never arithmetic'd.
|
|
15
|
-
*
|
|
15
|
+
* Encoded, a position is a decimal string (JSON-safe, `String(b)`); decoded, a
|
|
16
16
|
* `bigint`. `0n` is the "before the first event" sentinel used by `after` and by
|
|
17
17
|
* an empty store's head.
|
|
18
|
+
*
|
|
19
|
+
* The string-to-`bigint` step is hand-built rather than Effect 4's
|
|
20
|
+
* `Schema.BigIntFromString`, because that schema accepts only `^-?\d+$` and so
|
|
21
|
+
* refuses inputs the encoded side has always admitted — `" 5"`, `"+5"`,
|
|
22
|
+
* `"0x10"`. The decode here is the global `BigInt(s)` behind a blank-string
|
|
23
|
+
* refusal, which is `BigInt.fromString` and is exactly what Effect 3's
|
|
24
|
+
* `Schema.BigInt` ran, so a position string any earlier release decoded still
|
|
25
|
+
* decodes to the same value. The non-negative check then runs on the `bigint`,
|
|
26
|
+
* as it always did.
|
|
18
27
|
*/
|
|
19
|
-
export const Position = /*#__PURE__*/Schema.
|
|
28
|
+
export const Position = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.decodeTo(Schema.BigInt, /*#__PURE__*/SchemaTransformation.transformEffect({
|
|
29
|
+
decode: (s, options) => Option.match(BigInt_.fromString(s), {
|
|
30
|
+
onNone: () => Effect.fail(new SchemaIssue.InvalidValue({
|
|
31
|
+
message: `Unable to decode ${JSON.stringify(s)} into a bigint`
|
|
32
|
+
}, s, options)),
|
|
33
|
+
onSome: Effect.succeed
|
|
34
|
+
}),
|
|
35
|
+
encode: b => Effect.succeed(String(b))
|
|
36
|
+
})), /*#__PURE__*/Schema.check(/*#__PURE__*/Schema.isGreaterThanOrEqualToBigInt(0n)), /*#__PURE__*/Schema.brand('Position'));
|
|
20
37
|
/** The sentinel position meaning "before the first event". */
|
|
21
38
|
export const ORIGIN = /*#__PURE__*/Position.make(0n);
|
|
22
39
|
/**
|
|
@@ -25,9 +42,9 @@ export const ORIGIN = /*#__PURE__*/Position.make(0n);
|
|
|
25
42
|
* event sourcing; a query matches an event when the event carries all of an
|
|
26
43
|
* item's tags (superset test).
|
|
27
44
|
*/
|
|
28
|
-
export const Tag = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.
|
|
45
|
+
export const Tag = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.check(/*#__PURE__*/Schema.isPattern(/^[^:]+:.+/, {
|
|
29
46
|
identifier: 'Tag'
|
|
30
|
-
}), /*#__PURE__*/Schema.brand('Tag'));
|
|
47
|
+
})), /*#__PURE__*/Schema.brand('Tag'));
|
|
31
48
|
export const tagIdentity = key => {
|
|
32
49
|
if (key.length === 0 || key.includes(':')) {
|
|
33
50
|
throw new Error(`tagIdentity: key must be non-empty and contain no ':' (got ${JSON.stringify(key)})`);
|
|
@@ -52,12 +69,12 @@ export const tagIdentity = key => {
|
|
|
52
69
|
* error channel (`read` keeps `E = never`). Constructed at call sites with
|
|
53
70
|
* `ReadLimit.make(n)`.
|
|
54
71
|
*/
|
|
55
|
-
export const ReadLimit = /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.
|
|
72
|
+
export const ReadLimit = /*#__PURE__*/Schema.Int.pipe(/*#__PURE__*/Schema.check(/*#__PURE__*/Schema.isGreaterThanOrEqualTo(0)), /*#__PURE__*/Schema.brand('ReadLimit'));
|
|
56
73
|
/**
|
|
57
74
|
* An event type name, a branded non-empty string. Versioning is by convention
|
|
58
75
|
* in the name (e.g. `course-registered.v2`); only non-emptiness is enforced.
|
|
59
76
|
*/
|
|
60
|
-
export const EventType = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.
|
|
77
|
+
export const EventType = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.check(/*#__PURE__*/Schema.isNonEmpty()), /*#__PURE__*/Schema.brand('EventType'));
|
|
61
78
|
/**
|
|
62
79
|
* An event's metadata: a flat bag of strings carrying the circumstances under
|
|
63
80
|
* which the event was RECORDED, never anything the business asserts (ADR-0017).
|
|
@@ -107,10 +124,7 @@ export const EventType = /*#__PURE__*/Schema.String.pipe(/*#__PURE__*/Schema.non
|
|
|
107
124
|
* alone: it would make an event the store accepted unreadable for ever, so a
|
|
108
125
|
* value check belongs at write or nowhere.
|
|
109
126
|
*/
|
|
110
|
-
export const Metadata = /*#__PURE__*/Schema.Record(
|
|
111
|
-
key: Schema.String,
|
|
112
|
-
value: Schema.String
|
|
113
|
-
});
|
|
127
|
+
export const Metadata = /*#__PURE__*/Schema.Record(Schema.String, Schema.String);
|
|
114
128
|
/**
|
|
115
129
|
* An event as stored: an opaque payload plus its type, tags, a
|
|
116
130
|
* producer-supplied `uuid`, producer-supplied `occurredAt` domain time, and its
|
|
@@ -118,6 +132,8 @@ export const Metadata = /*#__PURE__*/Schema.Record({
|
|
|
118
132
|
*
|
|
119
133
|
* `data` is `Uint8Array` (opaque bytes); the store does not interpret it.
|
|
120
134
|
* `uuid` is producer-supplied to keep `core` deterministic (no RNG in core).
|
|
135
|
+
* It is checked for UUID SHAPE only (`isGUID`), not for a version nibble: a
|
|
136
|
+
* stricter check would refuse ids an existing log already holds.
|
|
121
137
|
* `occurredAt` is informational only; ordering is by position alone.
|
|
122
138
|
* `metadata` mirrors `tags` rather than `data`: REQUIRED, with an empty bag
|
|
123
139
|
* legal. Required because an absent-versus-empty divergence between engines is
|
|
@@ -127,10 +143,10 @@ export const Metadata = /*#__PURE__*/Schema.Record({
|
|
|
127
143
|
*/
|
|
128
144
|
export const DcbEvent = /*#__PURE__*/Schema.Struct({
|
|
129
145
|
type: EventType,
|
|
130
|
-
data: Schema.
|
|
146
|
+
data: Schema.Uint8Array,
|
|
131
147
|
tags: /*#__PURE__*/Schema.Array(Tag),
|
|
132
|
-
uuid: Schema.
|
|
133
|
-
occurredAt: Schema.
|
|
148
|
+
uuid: /*#__PURE__*/Schema.String.check(/*#__PURE__*/Schema.isGUID()),
|
|
149
|
+
occurredAt: Schema.DateTimeUtcFromString,
|
|
134
150
|
metadata: Metadata
|
|
135
151
|
});
|
|
136
152
|
/** A persisted event: the event together with the position it was written at. */
|
package/dist/esm/Event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Event.js","names":["Schema","Position","
|
|
1
|
+
{"version":3,"file":"Event.js","names":["BigInt","BigInt_","Effect","Option","Schema","SchemaIssue","SchemaTransformation","Position","String","pipe","decodeTo","transformEffect","decode","s","options","match","fromString","onNone","fail","InvalidValue","message","JSON","stringify","onSome","succeed","encode","b","check","isGreaterThanOrEqualToBigInt","brand","ORIGIN","make","Tag","isPattern","identifier","tagIdentity","key","length","includes","Error","value","ReadLimit","Int","isGreaterThanOrEqualTo","EventType","isNonEmpty","Metadata","Record","DcbEvent","Struct","type","data","Uint8Array","tags","Array","uuid","isGUID","occurredAt","DateTimeUtcFromString","metadata","SequencedEvent","event","position"],"sources":["../../src/Event.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;AAQA,SACEA,MAAM,IAAIC,OAAO,EACjBC,MAAM,EACNC,MAAM,EACNC,MAAM,EACNC,WAAW,EACXC,oBAAoB,QACf,QAAQ;AAEf;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAMC,QAAQ,gBAAGH,MAAM,CAACI,MAAM,CAACC,IAAI,cACxCL,MAAM,CAACM,QAAQ,CACbN,MAAM,CAACJ,MAAM,eACbM,oBAAoB,CAACK,eAAe,CAAiB;EACnDC,MAAM,EAAEA,CAACC,CAAC,EAAEC,OAAO,KACjBX,MAAM,CAACY,KAAK,CAACd,OAAO,CAACe,UAAU,CAACH,CAAC,CAAC,EAAE;IAClCI,MAAM,EAAEA,CAAA,KACNf,MAAM,CAACgB,IAAI,CACT,IAAIb,WAAW,CAACc,YAAY,CAC1B;MACEC,OAAO,EAAE,oBAAoBC,IAAI,CAACC,SAAS,CAACT,CAAC,CA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
|
const only = query.items.length === 1 ? query.items[0] : undefined;
|
|
227
227
|
if (only !== undefined && only.tags.length === 0) {
|
|
228
|
-
return Arr.
|
|
228
|
+
return Arr.isReadonlyArrayNonEmpty(only.types) ? {
|
|
229
229
|
kind: 'typeOnly',
|
|
230
230
|
types: only.types
|
|
231
231
|
} : {
|
package/dist/esm/Query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","names":["Array","Arr","Schema","EventType","Tag","QueryItem","Struct","types","tags","Query","items","matchesQueryItem","event","item","typeOk","length","includes","type","eventTags","Set","every","tag","has","matchesQuery","query","some","matchesSequenced","sequenced","assertServableQuery","fault","servableQueryFault","undefined","Error","unknownKeyFault","where","value","schemaFields","unknown","Object","keys","find","key","hasOwn","JSON","stringify","unknownQueryKeyFault","fields","reduce","unknownKey","classifyServableQuery","kind","only","
|
|
1
|
+
{"version":3,"file":"Query.js","names":["Array","Arr","Schema","EventType","Tag","QueryItem","Struct","types","tags","Query","items","matchesQueryItem","event","item","typeOk","length","includes","type","eventTags","Set","every","tag","has","matchesQuery","query","some","matchesSequenced","sequenced","assertServableQuery","fault","servableQueryFault","undefined","Error","unknownKeyFault","where","value","schemaFields","unknown","Object","keys","find","key","hasOwn","JSON","stringify","unknownQueryKeyFault","fields","reduce","unknownKey","classifyServableQuery","kind","only","isReadonlyArrayNonEmpty","all","or"],"sources":["../../src/Query.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAASA,KAAK,IAAIC,GAAG,EAAEC,MAAM,QAAQ,QAAQ;AAC7C,SAAwBC,SAAS,EAAuBC,GAAG,QAAQ,YAAS;AAE5E;;;;AAIA,OAAO,MAAMC,SAAS,gBAAGH,MAAM,CAACI,MAAM,CAAC;EACrCC,KAAK,eAAEL,MAAM,CAACF,KAAK,CAACG,SAAS,CAAC;EAC9BK,IAAI,eAAEN,MAAM,CAACF,KAAK,CAACI,GAAG;CACvB,CAAC;A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