@cratis/pi 7.139.0 → 7.141.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package/corpus/skills/cratis-chronicle-hosting/SKILL.md +7 -0
- package/package/corpus/skills/cratis-chronicle-hosting/references/sinks.md +119 -0
- package/package/corpus/skills/cratis-chronicle-hosting/verification.json +5 -1
- package/package/corpus/skills/cratis-chronicle-projection/SKILL.md +8 -0
- package/package/corpus/skills/cratis-chronicle-projection/references/graph-projections.md +25 -0
- package/package/corpus/skills/cratis-chronicle-read-model/SKILL.md +5 -0
- package/package/corpus/skills/cratis-chronicle-read-model/references/sinks.md +133 -0
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +29 -2
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +3 -1
- package/package/corpus/skills/cratis-screenplay-model-authoring/references/screen-authoring-workflow.md +15 -3
- package/package/corpus/skills/cratis-screenplay-model-authoring/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-model-review/SKILL.md +5 -1
- package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +4 -3
- package/package/corpus/skills/cratis-screenplay-model-review/verification.json +3 -2
- package/package/corpus/skills/cratis-screenplay-projections/SKILL.md +6 -1
- package/package/corpus/skills/cratis-screenplay-projections/references/graphs.md +56 -0
- package/package/corpus/skills/cratis-screenplay-projections/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +11 -6
- package/package/corpus/skills/cratis-screenplay-read-surface/references/sinks.md +166 -0
- package/package/corpus/skills/cratis-screenplay-read-surface/verification.json +7 -1
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +8 -0
- package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +2 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +45 -2
- package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +6 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/preferred-syntax.md +2 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1318 -0
- package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
- package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +4 -1
- package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +6 -8
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/design-system-and-themes.md +257 -0
- package/package/corpus/skills/cratis-screenplay-ui-composition/references/ui-profile-and-theme.md +8 -8
- package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +3 -0
- package/package.json +1 -1
|
@@ -52,6 +52,13 @@ Read [storage resolution](references/storage-resolution.md) when choosing
|
|
|
52
52
|
per-namespace destinations, schema/runtime identities, Azure authentication,
|
|
53
53
|
SQL schemas, or disabling automatic creation.
|
|
54
54
|
|
|
55
|
+
Read models and graphs can live apart from the events. The `sinks` section names
|
|
56
|
+
sink configurations (`type` `MongoDB`, `SQL` or `Neo4j`, each with its own
|
|
57
|
+
connection); `sinks.readModels` and `sinks.graphs` replace the defaults (the
|
|
58
|
+
`storage` connection and the `neo4j` server), and clients choose a named sink with
|
|
59
|
+
`[Sink("name")]`. Changing a sink replays the affected read models. Read
|
|
60
|
+
[named sinks](references/sinks.md) before adding or changing the section.
|
|
61
|
+
|
|
55
62
|
## Supply certificates before starting production
|
|
56
63
|
|
|
57
64
|
Default TLS needs a PFX certificate with a private key:
|
|
@@ -0,0 +1,119 @@
|
|
|
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 named sinks in the Kernel
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Defaults without a `sinks` section
|
|
9
|
+
- One MongoDB and one SQL sink
|
|
10
|
+
- Read models in another engine than the events
|
|
11
|
+
- Graphs in their own Neo4j servers
|
|
12
|
+
- Environment variables
|
|
13
|
+
- Startup validation and moves
|
|
14
|
+
|
|
15
|
+
Requires Chronicle 19.144.0 for the `sinks` section and for clients that name sinks (check the
|
|
16
|
+
Kernel image tag and the `Cratis.Chronicle` package version).
|
|
17
|
+
|
|
18
|
+
## Defaults without a `sinks` section
|
|
19
|
+
|
|
20
|
+
Without a `sinks` section the Kernel stores read models through its `storage` connection, with the
|
|
21
|
+
sink type the client chose (`DefaultSinkTypeId`, MongoDB unless changed), and graphs in its `neo4j`
|
|
22
|
+
server. Nothing changes for an existing deployment until the section is added.
|
|
23
|
+
|
|
24
|
+
The section has three members:
|
|
25
|
+
|
|
26
|
+
| Member | Default | Meaning |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `readModels` | empty | The configuration a read model naming no sink stores to. Empty keeps `storage` |
|
|
29
|
+
| `graphs` | empty | The configuration a graph naming no sink stores to. Empty keeps `neo4j` |
|
|
30
|
+
| `configurations.<name>` | empty | One named sink: `type` (`MongoDB`, `SQL` or `Neo4j`) and its own connection. Names match without regard to case |
|
|
31
|
+
|
|
32
|
+
`MongoDB` and `SQL` take `connectionDetails`; for `SQL` the engine (PostgreSQL, Microsoft SQL
|
|
33
|
+
Server or SQLite) is read from the connection string. `Neo4j` takes `server` (a bolt URI),
|
|
34
|
+
`userName`, `passwordSecret` (the **name** of the configuration key holding the password, never the
|
|
35
|
+
password), `databaseMode` (`PerNamespace` or `Single`), `databasePrefix`, `singleDatabase` and
|
|
36
|
+
`createIfMissing`. A named MongoDB or SQL sink derives its database names the way `storage` does,
|
|
37
|
+
including `storage.databaseNamePrefix`.
|
|
38
|
+
|
|
39
|
+
## One MongoDB and one SQL sink
|
|
40
|
+
|
|
41
|
+
The default read-model sink becomes the `primary` MongoDB configuration, and read models that the
|
|
42
|
+
client marks `[Sink("reporting")]` go to PostgreSQL:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"sinks": {
|
|
47
|
+
"readModels": "primary",
|
|
48
|
+
"configurations": {
|
|
49
|
+
"primary": { "type": "MongoDB", "connectionDetails": "mongodb://mongo:27017" },
|
|
50
|
+
"reporting": { "type": "SQL", "connectionDetails": "Host=pg;Database=reporting;Username=chronicle" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Keep credentials out of the file: supply them through approved configuration, or let
|
|
57
|
+
[storage resolution](storage-resolution.md) resolve the connection. A named SQL or Neo4j sink
|
|
58
|
+
resolves its connection through `storage.connectionResolution` when that is configured; a named
|
|
59
|
+
MongoDB sink uses its `connectionDetails` directly.
|
|
60
|
+
|
|
61
|
+
## Read models in another engine than the events
|
|
62
|
+
|
|
63
|
+
Named sinks do not depend on event storage. A Kernel on PostgreSQL can keep read models in
|
|
64
|
+
MongoDB, and a Kernel on MongoDB can keep some in PostgreSQL:
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"storage": { "type": "postgresql", "connectionDetails": "Host=pg;Database=chronicle;Username=chronicle" },
|
|
69
|
+
"sinks": {
|
|
70
|
+
"readModels": "documents",
|
|
71
|
+
"configurations": {
|
|
72
|
+
"documents": { "type": "MongoDB", "connectionDetails": "mongodb://mongo:27017" }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The configuration's `type` decides the engine, so a read model naming a `SQL` sink is stored in
|
|
79
|
+
SQL even when the client's `DefaultSinkTypeId` is MongoDB.
|
|
80
|
+
|
|
81
|
+
## Graphs in their own Neo4j servers
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"sinks": {
|
|
86
|
+
"graphs": "people",
|
|
87
|
+
"configurations": {
|
|
88
|
+
"people": { "type": "Neo4j", "server": "bolt://people-graph:7687", "userName": "chronicle", "passwordSecret": "NEO4J_PASSWORD" },
|
|
89
|
+
"organization": { "type": "Neo4j", "server": "bolt://organization-graph:7687" }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Environment variables
|
|
96
|
+
|
|
97
|
+
The same keys under the `Cratis__Chronicle__` prefix:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
Cratis__Chronicle__Sinks__ReadModels=primary
|
|
101
|
+
Cratis__Chronicle__Sinks__Configurations__primary__Type=MongoDB
|
|
102
|
+
Cratis__Chronicle__Sinks__Configurations__primary__ConnectionDetails=mongodb://mongo:27017
|
|
103
|
+
Cratis__Chronicle__Sinks__Configurations__reporting__Type=SQL
|
|
104
|
+
Cratis__Chronicle__Sinks__Configurations__reporting__ConnectionDetails=Host=pg;Database=reporting;Username=chronicle
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Startup validation and moves
|
|
108
|
+
|
|
109
|
+
The Kernel refuses to start, naming the configuration, when a `type` is not `MongoDB`, `SQL` or
|
|
110
|
+
`Neo4j`; a `MongoDB` or `SQL` entry has no `connectionDetails` or a `Neo4j` entry no `server`;
|
|
111
|
+
`readModels` or `graphs` names a missing configuration; or `readModels` names a `Neo4j` entry or
|
|
112
|
+
`graphs` a `MongoDB`/`SQL` one. A client registering a read model whose `[Sink]` names no
|
|
113
|
+
configuration is refused with `UnknownSinkName`.
|
|
114
|
+
|
|
115
|
+
Changing `readModels` or `graphs` moves every read model or graph that names no sink. When their
|
|
116
|
+
clients register again, the Kernel replays them into the new sink under the
|
|
117
|
+
`observers.definitionEvolution` policy (`Manual` records a replay recommendation instead). Plan
|
|
118
|
+
the replay time and the new database's capacity before changing it in production: a move is a
|
|
119
|
+
replay from the event log, not a data copy.
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
{ "kind": "skill-contains", "value": "clustering.type=MongoDB" },
|
|
10
10
|
{ "kind": "skill-contains", "value": "directly in persistent storage" },
|
|
11
11
|
{ "kind": "skill-contains", "file": "references/operations.md", "value": "single globally ordered job step" },
|
|
12
|
-
{ "kind": "skill-contains", "file": "references/operations.md", "value": "GetSequenceNumberError.NotFound" }
|
|
12
|
+
{ "kind": "skill-contains", "file": "references/operations.md", "value": "GetSequenceNumberError.NotFound" },
|
|
13
|
+
{ "kind": "skill-contains", "file": "references/sinks.md", "value": "\"reporting\": { \"type\": \"SQL\", \"connectionDetails\": \"Host=pg;Database=reporting;Username=chronicle\" }" },
|
|
14
|
+
{ "kind": "skill-contains", "file": "references/sinks.md", "value": "\"primary\": { \"type\": \"MongoDB\", \"connectionDetails\": \"mongodb://mongo:27017\" }" },
|
|
15
|
+
{ "kind": "skill-contains", "file": "references/sinks.md", "value": "Cratis__Chronicle__Sinks__Configurations__reporting__Type=SQL" },
|
|
16
|
+
{ "kind": "skill-contains", "value": "[named sinks](references/sinks.md) before adding or changing the section." }
|
|
13
17
|
]
|
|
14
18
|
}
|
|
@@ -280,6 +280,14 @@ element and a read model (CHR0068). Read
|
|
|
280
280
|
[references/graph-projections.md](references/graph-projections.md) for the attributes,
|
|
281
281
|
fluent builder, operation model, replay and idempotency, and the sinks.
|
|
282
282
|
|
|
283
|
+
## Where the output is stored
|
|
284
|
+
|
|
285
|
+
A projection never names a sink: it writes to its read model's sink, chosen by `[Sink("name")]` on
|
|
286
|
+
the read-model type (or `DefaultSinkName`, then the Kernel default). Moving a read model to another
|
|
287
|
+
sink replays its projections there under the `observers.definitionEvolution` policy. Read
|
|
288
|
+
[read-model sinks](../cratis-chronicle-read-model/references/sinks.md) for the attribute, client
|
|
289
|
+
defaults and `CHR0069`, and [graph projections](references/graph-projections.md#sinks) for graphs.
|
|
290
|
+
|
|
283
291
|
## Definition changes replay
|
|
284
292
|
|
|
285
293
|
Read [references/definition-changes.md](references/definition-changes.md) when a changed mapping, key, filter, join or child must replay, or when a corrected mapping does not repair existing counters and joins (replay rebuilds them; deploying alone does not).
|
|
@@ -139,6 +139,31 @@ services.Configure<ChronicleOptions>(options =>
|
|
|
139
139
|
});
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
+
To keep one graph in its own Neo4j server, name a sink configured in the Kernel's `sinks` section
|
|
143
|
+
(`cratis-chronicle-hosting`) with `[Sink("name")]` from `Cratis.Chronicle.Sinks`. Put it on an
|
|
144
|
+
`IGraphProjection` class, or on **every** node and edge of a model-bound graph: elements of one
|
|
145
|
+
graph naming different sinks fail registration with `GraphHasConflictingSinks`. Without it the
|
|
146
|
+
graph uses `ChronicleOptions.DefaultGraphSinkName`, then the Kernel's `sinks.graphs`, then its
|
|
147
|
+
`neo4j` server. Requires Chronicle 19.144.0.
|
|
148
|
+
|
|
149
|
+
```csharp
|
|
150
|
+
using Cratis.Chronicle.Projections.Graphs;
|
|
151
|
+
using Cratis.Chronicle.Sinks;
|
|
152
|
+
|
|
153
|
+
[Graph("People")]
|
|
154
|
+
[Sink("people")]
|
|
155
|
+
public class PeopleGraph : IGraphProjection
|
|
156
|
+
{
|
|
157
|
+
public void Define(IGraphProjectionBuilder builder)
|
|
158
|
+
{
|
|
159
|
+
// Nodes and edges, as in the fluent graph projection.
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
A graph naming a read-model sink (`MongoDB` or `SQL`) is refused with
|
|
165
|
+
`SinkConfigurationIsForAnotherKindOfReadModel`. Changing a graph's sink replays it into the new one.
|
|
166
|
+
|
|
142
167
|
## Testing and analyzers
|
|
143
168
|
|
|
144
169
|
`GraphScenario` runs a graph projection against the in-memory graph sink:
|
|
@@ -78,6 +78,11 @@ public record <ReadModelName>(
|
|
|
78
78
|
indexing in the sink, including SQL. `[CompositeIndex]` on the class declares ordered multi-property indexes and
|
|
79
79
|
`[Index(IsDescending = true)]` declares descending ones. Read
|
|
80
80
|
[indexing](references/indexing.md) for valid paths, flags and store-specific limits.
|
|
81
|
+
- `[Sink("name")]` (`Cratis.Chronicle.Sinks`) on the read-model type stores it in a named sink the
|
|
82
|
+
Kernel configures, such as a reporting database in another engine; without it the read model uses
|
|
83
|
+
`ChronicleOptions.DefaultSinkName`, then the Kernel default. Never combine it with `[Passive]`
|
|
84
|
+
(`CHR0069`), and expect a replay when the sink changes. Read [sinks](references/sinks.md) before
|
|
85
|
+
choosing one.
|
|
81
86
|
|
|
82
87
|
### Shape the model for its consumer
|
|
83
88
|
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
# Named sinks for read models
|
|
5
|
+
|
|
6
|
+
## Contents
|
|
7
|
+
|
|
8
|
+
- Default and named sinks
|
|
9
|
+
- Choose a sink with `[Sink]`
|
|
10
|
+
- Client defaults
|
|
11
|
+
- Passive read models have no sink
|
|
12
|
+
- Changing a sink replays
|
|
13
|
+
- Refusals
|
|
14
|
+
|
|
15
|
+
Requires Chronicle 19.144.0 for `[Sink]`, `DefaultSinkName`, `DefaultGraphSinkName`, CHR0069 and
|
|
16
|
+
the Kernel `sinks` configuration (check the `Cratis.Chronicle` package and the Kernel image tag;
|
|
17
|
+
both must be at least that version). Older clients have no `Cratis.Chronicle.Sinks.SinkAttribute`.
|
|
18
|
+
|
|
19
|
+
## Default and named sinks
|
|
20
|
+
|
|
21
|
+
A sink is where a read model is stored. Without any choice every read model goes to the Kernel's
|
|
22
|
+
default sink: the client's `DefaultSinkTypeId` (MongoDB unless changed) on the Kernel's `storage`
|
|
23
|
+
connection. A **named sink** is a sink type with a connection of its own, configured by name in
|
|
24
|
+
the Kernel's `sinks` section (`cratis-chronicle-hosting`). Use one when some read models belong in
|
|
25
|
+
another database or engine, such as reporting tables in PostgreSQL while the rest stays in MongoDB.
|
|
26
|
+
The client only names the sink; it never carries a connection string.
|
|
27
|
+
|
|
28
|
+
## Choose a sink with `[Sink]`
|
|
29
|
+
|
|
30
|
+
`Cratis.Chronicle.Sinks.SinkAttribute` goes on the **read model type**, whatever builds it: a
|
|
31
|
+
model-bound read model, one filled by an `IProjectionFor<T>`, or one folded by a reducer. Never put
|
|
32
|
+
it on the projection or reducer class; the builder writes wherever its read model is stored.
|
|
33
|
+
|
|
34
|
+
```csharp
|
|
35
|
+
using Cratis.Chronicle.Events;
|
|
36
|
+
using Cratis.Chronicle.Keys;
|
|
37
|
+
using Cratis.Chronicle.Projections;
|
|
38
|
+
using Cratis.Chronicle.Projections.ModelBound;
|
|
39
|
+
using Cratis.Chronicle.Reducers;
|
|
40
|
+
using Cratis.Chronicle.Sinks;
|
|
41
|
+
|
|
42
|
+
[EventType]
|
|
43
|
+
public record OrderPlaced(Guid CustomerId, decimal Amount);
|
|
44
|
+
|
|
45
|
+
[EventType]
|
|
46
|
+
public record ShipmentDispatched(Guid OrderId, string Carrier);
|
|
47
|
+
|
|
48
|
+
[Sink("reporting")]
|
|
49
|
+
[FromEvent<ShipmentDispatched>(key: nameof(ShipmentDispatched.OrderId))]
|
|
50
|
+
public record DispatchedShipment([property: Key] Guid OrderId, string Carrier);
|
|
51
|
+
|
|
52
|
+
[Sink("reporting")]
|
|
53
|
+
public record CustomerRevenue([property: Key] Guid CustomerId, decimal Total);
|
|
54
|
+
|
|
55
|
+
public class CustomerRevenueProjection : IProjectionFor<CustomerRevenue>
|
|
56
|
+
{
|
|
57
|
+
public void Define(IProjectionBuilderFor<CustomerRevenue> builder) =>
|
|
58
|
+
builder.From<OrderPlaced>(from => from
|
|
59
|
+
.UsingKey(@event => @event.CustomerId)
|
|
60
|
+
.Add(model => model.Total).With(@event => @event.Amount));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[Sink("reporting")]
|
|
64
|
+
public record OrderCount(int Orders);
|
|
65
|
+
|
|
66
|
+
public class OrderCountReducer : IReducerFor<OrderCount>
|
|
67
|
+
{
|
|
68
|
+
public OrderCount OnOrderPlaced(OrderPlaced @event, OrderCount? current, EventContext context) =>
|
|
69
|
+
new((current?.Orders ?? 0) + 1);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The name matches a `sinks.configurations` entry, compared without regard to case. The sink's
|
|
74
|
+
configured `type` decides the engine: a read model naming a `SQL` sink is stored in SQL even when
|
|
75
|
+
the client's `DefaultSinkTypeId` is MongoDB. Queries keep reading through Chronicle's read-model
|
|
76
|
+
APIs; a direct `IMongoCollection<T>` or SQL query must target the database the named sink points
|
|
77
|
+
at, not the Kernel's default storage.
|
|
78
|
+
|
|
79
|
+
Graphs choose a sink the same way: read
|
|
80
|
+
[graph projections](../../cratis-chronicle-projection/references/graph-projections.md#sinks).
|
|
81
|
+
|
|
82
|
+
## Client defaults
|
|
83
|
+
|
|
84
|
+
To send everything that names no sink to a named sink, set the client defaults. Both are empty
|
|
85
|
+
by default, which leaves the choice to the Kernel's `sinks.readModels` and `sinks.graphs`:
|
|
86
|
+
|
|
87
|
+
```csharp
|
|
88
|
+
using Microsoft.Extensions.Hosting;
|
|
89
|
+
|
|
90
|
+
public static class Program
|
|
91
|
+
{
|
|
92
|
+
public static void Configure(string[] args)
|
|
93
|
+
{
|
|
94
|
+
var builder = Host.CreateApplicationBuilder(args);
|
|
95
|
+
|
|
96
|
+
builder.AddCratisChronicle(configureOptions: options =>
|
|
97
|
+
{
|
|
98
|
+
options.DefaultSinkName = "reporting";
|
|
99
|
+
options.DefaultGraphSinkName = "people";
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The order is: `[Sink]` on the type, then `ChronicleOptions.DefaultSinkName` (or
|
|
106
|
+
`DefaultGraphSinkName` for graphs), then the Kernel's `sinks.readModels` (or `sinks.graphs`), then
|
|
107
|
+
the Kernel's own storage.
|
|
108
|
+
|
|
109
|
+
## Passive read models have no sink
|
|
110
|
+
|
|
111
|
+
A `[Passive]` read model is never materialized, so it has nowhere to be stored. Combining
|
|
112
|
+
`[Passive]` with `[Sink]` is analyzer error `CHR0069`: remove `[Sink]` to keep it passive, or
|
|
113
|
+
remove `[Passive]` to store it in the named sink. Event targets (a projection or reducer publishing
|
|
114
|
+
to an event sequence) ignore sink names.
|
|
115
|
+
|
|
116
|
+
## Changing a sink replays
|
|
117
|
+
|
|
118
|
+
Moving a read model to another sink, by a different `[Sink]`, client default or Kernel default,
|
|
119
|
+
rebuilds it there: the Kernel replays the projections and reducers that fill it into the new sink,
|
|
120
|
+
as it does for a changed definition. The
|
|
121
|
+
`observers.definitionEvolution` policy applies, so a `Manual` policy records a replay
|
|
122
|
+
recommendation instead of replaying. A read model whose sink is unchanged is not replayed. Read
|
|
123
|
+
[definition changes](../../cratis-chronicle-projection/references/definition-changes.md) before
|
|
124
|
+
deploying a sink move on a large history.
|
|
125
|
+
|
|
126
|
+
## Refusals
|
|
127
|
+
|
|
128
|
+
| Failure | Cause | Fix |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| `CHR0069` (analyzer, error) | `[Passive]` and `[Sink]` on one type | Remove one of them |
|
|
131
|
+
| `UnknownSinkName` at registration | The Kernel has no `sinks.configurations` entry with that name | Add the configuration, or fix the name |
|
|
132
|
+
| `SinkConfigurationIsForAnotherKindOfReadModel` | A read model names a `Neo4j` sink, or a graph a `MongoDB`/`SQL` sink | Name a sink of the right kind |
|
|
133
|
+
| `GraphHasConflictingSinks` | Nodes and edges of one model-bound graph name different sinks | Give every element of the graph the same `[Sink]` |
|
package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md
CHANGED
|
@@ -22,8 +22,8 @@ repository is the full list; this page is the authoring summary.
|
|
|
22
22
|
## Accepted constructs
|
|
23
23
|
|
|
24
24
|
**Top level:** `domain`, `import`, `concept`, `type`, `policy`, `persona`,
|
|
25
|
-
`authentication`, `identity`, `purpose`, `trigger`, `theme`, `layout`, `ui profile`, `behavior`,
|
|
26
|
-
`module`, `seed`, authoring-only `system`, and admitted `eventsource` with its `stream`s (ESM v8).
|
|
25
|
+
`authentication`, `identity`, `purpose`, `trigger`, `design system` (one per application: `modes`, `default theme`, `tokens`, `components`, `words`, `rules`), `theme` (`implements`, `compatible with`, `palette`, `values`, a block per mode), `layout`, `ui profile`, `behavior`,
|
|
26
|
+
`sink`, `module`, `seed`, authoring-only `system`, and admitted `eventsource` with its `stream`s (ESM v8).
|
|
27
27
|
|
|
28
28
|
**Inside a module:** `description`, `authorize`, `import "<glob>"`,
|
|
29
29
|
`screen`/`dialog` templates, `form`, `contribute`, `on`/`uses` behavior
|
|
@@ -71,6 +71,33 @@ positional pins preserve older bytes/version. Fixtures and conditions
|
|
|
71
71
|
still name members. Syntax, stored-number safety and consumer admission:
|
|
72
72
|
command-surface `references/enum-numbers.md`.
|
|
73
73
|
|
|
74
|
+
**Sinks.** `sink <Name> for readmodels` or `sink <Name> for graphs` at the application root
|
|
75
|
+
declares a named sink; a `readmodel` or `graph` body chooses one with a bare `sink <Name>` line,
|
|
76
|
+
and anything that names none uses its kind's default. In a read model the line is the directive
|
|
77
|
+
only when `<Name>` is declared (in any file of the model), otherwise a property named `sink`;
|
|
78
|
+
`@sink <Type>` is always the property, and in a graph every `sink` line is the directive. The model
|
|
79
|
+
never names a database. In the typed syntax, `ApplicationSyntax.sinks` holds `SinkSyntax`
|
|
80
|
+
(`name`, `stores`), and `ReadModelSyntax.sink` and `GraphSyntax.sink` hold the chosen name; JSON
|
|
81
|
+
omits all three when empty, and older tools reject syntax JSON that carries them. `propose-rename`
|
|
82
|
+
on a sink renames its declaration and every directive naming it. Requires Screenplay 6.4.0
|
|
83
|
+
(`screenplay --version`). Syntax, examples and `PLAY0931`–`PLAY0939`: read surface
|
|
84
|
+
[sinks](../../cratis-screenplay-read-surface/references/sinks.md).
|
|
85
|
+
|
|
86
|
+
| Code | Severity | Meaning |
|
|
87
|
+
| --- | --- | --- |
|
|
88
|
+
| `PLAY0931` | Error | Malformed sink declaration or graph `sink` line |
|
|
89
|
+
| `PLAY0932` | Error | Duplicate sink name, ignoring case |
|
|
90
|
+
| `PLAY0933` | Error | A graph names an undeclared sink |
|
|
91
|
+
| `PLAY0934` | Error | The sink's kind does not match the read model or graph |
|
|
92
|
+
| `PLAY0935` | Error | A `passive` read model names a sink |
|
|
93
|
+
| `PLAY0936` | Error | Two different sinks on one read model or graph |
|
|
94
|
+
| `PLAY0937` | Warning | A repeated identical `sink` line |
|
|
95
|
+
| `PLAY0938` | Warning | A declared sink nothing uses |
|
|
96
|
+
| `PLAY0939` | Warning | A read-model property `sink` whose type differs only in case from a declared sink |
|
|
97
|
+
|
|
98
|
+
Each `sink` line is also reported as information `PLAY0270`: realization metadata outside the
|
|
99
|
+
executable model, so the ESM revision does not change with it.
|
|
100
|
+
|
|
74
101
|
Projections and captures use their dedicated sub-grammars. Inline code uses a
|
|
75
102
|
tagged fence (` ```csharp `); the older language-line form still parses with
|
|
76
103
|
warning `PLAY0397`. Query the MCP's `syntax-schema` instead of inventing JSON
|
|
@@ -68,12 +68,14 @@ the [MCP loop](mcp-loop.md).
|
|
|
68
68
|
| --- | --- | --- |
|
|
69
69
|
| Understanding | `describe-application`, `search-declarations`, `find-declaration`, `declaration-details` | Navigate logical hierarchy and inspect bounded details |
|
|
70
70
|
| References and examples | `find-references`, `dependencies`, `dependency-graph`, `find-fixtures`, `find-assertion-gaps`, `find-specification-obligations`, `find-modeling-smells`, `trace-lineage`, `semantic-diff` | Inspect declared relationships and authored examples, not executed coverage |
|
|
71
|
-
| Source and validation | `diagnostics`, `ui-profiles
|
|
71
|
+
| Source and validation | `diagnostics`, `ui-profiles` (also the design system, themes and resolved values per mode), `read-document`, `merged-document`, `syntax-schema` | Read exact source or typed structure and diagnose problems |
|
|
72
72
|
| Workspace inspection | `open-workspace`, `read-workspace`, `read-ast`, `workspace-state`, `export-workspace`, `repair-capabilities` | Obtain current identities, handles, readiness, code attachment requirements, source-map locations, durable-state status and the repair catalog |
|
|
73
73
|
| Visual (MCP-Apps hosts only) | `visualize-model` | Draw the board for the model or a `proposalId`; its `sketch` argument previews a what-if of whole documents. Reads only |
|
|
74
74
|
| Planning | `propose-source`, `propose-ast`, `propose-rename`, `propose-move`, `propose-repair`, `propose-property`, `propose-number-enum-members`, `propose-extract-inline-event`, `propose-inline-event`, `propose`, `recommend-layout`, `expand-layout` | Produce validated, reviewable candidates without writing them |
|
|
75
75
|
| Review | `read-proposal`, `discard-proposal` | Inspect exact changes, dropped comments and proposed attachments, or abandon a connection-local proposal |
|
|
76
76
|
| Reference execution | `run-specifications` | Run the workspace or a retained proposal candidate read-only; not attached code or target tests |
|
|
77
|
+
|
|
78
|
+
`propose-ast` node kinds for the design (Screenplay with design systems): `DesignSystemSyntax`, `DesignTokenCategorySyntax`, `DesignTokenSyntax`, `DesignComponentSyntax`, `DesignVariantSyntax`, `DesignStateSyntax`, `DesignAssignmentSyntax`, `DesignWordsSyntax`, `DesignContrastRuleSyntax`, `ThemeModeValuesSyntax`; `ThemeSyntax` gains `implements`, `palette`, `values` and `modeValues`. The tool count is unchanged: `ui-profiles` carries the read.
|
|
77
79
|
| Version migration | `migrate` | Read-only: report what `screenplay migrate --from <major> [--to <major>]` rewrites and, for a named `document`, its migrated source to write through a proposal (`cratis-screenplay-modeling-lifecycle`) |
|
|
78
80
|
| Effects | `apply`, `recover-workspace` | Apply an accepted plan or explicitly recover an interrupted write |
|
|
79
81
|
|
|
@@ -184,17 +184,29 @@ such outlet. The syntax and when to choose an outlet over a screen toolbar are i
|
|
|
184
184
|
|
|
185
185
|
### The profile's shell
|
|
186
186
|
|
|
187
|
-
`ui-profiles` (Screenplay 4.201.0 or later) reads each `ui profile`'s root template, shell options, appearance, new screens default and
|
|
187
|
+
`ui-profiles` (Screenplay 4.201.0 or later) reads each `ui profile`'s root template, shell options, appearance, theme (and `resolvedTheme`, the theme and mode it resolves to), new screens default and
|
|
188
188
|
shell diagnostics, and lists the own templates that could be the root template (`applicableRootTemplates`) or the new screens
|
|
189
189
|
default (`applicableNewScreenTemplates`); pick from those instead of guessing. Edit `RootTemplateSyntax` (`name`, `blueprint`,
|
|
190
190
|
`version`), `ShellOptionSyntax` (`add` to the root's `options`; `syntaxKind` is `Word`, `Text`, `Number` or `Flag`),
|
|
191
|
-
`ProfileAppearanceSyntax` (`colorScheme
|
|
191
|
+
`ProfileAppearanceSyntax` (`colorScheme`; `accent`, `corners` and `font` are deprecated, `PLAY0929`) and `NewScreenTemplateSyntax` with `propose-ast`. A refusal is the answer:
|
|
192
192
|
`PLAY0790` (a template nothing declares), `PLAY0792` (a blueprint the profile does not list), `PLAY0794` (a template that cannot
|
|
193
|
-
be the shell), `PLAY0795` (no `content` slot), `PLAY0797` (a bad color scheme
|
|
193
|
+
be the shell), `PLAY0795` (no `content` slot), `PLAY0797` (a bad color scheme or identity value), `PLAY0799` (a new screens default that
|
|
194
194
|
cannot start a screen). `PLAY0796` (an option the shell does not expose) and `PLAY0791` (the legacy `layout` line) are warnings:
|
|
195
195
|
the proposal is accepted and `ui-profiles` shows them. Replay against the `ui-profile-root-positive` vector and its rejection
|
|
196
196
|
vectors (`ui-profile-root-unknown`, `ui-profile-root-not-a-shell`, `ui-profile-root-invalid`) in `Cratis.Screenplay.CanonicalCorpus`.
|
|
197
197
|
|
|
198
|
+
### The design system and its themes
|
|
199
|
+
|
|
200
|
+
The same `ui-profiles` read (no new tool; the tool count is unchanged) also returns the application's `design system` (modes, tokens,
|
|
201
|
+
components, words, rules), every theme with its palette, values and per-mode values, each theme's resolved tokens and components per mode,
|
|
202
|
+
the design diagnostics `PLAY0916` to `PLAY0930` and the closed vocabulary of token categories, component parts and states: choose from
|
|
203
|
+
those, do not guess. Edit with `propose-ast` on `DesignSystemSyntax`, `DesignTokenCategorySyntax`, `DesignTokenSyntax`,
|
|
204
|
+
`DesignComponentSyntax`, `DesignVariantSyntax`, `DesignStateSyntax`, `DesignAssignmentSyntax`, `DesignWordsSyntax`,
|
|
205
|
+
`DesignContrastRuleSyntax` and `ThemeModeValuesSyntax`; `ThemeSyntax` gains `implements`, `palette`, `values` and `modeValues`. A refusal is
|
|
206
|
+
the answer (`PLAY0916` a malformed design, `PLAY0920` an undeclared token, `PLAY0921` a color token without a value in a mode,
|
|
207
|
+
`PLAY0925` or `PLAY0926` a theme that does not implement the design system); `PLAY0928` (contrast below a rule) and `PLAY0929`
|
|
208
|
+
(deprecated `appearance` member) are warnings. Grammar and examples: the ui-composition skill's `design-system-and-themes.md`.
|
|
209
|
+
|
|
198
210
|
Requires Screenplay 4.188.0 or later (`screenplay --version`) to `add` the first outlet, item or sub-item to a member
|
|
199
211
|
the node JSON omits while empty; an older MCP server answers "Unknown typed syntax member".
|
|
200
212
|
|
|
@@ -262,6 +262,9 @@
|
|
|
262
262
|
"kind": "skill-contains",
|
|
263
263
|
"value": "Both sides reload",
|
|
264
264
|
"file": "references/mcp-tools.md"
|
|
265
|
-
}
|
|
265
|
+
},
|
|
266
|
+
{ "kind": "skill-contains", "value": "`sink`, `module`, `seed`", "file": "references/language-reference.md" },
|
|
267
|
+
{ "kind": "skill-contains", "value": "| `PLAY0937` | Warning | A repeated identical `sink` line |", "file": "references/language-reference.md" },
|
|
268
|
+
{ "kind": "skill-contains", "value": "`ReadModelSyntax.sink` and `GraphSyntax.sink` hold the chosen name", "file": "references/language-reference.md" }
|
|
266
269
|
]
|
|
267
270
|
}
|
|
@@ -99,6 +99,10 @@ model's behalf.
|
|
|
99
99
|
Protection and reaction-privilege checks: [mode compliance](references/mode-compliance.md).
|
|
100
100
|
A client id, secret, authority, sender or mail server in a model is a critical finding: those
|
|
101
101
|
belong in the environment (`cratis-screenplay-authentication-and-onboarding`).
|
|
102
|
+
**Design system check** (when the model draws a UI): exactly one `design system` with a `default theme` (`PLAY0917`, `PLAY0927`);
|
|
103
|
+
every theme a profile selects `implements` it and gives each `color` token a value in every mode (`PLAY0926`, `PLAY0921`); no raw
|
|
104
|
+
`accent`, `corners` or `font` left in a profile's `appearance` (`PLAY0929`); `contrast` rules declared for the text/background pairs
|
|
105
|
+
components use, and no `PLAY0928` waived without a reason. Detail: `cratis-screenplay-ui-composition`.
|
|
102
106
|
12. **Root causes, classify, report** (`references/report-template.md`). Group findings that share
|
|
103
107
|
a declaration; report the root cause with its symptoms under it; severity critical, major or
|
|
104
108
|
minor; kind defect, question or note; verdict with confidence. Never apply changes.
|
|
@@ -187,7 +191,7 @@ Read [references/neighbouring-skills.md](references/neighbouring-skills.md) when
|
|
|
187
191
|
|
|
188
192
|
## References (load on demand)
|
|
189
193
|
- Review public leaks, direction, complete keys and effective routes with [public/key/route checks](references/public-keys-and-routes.md).
|
|
190
|
-
- Read `references/checklist.md` when performing the element sweep and phased audit; it contains eleven phases,
|
|
194
|
+
- Read `references/checklist.md` when performing the element sweep and phased audit; it contains eleven phases, 90 checks, tiers and evidence sources.
|
|
191
195
|
- Read `references/anti-patterns.md` when investigating an anti-pattern signal.
|
|
192
196
|
- Read `references/report-template.md` when classifying findings, deciding the verdict, writing the report or conducting a re-review.
|
|
193
197
|
- Read `references/worked-example.md` when an example of the sweep, lineage or report is needed, or when checking the complete examples: seeded model, filled report, fixed model.
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
- Phase 7. Rules and their layer (9 checks, E1-E9)
|
|
12
12
|
- Phase 8. Flow and lifecycle (13 checks, F1-F13)
|
|
13
13
|
- Phase 9. Personas, reach and authorization (8 checks, G1-G8)
|
|
14
|
-
- Phase 10. Views, queries and screens (
|
|
14
|
+
- Phase 10. Views, queries and screens (5 checks, H1-H5)
|
|
15
15
|
- Phase 11. Strategy checks (13 checks, R1-R13)
|
|
16
16
|
- Closing questions (3, Q1-Q3; each needs an answer in the report; a "no" is a finding)
|
|
17
17
|
|
|
18
|
-
Eleven phases,
|
|
18
|
+
Eleven phases, 90 checks and three closing questions. Each phase header says how many checks it holds; the report lists
|
|
19
19
|
every phase with its count and, per check, a status, the element and the evidence
|
|
20
20
|
(`report-template.md`). Each check names what to look at, the Screenplay evidence source and the
|
|
21
21
|
tier:
|
|
@@ -176,13 +176,14 @@ Nebulit (`provenance.md`).
|
|
|
176
176
|
| G7 | Every command and query under an inherited module/feature `authorize` has its own `then denied` spec; authorization shared by a feature is declared at feature/module level so new paths inherit it. `require anonymous` is flagged on anything the business did not name public; it must be the whole authorization, preferably in a separate public module, and is not the same as omitting `authorize` | policies, specs | D (major when it exposes another person's data) |
|
|
177
177
|
| G8 | Ownership/claim targets are a supported scalar (text, Uuid, Date or DateTime render; a numeric or Boolean target is always denied; other shapes and a command without exactly one identifier are STAGE-ESM-015): noted | policies | C (renderable mode) |
|
|
178
178
|
|
|
179
|
-
## Phase 10. Views, queries and screens (
|
|
179
|
+
## Phase 10. Views, queries and screens (5 checks, H1-H5)
|
|
180
180
|
| Id | Check | Evidence | Tier |
|
|
181
181
|
|---|---|---|---|
|
|
182
182
|
| H1 | Query shape follows the business view (list where people scan; lookup where they open one) | queries, screens | D |
|
|
183
183
|
| H2 | Executable scope: a keyed `=> RM optional` query with `by` named like a read-model property, or a collection (`=> RM[]`, observable too) with caller-supplied `by` and/or equality filters. `from`, single-result filters, opaque `scoped to` and a list-query `by` block remain PLAY0268; a `performer` query is an opaque read (PLAY0270) left out of the executable model ([version gate](../../cratis-screenplay-toolchain/references/executable-subset.md#code-attachments-what-binds-what-never-does)). A read model with several key parts binds as v27 (Requires Screenplay 4.204.0). The projection routes by the same identity (a `from` key or an event property, or `$eventSourceId`; `$eventSourceId` is not mandated). Filtered models: supported v14 equality filters render within the CLI bundle's ESM ceiling. Renderable scope only: Stage-specific identity/filter limits; keyed optional snapshot lookups and snapshot/observable collections render (Requires Stage 4.90.0 for snapshot lists; older renderers report `STAGE-ESM-010`). Check query concept-validation parity separately; primitive-argument targets answer absence instead of Validation | queries, projections | C (executable); C (render admission, renderable only) |
|
|
184
184
|
| H3 | One builder per read model; projection `key` only on `from` | projections | C |
|
|
185
185
|
| H4 | Screens show one actor's point of view; a form submits one command | screens, forms | D |
|
|
186
|
+
| H5 | Sinks: every declared `sink` is used by a read model or graph (`PLAY0938`), names differ ignoring case (`PLAY0932`), no `passive` read model names one (`PLAY0935`), and no read model's `sink <Type>` line is a property where the directive was meant (`PLAY0939`, or a type spelled exactly like no declared sink). The model names no database; a named sink needs a reason such as separate reporting storage ([sinks](../../cratis-screenplay-read-surface/references/sinks.md)) | `sink` declarations, read models, graphs | C (PLAY0932/0935); D (unused or unneeded sinks) |
|
|
186
187
|
|
|
187
188
|
## Phase 11. Strategy checks (13 checks, R1-R13)
|
|
188
189
|
The rejected anti-patterns of the Screenplay strategy, as review checks. They apply to the
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
{ "kind": "skill-contains", "value": "business-question" },
|
|
21
21
|
{ "kind": "skill-contains", "value": "find-modeling-smells" },
|
|
22
22
|
{ "kind": "skill-contains", "value": "entity walk" },
|
|
23
|
-
{ "kind": "skill-contains", "value": "eleven phases,
|
|
23
|
+
{ "kind": "skill-contains", "value": "eleven phases, 90 checks" },
|
|
24
24
|
{ "kind": "skill-contains", "value": "could a non-technical product owner read it and immediately understand" },
|
|
25
|
-
{ "kind": "skill-contains", "value": "a \"simple relay\" is not exempt from having pending work" }
|
|
25
|
+
{ "kind": "skill-contains", "value": "a \"simple relay\" is not exempt from having pending work" },
|
|
26
|
+
{ "kind": "skill-contains", "value": "| H5 | Sinks: every declared `sink` is used by a read model or graph (`PLAY0938`), names differ ignoring case (`PLAY0932`)", "file": "references/checklist.md" }
|
|
26
27
|
]
|
|
27
28
|
}
|
|
@@ -65,6 +65,10 @@ build a read model** — two builders is error `PLAY0191`: *a projection or a
|
|
|
65
65
|
reducer builds it, and only one of them*. A slice may still declare several
|
|
66
66
|
projections, each building a **different** read model.
|
|
67
67
|
|
|
68
|
+
**A builder never names a sink.** A projection or reducer writes to its read model's sink, and a
|
|
69
|
+
graph projection to its graph's sink; only the `readmodel` or `graph` body carries `sink <Name>`
|
|
70
|
+
(read surface [sinks](../cratis-screenplay-read-surface/references/sinks.md)).
|
|
71
|
+
|
|
68
72
|
## Public-event targets and observer filters
|
|
69
73
|
|
|
70
74
|
In an explicitly outbound Translate slice, `projection P => PublicEvent` or
|
|
@@ -248,7 +252,8 @@ Choose a graph for traversals (membership, nesting, paths) and a document read m
|
|
|
248
252
|
for lookups by key. Design by **reading the graph backwards**: write each question
|
|
249
253
|
as a path, make every hop an edge type and every stop a node label, then name the
|
|
250
254
|
event that creates and the one that removes each. Read
|
|
251
|
-
[references/graphs.md](references/graphs.md) for syntax, operations
|
|
255
|
+
[references/graphs.md](references/graphs.md) for syntax, operations, a graph in a named sink
|
|
256
|
+
(`sink People for graphs`) and `PLAY0862`–`PLAY0877`.
|
|
252
257
|
|
|
253
258
|
## When PDL is not enough — the reducer
|
|
254
259
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
- Declaring a graph
|
|
6
6
|
- Projecting events onto it
|
|
7
|
+
- Storing a graph in a named sink
|
|
7
8
|
- Reading the graph backwards
|
|
8
9
|
- The five operations
|
|
9
10
|
- What a graph projection cannot say
|
|
@@ -103,6 +104,61 @@ module Organization
|
|
|
103
104
|
edge before the events that create its nodes arrive. A projection owns the edges
|
|
104
105
|
and node properties it declares and never deletes a node it did not declare.
|
|
105
106
|
|
|
107
|
+
## Storing a graph in a named sink
|
|
108
|
+
|
|
109
|
+
A graph names no sink by default and is stored in the application's default graph sink. To keep one
|
|
110
|
+
graph apart from another, declare a sink `for graphs` at the application root and put a bare
|
|
111
|
+
`sink <Name>` line in the graph body. The projection never names a sink: it writes to its graph's
|
|
112
|
+
sink. Requires Screenplay 6.4.0 (`screenplay --version`).
|
|
113
|
+
|
|
114
|
+
```screenplay
|
|
115
|
+
sink People for graphs
|
|
116
|
+
|
|
117
|
+
concept PersonId : Uuid
|
|
118
|
+
concept GroupId : Uuid
|
|
119
|
+
concept PersonName : String
|
|
120
|
+
|
|
121
|
+
module Organization
|
|
122
|
+
feature Chart
|
|
123
|
+
slice StateView OrganizationChart
|
|
124
|
+
event PersonRegistered
|
|
125
|
+
name PersonName
|
|
126
|
+
|
|
127
|
+
event GroupCreated
|
|
128
|
+
name String
|
|
129
|
+
|
|
130
|
+
event MemberAdded
|
|
131
|
+
groupId GroupId
|
|
132
|
+
|
|
133
|
+
graph Organization
|
|
134
|
+
sink People
|
|
135
|
+
node Person
|
|
136
|
+
personId PersonId key
|
|
137
|
+
name PersonName
|
|
138
|
+
node Group
|
|
139
|
+
groupId GroupId key
|
|
140
|
+
name String
|
|
141
|
+
edge MEMBER_OF source Person target Group
|
|
142
|
+
since DateTime
|
|
143
|
+
|
|
144
|
+
projection OrganizationChart => graph Organization
|
|
145
|
+
node Person
|
|
146
|
+
from PersonRegistered key $eventSourceId
|
|
147
|
+
name = name
|
|
148
|
+
node Group
|
|
149
|
+
from GroupCreated key $eventSourceId
|
|
150
|
+
name = name
|
|
151
|
+
edge MEMBER_OF
|
|
152
|
+
from MemberAdded source $eventSourceId target groupId
|
|
153
|
+
since = $eventContext.occurred
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
A graph body has no properties of its own, so every `sink` line in it is the directive: an
|
|
157
|
+
undeclared name is `PLAY0933`, and a sink declared `for readmodels` is `PLAY0934`. The model never
|
|
158
|
+
names a Neo4j server or database; the deployment maps `People` to one. The read-model side and the
|
|
159
|
+
full `PLAY0931`–`PLAY0939` table are in the read surface's
|
|
160
|
+
[sinks](../../cratis-screenplay-read-surface/references/sinks.md).
|
|
161
|
+
|
|
106
162
|
## Reading the graph backwards
|
|
107
163
|
|
|
108
164
|
1. List the questions the graph must answer ("who is in this group, including nested groups?").
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
{ "kind": "skill-contains", "value": "The key is **always the event source id**" },
|
|
29
29
|
{ "kind": "skill-contains", "value": "**A join never creates an" },
|
|
30
30
|
{ "kind": "skill-contains", "value": "Inline code uses a tagged fence" },
|
|
31
|
-
{ "kind": "skill-contains", "value": "PLAY0690", "file": "references/reducer-identity.md" }
|
|
31
|
+
{ "kind": "skill-contains", "value": "PLAY0690", "file": "references/reducer-identity.md" },
|
|
32
|
+
{ "kind": "skill-contains", "value": "**A builder never names a sink.**" },
|
|
33
|
+
{ "kind": "skill-contains", "value": "sink People for graphs", "file": "references/graphs.md" },
|
|
34
|
+
{ "kind": "skill-contains", "value": "every `sink` line in it is the directive", "file": "references/graphs.md" }
|
|
32
35
|
]
|
|
33
36
|
}
|