@xyo-network/event-kit-statement-graph 0.1.5 → 0.1.8
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 +29 -11
- package/dist/neutral/finalizedReplayChain.d.ts +16 -0
- package/dist/neutral/finalizedReplayChain.d.ts.map +1 -0
- package/dist/neutral/finalizedReplayController.d.ts +19 -3
- package/dist/neutral/finalizedReplayController.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +2 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +264 -93
- package/dist/neutral/index.mjs.map +4 -4
- package/dist/neutral/replayCheckpoint.d.ts +23 -22
- package/dist/neutral/replayCheckpoint.d.ts.map +1 -1
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -30,27 +30,41 @@ const replay = await createFinalizedEventKitReplayController({
|
|
|
30
30
|
|
|
31
31
|
await replay.sync()
|
|
32
32
|
|
|
33
|
+
// A bounded worker still reports the real live finalized head while advancing
|
|
34
|
+
// its durable projection by at most the requested number of blocks.
|
|
35
|
+
await replay.sync({ maxBlocks: 4_096, signal })
|
|
36
|
+
|
|
37
|
+
// The durable projection exposes its exact canonical XL1 root.
|
|
38
|
+
const at = replay.anchor() // { block, hash } or null before the first commit
|
|
39
|
+
|
|
33
40
|
const handshakes = createEventKitHandshakeReadModel({
|
|
34
41
|
body: hash => replay.body(hash),
|
|
35
42
|
viewer: replay.viewer(),
|
|
36
43
|
})
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
The
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
The controller bulk-stages contiguous finalized ranges through Statement Graph
|
|
47
|
+
with the exact Event Kit object-schema allowlist. The default full `sync()`
|
|
48
|
+
catches up to the independently observed live head; `sync({ maxBlocks, signal })`
|
|
49
|
+
lets a bounded worker retain that real `finalizedHead` while advancing
|
|
50
|
+
`indexedThrough` by at most `maxBlocks`. A staged range is published only after
|
|
51
|
+
every publisher-scoped object and required challenge/response attachment in it
|
|
52
|
+
is verified. An unresolved Statement Graph event, a missing or corrupt claimed
|
|
53
|
+
object, or a missing or corrupt attachment records the earliest affected block
|
|
54
|
+
as an explicit blocked boundary and leaves `indexedThrough` before that block.
|
|
55
|
+
A clean prefix is re-scanned and may be committed first. A later `sync()` retries
|
|
56
|
+
the same blocked block; unavailability is never interpreted as absence or
|
|
57
|
+
revocation. Cancellation retains only prefixes whose atomic checkpoint save has
|
|
58
|
+
already resolved.
|
|
59
|
+
|
|
60
|
+
Published Statement Graph `0.5.3` admits consensus-elevated, subject-bearing
|
|
48
61
|
Claims and decodes Claim bodies from finalized block carriers while resolving
|
|
49
62
|
claimed objects and acceptance attachments through the datalake. The Gate 2
|
|
50
63
|
live rerun against that release remains the acceptance boundary.
|
|
51
64
|
|
|
52
|
-
Statement Graph `0.5.
|
|
53
|
-
Kit's publisher-scoped outer checkpoint is
|
|
65
|
+
Statement Graph `0.5.x` uses fold version 4 and scan-checkpoint format 2. Event
|
|
66
|
+
Kit's publisher-scoped outer checkpoint is format 3 and binds
|
|
67
|
+
`indexedThrough` to the exact canonical XL1 root hash. Only the exact
|
|
54
68
|
current checkpoint and ordered Event Kit schema policy are accepted. Missing,
|
|
55
69
|
additional, reordered, or version-suffixed policy entries fail closed as
|
|
56
70
|
invalid content; no alternative-policy reader or in-place migration exists.
|
|
@@ -61,6 +75,10 @@ invalid content; no alternative-policy reader or in-place migration exists.
|
|
|
61
75
|
- `indexedThrough` is the highest block whose Event Kit projection was fully
|
|
62
76
|
committed, or `null` before the floor block has been indexed.
|
|
63
77
|
|
|
78
|
+
`anchor()` returns the durable `{block, hash}` pair for `indexedThrough`. A
|
|
79
|
+
height-only checkpoint from the previous format is replayed from the floor; it
|
|
80
|
+
is never upgraded into root-bound evidence by assumption.
|
|
81
|
+
|
|
64
82
|
The strict `EventKitReplayCheckpointZod` checkpoint binds network, chain ID,
|
|
65
83
|
publisher, datalake source identity, floor block, Statement Graph fold version,
|
|
66
84
|
and the ordered schema policy. It retains the complete canonical
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FinalizedBlockViewer } from '@xyo-network/xl1-statement-graph-sdk';
|
|
2
|
+
type Promisable<T> = PromiseLike<T> | T;
|
|
3
|
+
/**
|
|
4
|
+
* Public XL1 viewers expose height-aware chain identity through `chainId(block)`.
|
|
5
|
+
* Fakes and older adapters may omit it, in which case replay remains deliberately
|
|
6
|
+
* restricted to a single ChainId.
|
|
7
|
+
*/
|
|
8
|
+
export interface FinalizedEventKitReplayChain extends FinalizedBlockViewer {
|
|
9
|
+
chainId?(block: number | 'latest'): Promisable<unknown>;
|
|
10
|
+
}
|
|
11
|
+
export declare function exactFinalizedBlockHash(chain: FinalizedEventKitReplayChain, block: number, chainId: string): Promise<string>;
|
|
12
|
+
/** Validates every block actually consumed by the scanner without adding a second range read. */
|
|
13
|
+
export declare function lineageValidatingScanChain(chain: FinalizedEventKitReplayChain, chainId: string): FinalizedBlockViewer;
|
|
14
|
+
export declare function requireCurrentReplayChain(chain: FinalizedEventKitReplayChain, finalizedHead: number, chainId: string): Promise<void>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=finalizedReplayChain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finalizedReplayChain.d.ts","sourceRoot":"","sources":["../../src/finalizedReplayChain.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAEhF,KAAK,UAAU,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEvC;;;;GAIG;AACH,MAAM,WAAW,4BAA6B,SAAQ,oBAAoB;IACxE,OAAO,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;CACxD;AA2BD,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,4BAA4B,EACnC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,iGAAiG;AACjG,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,4BAA4B,EACnC,OAAO,EAAE,MAAM,GACd,oBAAoB,CAoBtB;AAED,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,4BAA4B,EACnC,aAAa,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StatementGraphViewer } from '@xyo-network/xl1-statement-graph-engine';
|
|
2
|
-
import type { BodyReader
|
|
2
|
+
import type { BodyReader } from '@xyo-network/xl1-statement-graph-sdk';
|
|
3
|
+
import type { FinalizedEventKitReplayChain } from './finalizedReplayChain.ts';
|
|
3
4
|
import type { EventKitReplayCheckpoint, EventKitReplayCheckpointIdentity, ReplayBlockedState } from './replayCheckpoint.ts';
|
|
4
5
|
export interface EventKitReplayCheckpointStore {
|
|
5
6
|
/** Returns durable JSON-compatible checkpoint content, if one exists. */
|
|
@@ -9,21 +10,36 @@ export interface EventKitReplayCheckpointStore {
|
|
|
9
10
|
}
|
|
10
11
|
export interface FinalizedEventKitReplayOptions extends EventKitReplayCheckpointIdentity {
|
|
11
12
|
readonly bodies: BodyReader;
|
|
12
|
-
readonly chain:
|
|
13
|
+
readonly chain: FinalizedEventKitReplayChain;
|
|
14
|
+
/** Maximum contiguous blocks staged before one atomic checkpoint save. */
|
|
15
|
+
readonly checkpointBatchSize?: number;
|
|
13
16
|
readonly checkpointStore: EventKitReplayCheckpointStore;
|
|
17
|
+
/** Maximum blocks requested by each Statement Graph bulk read. */
|
|
18
|
+
readonly scanBatchSize?: number;
|
|
14
19
|
}
|
|
15
20
|
export interface FinalizedEventKitReplayStatus {
|
|
16
21
|
readonly blocked?: ReplayBlockedState;
|
|
17
22
|
readonly finalizedHead: number;
|
|
18
23
|
readonly indexedThrough: number | null;
|
|
19
24
|
}
|
|
25
|
+
export interface FinalizedEventKitReplayAnchor {
|
|
26
|
+
readonly block: number;
|
|
27
|
+
readonly hash: string;
|
|
28
|
+
}
|
|
29
|
+
export interface FinalizedEventKitReplaySyncOptions {
|
|
30
|
+
/** Advance at most this many blocks while still reporting the uncapped live finalized head. */
|
|
31
|
+
readonly maxBlocks?: number;
|
|
32
|
+
readonly signal?: AbortSignal;
|
|
33
|
+
}
|
|
20
34
|
export interface FinalizedEventKitReplayController {
|
|
35
|
+
/** Exact canonical XL1 root retained with the current durable projection. */
|
|
36
|
+
anchor(): Readonly<FinalizedEventKitReplayAnchor> | null;
|
|
21
37
|
/** Resolve a verified lifecycle or acceptance-attachment body from the durable projection. */
|
|
22
38
|
body(hash: string): Readonly<Record<string, unknown>> | undefined;
|
|
23
39
|
snapshot(): Readonly<EventKitReplayCheckpoint>;
|
|
24
40
|
status(): FinalizedEventKitReplayStatus;
|
|
25
41
|
/** Walks clean finalized blocks and stops before the first unavailable body boundary. */
|
|
26
|
-
sync(): Promise<FinalizedEventKitReplayStatus>;
|
|
42
|
+
sync(options?: FinalizedEventKitReplaySyncOptions): Promise<FinalizedEventKitReplayStatus>;
|
|
27
43
|
/** Snapshot viewer; request it again after `sync()` to observe the new checkpoint. */
|
|
28
44
|
viewer(): StatementGraphViewer;
|
|
29
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalizedReplayController.d.ts","sourceRoot":"","sources":["../../src/finalizedReplayController.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAA;AAMnF,OAAO,KAAK,EACV,UAAU,
|
|
1
|
+
{"version":3,"file":"finalizedReplayController.d.ts","sourceRoot":"","sources":["../../src/finalizedReplayController.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yC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QAAQ,CAAC,6BAA6B,CAAC,GAAG,IAAI,CAAA;IACxD,8FAA8F;IAC9F,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAAA;IACjE,QAAQ,IAAI,QAAQ,CAAC,wBAAwB,CAAC,CAAA;IAC9C,MAAM,IAAI,6BAA6B,CAAA;IACvC,yFAAyF;IACzF,IAAI,CAAC,OAAO,CAAC,EAAE,kCAAkC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAC1F,sFAAsF;IACtF,MAAM,IAAI,oBAAoB,CAAA;CAC/B;AA0YD,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,8BAA8B,GACzC,OAAO,CAAC,iCAAiC,CAAC,CAwB5C;AAED,uFAAuF;AACvF,wBAAgB,yCAAyC,CACvD,OAAO,CAAC,EAAE,OAAO,GAChB,6BAA6B,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,wBAAwB,EAAE,CAAA;CAAE,CAazF"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ export type { ActiveSourceWakeGrantAuthorizerOptions } from './activeSourceWakeG
|
|
|
2
2
|
export { createActiveSourceWakeGrantAuthorizer } from './activeSourceWakeGrantAuthorizer.ts';
|
|
3
3
|
export { createCheckpointStatementGraphViewer } from './checkpointViewer.ts';
|
|
4
4
|
export { EventKitClaimedObjectSchemas, EventKitClaimedObjectSchemaSet, } from './eventKitSchemaPolicy.ts';
|
|
5
|
-
export type {
|
|
5
|
+
export type { FinalizedEventKitReplayChain } from './finalizedReplayChain.ts';
|
|
6
|
+
export type { EventKitReplayCheckpointStore, FinalizedEventKitReplayController, FinalizedEventKitReplayOptions, FinalizedEventKitReplayStatus, FinalizedEventKitReplaySyncOptions, } from './finalizedReplayController.ts';
|
|
6
7
|
export { createFinalizedEventKitReplayController, createMemoryEventKitReplayCheckpointStore, } from './finalizedReplayController.ts';
|
|
7
8
|
export type { StatementGraphGrantReadModelOptions } from './grantReadModel.ts';
|
|
8
9
|
export { createStatementGraphGrantReadModel } from './grantReadModel.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAA;AAClG,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAA;AAC5F,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,8BAA8B,EAC9B,6BAA6B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAA;AAClG,OAAO,EAAE,qCAAqC,EAAE,MAAM,sCAAsC,CAAA;AAC5F,OAAO,EAAE,oCAAoC,EAAE,MAAM,uBAAuB,CAAA;AAC5E,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAA;AAC7E,YAAY,EACV,6BAA6B,EAC7B,iCAAiC,EACjC,8BAA8B,EAC9B,6BAA6B,EAC7B,kCAAkC,GACnC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,uCAAuC,EACvC,yCAAyC,GAC1C,MAAM,gCAAgC,CAAA;AACvC,YAAY,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAA;AACxE,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAA;AAC1E,YAAY,EACV,sBAAsB,EAC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