@cratis/pi 7.34.0 → 7.35.0
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/package/corpus/agents/security-reviewer.md +1 -0
- package/package/corpus/agents/spec-writer.md +1 -1
- package/package/corpus/harnesses/pi/extensions/shared/rules.ts +3 -1
- package/package/corpus/hooks/scripts/cratis-nuget-pins.txt +7 -6
- package/package/corpus/hooks/scripts/cratis-release-notes-reviewed.cjs +7 -6
- package/package/corpus/hooks/scripts/cratis-store-mutations.json +7 -3
- package/package/corpus/product-sync.json +896 -0
- package/package/corpus/prompts/add-business-rule.prompt.md +1 -1
- package/package/corpus/prompts/ship-changes.prompt.md +2 -2
- package/package/corpus/rules/ai-distribution.md +31 -3
- package/package/corpus/rules/application-profile.md +2 -1
- package/package/corpus/rules/components.md +66 -7
- package/package/corpus/rules/concepts.md +11 -3
- package/package/corpus/rules/csharp.md +3 -1
- package/package/corpus/rules/dialogs.md +9 -0
- package/package/corpus/rules/efcore.md +1 -1
- package/package/corpus/rules/elixir.md +49 -0
- package/package/corpus/rules/framework.md +5 -3
- package/package/corpus/rules/general.md +1 -0
- package/package/corpus/rules/glossary.md +4 -4
- package/package/corpus/rules/go-engineering.md +60 -0
- package/package/corpus/rules/go.md +115 -0
- package/package/corpus/rules/java.md +5 -2
- package/package/corpus/rules/kotlin.md +7 -5
- package/package/corpus/rules/orleans.md +65 -9
- package/package/corpus/rules/profiles.md +43 -6
- package/package/corpus/rules/pull-requests.md +3 -3
- package/package/corpus/rules/react.md +8 -1
- package/package/corpus/rules/reactors.md +27 -3
- package/package/corpus/rules/specs.csharp.md +11 -4
- package/package/corpus/rules/specs.scenarios.csharp.md +35 -4
- package/package/corpus/rules/specs.typescript.md +2 -1
- package/package/corpus/rules/storybook.md +1 -1
- package/package/corpus/rules/typescript.md +1 -1
- package/package/corpus/rules/vertical-slices.md +37 -5
- package/package/corpus/skills/cratis-application-react-specifications/SKILL.md +4 -2
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +18 -8
- package/package/corpus/skills/cratis-application-slice-specifications/references/query-and-decision-scenarios.md +65 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +53 -57
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +38 -42
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +18 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authproxy.md +30 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +12 -9
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/local-development.md +9 -9
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +8 -5
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/tenancy.md +20 -4
- package/package/corpus/skills/cratis-arc-command/SKILL.md +32 -10
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +12 -5
- package/package/corpus/skills/cratis-arc-command/references/decisions-and-routing.md +95 -0
- package/package/corpus/skills/cratis-arc-command/references/generated-values.md +3 -2
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +8 -8
- package/package/corpus/skills/cratis-arc-command/references/proxy-generation.md +22 -3
- package/package/corpus/skills/cratis-arc-command/references/read-model-injection.md +13 -1
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +19 -9
- package/package/corpus/skills/cratis-arc-command-kotlin/SKILL.md +44 -18
- package/package/corpus/skills/cratis-arc-command-kotlin/references/read-model-naming.md +29 -0
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +10 -9
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +2 -2
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +4 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +42 -22
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +36 -5
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-operations.md +114 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +37 -16
- package/package/corpus/skills/cratis-arc-command-typescript/references/identity-and-introspection.md +88 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/observability-and-host-scopes.md +25 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +35 -4
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +11 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +8 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +49 -19
- package/package/corpus/skills/cratis-arc-ef-core-migration/SKILL.md +12 -6
- package/package/corpus/skills/cratis-arc-go/SKILL.md +148 -0
- package/package/corpus/skills/cratis-arc-go/references/queries.md +80 -0
- package/package/corpus/skills/cratis-arc-hosting/SKILL.md +96 -0
- package/package/corpus/skills/cratis-arc-hosting/references/integrations-and-publish.md +80 -0
- package/package/corpus/skills/cratis-arc-identity-and-tenancy-kotlin/SKILL.md +137 -0
- package/package/corpus/skills/cratis-arc-observable-query-http/SKILL.md +20 -2
- package/package/corpus/skills/cratis-arc-query-kotlin/SKILL.md +26 -6
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +25 -20
- package/package/corpus/skills/cratis-arc-query-typescript/SKILL.md +32 -6
- package/package/corpus/skills/cratis-arc-query-typescript/references/storage-observation-and-compliance.md +66 -0
- package/package/corpus/skills/cratis-arc-query-typescript/verification.json +5 -1
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +24 -13
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +20 -10
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +17 -3
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +14 -3
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +6 -1
- package/package/corpus/skills/cratis-arc-react-page/references/provenance.md +1 -1
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +11 -1
- package/package/corpus/skills/cratis-arc-react-page/verification.json +6 -1
- package/package/corpus/skills/cratis-arc-spring-data-kotlin/SKILL.md +163 -0
- package/package/corpus/skills/cratis-arc-testing-kotlin/SKILL.md +131 -0
- package/package/corpus/skills/cratis-arc-validation-kotlin/SKILL.md +44 -11
- package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +5 -3
- package/package/corpus/skills/cratis-chronicle-cli-operations/SKILL.md +79 -25
- package/package/corpus/skills/cratis-chronicle-cli-operations/references/command-effects.md +57 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +87 -99
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/additional-surfaces.md +65 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/client-construction.md +42 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +12 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +43 -19
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +29 -1
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +158 -162
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +36 -15
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/compliance.md +32 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/connections.md +56 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/event-sources.md +64 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/pitfalls.md +25 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/projections.md +48 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/upgrading.md +34 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +13 -5
- package/package/corpus/skills/cratis-chronicle-client-elixir/verification.json +23 -0
- package/package/corpus/skills/cratis-chronicle-client-go/SKILL.md +162 -0
- package/package/corpus/skills/cratis-chronicle-client-go/references/projections.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +87 -88
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +13 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +14 -4
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/event-sources.md +65 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/options.md +29 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +13 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +5 -4
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +165 -156
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +54 -11
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/testing.md +126 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +3 -5
- package/package/corpus/skills/cratis-chronicle-client-typescript/verification.json +19 -0
- package/package/corpus/skills/cratis-chronicle-compliance/SKILL.md +36 -13
- package/package/corpus/skills/cratis-chronicle-decision-reads/SKILL.md +110 -0
- package/package/corpus/skills/cratis-chronicle-decision-reads/references/admission-and-ownership.md +57 -0
- package/package/corpus/skills/cratis-chronicle-decision-reads/verification.json +12 -0
- package/package/corpus/skills/cratis-chronicle-event-constraints/SKILL.md +58 -19
- package/package/corpus/skills/cratis-chronicle-event-constraints/references/closing-streams.md +73 -0
- package/package/corpus/skills/cratis-chronicle-event-modeling/SKILL.md +32 -3
- package/package/corpus/skills/cratis-chronicle-event-specifications/SKILL.md +18 -5
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +32 -2
- package/package/corpus/skills/cratis-chronicle-hosting/SKILL.md +134 -0
- package/package/corpus/skills/cratis-chronicle-hosting/references/operations.md +89 -0
- package/package/corpus/skills/cratis-chronicle-hosting/verification.json +14 -0
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +93 -66
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/blocked-tools.md +21 -7
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/deployment.md +77 -0
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/references/observational-tools.md +46 -4
- package/package/corpus/skills/cratis-chronicle-multi-tenancy/SKILL.md +15 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +44 -10
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +7 -1
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +8 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +85 -105
- package/package/corpus/skills/cratis-chronicle-reactor/references/slice-delivery-checklist.md +1 -1
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +20 -1
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +35 -16
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +15 -3
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +23 -4
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +40 -15
- package/package/corpus/skills/cratis-cli-terminal-workbench/SKILL.md +20 -6
- package/package/corpus/skills/cratis-code-review/SKILL.md +25 -3
- package/package/corpus/skills/cratis-components-accessibility/SKILL.md +20 -4
- package/package/corpus/skills/cratis-components-schema-editor/SKILL.md +40 -28
- package/package/corpus/skills/cratis-components-schema-editor/references/tree-layout.md +62 -0
- package/package/corpus/skills/cratis-components-schema-editor/verification.json +14 -0
- package/package/corpus/skills/cratis-components-stepper-command-dialog/SKILL.md +16 -8
- package/package/corpus/skills/cratis-components-styling/SKILL.md +57 -20
- package/package/corpus/skills/cratis-components-styling/verification.json +13 -0
- package/package/corpus/skills/cratis-components-toolbar/SKILL.md +37 -7
- package/package/corpus/skills/cratis-components-toolbar/verification.json +12 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +6 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +5 -3
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +19 -6
- package/package/corpus/skills/cratis-fundamentals-concept/references/typescript-concepts.md +97 -0
- package/package/corpus/skills/cratis-fundamentals-concept/verification.json +4 -1
- package/package/corpus/skills/cratis-fundamentals-concept-go/SKILL.md +112 -0
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +54 -17
- package/package/corpus/skills/cratis-fundamentals-type-discovery/verification.json +14 -0
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +55 -28
- package/package/corpus/skills/cratis-performance-review/SKILL.md +5 -2
- package/package/corpus/skills/cratis-release-notes/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +5 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +1 -1
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +25 -7
- package/package/corpus/skills/cratis-screenplay-command-surface/references/enum-numbers.md +4 -2
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +4 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +4 -3
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +2 -2
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +3 -2
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +34 -4
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +5 -3
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +4 -2
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/property-links.md +42 -3
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +6 -6
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/drift-and-ledger.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +6 -4
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +1 -1
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +3 -1
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-design.md +1 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-slice-design/references/rule-layers.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/worked-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-specifications/references/examples-and-routes.md +48 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +3 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +7 -5
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +2 -2
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +2 -2
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/streams-example.md +5 -4
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +8 -6
- package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +2 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +4 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +16 -11
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +8 -5
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1329 -32
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +2 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +23 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +1 -1
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +2 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/screen-composition-contract.md +27 -9
- package/package/corpus/skills/cratis-security-review/SKILL.md +9 -3
- package/package/corpus/skills/cratis-security-review/references/arc-boundaries.md +59 -0
- package/package/corpus/skills/cratis-specification-by-example/SKILL.md +7 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +43 -11
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +16 -4
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +18 -5
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +21 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/shared-lifecycle.md +34 -0
- package/package/corpus/skills/cratis-specifications-csharp/verification.json +13 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +14 -5
- package/package/corpus/skills/cratis-specifications-typescript/verification.json +12 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +11 -5
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +7 -4
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +10 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/scene-runtime.md +75 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +6 -1
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +14 -1
- package/package/profile-catalog.json +68 -1
- package/package.json +1 -1
- package/src/index.ts +3 -1
|
@@ -15,47 +15,44 @@ HTTP and never sees this package.
|
|
|
15
15
|
|
|
16
16
|
| Pitfall | Why it bites |
|
|
17
17
|
| --- | --- |
|
|
18
|
-
| Naming a reactor method after the handler's purpose |
|
|
18
|
+
| Naming a reactor method after the handler's purpose | Use the camelCase event class name or explicit `@handles(EventType)` |
|
|
19
19
|
| `instanceof` on the event inside a handler | It is a `JSON.parse`d plain object, not your class |
|
|
20
|
-
| Event
|
|
20
|
+
| Event fields with no `@field` types under `tsx` | No type metadata is emitted; unresolved members make registration fail |
|
|
21
21
|
| Two `@eventType()` classes sharing a class name | The id defaults to the class name and they collide |
|
|
22
|
-
| Deploying compiled `dist/*.js` with default discovery |
|
|
22
|
+
| Deploying compiled `dist/*.js` with default discovery | Compiled-JS entries do not scan; import artifact modules explicitly |
|
|
23
23
|
| Omitting a side-effect import of an artifact module | Its decorator never runs, so it is never registered |
|
|
24
24
|
| Forgetting `import 'reflect-metadata'` at the entry point | Decorators do not work at runtime |
|
|
25
25
|
| Forgetting to install `@cratis/fundamentals` | It is a peer dependency and is not installed for you |
|
|
26
26
|
| Importing `ChronicleConnectionString` | There is no `./connection` export; pass a string |
|
|
27
|
-
|
|
|
27
|
+
| Carrying a pre-6.0 stream forward | Pass all three route dimensions explicitly; omitted routes now resolve to `Default`/`All`/`Default` |
|
|
28
28
|
| A connection string with no credentials | Silently falls back to the development client credentials |
|
|
29
29
|
| Shipping the default TLS behavior | `skipTlsValidation` defaults to `true` |
|
|
30
|
-
| Constructor-injecting
|
|
31
|
-
|
|
|
30
|
+
| Constructor-injecting without an `artifactActivator` | By default the client constructs the artifact itself |
|
|
31
|
+
| Side-effect reactor without `@onceOnly()` | Reactors run again on kernel replay by default since 6.9.0 |
|
|
32
32
|
| Reading `result.sequenceNumber` as a number | It is a `bigint` behind `.value` |
|
|
33
33
|
| A `@globalFor` mapping targeting a property one variant lacks | `GlobalHandlerPropertyNotOnVariant` when the group is built, not a silently skipped mapping |
|
|
34
34
|
| Expecting a `@globalFor`-only class to appear as a projection | It is never registered on its own; it is merged into its variants |
|
|
35
35
|
|
|
36
36
|
## Verified product sources
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
`
|
|
41
|
-
`4→5` major is the Chronicle 17/18 wire migration (internal gRPC shapes; it adds
|
|
42
|
-
`ensureCommandResponse` for server-side command results). The `file:line`
|
|
43
|
-
citations below were taken at `v4.0.0` and may have shifted.
|
|
38
|
+
Verified against `Cratis/Chronicle.TypeScript` tag **`v6.51.0`**, reading
|
|
39
|
+
`Source/**` and `Documentation/getting-started.md`, `testing.md`,
|
|
40
|
+
`migrate-append-routing.md` and `reactors.md`. Source paths below refer to that tag.
|
|
44
41
|
|
|
45
42
|
| Package | Version | Where |
|
|
46
43
|
| --- | --- | --- |
|
|
47
|
-
| `@cratis/chronicle` | `
|
|
48
|
-
| `@cratis/chronicle.contracts` | `
|
|
49
|
-
| `@cratis/fundamentals` | `^7.
|
|
44
|
+
| `@cratis/chronicle` | `6.51.0` | npm; `Source/package.json` carries a `1.0.0` placeholder |
|
|
45
|
+
| `@cratis/chronicle.contracts` | `19.31.10` | Client's pinned dependency, not the latest contracts package |
|
|
46
|
+
| `@cratis/fundamentals` | `^7.22.4` | **peer dependency** — you install it |
|
|
50
47
|
|
|
51
48
|
> **Do not read the version out of the repository.** `Source/package.json` says
|
|
52
49
|
> `1.0.0`; `publish-version.js` overwrites it at publish time. Take the version
|
|
53
50
|
> from npm.
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
**Upgrade the kernel first.** The 5.x→6.0.0 migration changes omitted append
|
|
53
|
+
routes and requires compatibility checks (kernel 18.4.1+); registered event
|
|
54
|
+
sources introduced in 6.49.0 require kernel 19.30+. Reactors replay by default
|
|
55
|
+
since 6.9.0, so review side-effect handlers when upgrading.
|
|
59
56
|
|
|
60
57
|
## Project setup
|
|
61
58
|
|
|
@@ -64,27 +61,31 @@ yarn add @cratis/chronicle @cratis/fundamentals reflect-metadata
|
|
|
64
61
|
```
|
|
65
62
|
|
|
66
63
|
`@cratis/fundamentals` is a peer dependency, so it does not arrive on its own.
|
|
67
|
-
`reflect-metadata`
|
|
68
|
-
decorated class is loaded
|
|
64
|
+
`reflect-metadata` is now a regular dependency. Import it **once, at the entry
|
|
65
|
+
point**, before any decorated class is loaded:
|
|
69
66
|
|
|
70
67
|
```typescript
|
|
71
68
|
import 'reflect-metadata';
|
|
72
69
|
```
|
|
73
70
|
|
|
74
|
-
The package is **ESM-only**
|
|
75
|
-
|
|
71
|
+
The package is **ESM-only** and needs Node.js **22.19+** for its `undici`
|
|
72
|
+
dependency (the client itself has no `engines` field). Standard TC39 decorators
|
|
73
|
+
are supported (TypeScript 5.2+) and are the documentation default:
|
|
76
74
|
|
|
77
75
|
```jsonc
|
|
78
|
-
// tsconfig.json
|
|
76
|
+
// tsconfig.json — standard decorator mode
|
|
79
77
|
{
|
|
80
78
|
"compilerOptions": {
|
|
81
|
-
"
|
|
82
|
-
"
|
|
79
|
+
"target": "ES2022",
|
|
80
|
+
"lib": ["ES2022", "ESNext.Decorators"]
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
```
|
|
86
84
|
|
|
87
|
-
|
|
85
|
+
Legacy mode with `experimentalDecorators: true` and
|
|
86
|
+
`emitDecoratorMetadata: true` still works. Standard decorators and esbuild/tsx
|
|
87
|
+
emit no type metadata: declare every serialized property with `@field(Type)`
|
|
88
|
+
from `@cratis/fundamentals`; default values are only an inference fallback.
|
|
88
89
|
|
|
89
90
|
## Connecting
|
|
90
91
|
|
|
@@ -101,41 +102,35 @@ try {
|
|
|
101
102
|
}
|
|
102
103
|
```
|
|
103
104
|
|
|
104
|
-
`IChronicleClient`
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
| --- | --- |
|
|
108
|
-
| `readonly options: ChronicleOptions` | `:18` |
|
|
109
|
-
| `getEventStore(name, namespace?): Promise<IEventStore>` | `:27` |
|
|
110
|
-
| `getEventStores(): Promise<EventStoreName[]>` | `:33` |
|
|
111
|
-
| `dispose(): void` | `:38` |
|
|
105
|
+
`IChronicleClient` (`Source/IChronicleClient.ts`) exposes `readonly options`,
|
|
106
|
+
`getEventStore(name, namespace?): Promise<IEventStore>`,
|
|
107
|
+
`getEventStores(): Promise<EventStoreName[]>`, and `dispose(): void`.
|
|
112
108
|
|
|
113
109
|
`ChronicleClient`'s constructor takes exactly one argument —
|
|
114
|
-
`constructor(readonly options: ChronicleOptions)
|
|
110
|
+
`constructor(readonly options: ChronicleOptions)` (`Source/ChronicleClient.ts`).
|
|
115
111
|
|
|
116
112
|
**Connecting is implicit and lazy.** There is no `connect()`. The constructor
|
|
117
113
|
starts a health-check watchdog and kicks off artifact discovery; the actual
|
|
118
114
|
connect happens on the first `getEventStore`/`getEventStores` through an internal
|
|
119
115
|
`ensureConnected()`. `getEventStore` also *creates* the store if it does not
|
|
120
|
-
exist — it calls `ensureEventStore
|
|
116
|
+
exist — it calls `ensureEventStore`.
|
|
121
117
|
|
|
122
|
-
`dispose()` is **synchronous
|
|
118
|
+
`dispose()` is **synchronous**, not
|
|
123
119
|
`Symbol.dispose` or `Symbol.asyncDispose`. After disposal every call throws.
|
|
124
120
|
|
|
125
121
|
### Options
|
|
126
122
|
|
|
127
|
-
`ChronicleOptions` has a **private constructor**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- `ChronicleOptions.fromConnectionString(connectionString, options?)` — `:92`
|
|
131
|
-
- `ChronicleOptions.development(options?)` — `:116`
|
|
123
|
+
`ChronicleOptions` has a **private constructor** (`Source/ChronicleOptions.ts`);
|
|
124
|
+
use `ChronicleOptions.fromConnectionString(connectionString, options?)` or
|
|
125
|
+
`ChronicleOptions.development(options?)`.
|
|
132
126
|
|
|
133
|
-
The optional bag accepts `
|
|
134
|
-
`
|
|
135
|
-
|
|
127
|
+
The optional bag accepts `telemetry`, `logger`, `clientArtifactsProvider`,
|
|
128
|
+
`discoveryPatterns`, `defaultSinkTypeId`, `reactorResultHandler`,
|
|
129
|
+
`artifactActivator`, and `readModelNamingPolicy`. `defaultSinkTypeId` defaults
|
|
130
|
+
to `WellKnownSinks.MongoDB`.
|
|
136
131
|
|
|
137
132
|
> `programIdentifier`, `softwareVersion`, and `softwareCommit` exist on the type
|
|
138
|
-
>
|
|
133
|
+
> but **neither public factory forwards them**, so they cannot be set.
|
|
139
134
|
> Do not write guidance that configures them.
|
|
140
135
|
|
|
141
136
|
### The connection string
|
|
@@ -151,7 +146,7 @@ Two facts to carry into production guidance:
|
|
|
151
146
|
is not validated, because a development kernel serves a self-signed
|
|
152
147
|
certificate. Set `?skipTlsValidation=false` against a real server.
|
|
153
148
|
- **A connection string with no credentials silently falls back to the
|
|
154
|
-
development client credentials** (`Source/connection/ChronicleConnection.ts
|
|
149
|
+
development client credentials** (`Source/connection/ChronicleConnection.ts`).
|
|
155
150
|
An anonymous-looking connection string is not anonymous; it is
|
|
156
151
|
`chronicle-dev-client`.
|
|
157
152
|
|
|
@@ -167,55 +162,51 @@ The subpath exports that do exist: `.`, `./events`, `./eventSequences`,
|
|
|
167
162
|
`./seeding`, `./readModels`, `./projections`, `./jobs`, `./webhooks`,
|
|
168
163
|
`./externalServices`, `./identities`, `./observation`, `./sinks`, `./schemas`,
|
|
169
164
|
`./types`, `./artifacts`, `./identity`, `./auditing`, `./correlation`,
|
|
170
|
-
`./transactions
|
|
165
|
+
`./transactions`, `./confidentiality`, `./patterns`, `./testing`, and
|
|
166
|
+
`./package.json`. Event-source APIs are root exports; there is no
|
|
167
|
+
`./eventSources` subpath. `IncompatibleChronicleServer` and
|
|
168
|
+
`RejectedChronicleCredentials` are also root exports.
|
|
171
169
|
|
|
172
170
|
## Event types
|
|
173
171
|
|
|
174
172
|
```typescript
|
|
173
|
+
// Excerpt: replace the domain placeholders with your event and value types.
|
|
174
|
+
import { field } from '@cratis/fundamentals';
|
|
175
175
|
import { eventType } from '@cratis/chronicle';
|
|
176
176
|
|
|
177
177
|
@eventType()
|
|
178
178
|
export class <EventName> {
|
|
179
|
-
|
|
179
|
+
@field(<RuntimeType>) <property>: <Type>;
|
|
180
|
+
constructor(<property>: <Type>) { this.<property> = <property>; }
|
|
180
181
|
}
|
|
181
182
|
```
|
|
182
183
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
export function eventType(): ClassDecorator;
|
|
187
|
-
export function eventType(id: string): ClassDecorator;
|
|
188
|
-
export function eventType(id: string, generation: number): ClassDecorator;
|
|
189
|
-
export function eventType(id: string, generation: number, tombstone: boolean): ClassDecorator;
|
|
190
|
-
export function eventType(generation: number): ClassDecorator;
|
|
191
|
-
export function eventType(generation: number, tombstone: boolean): ClassDecorator;
|
|
192
|
-
export function eventType(tombstone: boolean): ClassDecorator;
|
|
193
|
-
```
|
|
184
|
+
`eventType` supports no args, `id`, `id/generation`, `id/generation/tombstone`,
|
|
185
|
+
`generation`, `generation/tombstone`, or `tombstone`
|
|
186
|
+
(`Source/events/eventTypeDecorator.ts`); both decorator modes work.
|
|
194
187
|
|
|
195
188
|
**The event type id defaults to the class name** — `new EventTypeId(id || constructor.name)`
|
|
196
|
-
|
|
189
|
+
in the decorator. Two classes with the same name in different modules collide
|
|
190
|
+
on the wire.
|
|
197
191
|
|
|
198
|
-
**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
defaults and no `@field` decorators produces no members and an empty schema. Every
|
|
205
|
-
sample event carries defaults for exactly this reason.
|
|
192
|
+
**Use explicit `@field` declarations.** `Source/types/TypeIntrospector.ts` checks
|
|
193
|
+
field metadata before inference from tracked properties, default-constructed
|
|
194
|
+
instances and legacy metadata. Use `@field(Array, { genericArguments: [Item] })`
|
|
195
|
+
for typed arrays; concepts need `static readonly valueType`. A property the
|
|
196
|
+
client cannot type makes registration fail — do not rely on constructor-only
|
|
197
|
+
properties under standard decorators or tsx.
|
|
206
198
|
|
|
207
|
-
Tag an event type at declaration with `@tag(...)` / `@tags(...)
|
|
208
|
-
`Source/events/tagDecorator.ts:30`, `:42`.
|
|
199
|
+
Tag an event type at declaration with `@tag(...)` / `@tags(...)`.
|
|
209
200
|
|
|
210
201
|
## Appending
|
|
211
202
|
|
|
212
203
|
`IEventLog` is an empty extension of `IEventSequence`
|
|
213
|
-
(`Source/eventSequences/IEventLog.ts
|
|
204
|
+
(`Source/eventSequences/IEventLog.ts`); the surface is on `IEventSequence`:
|
|
214
205
|
|
|
215
206
|
```typescript
|
|
216
|
-
append(eventSourceId: string, event: object, options?: AppendOptions): Promise<AppendResult>;
|
|
217
|
-
appendMany(eventSourceId: string, events: object[], options?: AppendOptions): Promise<AppendResult[]>;
|
|
218
|
-
appendMany(events: EventForEventSourceId[], options?: AppendOptions): Promise<AppendResult[]>;
|
|
207
|
+
append(eventSourceId: string, event: object, options?: AppendOptions): Promise<AppendResult>;
|
|
208
|
+
appendMany(eventSourceId: string, events: object[], options?: AppendOptions): Promise<AppendResult[]>;
|
|
209
|
+
appendMany(events: EventForEventSourceId[], options?: AppendOptions): Promise<AppendResult[]>;
|
|
219
210
|
```
|
|
220
211
|
|
|
221
212
|
```typescript
|
|
@@ -227,22 +218,25 @@ if (!result.isSuccess) {
|
|
|
227
218
|
|
|
228
219
|
- **The event source id is a plain `string`.** There is no `EventSourceId` value
|
|
229
220
|
type at this boundary.
|
|
230
|
-
- `AppendResult`
|
|
231
|
-
`constraintViolations
|
|
232
|
-
`waitForCompletion(timeoutMs?)`
|
|
221
|
+
- `AppendResult` (`Source/eventSequences/AppendResult.ts`): `sequenceNumber`,
|
|
222
|
+
`constraintViolations` (including the constraint name), `concurrencyViolation?`,
|
|
223
|
+
`errors`, `isSuccess`, and `waitForCompletion({ timeoutMs, signal }?)`
|
|
224
|
+
(timeout defaults to 5000 ms).
|
|
233
225
|
- **`sequenceNumber` wraps a `bigint`.** Read it as `result.sequenceNumber.value`.
|
|
234
226
|
`EventContext.sequenceNumber` is a `bigint` too.
|
|
235
|
-
- `AppendOptions`
|
|
236
|
-
`
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
227
|
+
- `AppendOptions` (`Source/eventSequences/AppendOptions.ts`): `correlationId`,
|
|
228
|
+
`sourceType`, `streamType`, `streamId`, `subject`, `occurred`, `tags`, `namedTags`,
|
|
229
|
+
`concurrencyScope`, `concurrencyScopes`, `eventSource`, and `eventStream`.
|
|
230
|
+
The reserved legacy `eventSourceId` option does not override the method's id.
|
|
231
|
+
|
|
232
|
+
**Single `append()` supports routing and subject options.** Since 6.0.0 an
|
|
233
|
+
unspecified route is omitted on the wire; the kernel resolves source `Default`,
|
|
234
|
+
stream type `All`, stream id `Default`. Subject precedence is the explicit option,
|
|
235
|
+
then the event's `@subject()` property, then its event source id.
|
|
236
|
+
|
|
237
|
+
To continue a pre-6.0 stream, pass **all three** dimensions explicitly:
|
|
238
|
+
`{ sourceType: 'Default', streamType: 'Default', streamId: id }`.
|
|
239
|
+
See `Documentation/migrate-append-routing.md` at the verified tag.
|
|
246
240
|
|
|
247
241
|
Correlation id, identity, and the causation chain are picked up from the ambient
|
|
248
242
|
module-level managers (`identityProvider`, `causationManager`,
|
|
@@ -257,37 +251,32 @@ await unitOfWork.commit();
|
|
|
257
251
|
```
|
|
258
252
|
|
|
259
253
|
`ITransactionalEventSequence` returns `Promise<void>`, not an `AppendResult`;
|
|
260
|
-
results are on the unit of work.
|
|
254
|
+
results are on the unit of work. Since 6.51.0 transactional appends retain
|
|
255
|
+
routing, subject, occurrence, tags and concurrency scopes in enrollment order;
|
|
256
|
+
conflicting scopes for one source throw `ConflictingConcurrencyScopesInUnitOfWork`
|
|
257
|
+
before enrollment.
|
|
261
258
|
|
|
262
259
|
## Observing
|
|
263
260
|
|
|
264
|
-
### Handlers
|
|
265
|
-
|
|
266
|
-
This is the defining convention of this client, and it is **not** the parameter
|
|
267
|
-
type. `Source/reactors/Reactors.ts:378-381` computes the method name from the
|
|
268
|
-
event class name and looks it up on the prototype:
|
|
261
|
+
### Handlers use camelCase names or `@handles(EventType)`
|
|
269
262
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
if (typeof proto[methodName] === 'function') { /* it is a handler */ }
|
|
275
|
-
```
|
|
263
|
+
The default is the camelCase event class name, **not** parameter-type dispatch.
|
|
264
|
+
An unmatched name is simply never called. Reactors and reducers also support
|
|
265
|
+
`@handles(EventType)` on a public instance method: one handler per event;
|
|
266
|
+
a reactor handler cannot combine it with `@replay`.
|
|
276
267
|
|
|
277
|
-
|
|
278
|
-
method
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
> first parameter's type. **It is wrong**, and it is still wrong at `5.1.0`. The
|
|
282
|
-
> code is the authority; so are the client snippets under `Documentation/`, which
|
|
283
|
-
> state the name rule explicitly.
|
|
268
|
+
**Reactors replay by default since 6.9.0.** Use class `@onceOnly()` (not inherited)
|
|
269
|
+
or method `@onceOnly()` for effects that must not run on replay; `@replay(EventType)`
|
|
270
|
+
provides a separate replay handler. This never prevents failed-partition
|
|
271
|
+
redelivery or proves exactly-once effects.
|
|
284
272
|
|
|
285
273
|
```typescript
|
|
286
|
-
import { reactor } from '@cratis/chronicle/reactors';
|
|
274
|
+
import { onceOnly, reactor } from '@cratis/chronicle/reactors';
|
|
287
275
|
import { EventContext, EventForEventSourceId } from '@cratis/chronicle';
|
|
288
276
|
|
|
289
277
|
@reactor()
|
|
290
278
|
export class <ReactorName> {
|
|
279
|
+
@onceOnly()
|
|
291
280
|
async <eventName>(event: <EventName>, context: EventContext): Promise<EventForEventSourceId> {
|
|
292
281
|
return {
|
|
293
282
|
eventSourceId: '<other-event-source-id>',
|
|
@@ -300,24 +289,25 @@ export class <ReactorName> {
|
|
|
300
289
|
A returned event, array, or `EventForEventSourceId` is appended as a side effect;
|
|
301
290
|
a failed side-effect append fails the partition.
|
|
302
291
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
292
|
+
Reactor arguments are `(event, context, services, delivery)`
|
|
293
|
+
(`Source/reactors/ReactorDispatcher.ts`). `ReactorServices` exposes
|
|
294
|
+
`{ eventStore, readModels, signal }` for the observation's owning store/namespace.
|
|
295
|
+
`ReactorDelivery` supplies an idempotency identity, not an exactly-once guarantee.
|
|
296
|
+
|
|
297
|
+
> **Event content is parsed JSON, not an instance of your event class.**
|
|
298
|
+
> `instanceof` checks and event methods do not work. Read properties only.
|
|
307
299
|
|
|
308
|
-
`@reducer(id?, eventSequenceId?, readModel?, isActive?)`
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
`reducerInstance[methodName](content, currentState, context)`
|
|
312
|
-
(`Source/reducers/Reducers.ts:400`). The third is optional by arity, and a handler
|
|
313
|
-
may be sync or async.
|
|
300
|
+
`@reducer(id?, eventSequenceId?, readModel?, isActive?)` also registers the supplied
|
|
301
|
+
read model type. Reducers receive `(content, currentState, context)` and may be
|
|
302
|
+
sync or async.
|
|
314
303
|
|
|
315
|
-
|
|
316
|
-
`
|
|
304
|
+
Filter with `@filterEventsByTag(value)`, `@eventSourceType(...)`, or
|
|
305
|
+
`@eventStreamType(...)`. `reactorResultHandler` handles application-owned returns.
|
|
317
306
|
|
|
318
307
|
### Read models and projections
|
|
319
308
|
|
|
320
|
-
Read
|
|
309
|
+
Read through `store.readModels`; projections are model-bound (decorators) or
|
|
310
|
+
fluent (`@projection`). Constraints use `@unique`/`@removeConstraint` or a builder.
|
|
321
311
|
|
|
322
312
|
Read [references/read-models-and-projections.md](references/read-models-and-projections.md) when reading a read model instance, choosing a projection style, or declaring a constraint.
|
|
323
313
|
|
|
@@ -327,23 +317,18 @@ One entity with mutually exclusive lifecycle shapes is modeled as variants, with
|
|
|
327
317
|
|
|
328
318
|
Read [references/variants.md](references/variants.md) when a read model for one entity changes shape over its lifecycle, or when you meet `VariantMustDeclareEntersOnEvent` or `GlobalHandlerPropertyNotOnVariant`.
|
|
329
319
|
|
|
330
|
-
##
|
|
331
|
-
|
|
332
|
-
`ChronicleOptions.discoveryPatterns` defaults to
|
|
333
|
-
`['**/*.ts', '!**/*.d.ts', '!**/node_modules', '!**/dist', '!**/build', '!**/.git', '!**/.vscode', '!**/*.spec.ts', '!**/*.test.ts']`
|
|
334
|
-
(`Source/ChronicleOptions.ts:73-83`), and the client `import()`s every matching
|
|
335
|
-
file at construction time so that the decorators run. Registration is into a
|
|
336
|
-
process-wide static map.
|
|
320
|
+
## Artifact discovery
|
|
337
321
|
|
|
338
|
-
|
|
322
|
+
`ChronicleOptions.discoveryPatterns` defaults to `**/*.ts` and `**/*.tsx` only
|
|
323
|
+
for TypeScript entries (`.ts/.tsx/.mts/.cts`), Vitest, or tsx/ts-node/type-stripping
|
|
324
|
+
loader arguments. It excludes declaration files, `node_modules`, `dist`, `build`,
|
|
325
|
+
`.git`, `.vscode`, and `*.spec/test.ts(x)` (`Source/ChronicleOptions.ts`).
|
|
339
326
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
of event, reactor, reducer, and projection modules are load-bearing; the sample
|
|
346
|
-
does exactly this with a comment saying why.
|
|
327
|
+
**A compiled-JS entry defaults to `[]`.** Decorators register when their module is
|
|
328
|
+
imported, so side-effect imports of artifacts remain load-bearing in production.
|
|
329
|
+
Explicit patterns always win; `[]` disables scanning. The client imports matching
|
|
330
|
+
files at construction; failed imports name the file. Registration uses a
|
|
331
|
+
process-wide static map.
|
|
347
332
|
|
|
348
333
|
`EventStore.registerArtifacts()` registers event types first, then everything else
|
|
349
334
|
in parallel, and re-runs for every cached event store on reconnect.
|
|
@@ -359,32 +344,56 @@ in parallel, and re-runs for every cached event store on reconnect.
|
|
|
359
344
|
- Failed operations are retried once after reconnecting, keyed on gRPC status
|
|
360
345
|
codes 4/13/14 plus a substring match over the error text.
|
|
361
346
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
347
|
+
The client reports its **installed package version**, read from
|
|
348
|
+
`@cratis/chronicle/package.json`, and performs `CheckCompatibility` with
|
|
349
|
+
`ProtocolVersion` and the contracts descriptor set before a connection is usable
|
|
350
|
+
and before event-sequence calls. `IncompatibleChronicleServer` is a permanent
|
|
351
|
+
verdict, not retried (`Source/connection/CompatibilityPreflight.ts`).
|
|
352
|
+
Three consecutive credential rejections cause `RejectedChronicleCredentials`.
|
|
353
|
+
A failed token request is logged and the call proceeds without a token (allowing
|
|
354
|
+
an auth-less kernel); tokens come from the selected server, not the first host.
|
|
355
|
+
|
|
356
|
+
Since 6.43.0 built-in spans use `cratis.chronicle.client.*` and scope
|
|
357
|
+
`Cratis.Chronicle.Client`; metrics use seconds. Legacy millisecond metrics and
|
|
358
|
+
`chronicle.*` attributes are retired except the retained exact-string
|
|
359
|
+
`chronicle.sequence_number`. Historical constants, `ChronicleMetrics`, and
|
|
360
|
+
`telemetry.spanNames` are deprecated; migrate dashboards.
|
|
368
361
|
|
|
369
|
-
##
|
|
362
|
+
## Artifact activation
|
|
370
363
|
|
|
371
|
-
There is
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
364
|
+
There is no built-in container. By default the client constructs artifacts.
|
|
365
|
+
For reactor/reducer constructor dependencies supply `artifactActivator` in
|
|
366
|
+
`ChronicleOptions`: activation is per delivered batch and can implement
|
|
367
|
+
`ActivatedArtifact.run/complete/dispose` around handlers and returned effects.
|
|
368
|
+
|
|
369
|
+
## Testing without a kernel
|
|
370
|
+
|
|
371
|
+
Read [references/testing.md](references/testing.md) when specifying appends,
|
|
372
|
+
reactors or read models with `EventScenario`, `ReactorScenario`, or
|
|
373
|
+
`ReadModelScenario`. Unsupported shapes fail explicitly; they need kernel tests.
|
|
374
|
+
|
|
375
|
+
## More surface
|
|
376
|
+
|
|
377
|
+
| Need | Public surface and boundary |
|
|
378
|
+
| --- | --- |
|
|
379
|
+
| Registered sources/streams | Root `@eventSource`, repeatable `@eventStream`, `ConcurrencyDimensions`, `store.eventSources`; append `eventSource/eventStream`. Kernel 19.30+; see `Source/eventSources/` |
|
|
380
|
+
| Named tags | `namedTags` on appends; batches cannot combine them with registered event sources |
|
|
381
|
+
| Personal data and retained secrets | `@pii`, `@subject`, `store.pii`; `@encrypted` with `EncryptionScope` from `./confidentiality`; release through `readModels.release*`. Never combine PII/encrypted or put either on `eventSourceId` |
|
|
382
|
+
| Subject migration | Subject uses `@subject()` since 6.41.1; earlier appended events used the source id for protection keys |
|
|
383
|
+
| Operational catalogs | `store.observers` (list/remove), `store.patterns`; mutations need authority |
|
|
384
|
+
| Diagnostics/privacy | `ChronicleOptions.telemetry` and per-client `logger`; source ids are omitted by default, raw/HMAC recording is opt-in |
|
|
375
385
|
|
|
376
386
|
## Verify
|
|
377
387
|
|
|
378
388
|
- The installed version is the one you intended, taken from npm, and
|
|
379
389
|
`@cratis/fundamentals` is installed alongside it.
|
|
380
390
|
- `reflect-metadata` is imported exactly once, at the entry point.
|
|
381
|
-
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
class, and an appended event demonstrably reaches it.
|
|
391
|
+
- Decorator mode is consistent: standard mode uses explicit `@field` types;
|
|
392
|
+
legacy mode uses `experimentalDecorators` with `emitDecoratorMetadata`.
|
|
393
|
+
- Every serialized property has a runtime type and a non-empty schema.
|
|
394
|
+
- Compiled-JS deployments import artifacts, or configure explicit discovery.
|
|
395
|
+
- Every handler uses exact camelCase naming or `@handles(EventType)`, and an
|
|
396
|
+
appended event demonstrably reaches it; side-effect replay policy is explicit.
|
|
388
397
|
- A production connection string carries credentials and `skipTlsValidation=false`.
|
|
389
398
|
- `client.dispose()` runs on shutdown.
|
|
390
399
|
- Every variant group has at least one `@entersOn`/`entersOn(...)` per variant,
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
+
<!-- Copyright (c) Cratis. All rights reserved. -->
|
|
2
|
+
<!-- Licensed under the MIT license. See LICENSE file in the project root for full license information. -->
|
|
3
|
+
|
|
1
4
|
## Read models and projections
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`
|
|
6
|
-
|
|
6
|
+
Verified at `Cratis/Chronicle.TypeScript` **v6.51.0**:
|
|
7
|
+
`Source/readModels/IReadModels.ts`, `indexDecorator.ts`,
|
|
8
|
+
`Source/projections/modelBound/**`, `declarative/**`, and
|
|
9
|
+
`Source/events/constraints/**`.
|
|
10
|
+
|
|
11
|
+
`store.readModels` exposes:
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
| API | Meaning |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| `getInstanceById(type, key, sessionId?)` | Canonical, not deprecated. An empty missing document yields a prototype-only instance; JSON null may construct default fields |
|
|
16
|
+
| `findInstanceById(type, key, sessionId?)` | Returns **null when absent**; use for existence decisions |
|
|
17
|
+
| `getInstances(type, eventCount?)`, `getSnapshotsById(type, key)` | Instances and snapshots; `materialized` offers paged sink access |
|
|
18
|
+
| `watch(type)` | Async iterable, opens on first `next()`; no empty initial changeset |
|
|
19
|
+
| `createWatcher(type, options?)` | Starts immediately, exposes readiness and disposal, opt-in resume and overflow-failure limit. Resumption does not replay outage gaps |
|
|
20
|
+
| `register()` / `register(type)` | Register discovered models or one type |
|
|
21
|
+
| `release`, `releaseMany`, `releaseDocument` | Release protected values through Chronicle |
|
|
22
|
+
| `dehydrateSession` | Dehydrate a read-model session |
|
|
23
|
+
|
|
24
|
+
### Projection styles
|
|
9
25
|
|
|
10
26
|
- **Model-bound** — decorators on the read model, from
|
|
11
|
-
`@cratis/chronicle/projections`: `fromEvent`, `fromEvery`, `
|
|
27
|
+
`@cratis/chronicle/projections`: `fromEvent`, `fromEvery`, `setFrom`,
|
|
12
28
|
`setFromContext`, `setValue`, `join`, `addFrom`, `subtractFrom`, `increment`,
|
|
13
29
|
`decrement`, `count`, `childrenFrom`, `nested`, `clearWith`, `removedWith`,
|
|
14
30
|
`removedWithJoin`, `noAutoMap`, `notRewindable`, `passive`.
|
|
@@ -16,8 +32,35 @@ Two projection styles:
|
|
|
16
32
|
implementing `IProjectionFor<TReadModel>` with
|
|
17
33
|
`define(builder: IProjectionBuilderFor<TReadModel>): void`.
|
|
18
34
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
35
|
+
Chronicle's `@readModel()` is deprecated since 6.7.0: infer the read model from
|
|
36
|
+
mappings or the type supplied to projection/reducer registration. A custom id
|
|
37
|
+
uses `static readonly readModelId = 'custom-id'`. This does **not** deprecate
|
|
38
|
+
Arc's separate `@readModel()` query marker.
|
|
39
|
+
|
|
40
|
+
- `@index()` from `@cratis/chronicle/readModels` declares an ascending, non-unique
|
|
41
|
+
property index, including dotted nested/typed-collection paths.
|
|
42
|
+
- `@childrenFrom(Event, { childType, key, identifiedBy, parentKey })` supplies
|
|
43
|
+
typed children and their keys. Use `@noAutoMap` on children/nested properties
|
|
44
|
+
when explicit mappings should replace AutoMap.
|
|
45
|
+
- `@fromAllEvents` / fluent `fromAll()` subscribe to every event type.
|
|
46
|
+
`@fromEvery` maps only already-subscribed events; `@fromAll` is its deprecated
|
|
47
|
+
restricted-mapping alias, **not** all-event subscription.
|
|
48
|
+
- Composite key parts can use `set(target).toEventContextProperty(...)`,
|
|
49
|
+
`.toEventSourceId()`, or `.toValue(...)`; `usingKeyFromContext(...)` selects a
|
|
50
|
+
context key.
|
|
51
|
+
- `ChronicleOptions.readModelNamingPolicy` changes the storage container name,
|
|
52
|
+
not the model id. Align it with Arc MongoDB's naming policy when integrating;
|
|
53
|
+
Arc's `withMongoDB` + Arc-owned `withChronicle` do this by default.
|
|
54
|
+
|
|
55
|
+
### Append-time constraints
|
|
56
|
+
|
|
57
|
+
`@unique()` and repeatable `@removeConstraint(name)` are exported from
|
|
58
|
+
`@cratis/chronicle` and `@cratis/chronicle/events` since 6.8.0.
|
|
59
|
+
`@unique(name?, message?)` or `@unique({ name, message, eventSequences })`
|
|
60
|
+
marks a property unique across sources, or a class unique per source.
|
|
61
|
+
Same-named declarations merge; conflicting scopes throw.
|
|
62
|
+
|
|
63
|
+
Use `@constraint()` plus `IConstraint.define(builder)` for composite, scoped,
|
|
64
|
+
case-insensitive or multi-type rules. The builder offers `unique(...)`,
|
|
65
|
+
`uniqueFor(...)`, `perEventSourceType`, `perEventStreamType`, and
|
|
66
|
+
`perEventStreamId`. These protect appends, not command pre-validation.
|