@cratis/pi 7.34.1 → 7.36.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/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-command-surface/SKILL.md +7 -11
- package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +26 -6
- 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-command-surface/verification.json +7 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +3 -2
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +6 -2
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/generate-notes.md +34 -4
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +17 -24
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +19 -2
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -3
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/property-links.md +90 -4
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +19 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +3 -1
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +3 -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 +4 -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 +8 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +4 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +7 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +24 -11
- package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +10 -4
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1543 -131
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +9 -3
- 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 +8 -2
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +6 -3
- 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 +5 -0
- 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
|
@@ -9,9 +9,11 @@
|
|
|
9
9
|
- Cross-stream appends
|
|
10
10
|
- Failure shapes
|
|
11
11
|
|
|
12
|
-
Verified against `Cratis.Arc.Core` and `Cratis.Arc.Chronicle`
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Verified against `Cratis.Arc.Core` and `Cratis.Arc.Chronicle` **v22.75.0**
|
|
13
|
+
(Chronicle dependency 19.39.1). Sources: `Source/DotNET/Arc.Core/Commands/CommandPipeline.cs`,
|
|
14
|
+
`CommandOperationExecution.cs` and `Source/DotNET/Chronicle/Commands/CommandContextExtensions.cs`.
|
|
15
|
+
Read [decisions and routing](decisions-and-routing.md) for guarded reads,
|
|
16
|
+
stream templates, tags and post-commit completion.
|
|
15
17
|
|
|
16
18
|
## The pipeline around `Handle`
|
|
17
19
|
|
|
@@ -113,11 +115,8 @@ events in the same tuple are therefore appended to the id the handler just
|
|
|
113
115
|
generated, and the client receives it as the response.
|
|
114
116
|
|
|
115
117
|
```csharp
|
|
116
|
-
public (<ThingId>, <ThingRegistered>) Handle()
|
|
117
|
-
|
|
118
|
-
var id = <ThingId>.New();
|
|
119
|
-
return (id, new(<Name>));
|
|
120
|
-
}
|
|
118
|
+
public (<ThingId>, <ThingRegistered>) Handle([GeneratedValue("thing")] <ThingId> id) =>
|
|
119
|
+
(id, new(<Name>));
|
|
121
120
|
```
|
|
122
121
|
|
|
123
122
|
Returning two ids, or an id and another plain value, is the failure case.
|
|
@@ -136,6 +135,7 @@ public IEnumerable<object> Handle() =>
|
|
|
136
135
|
|
|
137
136
|
`EventForEventSourceId` also carries optional `Subject`, `EventStreamType` and
|
|
138
137
|
`EventStreamId` init members when the target stream is not the default.
|
|
138
|
+
Explicit wrapper routing wins over command-context routing in every return shape.
|
|
139
139
|
|
|
140
140
|
A command that always appends through a Chronicle event source definition (Arc 22.49.0
|
|
141
141
|
and later, definitions from Chronicle 19.30.0) declares it with
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Proxy generation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Wiring
|
|
6
|
+
- MSBuild properties
|
|
7
|
+
- What the generator extracts for client-side validation
|
|
8
|
+
- Failure modes
|
|
9
|
+
|
|
10
|
+
Verified against `Cratis.Arc.ProxyGenerator.Build` `22.75.0`.
|
|
4
11
|
|
|
5
12
|
## Wiring
|
|
6
13
|
|
|
@@ -8,7 +15,7 @@ Reference the build package from the project that contains the commands,
|
|
|
8
15
|
queries and read models, and set an output path:
|
|
9
16
|
|
|
10
17
|
```xml
|
|
11
|
-
<PackageReference Include="Cratis.Arc.ProxyGenerator.Build" Version="22.
|
|
18
|
+
<PackageReference Include="Cratis.Arc.ProxyGenerator.Build" Version="22.75.0" />
|
|
12
19
|
|
|
13
20
|
<PropertyGroup>
|
|
14
21
|
<CratisProxiesOutputPath>$(MSBuildThisFileDirectory)../<Web>/src/api</CratisProxiesOutputPath>
|
|
@@ -27,7 +34,8 @@ Output folders mirror the C# **namespace**, not the file path. A command in
|
|
|
27
34
|
|
|
28
35
|
## MSBuild properties
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
Properties below are forwarded by the package's `.props`/`.targets`; boolean
|
|
38
|
+
switches without a declared default are off when absent.
|
|
31
39
|
|
|
32
40
|
| Property | Default | Effect |
|
|
33
41
|
| --- | --- | --- |
|
|
@@ -42,12 +50,20 @@ The first nine properties below are declared with the default shown in the packa
|
|
|
42
50
|
| `CratisProxiesSkipFileIndexTracking` | `false` | Disables tracking which files the generator owns |
|
|
43
51
|
| `CratisProxiesSkipIndexGeneration` | `false` | Does not write the per-folder `index.ts` barrels |
|
|
44
52
|
| `CratisProxiesUseSourceFileAsOutputFile` | `false` | Names the generated file after the C# source file rather than the type |
|
|
53
|
+
| `CratisProxiesUseProxyFileSuffix` | off | Emits `Name.proxy.ts` and matching barrels; avoids `.ts`/`.tsx` basename collisions |
|
|
45
54
|
| `CratisProxiesEmitInterfaces` | off | **Arc ≥ 22.15.0** (the underlying `--emit-interfaces` flag exists from 22.14.0; the MSBuild property from 22.15.0). Emits plain TypeScript `interface`s instead of `@field`-decorated classes — no `@cratis/fundamentals` import in the output. Only for consumers that never reconstruct instances from JSON; command and query proxies need the classes |
|
|
46
55
|
|
|
47
56
|
⚠️ `CratisProxiesSkipOutputDeletion` defaults to `true`. Guidance that tells you
|
|
48
57
|
to set it to `true` "so the generator does not delete your hand-written files"
|
|
49
58
|
is describing the default, not a fix.
|
|
50
59
|
|
|
60
|
+
The generator preserves hand-written `index.ts` exports, and generated files
|
|
61
|
+
follow the Cratis ESLint configuration. Named concepts live only in the backend
|
|
62
|
+
model: generated TypeScript erases them to primitives; nullable concept properties
|
|
63
|
+
are optional. Source at Arc v22.75.0: `Tools/ProxyGenerator/ConceptMap.cs` and
|
|
64
|
+
`Tools/ProxyGenerator.Build/build/Cratis.Arc.ProxyGenerator.Build.targets` under
|
|
65
|
+
`Source/DotNET`.
|
|
66
|
+
|
|
51
67
|
Item groups the target also forwards: `AssemblyToPackageMapping`,
|
|
52
68
|
`ExcludeType`, `ExcludeNamespace`, `NamespaceRoot`, and `TypeToTsType`.
|
|
53
69
|
|
|
@@ -74,6 +90,9 @@ Rules declared on a `ConceptValidator<T>` are projected onto every property
|
|
|
74
90
|
typed as that concept, so declaring a value's format once validates it in the
|
|
75
91
|
browser too.
|
|
76
92
|
|
|
93
|
+
Conditional `When`/`Unless` rules are not projected to the client. Extracted
|
|
94
|
+
rules retain severity (`withSeverity`); command blocking thresholds still apply.
|
|
95
|
+
|
|
77
96
|
⚠️ **`Must(...)` is not extracted.** Neither is any rule that needs an injected
|
|
78
97
|
dependency. Those run on the server only, which means
|
|
79
98
|
`validateClientSide()` can pass while `execute()` still fails validation.
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Injecting a read model into a command
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Nullability is the required/optional switch
|
|
6
|
+
- `null` is not always what absence looks like
|
|
7
|
+
- Which provider owns a read model type
|
|
8
|
+
|
|
9
|
+
Arc injection verified at **v22.75.0**, with Chronicle dependency 19.39.1;
|
|
10
|
+
separate Chronicle absence behavior below retains its original version context.
|
|
11
|
+
Source: [read models in commands](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/chronicle/read-models/injecting-into-commands.md).
|
|
12
|
+
Plain models and keyed reads are advisory, not concurrency guards. For protected
|
|
13
|
+
reads use [decisions and routing](decisions-and-routing.md): opt into
|
|
14
|
+
`[ProtectedDecision]` before taking `DecisionRead<T>`; constructor-injected
|
|
15
|
+
validators are refused there.
|
|
4
16
|
|
|
5
17
|
A read model can be injected into a `CommandValidator<T>` constructor, into
|
|
6
18
|
`Provide()`, or into `Handle()`. Arc resolves it through an
|
|
@@ -16,14 +16,16 @@ recovery; calling `Handle()` directly only returns their declarations.
|
|
|
16
16
|
|
|
17
17
|
| Package | Version | Purpose |
|
|
18
18
|
| --- | --- | --- |
|
|
19
|
-
| `Cratis.Arc.Core` | `22.
|
|
20
|
-
| `Cratis.Arc.Chronicle` | `22.
|
|
19
|
+
| `Cratis.Arc.Core` | `22.75.0` | `Cratis.Arc.Commands.ICommandPipeline`, `CommandResult`, `ValidationResultSeverity` |
|
|
20
|
+
| `Cratis.Arc.Chronicle` | `22.75.0` | analyzer `ARCCHR0006` for reactor replay |
|
|
21
21
|
|
|
22
|
-
>
|
|
22
|
+
> Arc execution/severity and returned-reactor effects rechecked at v22.75.0.
|
|
23
|
+
> Arc's Chronicle dependency is 19.39.1; older source-pinned transaction/operation
|
|
24
|
+
> sections below remain explicitly version-qualified.
|
|
23
25
|
|
|
24
26
|
Reverify before claiming support for another version. Operation execution,
|
|
25
27
|
nesting restrictions, and backend recovery members below are verified at
|
|
26
|
-
**Arc v22.
|
|
28
|
+
**Arc v22.75.0**; see `cratis-arc-command-operation` for sources and limits.
|
|
27
29
|
|
|
28
30
|
## When this is the wrong tool
|
|
29
31
|
|
|
@@ -43,12 +45,17 @@ it records a failed compensator. Compose operation declarations instead.
|
|
|
43
45
|
## Inject and execute
|
|
44
46
|
|
|
45
47
|
> **Reactors have a declarative alternative.** With the Arc Chronicle integration a
|
|
46
|
-
> reactor handler can **return** the `[Command]`
|
|
47
|
-
>
|
|
48
|
+
> reactor handler can **return** the `[Command]` or a stable collection mixing
|
|
49
|
+
> commands, registered events and `EventForEventSourceId`. At v22.75.0 events
|
|
50
|
+
> append first; append rejection stops all commands, and the first failed command
|
|
51
|
+
> stops the rest. Earlier effects stay committed, so retries need idempotency.
|
|
52
|
+
> A denied or invalid result fails the partition instead of being
|
|
48
53
|
> discarded, and `[ExecuteCommandsAsSystem]` on the reactor class supplies a
|
|
49
54
|
> principal for those returned commands. That attribute does **not** cover manual
|
|
50
55
|
> `Execute` calls — the form below needs its own execution context. See the
|
|
51
|
-
> **cratis-chronicle-reactor** skill.
|
|
56
|
+
> **cratis-chronicle-reactor** skill. `[ExecuteCommandsAsSystem]` no longer leaks
|
|
57
|
+
> the system actor into the caller (fixed in 22.72.0). A reactor may also return
|
|
58
|
+
> `CompleteStream` directly; it cannot mix completion with events in a collection.
|
|
52
59
|
|
|
53
60
|
```csharp
|
|
54
61
|
public class <Name>Reactor(ICommandPipeline pipeline) : IReactor
|
|
@@ -138,8 +145,11 @@ Both `Execute` and `Validate` take an optional
|
|
|
138
145
|
`ValidationResultSeverity? allowedSeverity` from `Cratis.Arc.Validation`. The
|
|
139
146
|
levels are `Unknown = 0`, `Information = 1`, `Warning = 2`, `Error = 3`.
|
|
140
147
|
|
|
141
|
-
- With no `allowedSeverity`, **only `Error` blocks
|
|
142
|
-
warnings are filtered off
|
|
148
|
+
- With no `allowedSeverity`, **only `Error` blocks** for an unannotated command,
|
|
149
|
+
and information/warnings are filtered off. An attributed command uses
|
|
150
|
+
`[BlockOnValidationSeverity(...)]` as its inclusive blocking floor; `Unknown`
|
|
151
|
+
also blocks. Caller thresholds can tighten, never loosen, that floor.
|
|
152
|
+
Source at Arc v22.75.0: `Arc.Core/Commands/CommandValidationResults.cs`.
|
|
143
153
|
- With an `allowedSeverity`, anything **strictly greater** blocks. Passing
|
|
144
154
|
`Warning` lets warnings through onto the result while errors still block.
|
|
145
155
|
|
|
@@ -13,29 +13,33 @@ there is no controller or handler class to write by hand.
|
|
|
13
13
|
|
|
14
14
|
## Verified product sources
|
|
15
15
|
|
|
16
|
-
Verified against `Arc.Kotlin` at tag **`v7.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`ArcSymbolProcessorAuthorizationPrecedenceCompilationTest` and
|
|
22
|
-
`buildAuthorization` in `ArcSymbolProcessor.kt`, not documentation prose alone:
|
|
23
|
-
two of Arc.Kotlin's own reference pages (`reference/annotations.md`,
|
|
24
|
-
`troubleshooting.md`) are currently stale on this point relative to
|
|
25
|
-
`guides/security.md`, `reference/parity.md`, and the compiler source. The local workspace version is `0.0.0-SNAPSHOT`; use a released version
|
|
26
|
-
from Maven Central for a real application.
|
|
16
|
+
Verified against `Arc.Kotlin` at tag **`v7.7.0`**: JDK 17, Gradle 8.14.4,
|
|
17
|
+
Kotlin 2.4.20, KSP 2.3.12, Spring Boot 4.1.1, JUnit Jupiter 6.1.3.
|
|
18
|
+
Sources include `ArcSymbolProcessor.kt`, `GradlePlugin/ArcExtension.kt` and
|
|
19
|
+
`Integrations/Cratis`/`Integrations/Chronicle` publishing blocks. Use a released
|
|
20
|
+
version from Maven Central, not the local `0.0.0-SNAPSHOT`.
|
|
27
21
|
|
|
28
22
|
| Artifact | Purpose |
|
|
29
23
|
| --- | --- |
|
|
30
24
|
| `io.cratis:arc` | `io.cratis.arc.artifacts.Command`, `CommandKey`, `FromServices` |
|
|
31
25
|
| `io.cratis:arc-ksp` | the KSP processor that generates the command handler |
|
|
32
26
|
| `io.cratis:arc-spring-boot-starter` | Spring Boot auto-configuration, the command pipeline host |
|
|
33
|
-
| `io.cratis:
|
|
27
|
+
| `io.cratis:cratis` | recommended single dependency for an event-sourced app: Arc, Spring Boot wiring and Chronicle integration (`7.5.0+`) |
|
|
28
|
+
| `io.cratis:arc-chronicle-spring-boot-starter` | explicit alternative to `cratis`, same Arc version |
|
|
29
|
+
| `io.cratis:arc-testing` | in-process command and query scenarios (test scope) |
|
|
30
|
+
| `io.cratis:arc-spring-data-jpa`, `io.cratis:arc-spring-data-mongodb` | Spring Data read-model integrations |
|
|
31
|
+
| `io.cratis:arc-rxjava3` | RxJava 3 observable queries |
|
|
32
|
+
| `io.cratis:arc-observability-spring-boot-starter`, `io.cratis:arc-openapi-spring-boot-starter` | optional observability and OpenAPI |
|
|
34
33
|
| `io.cratis.arc` Gradle plugin | applies Kotlin/JVM + KSP, adds the dependencies, configures the module name and proxy output |
|
|
35
34
|
|
|
36
35
|
Arc.Kotlin has no Chronicle dependency by default. Add the optional Chronicle
|
|
37
|
-
|
|
38
|
-
read model; without it, `handle()` returns an ordinary response value.
|
|
36
|
+
integration only when a command should append a returned event or read a
|
|
37
|
+
Chronicle read model; without it, `handle()` returns an ordinary response value.
|
|
38
|
+
For that setup prefer `implementation("io.cratis:cratis:<version>")` over the
|
|
39
|
+
Arc-only starter in the example below. Arc `7.7.0` brings Chronicle.Kotlin
|
|
40
|
+
`6.10.0` transitively; its compatibility gate uses kernel `19.21.1` (19.x).
|
|
41
|
+
The standalone Chronicle `6.13.0` client needs `19.30.0`; do not assume that
|
|
42
|
+
latest/latest is a verified Arc integration pair.
|
|
39
43
|
|
|
40
44
|
Java applications still need Kotlin and KSP on the build — Arc generates Kotlin
|
|
41
45
|
adapters for Java declarations even in an all-Java application. A Java project
|
|
@@ -181,7 +185,8 @@ data class CompleteTask(val taskId: TaskId) {
|
|
|
181
185
|
|
|
182
186
|
## Return a Chronicle event
|
|
183
187
|
|
|
184
|
-
Requires
|
|
188
|
+
Requires `io.cratis:cratis` or the explicit
|
|
189
|
+
`io.cratis:arc-chronicle-spring-boot-starter`. A plain
|
|
185
190
|
event response needs a stable command key backed by `String`, `UUID`, a
|
|
186
191
|
number, or a concept wrapping one of those — mark it `@CommandKey`.
|
|
187
192
|
|
|
@@ -235,9 +240,10 @@ data class CreateTask(@CommandKey val id: String, val title: String) {
|
|
|
235
240
|
```
|
|
236
241
|
|
|
237
242
|
Each annotation is optional and must be nonblank with no control characters
|
|
238
|
-
when present (`ARCKSP0110` otherwise).
|
|
239
|
-
|
|
240
|
-
to the event-source identifier.
|
|
243
|
+
when present (`ARCKSP0110` otherwise). Omitted routing is forwarded as absent by `ChronicleOperationContext`:
|
|
244
|
+
with Chronicle `6.x`, the kernel resolves source/stream type/stream id to
|
|
245
|
+
`Default`/`All`/`Default`; subject defaults to the event-source identifier.
|
|
246
|
+
Pass all routing fields explicitly to preserve a legacy route. An explicit `EventForEventSourceId` value keeps
|
|
241
247
|
its own metadata; only its missing fields inherit the command's declaration.
|
|
242
248
|
Implement `CommandEventStreamIdProvider` or `CommandEventSubjectProvider`
|
|
243
249
|
instead when a value depends on the command instance — never combine a
|
|
@@ -271,6 +277,10 @@ A value from `provide` still takes precedence over this injection. A missing
|
|
|
271
277
|
model leaves the dependency unresolved rather than silently falling through to
|
|
272
278
|
another store; an invalid key or unavailable store fails the command.
|
|
273
279
|
|
|
280
|
+
Collection naming is shared with Arc's MongoDB integration in `7.7.0`.
|
|
281
|
+
Read [references/read-model-naming.md](references/read-model-naming.md) when
|
|
282
|
+
upgrading an existing projection or overriding its storage collection name.
|
|
283
|
+
|
|
274
284
|
## Protect the command
|
|
275
285
|
|
|
276
286
|
```kotlin
|
|
@@ -337,6 +347,17 @@ they read almost identically. The generated proxy's runtime contract
|
|
|
337
347
|
`@cratis/arc` client shape as Arc .NET; see the `cratis-arc-command` skill for
|
|
338
348
|
that contract.
|
|
339
349
|
|
|
350
|
+
`proxies.enabled` defaults to true; `removeStaleGeneratedFiles` defaults to
|
|
351
|
+
true. Set `proxies.useProxyFileSuffix` for `Name.proxy.ts` instead of `Name.ts`
|
|
352
|
+
(CLI: `--use-proxy-file-suffix`). `proxies.mapType(...)` and `mapPackage(...)`
|
|
353
|
+
map external DTOs to TypeScript types/npm packages. Do not map a command or
|
|
354
|
+
concept directly: command mappings fail, and `ConceptAs` is unwrapped to its
|
|
355
|
+
underlying primitive before mapping, so its named type exists only in the backend.
|
|
356
|
+
`@ExportedType` explicitly exports a DTO; KDoc/Javadoc summaries become JSDoc.
|
|
357
|
+
|
|
358
|
+
`endpoints.routePrefix`, `includeCommandNames`, `includeQueryNames`, and
|
|
359
|
+
`enableQueryHttpMethod` control endpoint conventions separately from proxy paths.
|
|
360
|
+
|
|
340
361
|
## Route near misses
|
|
341
362
|
|
|
342
363
|
- Adding or changing a rejection rule on an existing command:
|
|
@@ -344,6 +365,9 @@ that contract.
|
|
|
344
365
|
- Defining or changing a `@ReadModel` query: `cratis-arc-query-kotlin`.
|
|
345
366
|
- Talking to Chronicle outside a command (a plain worker, a reactor's own
|
|
346
367
|
event types, direct append): `cratis-chronicle-client-kotlin`.
|
|
368
|
+
- In-process command/query specifications: `cratis-arc-testing-kotlin`.
|
|
369
|
+
- Authentication, identity or tenant resolution: `cratis-arc-identity-and-tenancy-kotlin`.
|
|
370
|
+
- Spring Data storage and observations: `cratis-arc-spring-data-kotlin`.
|
|
347
371
|
- The C# Arc command shape and its causation-chain rules: `cratis-arc-command`.
|
|
348
372
|
|
|
349
373
|
## Verify
|
|
@@ -365,3 +389,5 @@ that contract.
|
|
|
365
389
|
`allWarningsAsErrors`, Java `-Xlint:all -Werror`).
|
|
366
390
|
- The generated proxy exists at the configured output directory when one was
|
|
367
391
|
configured, and the frontend compiles against it.
|
|
392
|
+
- Exercise the generated module through `cratis-arc-testing-kotlin`, including
|
|
393
|
+
rejection, authorization and append-failure paths when they apply.
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
|
|
4
|
+
# Share Arc and Chronicle collection names
|
|
5
|
+
|
|
6
|
+
Verified at `Arc.Kotlin v7.7.0`: `ChronicleArcAutoConfiguration.arcReadModelNamingPolicy`,
|
|
7
|
+
its Kotlin/Java conformance tests and `Documentation/guides/read-model-naming.mdx`.
|
|
8
|
+
The integration depends on Chronicle.Kotlin `6.10.0`.
|
|
9
|
+
|
|
10
|
+
With the MongoDB integration present, one Arc `NamingPolicy` bean is adapted
|
|
11
|
+
into Chronicle's `ReadModelNamingPolicy`. Chronicle's starter passes it to the
|
|
12
|
+
options it builds: a projected `Author` lands in `Authors`, where Arc reads it.
|
|
13
|
+
The adapter is absent when the Arc policy is missing/ambiguous or an application
|
|
14
|
+
already declares a Chronicle `ReadModelNamingPolicy` bean. The application bean
|
|
15
|
+
wins; keep its names consistent with Arc's reader.
|
|
16
|
+
|
|
17
|
+
The policy changes the storage container, not the read-model identifier or
|
|
18
|
+
observer identity. An explicit `@ReadModel(id = ...)` no longer determines the
|
|
19
|
+
collection name under the adapter. Without Arc's Mongo naming policy,
|
|
20
|
+
Chronicle retains identifier-based naming. An application that constructs its
|
|
21
|
+
own `ChronicleOptions` must call `withReadModelNamingPolicy(policy)` itself.
|
|
22
|
+
|
|
23
|
+
The old `pluralizeReadModelNames = false` workaround is no longer needed for
|
|
24
|
+
this JVM integration. Remove it only after verifying your affected type names
|
|
25
|
+
and reader/projection pairing. Existing documents do not move with the name:
|
|
26
|
+
replay affected projections into the new collections and verify their data;
|
|
27
|
+
drop the old collections only when no longer needed and deletion is authorized.
|
|
28
|
+
Do not claim a .NET-written collection uses the JVM inflector: Arc's default
|
|
29
|
+
policy uses Evo Inflector, while .NET uses Humanizer. Override measured disagreements.
|
|
@@ -19,15 +19,16 @@ Chronicle is not required.
|
|
|
19
19
|
|
|
20
20
|
| Package / source assembly | Verified version | Purpose |
|
|
21
21
|
| --- | --- | --- |
|
|
22
|
-
| `Cratis.Arc.Core` | `22.
|
|
23
|
-
| `Cratis.Arc.Core.CodeAnalysis` / `Cratis.Arc.Core.Generators` | `22.
|
|
24
|
-
| `Cratis.Arc.ProxyGenerator` | `22.
|
|
25
|
-
| `Cratis.Arc.Testing` | `22.
|
|
26
|
-
| `Cratis.Arc.Chronicle` / `Cratis.Arc.Chronicle.Testing` | `22.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[
|
|
22
|
+
| `Cratis.Arc.Core` | `22.75.0` | `Cratis.Arc.Commands`: operation declarations, pipeline, scopes, recovery observations |
|
|
23
|
+
| `Cratis.Arc.Core.CodeAnalysis` / `Cratis.Arc.Core.Generators` | `22.75.0` | ARC0016–ARC0018 and typed invocation; generator ships inside Core, not as a standalone package |
|
|
24
|
+
| `Cratis.Arc.ProxyGenerator` | `22.75.0` | Excludes operations and batches from the client response |
|
|
25
|
+
| `Cratis.Arc.Testing` | `22.75.0` | `Cratis.Arc.Testing.Commands.CommandScenario<TCommand>` and operation assertions |
|
|
26
|
+
| `Cratis.Arc.Chronicle` / `Cratis.Arc.Chronicle.Testing` | `22.75.0` | Deferred event commitment and real in-process constraint-rejection specs |
|
|
27
|
+
|
|
28
|
+
Rechecked at **Arc v22.75.0**; operation/recovery sources and the linked lessons
|
|
29
|
+
are unchanged since the prior 22.48.1 verification.
|
|
30
|
+
[Operation docs](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/commands/operations/index.md),
|
|
31
|
+
[execution reference](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/commands/operations/reference.md),
|
|
31
32
|
`Source/DotNET/Arc.Core/Commands/`, the analyzer/generator, and the testing
|
|
32
33
|
sources. Reverify for other versions. These are C# APIs, not the separate
|
|
33
34
|
Arc for TypeScript server API.
|
package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
- Supported scopes
|
|
13
13
|
- Troubleshooting
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
[product reference](https://github.com/Cratis/Arc/blob/v22.
|
|
15
|
+
Rechecked at **Arc v22.75.0** (operation/recovery sources unchanged since 22.48.1), against the
|
|
16
|
+
[product reference](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/commands/operations/reference.md)
|
|
17
17
|
and `Source/DotNET/Arc.Core/Commands/`. Types below are in
|
|
18
18
|
`Cratis.Arc.Commands`. Start with [the skill](../SKILL.md) to choose the boundary.
|
|
19
19
|
|
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
- Extend the failure coverage
|
|
10
10
|
- Migrate an existing service-backed Handle
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
Rechecked at **Arc v22.75.0**; operation assertions and these lessons are unchanged
|
|
13
|
+
since 22.48.1. These class excerpts follow the product's
|
|
14
|
+
[standalone lesson](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/testing/command-operations.md)
|
|
15
|
+
and [Chronicle rejection lesson](https://github.com/Cratis/Arc/blob/v22.75.0/Documentation/backend/csharp/testing/command-operations-with-chronicle.md).
|
|
15
16
|
See "Observe and test on the backend" in SKILL.md.
|
|
16
17
|
|
|
17
18
|
The standalone examples reuse `ReservationId`, `SeatId`, `ISeatReservations`,
|
|
@@ -18,7 +18,7 @@ Arc supplies the route, body binding, validation, authorization, and the
|
|
|
18
18
|
`@cratis/arc.testing`, `@cratis/arc.mongodb`, `@cratis/arc.drizzle`,
|
|
19
19
|
`@cratis/arc.chronicle`, `@cratis/cratis`, `@cratis/arc.proxygenerator` and
|
|
20
20
|
`@cratis/eslint-plugin-arc-core` are an unpublished source preview (0.x
|
|
21
|
-
manifests;
|
|
21
|
+
manifests; GitHub pre-releases v0.1.0–v0.57.2). The API may still change. `npm install @cratis/arc.core` fails.
|
|
22
22
|
- **`@cratis/arc` is a different package.** `@cratis/arc`, `@cratis/arc.react` and
|
|
23
23
|
`@cratis/arc.react.mvvm` are the published **client** runtime, built from
|
|
24
24
|
`Cratis/Arc`. Generated proxies import them in the frontend. The server packages
|
|
@@ -29,26 +29,28 @@ Arc supplies the route, body binding, validation, authorization, and the
|
|
|
29
29
|
|
|
30
30
|
## Verified product sources
|
|
31
31
|
|
|
32
|
-
Verified against `Cratis/Arc.TypeScript`
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
`
|
|
32
|
+
Verified against `Cratis/Arc.TypeScript` tag **v0.57.2** (GitHub pre-release;
|
|
33
|
+
server manifests 0.57.2), reading package exports, `Documentation/**`, and
|
|
34
|
+
`Samples/Tasks` / `Samples/Library`. Unreleased main/0.58.0 behavior is excluded.
|
|
35
|
+
Chronicle SDK: peer `^6.29.0`, built against/sample pin `6.35.0`;
|
|
36
|
+
Fundamentals peer `^7.19.6`, Library pin `7.22.0`. The Chronicle integration
|
|
37
|
+
needs Node 22.19+, `zod ^4.1`, `rxjs ^7.8.2`, and an optional
|
|
38
|
+
`@cratis/arc.testing` peer for scenarios.
|
|
38
39
|
|
|
39
|
-
Read [references/hosting-and-storage.md](references/hosting-and-storage.md) when
|
|
40
|
+
Read [references/hosting-and-storage.md](references/hosting-and-storage.md) when
|
|
41
|
+
hosting or wiring storage. Read [references/chronicle-events.md](references/chronicle-events.md)
|
|
42
|
+
when returning or specifying Chronicle events.
|
|
40
43
|
|
|
41
44
|
## Chronicle traps
|
|
42
45
|
|
|
43
|
-
- Appending and projecting are separate
|
|
44
|
-
|
|
45
|
-
`completionTimeoutMs` makes the command wait for observers, but Chronicle waits
|
|
46
|
-
for **every** observer on the log (Cratis/Chronicle#4132), so a projection or
|
|
47
|
-
reactor that does not handle the event makes every command time out with 500.
|
|
46
|
+
- Appending and projecting are separate; prefer observable reads. See the
|
|
47
|
+
Chronicle reference before using `completionTimeoutMs` to wait for observers.
|
|
48
48
|
|
|
49
|
-
-
|
|
50
|
-
|
|
51
|
-
`
|
|
49
|
+
- In-memory scenarios evaluate reducers and fixture-bounded projections through
|
|
50
|
+
the SDK's `ReadModelScenario`; unsupported shapes throw
|
|
51
|
+
`UnsupportedProjectionOperation`. Aggregates, constraints, concurrency,
|
|
52
|
+
listing/watching and history beyond that boundary need `ChronicleKernelScenario`
|
|
53
|
+
against `ARC_CHRONICLE_TEST_URL`.
|
|
52
54
|
|
|
53
55
|
## Set up a project
|
|
54
56
|
|
|
@@ -86,14 +88,15 @@ version ranges; npm does not, and the tarball then fails to install. A
|
|
|
86
88
|
"rootDir": ".",
|
|
87
89
|
"outDir": "dist"
|
|
88
90
|
},
|
|
89
|
-
"include": ["main.ts", "Features/**/*.ts"]
|
|
91
|
+
"include": ["main.ts", "Features/**/*.ts"],
|
|
92
|
+
"exclude": ["Features/**/*.proxy.ts", "Features/**/*.tsx"]
|
|
90
93
|
}
|
|
91
94
|
```
|
|
92
95
|
|
|
93
96
|
- **No `experimentalDecorators`.** Arc's decorators compile as standard TC39
|
|
94
97
|
decorators, as the samples do; `ESNext.Decorators` declares `Symbol.metadata`.
|
|
95
98
|
Legacy `experimentalDecorators` also work. The Library sample compiles its
|
|
96
|
-
`@cratis/chronicle` 6.
|
|
99
|
+
`@cratis/chronicle` 6.35 event types and projections under the same
|
|
97
100
|
standard-decorator settings. Generated frontend proxies are the exception:
|
|
98
101
|
they compile with `experimentalDecorators: true`.
|
|
99
102
|
- With `NodeNext`, relative imports carry a `.js` extension. `ESNext` +
|
|
@@ -127,14 +130,22 @@ await app.run({ port: Number(process.env.PORT ?? 3000) });
|
|
|
127
130
|
| `ArcApplication.createBuilder(options?)` | Starts the application; the Node builder reads `appsettings.json` (`Cratis:Arc`) and `Cratis__...` environment variables |
|
|
128
131
|
| `useGeneratedMetadata(metadata)` | Installs parameter and return-type metadata extracted from source. Call it **before** `discover()`/`add()` |
|
|
129
132
|
| `services.addSingleton(Token)` | Registers a service; `addScoped`/`addTransient` take factories. Classes can also carry `@singleton()`, `@scoped()`, `@transient()` |
|
|
130
|
-
| `discover(folderUrl)` | Imports every module under the folder and registers **exported**, decorated artifacts. Skips `dist`, `node_modules`, `given`, `for_*`, `index.*`, declaration files |
|
|
133
|
+
| `discover(folderUrl)` | Imports every module under the folder and registers **exported**, decorated artifacts. Skips `dist`, `node_modules`, `given`, `for_*`, `index.*`, declaration files and `*.proxy.ts/.tsx` |
|
|
131
134
|
| `add(...types)` | Registers artifacts explicitly — required on the Fetch entry, which cannot discover |
|
|
132
135
|
| `build()` | Validates the whole graph (missing services, lifetime mismatches, misplaced decorators, stale metadata) and throws before any listener opens |
|
|
133
136
|
| `app.run()` / `app.start()` | Standalone Node host. `app.dispose()` stops it and disposes services |
|
|
134
137
|
|
|
135
|
-
`discover()` refuses a folder
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
`discover()` refuses a folder containing the entry point; use `Features/`.
|
|
139
|
+
`Cratis:Arc:Development: true` is local-only.
|
|
140
|
+
|
|
141
|
+
### Secure discovery defaults (0.56.0+)
|
|
142
|
+
|
|
143
|
+
Outside **Development**, catalogs, identity discovery and `/openapi.json` require
|
|
144
|
+
authentication; without it they are unmapped with a warning. Explicitly requiring
|
|
145
|
+
authentication without configuring it fails startup. `development: true` is no bypass.
|
|
146
|
+
Read [references/identity-and-introspection.md](references/identity-and-introspection.md)
|
|
147
|
+
when configuring authentication, native principals, identity providers or
|
|
148
|
+
introspection access for deployed tools. Source proxy generation needs no host.
|
|
138
149
|
|
|
139
150
|
## Lay out the slice
|
|
140
151
|
|
|
@@ -279,6 +290,11 @@ is enabled; do not throw for a rejection the user can act on. Rules that can
|
|
|
279
290
|
run before `handle()` belong in validators: see
|
|
280
291
|
`cratis-arc-validation-typescript`.
|
|
281
292
|
|
|
293
|
+
Read [references/command-operations.md](references/command-operations.md) when
|
|
294
|
+
returning inline work (`CommandOperation`, `operations(...)`), combining it with
|
|
295
|
+
a response, or choosing several business outcomes. It covers commit-aware
|
|
296
|
+
compensation; durable delivery needs its own workflow.
|
|
297
|
+
|
|
282
298
|
## Protect the command
|
|
283
299
|
|
|
284
300
|
```typescript
|
|
@@ -378,6 +394,10 @@ Read [references/command-specifications.md](references/command-specifications.md
|
|
|
378
394
|
|
|
379
395
|
Folder and naming conventions for specs are `cratis-specifications-typescript`.
|
|
380
396
|
|
|
397
|
+
Read [references/observability-and-host-scopes.md](references/observability-and-host-scopes.md)
|
|
398
|
+
when instrumenting commands/queries or using `ArcServer.runInScope` for a trusted
|
|
399
|
+
host integration; a service scope is not an authorization mechanism.
|
|
400
|
+
|
|
381
401
|
## Route near misses
|
|
382
402
|
|
|
383
403
|
- A rejection rule on an existing command: `cratis-arc-validation-typescript`.
|
|
@@ -11,12 +11,11 @@
|
|
|
11
11
|
- Reactors that return commands
|
|
12
12
|
- Specify it without a kernel
|
|
13
13
|
|
|
14
|
-
Verified against `Cratis/Arc.TypeScript`
|
|
15
|
-
`v0.33.0` plus three commits): `Documentation/chronicle/**`,
|
|
14
|
+
Verified against `Cratis/Arc.TypeScript` tag **v0.57.2** (GitHub pre-release): `Documentation/chronicle/**`,
|
|
16
15
|
`Documentation/testing/chronicle.md`, `Source/Chronicle/index.ts`, and
|
|
17
16
|
`Samples/Library`. `@cratis/arc.chronicle` is **experimental** and, like every
|
|
18
17
|
package in the repository, not published to npm. `@cratis/chronicle` (the SDK)
|
|
19
|
-
is published; the integration peers `^6.
|
|
18
|
+
is published; the integration peers `^6.29.0` and is built against 6.35.0.
|
|
20
19
|
|
|
21
20
|
## Register the integration
|
|
22
21
|
|
|
@@ -90,6 +89,11 @@ sample's `UniqueAuthorName` does).
|
|
|
90
89
|
|
|
91
90
|
## Rejections and the batch
|
|
92
91
|
|
|
92
|
+
Appending and projecting are separate: immediate queries may be stale. Prefer
|
|
93
|
+
observable reads. `completionTimeoutMs` waits for observers, but Chronicle waits
|
|
94
|
+
for **every** observer on the log (Cratis/Chronicle#4132); an observer that does
|
|
95
|
+
not handle the event can make every command time out with 500.
|
|
96
|
+
|
|
93
97
|
- A constraint or concurrency rejection answers 400 with a validation result
|
|
94
98
|
(`reason` `constraintViolation` or `concurrencyViolation`) and appends nothing.
|
|
95
99
|
- Events returned by nested Arc commands that share tenant, correlation ID and
|
|
@@ -118,6 +122,24 @@ replay by default since SDK 6.9.0 — mark effects `@onceOnly()`, and keep retur
|
|
|
118
122
|
commands safe to repeat after a failed-partition re-delivery. Reactor authoring
|
|
119
123
|
itself is `cratis-chronicle-client-typescript`.
|
|
120
124
|
|
|
125
|
+
`ARCCHR0006` in `@cratis/eslint-plugin-arc-core`'s `recommended-type-checked`
|
|
126
|
+
preset flags a command-returning handler without `@onceOnly()` or a replay
|
|
127
|
+
handler. Prefer explicit replay decisions, not lint suppression.
|
|
128
|
+
|
|
129
|
+
Preview `withChronicle({ ..., activateArtifactsInScopes: true })` on an Arc-owned
|
|
130
|
+
client resolves reactors/reducers through Arc DI, one scope per delivered batch,
|
|
131
|
+
with the Chronicle namespace as tenant and no principal. Existing registrations
|
|
132
|
+
win; otherwise discovered reactors/reducers are registered scoped. The SDK
|
|
133
|
+
activator API arrived in 6.17.0; this integration requires its 6.29.0 peer minimum.
|
|
134
|
+
For a caller-owned client, supply `chronicleArtifactActivator(...)` as
|
|
135
|
+
`artifactActivator` and `reactorCommandResultHandler(...)` as
|
|
136
|
+
`reactorResultHandler`, then opt in to `activateArtifactsInScopes`. Build Arc
|
|
137
|
+
before observing and dispose Arc before that client. See the tagged
|
|
138
|
+
`Documentation/chronicle/reactors/scoped-activation.md`.
|
|
139
|
+
|
|
140
|
+
Read [command-operations.md](command-operations.md) when combining events with
|
|
141
|
+
inline operations, or rehydrating a `commandAggregate` for a state-based decision.
|
|
142
|
+
|
|
121
143
|
## Specify it without a kernel
|
|
122
144
|
|
|
123
145
|
`ChronicleCommandScenario` from `@cratis/arc.chronicle/testing` runs the real
|
|
@@ -138,7 +160,16 @@ await scenario.dispose();
|
|
|
138
160
|
- Pass the command, its event types, validators and read-model types to
|
|
139
161
|
`for(...)`; the in-memory log refuses an unregistered event type.
|
|
140
162
|
- `givenReadModel(Type, id, instance, tenant?)` pins state;
|
|
141
|
-
`scenario.given.forEventSource(id).events(...)` seeds reducer history
|
|
142
|
-
6.14.0
|
|
163
|
+
`scenario.given.forEventSource(id, tenant?).events(...)` seeds reducer history
|
|
164
|
+
(SDK >=6.14.0) and projections (>=6.19.0) through SDK `ReadModelScenario`.
|
|
165
|
+
`.readModel(instance)` pins state on the same given builder.
|
|
143
166
|
- `shouldHaveAppendedEvent` does not check count or order — assert
|
|
144
167
|
`appendedEvents` when either matters.
|
|
168
|
+
- `ChronicleQueryScenario.for(Model, 'method', ...artifacts)` runs snapshot
|
|
169
|
+
queries with the same tenant-scoped given events/read models.
|
|
170
|
+
- Fixture-bounded projections/reducers work in-process. Unsupported definitions
|
|
171
|
+
throw `UnsupportedProjectionOperation`; give declarative projections an
|
|
172
|
+
explicit model (`@projection('', ReadModel)`) so lookups of other seeded models
|
|
173
|
+
can associate them. No aggregate rehydration, constraint/concurrency enforcement,
|
|
174
|
+
listing/watching, or projection history beyond that boundary: use
|
|
175
|
+
`ChronicleKernelScenario` at `ARC_CHRONICLE_TEST_URL`.
|