@cratis/pi 7.136.1 → 7.137.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.
Files changed (29) hide show
  1. package/package/corpus/harnesses/copilot/instructions/profiles.instructions.md +11 -7
  2. package/package/corpus/product-sync.json +9 -6
  3. package/package/corpus/rules/profiles.md +11 -7
  4. package/package/corpus/skills/cratis-arc-code-analysis-typescript/SKILL.md +96 -0
  5. package/package/corpus/skills/cratis-arc-command-typescript/SKILL.md +22 -13
  6. package/package/corpus/skills/cratis-arc-command-typescript/references/chronicle-events.md +5 -5
  7. package/package/corpus/skills/cratis-arc-command-typescript/references/command-operations.md +1 -1
  8. package/package/corpus/skills/cratis-arc-command-typescript/references/command-pipeline.md +137 -0
  9. package/package/corpus/skills/cratis-arc-command-typescript/references/configuration.md +83 -0
  10. package/package/corpus/skills/cratis-arc-command-typescript/references/hosting-and-storage.md +5 -4
  11. package/package/corpus/skills/cratis-arc-command-typescript/references/identity-and-introspection.md +1 -3
  12. package/package/corpus/skills/cratis-arc-command-typescript/references/observability-and-host-scopes.md +1 -1
  13. package/package/corpus/skills/cratis-arc-command-typescript/references/project-setup.md +14 -9
  14. package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generation.md +2 -2
  15. package/package/corpus/skills/cratis-arc-command-typescript/references/proxy-generator-options.md +90 -0
  16. package/package/corpus/skills/cratis-arc-command-typescript/verification.json +2 -2
  17. package/package/corpus/skills/cratis-arc-query-typescript/SKILL.md +4 -2
  18. package/package/corpus/skills/cratis-arc-query-typescript/references/product-sources.md +1 -2
  19. package/package/corpus/skills/cratis-arc-query-typescript/references/query-pipeline.md +125 -0
  20. package/package/corpus/skills/cratis-arc-query-typescript/references/storage-observation-and-compliance.md +1 -1
  21. package/package/corpus/skills/cratis-arc-query-typescript/verification.json +1 -1
  22. package/package/corpus/skills/cratis-arc-storage-typescript/SKILL.md +150 -0
  23. package/package/corpus/skills/cratis-arc-tenancy-typescript/LICENSE +2 -0
  24. package/package/corpus/skills/cratis-arc-tenancy-typescript/SKILL.md +125 -0
  25. package/package/corpus/skills/cratis-arc-testing-typescript/SKILL.md +153 -0
  26. package/package/corpus/skills/cratis-arc-validation-typescript/SKILL.md +3 -4
  27. package/package/corpus/skills/cratis-arc-validation-typescript/verification.json +1 -1
  28. package/package/profile-catalog.json +5 -1
  29. package/package.json +1 -1
@@ -146,11 +146,11 @@ JVM language conventions are `kotlin.md` and `java.md`.
146
146
 
147
147
  Arc for TypeScript (`@cratis/arc.core` with the Express, Fastify, Hono,
148
148
  MongoDB, Drizzle, testing and experimental Chronicle packages, plus
149
- `@cratis/arc.proxygenerator`, `@cratis/eslint-plugin-arc-core` and experimental
150
- `@cratis/cratis`) brings the same model-bound command/query shape to a Node.js
151
- server. Verified at GitHub pre-release **v0.57.2**: its packages are a source
152
- preview and are not published to npm. It is separate from `@cratis/arc`, the
153
- published client runtime that generated proxies import in a frontend.
149
+ `@cratis/arc.proxygenerator`, `@cratis/eslint-plugin-arc-core` and the
150
+ `@cratis/platform` meta package that brings Arc and Chronicle together) brings the same model-bound command/query shape to a Node.js
151
+ server. The packages are published to npm at stable 1.0.0. They are separate
152
+ from `@cratis/arc`, the published client runtime that generated proxies import
153
+ in a frontend.
154
154
  `cratis/arc/server-typescript` carries the skills; `cratis/arc/typescript` adds
155
155
  the TypeScript language conventions, and `cratis/full/typescript` composes it.
156
156
  The server skills are opt-in: `cratis/arc`, `cratis/application` and
@@ -160,9 +160,13 @@ Node.js server and a C# or React-frontend project has no use for them. Select
160
160
 
161
161
  | Skill | Covers |
162
162
  | --- | --- |
163
- | `cratis-arc-command-typescript` | Project setup from the source preview, `ArcApplication.createBuilder()`, `@command()` with `handle()`/`provide()`, outcomes, authorization, returned Chronicle events, generated metadata and proxies, hosts, `CommandScenario` |
164
- | `cratis-arc-query-typescript` | `@readModel()` with static `@query()` methods, argument binding, GET and HTTP `QUERY`, paging, RxJS observable queries, MongoDB/Drizzle/Chronicle read models, `QueryScenario`/`ObservableQueryScenario` |
163
+ | `cratis-arc-command-typescript` | Project setup, `ArcApplication.createBuilder()`, `@command()` with `handle()`/`provide()`, outcomes, authorization, identity, returned Chronicle events, generated metadata and proxies, configuration, command pipeline filters, hosts (Express, Fastify, Hono, Fetch) |
164
+ | `cratis-arc-query-typescript` | `@readModel()` with static `@query()` methods, argument binding, GET and HTTP `QUERY`, paging, RxJS observable queries, query filters, renderers and read-model interceptors, MongoDB/Drizzle/Chronicle read models |
165
165
  | `cratis-arc-validation-typescript` | `CommandValidator`/`QueryValidator`/`ConceptValidator`/`ModelValidator`, `readModelForValidation`, `validation()` with `rejected`/`denied`, severity filtering |
166
+ | `cratis-arc-tenancy-typescript` | Tenant sources, `membershipClaim`, `tenancy.resolve`, storage isolation per tenant, tenant-safe scoping |
167
+ | `cratis-arc-storage-typescript` | `@cratis/arc.mongodb` and `@cratis/arc.drizzle`: collections, naming, codecs, paging, change-stream and PostgreSQL observation |
168
+ | `cratis-arc-testing-typescript` | `@cratis/arc.testing`: `CommandScenario`, `QueryScenario`, `ObservableQueryScenario`, `ArcScenario`, `given`, `node:test` |
169
+ | `cratis-arc-code-analysis-typescript` | `@cratis/eslint-plugin-arc-core` presets and rules (`missing-field`, `arc0004`, `arcchr0006`, ...) |
166
170
 
167
171
  Standalone Chronicle client usage (no Arc) in TypeScript is
168
172
  `cratis-chronicle-client-typescript`.
@@ -909,7 +909,6 @@
909
909
  "id": "arc-typescript",
910
910
  "name": "Arc.TypeScript",
911
911
  "repository": "Cratis/Arc.TypeScript",
912
- "track": "prerelease",
913
912
  "packages": [
914
913
  {
915
914
  "ecosystem": "npm",
@@ -917,19 +916,23 @@
917
916
  }
918
917
  ],
919
918
  "synced": {
920
- "version": "0.57.2",
921
- "date": "2026-10-12",
922
- "by": "Cratis/AI#620"
919
+ "version": "1.0.0",
920
+ "date": "2026-11-05",
921
+ "by": "Cratis/AI#1035"
923
922
  },
924
923
  "covers": {
925
924
  "skills": [
926
925
  "cratis-arc-command-typescript",
927
926
  "cratis-arc-query-typescript",
928
- "cratis-arc-validation-typescript"
927
+ "cratis-arc-validation-typescript",
928
+ "cratis-arc-tenancy-typescript",
929
+ "cratis-arc-storage-typescript",
930
+ "cratis-arc-testing-typescript",
931
+ "cratis-arc-code-analysis-typescript"
929
932
  ],
930
933
  "rules": []
931
934
  },
932
- "notes": "Synced to GitHub pre-release v0.57.2 source in Cratis/AI#620; tracks pre-release tags and does not claim npm publication."
935
+ "notes": "Packages are published to npm as stable 1.0.0; the skills cover hosting adapters, authentication, tenancy, validation, MongoDB, Drizzle, Chronicle, testing, proxy generation and the ESLint plugin."
933
936
  }
934
937
  ]
935
938
  }
@@ -145,11 +145,11 @@ JVM language conventions are `kotlin.md` and `java.md`.
145
145
 
146
146
  Arc for TypeScript (`@cratis/arc.core` with the Express, Fastify, Hono,
147
147
  MongoDB, Drizzle, testing and experimental Chronicle packages, plus
148
- `@cratis/arc.proxygenerator`, `@cratis/eslint-plugin-arc-core` and experimental
149
- `@cratis/cratis`) brings the same model-bound command/query shape to a Node.js
150
- server. Verified at GitHub pre-release **v0.57.2**: its packages are a source
151
- preview and are not published to npm. It is separate from `@cratis/arc`, the
152
- published client runtime that generated proxies import in a frontend.
148
+ `@cratis/arc.proxygenerator`, `@cratis/eslint-plugin-arc-core` and the
149
+ `@cratis/platform` meta package that brings Arc and Chronicle together) brings the same model-bound command/query shape to a Node.js
150
+ server. The packages are published to npm at stable 1.0.0. They are separate
151
+ from `@cratis/arc`, the published client runtime that generated proxies import
152
+ in a frontend.
153
153
  `cratis/arc/server-typescript` carries the skills; `cratis/arc/typescript` adds
154
154
  the TypeScript language conventions, and `cratis/full/typescript` composes it.
155
155
  The server skills are opt-in: `cratis/arc`, `cratis/application` and
@@ -159,9 +159,13 @@ Node.js server and a C# or React-frontend project has no use for them. Select
159
159
 
160
160
  | Skill | Covers |
161
161
  | --- | --- |
162
- | `cratis-arc-command-typescript` | Project setup from the source preview, `ArcApplication.createBuilder()`, `@command()` with `handle()`/`provide()`, outcomes, authorization, returned Chronicle events, generated metadata and proxies, hosts, `CommandScenario` |
163
- | `cratis-arc-query-typescript` | `@readModel()` with static `@query()` methods, argument binding, GET and HTTP `QUERY`, paging, RxJS observable queries, MongoDB/Drizzle/Chronicle read models, `QueryScenario`/`ObservableQueryScenario` |
162
+ | `cratis-arc-command-typescript` | Project setup, `ArcApplication.createBuilder()`, `@command()` with `handle()`/`provide()`, outcomes, authorization, identity, returned Chronicle events, generated metadata and proxies, configuration, command pipeline filters, hosts (Express, Fastify, Hono, Fetch) |
163
+ | `cratis-arc-query-typescript` | `@readModel()` with static `@query()` methods, argument binding, GET and HTTP `QUERY`, paging, RxJS observable queries, query filters, renderers and read-model interceptors, MongoDB/Drizzle/Chronicle read models |
164
164
  | `cratis-arc-validation-typescript` | `CommandValidator`/`QueryValidator`/`ConceptValidator`/`ModelValidator`, `readModelForValidation`, `validation()` with `rejected`/`denied`, severity filtering |
165
+ | `cratis-arc-tenancy-typescript` | Tenant sources, `membershipClaim`, `tenancy.resolve`, storage isolation per tenant, tenant-safe scoping |
166
+ | `cratis-arc-storage-typescript` | `@cratis/arc.mongodb` and `@cratis/arc.drizzle`: collections, naming, codecs, paging, change-stream and PostgreSQL observation |
167
+ | `cratis-arc-testing-typescript` | `@cratis/arc.testing`: `CommandScenario`, `QueryScenario`, `ObservableQueryScenario`, `ArcScenario`, `given`, `node:test` |
168
+ | `cratis-arc-code-analysis-typescript` | `@cratis/eslint-plugin-arc-core` presets and rules (`missing-field`, `arc0004`, `arcchr0006`, ...) |
165
169
 
166
170
  Standalone Chronicle client usage (no Arc) in TypeScript is
167
171
  `cratis-chronicle-client-typescript`.
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: cratis-arc-code-analysis-typescript
3
+ description: Use when adding the Arc ESLint plugin to a Node.js server project or fixing an arc-core lint finding such as missing-field, ARC0004 or ARCCHR0006. Not for C# analyzers or runtime build() graph errors.
4
+ license: MIT
5
+ ---
6
+
7
+ # Lint Arc server artifacts with `@cratis/eslint-plugin-arc-core`
8
+
9
+ The plugin finds model-bound binding mistakes in `@command()`, `@readModel()`
10
+ and validator classes before `build()` or the first request. It targets ESLint
11
+ 10 flat config and `typescript-eslint`. It does not lint the Arc frontend
12
+ packages or generated proxies. Peers: `eslint` `^10.0.0` and
13
+ `@typescript-eslint/parser` `^8.70.0`.
14
+
15
+ ```javascript
16
+ // eslint.config.mjs
17
+ import arc from '@cratis/eslint-plugin-arc-core';
18
+ import tseslint from 'typescript-eslint';
19
+
20
+ export default tseslint.config(
21
+ ...tseslint.configs.recommended,
22
+ arc.configs['recommended-type-checked']
23
+ );
24
+ ```
25
+
26
+ Run `eslint src`. Two presets exist, both applied to `**/*.ts` and `**/*.tsx`
27
+ under the `arc-core/` rule prefix:
28
+
29
+ | Preset | Needs type information | Rules |
30
+ | --- | --- | --- |
31
+ | `recommended` | no | every rule except `query-argument-name`, `arcchr0006` and `arcchr0010`; type-dependent comparisons are skipped |
32
+ | `recommended-type-checked` | yes (`projectService`) | `recommended` plus `arcchr0006` and `arcchr0010` |
33
+
34
+ `arc-core/query-argument-name` is opt-in in both presets.
35
+
36
+ ## Rules and how to fix them
37
+
38
+ Rule names are `arc-core/<name>`. Arc rules keep the .NET ARC ids only where the
39
+ same mistake exists in TypeScript.
40
+
41
+ | Rule | Finds | Fix |
42
+ | --- | --- | --- |
43
+ | `missing-field` | public instance property on `@command()`/`@readModel()` without `@field` (private, `#` and `_` names are ignored) | add `@field(String)` etc.; unmarked properties are invisible to the wire schema |
44
+ | `declared-field` | decorated property declared with `declare` | use `!` with a real class field |
45
+ | `inject-binding` | `@inject` token count or provable type disagrees with `handle` parameters | align tokens and parameters (type comparison needs type information) |
46
+ | `query-binding` | `@query` descriptor count differs from the method's parameters, or a token type disagrees | one descriptor per parameter |
47
+ | `query-argument-name` (opt-in) | literal wire argument name differs from the method parameter | rename one to match |
48
+ | `misplaced-decorator` | `@query` not on a static read-model method, `@inject` not on a command `handle`, authorization on an unsupported member | move it |
49
+ | `unexported-artifact` | decorated artifact not exported (including an export at the end of the file) | export the class; `discover()` only registers exports |
50
+ | `validator-target` | validator subclass without `@validator(Target)` | add the decorator |
51
+ | `arc0002` | class with public fields and an instance `handle()` but no `@command()` | add `@command()` and `@field`s; no decorator is needed if the class is a service |
52
+ | `arc0003` | external `handle(command: DecoratedCommand)` that never runs | move `handle` onto the command |
53
+ | `arc0004` | command without an instance `handle()` (inherited counts) | add one |
54
+ | `arc0005` | `provide()` value discarded because `handle` takes no parameter for it | add the parameter or drop the value |
55
+ | `arc0010` | async `handle()` with no `await`, `for await` or returned value | remove `async` or await |
56
+ | `arc0012` | built-in `Error` thrown from a decorated artifact | throw a domain-named error class (or reject through validation) |
57
+ | `arc0014` | generic type arguments on `@query` (HTTP cannot supply them) | use a concrete type |
58
+ | `arc0015` | primitive query parameter converted to a `ConceptAs` inside the query, skipping concept validation | bind the concept as the parameter |
59
+ | `arc0019` | `@allowAnonymous()` with `@authorize()` or `@roles()` on one declaration | remove one |
60
+ | `arcchr0003` | reactor appends directly through `eventLog.append`/`appendMany` on a store from `getEventStore`/`getStore` | return the event from the reactor |
61
+ | `arcchr0006` | command-returning reactor without once-only or a replay handler | add `@onceOnly()` or a replay handler (type-checked) |
62
+ | `arcchr0007` | command handler bypassing the append pipeline with a direct write | return the event |
63
+ | `arcchr0009` | secret command field persisted into Chronicle causation | mark with `@notAudited` or `@pii` |
64
+ | `arcchr0010` | keyless command returning a GUID meant as the event stream id | return `eventSourceIdResponse` (type-checked) |
65
+
66
+ The .NET ids ARC0001, ARC0006 to ARC0009, ARC0011, ARC0016 to ARC0018 and
67
+ ARC0020/ARC0021 have no TypeScript rule: TypeScript queries may return any
68
+ shape, a missing command read model is explicit through
69
+ `commandReadModel(Type, { optional: true })`, concepts are classes, roles are
70
+ strings, operations are returned `CommandOperation` objects, and ASP.NET
71
+ attributes do not exist in the Node host.
72
+
73
+ ## Pitfalls
74
+
75
+ - A suppression comment hides the finding, not the bug: `unexported-artifact`
76
+ and `missing-field` describe things `build()` or the wire schema will break on.
77
+ - The Chronicle rules need the decorator imports to come from
78
+ `@cratis/chronicle` or `@cratis/chronicle/reactors`; the rule cannot prove a
79
+ `this.client` field belongs to the reactor, so a non-match is not a clean bill.
80
+ - Lint complements, not replaces, `build()`: the builder validates the whole
81
+ graph (missing services, lifetime mismatches, misplaced decorators, stale
82
+ metadata) and `arc-proxygenerator --check-metadata` catches stale generated
83
+ metadata in CI.
84
+
85
+ ## Verify
86
+
87
+ Run `eslint src` with the type-checked preset in CI next to `tsc` and the
88
+ specs. A pass shows no `arc-core/*` findings; a deliberately broken artifact
89
+ (for example a `@command()` property without `@field`) should fail with
90
+ `arc-core/missing-field`.
91
+
92
+ ## Route near misses
93
+
94
+ - Writing the artifacts: `cratis-arc-command-typescript`,
95
+ `cratis-arc-query-typescript`, `cratis-arc-validation-typescript`.
96
+ - The Roslyn analyzers for C# Arc: the C# command skills.
@@ -11,25 +11,28 @@ of Arc. A command is a decorated class that carries the input and handles itself
11
11
  Arc supplies the route, body binding, validation, authorization, and the
12
12
  `CommandResult` envelope. There is no controller and no route to write.
13
13
 
14
- ## Source preview — read this first
14
+ ## Packages — read this first
15
15
 
16
- - **None of the server packages is published to npm.** `@cratis/arc.core`,
16
+ - **The server packages are published to npm at stable 1.0.0.** `@cratis/arc.core`,
17
17
  `@cratis/arc.express`, `@cratis/arc.fastify`, `@cratis/arc.hono`,
18
18
  `@cratis/arc.testing`, `@cratis/arc.mongodb`, `@cratis/arc.drizzle`,
19
- `@cratis/arc.chronicle`, `@cratis/cratis`, `@cratis/arc.proxygenerator` and
20
- `@cratis/eslint-plugin-arc-core` are an unpublished source preview (0.x
21
- manifests, GitHub pre-releases). The API may still change. `npm install @cratis/arc.core` fails.
19
+ `@cratis/arc.chronicle`, `@cratis/platform`, `@cratis/arc.proxygenerator` and
20
+ `@cratis/eslint-plugin-arc-core` install with `npm install`.
21
+ `@cratis/platform` is a meta package, like the C# `Cratis` package: it brings
22
+ Arc and Chronicle together by installing `@cratis/arc.core`, `.express`,
23
+ `.chronicle`, `.testing` and the `@cratis/chronicle` client. `@cratis/cratis`
24
+ is its deprecated former name.
22
25
  - **`@cratis/arc` is a different package.** `@cratis/arc`, `@cratis/arc.react` and
23
26
  `@cratis/arc.react.mvvm` are the published **client** runtime, built from
24
27
  `Cratis/Arc`. Generated proxies import them in the frontend. The server packages
25
28
  never depend on them. Never tell a user to install `@cratis/arc` to get a
26
29
  server.
27
- - `@cratis/arc.chronicle` and `@cratis/cratis` are additionally marked
28
- **experimental**.
30
+ - `@cratis/arc.chronicle` and `@cratis/platform` describe their own Chronicle
31
+ integration as **experimental**; their package READMEs carry that label.
29
32
 
30
33
  ## Verified product sources
31
34
 
32
- Source: `Cratis/Arc.TypeScript` (source preview), reading package exports, `Documentation/**`, and
35
+ Source: `Cratis/Arc.TypeScript`, reading package exports, `Documentation/**`, and
33
36
  `Samples/Tasks` / `Samples/Library`. Behavior on the development branch is excluded.
34
37
 
35
38
  Requires the Chronicle SDK peer `^6.29.0`, Fundamentals peer `^7.19.6`, `@opentelemetry/api` `^1.9.0` and (optional, for RxJS observable queries) `rxjs` `^7.8.2`.
@@ -57,12 +60,10 @@ when returning or specifying Chronicle events.
57
60
 
58
61
  Start the server's builder with `ArcApplication.createBuilder()`.
59
62
 
60
- Read [references/project-setup.md](references/project-setup.md) when consuming the source preview in a project, choosing compiler and decorator settings, or wiring `main.ts` and the builder calls (`useGeneratedMetadata` before `discover()`; `build()` validates the graph before any listener opens).
63
+ Read [references/project-setup.md](references/project-setup.md) when installing the packages, choosing compiler and decorator settings, or wiring `main.ts` and the builder calls (`useGeneratedMetadata` before `discover()`; `build()` validates the graph before any listener opens).
61
64
 
62
65
  ## Secure discovery defaults
63
66
 
64
- Requires Arc for TypeScript 0.56.0 for these defaults.
65
-
66
67
  Outside **Development**, catalogs, identity discovery and `/openapi.json` require
67
68
  authentication; without it they are unmapped with a warning. Explicitly requiring
68
69
  authentication without configuring it fails startup. `development: true` is no bypass.
@@ -273,12 +274,20 @@ are in [references/chronicle-events.md](references/chronicle-events.md).
273
274
 
274
275
  ## Generate metadata and proxies
275
276
 
276
- `arc-proxygenerator` (`@cratis/arc.proxygenerator`, unpublished) reads the TypeScript source and writes server metadata and client proxies in one run. Regenerate after **every** change to a command, read model or validator — `useGeneratedMetadata` throws `Stale generated artifact metadata for <Type>` otherwise — and gate CI with `--check-metadata`. Never edit the committed metadata module.
277
+ `arc-proxygenerator` (`@cratis/arc.proxygenerator`) reads the TypeScript source and writes server metadata and client proxies in one run. Regenerate after **every** change to a command, read model or validator — `useGeneratedMetadata` throws `Stale generated artifact metadata for <Type>` otherwise — and gate CI with `--check-metadata`. Never edit the committed metadata module.
278
+
279
+ Read [references/proxy-generation.md](references/proxy-generation.md) when wiring the generator script, matching route options to the server, or compiling the generated proxies in a frontend. Read [references/proxy-generator-options.md](references/proxy-generator-options.md) for the full option list, type mapping, copied client validators and file ownership.
280
+
281
+ ## Extend the pipeline or call it from code
277
282
 
278
- Read [references/proxy-generation.md](references/proxy-generation.md) when wiring the generator script, matching route options to the server, or compiling the generated proxies in a frontend.
283
+ Read [references/command-pipeline.md](references/command-pipeline.md) for global command filters, response value handlers, execution scopes, `app.server.executeCommand` from jobs, and low-level `defineCommand`.
284
+
285
+ Related Arc for TypeScript skills: `cratis-arc-tenancy-typescript`, `cratis-arc-storage-typescript`, `cratis-arc-testing-typescript` and `cratis-arc-code-analysis-typescript`.
279
286
 
280
287
  ## Host the application
281
288
 
289
+ Read [references/configuration.md](references/configuration.md) when setting `ArcOptions`, `appsettings.json` or `Cratis__...` environment variables, route prefixes, body limits or observable-query limits.
290
+
282
291
  `app.run()` is the standalone Node host. To mount the same built application in
283
292
  Express 5, Fastify 5, Hono 4, or a Fetch API runtime, keep the builder and swap
284
293
  the host — see
@@ -11,11 +11,11 @@
11
11
  - Reactors that return commands
12
12
  - Specify it without a kernel
13
13
 
14
- Source: `Cratis/Arc.TypeScript` (source preview): `Documentation/chronicle/**`,
14
+ Source: `Cratis/Arc.TypeScript`: `Documentation/chronicle/**`,
15
15
  `Documentation/testing/chronicle.md`, `Source/Chronicle/index.ts`, and
16
- `Samples/Library`. `@cratis/arc.chronicle` is **experimental** and, like every
17
- package in the repository, not published to npm. `@cratis/chronicle` (the SDK)
18
- is published; the integration peers it and needs SDK 6.29.0 or later.
16
+ `Samples/Library`. `@cratis/arc.chronicle` labels itself **experimental** in
17
+ its README. `@cratis/chronicle` (the SDK) is a separate package; the
18
+ integration peers it and needs SDK 6.29.0 or later.
19
19
 
20
20
  ## Register the integration
21
21
 
@@ -126,7 +126,7 @@ itself is `cratis-chronicle-client-typescript`.
126
126
  preset flags a command-returning handler without `@onceOnly()` or a replay
127
127
  handler. Prefer explicit replay decisions, not lint suppression.
128
128
 
129
- Preview `withChronicle({ ..., activateArtifactsInScopes: true })` on an Arc-owned
129
+ Opt in with `withChronicle({ ..., activateArtifactsInScopes: true })` on an Arc-owned
130
130
  client resolves reactors/reducers through Arc DI, one scope per delivered batch,
131
131
  with the Chronicle namespace as tenant and no principal. Existing registrations
132
132
  win; otherwise discovered reactors/reducers are registered scoped. The SDK
@@ -10,7 +10,7 @@
10
10
  - Recovery follows commit facts
11
11
  - Chronicle aggregates (experimental)
12
12
 
13
- Source: `Cratis/Arc.TypeScript` (source preview, not on npm):
13
+ Source: `Cratis/Arc.TypeScript`:
14
14
  `Source/Core/commands/CommandOperation.ts`, operation execution/recovery code,
15
15
  `Source/Chronicle/ChronicleCommandScope.ts`, `commandAggregate.ts`,
16
16
  `Documentation/commands/operations/reference.md`, and
@@ -0,0 +1,137 @@
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
+ # Command pipeline extensions, direct calls and low-level definitions
5
+
6
+ ## Contents
7
+
8
+ - Global command filters
9
+ - Response value handlers
10
+ - Execution scopes and runners
11
+ - Run a command without HTTP
12
+ - Low-level definitions
13
+
14
+ Source: `Cratis/Arc.TypeScript`: `Documentation/commands/{command-filters,response-value-handlers,command-execution-scopes,calling-commands-from-code,low-level-definitions}.md`.
15
+ Read this when every command needs the same gate, a returned value should
16
+ trigger a side effect instead of reaching the client, work must wrap a command,
17
+ a job must run a command without HTTP, or Zod-based definitions are in play.
18
+
19
+ ## Global command filters
20
+
21
+ `AuthorizationCommandFilter` makes access decisions and always runs first,
22
+ whatever the registration order; `CommandPipelineFilter` returns ordinary
23
+ result fragments. Both implement `onExecution(context: CommandContext)` and
24
+ return a `CommandResult` or nothing. They apply to every `@command()` class and
25
+ low-level definition and run for execute and for `POST <route>/validate`.
26
+
27
+ ```typescript
28
+ @authorizationCommandFilter()
29
+ export class TenantGate implements AuthorizationCommandFilter {
30
+ onExecution(context: CommandContext): CommandResult | void {
31
+ if (!context.tenantId) return unauthorizedCommandResult(context, 'A tenant is required');
32
+ }
33
+ }
34
+ @commandPipelineFilter()
35
+ class TitleGate implements CommandPipelineFilter {
36
+ onExecution(context: CommandContext): CommandResult | void {
37
+ // return commandFilterResult(context, { validationResults: [validation('A title is required', ['title'])] });
38
+ }
39
+ }
40
+ builder.add(TenantGate, TitleGate); // or addAuthorizationCommandFilter / addCommandPipelineFilter
41
+ ```
42
+
43
+ A denial answers 403 with `isAuthorized: false` and an optional
44
+ `authorizationFailureReason`; validation answers 400. Register explicit tokens
45
+ as scoped or transient services. Per-definition `CommandFilter<T>` callbacks
46
+ (a `filters` list on `defineCommand`) are a different, narrower mechanism.
47
+
48
+ ## Response value handlers
49
+
50
+ Return effects next to the response instead of performing them in `handle()`:
51
+ `return tuple({ id: this.id }, new AuditEntry(...))`. Arc flattens branded
52
+ tuples and `response(...)` branches, then asks every registered handler's
53
+ `canHandle(context, value)`; **every** matching handler runs, in deterministic
54
+ name order. A value no handler accepts is a candidate client response, and
55
+ **at most one** is allowed (two fail the command). Arrays are not flattened.
56
+
57
+ ```typescript
58
+ @commandResponseValueHandler()
59
+ @injectable(AuditLog)
60
+ export class AuditEntryHandler implements CommandResponseValueHandler {
61
+ constructor(private readonly log: AuditLog) {}
62
+ canHandle(_context: CommandContext, value: unknown): boolean { return value instanceof AuditEntry; }
63
+ handle(context: CommandContext, value: unknown): void { this.log.record(context.correlationId, (value as AuditEntry).text); }
64
+ }
65
+ ```
66
+
67
+ A handler may return `rejected(...)` or `denied(...)` to fail the command but
68
+ never a client response. It runs scoped and reads `CommandContext`. Register
69
+ with `builder.add`, `discover`, `addCommandResponseValueHandler(token)`, or the
70
+ `commandResponseValueHandlers` option on `ArcServer`. The Chronicle integration
71
+ uses this mechanism to append returned events.
72
+
73
+ ## Execution scopes and runners
74
+
75
+ Low-level `defineCommand({ scopes: [factory] })`: Arc creates the scope objects
76
+ for every execution and records each before calling `begin`. `begin` runs before
77
+ `provide()` and `handle()`; every recorded scope then `complete`s exactly once,
78
+ in reverse order, with the result so far, including a scope whose `begin`
79
+ threw. A throwing `begin` stops later scopes and fails with 500; a throwing
80
+ `complete` removes the response and fails with 500. Scopes do not run for the
81
+ validation-only route or when authorization or validation fails, and Arc does
82
+ not make a scope transactional: read `result.isSuccess` to commit or roll back.
83
+ `@command()` classes declare no scopes; wrap every model-bound execution with
84
+ `builder.addCommandExecutionRunner((context, execute) => ...)` or the
85
+ `commandExecutionRunner` option.
86
+
87
+ ## Run a command without HTTP
88
+
89
+ `app.server` (an `ArcServer`) offers direct entry points:
90
+
91
+ | Entry point | Runs | Trusts the caller with |
92
+ | --- | --- | --- |
93
+ | `handle(request, native?)` | the full HTTP pipeline for a Fetch `Request`; `null` when not an Arc route | nothing beyond an HTTP client |
94
+ | `executeCommand(name, input, context)` / `execute(instance, context)` | authorization, binding, validators, the command | the whole execution context, including allowed severity |
95
+ | `validateCommand(name, input, context)` / `validate(instance, context)` | the same without `provide` or `handle` | the whole context |
96
+ | `performQuery(name, input, context, options?)` | authorization, binding, validators, the query | the whole context except allowed severity |
97
+
98
+ Names are namespace plus class (`Tasks.Registration.RegisterTask` when
99
+ discovered, bare `RegisterTask` when added), `Namespace.ReadModel.method` for
100
+ queries, and `Namespace.Name` for low-level definitions. A missing name throws.
101
+
102
+ ```typescript
103
+ const context = {
104
+ correlationId: randomUUID(),
105
+ principal: { id: 'import-job', roles: ['system'], isAuthenticated: true },
106
+ tenantId: 'acme', signal: AbortSignal.timeout(5_000), allowedSeverity: Severity.Warning
107
+ };
108
+ const result = await app.server.executeCommand('RegisterTask', { id, title: 'Imported' }, context);
109
+ ```
110
+
111
+ - You supply the context: no authentication handler runs and no tenant is
112
+ resolved, but authorization still checks the principal and tenant you pass,
113
+ so pass the real ones. Choose the tenant deliberately.
114
+ - `context.allowedSeverity` is used as given (`Severity.Error` lets
115
+ error-severity validation pass); only trusted code may raise it.
116
+ - Arc exposes a frozen copy through `currentContext()` during the call; nested
117
+ calls get their own and the outer is restored afterward.
118
+ - Nothing is redacted or logged; never forward the result to an untrusted
119
+ caller. No body limit applies.
120
+
121
+ ## Low-level definitions
122
+
123
+ Keep `defineCommand`, `defineQuery` and `defineObservableQuery` when Zod schemas
124
+ already exist, explicit `validate` and `filters` callbacks are needed, or code
125
+ cannot use decorators. They run through the same server and pipeline:
126
+
127
+ ```typescript
128
+ const create = defineCommand({
129
+ name: 'Create', namespace: 'Tasks', schema: z.object({ id: z.string(), title: z.string() }),
130
+ handle: ({ id, title }) => { tasks.set(id, title); return id; }
131
+ });
132
+ const server = new ArcServer({ commands: [create] });
133
+ ```
134
+
135
+ The analyzer cannot see their output types; declare `clientOutput` and export a
136
+ manifest for proxy generation (`proxy-generator-options.md`). Specify them with
137
+ `ArcScenario` (`cratis-arc-testing-typescript`).
@@ -0,0 +1,83 @@
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
+ # Configure Arc for TypeScript
5
+
6
+ Source: `Cratis/Arc.TypeScript`: `Documentation/configuration/index.md`,
7
+ `Source/Core/configuration/loadConfiguration.ts`. Settings live in one
8
+ `ArcOptions` object. Serializable settings may come from `appsettings.json`,
9
+ environment variables and code; **code always wins**.
10
+
11
+ ## Which entry point reads configuration
12
+
13
+ | Entry point | Reads `appsettings.json` and environment |
14
+ | --- | --- |
15
+ | `ArcApplication.createBuilder()` (`@cratis/arc.core`) | Yes, unless `configuration: false` |
16
+ | `CratisApplication.createBuilder()` (`@cratis/platform`) | Yes, including `Cratis:Chronicle` |
17
+ | `ArcApplication.createBuilder()` from `@cratis/arc.core/fetch` | No; code options only (no filesystem) |
18
+ | `new ArcServer(options)` | No; code options only |
19
+
20
+ Precedence, lowest to highest: `appsettings.json` in the working directory,
21
+ `appsettings.{Environment}.json`, `Cratis__...` environment variables, then code
22
+ options. `Cratis__Arc__CorrelationId__HttpHeader=X-Other-ID` overrides the file;
23
+ `correlationId: { httpHeader: 'X-Code-ID' }` overrides that variable. Choose
24
+ files explicitly with `{ configuration: { file: new URL(...), env } }`.
25
+
26
+ ```json
27
+ { "Cratis": { "Arc": {
28
+ "Tenancy": { "ResolverType": "Fixed", "FixedTenantId": "default" },
29
+ "GeneratedApis": { "RoutePrefix": "api", "EnableQueryHttpMethod": true },
30
+ "Query": { "KeepAliveInterval": "00:00:30" },
31
+ "Hosting": { "ApplicationUrl": "http://127.0.0.1:3000/" },
32
+ "ExposeExceptionDetails": false } } }
33
+ ```
34
+
35
+ ## Core options (configuration path / code path)
36
+
37
+ | Option | Default | Effect |
38
+ | --- | --- | --- |
39
+ | `ExposeExceptionDetails` / `exposeExceptionDetails` | `true` only in Development | Include exception messages and stack traces in results; otherwise redacted |
40
+ | `Development` / `development` | `false` | Enables development user and tenant discovery only; not an auth bypass |
41
+ | `Introspection:Enabled` / `introspection.enabled` | `true` | `false` unmaps catalogs and OpenAPI everywhere |
42
+ | `CorrelationId:HttpHeader` / `correlationId.httpHeader` | `X-Correlation-ID` | Request and response correlation header |
43
+ | `GeneratedApis:RoutePrefix` / `generatedApis.routePrefix` | `api` | Convention route prefix |
44
+ | `GeneratedApis:SegmentsToSkipForRoute` | `0` | Leading namespace segments dropped from routes |
45
+ | `GeneratedApis:IncludeCommandNameInRoute`, `IncludeQueryNameInRoute` | `true` | Append the artifact name to its route |
46
+ | `GeneratedApis:EnableQueryHttpMethod` | `true` | Accept HTTP `QUERY`; `false` answers 405 with `Allow: GET` |
47
+ | `GeneratedApis:OpenApiVersion` | `0.1.0` | OpenAPI `info.version` (TypeScript only) |
48
+ | `Query:KeepAliveInterval` / `query.keepAliveIntervalMs` | 30 s | Idle hub `Ping`; `hh:mm:ss` in files, milliseconds in code, `0` disables in code |
49
+ | `Hosting:ApplicationUrl` / `hosting.applicationUrl` | `http://127.0.0.1:3000/` | Standalone listener; `app.run({ host, port })` overrides |
50
+ | `Hosting:MaxBodyBytes` / `hosting.maxBodyBytes` | `1048576` | Largest JSON command or `QUERY` body |
51
+ | `Tenancy:*` | see `cratis-arc-tenancy-typescript` | Tenant selection and membership |
52
+
53
+ Keep route options equal to the proxy generator's `--api-prefix`,
54
+ `--segments-to-skip`, `--skip-command-name-in-route` and
55
+ `--skip-query-name-in-route` (see `proxy-generator-options.md`).
56
+
57
+ ## Observable-query limits (code options under `query`)
58
+
59
+ | Option | Default |
60
+ | --- | --- |
61
+ | `allowedOrigins` | same origin; exact HTTP(S) origins or a code-only predicate |
62
+ | `observableEmissionGuards` | `[]` (scoped guard tokens) |
63
+ | `enableObservableHealth` | `false` |
64
+ | `maxObservableSubscriptions` / `...PerCaller` | 4096 / 4096 |
65
+ | `maxObservableHubConnections` / `...PerCaller` | 512 / 512 |
66
+ | `maxObservableHubSubscriptionsPerConnection` | 256 |
67
+ | `maxObservableInboundFrames` / `maxObservableOutboundFrames` | 256 / 256 |
68
+ | `maxObservableInboundFrameBytes` / `maxObservableOutboundFrameBytes` | 65536 / 1048576 |
69
+ | `maxObservablePendingEmissions` | 256 |
70
+ | `maxObservableTombstones` | 1024 per hub connection |
71
+ | `observableHandshakeTimeoutMs`, `observableShutdownTimeoutMs` | 10000 each |
72
+
73
+ ## Package options bound from configuration
74
+
75
+ | Builder method | Configuration it binds |
76
+ | --- | --- |
77
+ | `withMongoDB({ ... })` | `Cratis:MongoDB:{Server,Database}` |
78
+ | `withDrizzle({ ... })` | none; pass the database in code |
79
+ | `withChronicle({ ... })` | `Cratis:Chronicle:{ConnectionString,EventStore}` |
80
+
81
+ Low-level `commands`, `queries` and `observableQueries` arrays take
82
+ `defineCommand`/`defineQuery` definitions; the model-bound decorators are the
83
+ default.
@@ -10,11 +10,11 @@
10
10
  - Observable-query WebSockets from a dev server
11
11
  - Storage integrations
12
12
 
13
- Source: `Cratis/Arc.TypeScript` (source preview): `Documentation/overview.md`, `hosts/**`,
13
+ Source: `Cratis/Arc.TypeScript`: `Documentation/overview.md`, `hosts/**`,
14
14
  `mongodb/getting-started.md`, `sql/getting-started.md`,
15
15
  `chronicle/registration-options.md`, and the `Express`, `Fastify`, `Hono`,
16
- `MongoDB`, `Drizzle` and `Chronicle` package exports. None of these packages is
17
- published to npm; install them from a clone or packed tarballs.
16
+ `MongoDB`, `Drizzle` and `Chronicle` package exports. Install each package from
17
+ npm (stable 1.0.0).
18
18
 
19
19
  ## The host only delivers requests
20
20
 
@@ -212,7 +212,8 @@ Requires the peers `mongodb` `^6.21.0`, `drizzle-orm` `^0.45.0`, `rxjs` `^7.8.2`
212
212
  Existing deployments must replay projections into the aligned collection;
213
213
  the old collection is left intact. Core exports `readModelCollectionNameResolver`,
214
214
  MongoDB exports `resolveMongoCollectionName`.
215
- - `@cratis/cratis` (experimental) registers Arc and Chronicle together through
215
+ - `@cratis/platform` (a meta package, formerly `@cratis/cratis`; its Chronicle
216
+ integration is experimental) brings Arc and Chronicle together and registers them through
216
217
  `CratisApplication.createBuilder()` and `builder.addCratis(...)`. Unlike C#
217
218
  `AddCratis`, it installs no authentication handler; protected routes still
218
219
  need one you choose.
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Identity, authorization and discovery access
5
5
 
6
- Source: `Cratis/Arc.TypeScript` (GitHub pre-release, not on npm):
6
+ Source: `Cratis/Arc.TypeScript`:
7
7
  `Source/Core/authentication/**`, `identity/**`, `introspection/**`,
8
8
  `Documentation/core/authentication.md`, `authorization.md`,
9
9
  `Documentation/identity/**`, `hosts/native-principal.md`, and
@@ -63,8 +63,6 @@ production credentials; keep simulated identities on loopback hosts.
63
63
 
64
64
  ## Secure introspection defaults
65
65
 
66
- Requires Arc for TypeScript 0.56.0 for these defaults.
67
-
68
66
  `/.cratis/commands`, `/.cratis/queries`, `/.cratis/identity-details/schema`,
69
67
  `/.cratis/users`, `/.cratis/tenants`, and `/openapi.json` are anonymous only in
70
68
  Development by default. Elsewhere they require an authenticated principal from
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Observability and trusted host scopes
5
5
 
6
- Source: `Cratis/Arc.TypeScript` (source preview):
6
+ Source: `Cratis/Arc.TypeScript`:
7
7
  `Source/Core/execution/WellKnownTelemetryNames.ts`, `observability.ts`,
8
8
  `runInScope.ts`, `RunInScopeOptions.ts`, and `Documentation/observability.md`.
9
9
 
@@ -1,19 +1,24 @@
1
1
  # Project setup and bootstrap for Arc for TypeScript
2
2
 
3
- This reference holds the source-preview consumption paths, compiler and decorator settings, and the application bootstrap with its builder calls.
3
+ This reference holds the install path, compiler and decorator settings, and the application bootstrap with its builder calls.
4
4
 
5
5
  ## Set up a project
6
6
 
7
- Consume the preview in one of two ways:
7
+ Install the server packages from npm (stable 1.0.0), then add the host adapter and storage packages the application needs:
8
8
 
9
- | Path | How | Use when |
10
- | --- | --- | --- |
11
- | Inside a clone | Put the application under `Samples/<Name>` in a clone of `Cratis/Arc.TypeScript`; reference packages as `workspace:^` | Experimenting, or changing Arc while building on it |
12
- | Packed tarballs | In the clone: `yarn install`, `yarn build`, then `yarn workspace @cratis/arc.core pack --out <file>` per package; `npm install <file>.tgz` in your project | A separate repository |
9
+ ```bash
10
+ npm install @cratis/arc.core @cratis/fundamentals @opentelemetry/api
11
+ npm install --save-dev @cratis/arc.testing @cratis/arc.proxygenerator @cratis/eslint-plugin-arc-core
12
+ ```
13
+
14
+ | Add | When |
15
+ | --- | --- |
16
+ | `@cratis/arc.express`, `@cratis/arc.fastify` or `@cratis/arc.hono` | The application mounts into an existing web framework instead of the standalone host |
17
+ | `@cratis/arc.mongodb`, `@cratis/arc.drizzle` | MongoDB or SQL read models |
18
+ | `@cratis/arc.chronicle`, or `@cratis/platform` (meta package) for the composed builder | Event sourcing with Chronicle |
19
+ | `rxjs` | RxJS observable queries (optional peer of the core) |
13
20
 
14
- Use `yarn pack`, not `npm pack` — Yarn rewrites `workspace:^` dependencies to
15
- version ranges; npm does not, and the tarball then fails to install. A
16
- `workspace:^` dependency outside the clone fails at install.
21
+ `Samples/Tasks` and `Samples/Library` in `Cratis/Arc.TypeScript` are runnable references for the slice layout.
17
22
 
18
23
  - Node.js 22.19 or later (the core runs on 22; the workspace build needs 22.19;
19
24
  24 LTS is recommended).