@kairos-es/core 1.0.0-alpha.0 → 1.0.0-alpha.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 +15 -3
- package/dist/cjs/AppendIsOwned.js +81 -0
- package/dist/cjs/AppendIsOwned.js.map +1 -0
- package/dist/cjs/ContractStore.js +12 -2
- package/dist/cjs/ContractStore.js.map +1 -1
- package/dist/cjs/Projection.js +19 -5
- package/dist/cjs/Projection.js.map +1 -1
- package/dist/cjs/Query.js +37 -7
- package/dist/cjs/Query.js.map +1 -1
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/AppendIsOwned.d.ts +78 -0
- package/dist/dts/AppendIsOwned.d.ts.map +1 -0
- package/dist/dts/ContractStore.d.ts +4 -1
- package/dist/dts/ContractStore.d.ts.map +1 -1
- package/dist/dts/Projection.d.ts +16 -0
- package/dist/dts/Projection.d.ts.map +1 -1
- package/dist/dts/Query.d.ts +21 -0
- package/dist/dts/Query.d.ts.map +1 -1
- package/dist/dts/index.d.ts +9 -4
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/esm/AppendIsOwned.js +73 -0
- package/dist/esm/AppendIsOwned.js.map +1 -0
- package/dist/esm/ContractStore.js +12 -2
- package/dist/esm/ContractStore.js.map +1 -1
- package/dist/esm/Projection.js +17 -4
- package/dist/esm/Projection.js.map +1 -1
- package/dist/esm/Query.js +34 -5
- package/dist/esm/Query.js.map +1 -1
- package/dist/esm/index.js +9 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/AppendIsOwned.ts +92 -0
- package/src/ContractStore.ts +65 -51
- package/src/Projection.ts +21 -9
- package/src/Query.ts +38 -8
- package/src/index.ts +9 -4
package/README.md
CHANGED
|
@@ -13,7 +13,11 @@ pnpm add @kairos-es/core@alpha effect
|
|
|
13
13
|
|
|
14
14
|
Provides the `DcbEventStore` contract (branded `Position` / `Tag` / `EventType`,
|
|
15
15
|
the `DcbEvent` / `Query` / `AppendCondition` schemas, the errors and the
|
|
16
|
-
`Context.Tag`), the pure `Projection` / `composeProjections` fold primitives
|
|
16
|
+
`Context.Tag`), the pure `Projection` / `composeProjections` fold primitives
|
|
17
|
+
(plus `unionQueries`, the OR-merge `composeProjections` folds a record through,
|
|
18
|
+
reachable without one — a caller accumulating queries rather than projections
|
|
19
|
+
needs it, and hand-rolling that merge silently drops a wildcard, an empty item
|
|
20
|
+
list being absorbing under OR while an empty spread contributes nothing), and
|
|
17
21
|
the in-memory `Layer` — the canonical, readable form of the check-then-append
|
|
18
22
|
algorithm. Decoding is deliberately not core's job, because it needs `Schema` and
|
|
19
23
|
a `Serializer`: the event-def builder, the slice builder and `buildDecisionModel`
|
|
@@ -34,8 +38,16 @@ the shared `subscribe` wake/poll/dedup machine every engine's `subscribe` is bui
|
|
|
34
38
|
from and the two tuning constants and config fields that go with it
|
|
35
39
|
([ADR-0009](../../docs/adr/0009-subscribe-machine-in-core-ascending-commit-order-precondition.md)),
|
|
36
40
|
and `classifyServableQuery` beside the `assertServableQuery` defining the grammar it
|
|
37
|
-
dispatches over
|
|
38
|
-
|
|
41
|
+
dispatches over, plus `servableQueryFault`, that same grammar as a total function for a
|
|
42
|
+
caller who can still act on the answer. `SubscribeMachine.ts` states the one obligation
|
|
43
|
+
an engine using it inherits.
|
|
44
|
+
|
|
45
|
+
`AppendIsOwned` is a marker a bracket puts in context to say it already owns the append
|
|
46
|
+
here, and the shared decorator refuses any other append made under it as a defect —
|
|
47
|
+
which is what catches a raw `store.append` inside `@kairos-es/codec`'s `transact`, where
|
|
48
|
+
no syntactic rule could. Nothing is required to provide it, and outside a bracket nothing
|
|
49
|
+
does
|
|
50
|
+
([ADR-0014](../../docs/adr/0014-layered-decision-models-an-ambient-read-ledger-and-a-bracket-that-owns-the-append.md)).
|
|
39
51
|
|
|
40
52
|
Platform-neutral (no `node:*` imports); `effect` is the only peer dependency.
|
|
41
53
|
`@kairos-es/core/testing` is a published subpath carrying the deterministic
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assertAppendNotOwned = exports.AppendIsOwned = void 0;
|
|
7
|
+
var _effect = require("effect");
|
|
8
|
+
/**
|
|
9
|
+
* `AppendIsOwned` — the marker saying *"an append is already owned here"*, and the
|
|
10
|
+
* check that refuses a second one.
|
|
11
|
+
*
|
|
12
|
+
* ## Why a write-side concept core does not need for its own job lives in core
|
|
13
|
+
*
|
|
14
|
+
* A bracket that derives one `AppendCondition` from every read its body performed
|
|
15
|
+
* (`@kairos-es/codec`'s `transact`) owns exactly one append: the one it issues at
|
|
16
|
+
* close, under that derived condition. Any OTHER append inside that body is a
|
|
17
|
+
* wiring mistake, and the dangerous case is not the one that looks dangerous. A
|
|
18
|
+
* command runner appending mid-body usually writes into the very slice the body
|
|
19
|
+
* read, so its events match the union the bracket is about to guard on — and the
|
|
20
|
+
* bracket's own closing append is then refused by a condition its own body
|
|
21
|
+
* invalidated. The failure arrives at the wrong line, describing a conflict that
|
|
22
|
+
* was self-inflicted.
|
|
23
|
+
*
|
|
24
|
+
* The refusal therefore has to catch a RAW `store.append` and not merely a nested
|
|
25
|
+
* bracket, which is what puts it here rather than in the codec. Enforcing it one
|
|
26
|
+
* layer up would catch a nested bracket and a command runner and miss a direct
|
|
27
|
+
* store call — and a syntactic lint rule cannot close that gap either, having no
|
|
28
|
+
* call graph, so an append one function away in a helper is invisible to both.
|
|
29
|
+
* `makeContractStore` is the one seam every engine's append already passes
|
|
30
|
+
* through, so the check is written once and inherited whole, exactly as
|
|
31
|
+
* `assertServableQuery` is.
|
|
32
|
+
*
|
|
33
|
+
* The cost is real and is accepted: core learns a concept it does not need for its
|
|
34
|
+
* own job. It is affordable because core already owns the write contract, and
|
|
35
|
+
* *"an append is already owned"* is a write-side fact about that contract rather
|
|
36
|
+
* than a fact about the codec.
|
|
37
|
+
*
|
|
38
|
+
* ## Present means refused, so a sanctioned append REMOVES the marker
|
|
39
|
+
*
|
|
40
|
+
* The check reads the tag through `Effect.serviceOption`, so its ABSENCE is the
|
|
41
|
+
* normal case and costs the `append` signature nothing — `DcbEventStore.append`
|
|
42
|
+
* keeps `R = never` and no caller provides anything. Presence is what refuses.
|
|
43
|
+
*
|
|
44
|
+
* That shape decides how the two legitimate appends inside a bracket get through,
|
|
45
|
+
* and there is only one route: run with the marker STRIPPED from the context
|
|
46
|
+
* (`Effect.mapInputContext` over `Context.omit(AppendIsOwned)`). The bracket's own
|
|
47
|
+
* closing append is issued outside the scope it provided the marker in, and the
|
|
48
|
+
* codec's escape hatch strips it explicitly. Neither needs a second tag, a
|
|
49
|
+
* sanctioning flag or a mutable cell, and there is no way to be exempt by
|
|
50
|
+
* accident: an append is either lexically outside the marked region or it says in
|
|
51
|
+
* as many words that it is removing the marker.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Marks that an append is already owned by an enclosing bracket, and names what
|
|
56
|
+
* owns it.
|
|
57
|
+
*
|
|
58
|
+
* `by` is a human-readable owner name and exists for the defect message alone —
|
|
59
|
+
* the refusal is decided by the tag's PRESENCE, never by this value, so nothing
|
|
60
|
+
* branches on it and no caller need agree on a vocabulary for it.
|
|
61
|
+
*/
|
|
62
|
+
class AppendIsOwned extends /*#__PURE__*/_effect.Context.Tag('@kairos-es/core/AppendIsOwned')() {}
|
|
63
|
+
/**
|
|
64
|
+
* Die if an append is already owned here; do nothing otherwise.
|
|
65
|
+
*
|
|
66
|
+
* A DEFECT and not an error-channel value, deliberately. There is no
|
|
67
|
+
* data-dependent recovery from it: the events this append would have written
|
|
68
|
+
* belong to a bracket that is going to write its own, so no caller could sensibly
|
|
69
|
+
* catch it and carry on. It is the same class of fault as a non-servable query,
|
|
70
|
+
* and it is refused in the same place and in the same way. The remedy is one
|
|
71
|
+
* identifier away in every case — the codec's `decideOnly` for a command runner,
|
|
72
|
+
* its escape hatch for a deliberate second append — which is what makes a defect
|
|
73
|
+
* affordable here.
|
|
74
|
+
*
|
|
75
|
+
* `Effect.serviceOption` is what keeps this free: it reads the tag if present and
|
|
76
|
+
* adds NOTHING to the requirement channel, so every existing append is unchanged
|
|
77
|
+
* and unprovisioned.
|
|
78
|
+
*/
|
|
79
|
+
exports.AppendIsOwned = AppendIsOwned;
|
|
80
|
+
const assertAppendNotOwned = exports.assertAppendNotOwned = /*#__PURE__*/_effect.Effect.flatMap(/*#__PURE__*/_effect.Effect.serviceOption(AppendIsOwned), owner => owner._tag === 'None' ? _effect.Effect.void : _effect.Effect.die(new Error(`makeContractStore.append: an append is already owned here (by '${owner.value.by}'), ` + 'so this one is refused. A bracket derives one append condition from every ' + 'read its body performed and issues one append under it; a second append ' + 'inside that body writes events the bracket is about to guard against, and ' + "refuses the bracket's own close. Return the events instead of appending " + "them, or say the append is deliberate with the codec's escape hatch.")));
|
|
81
|
+
//# sourceMappingURL=AppendIsOwned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppendIsOwned.js","names":["_effect","require","AppendIsOwned","Context","Tag","exports","assertAppendNotOwned","Effect","flatMap","serviceOption","owner","_tag","void","die","Error","value","by"],"sources":["../../src/AppendIsOwned.ts"],"sourcesContent":[null],"mappings":";;;;;;AA6CA,IAAAA,OAAA,GAAAC,OAAA;AA7CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA;;;;;;;;AAQM,MAAOC,aAAc,sBAAQC,eAAO,CAACC,GAAG,CAAC,+BAA+B,CAAC,EAG5E;AAEH;;;;;;;;;;;;;;;;AAAAC,OAAA,CAAAH,aAAA,GAAAA,aAAA;AAgBO,MAAMI,oBAAoB,GAAAD,OAAA,CAAAC,oBAAA,gBAAwBC,cAAM,CAACC,OAAO,cACrED,cAAM,CAACE,aAAa,CAACP,aAAa,CAAC,EAClCQ,KAAK,IACJA,KAAK,CAACC,IAAI,KAAK,MAAM,GACjBJ,cAAM,CAACK,IAAI,GACXL,cAAM,CAACM,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":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.makeContractStore = void 0;
|
|
7
7
|
var _effect = require("effect");
|
|
8
|
+
var _AppendIsOwned = require("./AppendIsOwned.js");
|
|
8
9
|
var _Event = require("./Event.js");
|
|
9
10
|
var _Query = require("./Query.js");
|
|
10
11
|
/** Decode an unknown limit through `ReadLimit`, dying on a defect-worthy value. */
|
|
@@ -23,7 +24,16 @@ const makeContractStore = raw => ({
|
|
|
23
24
|
// Infrastructure faults are defects, not contract values.
|
|
24
25
|
return _effect.Effect.orDie(raw.read(query, options));
|
|
25
26
|
}),
|
|
26
|
-
append: (events, condition) =>
|
|
27
|
+
append: (events, condition) =>
|
|
28
|
+
// The ownership refusal runs FIRST and sits OUTSIDE the suspend, because it is
|
|
29
|
+
// the only one of append's four checks that is EFFECTFUL: it consults a
|
|
30
|
+
// `Context.Tag` rather than inspecting the arguments. `Effect.flatMap` over an
|
|
31
|
+
// already-lazy effect defers it exactly as the suspend defers the throws below,
|
|
32
|
+
// so nothing runs at the call site either way; what it buys is that the
|
|
33
|
+
// "you are inside a bracket" defect arrives before any argument is judged, which
|
|
34
|
+
// is the order a reader expects when both are wrong at once. `AppendIsOwned.ts`
|
|
35
|
+
// owns why the concept is in core at all.
|
|
36
|
+
_effect.Effect.flatMap(_AppendIsOwned.assertAppendNotOwned, () => _effect.Effect.suspend(() => {
|
|
27
37
|
// An EMPTY batch is a plain-data caller bypassing the
|
|
28
38
|
// `NonEmptyReadonlyArray` type: there is nothing to append. The engines
|
|
29
39
|
// diverge on it at an unchecked boundary — Postgres inserts zero rows and
|
|
@@ -65,7 +75,7 @@ const makeContractStore = raw => ({
|
|
|
65
75
|
// narrows the raw `AppendConditionFailed | E` to the contract's single
|
|
66
76
|
// error, which is what keeps `append` at `E = AppendConditionFailed`.
|
|
67
77
|
return _effect.Effect.catchAll(raw.append(events, condition), error => _effect.Predicate.isTagged('AppendConditionFailed')(error) ? _effect.Effect.fail(error) : _effect.Effect.die(error));
|
|
68
|
-
}),
|
|
78
|
+
})),
|
|
69
79
|
subscribe: (query, after) =>
|
|
70
80
|
// `Effect.sync` runs when the stream is executed; a throw from
|
|
71
81
|
// `assertServableQuery` becomes a stream defect (identical rule to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractStore.js","names":["_effect","require","_Event","_Query","decodeReadLimit","Schema","decodeUnknownSync","ReadLimit","makeContractStore","raw","read","query","options","Effect","suspend","assertServableQuery","limit","undefined","orDie","append","events","condition","length","Error","failIfEventsMatch","catchAll","error","Predicate","isTagged","fail","die","subscribe","after","Stream","unwrap","sync","exports"],"sources":["../../src/ContractStore.ts"],"sourcesContent":[null],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ContractStore.js","names":["_effect","require","_AppendIsOwned","_Event","_Query","decodeReadLimit","Schema","decodeUnknownSync","ReadLimit","makeContractStore","raw","read","query","options","Effect","suspend","assertServableQuery","limit","undefined","orDie","append","events","condition","flatMap","assertAppendNotOwned","length","Error","failIfEventsMatch","catchAll","error","Predicate","isTagged","fail","die","subscribe","after","Stream","unwrap","sync","exports"],"sources":["../../src/ContractStore.ts"],"sourcesContent":[null],"mappings":";;;;;;AAmCA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AAEA;AACA,MAAMI,eAAe,gBAAGC,cAAM,CAACC,iBAAiB,CAACC,gBAAS,CAAC;AAw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AAC,CAAC,CACH;EAEHK,SAAS,EAAEA,CAACtB,KAAK,EAAEuB,KAAK;EACtB;EACA;EACA;EACA;EACAC,cAAM,CAACC,MAAM,CACXvB,cAAM,CAACwB,IAAI,CAAC,MAAK;IACf,IAAAtB,0BAAmB,EAACJ,KAAK,CAAC;IAC1B,OAAOwB,cAAM,CAACjB,KAAK,CAACT,GAAG,CAACwB,SAAS,CAACtB,KAAK,EAAEuB,KAAK,CAAC,CAAC;EAClD,CAAC,CAAC;CAEP,CAAC;AAAAI,OAAA,CAAA9B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
package/dist/cjs/Projection.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.composeProjections = exports.AnyProjection = void 0;
|
|
6
|
+
exports.unionQueries = exports.composeProjections = exports.AnyProjection = void 0;
|
|
7
7
|
var _Query = require("./Query.js");
|
|
8
8
|
// The wildcard query, built directly (not via the public `query` surface).
|
|
9
9
|
// Decision-model composition assembles `Query` values from plain data because
|
|
@@ -33,6 +33,22 @@ const mergeQuery = (left, right) => {
|
|
|
33
33
|
items: [...left.items, ...right.items]
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* OR-merge a list of queries into one. The empty list is the wildcard.
|
|
38
|
+
*
|
|
39
|
+
* The same merge `composeProjections` folds its record through, reachable
|
|
40
|
+
* WITHOUT a record — which is what a caller accumulating queries rather than
|
|
41
|
+
* projections needs, and the codec's read ledger is one. Without it that caller
|
|
42
|
+
* either hand-rolls the merge, or fabricates a projection per query to reach this
|
|
43
|
+
* one; both were tried and the first is a TRAP. An empty `items` is the WILDCARD
|
|
44
|
+
* and is absorbing under OR, while spreading an empty list contributes nothing, so
|
|
45
|
+
* a hand-rolled union silently narrows a match-everything query to its siblings —
|
|
46
|
+
* in the unsafe direction, and with nothing to notice.
|
|
47
|
+
*
|
|
48
|
+
* Seeding the fold with the wildcard would swallow everything for the same reason,
|
|
49
|
+
* so the list is reduced with no seed and the empty case answers directly.
|
|
50
|
+
*/
|
|
51
|
+
const unionQueries = queries => queries.length === 0 ? WILDCARD : queries.reduce((acc, q) => mergeQuery(acc, q));
|
|
36
52
|
/**
|
|
37
53
|
* Compose named projections into one whose state is a record of sub-states and
|
|
38
54
|
* whose query is the OR-merge of all sub-queries. Each sub-projection only
|
|
@@ -44,13 +60,11 @@ const mergeQuery = (left, right) => {
|
|
|
44
60
|
* check): an in-place-mutating fold that returns the same reference would
|
|
45
61
|
* otherwise be silently dropped. At decision-model scale the extra copy is nil.
|
|
46
62
|
*/
|
|
63
|
+
exports.unionQueries = unionQueries;
|
|
47
64
|
const composeProjections = projections => {
|
|
48
65
|
const keys = Object.keys(projections);
|
|
49
66
|
const initialState = Object.fromEntries(keys.map(key => [key, projections[key].initialState]));
|
|
50
|
-
|
|
51
|
-
// treats an empty-items query as a wildcard), so fold the sub-queries
|
|
52
|
-
// directly with no seed.
|
|
53
|
-
const mergedQuery = keys.length === 0 ? WILDCARD : keys.map(key => projections[key].query).reduce((acc, q) => mergeQuery(acc, q));
|
|
67
|
+
const mergedQuery = unionQueries(keys.map(key => projections[key].query));
|
|
54
68
|
return {
|
|
55
69
|
initialState,
|
|
56
70
|
query: mergedQuery,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Projection.js","names":["_Query","require","WILDCARD","items","AnyProjection","exports","of","projection","mergeQuery","left","right","length","composeProjections","projections","keys","Object","initialState","fromEntries","map","key","mergedQuery","query","
|
|
1
|
+
{"version":3,"file":"Projection.js","names":["_Query","require","WILDCARD","items","AnyProjection","exports","of","projection","mergeQuery","left","right","length","unionQueries","queries","reduce","acc","q","composeProjections","projections","keys","Object","initialState","fromEntries","map","key","mergedQuery","query","evolve","state","decoded","next","matchesSequenced","sequenced"],"sources":["../../src/Projection.ts"],"sourcesContent":[null],"mappings":";;;;;;AA4BA,IAAAA,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AK,EAAED,WAAW;IAClBE,MAAM,EAAEA,CAACC,KAAK,EAAEC,OAAO,KAAI;MACzB,MAAMC,IAAI,GAAG;QAAE,GAAGF;MAAK,CAAuC;MAC9D,KAAK,MAAMJ,GAAG,IAAIL,IAAI,EAAE;QACtB,MAAMZ,UAAU,GAAGW,WAAW,CAACM,GAAG,CAAC;QACnC,IAAI,CAAC,IAAAO,uBAAgB,EAACF,OAAO,CAACG,SAAS,EAAEzB,UAAU,CAACmB,KAAK,CAAC,EAAE;UAC1D;QACF;QACAI,IAAI,CAACN,GAAG,CAAC,GAAGjB,UAAU,CAACoB,MAAM,CAACC,KAAK,CAACJ,GAAG,CAAC,EAAEK,OAAO,CAEhD;MACH;MACA,OAAOC,IAAI;IACb;GACD;AACH,CAAC;AAAAzB,OAAA,CAAAY,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/dist/cjs/Query.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.query = exports.matchesSequenced = exports.matchesQueryItem = exports.matchesQuery = exports.classifyServableQuery = exports.assertServableQuery = exports.QueryItem = exports.Query = void 0;
|
|
6
|
+
exports.servableQueryFault = exports.query = exports.matchesSequenced = exports.matchesQueryItem = exports.matchesQuery = exports.classifyServableQuery = exports.assertServableQuery = exports.QueryItem = exports.Query = void 0;
|
|
7
7
|
var _effect = require("effect");
|
|
8
8
|
var _Event = require("./Event.js");
|
|
9
9
|
/**
|
|
@@ -98,19 +98,49 @@ const matchesSequenced = (sequenced, query) => matchesQuery(sequenced.event, que
|
|
|
98
98
|
*/
|
|
99
99
|
exports.matchesSequenced = matchesSequenced;
|
|
100
100
|
const assertServableQuery = query => {
|
|
101
|
+
const fault = servableQueryFault(query);
|
|
102
|
+
if (fault !== undefined) {
|
|
103
|
+
throw new Error(fault);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The servable grammar as a TOTAL function: the reason `query` cannot be served,
|
|
108
|
+
* or `undefined` when it can.
|
|
109
|
+
*
|
|
110
|
+
* The same rule as `assertServableQuery` above and NOT a second statement of it —
|
|
111
|
+
* that function is this one plus a throw, so the grammar is defined once and the
|
|
112
|
+
* two differ only in DISPOSITION. A store boundary wants the defect, because a
|
|
113
|
+
* non-servable query there is a programming error with no recovery; a caller that
|
|
114
|
+
* can still act on the answer wants a value, and the codec's read ledger is one:
|
|
115
|
+
* it asks whether a hop it is about to record would make the accumulated union
|
|
116
|
+
* unservable, and refuses on the error channel BEFORE the read is paid for.
|
|
117
|
+
*
|
|
118
|
+
* The alternative was for that caller to re-derive the rule, and it was tried:
|
|
119
|
+
* the codec's own copy tested each recorded query separately, which silently
|
|
120
|
+
* admitted a FIRST hop composed of two tagless slices — a multi-item query, and
|
|
121
|
+
* unservable, dying at the store one layer away. A grammar with two homes drifts
|
|
122
|
+
* at exactly the shapes neither author had in mind. The shape here is the read
|
|
123
|
+
* side's own (`projectionWiringFault` returns `string | undefined` for the same
|
|
124
|
+
* reason), so a fault is one exit route and one return type.
|
|
125
|
+
*/
|
|
126
|
+
exports.assertServableQuery = assertServableQuery;
|
|
127
|
+
const servableQueryFault = query => {
|
|
101
128
|
const {
|
|
102
129
|
items
|
|
103
130
|
} = query;
|
|
104
131
|
// Wildcard and single-item queries are always servable.
|
|
105
132
|
if (items.length <= 1) {
|
|
106
|
-
return;
|
|
133
|
+
return undefined;
|
|
107
134
|
}
|
|
108
135
|
// A multi-item query is servable only if every item is tagged; a tagless
|
|
109
136
|
// (type-only) item mixed with tagged items cannot ride a single index.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
// The `assertServableQuery:` prefix is part of the MESSAGE and not something the
|
|
138
|
+
// throw adds, so both dispositions emit byte-identical text. It names the rule in
|
|
139
|
+
// the vocabulary a store rejects in, which is what lets the read side's wiring gate
|
|
140
|
+
// report a violation in the same words a store would — an author who meets it in
|
|
141
|
+
// both places meets it once. Building it here is also what stops a second caller
|
|
142
|
+
// re-deriving the prefix to match.
|
|
143
|
+
return items.some(item => item.tags.length === 0) ? 'assertServableQuery: a multi-item query must have every item carry at ' + 'least one tag; a type-only item mixed with tagged items is not servable' : undefined;
|
|
114
144
|
};
|
|
115
145
|
/**
|
|
116
146
|
* Classify a servable `Query` into the shape that serves it.
|
|
@@ -143,7 +173,7 @@ const assertServableQuery = query => {
|
|
|
143
173
|
* construction would have been deletable by anyone tidying what looks like a
|
|
144
174
|
* redundant check on a list that "obviously" has types in it.
|
|
145
175
|
*/
|
|
146
|
-
exports.
|
|
176
|
+
exports.servableQueryFault = servableQueryFault;
|
|
147
177
|
const classifyServableQuery = query => {
|
|
148
178
|
if (query.items.length === 0) {
|
|
149
179
|
return {
|
package/dist/cjs/Query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","names":["_effect","require","_Event","QueryItem","exports","Schema","Struct","types","Array","EventType","tags","Tag","Query","items","matchesQueryItem","event","item","typeOk","length","includes","type","eventTags","Set","every","tag","has","matchesQuery","query","some","matchesSequenced","sequenced","assertServableQuery","
|
|
1
|
+
{"version":3,"file":"Query.js","names":["_effect","require","_Event","QueryItem","exports","Schema","Struct","types","Array","EventType","tags","Tag","Query","items","matchesQueryItem","event","item","typeOk","length","includes","type","eventTags","Set","every","tag","has","matchesQuery","query","some","matchesSequenced","sequenced","assertServableQuery","fault","servableQueryFault","undefined","Error","classifyServableQuery","kind","only","Arr","isNonEmptyReadonlyArray","fields","all","or"],"sources":["../../src/Query.ts"],"sourcesContent":[null],"mappings":";;;;;;AAwBA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAzBA;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;AAIO,MAAME,SAAS,GAAAC,OAAA,CAAAD,SAAA,gBAAGE,cAAM,CAACC,MAAM,CAAC;EACrCC,KAAK,eAA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E+B,IAAI,CAAC/B;IAAK,CAAE,GACvC;MAAE8B,IAAI,EAAE;IAAU,CAAE;EAC1B;EACA,OAAO;IAAEA,IAAI,EAAE;EAAQ,CAAE;AAC3B,CAAC;AAED;AAEA;;;;;;AAAAjC,OAAA,CAAAgC,qBAAA,GAAAA,qBAAA;AAMA,MAAMpB,IAAI,GAAIyB,MAGb,KAAiB;EAChBlC,KAAK,EAAEkC,MAAM,CAAClC,KAAK,IAAI,EAAE;EACzBG,IAAI,EAAE+B,MAAM,CAAC/B;CACd,CAAC;AAEF;AACA,MAAMgC,GAAG,GAAGA,CAAA,MAAc;EAAE7B,KAAK,EAAE;AAAE,CAAE,CAAC;AAExC;;;;AAIA,MAAMH,IAAI,GAAGA,CACXA,IAA2C,EAC3CH,KAAgC,MACrB;EACXM,KAAK,EAAE,CAACG,IAAI,CAAC;IAAEN,IAAI;IAAE,IAAIH,KAAK,KAAK2B,SAAS,GAAG,EAAE,GAAG;MAAE3B;IAAK,CAAE;EAAC,CAAE,CAAC;CAClE,CAAC;AAEF;;;;;AAKA,MAAMA,KAAK,GACTA,KAAwD,KAC7C;EAAEM,KAAK,EAAE,CAAC;IAAEN,KAAK;IAAEG,IAAI,EAAE;EAAE,CAAE;AAAC,CAAE,CAAC;AAE9C;;;;;AAKA,MAAMiC,EAAE,GACN9B,KAAwD,KAC7C;EACXA;CACD,CAAC;AAEF;AACO,MAAMc,KAAK,GAAAvB,OAAA,CAAAuB,KAAA,GAAG;EACnBe,GAAG;EACH1B,IAAI;EACJ2B,EAAE;EACFjC,IAAI;EACJH;CACQ","ignoreList":[]}
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,6 +24,18 @@ Object.keys(_AppendCondition).forEach(function (key) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
+
var _AppendIsOwned = require("./AppendIsOwned.js");
|
|
28
|
+
Object.keys(_AppendIsOwned).forEach(function (key) {
|
|
29
|
+
if (key === "default" || key === "__esModule") return;
|
|
30
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
|
+
if (key in exports && exports[key] === _AppendIsOwned[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _AppendIsOwned[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
27
39
|
var _ContractStore = require("./ContractStore.js");
|
|
28
40
|
Object.keys(_ContractStore).forEach(function (key) {
|
|
29
41
|
if (key === "default" || key === "__esModule") return;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_AppendCondition","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ContractStore","_DcbEventStore","_Event","_errors","_inMemory","_Projection","_Query","_retryOnConflict","_SubscribeMachine"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_AppendCondition","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_AppendIsOwned","_ContractStore","_DcbEventStore","_Event","_errors","_inMemory","_Projection","_Query","_retryOnConflict","_SubscribeMachine"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AA4BA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA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CAAAjB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAkB,iBAAA,GAAAtB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAoB,iBAAA,EAAAnB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAkB,iBAAA,CAAAlB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAU,iBAAA,CAAAlB,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `AppendIsOwned` — the marker saying *"an append is already owned here"*, and the
|
|
3
|
+
* check that refuses a second one.
|
|
4
|
+
*
|
|
5
|
+
* ## Why a write-side concept core does not need for its own job lives in core
|
|
6
|
+
*
|
|
7
|
+
* A bracket that derives one `AppendCondition` from every read its body performed
|
|
8
|
+
* (`@kairos-es/codec`'s `transact`) owns exactly one append: the one it issues at
|
|
9
|
+
* close, under that derived condition. Any OTHER append inside that body is a
|
|
10
|
+
* wiring mistake, and the dangerous case is not the one that looks dangerous. A
|
|
11
|
+
* command runner appending mid-body usually writes into the very slice the body
|
|
12
|
+
* read, so its events match the union the bracket is about to guard on — and the
|
|
13
|
+
* bracket's own closing append is then refused by a condition its own body
|
|
14
|
+
* invalidated. The failure arrives at the wrong line, describing a conflict that
|
|
15
|
+
* was self-inflicted.
|
|
16
|
+
*
|
|
17
|
+
* The refusal therefore has to catch a RAW `store.append` and not merely a nested
|
|
18
|
+
* bracket, which is what puts it here rather than in the codec. Enforcing it one
|
|
19
|
+
* layer up would catch a nested bracket and a command runner and miss a direct
|
|
20
|
+
* store call — and a syntactic lint rule cannot close that gap either, having no
|
|
21
|
+
* call graph, so an append one function away in a helper is invisible to both.
|
|
22
|
+
* `makeContractStore` is the one seam every engine's append already passes
|
|
23
|
+
* through, so the check is written once and inherited whole, exactly as
|
|
24
|
+
* `assertServableQuery` is.
|
|
25
|
+
*
|
|
26
|
+
* The cost is real and is accepted: core learns a concept it does not need for its
|
|
27
|
+
* own job. It is affordable because core already owns the write contract, and
|
|
28
|
+
* *"an append is already owned"* is a write-side fact about that contract rather
|
|
29
|
+
* than a fact about the codec.
|
|
30
|
+
*
|
|
31
|
+
* ## Present means refused, so a sanctioned append REMOVES the marker
|
|
32
|
+
*
|
|
33
|
+
* The check reads the tag through `Effect.serviceOption`, so its ABSENCE is the
|
|
34
|
+
* normal case and costs the `append` signature nothing — `DcbEventStore.append`
|
|
35
|
+
* keeps `R = never` and no caller provides anything. Presence is what refuses.
|
|
36
|
+
*
|
|
37
|
+
* That shape decides how the two legitimate appends inside a bracket get through,
|
|
38
|
+
* and there is only one route: run with the marker STRIPPED from the context
|
|
39
|
+
* (`Effect.mapInputContext` over `Context.omit(AppendIsOwned)`). The bracket's own
|
|
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 tag, a
|
|
42
|
+
* sanctioning flag or a mutable cell, and there is no way to be exempt by
|
|
43
|
+
* accident: an append is either lexically outside the marked region or it says in
|
|
44
|
+
* as many words that it is removing the marker.
|
|
45
|
+
*/
|
|
46
|
+
import { Context, Effect } from 'effect';
|
|
47
|
+
declare const AppendIsOwned_base: Context.TagClass<AppendIsOwned, "@kairos-es/core/AppendIsOwned", {
|
|
48
|
+
readonly by: string;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Marks that an append is already owned by an enclosing bracket, and names what
|
|
52
|
+
* owns it.
|
|
53
|
+
*
|
|
54
|
+
* `by` is a human-readable owner name and exists for the defect message alone —
|
|
55
|
+
* the refusal is decided by the tag's PRESENCE, never by this value, so nothing
|
|
56
|
+
* branches on it and no caller need agree on a vocabulary for it.
|
|
57
|
+
*/
|
|
58
|
+
export declare class AppendIsOwned extends AppendIsOwned_base {
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Die if an append is already owned here; do nothing otherwise.
|
|
62
|
+
*
|
|
63
|
+
* A DEFECT and not an error-channel value, deliberately. There is no
|
|
64
|
+
* data-dependent recovery from it: the events this append would have written
|
|
65
|
+
* belong to a bracket that is going to write its own, so no caller could sensibly
|
|
66
|
+
* catch it and carry on. It is the same class of fault as a non-servable query,
|
|
67
|
+
* and it is refused in the same place and in the same way. The remedy is one
|
|
68
|
+
* identifier away in every case — the codec's `decideOnly` for a command runner,
|
|
69
|
+
* its escape hatch for a deliberate second append — which is what makes a defect
|
|
70
|
+
* affordable here.
|
|
71
|
+
*
|
|
72
|
+
* `Effect.serviceOption` is what keeps this free: it reads the tag if present and
|
|
73
|
+
* adds NOTHING to the requirement channel, so every existing append is unchanged
|
|
74
|
+
* and unprovisioned.
|
|
75
|
+
*/
|
|
76
|
+
export declare const assertAppendNotOwned: Effect.Effect<void>;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=AppendIsOwned.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppendIsOwned.d.ts","sourceRoot":"","sources":["../../src/AppendIsOwned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;;iBAYvB,MAAM;;AAVvB;;;;;;;GAOG;AACH,qBAAa,aAAc,SAAQ,kBAGhC;CAAG;AAEN;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAepD,CAAA"}
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
* `E = never` on the contract, so a raw fault is a defect, not a channel value;
|
|
20
20
|
* - the `AppendConditionFailed`-else-die classification on append, matched by
|
|
21
21
|
* `_tag` and never by class identity — ONLY the contract conflict rides the
|
|
22
|
-
* error channel; every other fault is a defect
|
|
22
|
+
* error channel; every other fault is a defect;
|
|
23
|
+
* - `assertAppendNotOwned` on append — an append inside a bracket that already
|
|
24
|
+
* owns one is a DEFECT. Read `AppendIsOwned.ts` for the rule and for why a
|
|
25
|
+
* write-side concept core does not need for its own job is enforced here.
|
|
23
26
|
*
|
|
24
27
|
* The throws are deferred into the returned Effect/Stream (via `Effect.suspend`
|
|
25
28
|
* / `Effect.sync`), so a validation failure surfaces as a DEFECT WHEN THE EFFECT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContractStore.d.ts","sourceRoot":"","sources":["../../src/ContractStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ContractStore.d.ts","sourceRoot":"","sources":["../../src/ContractStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,OAAO,KAAK,EAAE,KAAK,IAAI,GAAG,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,MAAM,EAAqB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC/E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAEjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AACrD,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAKzD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,QAAQ,CAAC,IAAI,EAAE,CACb,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,WAAW,KAClB,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,CACf,MAAM,EAAE,GAAG,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAC3C,SAAS,CAAC,EAAE,eAAe,KACxB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,qBAAqB,GAAG,CAAC,CAAC,CAAA;IACvD,QAAQ,CAAC,SAAS,EAAE,CAClB,KAAK,EAAE,KAAK,EACZ,KAAK,CAAC,EAAE,QAAQ,KACb,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;CACnD;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,CAAC,EACjC,KAAK,gBAAgB,CAAC,CAAC,CAAC,KACvB,aAAa,CAAC,MAAM,CAsFrB,CAAA"}
|
package/dist/dts/Projection.d.ts
CHANGED
|
@@ -93,6 +93,22 @@ export type StateOf<P> = P extends AnyProjection<infer S> ? S : never;
|
|
|
93
93
|
export type CompositeState<T extends Record<string, AnyProjection>> = {
|
|
94
94
|
readonly [K in keyof T]: StateOf<T[K]>;
|
|
95
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* OR-merge a list of queries into one. The empty list is the wildcard.
|
|
98
|
+
*
|
|
99
|
+
* The same merge `composeProjections` folds its record through, reachable
|
|
100
|
+
* WITHOUT a record — which is what a caller accumulating queries rather than
|
|
101
|
+
* projections needs, and the codec's read ledger is one. Without it that caller
|
|
102
|
+
* either hand-rolls the merge, or fabricates a projection per query to reach this
|
|
103
|
+
* one; both were tried and the first is a TRAP. An empty `items` is the WILDCARD
|
|
104
|
+
* and is absorbing under OR, while spreading an empty list contributes nothing, so
|
|
105
|
+
* a hand-rolled union silently narrows a match-everything query to its siblings —
|
|
106
|
+
* in the unsafe direction, and with nothing to notice.
|
|
107
|
+
*
|
|
108
|
+
* Seeding the fold with the wildcard would swallow everything for the same reason,
|
|
109
|
+
* so the list is reduced with no seed and the empty case answers directly.
|
|
110
|
+
*/
|
|
111
|
+
export declare const unionQueries: (queries: ReadonlyArray<Query>) => Query;
|
|
96
112
|
/**
|
|
97
113
|
* Compose named projections into one whose state is a record of sub-states and
|
|
98
114
|
* whose query is the OR-merge of all sub-queries. Each sub-projection only
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Projection.d.ts","sourceRoot":"","sources":["../../src/Projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAWpC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAA;IAClC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,KAAK,CAAC,CAAA;CACtD;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO;IAC5C,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAA;CAClE;AAED,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;kBACE,CAAC,cAAc,UA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,CAAC,CAAC,GAAG,OAAO;IAC5C,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAA;CAClE;AAED,eAAO,MAAM,aAAa;IACxB;;;;;;OAMG;kBACE,CAAC,cAAc,UAAU,CAAC,CAAC,CAAC,KAAG,aAAa,CAAC,CAAC,CAAC;CAE5C,CAAA;AAEV,oDAAoD;AACpD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI;IACpE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAA;AAUD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,aAAa,CAAC,KAAK,CAAC,KAAG,KAGT,CAAA;AAEpD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACxE,aAAa,CAAC,KACb,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CA0B9B,CAAA"}
|
package/dist/dts/Query.d.ts
CHANGED
|
@@ -81,6 +81,27 @@ export declare const matchesSequenced: (sequenced: SequencedEvent, query: Query)
|
|
|
81
81
|
* engine" behaviour.
|
|
82
82
|
*/
|
|
83
83
|
export declare const assertServableQuery: (query: Query) => void;
|
|
84
|
+
/**
|
|
85
|
+
* The servable grammar as a TOTAL function: the reason `query` cannot be served,
|
|
86
|
+
* or `undefined` when it can.
|
|
87
|
+
*
|
|
88
|
+
* The same rule as `assertServableQuery` above and NOT a second statement of it —
|
|
89
|
+
* that function is this one plus a throw, so the grammar is defined once and the
|
|
90
|
+
* two differ only in DISPOSITION. A store boundary wants the defect, because a
|
|
91
|
+
* non-servable query there is a programming error with no recovery; a caller that
|
|
92
|
+
* can still act on the answer wants a value, and the codec's read ledger is one:
|
|
93
|
+
* it asks whether a hop it is about to record would make the accumulated union
|
|
94
|
+
* unservable, and refuses on the error channel BEFORE the read is paid for.
|
|
95
|
+
*
|
|
96
|
+
* The alternative was for that caller to re-derive the rule, and it was tried:
|
|
97
|
+
* the codec's own copy tested each recorded query separately, which silently
|
|
98
|
+
* admitted a FIRST hop composed of two tagless slices — a multi-item query, and
|
|
99
|
+
* unservable, dying at the store one layer away. A grammar with two homes drifts
|
|
100
|
+
* at exactly the shapes neither author had in mind. The shape here is the read
|
|
101
|
+
* side's own (`projectionWiringFault` returns `string | undefined` for the same
|
|
102
|
+
* reason), so a fault is one exit route and one return type.
|
|
103
|
+
*/
|
|
104
|
+
export declare const servableQueryFault: (query: Query) => string | undefined;
|
|
84
105
|
/**
|
|
85
106
|
* The three shapes a servable query is SERVED by, and therefore the only three an
|
|
86
107
|
* engine's plan compiler dispatches over: the wildcard, a single type-only item,
|
package/dist/dts/Query.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../src/Query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAE5E;;;GAGG;AACH,eAAO,MAAM,SAAS;;;EAGpB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C,i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ANGED
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Exposes the domain types (`DcbEvent`, `SequencedEvent`, `Position`, `Tag`,
|
|
6
6
|
* `EventType`), the selection language (`Query`, `QueryItem`, the pure match
|
|
7
|
-
* predicate + smart constructors,
|
|
8
|
-
*
|
|
9
|
-
* `
|
|
7
|
+
* predicate + smart constructors, the servable grammar in both its dispositions —
|
|
8
|
+
* `assertServableQuery`'s throw and `servableQueryFault`'s total `string |
|
|
9
|
+
* undefined` — and the servable-shape dispatch every engine compiles its plans
|
|
10
|
+
* through), the `AppendCondition`, tagged errors, the
|
|
11
|
+
* `DcbEventStore` contract, `AppendIsOwned` and the refusal every engine's `append`
|
|
12
|
+
* inherits from it, the in-memory layer, the shared subscribe machine
|
|
10
13
|
* every engine's `subscribe` is built from (`SubscribeMachine.ts`), the pure
|
|
11
|
-
* projection primitives (`Projection`, `DecodedEvent`, `composeProjections`
|
|
14
|
+
* projection primitives (`Projection`, `DecodedEvent`, `composeProjections` and the
|
|
15
|
+
* `unionQueries` its query merge is reachable through without a record), and
|
|
12
16
|
* `retryOnConflict`.
|
|
13
17
|
*
|
|
14
18
|
* Core keeps only the *pure* fold: projections fold an already-`DecodedEvent`
|
|
@@ -23,6 +27,7 @@
|
|
|
23
27
|
* write-only consumer depend on a package it uses nothing else of (ADR-0008).
|
|
24
28
|
*/
|
|
25
29
|
export * from './AppendCondition.js';
|
|
30
|
+
export * from './AppendIsOwned.js';
|
|
26
31
|
export * from './ContractStore.js';
|
|
27
32
|
export * from './DcbEventStore.js';
|
|
28
33
|
export * from './Event.js';
|
package/dist/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AAIxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAClD,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA"}
|