create-githolon 0.100.6 → 0.101.1
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 +1 -1
- package/template/README.md +7 -11
- package/template/domains/todo.ts +5 -12
- package/template/package.json +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-githolon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.101.1",
|
|
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",
|
package/template/README.md
CHANGED
|
@@ -12,19 +12,12 @@ The starter in [`domains/todo.ts`](domains/todo.ts) gives a todo list its own du
|
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
14
|
export const TodoList = aggregate("TodoList", {
|
|
15
|
-
reference: t.string().
|
|
16
|
-
title: t.string().
|
|
15
|
+
reference: t.string({ nonempty: true }).fromBirth(),
|
|
16
|
+
title: t.string({ nonempty: true }).fromBirth(),
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
export const todoList = birth(TodoList, {
|
|
20
|
-
|
|
21
|
-
reference: z.string().min(1),
|
|
22
|
-
title: z.string().min(1),
|
|
23
|
-
}),
|
|
24
|
-
key: (facts) => facts.reference,
|
|
25
|
-
plan: (list, facts) => list
|
|
26
|
-
.set("reference", facts.reference)
|
|
27
|
-
.set("title", facts.title),
|
|
20
|
+
key: "reference",
|
|
28
21
|
});
|
|
29
22
|
```
|
|
30
23
|
|
|
@@ -51,7 +44,10 @@ npx githolon proof
|
|
|
51
44
|
|
|
52
45
|
`compile` emits the law, typed client, and a proof generated from this domain. `proof` drives the real engine locally, births the list, discards its resident copy, restores it from durable custody, verifies the full history again, and reads the business root back.
|
|
53
46
|
|
|
54
|
-
Make it yours by renaming `TodoList
|
|
47
|
+
Make it yours by renaming `TodoList` and changing its fields. `.fromBirth()` means the fact is required to
|
|
48
|
+
begin that durable life; its field rule is also the birth validation and generated input type. Nomos derives
|
|
49
|
+
the initial write. Keep the rule: application code supplies business facts; Nomos owns the machinery that
|
|
50
|
+
makes those facts durable and trustworthy.
|
|
55
51
|
|
|
56
52
|
Useful files:
|
|
57
53
|
|
package/template/domains/todo.ts
CHANGED
|
@@ -4,22 +4,15 @@
|
|
|
4
4
|
* The app supplies business facts. Nomos gives the aggregate a durable life and owns identity,
|
|
5
5
|
* authorship, local execution, synchronisation, persistence, provenance, and recovery beneath it.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
7
|
+
import { aggregate, birth, t } from "@githolon/dsl";
|
|
8
8
|
|
|
9
9
|
export const TodoList = aggregate("TodoList", {
|
|
10
10
|
/** A stable business key the caller already knows. */
|
|
11
|
-
reference: t.string().
|
|
12
|
-
title: t.string().
|
|
13
|
-
});
|
|
11
|
+
reference: t.string({ nonempty: true }).fromBirth(),
|
|
12
|
+
title: t.string({ nonempty: true }).fromBirth(),
|
|
13
|
+
}).owned();
|
|
14
14
|
|
|
15
15
|
/** The one public creation idea: give a todo list its own durable life. */
|
|
16
16
|
export const todoList = birth(TodoList, {
|
|
17
|
-
|
|
18
|
-
reference: z.string().min(1),
|
|
19
|
-
title: z.string().min(1),
|
|
20
|
-
}),
|
|
21
|
-
key: (facts) => facts.reference,
|
|
22
|
-
plan: (list, facts) => list
|
|
23
|
-
.set("reference", facts.reference)
|
|
24
|
-
.set("title", facts.title),
|
|
17
|
+
key: "reference",
|
|
25
18
|
});
|
package/template/package.json
CHANGED