feat: add minimal Chronicle TypeScript client sample - #583
Merged
Conversation
Adds Chronicle/TypeScript — a small runnable Node.js/TypeScript sample using the @cratis/chronicle client: append a VisitorArrived event, let a reactor respond with a VisitorWelcomed side-effect event, and read the combined history back. Includes a single-container docker-compose.yml, pinned npm dependencies, a catalog entry in samples.json, and a row in the samples table.
…e servers - 3.1.1 adopts chronicle.contracts 17 with the renamed EnsureEventStore RPC, so the sample runs against cratis/chronicle:latest-development - remove the known-incompatibility warning that no longer applies
Collaborator
Author
|
Unblocked: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
Chronicle/TypeScript— a minimal runnable Node.js/TypeScript sample for the@cratis/chronicleclient covering the three-step journey append → react → read:events.ts— two past-tense@eventType()classes (VisitorArrived,VisitorWelcomed)reactor.ts— a@reactor()returning a side-effect event, making the reaction visible in the historyindex.ts— connect, append,waitForCompletion(), read the combined historydocker-compose.yml— singlecratis/chronicle:latest-developmentcontainer (bundles MongoDB)README.md— pinned versions, docker compose instructions, expected output, cleanupsamples.jsoncatalog entry (trackgetting-started) and a row in the root README table — the catalog/docs-sync path clearly supports new entries (README contributing steps 5–6,scripts/validate-samples.mjs, CIyarn samples:validate)npm dependencies are pinned exactly:
@cratis/chronicle3.1.0,@cratis/fundamentals7.18.2,reflect-metadata0.2.2.Verification
node scripts/validate-samples.mjs— passes (10 samples across 7 tracks)npm install+npm run compile— cleancratis/chronicle:16.33.0-development— works: append at seq 0, reactor side effect at seq 1, both read backcratis/chronicle:latest-development(digestsha256:a42361…, built 2026-08-28) — fails:/Cratis.Chronicle.Contracts.EventStores/Ensure UNIMPLEMENTEDWhy this PR is left open (do not merge yet)
The sample was required to run against
cratis/chronicle:latest-development, and it currently cannot — through no fault of the sample code:a34f5b2b1(2026-08-14, first released in v16.33.1) renamed theEventStores/EnsureRPC toEnsureEventStore.@cratis/chronicle.contracts17.0.0 carries the renamed contract, but the latest published client@cratis/chronicle3.1.0 still pins contracts 16.13.4 and callsEnsure.getEventStore()against any server ≥ 16.33.1, including today'slatest-developmentand the current release image.The sample README carries a clearly marked known-incompatibility warning with the verified fallback tag (
16.33.0-development). Suggested unblock: publish a@cratis/chronicleclient release on contracts 17.x, then re-run this sample againstlatest-developmentand merge.Also found (upstream, fixed in-sample)
The client's default artifact
discoveryPatterns(!**/node_modules) do not exclude files insidenode_modulesin a standalone npm layout (the upstream Console sample never hits this because its dependencies are hoisted). The sample passes explicitdiscoveryPatterns: ['*.ts', …]. Worth an upstream issue in Chronicle.TypeScript.