create-githolon 0.65.1 → 0.66.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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffold a Nomos domain package: the starter domain + compile config + live e2e. `npm create githolon my-app`.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -119,6 +119,41 @@ as an aggregate. A `z.enum` field generates a REAL Dart enum
|
|
|
119
119
|
decode: a wire value this client's law snapshot doesn't know decodes to the
|
|
120
120
|
`unknownWire` sentinel — law can add enum values without crashing old clients.
|
|
121
121
|
|
|
122
|
+
## Contracts: public DTOs for cross-domain references
|
|
123
|
+
|
|
124
|
+
When one domain references another's aggregate, reference a **contract** — a named
|
|
125
|
+
public shape (a DTO) — not the concrete aggregate. This keeps domains from importing
|
|
126
|
+
each other's private types (which tangles the package graph). A contract is fields,
|
|
127
|
+
no behavior:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
// contracts.ts — the shared public shapes
|
|
131
|
+
export const CatalogueListingContract = contract("CatalogueListing", {
|
|
132
|
+
listingId: t.string(),
|
|
133
|
+
name: t.string(),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// catalogue.ts — the concrete owner declares it satisfies the shape (compile-checked;
|
|
137
|
+
// a missing/mismatched field fails the build naming it). Private fields stay private.
|
|
138
|
+
export const CatalogueListing = aggregate("CatalogueListing", {
|
|
139
|
+
listingId: t.string().merge(Lww),
|
|
140
|
+
name: t.string().merge(Lww),
|
|
141
|
+
internalNotes: t.string().merge(Lww), // not in the contract — behind the boundary
|
|
142
|
+
}).implements(CatalogueListingContract);
|
|
143
|
+
|
|
144
|
+
// estate.ts — reference the CONTRACT, never the concrete aggregate
|
|
145
|
+
export const EstateAsset = aggregate("EstateAsset", {
|
|
146
|
+
catalogueWorkspaceName: t.string().merge(Lww),
|
|
147
|
+
listing: t.foreignRef({ workspace: "catalogueWorkspaceName", target: CatalogueListingContract, domain: "catalogue" }),
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The generated client types the reference as `ForeignRef<CatalogueListingContract>`;
|
|
152
|
+
the Dart DTO class lives in a shared `contracts.dart` every domain imports, so `estate`
|
|
153
|
+
never imports `catalogue`'s implementation. If two domains ever import each other's
|
|
154
|
+
concrete types, the compiler fails with a cycle diagnostic pointing you here. Contracts
|
|
155
|
+
are pure typing metadata — they never change an aggregate's law hash.
|
|
156
|
+
|
|
122
157
|
## Merge drivers ARE the conflict policy
|
|
123
158
|
|
|
124
159
|
| driver | concurrent writes to the same field… |
|