@kairos-es/read 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 CHANGED
@@ -325,7 +325,9 @@ at all. `modelAtHead` from `@kairos-es/codec` reads the log at query time and is
325
325
  consistent as of the `head` its read returned, which makes it MORE current than any
326
326
  maintained view of the same slices — a maintained view is consistent as of a
327
327
  checkpoint that trails that head. No table, no checkpoint, no runner, and no rung
328
- of the construction gate applies to it.
328
+ of the construction gate applies to it. ⚠ Its error channel carries
329
+ `TaglessSliceInLedger`, raised when a slice built without tags would be unioned with
330
+ another inside a `transact` bracket — see `@kairos-es/codec`.
329
331
 
330
332
  All three over one course's roster:
331
333
  [`examples/course-subscriptions/src/courseRosterMaterialisations.ts`](../../examples/course-subscriptions/src/courseRosterMaterialisations.ts),
@@ -142,7 +142,7 @@ var _EventLogDurability = require("./EventLogDurability.js");
142
142
  * options literal, a smaller and more local mistake than picking the wrong pair
143
143
  * of layers.
144
144
  * 4. **The store's own servable grammar**, once over the SHARED composed query,
145
- * reported in the STORE's vocabulary by `core`'s own `assertServableQuery`.
145
+ * reported in the STORE's vocabulary by `core`'s own servable-query grammar.
146
146
  * 5. **The read side's stricter per-slice tag rule**, once over the SHARED slice
147
147
  * record, and it MUST stay after (4): it catches only what that grammar admits,
148
148
  * since a lone type-only item is servable. Were it first, a tagless-plus-tagged
@@ -327,7 +327,7 @@ const tuningFault = tuning => {
327
327
  * `undefined` when the store would serve it, otherwise `core`'s own sentence about
328
328
  * why it would not.
329
329
  *
330
- * ## Why `core`'s `assertServableQuery` and not a predicate of our own
330
+ * ## Why `core`'s grammar and not a predicate of our own
331
331
  *
332
332
  * It is the very function every engine applies inside `read`/`subscribe`/`append`,
333
333
  * so calling it is what makes ONE grammar rather than two that agree until one is
@@ -339,31 +339,25 @@ const tuningFault = tuning => {
339
339
  * once the breaker trips on a checkpoint that never moved — several backoff sleeps
340
340
  * later, describing a stall rather than the mis-built slice that caused it.
341
341
  *
342
- * ## Why the THROW is converted rather than propagated
343
- *
344
- * `assertServableQuery` throws, because its own callers are store methods where a
345
- * throw inside an `Effect` is already the defect it should be. Here it is one of
346
- * five rules whose results compose, so letting it throw would give this gate two
347
- * exit routes — a returned sentence for four rules and an exception for the
348
- * fifth — and every caller would then need both a `??` chain and a `try`. Catching
349
- * it keeps ONE exit route, and the caller keeps one `Effect.die`.
350
- *
351
- * The message is passed through VERBATIM, which is the point of the conversion
352
- * rather than a detail of it: the violation goes on being reported in the store's
353
- * vocabulary, in the same words the same rule produces when a store rejects the
354
- * same query, so an author who meets it twice meets it once. The `instanceof`
355
- * fallback is for the shape of the contract rather than for anything observed —
356
- * `throw` admits any value, and `String(error)` is the honest reading of one this
357
- * module cannot inspect.
342
+ * ## Why core's TOTAL form is called rather than its throwing one
343
+ *
344
+ * The grammar has two dispositions and core owns both: `assertServableQuery`
345
+ * throws, because its own callers are store methods where a throw inside an
346
+ * `Effect` is already the defect it should be, and `servableQueryFault` returns the
347
+ * sentence, for a caller that can still act on it. Here it is one of five rules
348
+ * whose results compose, so a throw would give this gate two exit routes — a
349
+ * returned sentence for four rules and an exception for the fifth — and every
350
+ * caller would need both a `??` chain and a `try`. The total form keeps ONE exit
351
+ * route, and the caller keeps one `Effect.die`.
352
+ *
353
+ * This used to convert the throw here, with a `try`/`catch` and an `instanceof`
354
+ * fallback, which was a THIRD statement of a rule that must have one home — and,
355
+ * once core's total form existed, a private symbol of the same name and meaning
356
+ * sitting beside the public one. The message is core's either way, so the violation
357
+ * goes on being reported in the store's own vocabulary and an author who meets it
358
+ * twice meets it once.
358
359
  */
359
- const servableQueryFault = wiring => {
360
- try {
361
- (0, _core.assertServableQuery)(wiring.query);
362
- return undefined;
363
- } catch (error) {
364
- return error instanceof Error ? error.message : String(error);
365
- }
366
- };
360
+ const servableSliceQueryFault = wiring => (0, _core.servableQueryFault)(wiring.query);
367
361
  /**
368
362
  * The read side's OWN per-slice rule: `undefined` when every slice carries at least
369
363
  * one tag, otherwise the sentence naming the first slice that does not.
@@ -436,7 +430,7 @@ const perEntry = (entries, rule) => {
436
430
  const projectionWiringFault = wiring => materialisationCollisionFault(wiring) ?? perEntry(wiring.materialisations, entry => (0, _EventLogDurability.durabilityOrderingFault)({
437
431
  eventLogDurability: wiring.eventLogDurability,
438
432
  viewDurability: entry.viewDurability
439
- })) ?? perEntry(wiring.materialisations, tuningFault) ?? servableQueryFault(wiring) ?? taglessSliceFault(wiring);
433
+ })) ?? perEntry(wiring.materialisations, tuningFault) ?? servableSliceQueryFault(wiring) ?? taglessSliceFault(wiring);
440
434
  /**
441
435
  * The SET-LEVEL rung: `undefined` when no two materialisations of one read model
442
436
  * would fight over one cursor, otherwise the sentence naming the offending pair and
@@ -1 +1 @@
1
- {"version":3,"file":"projectionWiringFault.js","names":["_core","require","_effect","_EventLogDurability","positiveFiniteDuration","name","input","role","decoded","Duration","decodeUnknown","Option","isNone","Either","left","String","isFinite","value","isZero","right","MIS_TUNED","tuningFault","tuning","checked","all","batchWindow","restartMinDelay","restartMaxDelay","restartResetAfter","isLeft","greaterThan","format","undefined","servableQueryFault","wiring","assertServableQuery","query","error","Error","message","taglessSliceFault","slice","Object","entries","slices","untagged","items","length","some","item","tags","perEntry","rule","index","fault","projectionWiringFault","materialisationCollisionFault","materialisations","entry","durabilityOrderingFault","eventLogDurability","viewDurability","exports","one","other","cursorIdentity","key","projection","partition"],"sources":["../../src/projectionWiringFault.ts"],"sourcesContent":[null],"mappings":";;;;;;AA4LA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AA9LA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,2BAA2B,GACzE,mEAAmE,GACnE,uEAAuE,GACvE,kEAAkE,GAClE,qEAAqE,GACrE,2DAA2D,GAC3D,wEAAwE,GACxE,uEAAuE,GACvE,sEAAsE,GACtE,yEAAyE,GACzE,iEAAiE,GACjE,mEAAmE,GACnE,oBAAoB;MAExB;IACF;EACF;EACA,OAAOpC,SAAS;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"projectionWiringFault.js","names":["_core","require","_effect","_EventLogDurability","positiveFiniteDuration","name","input","role","decoded","Duration","decodeUnknown","Option","isNone","Either","left","String","isFinite","value","isZero","right","MIS_TUNED","tuningFault","tuning","checked","all","batchWindow","restartMinDelay","restartMaxDelay","restartResetAfter","isLeft","greaterThan","format","undefined","servableSliceQueryFault","wiring","servableQueryFault","query","taglessSliceFault","slice","Object","entries","slices","untagged","items","length","some","item","tags","perEntry","rule","index","fault","projectionWiringFault","materialisationCollisionFault","materialisations","entry","durabilityOrderingFault","eventLogDurability","viewDurability","exports","one","other","cursorIdentity","key","projection","partition"],"sources":["../../src/projectionWiringFault.ts"],"sourcesContent":[null],"mappings":";;;;;;AA4LA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AA9LA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMG,sBAAsB,GAAGA,CAC7BC,IAAY,EACZC,KAA6B,EAC7BC,IAAY,KACgC;EAC5C,MAAMC,OAAO,GAAGC,gBAAQ,CAACC,aAAa,CAACJ,KAAK,CAAC;EAC7C,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qBAAA,GAAAA,qBAAA;AA4EA,MAAMC,6BAA6B,GAAInB,MAKtC,IAAwB;EACvB,MAAM;IAAEoB;EAAgB,CAAE,GAAGpB,MAAM;EACnC,KAAK,IAAIpB,IAAI,GAAG,CAAC,EAAEA,IAAI,GAAGwC,gBAAgB,CAACV,MAAM,EAAE9B,IAAI,IAAI,CAAC,EAAE;IAC5D,KAAK,IAAIK,KAAK,GAAGL,IAAI,GAAG,CAAC,EAAEK,KAAK,GAAGmC,gBAAgB,CAACV,MAAM,EAAEzB,KAAK,IAAI,CAAC,EAAE;MACtE,MAAMyC,GAAG,GAAGN,gBAAgB,CAACxC,IAAI,CAAC;MAClC,MAAM+C,KAAK,GAAGP,gBAAgB,CAACnC,KAAK,CAAC;MACrC,IACEyC,GAAG,CAACE,cAAc,KAAKD,KAAK,CAACC,cAAc,IAC3CF,GAAG,CAACG,GAAG,CAACC,UAAU,KAAKH,KAAK,CAACE,GAAG,CAACC,UAAU,IAC3CJ,GAAG,CAACG,GAAG,CAACE,SAAS,KAAKJ,KAAK,CAACE,GAAG,CAACE,SAAS,EACzC;QACA,OACE,iDAAiDnD,IAAI,QAAQ,GAC7D,oBAAoBK,KAAK,6CAA6C,GACtE,6BAA6ByC,GAAG,CAACG,GAAG,CAACE,SAAS,2BAA2B,GACzE,mEAAmE,GACnE,uEAAuE,GACvE,kEAAkE,GAClE,qEAAqE,GACrE,2DAA2D,GAC3D,wEAAwE,GACxE,uEAAuE,GACvE,sEAAsE,GACtE,yEAAyE,GACzE,iEAAiE,GACjE,mEAAmE,GACnE,oBAAoB;MAExB;IACF;EACF;EACA,OAAOjC,SAAS;AAClB,CAAC","ignoreList":[]}
@@ -133,7 +133,7 @@
133
133
  * options literal, a smaller and more local mistake than picking the wrong pair
134
134
  * of layers.
135
135
  * 4. **The store's own servable grammar**, once over the SHARED composed query,
136
- * reported in the STORE's vocabulary by `core`'s own `assertServableQuery`.
136
+ * reported in the STORE's vocabulary by `core`'s own servable-query grammar.
137
137
  * 5. **The read side's stricter per-slice tag rule**, once over the SHARED slice
138
138
  * record, and it MUST stay after (4): it catches only what that grammar admits,
139
139
  * since a lone type-only item is servable. Were it first, a tagless-plus-tagged
@@ -1 +1 @@
1
- {"version":3,"file":"projectionWiringFault.d.ts","sourceRoot":"","sources":["../../src/projectionWiringFault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2LG;AACH,OAAO,EAAuB,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACjE,OAAO,EAAE,QAAQ,EAAkB,MAAM,QAAQ,CAAA;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAyRlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;IAC3B,QAAQ,CAAC,cAAc,EAAE,UAAU,CAAA;IACnC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,aAAa,CAAA;IAC5C,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAA;IAChD,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAA;IAChD,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,aAAa,CAAA;CACnD,CAAA;AAgCD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,UAAU,CAAA;IACvC,QAAQ,CAAC,KAAK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AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,UAAU,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAA;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAA;CAChE,KAAG,MAAM,GAAG,SAUc,CAAA"}
@@ -133,7 +133,7 @@
133
133
  * options literal, a smaller and more local mistake than picking the wrong pair
134
134
  * of layers.
135
135
  * 4. **The store's own servable grammar**, once over the SHARED composed query,
136
- * reported in the STORE's vocabulary by `core`'s own `assertServableQuery`.
136
+ * reported in the STORE's vocabulary by `core`'s own servable-query grammar.
137
137
  * 5. **The read side's stricter per-slice tag rule**, once over the SHARED slice
138
138
  * record, and it MUST stay after (4): it catches only what that grammar admits,
139
139
  * since a lone type-only item is servable. Were it first, a tagless-plus-tagged
@@ -186,7 +186,7 @@
186
186
  * offers — a caller with a wiring to validate has `runProjection` or
187
187
  * `runProjections` itself. BOTH judge all five rules before either forks anything.
188
188
  */
189
- import { assertServableQuery } from '@kairos-es/core';
189
+ import { servableQueryFault } from '@kairos-es/core';
190
190
  import { Duration, Either, Option } from 'effect';
191
191
  import { durabilityOrderingFault } from "./EventLogDurability.js";
192
192
  /**
@@ -320,7 +320,7 @@ const tuningFault = tuning => {
320
320
  * `undefined` when the store would serve it, otherwise `core`'s own sentence about
321
321
  * why it would not.
322
322
  *
323
- * ## Why `core`'s `assertServableQuery` and not a predicate of our own
323
+ * ## Why `core`'s grammar and not a predicate of our own
324
324
  *
325
325
  * It is the very function every engine applies inside `read`/`subscribe`/`append`,
326
326
  * so calling it is what makes ONE grammar rather than two that agree until one is
@@ -332,31 +332,25 @@ const tuningFault = tuning => {
332
332
  * once the breaker trips on a checkpoint that never moved — several backoff sleeps
333
333
  * later, describing a stall rather than the mis-built slice that caused it.
334
334
  *
335
- * ## Why the THROW is converted rather than propagated
336
- *
337
- * `assertServableQuery` throws, because its own callers are store methods where a
338
- * throw inside an `Effect` is already the defect it should be. Here it is one of
339
- * five rules whose results compose, so letting it throw would give this gate two
340
- * exit routes — a returned sentence for four rules and an exception for the
341
- * fifth — and every caller would then need both a `??` chain and a `try`. Catching
342
- * it keeps ONE exit route, and the caller keeps one `Effect.die`.
343
- *
344
- * The message is passed through VERBATIM, which is the point of the conversion
345
- * rather than a detail of it: the violation goes on being reported in the store's
346
- * vocabulary, in the same words the same rule produces when a store rejects the
347
- * same query, so an author who meets it twice meets it once. The `instanceof`
348
- * fallback is for the shape of the contract rather than for anything observed —
349
- * `throw` admits any value, and `String(error)` is the honest reading of one this
350
- * module cannot inspect.
335
+ * ## Why core's TOTAL form is called rather than its throwing one
336
+ *
337
+ * The grammar has two dispositions and core owns both: `assertServableQuery`
338
+ * throws, because its own callers are store methods where a throw inside an
339
+ * `Effect` is already the defect it should be, and `servableQueryFault` returns the
340
+ * sentence, for a caller that can still act on it. Here it is one of five rules
341
+ * whose results compose, so a throw would give this gate two exit routes — a
342
+ * returned sentence for four rules and an exception for the fifth — and every
343
+ * caller would need both a `??` chain and a `try`. The total form keeps ONE exit
344
+ * route, and the caller keeps one `Effect.die`.
345
+ *
346
+ * This used to convert the throw here, with a `try`/`catch` and an `instanceof`
347
+ * fallback, which was a THIRD statement of a rule that must have one home — and,
348
+ * once core's total form existed, a private symbol of the same name and meaning
349
+ * sitting beside the public one. The message is core's either way, so the violation
350
+ * goes on being reported in the store's own vocabulary and an author who meets it
351
+ * twice meets it once.
351
352
  */
352
- const servableQueryFault = wiring => {
353
- try {
354
- assertServableQuery(wiring.query);
355
- return undefined;
356
- } catch (error) {
357
- return error instanceof Error ? error.message : String(error);
358
- }
359
- };
353
+ const servableSliceQueryFault = wiring => servableQueryFault(wiring.query);
360
354
  /**
361
355
  * The read side's OWN per-slice rule: `undefined` when every slice carries at least
362
356
  * one tag, otherwise the sentence naming the first slice that does not.
@@ -429,7 +423,7 @@ const perEntry = (entries, rule) => {
429
423
  export const projectionWiringFault = wiring => materialisationCollisionFault(wiring) ?? perEntry(wiring.materialisations, entry => durabilityOrderingFault({
430
424
  eventLogDurability: wiring.eventLogDurability,
431
425
  viewDurability: entry.viewDurability
432
- })) ?? perEntry(wiring.materialisations, tuningFault) ?? servableQueryFault(wiring) ?? taglessSliceFault(wiring);
426
+ })) ?? perEntry(wiring.materialisations, tuningFault) ?? servableSliceQueryFault(wiring) ?? taglessSliceFault(wiring);
433
427
  /**
434
428
  * The SET-LEVEL rung: `undefined` when no two materialisations of one read model
435
429
  * would fight over one cursor, otherwise the sentence naming the offending pair and
@@ -1 +1 @@
1
- {"version":3,"file":"projectionWiringFault.js","names":["assertServableQuery","Duration","Either","Option","durabilityOrderingFault","positiveFiniteDuration","name","input","role","decoded","decodeUnknown","isNone","left","String","isFinite","value","isZero","right","MIS_TUNED","tuningFault","tuning","checked","all","batchWindow","restartMinDelay","restartMaxDelay","restartResetAfter","isLeft","greaterThan","format","undefined","servableQueryFault","wiring","query","error","Error","message","taglessSliceFault","slice","Object","entries","slices","untagged","items","length","some","item","tags","perEntry","rule","index","fault","projectionWiringFault","materialisationCollisionFault","materialisations","entry","eventLogDurability","viewDurability","one","other","cursorIdentity","key","projection","partition"],"sources":["../../src/projectionWiringFault.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4LA,SAASA,mBAAmB,QAAoB,iBAAiB;AACjE,SAASC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;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AqE,GACrE,2DAA2D,GAC3D,wEAAwE,GACxE,uEAAuE,GACvE,sEAAsE,GACtE,yEAAyE,GACzE,iEAAiE,GACjE,mEAAmE,GACnE,oBAAoB;MAExB;IACF;EACF;EACA,OAAOjC,SAAS;AAClB,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"projectionWiringFault.js","names":["servableQueryFault","Duration","Either","Option","durabilityOrderingFault","positiveFiniteDuration","name","input","role","decoded","decodeUnknown","isNone","left","String","isFinite","value","isZero","right","MIS_TUNED","tuningFault","tuning","checked","all","batchWindow","restartMinDelay","restartMaxDelay","restartResetAfter","isLeft","greaterThan","format","undefined","servableSliceQueryFault","wiring","query","taglessSliceFault","slice","Object","entries","slices","untagged","items","length","some","item","tags","perEntry","rule","index","fault","projectionWiringFault","materialisationCollisionFault","materialisations","entry","eventLogDurability","viewDurability","one","other","cursorIdentity","key","projection","partition"],"sources":["../../src/projectionWiringFault.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4LA,SAAqBA,kBAAkB,QAAQ,iBAAiB;AAChE,SAASC,QAAQ,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACjD,SAASC,uBAAuB,QAAQ,yBAAsB;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMC,sBAAsB,GAAGA,CAC7BC,IAAY,EACZC,KAA6B,EAC7BC,IAAY,KACgC;EAC5C,MAAMC,OAAO,GAAGR,QAAQ,CAACS,aAAa,CAACH,KAAK,CAAC;EAC7C,IAAIJ,MAAM,CAACQ,MAAM,CAACF,OAAO,CAAC,EAAE;IAC1B,O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M;EACnC,KAAK,IAAIpB,IAAI,GAAG,CAAC,EAAEA,IAAI,GAAGuC,gBAAgB,CAACV,MAAM,EAAE7B,IAAI,IAAI,CAAC,EAAE;IAC5D,KAAK,IAAIK,KAAK,GAAGL,IAAI,GAAG,CAAC,EAAEK,KAAK,GAAGkC,gBAAgB,CAACV,MAAM,EAAExB,KAAK,IAAI,CAAC,EAAE;MACtE,MAAMsC,GAAG,GAAGJ,gBAAgB,CAACvC,IAAI,CAAC;MAClC,MAAM4C,KAAK,GAAGL,gBAAgB,CAAClC,KAAK,CAAC;MACrC,IACEsC,GAAG,CAACE,cAAc,KAAKD,KAAK,CAACC,cAAc,IAC3CF,GAAG,CAACG,GAAG,CAACC,UAAU,KAAKH,KAAK,CAACE,GAAG,CAACC,UAAU,IAC3CJ,GAAG,CAACG,GAAG,CAACE,SAAS,KAAKJ,KAAK,CAACE,GAAG,CAACE,SAAS,EACzC;QACA,OACE,iDAAiDhD,IAAI,QAAQ,GAC7D,oBAAoBK,KAAK,6CAA6C,GACtE,6BAA6BsC,GAAG,CAACG,GAAG,CAACE,SAAS,2BAA2B,GACzE,mEAAmE,GACnE,uEAAuE,GACvE,kEAAkE,GAClE,qEAAqE,GACrE,2DAA2D,GAC3D,wEAAwE,GACxE,uEAAuE,GACvE,sEAAsE,GACtE,yEAAyE,GACzE,iEAAiE,GACjE,mEAAmE,GACnE,oBAAoB;MAExB;IACF;EACF;EACA,OAAO9B,SAAS;AAClB,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kairos-es/read",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.0.0-alpha.1",
4
4
  "description": "Query-driven projection runner and checkpoint port for kairos-es",
5
5
  "license": "BSD-3-Clause",
6
6
  "repository": {
@@ -12,8 +12,8 @@
12
12
  "homepage": "https://github.com/neverbland/kairos-es",
13
13
  "peerDependencies": {
14
14
  "effect": "^3.22.0",
15
- "@kairos-es/codec": "^1.0.0-alpha.0",
16
- "@kairos-es/core": "^1.0.0-alpha.0"
15
+ "@kairos-es/codec": "^1.0.0-alpha.1",
16
+ "@kairos-es/core": "^1.0.0-alpha.1"
17
17
  },
18
18
  "main": "./dist/cjs/index.js",
19
19
  "module": "./dist/esm/index.js",
@@ -133,7 +133,7 @@
133
133
  * options literal, a smaller and more local mistake than picking the wrong pair
134
134
  * of layers.
135
135
  * 4. **The store's own servable grammar**, once over the SHARED composed query,
136
- * reported in the STORE's vocabulary by `core`'s own `assertServableQuery`.
136
+ * reported in the STORE's vocabulary by `core`'s own servable-query grammar.
137
137
  * 5. **The read side's stricter per-slice tag rule**, once over the SHARED slice
138
138
  * record, and it MUST stay after (4): it catches only what that grammar admits,
139
139
  * since a lone type-only item is servable. Were it first, a tagless-plus-tagged
@@ -186,7 +186,7 @@
186
186
  * offers — a caller with a wiring to validate has `runProjection` or
187
187
  * `runProjections` itself. BOTH judge all five rules before either forks anything.
188
188
  */
189
- import { assertServableQuery, type Query } from '@kairos-es/core'
189
+ import { type Query, servableQueryFault } from '@kairos-es/core'
190
190
  import { Duration, Either, Option } from 'effect'
191
191
  import { durabilityOrderingFault } from './EventLogDurability'
192
192
  import type { CheckpointKey, Durability } from './ProjectionStore'
@@ -388,7 +388,7 @@ const tuningFault = (tuning: {
388
388
  * `undefined` when the store would serve it, otherwise `core`'s own sentence about
389
389
  * why it would not.
390
390
  *
391
- * ## Why `core`'s `assertServableQuery` and not a predicate of our own
391
+ * ## Why `core`'s grammar and not a predicate of our own
392
392
  *
393
393
  * It is the very function every engine applies inside `read`/`subscribe`/`append`,
394
394
  * so calling it is what makes ONE grammar rather than two that agree until one is
@@ -400,33 +400,27 @@ const tuningFault = (tuning: {
400
400
  * once the breaker trips on a checkpoint that never moved — several backoff sleeps
401
401
  * later, describing a stall rather than the mis-built slice that caused it.
402
402
  *
403
- * ## Why the THROW is converted rather than propagated
404
- *
405
- * `assertServableQuery` throws, because its own callers are store methods where a
406
- * throw inside an `Effect` is already the defect it should be. Here it is one of
407
- * five rules whose results compose, so letting it throw would give this gate two
408
- * exit routes — a returned sentence for four rules and an exception for the
409
- * fifth — and every caller would then need both a `??` chain and a `try`. Catching
410
- * it keeps ONE exit route, and the caller keeps one `Effect.die`.
411
- *
412
- * The message is passed through VERBATIM, which is the point of the conversion
413
- * rather than a detail of it: the violation goes on being reported in the store's
414
- * vocabulary, in the same words the same rule produces when a store rejects the
415
- * same query, so an author who meets it twice meets it once. The `instanceof`
416
- * fallback is for the shape of the contract rather than for anything observed —
417
- * `throw` admits any value, and `String(error)` is the honest reading of one this
418
- * module cannot inspect.
403
+ * ## Why core's TOTAL form is called rather than its throwing one
404
+ *
405
+ * The grammar has two dispositions and core owns both: `assertServableQuery`
406
+ * throws, because its own callers are store methods where a throw inside an
407
+ * `Effect` is already the defect it should be, and `servableQueryFault` returns the
408
+ * sentence, for a caller that can still act on it. Here it is one of five rules
409
+ * whose results compose, so a throw would give this gate two exit routes — a
410
+ * returned sentence for four rules and an exception for the fifth — and every
411
+ * caller would need both a `??` chain and a `try`. The total form keeps ONE exit
412
+ * route, and the caller keeps one `Effect.die`.
413
+ *
414
+ * This used to convert the throw here, with a `try`/`catch` and an `instanceof`
415
+ * fallback, which was a THIRD statement of a rule that must have one home — and,
416
+ * once core's total form existed, a private symbol of the same name and meaning
417
+ * sitting beside the public one. The message is core's either way, so the violation
418
+ * goes on being reported in the store's own vocabulary and an author who meets it
419
+ * twice meets it once.
419
420
  */
420
- const servableQueryFault = (wiring: {
421
+ const servableSliceQueryFault = (wiring: {
421
422
  readonly query: Query
422
- }): string | undefined => {
423
- try {
424
- assertServableQuery(wiring.query)
425
- return undefined
426
- } catch (error) {
427
- return error instanceof Error ? error.message : String(error)
428
- }
429
- }
423
+ }): string | undefined => servableQueryFault(wiring.query)
430
424
 
431
425
  /**
432
426
  * The read side's OWN per-slice rule: `undefined` when every slice carries at least
@@ -575,7 +569,7 @@ export const projectionWiringFault = (wiring: {
575
569
  }),
576
570
  ) ??
577
571
  perEntry(wiring.materialisations, tuningFault) ??
578
- servableQueryFault(wiring) ??
572
+ servableSliceQueryFault(wiring) ??
579
573
  taglessSliceFault(wiring)
580
574
 
581
575
  /**