@metaobjectsdev/codegen-ts 1.0.3 → 1.0.4-rc.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/dist/catalog-gates.d.ts +52 -0
- package/dist/catalog-gates.d.ts.map +1 -0
- package/dist/catalog-gates.js +183 -0
- package/dist/catalog-gates.js.map +1 -0
- package/dist/constants.d.ts +24 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +26 -0
- package/dist/constants.js.map +1 -1
- package/dist/generator-registry.d.ts +73 -0
- package/dist/generator-registry.d.ts.map +1 -1
- package/dist/generator-registry.js +174 -40
- package/dist/generator-registry.js.map +1 -1
- package/dist/generator.d.ts +17 -0
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js.map +1 -1
- package/dist/generators/trace-helper-file.d.ts.map +1 -1
- package/dist/generators/trace-helper-file.js +54 -11
- package/dist/generators/trace-helper-file.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/metaobjects-config.d.ts +0 -15
- package/dist/metaobjects-config.d.ts.map +1 -1
- package/dist/metaobjects-config.js.map +1 -1
- package/dist/projection/extract-view-spec.d.ts.map +1 -1
- package/dist/projection/extract-view-spec.js +111 -4
- package/dist/projection/extract-view-spec.js.map +1 -1
- package/dist/relation-resolver.d.ts.map +1 -1
- package/dist/relation-resolver.js +11 -9
- package/dist/relation-resolver.js.map +1 -1
- package/dist/routes-expose.d.ts +30 -0
- package/dist/routes-expose.d.ts.map +1 -1
- package/dist/routes-expose.js +46 -0
- package/dist/routes-expose.js.map +1 -1
- package/dist/runner.d.ts +20 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +23 -0
- package/dist/runner.js.map +1 -1
- package/dist/templates/entity-file.js +2 -2
- package/dist/templates/entity-file.js.map +1 -1
- package/dist/templates/queries-file.js +5 -5
- package/dist/templates/queries-file.js.map +1 -1
- package/dist/templates/routes-file-hono.d.ts.map +1 -1
- package/dist/templates/routes-file-hono.js +10 -3
- package/dist/templates/routes-file-hono.js.map +1 -1
- package/dist/templates/routes-file.d.ts.map +1 -1
- package/dist/templates/routes-file.js +21 -4
- package/dist/templates/routes-file.js.map +1 -1
- package/dist/templates/value-object-file.js +2 -2
- package/dist/templates/value-object-file.js.map +1 -1
- package/package.json +6 -6
- package/src/catalog-gates.ts +222 -0
- package/src/constants.ts +27 -0
- package/src/generator-registry.ts +245 -44
- package/src/generator.ts +17 -0
- package/src/generators/trace-helper-file.ts +55 -12
- package/src/index.ts +17 -3
- package/src/metaobjects-config.ts +0 -15
- package/src/projection/extract-view-spec.ts +126 -5
- package/src/reference/entity.ts +2 -2
- package/src/reference/queries.ts +2 -2
- package/src/relation-resolver.ts +14 -8
- package/src/routes-expose.ts +57 -0
- package/src/runner.ts +49 -0
- package/src/templates/entity-file.ts +2 -2
- package/src/templates/queries-file.ts +5 -5
- package/src/templates/routes-file-hono.ts +10 -3
- package/src/templates/routes-file.ts +21 -4
- package/src/templates/value-object-file.ts +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Generator } from "./generator.js";
|
|
2
|
+
import type { GeneratorRegistryEntry } from "./generator-registry.js";
|
|
3
|
+
export declare function stableNameIndex(catalog: Record<string, GeneratorRegistryEntry>): ReadonlyMap<string, string>;
|
|
4
|
+
/**
|
|
5
|
+
* Warn for each wired generator whose `requires` are not also wired.
|
|
6
|
+
*
|
|
7
|
+
* A generator whose name resolves to no catalog entry is an owned or third-party one
|
|
8
|
+
* with nothing declared, and is skipped in silence — there is no declaration to check
|
|
9
|
+
* it against.
|
|
10
|
+
*/
|
|
11
|
+
export declare function warnUnsatisfiedRequires(generators: readonly Generator[], catalog: Record<string, GeneratorRegistryEntry>, warn: (message: string) => void): void;
|
|
12
|
+
/**
|
|
13
|
+
* Warn when two wired `api`-layer generators declare DIFFERENT frameworks.
|
|
14
|
+
*
|
|
15
|
+
* Verified before it was written: `routes` emits `<Entity>.routes.ts` and `routes-hono`
|
|
16
|
+
* emits `<Entity>.routes.hono.ts`. Different paths — so wiring both does not trip the
|
|
17
|
+
* runner's conflicting-output-path error, does not fail `tsc`, and silently produces two
|
|
18
|
+
* complete HTTP surfaces over the same entities. Worth saying; not worth refusing.
|
|
19
|
+
*
|
|
20
|
+
* **`api` only, and there is deliberately no general per-layer rule.** The `client`
|
|
21
|
+
* layer disproves one: `@metaobjectsdev/tanstack` declares `react` as a peer, so
|
|
22
|
+
* `form` (react) + `hooks`/`grid` (tanstack) is the documented, normal composition. An
|
|
23
|
+
* earlier draft of the design carried "at most one framework per api and per client
|
|
24
|
+
* layer"; that rule would have forbidden the single most common client selection.
|
|
25
|
+
*/
|
|
26
|
+
export declare function warnMixedApiFrameworks(generators: readonly Generator[], catalog: Record<string, GeneratorRegistryEntry>, warn: (message: string) => void): void;
|
|
27
|
+
/**
|
|
28
|
+
* Warn on the two halves of a library/generator selection that do not agree.
|
|
29
|
+
*
|
|
30
|
+
* A library ships metadata; a generator that keys on that metadata is a separate
|
|
31
|
+
* choice, and FR-043 §6 deliberately wires neither for you. What it does instead is
|
|
32
|
+
* refuse to let either half be silently half-done:
|
|
33
|
+
*
|
|
34
|
+
* - **opted in, not wired** — the design is in your model and the code it implies is
|
|
35
|
+
* not being generated.
|
|
36
|
+
* - **wired, not opted in** — the generator's anchor is a node only that library
|
|
37
|
+
* declares, so it will match nothing and emit zero files. Without this line that is
|
|
38
|
+
* indistinguishable from "my model has no trace entities yet".
|
|
39
|
+
*
|
|
40
|
+
* Both self-extinguish: wire it, or opt in, or remove one. Neither ever fails a build —
|
|
41
|
+
* an adopter who ejected the library and owns the metadata is in a legitimate state
|
|
42
|
+
* this cannot see, and a gate that cries wolf gets switched off.
|
|
43
|
+
*
|
|
44
|
+
* `optedIn` is the project's selection TOKENS (`["ai", "ai/db"]`); a layer token names
|
|
45
|
+
* the same library as its bare form.
|
|
46
|
+
*/
|
|
47
|
+
export declare function warnLibrarySelectionMismatch(generators: readonly Generator[], catalog: Record<string, GeneratorRegistryEntry>, manifests: Readonly<Record<string, {
|
|
48
|
+
generators?: ReadonlyArray<{
|
|
49
|
+
name: string;
|
|
50
|
+
}>;
|
|
51
|
+
}>>, optedIn: readonly string[], warn: (message: string) => void): void;
|
|
52
|
+
//# sourceMappingURL=catalog-gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-gates.d.ts","sourceRoot":"","sources":["../src/catalog-gates.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAqBtE,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,GAC9C,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB7B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC/C,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAsBN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC/C,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAyBN;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,EAC/C,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAAC,EACrF,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAwCN"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// The post-selection audits `meta gen` runs over the wired suite.
|
|
2
|
+
//
|
|
3
|
+
// Codegen is opt-in, so the selection is the adopter's (increasingly their agent's).
|
|
4
|
+
// That makes `meta gen` the place the selection is CHECKED — not by refusing it, but by
|
|
5
|
+
// naming the ways a legal selection still surprises you:
|
|
6
|
+
//
|
|
7
|
+
// 1. a generator whose output imports a module nothing in the run emits;
|
|
8
|
+
// 2. two `api`-layer generators bringing two different HTTP frameworks;
|
|
9
|
+
// 3. (FR-043) a library opted into whose implied generator is not wired, or a
|
|
10
|
+
// generator wired whose library is not opted into — the two halves of one choice.
|
|
11
|
+
//
|
|
12
|
+
// Both are WARNINGS, self-extinguishing, never a build failure. An adopter may
|
|
13
|
+
// legitimately have hand-written the other half, and serving Node and edge from one
|
|
14
|
+
// model is a real thing people do. Following the house rule: a gate that cries wolf
|
|
15
|
+
// gets deleted, and a gate nobody can satisfy is worse than no gate.
|
|
16
|
+
/**
|
|
17
|
+
* Map a CONSTRUCTED generator back to its catalog stable name.
|
|
18
|
+
*
|
|
19
|
+
* These are two different names and conflating them is the trap here: the catalog key
|
|
20
|
+
* is `routes` / `grid-hook`, while the object a factory returns calls itself
|
|
21
|
+
* `routes-file` / `tanstack-grid-hook`. A gate keyed on `g.name` therefore matches
|
|
22
|
+
* nothing at all — silently, since a name the catalog does not know is legitimately
|
|
23
|
+
* skipped as somebody's own generator.
|
|
24
|
+
*
|
|
25
|
+
* DERIVED by constructing every catalog factory and reading the name back, not kept as
|
|
26
|
+
* a table: a table would be a third spelling to maintain, and the failure mode of it
|
|
27
|
+
* going stale is exactly the silent no-op above. The factories are trivial (that is a
|
|
28
|
+
* registry invariant `--list` already depends on), and the result is memoized per
|
|
29
|
+
* catalog object.
|
|
30
|
+
*
|
|
31
|
+
* An implementation name produced by two entries is dropped rather than guessed at.
|
|
32
|
+
*/
|
|
33
|
+
const STABLE_NAME_CACHE = new WeakMap();
|
|
34
|
+
export function stableNameIndex(catalog) {
|
|
35
|
+
const cached = STABLE_NAME_CACHE.get(catalog);
|
|
36
|
+
if (cached !== undefined)
|
|
37
|
+
return cached;
|
|
38
|
+
const index = new Map();
|
|
39
|
+
const ambiguous = new Set();
|
|
40
|
+
for (const [stable, entry] of Object.entries(catalog)) {
|
|
41
|
+
let implName;
|
|
42
|
+
try {
|
|
43
|
+
implName = entry.factory().name;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
continue; // a factory that cannot construct contributes nothing
|
|
47
|
+
}
|
|
48
|
+
if (index.has(implName) && index.get(implName) !== stable)
|
|
49
|
+
ambiguous.add(implName);
|
|
50
|
+
index.set(implName, stable);
|
|
51
|
+
// The stable name maps to itself too, so a generator that already calls itself by
|
|
52
|
+
// its stable name (and an ejected copy that renamed itself to one) still resolves.
|
|
53
|
+
if (!index.has(stable))
|
|
54
|
+
index.set(stable, stable);
|
|
55
|
+
}
|
|
56
|
+
for (const name of ambiguous)
|
|
57
|
+
index.delete(name);
|
|
58
|
+
STABLE_NAME_CACHE.set(catalog, index);
|
|
59
|
+
return index;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Warn for each wired generator whose `requires` are not also wired.
|
|
63
|
+
*
|
|
64
|
+
* A generator whose name resolves to no catalog entry is an owned or third-party one
|
|
65
|
+
* with nothing declared, and is skipped in silence — there is no declaration to check
|
|
66
|
+
* it against.
|
|
67
|
+
*/
|
|
68
|
+
export function warnUnsatisfiedRequires(generators, catalog, warn) {
|
|
69
|
+
const index = stableNameIndex(catalog);
|
|
70
|
+
const stableOf = (g) => index.get(g.name);
|
|
71
|
+
const wired = new Set(generators.map(stableOf).filter((n) => n !== undefined));
|
|
72
|
+
for (const g of generators) {
|
|
73
|
+
const stable = stableOf(g);
|
|
74
|
+
if (stable === undefined)
|
|
75
|
+
continue;
|
|
76
|
+
const entry = catalog[stable];
|
|
77
|
+
if (entry?.requires === undefined)
|
|
78
|
+
continue;
|
|
79
|
+
const missing = entry.requires.filter((dep) => !wired.has(dep));
|
|
80
|
+
if (missing.length === 0)
|
|
81
|
+
continue;
|
|
82
|
+
const list = missing.map((m) => `"${m}"`).join(", ");
|
|
83
|
+
warn(`"${stable}" is wired but ${list} ${missing.length === 1 ? "is" : "are"} not. ` +
|
|
84
|
+
`The code "${stable}" emits imports modules ${list} would have emitted, so ` +
|
|
85
|
+
`tsc will report an unresolved import. Wire ${missing.length === 1 ? "it" : "them"} ` +
|
|
86
|
+
`(\`meta eject ${missing.join(" ")}\` copies the reference generator${missing.length === 1 ? "" : "s"}), ` +
|
|
87
|
+
`or keep your own hand-written module${missing.length === 1 ? "" : "s"} at ${missing.length === 1 ? "that path" : "those paths"}.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Warn when two wired `api`-layer generators declare DIFFERENT frameworks.
|
|
92
|
+
*
|
|
93
|
+
* Verified before it was written: `routes` emits `<Entity>.routes.ts` and `routes-hono`
|
|
94
|
+
* emits `<Entity>.routes.hono.ts`. Different paths — so wiring both does not trip the
|
|
95
|
+
* runner's conflicting-output-path error, does not fail `tsc`, and silently produces two
|
|
96
|
+
* complete HTTP surfaces over the same entities. Worth saying; not worth refusing.
|
|
97
|
+
*
|
|
98
|
+
* **`api` only, and there is deliberately no general per-layer rule.** The `client`
|
|
99
|
+
* layer disproves one: `@metaobjectsdev/tanstack` declares `react` as a peer, so
|
|
100
|
+
* `form` (react) + `hooks`/`grid` (tanstack) is the documented, normal composition. An
|
|
101
|
+
* earlier draft of the design carried "at most one framework per api and per client
|
|
102
|
+
* layer"; that rule would have forbidden the single most common client selection.
|
|
103
|
+
*/
|
|
104
|
+
export function warnMixedApiFrameworks(generators, catalog, warn) {
|
|
105
|
+
const index = stableNameIndex(catalog);
|
|
106
|
+
const byFramework = new Map();
|
|
107
|
+
for (const g of generators) {
|
|
108
|
+
const stable = index.get(g.name);
|
|
109
|
+
if (stable === undefined)
|
|
110
|
+
continue;
|
|
111
|
+
const entry = catalog[stable];
|
|
112
|
+
if (entry?.layer !== "api" || entry.framework === undefined)
|
|
113
|
+
continue;
|
|
114
|
+
const names = byFramework.get(entry.framework) ?? [];
|
|
115
|
+
names.push(stable);
|
|
116
|
+
byFramework.set(entry.framework, names);
|
|
117
|
+
}
|
|
118
|
+
if (byFramework.size < 2)
|
|
119
|
+
return;
|
|
120
|
+
const described = [...byFramework.entries()]
|
|
121
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
122
|
+
.map(([fw, names]) => `${names.sort().map((n) => `"${n}"`).join(" + ")} (${fw})`)
|
|
123
|
+
.join(" and ");
|
|
124
|
+
warn(`two api-layer frameworks are wired — ${described}. They emit to DIFFERENT paths, ` +
|
|
125
|
+
"so nothing conflicts and nothing fails; this run produces two complete HTTP " +
|
|
126
|
+
"surfaces over the same entities. That is legitimate when you are migrating " +
|
|
127
|
+
"between them or serving Node and edge from one model — otherwise wire one.");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Warn on the two halves of a library/generator selection that do not agree.
|
|
131
|
+
*
|
|
132
|
+
* A library ships metadata; a generator that keys on that metadata is a separate
|
|
133
|
+
* choice, and FR-043 §6 deliberately wires neither for you. What it does instead is
|
|
134
|
+
* refuse to let either half be silently half-done:
|
|
135
|
+
*
|
|
136
|
+
* - **opted in, not wired** — the design is in your model and the code it implies is
|
|
137
|
+
* not being generated.
|
|
138
|
+
* - **wired, not opted in** — the generator's anchor is a node only that library
|
|
139
|
+
* declares, so it will match nothing and emit zero files. Without this line that is
|
|
140
|
+
* indistinguishable from "my model has no trace entities yet".
|
|
141
|
+
*
|
|
142
|
+
* Both self-extinguish: wire it, or opt in, or remove one. Neither ever fails a build —
|
|
143
|
+
* an adopter who ejected the library and owns the metadata is in a legitimate state
|
|
144
|
+
* this cannot see, and a gate that cries wolf gets switched off.
|
|
145
|
+
*
|
|
146
|
+
* `optedIn` is the project's selection TOKENS (`["ai", "ai/db"]`); a layer token names
|
|
147
|
+
* the same library as its bare form.
|
|
148
|
+
*/
|
|
149
|
+
export function warnLibrarySelectionMismatch(generators, catalog, manifests, optedIn, warn) {
|
|
150
|
+
const index = stableNameIndex(catalog);
|
|
151
|
+
const wired = new Set(generators.map((g) => index.get(g.name)).filter((n) => n !== undefined));
|
|
152
|
+
const selected = new Set(optedIn.map((t) => t.split("/")[0]));
|
|
153
|
+
for (const [library, manifest] of Object.entries(manifests)) {
|
|
154
|
+
const implied = (manifest.generators ?? []).map((g) => g.name);
|
|
155
|
+
if (implied.length === 0)
|
|
156
|
+
continue;
|
|
157
|
+
if (selected.has(library)) {
|
|
158
|
+
const notWired = implied.filter((n) => !wired.has(n));
|
|
159
|
+
if (notWired.length > 0) {
|
|
160
|
+
warn(`library "${library}" is opted in and implies ${notWired.map((n) => `"${n}"`).join(", ")}, ` +
|
|
161
|
+
`which ${notWired.length === 1 ? "is" : "are"} not wired. The design is in your model; ` +
|
|
162
|
+
`the code it implies is not being generated. Wire it, or ignore this if you are ` +
|
|
163
|
+
`taking the metadata alone.`);
|
|
164
|
+
}
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
// Not opted in: name any of its generators that ARE wired. Checked per library
|
|
168
|
+
// rather than per generator so a name two libraries imply is not reported twice
|
|
169
|
+
// when one of them is selected.
|
|
170
|
+
const orphaned = implied.filter((n) => wired.has(n) && !impliedByAnySelected(n, manifests, selected));
|
|
171
|
+
if (orphaned.length > 0) {
|
|
172
|
+
warn(`${orphaned.map((n) => `"${n}"`).join(", ")} ${orphaned.length === 1 ? "is" : "are"} wired, ` +
|
|
173
|
+
`but library "${library}" — which declares the node ${orphaned.length === 1 ? "it keys" : "they key"} ` +
|
|
174
|
+
`on — is not opted in, so ${orphaned.length === 1 ? "it will" : "they will"} match nothing and emit ` +
|
|
175
|
+
`no files. Add "${library}" to \`libraries\` in .metaobjects/config.json, or unwire ` +
|
|
176
|
+
`${orphaned.length === 1 ? "it" : "them"}.`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function impliedByAnySelected(generator, manifests, selected) {
|
|
181
|
+
return [...selected].some((lib) => (manifests[lib]?.generators ?? []).some((g) => g.name === generator));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=catalog-gates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog-gates.js","sourceRoot":"","sources":["../src/catalog-gates.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,qFAAqF;AACrF,wFAAwF;AACxF,yDAAyD;AACzD,EAAE;AACF,2EAA2E;AAC3E,0EAA0E;AAC1E,gFAAgF;AAChF,uFAAuF;AACvF,EAAE;AACF,+EAA+E;AAC/E,oFAAoF;AACpF,oFAAoF;AACpF,qEAAqE;AAKrE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAAuC,CAAC;AAE7E,MAAM,UAAU,eAAe,CAC7B,OAA+C;IAE/C,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAExC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IACpC,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACtD,IAAI,QAAgB,CAAC;QACrB,IAAI,CAAC;YACH,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QACl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ChC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CACrE,CAAC;AACJ,CAAC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -24,6 +24,30 @@ export declare const GENERATED_HEADER = "@generated by @metaobjectsdev/codegen-t
|
|
|
24
24
|
* finding the artifact it exists to protect, silently.
|
|
25
25
|
*/
|
|
26
26
|
export declare const NAMES_FILE_SUFFIX = ".names.ts";
|
|
27
|
+
/**
|
|
28
|
+
* Line 3 of every generated file's header — where an adopter's own code goes.
|
|
29
|
+
*
|
|
30
|
+
* It used to read `Customize via <Name>.extra.ts in this directory`, and on the routes
|
|
31
|
+
* emitters `(e.g., auth, additional handlers)`. Both asserted a plugin point this engine
|
|
32
|
+
* does not have — the same claim `EXTRA_SUFFIX` was deleted above for implying. The
|
|
33
|
+
* convention is real and documented (`docs/features/own-your-codegen.md`): a sibling file
|
|
34
|
+
* is safe because `meta gen` writes only the paths it records, and the barrel is built
|
|
35
|
+
* from the model so it never re-exports one. What is NOT real is anything importing it
|
|
36
|
+
* for you, and "Customize via" is exactly the verb that promises otherwise.
|
|
37
|
+
*
|
|
38
|
+
* #367 is the measured cost: an agent building a real API read `(e.g., auth)` on a routes
|
|
39
|
+
* file, went looking for the seam, found none, and deleted `routesFile()` from its config
|
|
40
|
+
* rather than mount five unauthenticated endpoints over a password-hash table. The auth
|
|
41
|
+
* seam it needed exists — a parent plugin scope's `preHandler` (Fastify) or `app.use`
|
|
42
|
+
* (Hono) — and the routes emitters now say so in the handler's own JSDoc, gated by
|
|
43
|
+
* `runtime-ts/test/route-auth-seam.test.ts`.
|
|
44
|
+
*
|
|
45
|
+
* Spelled once because the literal had been copy-pasted to ten TypeScript emitters plus
|
|
46
|
+
* Python's `generated_header`, which is how one wrong sentence reached every generated
|
|
47
|
+
* file in the estate. `sidecarName` is the emitted module name, extension included
|
|
48
|
+
* (`Order.extra.ts`, `OrderForm.extra.tsx`).
|
|
49
|
+
*/
|
|
50
|
+
export declare function sidecarLine(sidecarName: string): string;
|
|
27
51
|
/** Default outDir used by tests + as a sane default for generate(). */
|
|
28
52
|
export declare const DEFAULT_OUT_DIR = "./src/db/entities";
|
|
29
53
|
/** One retired codegen-control attribute, paired with what an adopter does instead. */
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,6CAA6C,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAU7C,uEAAuE;AACvE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AA8BnD,uFAAuF;AACvF,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAmCrD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,6CAA6C,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAU7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,uEAAuE;AACvE,eAAO,MAAM,eAAe,sBAAsB,CAAC;AA8BnD,uFAAuF;AACvF,MAAM,WAAW,kBAAkB;IACjC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,SAAS,kBAAkB,EAmCrD,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -32,6 +32,32 @@ export const NAMES_FILE_SUFFIX = ".names.ts";
|
|
|
32
32
|
// records in `.gen-state/.hashes.json` — not because of its name — and the generated
|
|
33
33
|
// barrel is built from the model, so it does not re-export it. Say that in prose;
|
|
34
34
|
// do not re-add a constant that suggests the engine knows the name.
|
|
35
|
+
/**
|
|
36
|
+
* Line 3 of every generated file's header — where an adopter's own code goes.
|
|
37
|
+
*
|
|
38
|
+
* It used to read `Customize via <Name>.extra.ts in this directory`, and on the routes
|
|
39
|
+
* emitters `(e.g., auth, additional handlers)`. Both asserted a plugin point this engine
|
|
40
|
+
* does not have — the same claim `EXTRA_SUFFIX` was deleted above for implying. The
|
|
41
|
+
* convention is real and documented (`docs/features/own-your-codegen.md`): a sibling file
|
|
42
|
+
* is safe because `meta gen` writes only the paths it records, and the barrel is built
|
|
43
|
+
* from the model so it never re-exports one. What is NOT real is anything importing it
|
|
44
|
+
* for you, and "Customize via" is exactly the verb that promises otherwise.
|
|
45
|
+
*
|
|
46
|
+
* #367 is the measured cost: an agent building a real API read `(e.g., auth)` on a routes
|
|
47
|
+
* file, went looking for the seam, found none, and deleted `routesFile()` from its config
|
|
48
|
+
* rather than mount five unauthenticated endpoints over a password-hash table. The auth
|
|
49
|
+
* seam it needed exists — a parent plugin scope's `preHandler` (Fastify) or `app.use`
|
|
50
|
+
* (Hono) — and the routes emitters now say so in the handler's own JSDoc, gated by
|
|
51
|
+
* `runtime-ts/test/route-auth-seam.test.ts`.
|
|
52
|
+
*
|
|
53
|
+
* Spelled once because the literal had been copy-pasted to ten TypeScript emitters plus
|
|
54
|
+
* Python's `generated_header`, which is how one wrong sentence reached every generated
|
|
55
|
+
* file in the estate. `sidecarName` is the emitted module name, extension included
|
|
56
|
+
* (`Order.extra.ts`, `OrderForm.extra.tsx`).
|
|
57
|
+
*/
|
|
58
|
+
export function sidecarLine(sidecarName) {
|
|
59
|
+
return `// Extend in your own module (e.g. ${sidecarName}) — nothing imports it for you.\n`;
|
|
60
|
+
}
|
|
35
61
|
/** Default outDir used by tests + as a sane default for generate(). */
|
|
36
62
|
export const DEFAULT_OUT_DIR = "./src/db/entities";
|
|
37
63
|
/** Every retired codegen-control attribute. Read ONLY by the `meta gen` warning. */
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C,qFAAqF;AACrF,kFAAkF;AAClF,uFAAuF;AACvF,iFAAiF;AACjF,qFAAqF;AACrF,kFAAkF;AAClF,oEAAoE;AAEpE,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAsCnD,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,qFAAqF;YACrF,mGAAmG;KACtG;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,kFAAkF;YAClF,4EAA4E;YAC5E,8DAA8D;KACjE;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,mFAAmF;YACnF,yFAAyF;KAC5F;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,wFAAwF;YACxF,qFAAqF;YACrF,yFAAyF;YACzF,kFAAkF;KACrF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,yFAAyF;YACzF,8EAA8E;YAC9E,mEAAmE;KACtE;CACO,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C,qFAAqF;AACrF,kFAAkF;AAClF,uFAAuF;AACvF,iFAAiF;AACjF,qFAAqF;AACrF,kFAAkF;AAClF,oEAAoE;AAEpE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,WAAW,CAAC,WAAmB;IAC7C,OAAO,sCAAsC,WAAW,mCAAmC,CAAC;AAC9F,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAsCnD,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE;QACE,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,qFAAqF;YACrF,mGAAmG;KACtG;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,kFAAkF;YAClF,4EAA4E;YAC5E,8DAA8D;KACjE;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,mFAAmF;YACnF,yFAAyF;KAC5F;IACD;QACE,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,wFAAwF;YACxF,qFAAqF;YACrF,yFAAyF;YACzF,kFAAkF;KACrF;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,yFAAyF;YACzF,8EAA8E;YAC9E,mEAAmE;KACtE;CACO,CAAC"}
|
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
import type { Generator } from "./generator.js";
|
|
2
|
+
import type { MetaobjectsGenConfig } from "./metaobjects-config.js";
|
|
2
3
|
export type GeneratorTier = "native" | "neutral";
|
|
4
|
+
/**
|
|
5
|
+
* The six layers a generator can belong to — the axis an adopter SELECTS BY.
|
|
6
|
+
*
|
|
7
|
+
* Cross-port: `layer` is gated by every port's registry-conformance test against
|
|
8
|
+
* `fixtures/generator-registry-conformance/registry.json`, exactly as `tier` is, so a
|
|
9
|
+
* polyglot agent groups the catalog by the same words everywhere.
|
|
10
|
+
*
|
|
11
|
+
* Six, not ten. The first four are app-shape decisions a builder makes; `docs` is on by
|
|
12
|
+
* default (`meta docs`); `capability` holds the ones the MODEL has already made — nobody
|
|
13
|
+
* picks `prompt-render` by browsing a taxonomy, they pick it because they declared a
|
|
14
|
+
* `template.prompt`, which `meta gen --list --probe` reports with a real file count. A
|
|
15
|
+
* layer with one member does no grouping work, so do not split `capability` to tidy it.
|
|
16
|
+
*/
|
|
17
|
+
export declare const GENERATOR_LAYERS: readonly ["model", "persistence", "api", "client", "docs", "capability"];
|
|
18
|
+
export type Layer = (typeof GENERATOR_LAYERS)[number];
|
|
19
|
+
/**
|
|
20
|
+
* The framework a generator's OUTPUT targets. Absent = framework-neutral.
|
|
21
|
+
*
|
|
22
|
+
* Exclusivity is an ADVISORY and only on the `api` layer (spec §8a): `routes` and
|
|
23
|
+
* `routes-hono` emit to different paths, so wiring both is legal and silently produces
|
|
24
|
+
* two HTTP surfaces — worth a warning, never an error, because migrating between them is
|
|
25
|
+
* legitimate. There is NO general per-layer rule: `@metaobjectsdev/tanstack` peers on
|
|
26
|
+
* `react`, so `form` (react) + `hooks`/`grid` (tanstack) is the intended composition.
|
|
27
|
+
*/
|
|
28
|
+
export type GeneratorFramework = "fastify" | "hono" | "react" | "tanstack";
|
|
3
29
|
export interface GeneratorRegistryEntry {
|
|
4
30
|
/** Stable, cross-port-consistent id. Equals the registry map key. */
|
|
5
31
|
name: string;
|
|
32
|
+
/**
|
|
33
|
+
* Catalog discriminator. Today every entry is a generator; FR-043 adds
|
|
34
|
+
* `kind: "library"` rows to the same table rather than building a parallel one.
|
|
35
|
+
*/
|
|
36
|
+
kind: "generator";
|
|
37
|
+
/** The selection axis — see {@link GENERATOR_LAYERS}. Gated cross-port. */
|
|
38
|
+
layer: Layer;
|
|
6
39
|
/** One-line (no newline) human description for `--list`. */
|
|
7
40
|
description: string;
|
|
8
41
|
/** "native" = recommended `meta gen` suite; "neutral" = `meta docs`-owned. */
|
|
@@ -11,6 +44,46 @@ export interface GeneratorRegistryEntry {
|
|
|
11
44
|
factory: () => Generator;
|
|
12
45
|
/** Optional one-line options summary for `--list`. */
|
|
13
46
|
options?: string;
|
|
47
|
+
/** The framework this generator's OUTPUT targets. Absent = framework-neutral. */
|
|
48
|
+
framework?: GeneratorFramework;
|
|
49
|
+
/**
|
|
50
|
+
* Stable names whose emitted output THIS generator's output imports.
|
|
51
|
+
*
|
|
52
|
+
* Resolved, not trusted: a gate dry-runs every generator, resolves each emitted
|
|
53
|
+
* RELATIVE import back to whichever generator emits that path, and asserts the result
|
|
54
|
+
* is a subset of this list — so a generator that quietly starts depending on `entity`
|
|
55
|
+
* cannot ship claiming it depends on nothing.
|
|
56
|
+
*/
|
|
57
|
+
requires?: readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* The `@metaobjectsdev` runtime packages the EMITTED code imports.
|
|
60
|
+
*
|
|
61
|
+
* PLURAL, against the design's first sketch, because the emitted code is: an
|
|
62
|
+
* `output-parser` module imports `@metaobjectsdev/metadata`, `/render` AND
|
|
63
|
+
* `/runtime-ts`, and a `hooks` module imports `/runtime-web` and `/tanstack`. A
|
|
64
|
+
* singular field would have forced two of the three to go undeclared, which is the
|
|
65
|
+
* exact under-declaration the gate exists to catch. Resolved, not trusted — the
|
|
66
|
+
* emitted files are read back and every `@metaobjectsdev` import must appear here.
|
|
67
|
+
*/
|
|
68
|
+
runtimePackages?: readonly string[];
|
|
69
|
+
/**
|
|
70
|
+
* Third-party packages the EMITTED code imports.
|
|
71
|
+
*
|
|
72
|
+
* Per generator rather than derived from {@link runtimePackages}, because
|
|
73
|
+
* `@metaobjectsdev/runtime-ts`'s peers are a union (drizzle-orm, fastify, hono, kysely,
|
|
74
|
+
* zod) — deriving per package would tell someone ejecting `entity` to install both
|
|
75
|
+
* Fastify and Hono. Version RANGES are read from the runtime package's own
|
|
76
|
+
* `peerDependencies`, never written here. Gated the same way `requires` is.
|
|
77
|
+
*/
|
|
78
|
+
runtimePeers?: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Config keys this generator reads. Typed against the real config so a renamed key
|
|
81
|
+
* breaks the build instead of going quietly stale — the same "resolved, not trusted"
|
|
82
|
+
* doctrine as `requires`, obtained here for free from the type system.
|
|
83
|
+
*/
|
|
84
|
+
configKeys?: readonly (keyof MetaobjectsGenConfig)[];
|
|
85
|
+
/** True iff this package ships a `src/reference/<name>.ts` for `meta eject`. */
|
|
86
|
+
ejectable: boolean;
|
|
14
87
|
/** Optional note — used to point neutral entries at their canonical door. */
|
|
15
88
|
note?: string;
|
|
16
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator-registry.d.ts","sourceRoot":"","sources":["../src/generator-registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator-registry.d.ts","sourceRoot":"","sources":["../src/generator-registry.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA2BpE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,0EAOnB,CAAC;AACX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CA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