@cratis/pi 7.14.2 → 7.14.4
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/skills/cratis-application-slice-conformance/SKILL.md +11 -2
- package/package/corpus/skills/cratis-application-slice-conformance/references/build-prompts.md +8 -0
- package/package/corpus/skills/cratis-application-slice-conformance/references/checklists.md +10 -6
- package/package/corpus/skills/cratis-application-slice-specifications/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/SKILL.md +11 -7
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authentication.md +12 -2
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/authorization.md +16 -1
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/frontend.md +7 -0
- package/package/corpus/skills/cratis-arc-authentication-authorization-and-identity/references/observable-emission-guards.md +9 -0
- package/package/corpus/skills/cratis-arc-command/SKILL.md +20 -15
- package/package/corpus/skills/cratis-arc-command/references/command-result.md +7 -0
- package/package/corpus/skills/cratis-arc-command/references/handler-shapes.md +10 -3
- package/package/corpus/skills/cratis-arc-command-execution/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-command-operation/SKILL.md +5 -1
- package/package/corpus/skills/cratis-arc-command-operation/references/execution-and-recovery.md +12 -0
- package/package/corpus/skills/cratis-arc-command-operation/references/testing.md +10 -3
- package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +20 -116
- package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +11 -8
- package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md +63 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +10 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +38 -0
- package/package/corpus/skills/cratis-arc-command-typescript/references/slice-layout.md +19 -0
- package/package/corpus/skills/cratis-arc-command-typescript/verification.json +1 -1
- package/package/corpus/skills/cratis-arc-command-validation/SKILL.md +1 -1
- package/package/corpus/skills/cratis-arc-query-paging/SKILL.md +11 -10
- package/package/corpus/skills/cratis-arc-react-page/SKILL.md +30 -19
- package/package/corpus/skills/cratis-arc-react-page/references/data-page.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/data-tables.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/dialogs.md +12 -10
- package/package/corpus/skills/cratis-arc-react-page/references/from-screenplay.md +10 -0
- package/package/corpus/skills/cratis-arc-react-page/references/mvvm.md +11 -0
- package/package/corpus/skills/cratis-arc-react-page/references/queries-and-commands.md +7 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/SKILL.md +58 -122
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md +26 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/discovery.md +22 -0
- package/package/corpus/skills/cratis-chronicle-client-dotnet/references/hosting.md +31 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/SKILL.md +52 -131
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/append-api.md +19 -0
- package/package/corpus/skills/cratis-chronicle-client-elixir/references/variants.md +73 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/SKILL.md +29 -232
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/connection-lifecycle.md +20 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/discovery-and-registration.md +44 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/java-api.md +33 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/spring-boot.md +54 -0
- package/package/corpus/skills/cratis-chronicle-client-kotlin/references/variants.md +77 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/SKILL.md +26 -102
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/read-models-and-projections.md +23 -0
- package/package/corpus/skills/cratis-chronicle-client-typescript/references/variants.md +63 -0
- package/package/corpus/skills/cratis-chronicle-event-type-migration/SKILL.md +13 -13
- package/package/corpus/skills/cratis-chronicle-mcp-inspection/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +13 -4
- package/package/corpus/skills/cratis-chronicle-projection/references/fluent-builder.md +10 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/model-bound-attributes.md +14 -6
- package/package/corpus/skills/cratis-chronicle-projection/references/variants.md +9 -0
- package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +7 -49
- package/package/corpus/skills/cratis-chronicle-reactor/references/domain-failures.md +19 -0
- package/package/corpus/skills/cratis-chronicle-reactor/references/specifications.md +33 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +2 -2
- package/package/corpus/skills/cratis-chronicle-read-model/references/queries.md +11 -0
- package/package/corpus/skills/cratis-chronicle-read-model-specifications/SKILL.md +1 -0
- package/package/corpus/skills/cratis-chronicle-reducer/SKILL.md +1 -1
- package/package/corpus/skills/cratis-chronicle-web-workbench/SKILL.md +24 -24
- package/package/corpus/skills/cratis-content-length/SKILL.md +1 -1
- package/package/corpus/skills/cratis-content-length/references/length-evidence.md +12 -0
- package/package/corpus/skills/cratis-developer-marketing/SKILL.md +19 -19
- package/package/corpus/skills/cratis-developer-marketing/references/measurement.md +10 -0
- package/package/corpus/skills/cratis-developer-marketing/references/playbook-evidence.md +10 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/SKILL.md +5 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/code-style.md +15 -0
- package/package/corpus/skills/cratis-engineering-csharp-conventions/references/exceptions-logging-and-di.md +9 -4
- package/package/corpus/skills/cratis-engineering-decision-record/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-decision-record/references/record-format.md +8 -0
- package/package/corpus/skills/cratis-engineering-docs-authoring/SKILL.md +1 -2
- package/package/corpus/skills/cratis-engineering-effect-boundaries/references/failure-archetypes.md +10 -0
- package/package/corpus/skills/cratis-fundamentals-concept/SKILL.md +1 -1
- package/package/corpus/skills/cratis-fundamentals-type-discovery/SKILL.md +1 -1
- package/package/corpus/skills/cratis-lens-browser-extension/SKILL.md +18 -18
- package/package/corpus/skills/cratis-performance-review/SKILL.md +1 -1
- package/package/corpus/skills/cratis-release-notes/SKILL.md +1 -0
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +29 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +16 -4
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/effects-and-idempotency.md +4 -15
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +6 -2
- package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/translation-patterns.md +1 -6
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +45 -245
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/capture-map-and-example.md +42 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/complete-examples.md +155 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/specifying-triggers-and-clock.md +27 -0
- package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/trigger-reads-example.md +21 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +69 -227
- package/package/corpus/skills/cratis-screenplay-command-surface/references/context.md +10 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +51 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/inline-events.md +62 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/policy-persona-seed.md +46 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/references/validate-rules.md +36 -0
- package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +11 -11
- package/package/corpus/skills/cratis-screenplay-discovery/SKILL.md +10 -3
- package/package/corpus/skills/cratis-screenplay-discovery/references/facilitation.md +1 -6
- package/package/corpus/skills/cratis-screenplay-discovery/references/human-workshop.md +13 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/personas-and-causes.md +8 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/plotting-and-handoff.md +11 -0
- package/package/corpus/skills/cratis-screenplay-discovery/references/storming-loop.md +7 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +75 -198
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/file-layout.md +89 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/naming-primitives.md +26 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +14 -1
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +8 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/provenance.md +10 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/references/slice-type-rules.md +12 -0
- package/package/corpus/skills/cratis-screenplay-event-modeling/verification.json +12 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/SKILL.md +5 -6
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/candidate-inventory.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/prologue-safety.md +8 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/side-car-migration.md +11 -0
- package/package/corpus/skills/cratis-screenplay-legacy-extraction/references/ui-observation.md +1 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +33 -10
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +8 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-loop.md +13 -17
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +11 -0
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +9 -9
- package/package/corpus/skills/cratis-screenplay-model-review/references/business-questions.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +15 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/report-template.md +9 -0
- package/package/corpus/skills/cratis-screenplay-model-review/references/worked-example.md +9 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +17 -8
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/handoff-template.md +8 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/identity-and-edits.md +1 -6
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +19 -0
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/safety.md +1 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/verdicts-and-modes.md +11 -1
- package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +2 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +3 -4
- package/package/corpus/skills/cratis-screenplay-projections/references/pdl-grammar.md +8 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +3 -3
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +1 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/worked-example.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/SKILL.md +10 -10
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/coverage-matrix.md +8 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/invoicing-dues-example.md +4 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-catalogue.md +17 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-examples.md +10 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/scenario-workshop.md +11 -0
- package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/view-and-story-specs.md +12 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/SKILL.md +2 -2
- package/package/corpus/skills/cratis-screenplay-slice-design/references/command-inventory.md +7 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +8 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/read-model-design.md +16 -0
- package/package/corpus/skills/cratis-screenplay-slice-design/references/slicing.md +10 -0
- package/package/corpus/skills/cratis-screenplay-specifications/SKILL.md +52 -360
- package/package/corpus/skills/cratis-screenplay-specifications/references/actions-beyond-commands.md +34 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/concept-rules.md +77 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +39 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +72 -0
- package/package/corpus/skills/cratis-screenplay-specifications/references/worked-example.md +110 -0
- package/package/corpus/skills/cratis-screenplay-specifications/verification.json +6 -6
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +21 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +13 -0
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/chronicle-boundaries.md +1 -1
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/consistency-and-concurrency.md +16 -20
- package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/stream-patterns.md +16 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +13 -7
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/generated-responses-example.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +10 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +12 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +11 -13
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/flow-review.md +1 -1
- package/package/corpus/skills/cratis-social-feed-post/SKILL.md +10 -10
- package/package/corpus/skills/cratis-social-feed-post/references/engagement-evidence.md +12 -0
- package/package/corpus/skills/cratis-specifications-csharp/SKILL.md +13 -2
- package/package/corpus/skills/cratis-specifications-csharp/references/application-scenarios.md +10 -10
- package/package/corpus/skills/cratis-specifications-csharp/references/csharp-patterns.md +10 -0
- package/package/corpus/skills/cratis-specifications-csharp/references/integration-specs.md +9 -0
- package/package/corpus/skills/cratis-specifications-typescript/SKILL.md +1 -2
- package/package/corpus/skills/cratis-specifications-typescript/references/typescript-patterns.md +11 -1
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +30 -21
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +9 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/render-example.md +5 -0
- package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +2 -4
- package/package/corpus/skills/cratis-studio-mcp-safety-guidance/SKILL.md +2 -2
- package/package/corpus/skills/cratis-writing-voice-and-cadence/SKILL.md +39 -39
- package/package/corpus/skills/cratis-writing-voice-and-cadence/references/ai-tells.md +10 -0
- package/package.json +1 -1
package/package/corpus/skills/cratis-arc-command-typescript/references/command-specifications.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
## Specify the command with CommandScenario
|
|
2
|
+
|
|
3
|
+
`@cratis/arc.testing` runs a command through the real pipeline in-process —
|
|
4
|
+
binding, authorization, validators, services, `provide()`, `handle()` — without
|
|
5
|
+
a listener. From `Samples/Tasks`:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { CommandScenario } from '@cratis/arc.testing';
|
|
9
|
+
import { Tasks } from '../../../Tasks.js';
|
|
10
|
+
import { RegisterTask, RegisterTaskValidator } from '../../Registration.js';
|
|
11
|
+
import { metadata } from '../../../../generatedMetadata.js';
|
|
12
|
+
|
|
13
|
+
export class a_task_registration {
|
|
14
|
+
tasks = new Tasks();
|
|
15
|
+
scenario = CommandScenario.for(RegisterTask, RegisterTaskValidator);
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
this.scenario.extend(builder => builder.useGeneratedMetadata(metadata));
|
|
19
|
+
this.scenario.services.addSingleton(Tasks, this.tasks);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { given, type ScenarioCommandResult } from '@cratis/arc.testing';
|
|
26
|
+
import { TaskId } from '../../../TaskId.js';
|
|
27
|
+
import { TaskTitle } from '../../../TaskTitle.js';
|
|
28
|
+
import { a_task_registration } from '../given/a_task_registration.js';
|
|
29
|
+
|
|
30
|
+
describe('when registering a task with a valid title', given(a_task_registration, context => {
|
|
31
|
+
const id = TaskId.create();
|
|
32
|
+
let result: ScenarioCommandResult;
|
|
33
|
+
|
|
34
|
+
beforeAll(async () => {
|
|
35
|
+
result = await context.scenario.execute({ id, title: new TaskTitle('Plan release') });
|
|
36
|
+
});
|
|
37
|
+
afterAll(async () => { await context.scenario.dispose(); });
|
|
38
|
+
|
|
39
|
+
it('should succeed through the command pipeline', () => { result.shouldBeSuccessful(); });
|
|
40
|
+
}));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- `CommandScenario.for(Command, ...artifacts)` — pass the validators and other
|
|
44
|
+
artifacts the command needs; it cannot discover classes that were never
|
|
45
|
+
imported.
|
|
46
|
+
- Register fakes on `scenario.services` **before** the first call.
|
|
47
|
+
`extend(builder => ...)` installs builder setup such as generated metadata.
|
|
48
|
+
- `execute(values)` runs everything; `validate(values)` stops before
|
|
49
|
+
`provide()`/`handle()`. `withContext({ principal, tenantId, correlationId })`
|
|
50
|
+
sets a trusted caller.
|
|
51
|
+
- `given(Context, ...)` creates **one** context per `describe`: act in
|
|
52
|
+
`beforeAll`, dispose in `afterAll`. A disposed scenario cannot run again.
|
|
53
|
+
- Assertions on the result: `shouldBeSuccessful()`, `shouldNotBeSuccessful()`,
|
|
54
|
+
`shouldBeValid()`, `shouldHaveValidationErrors()`,
|
|
55
|
+
`shouldHaveValidationErrorForMember(member)`, `shouldHaveValidationErrorFor(text)`,
|
|
56
|
+
`shouldHaveValidationErrorBecauseOf(reason)`, `shouldBeAuthorized()`,
|
|
57
|
+
`shouldNotBeAuthorized()`, `shouldHaveExceptions()`, `shouldNotHaveExceptions()`.
|
|
58
|
+
Do not assert presentation text by default; assert exact wording only when it
|
|
59
|
+
is the specified behavior, named in the fact. A text-matching helper alone
|
|
60
|
+
does not prove exact equality; compare the actual message when equality is
|
|
61
|
+
the requirement.
|
|
62
|
+
- Specify authorization for three callers — anonymous, without the role, with
|
|
63
|
+
it — and on `validate()` too.
|
package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Hosting and storage for Arc for TypeScript
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- The host only delivers requests
|
|
6
|
+
- Express
|
|
7
|
+
- Fastify
|
|
8
|
+
- Hono
|
|
9
|
+
- Fetch API entry
|
|
10
|
+
- Observable-query WebSockets from a dev server
|
|
11
|
+
- Storage integrations
|
|
12
|
+
|
|
3
13
|
Verified against `Cratis/Arc.TypeScript` `main` at commit `94d398d` (tag
|
|
4
14
|
`v0.33.0` plus three commits): `Documentation/overview.md`, `hosts/**`,
|
|
5
15
|
`mongodb/getting-started.md`, `sql/getting-started.md`,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
## Generate metadata and proxies
|
|
2
|
+
|
|
3
|
+
`arc-proxygenerator` (package `@cratis/arc.proxygenerator`, also unpublished)
|
|
4
|
+
reads the TypeScript source with the compiler API — it never queries a running
|
|
5
|
+
server. It writes server metadata and client proxies in one run. The CLI
|
|
6
|
+
rejects relative paths, and the output folder must exist:
|
|
7
|
+
|
|
8
|
+
```javascript
|
|
9
|
+
import { spawnSync } from 'node:child_process';
|
|
10
|
+
import { mkdirSync } from 'node:fs';
|
|
11
|
+
import process from 'node:process';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
const path = relative => fileURLToPath(new URL(relative, import.meta.url));
|
|
15
|
+
const cli = fileURLToPath(new URL('./cli.js', import.meta.resolve('@cratis/arc.proxygenerator')));
|
|
16
|
+
mkdirSync(path('./generated'), { recursive: true });
|
|
17
|
+
const result = spawnSync(process.execPath, [cli,
|
|
18
|
+
'--project', path('./tsconfig.json'),
|
|
19
|
+
'--artifacts', path('./Features'),
|
|
20
|
+
'--output', path('./generated'),
|
|
21
|
+
'--metadata', path('./Features/generatedMetadata.ts'),
|
|
22
|
+
...process.argv.slice(2)], { stdio: 'inherit' });
|
|
23
|
+
process.exitCode = result.status ?? 1;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
- Commit the metadata module; never edit it. Regenerate after **every** change
|
|
27
|
+
to a command, read model or validator — `useGeneratedMetadata` throws
|
|
28
|
+
`Stale generated artifact metadata for <Type>` otherwise. Reordering
|
|
29
|
+
parameters without changing their count goes undetected, so gate CI with
|
|
30
|
+
`--check-metadata` and keep `--watch` running beside `tsx` while developing.
|
|
31
|
+
- `--artifacts` must be the folder passed to `discover()`. Match route options
|
|
32
|
+
(`--api-prefix`, `--segments-to-skip`, `--root-namespace`) to the server's
|
|
33
|
+
`generatedApis` options, or proxies call URLs the server does not serve.
|
|
34
|
+
- Generated proxies import the **published** `@cratis/arc` and
|
|
35
|
+
`@cratis/arc.react` (the docs pin `22.19.1`) plus `@cratis/fundamentals`.
|
|
36
|
+
Compile them in `Bundler` resolution with `experimentalDecorators: true`, and
|
|
37
|
+
import `reflect-metadata` once in the frontend entry. Consuming the proxies in
|
|
38
|
+
React is `cratis-arc-react-page`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## Lay out the slice
|
|
2
|
+
|
|
3
|
+
House convention (not a runtime requirement): one folder per behavior, one
|
|
4
|
+
TypeScript file named for the behavior holding the command, its validator and —
|
|
5
|
+
for Chronicle — its events. Concepts shared by several slices live one level up.
|
|
6
|
+
Specs sit beside the slice in `for_<Subject>/when_<action>/<case>.ts`, which
|
|
7
|
+
`discover()` skips.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Features/Tasks/
|
|
11
|
+
├── TaskId.ts
|
|
12
|
+
├── TaskTitle.ts
|
|
13
|
+
├── Tasks.ts
|
|
14
|
+
├── Registration/
|
|
15
|
+
│ ├── Registration.ts
|
|
16
|
+
│ └── for_RegisterTask/when_registering/with_valid_title.ts
|
|
17
|
+
└── Listing/
|
|
18
|
+
└── Listing.ts
|
|
19
|
+
```
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
{ "kind": "skill-contains", "value": "Authorization belongs on the **class**." },
|
|
11
11
|
{ "kind": "skill-contains", "value": "is created through its **constructor** in `handle()`" },
|
|
12
12
|
{ "kind": "skill-contains", "value": "`--check-metadata`" },
|
|
13
|
-
{ "kind": "skill-contains", "value": "CommandScenario.for(RegisterTask, RegisterTaskValidator)" }
|
|
13
|
+
{ "kind": "skill-contains", "value": "CommandScenario.for(RegisterTask, RegisterTaskValidator)", "file": "references/command-specifications.md" }
|
|
14
14
|
]
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cratis-arc-command-validation
|
|
3
|
-
description: Add a rejection rule to an existing Arc command — choosing between ConceptValidator, CommandValidator, a short-circuiting Provide, and a read-model-injected Handle returning Result
|
|
3
|
+
description: Add a rejection rule to an existing Arc command — choosing between ConceptValidator, CommandValidator, a short-circuiting Provide, and a read-model-injected Handle returning a Result of either the event or a ValidationResult. Use when a command must refuse work under some condition. Do not use to define a new command, and do not use for append-time Chronicle constraints.
|
|
4
4
|
license: MIT
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -9,6 +9,17 @@ license: MIT
|
|
|
9
9
|
Arc applies paging and sorting for you. You never write `Skip`/`Take` or read
|
|
10
10
|
the query string — you choose a **return shape** that the framework can narrow.
|
|
11
11
|
|
|
12
|
+
- An accepted `.play` model under the model root covers the behavior, or the
|
|
13
|
+
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
14
|
+
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
15
|
+
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
16
|
+
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
17
|
+
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
18
|
+
say so and do not author `.play` from memory.
|
|
19
|
+
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
20
|
+
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
21
|
+
never edit Stage-managed output.
|
|
22
|
+
|
|
12
23
|
## Verified product sources
|
|
13
24
|
|
|
14
25
|
| Package | Version | Purpose |
|
|
@@ -181,13 +192,3 @@ pinning, keep it in a method a specification can supply arguments to.
|
|
|
181
192
|
- Creating the read model or its projection: the Chronicle read-model guidance.
|
|
182
193
|
- Inspecting an observable query over HTTP: `cratis-arc-observable-query-http`.
|
|
183
194
|
- Whole-slice performance work: the performance review guidance.
|
|
184
|
-
- An accepted `.play` model under the model root covers the behavior, or the
|
|
185
|
-
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
186
|
-
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
187
|
-
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
188
|
-
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
189
|
-
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
190
|
-
say so and do not author `.play` from memory.
|
|
191
|
-
Edit code here only for infrastructure, clients, adapters, Screenplay code
|
|
192
|
-
attachments, or gap-fill scope (`cratis-screenplay-render-and-gap-fill`);
|
|
193
|
-
never edit Stage-managed output.
|
|
@@ -9,6 +9,19 @@ license: MIT
|
|
|
9
9
|
Build the page from the generated Arc proxies and the Cratis Components
|
|
10
10
|
wrappers. Do not hand-roll a table, a dialog, or a fetch.
|
|
11
11
|
|
|
12
|
+
- An accepted `.play` model under the model root covers the behavior, or the
|
|
13
|
+
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
14
|
+
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
15
|
+
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
16
|
+
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
17
|
+
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
18
|
+
say so and do not author `.play` from memory.
|
|
19
|
+
Read the model's `screen` and `form` with
|
|
20
|
+
[from-screenplay.md](references/from-screenplay.md). Edit code here only for
|
|
21
|
+
infrastructure, clients, adapters, Screenplay code attachments, or gap-fill
|
|
22
|
+
scope (`cratis-screenplay-render-and-gap-fill`); never edit Stage-managed
|
|
23
|
+
output.
|
|
24
|
+
|
|
12
25
|
## Verified product sources
|
|
13
26
|
|
|
14
27
|
This skill is verified against these exact package contracts:
|
|
@@ -38,6 +51,16 @@ import { Dialog } from '@cratis/components/Dialogs';
|
|
|
38
51
|
import { DialogProps, DialogResult, useDialog } from '@cratis/arc.react/dialogs';
|
|
39
52
|
```
|
|
40
53
|
|
|
54
|
+
## Initial focus
|
|
55
|
+
|
|
56
|
+
`DialogInitialFocus.Confirm` is the default and *arms* the confirm button — a
|
|
57
|
+
browser fires `click` from the `keydown` of Enter, so a held Enter confirms.
|
|
58
|
+
For a destructive dialog use `DialogInitialFocus.Cancel`, which focuses the
|
|
59
|
+
least destructive action and degrades to `Content` when the button set has
|
|
60
|
+
nothing to dismiss with. `DialogInitialFocus.Content` focuses the title so
|
|
61
|
+
nothing is armed. There is deliberately no "focus nothing" option — a modal
|
|
62
|
+
must move focus into itself.
|
|
63
|
+
|
|
41
64
|
## Step 1 — Prerequisites
|
|
42
65
|
|
|
43
66
|
- The backend query and command must already exist, and a Debug build must have
|
|
@@ -112,7 +135,7 @@ compound members; `MenuItem` and `Column` are also **named exports** of the
|
|
|
112
135
|
subpath (there is no `DataPage.Column`). Pass `dataKey` whenever the read model has an
|
|
113
136
|
identity.
|
|
114
137
|
|
|
115
|
-
|
|
138
|
+
Read [data-page.md](references/data-page.md) when configuring DataPage props; it lists every prop, and
|
|
116
139
|
[data-tables.md](references/data-tables.md) when you need a table without the
|
|
117
140
|
page chrome.
|
|
118
141
|
|
|
@@ -142,8 +165,8 @@ const [CreateAccountWrapper, showCreateAccount] = useDialog(CreateAccountDialog)
|
|
|
142
165
|
<CreateAccountWrapper />
|
|
143
166
|
```
|
|
144
167
|
|
|
145
|
-
Render the wrapper returned by `useDialog` once in the tree.
|
|
146
|
-
[dialogs.md](references/dialogs.md)
|
|
168
|
+
Render the wrapper returned by `useDialog` once in the tree. Read
|
|
169
|
+
[dialogs.md](references/dialogs.md) when implementing dialog opening, closing, input, response, validation, or focus behavior; it gives the full dialog contract.
|
|
147
170
|
|
|
148
171
|
## Step 5 — Command dialogs
|
|
149
172
|
|
|
@@ -248,7 +271,7 @@ and picks the snapshot or observable table itself. Pass an observable query and
|
|
|
248
271
|
the page stays live; pass a snapshot query and call `onRefresh` after a command
|
|
249
272
|
succeeds.
|
|
250
273
|
|
|
251
|
-
Read [queries-and-commands.md](references/queries-and-commands.md)
|
|
274
|
+
Read [queries-and-commands.md](references/queries-and-commands.md) when using generated proxy hooks, implementing paging, or handling command results; it covers the
|
|
252
275
|
generated proxy hooks, their exact return tuples, paging, and how to read a
|
|
253
276
|
command result.
|
|
254
277
|
|
|
@@ -280,8 +303,8 @@ export const AccountsPage = withViewModel(AccountsViewModel, ({ viewModel }) =>
|
|
|
280
303
|
```
|
|
281
304
|
|
|
282
305
|
`withViewModel` applies `makeAutoObservable` itself — do not call it in the
|
|
283
|
-
constructor.
|
|
284
|
-
props handling,
|
|
306
|
+
constructor. Read [mvvm.md](references/mvvm.md) when implementing view-model injection, route parameters,
|
|
307
|
+
props handling, or teardown.
|
|
285
308
|
|
|
286
309
|
## Quick decision guide
|
|
287
310
|
|
|
@@ -336,19 +359,7 @@ props handling, and teardown.
|
|
|
336
359
|
- The backend command or read model behind the page: `cratis-arc-command`,
|
|
337
360
|
`cratis-chronicle-read-model`.
|
|
338
361
|
- Specifying page behavior with specs: `cratis-application-react-specifications`.
|
|
339
|
-
- An accepted `.play` model under the model root covers the behavior, or the
|
|
340
|
-
repository is opted in (the root holds a committed `.play` file (`git ls-tree -r --name-only HEAD` lists a `.play` file there, narrowed to `-- <root>` when a root is configured), or the project set
|
|
341
|
-
`mcpServers.screenplay.root` in `.cratis/ai.json`; an empty directory, install
|
|
342
|
-
output, an uncommitted `.play` draft or a `.play` file outside the root does not count; master definition:
|
|
343
|
-
`cratis-screenplay-modeling-lifecycle`): change the model first with
|
|
344
|
-
`cratis-screenplay-event-modeling`. If the Screenplay skills are not installed,
|
|
345
|
-
say so and do not author `.play` from memory.
|
|
346
|
-
Read the model's `screen` and `form` with
|
|
347
|
-
[from-screenplay.md](references/from-screenplay.md). Edit code here only for
|
|
348
|
-
infrastructure, clients, adapters, Screenplay code attachments, or gap-fill
|
|
349
|
-
scope (`cratis-screenplay-render-and-gap-fill`); never edit Stage-managed
|
|
350
|
-
output.
|
|
351
362
|
|
|
352
363
|
## Lineage
|
|
353
364
|
|
|
354
|
-
|
|
365
|
+
Read [references/provenance.md](references/provenance.md) when checking source attribution or adaptation permissions.
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# DataPage reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Compound members
|
|
6
|
+
- `DataPageProps`
|
|
7
|
+
- Snapshot versus observable
|
|
8
|
+
- `MenuItemProps`
|
|
9
|
+
- `IDetailsComponentProps<TDataType>`
|
|
10
|
+
- `Column`
|
|
11
|
+
- Type name caution
|
|
12
|
+
- Layout
|
|
13
|
+
|
|
3
14
|
`DataPage` is the standard list page: an action menubar, a data table, and an
|
|
4
15
|
optional details pane in one component. Import from
|
|
5
16
|
`@cratis/components/DataPage`.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Data tables reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Pick the component by query kind
|
|
6
|
+
- Shared props
|
|
7
|
+
- Paging, sorting and filtering scope
|
|
8
|
+
- Selection event
|
|
9
|
+
- Column filtering
|
|
10
|
+
- Filter state shape
|
|
11
|
+
- Custom match modes
|
|
12
|
+
|
|
3
13
|
Use a standalone table when you need query-backed rows **without** the
|
|
4
14
|
`DataPage` chrome — embedded in a panel, a card, or a dialog. Import from
|
|
5
15
|
`@cratis/components/DataTables`.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Dialogs reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Choose the dialog
|
|
6
|
+
- Opening a dialog
|
|
7
|
+
- The enums
|
|
8
|
+
- `CommandDialog`
|
|
9
|
+
- `CommandForm` fields
|
|
10
|
+
- `Dialog` — data without a command
|
|
11
|
+
- Host-registered confirmation and busy indicators
|
|
12
|
+
|
|
3
13
|
The Cratis dialog wrappers own command execution, validation timing, busy
|
|
4
14
|
state, and footer buttons. Never use a vendor or hand-rolled modal — dialogs are Components-owned.
|
|
5
15
|
|
|
@@ -221,20 +231,12 @@ const handleConfirm = async (): Promise<boolean> => {
|
|
|
221
231
|
`onClose(result)` is the combined handler for both outcomes and closes unless it
|
|
222
232
|
returns `false`.
|
|
223
233
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
`DialogInitialFocus.Confirm` is the default and *arms* the confirm button — a
|
|
227
|
-
browser fires `click` from the `keydown` of Enter, so a held Enter confirms.
|
|
228
|
-
For a destructive dialog use `DialogInitialFocus.Cancel`, which focuses the
|
|
229
|
-
least destructive action and degrades to `Content` when the button set has
|
|
230
|
-
nothing to dismiss with. `DialogInitialFocus.Content` focuses the title so
|
|
231
|
-
nothing is armed. There is deliberately no "focus nothing" option — a modal
|
|
232
|
-
must move focus into itself.
|
|
234
|
+
See "Initial focus" in SKILL.md.
|
|
233
235
|
|
|
234
236
|
## Host-registered confirmation and busy indicators
|
|
235
237
|
|
|
236
238
|
`ConfirmationDialog` takes no props at all; it reads its title, message, and
|
|
237
239
|
buttons from the dialog request. `BusyIndicatorDialog` takes the busy-indicator
|
|
238
240
|
request. Register both once at the app root through `DialogComponents` and
|
|
239
|
-
raise them by hook — see the skill's
|
|
241
|
+
raise them by hook — see the skill's Step 6. From a view model, use the
|
|
240
242
|
injectable `IDialogs` abstraction instead of the hooks.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# From a Screenplay model to an Arc React page
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- What is verified, and what is not
|
|
6
|
+
- Worked model
|
|
7
|
+
- Level 1 and 2: `screen`
|
|
8
|
+
- `form` and `field`
|
|
9
|
+
- Interactions: `on`, `uses`, `behavior`
|
|
10
|
+
- Reconcile before you finish
|
|
11
|
+
- Verify
|
|
12
|
+
|
|
3
13
|
Use this when the page you are asked to build, or change, is described by a
|
|
4
14
|
`screen` or `form` in a `.play` model. The model is the specification; the page
|
|
5
15
|
is how that specification looks in React. Read the model first, build the page
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# MVVM reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- When to use it
|
|
6
|
+
- Setup
|
|
7
|
+
- The view model
|
|
8
|
+
- `withViewModel`
|
|
9
|
+
- Props, route parameters, and query parameters
|
|
10
|
+
- Injectable abstractions
|
|
11
|
+
- `observer`
|
|
12
|
+
- Testing
|
|
13
|
+
|
|
3
14
|
The Arc MVVM layer keeps page logic in plain TypeScript classes and leaves the
|
|
4
15
|
component declarative. `@cratis/arc.react.mvvm` builds on tsyringe for
|
|
5
16
|
injection and MobX for reactivity.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Queries and commands reference
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- Query proxy hooks
|
|
6
|
+
- Observable query transport
|
|
7
|
+
- Command proxy
|
|
8
|
+
- `<Arc>` configuration
|
|
9
|
+
|
|
3
10
|
A Debug build generates one typed proxy class per query and per command. The
|
|
4
11
|
proxy exposes static React hooks; the page calls those. Never edit a generated
|
|
5
12
|
file — fix the C# source and rebuild.
|
|
@@ -35,6 +35,57 @@ placeholder injected at pack time (`Source/Directory.Build.props`), so the
|
|
|
35
35
|
repository never carries the real number. Reverify before claiming support for a
|
|
36
36
|
version you have not checked.
|
|
37
37
|
|
|
38
|
+
## Lifecycle
|
|
39
|
+
|
|
40
|
+
- **Registration is wired to the connection, not called by you.**
|
|
41
|
+
`EventStore.cs:265-268` subscribes `RegisterAll` to `Connection.Lifecycle.OnConnected`
|
|
42
|
+
when `autoDiscoverAndRegister` is on, so a reconnect re-registers everything.
|
|
43
|
+
- `DiscoverAll()` does event types first, then constraints, reactors, reducers,
|
|
44
|
+
projections, and seeding in parallel (`EventStore.cs:349-362`). `RegisterAll()`
|
|
45
|
+
is single-flighted with jittered backoff and a background retry loop (`:373-379`).
|
|
46
|
+
- **Wait with `WaitForRegistration`, not by polling `IsConnected`.**
|
|
47
|
+
`RegistrationWaitExtensions.WaitForRegistration(this IEventStore, TimeSpan? timeout = default)`
|
|
48
|
+
(`Source/Clients/DotNET/Registrations/RegistrationWaitExtensions.cs:42`, default
|
|
49
|
+
5 seconds) exists precisely for this, and its own remarks warn against the
|
|
50
|
+
`IConnectionLifecycle.IsConnected` alternative (`:34-39`). Connected is not
|
|
51
|
+
registered.
|
|
52
|
+
- **Keepalive is a bidirectional stream plus a watchdog.** The watchdog monitors
|
|
53
|
+
every `MonitorIntervalMilliseconds = 1000`
|
|
54
|
+
(`Source/Clients/Connections/ConnectionWatchdog.cs:34`) and a keepalive that
|
|
55
|
+
falls more than 5 seconds behind is treated as a lost connection, with
|
|
56
|
+
reconnect backoff capped at 30 seconds. **The failure mode is silence, not an
|
|
57
|
+
exception** — appends keep working while observers go quiet.
|
|
58
|
+
- `Dispose()` disposes read model reactors for created stores, cancels the owned
|
|
59
|
+
connection, and disposes the connection
|
|
60
|
+
(`Source/Clients/DotNET/ChronicleClient.cs:225-246`).
|
|
61
|
+
|
|
62
|
+
## What a standalone app owns that a host would have supplied
|
|
63
|
+
|
|
64
|
+
Every one of these has a silent default. Read them as a checklist, because the
|
|
65
|
+
defaults are reasonable for a sample and wrong for a service
|
|
66
|
+
(`ChronicleClient.cs:121-127`):
|
|
67
|
+
|
|
68
|
+
| Concern | Default when you pass nothing |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `IClientArtifactsProvider` | `DefaultClientArtifactsProvider.Default` — full assembly scan |
|
|
71
|
+
| `IServiceProvider` | `DefaultServiceProvider`, which activates everything through `Activator.CreateInstance` (`DefaultServiceProvider.cs:41`) |
|
|
72
|
+
| `IIdentityProvider` | `BaseIdentityProvider` |
|
|
73
|
+
| `ICorrelationIdAccessor` | `CorrelationIdAccessor` |
|
|
74
|
+
| `IEventStoreNamespaceResolver` | `DefaultEventStoreNamespaceResolver` — always `"Default"` |
|
|
75
|
+
| `ILoggerFactory` | `new LoggerFactory()` — **a silent one** |
|
|
76
|
+
| Configuration binding | none; there is no `Cratis:Chronicle` section without a host |
|
|
77
|
+
|
|
78
|
+
The `IServiceProvider` default is the sharp one: **a reactor or reducer with
|
|
79
|
+
constructor dependencies is default-constructed** unless you pass a real
|
|
80
|
+
container. Pass one, or keep observers dependency-free.
|
|
81
|
+
|
|
82
|
+
The AspNetCore package additionally registers `AddUnitOfWork()`,
|
|
83
|
+
`AddCompliance()`, `AddCausation()`, `AddChronicleHealthCheck()`, and
|
|
84
|
+
`UseCratisChronicle()` — none of which the base package gives you.
|
|
85
|
+
|
|
86
|
+
**Keep the process alive.** Observation is a live gRPC duplex stream; a console
|
|
87
|
+
app that appends and returns from `Main` never sees a reactor run.
|
|
88
|
+
|
|
38
89
|
## Which package
|
|
39
90
|
|
|
40
91
|
```shell
|
|
@@ -149,62 +200,15 @@ from `string` (`:158`) and a `Redacted` form for logging (`:152`).
|
|
|
149
200
|
|
|
150
201
|
### In a host
|
|
151
202
|
|
|
152
|
-
|
|
153
|
-
var builder = Host.CreateApplicationBuilder(args);
|
|
154
|
-
builder.AddCratisChronicle(options => options.EventStore = "<EventStoreName>");
|
|
155
|
-
builder.Services.AddHostedService<<WorkerName>>();
|
|
156
|
-
await builder.Build().RunAsync();
|
|
157
|
-
```
|
|
203
|
+
`AddCratisChronicle` is an extension on `IHostApplicationBuilder` (and `WebApplicationBuilder`), not on `IServiceCollection`; there is no `WithClaimsBasedNamespaceResolver`.
|
|
158
204
|
|
|
159
|
-
`AddCratisChronicle`
|
|
160
|
-
(`Source/Clients/DotNET/ChronicleHostApplicationBuilderExtensions.cs:28`) and binds
|
|
161
|
-
the `Cratis:Chronicle` configuration section by default (`:25`, `:37`), with
|
|
162
|
-
`ValidateDataAnnotations().ValidateOnStart()`. The bound type is
|
|
163
|
-
`ChronicleClientOptions : ChronicleOptions`, which adds a `[Required] EventStore`
|
|
164
|
-
and an optional `EventStoreNamespaceResolverType`.
|
|
165
|
-
|
|
166
|
-
> **`AddCratisChronicle` on `IServiceCollection` does not exist**, despite what
|
|
167
|
-
> `Documentation/clients/dotnet/getting-started.md:61` shows. The real extensions
|
|
168
|
-
> are on `IHostApplicationBuilder`, `WebApplicationBuilder` (in the AspNetCore
|
|
169
|
-
> package), and Aspire's `IDistributedApplicationBuilder`. `IHostBuilder.AddCratisChronicle()`
|
|
170
|
-
> also exists but only registers concept type converters
|
|
171
|
-
> (`Source/Clients/DotNET/Hosting/HostBuilderExtensions.cs:18-23`) — it is not
|
|
172
|
-
> the wiring entry point.
|
|
173
|
-
|
|
174
|
-
`IChronicleBuilder` extensions are exactly five:
|
|
175
|
-
`WithArtifactsProvider`, `WithIdentityProvider`, `WithCorrelationIdAccessor`,
|
|
176
|
-
`WithNamespaceResolver`, `WithCamelCaseNamingPolicy`
|
|
177
|
-
(`Source/Clients/DotNET/ChronicleBuilderExtensions.cs`). **There is no
|
|
178
|
-
`WithClaimsBasedNamespaceResolver`**, despite a doc comment at
|
|
179
|
-
`ChronicleOptions.cs:141` referring to one. Pass the resolver instead:
|
|
180
|
-
`new ChronicleClient(options, namespaceResolver: new ClaimsBasedNamespaceResolver("tenant_id"))`.
|
|
205
|
+
Read [references/hosting.md](references/hosting.md) when wiring Chronicle into a worker or ASP.NET Core host, or when `AddCratisChronicle` or a namespace resolver does not resolve.
|
|
181
206
|
|
|
182
207
|
## The client and the server check each other
|
|
183
208
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
`CheckCompatibility` (`:414`), sending the client type, client version, protocol
|
|
188
|
-
version, and the descriptor set its contracts package was built with (`:420-426`).
|
|
189
|
-
The rationale is at `:409-413`: Chronicle has clients in four languages and only
|
|
190
|
-
some can build a descriptor set at runtime, so each ships the one it was built
|
|
191
|
-
with and the server does the single comparison.
|
|
192
|
-
|
|
193
|
-
Behavior you can rely on:
|
|
194
|
-
|
|
195
|
-
- A server too old to have the RPC answers `Unimplemented`, and the client falls
|
|
196
|
-
back to the previous client-side exchange (`:428-434`) — upgrading the client
|
|
197
|
-
does not silently drop the check.
|
|
198
|
-
- Any other transport error is **logged and ignored** (`:435-441`), on the stated
|
|
199
|
-
reasoning that failing to ask says nothing about whether the two sides agree.
|
|
200
|
-
- A genuine mismatch throws `IncompatibleServerException`
|
|
201
|
-
(`Source/Clients/Connections/IncompatibleServerException.cs:10`) whose message
|
|
202
|
-
names the server address, its version, its protocol version, and the specific
|
|
203
|
-
incompatibilities (`:443-449`).
|
|
204
|
-
|
|
205
|
-
The client identifies itself as `".NET"`
|
|
206
|
-
(`Source/Clients/Connections/ChronicleClientIdentity.cs:22`) with its assembly
|
|
207
|
-
informational version (`:27`) and the contracts protocol version (`:32`).
|
|
209
|
+
The client runs the server-side compatibility check automatically inside `Connect()`; a genuine mismatch throws `IncompatibleServerException`, while a transport error is logged and ignored by design.
|
|
210
|
+
|
|
211
|
+
Read [references/compatibility-check.md](references/compatibility-check.md) when diagnosing an `IncompatibleServerException`, a skipped compatibility check, or an old-server fallback.
|
|
208
212
|
|
|
209
213
|
## Event types
|
|
210
214
|
|
|
@@ -357,77 +361,9 @@ Read models are queried through `eventStore.ReadModels`
|
|
|
357
361
|
|
|
358
362
|
## Discovery
|
|
359
363
|
|
|
360
|
-
Artifacts are found by
|
|
361
|
-
container required. `DefaultClientArtifactsProvider.Default` composes the
|
|
362
|
-
project-referenced and package-referenced assemblies
|
|
363
|
-
(`Source/Clients/DotNET/DefaultClientArtifactsProvider.cs:37`), and the
|
|
364
|
-
predicates are exactly (`:242-251`):
|
|
365
|
-
|
|
366
|
-
| Kind | Predicate |
|
|
367
|
-
| --- | --- |
|
|
368
|
-
| event types | `HasAttribute<EventTypeAttribute>()` or `HasAttribute<EventTypeGenerationForAttribute>()` |
|
|
369
|
-
| projections | `HasInterface(typeof(IProjectionFor<>))` |
|
|
370
|
-
| model-bound projections | `HasModelBoundProjectionAttributes()` |
|
|
371
|
-
| reactors | `HasInterface<IReactor>()` and not generic |
|
|
372
|
-
| read model reactors | `HasInterface<IReadModelReactor>()` and not generic |
|
|
373
|
-
| reducers | `HasInterface(typeof(IReducerFor<>))` and not generic |
|
|
374
|
-
|
|
375
|
-
Explicit registration is available per family as an alternative —
|
|
376
|
-
`IEventTypes.Register`, `IConstraints.Register`, `IProjections.Register`,
|
|
377
|
-
`IReducers.Register`, `IReactors.Register<TReactor>()`,
|
|
378
|
-
`IReadModels.Register<TReadModel>()` — and is what you use with
|
|
379
|
-
`AutoDiscoverAndRegister = false`.
|
|
380
|
-
|
|
381
|
-
## Lifecycle
|
|
382
|
-
|
|
383
|
-
- **Registration is wired to the connection, not called by you.**
|
|
384
|
-
`EventStore.cs:265-268` subscribes `RegisterAll` to `Connection.Lifecycle.OnConnected`
|
|
385
|
-
when `autoDiscoverAndRegister` is on, so a reconnect re-registers everything.
|
|
386
|
-
- `DiscoverAll()` does event types first, then constraints, reactors, reducers,
|
|
387
|
-
projections, and seeding in parallel (`EventStore.cs:349-362`). `RegisterAll()`
|
|
388
|
-
is single-flighted with jittered backoff and a background retry loop (`:373-379`).
|
|
389
|
-
- **Wait with `WaitForRegistration`, not by polling `IsConnected`.**
|
|
390
|
-
`RegistrationWaitExtensions.WaitForRegistration(this IEventStore, TimeSpan? timeout = default)`
|
|
391
|
-
(`Source/Clients/DotNET/Registrations/RegistrationWaitExtensions.cs:42`, default
|
|
392
|
-
5 seconds) exists precisely for this, and its own remarks warn against the
|
|
393
|
-
`IConnectionLifecycle.IsConnected` alternative (`:34-39`). Connected is not
|
|
394
|
-
registered.
|
|
395
|
-
- **Keepalive is a bidirectional stream plus a watchdog.** The watchdog monitors
|
|
396
|
-
every `MonitorIntervalMilliseconds = 1000`
|
|
397
|
-
(`Source/Clients/Connections/ConnectionWatchdog.cs:34`) and a keepalive that
|
|
398
|
-
falls more than 5 seconds behind is treated as a lost connection, with
|
|
399
|
-
reconnect backoff capped at 30 seconds. **The failure mode is silence, not an
|
|
400
|
-
exception** — appends keep working while observers go quiet.
|
|
401
|
-
- `Dispose()` disposes read model reactors for created stores, cancels the owned
|
|
402
|
-
connection, and disposes the connection
|
|
403
|
-
(`Source/Clients/DotNET/ChronicleClient.cs:225-246`).
|
|
364
|
+
Artifacts are found by assembly scanning, with no registration call and no DI container required.
|
|
404
365
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
Every one of these has a silent default. Read them as a checklist, because the
|
|
408
|
-
defaults are reasonable for a sample and wrong for a service
|
|
409
|
-
(`ChronicleClient.cs:121-127`):
|
|
410
|
-
|
|
411
|
-
| Concern | Default when you pass nothing |
|
|
412
|
-
| --- | --- |
|
|
413
|
-
| `IClientArtifactsProvider` | `DefaultClientArtifactsProvider.Default` — full assembly scan |
|
|
414
|
-
| `IServiceProvider` | `DefaultServiceProvider`, which activates everything through `Activator.CreateInstance` (`DefaultServiceProvider.cs:41`) |
|
|
415
|
-
| `IIdentityProvider` | `BaseIdentityProvider` |
|
|
416
|
-
| `ICorrelationIdAccessor` | `CorrelationIdAccessor` |
|
|
417
|
-
| `IEventStoreNamespaceResolver` | `DefaultEventStoreNamespaceResolver` — always `"Default"` |
|
|
418
|
-
| `ILoggerFactory` | `new LoggerFactory()` — **a silent one** |
|
|
419
|
-
| Configuration binding | none; there is no `Cratis:Chronicle` section without a host |
|
|
420
|
-
|
|
421
|
-
The `IServiceProvider` default is the sharp one: **a reactor or reducer with
|
|
422
|
-
constructor dependencies is default-constructed** unless you pass a real
|
|
423
|
-
container. Pass one, or keep observers dependency-free.
|
|
424
|
-
|
|
425
|
-
The AspNetCore package additionally registers `AddUnitOfWork()`,
|
|
426
|
-
`AddCompliance()`, `AddCausation()`, `AddChronicleHealthCheck()`, and
|
|
427
|
-
`UseCratisChronicle()` — none of which the base package gives you.
|
|
428
|
-
|
|
429
|
-
**Keep the process alive.** Observation is a live gRPC duplex stream; a console
|
|
430
|
-
app that appends and returns from `Main` never sees a reactor run.
|
|
366
|
+
Read [references/discovery.md](references/discovery.md) when an event type, reactor, reducer or projection is not being found, or when you need explicit registration with `AutoDiscoverAndRegister = false`.
|
|
431
367
|
|
|
432
368
|
## Common pitfalls
|
|
433
369
|
|
package/package/corpus/skills/cratis-chronicle-client-dotnet/references/compatibility-check.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## The client and the server check each other
|
|
2
|
+
|
|
3
|
+
Since Chronicle 17 the compatibility check is a server-side RPC, and **the client
|
|
4
|
+
runs it automatically inside `Connect()`** —
|
|
5
|
+
`Source/Clients/Connections/ChronicleConnection.cs:310` calls
|
|
6
|
+
`CheckCompatibility` (`:414`), sending the client type, client version, protocol
|
|
7
|
+
version, and the descriptor set its contracts package was built with (`:420-426`).
|
|
8
|
+
The rationale is at `:409-413`: Chronicle has clients in four languages and only
|
|
9
|
+
some can build a descriptor set at runtime, so each ships the one it was built
|
|
10
|
+
with and the server does the single comparison.
|
|
11
|
+
|
|
12
|
+
Behavior you can rely on:
|
|
13
|
+
|
|
14
|
+
- A server too old to have the RPC answers `Unimplemented`, and the client falls
|
|
15
|
+
back to the previous client-side exchange (`:428-434`) — upgrading the client
|
|
16
|
+
does not silently drop the check.
|
|
17
|
+
- Any other transport error is **logged and ignored** (`:435-441`), on the stated
|
|
18
|
+
reasoning that failing to ask says nothing about whether the two sides agree.
|
|
19
|
+
- A genuine mismatch throws `IncompatibleServerException`
|
|
20
|
+
(`Source/Clients/Connections/IncompatibleServerException.cs:10`) whose message
|
|
21
|
+
names the server address, its version, its protocol version, and the specific
|
|
22
|
+
incompatibilities (`:443-449`).
|
|
23
|
+
|
|
24
|
+
The client identifies itself as `".NET"`
|
|
25
|
+
(`Source/Clients/Connections/ChronicleClientIdentity.cs:22`) with its assembly
|
|
26
|
+
informational version (`:27`) and the contracts protocol version (`:32`).
|