Skip to content

Add Chronicle query scenarios and release unexpected snapshot streams in tests - #88

Merged
woksin merged 12 commits into
mainfrom
feature/chronicle-query-scenario
Sep 26, 2026
Merged

woksin merged 12 commits into
mainfrom
feature/chronicle-query-scenario

Conversation

@woksin

@woksin woksin commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Arc for TypeScript 0.37.0 adds in-memory Chronicle query scenarios, the counterpart of the query scenario seeding in Arc for .NET, and aligns snapshot queries that return streams with .NET. npm publication remains disabled.

Added

  • ChronicleQueryScenario.for(Model, 'method', ...artifacts) runs a model-bound query against Chronicle read models without a kernel. Seed state per event source with given.forEventSource(id, tenant?): .events(...) builds reducer-backed read models with the Chronicle SDK's ReadModelScenario, and .readModel(instance) pins an instance, which wins over seeded events. Reads are tenant-scoped, and an unseeded key resolves as missing.
    • Listing, watching and projection-backed history need ChronicleKernelScenario, and the scenario says so rather than returning a partial answer.
  • snapshotStreamSource(result) in @cratis/arc.core returns the stream a snapshot query returned by mistake, so a test host can release it.

Changed

  • A query declared as a snapshot that returns an observable, subscribable or async iterable is rejected without touching the returned source, so a shared RxJS Subject stays usable.
  • QueryScenario releases such a stream before rejecting, with a one-second limit and cancellation support. Sources returned inside a scenario are treated as owned by the scenario and may be closed.
  • QueryScenario.perform() now rejects queries declared observable: true, as QueryScenario does in Arc for .NET; use ObservableQueryScenario for them.
  • yarn ci now type-checks the built declarations of every published package with skipLibCheck: false, so a declaration a consumer can't compile fails the build.

Refs #77

@woksin woksin added the minor New backward-compatible capabilities label Sep 26, 2026
@woksin woksin self-assigned this Sep 26, 2026
@woksin
woksin merged commit b310c91 into main Sep 26, 2026
3 checks passed
@cratis-direct
cratis-direct Bot deleted the feature/chronicle-query-scenario branch September 26, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New backward-compatible capabilities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant