@metaobjectsdev/codegen-ts-tanstack 0.24.4 → 0.25.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/README.md +9 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/reference-templates.d.ts +5 -0
- package/dist/reference-templates.d.ts.map +1 -0
- package/dist/reference-templates.js +12 -0
- package/dist/reference-templates.js.map +1 -0
- package/dist/tanstack-grid-hook.d.ts +28 -2
- package/dist/tanstack-grid-hook.d.ts.map +1 -1
- package/dist/tanstack-grid-hook.js +35 -18
- package/dist/tanstack-grid-hook.js.map +1 -1
- package/dist/tanstack-grid.d.ts +27 -3
- package/dist/tanstack-grid.d.ts.map +1 -1
- package/dist/tanstack-grid.js +20 -12
- package/dist/tanstack-grid.js.map +1 -1
- package/dist/tanstack-query.d.ts +6 -2
- package/dist/tanstack-query.d.ts.map +1 -1
- package/dist/tanstack-query.js +25 -10
- package/dist/tanstack-query.js.map +1 -1
- package/dist/templates/columns-file.d.ts.map +1 -1
- package/dist/templates/columns-file.js +40 -9
- package/dist/templates/columns-file.js.map +1 -1
- package/dist/templates/grid-hook-file.js +1 -1
- package/dist/templates/grid-hook-file.js.map +1 -1
- package/dist/templates/hooks-file.js +16 -16
- package/dist/templates/hooks-file.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +19 -0
- package/src/reference/grid-hook.ts +154 -0
- package/src/reference/grid.ts +117 -0
- package/src/reference/hooks.ts +112 -0
- package/src/reference-templates.ts +16 -0
- package/src/tanstack-grid-hook.ts +61 -18
- package/src/tanstack-grid.ts +42 -12
- package/src/tanstack-query.ts +34 -10
- package/src/templates/columns-file.ts +39 -6
- package/src/templates/grid-hook-file.ts +1 -1
- package/src/templates/hooks-file.ts +16 -16
|
@@ -101,7 +101,7 @@ export function ${hookName}(
|
|
|
101
101
|
const fetcher = ${useEntityFetcherSym}();
|
|
102
102
|
return ${useQuerySym}<${targetSym}[]>({
|
|
103
103
|
queryKey: ${keysVar}.relation(${relLit}, sourceId),
|
|
104
|
-
queryFn: () => fetcher<${targetSym}[]>(\`\${${source}.$
|
|
104
|
+
queryFn: () => fetcher<${targetSym}[]>(\`\${${source}.$path}/\${sourceId}/${e.name}\`),
|
|
105
105
|
enabled: sourceId != null && (opts?.enabled ?? true),
|
|
106
106
|
...opts,
|
|
107
107
|
});
|
|
@@ -155,7 +155,7 @@ export function use${entityName}(
|
|
|
155
155
|
const fetcher = ${useEntityFetcherSym}();
|
|
156
156
|
return ${useQuerySym}<${entityName}Row>({
|
|
157
157
|
queryKey: ${keysVar}.detail(id),
|
|
158
|
-
queryFn: () => fetcher<${entityName}Row>(\`\${${entityName}.$
|
|
158
|
+
queryFn: () => fetcher<${entityName}Row>(\`\${${entityName}.$path}/\${id}\`),
|
|
159
159
|
...opts,
|
|
160
160
|
});
|
|
161
161
|
}
|
|
@@ -168,7 +168,7 @@ export function use${entityNamePlural}(
|
|
|
168
168
|
const qs = filter ? "?" + ${buildFilterQsSym}(filter as Record<string, unknown>) : "";
|
|
169
169
|
return ${useQuerySym}<${entityName}Row[]>({
|
|
170
170
|
queryKey: ${keysVar}.list(filter),
|
|
171
|
-
queryFn: () => fetcher<${entityName}Row[]>(\`\${${entityName}.$
|
|
171
|
+
queryFn: () => fetcher<${entityName}Row[]>(\`\${${entityName}.$path}\${qs}\`),
|
|
172
172
|
...opts,
|
|
173
173
|
});
|
|
174
174
|
}
|
|
@@ -227,7 +227,7 @@ export function use${entityName}(
|
|
|
227
227
|
const fetcher = ${useEntityFetcherSym}();
|
|
228
228
|
return ${useQuerySym}<${entityName}Row>({
|
|
229
229
|
queryKey: ${keysVar}.detail(id),
|
|
230
|
-
queryFn: () => fetcher<${entityName}Row>(\`\${${entityName}.$
|
|
230
|
+
queryFn: () => fetcher<${entityName}Row>(\`\${${entityName}.$path}/\${id}\`),
|
|
231
231
|
...opts,
|
|
232
232
|
});
|
|
233
233
|
}
|
|
@@ -240,7 +240,7 @@ export function use${entityNamePlural}(
|
|
|
240
240
|
const qs = filter ? "?" + ${buildFilterQsSym}(filter as Record<string, unknown>) : "";
|
|
241
241
|
return ${useQuerySym}<${entityName}Row[]>({
|
|
242
242
|
queryKey: ${keysVar}.list(filter),
|
|
243
|
-
queryFn: () => fetcher<${entityName}Row[]>(\`\${${entityName}.$
|
|
243
|
+
queryFn: () => fetcher<${entityName}Row[]>(\`\${${entityName}.$path}\${qs}\`),
|
|
244
244
|
...opts,
|
|
245
245
|
});
|
|
246
246
|
}
|
|
@@ -253,7 +253,7 @@ export function useCreate${entityName}(
|
|
|
253
253
|
const fetcher = ${useEntityFetcherSym}();
|
|
254
254
|
const qc = ${useQueryClientSym}();
|
|
255
255
|
return ${useMutationSym}<${entityName}Row, Error, ${entityName}Insert>({
|
|
256
|
-
mutationFn: (input) => fetcher<${entityName}Row>(\`\${${entityName}.$
|
|
256
|
+
mutationFn: (input) => fetcher<${entityName}Row>(\`\${${entityName}.$path}\`, {
|
|
257
257
|
method: "POST",
|
|
258
258
|
headers: { "Content-Type": "application/json" },
|
|
259
259
|
body: JSON.stringify(input),
|
|
@@ -272,7 +272,7 @@ export function useUpdate${entityName}(
|
|
|
272
272
|
const fetcher = ${useEntityFetcherSym}();
|
|
273
273
|
const qc = ${useQueryClientSym}();
|
|
274
274
|
return ${useMutationSym}({
|
|
275
|
-
mutationFn: ({ id, input }) => fetcher<${entityName}Row>(\`\${${entityName}.$
|
|
275
|
+
mutationFn: ({ id, input }) => fetcher<${entityName}Row>(\`\${${entityName}.$path}/\${id}\`, {
|
|
276
276
|
method: "PATCH",
|
|
277
277
|
headers: { "Content-Type": "application/json" },
|
|
278
278
|
body: JSON.stringify(input),
|
|
@@ -291,7 +291,7 @@ export function useDelete${entityName}(
|
|
|
291
291
|
const fetcher = ${useEntityFetcherSym}();
|
|
292
292
|
const qc = ${useQueryClientSym}();
|
|
293
293
|
return ${useMutationSym}({
|
|
294
|
-
mutationFn: (id) => fetcher<void>(\`\${${entityName}.$
|
|
294
|
+
mutationFn: (id) => fetcher<void>(\`\${${entityName}.$path}/\${id}\`, { method: "DELETE" }),
|
|
295
295
|
...opts,
|
|
296
296
|
onSuccess: (...args) => {
|
|
297
297
|
qc.invalidateQueries({ queryKey: ${keysVar}.all() });
|
|
@@ -328,7 +328,7 @@ function renderTphHooksFile(base, ctx, baseModule) {
|
|
|
328
328
|
const useEntityFetcherSym = imp("useEntityFetcher@@metaobjectsdev/tanstack");
|
|
329
329
|
const buildFilterQsSym = imp("buildFilterQs@@metaobjectsdev/runtime-web");
|
|
330
330
|
const subtypes = plan.subtypes;
|
|
331
|
-
// `${baseName}` imports BOTH the constants value (for $path
|
|
331
|
+
// `${baseName}` imports BOTH the constants value (for $path) and the
|
|
332
332
|
// discriminated-union type (declaration merge). Each subtype contributes its
|
|
333
333
|
// interface type AND its own filter type (discriminator-excluded — the route
|
|
334
334
|
// pins it), so per-subtype hooks filter on the fields the per-subtype
|
|
@@ -367,7 +367,7 @@ export function use${baseName}(
|
|
|
367
367
|
const fetcher = ${useEntityFetcherSym}();
|
|
368
368
|
return ${useQuerySym}<${baseName}>({
|
|
369
369
|
queryKey: ${keysVar}.detail(id),
|
|
370
|
-
queryFn: () => fetcher<${baseName}>(\`\${${baseName}.$
|
|
370
|
+
queryFn: () => fetcher<${baseName}>(\`\${${baseName}.$path}/\${id}\`),
|
|
371
371
|
...opts,
|
|
372
372
|
});
|
|
373
373
|
}
|
|
@@ -380,7 +380,7 @@ export function use${pluralize(baseName)}(
|
|
|
380
380
|
const qs = filter ? "?" + ${buildFilterQsSym}(filter as Record<string, unknown>) : "";
|
|
381
381
|
return ${useQuerySym}<${baseName}[]>({
|
|
382
382
|
queryKey: ${keysVar}.list(filter),
|
|
383
|
-
queryFn: () => fetcher<${baseName}[]>(\`\${${baseName}.$
|
|
383
|
+
queryFn: () => fetcher<${baseName}[]>(\`\${${baseName}.$path}\${qs}\`),
|
|
384
384
|
...opts,
|
|
385
385
|
});
|
|
386
386
|
}
|
|
@@ -391,7 +391,7 @@ export function use${pluralize(baseName)}(
|
|
|
391
391
|
const valueLit = JSON.stringify(value);
|
|
392
392
|
const createInput = `Omit<${subName}, ${JSON.stringify(discField)}>`;
|
|
393
393
|
const updateInput = `Partial<${createInput}>`;
|
|
394
|
-
const subPath = `\`\${${baseName}.$
|
|
394
|
+
const subPath = `\`\${${baseName}.$path}/${seg}\``;
|
|
395
395
|
return code `
|
|
396
396
|
export function use${pluralize(subName)}(
|
|
397
397
|
filter?: ${subName}Filter,
|
|
@@ -401,7 +401,7 @@ export function use${pluralize(subName)}(
|
|
|
401
401
|
const qs = filter ? "?" + ${buildFilterQsSym}(filter as Record<string, unknown>) : "";
|
|
402
402
|
return ${useQuerySym}<${subName}[]>({
|
|
403
403
|
queryKey: ${keysVar}.subtypeList(${valueLit}, filter),
|
|
404
|
-
queryFn: () => fetcher<${subName}[]>(\`\${${baseName}.$
|
|
404
|
+
queryFn: () => fetcher<${subName}[]>(\`\${${baseName}.$path}/${seg}\${qs}\`),
|
|
405
405
|
...opts,
|
|
406
406
|
});
|
|
407
407
|
}
|
|
@@ -413,7 +413,7 @@ export function use${subName}(
|
|
|
413
413
|
const fetcher = ${useEntityFetcherSym}();
|
|
414
414
|
return ${useQuerySym}<${subName}>({
|
|
415
415
|
queryKey: ${keysVar}.subtypeDetail(${valueLit}, id),
|
|
416
|
-
queryFn: () => fetcher<${subName}>(\`\${${baseName}.$
|
|
416
|
+
queryFn: () => fetcher<${subName}>(\`\${${baseName}.$path}/${seg}/\${id}\`),
|
|
417
417
|
...opts,
|
|
418
418
|
});
|
|
419
419
|
}
|
|
@@ -443,7 +443,7 @@ export function useUpdate${subName}(
|
|
|
443
443
|
const fetcher = ${useEntityFetcherSym}();
|
|
444
444
|
const qc = ${useQueryClientSym}();
|
|
445
445
|
return ${useMutationSym}({
|
|
446
|
-
mutationFn: ({ id, input }) => fetcher<${subName}>(\`\${${baseName}.$
|
|
446
|
+
mutationFn: ({ id, input }) => fetcher<${subName}>(\`\${${baseName}.$path}/${seg}/\${id}\`, {
|
|
447
447
|
method: "PATCH",
|
|
448
448
|
headers: { "Content-Type": "application/json" },
|
|
449
449
|
body: JSON.stringify(input),
|
|
@@ -462,7 +462,7 @@ export function useDelete${subName}(
|
|
|
462
462
|
const fetcher = ${useEntityFetcherSym}();
|
|
463
463
|
const qc = ${useQueryClientSym}();
|
|
464
464
|
return ${useMutationSym}({
|
|
465
|
-
mutationFn: (id) => fetcher<void>(\`\${${baseName}.$
|
|
465
|
+
mutationFn: (id) => fetcher<void>(\`\${${baseName}.$path}/${seg}/\${id}\`, { method: "DELETE" }),
|
|
466
466
|
...opts,
|
|
467
467
|
onSuccess: (...args) => {
|
|
468
468
|
qc.invalidateQueries({ queryKey: ${keysVar}.all() });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks-file.js","sourceRoot":"","sources":["../../src/templates/hooks-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAa,MAAM,SAAS,CAAC;AAIjE;;;kFAGkF;AAClF,SAAS,YAAY,CAAC,YAAoB;IACxC,OAAO,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,CAAC,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU;QACxC,CAAC,CAAC,GAAG,YAAY,OAAO,CAAC;AAC7B,CAAC;AAED,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,qBAAqB,EACrB,sBAAsB,EACtB,OAAO,EACP,SAAS,GACV,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,MAAkB,EAAE,GAAkB;IACpE,yEAAyE;IACzE,8CAA8C;IAC9C,MAAM,YAAY,GAAG,qBAAqB,CACxC,GAAG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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/codegen-ts-tanstack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "TanStack codegen for metaobjects — TanStack Query hooks for every entity, plus TanStack Table column definitions and grid-state hooks for entities declaring a layout.dataGrid.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@metaobjectsdev/metadata": "0.
|
|
48
|
-
"@metaobjectsdev/codegen-ts": "0.
|
|
47
|
+
"@metaobjectsdev/metadata": "0.25.0",
|
|
48
|
+
"@metaobjectsdev/codegen-ts": "0.25.0",
|
|
49
49
|
"ts-poet": "^6.10.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -2,3 +2,22 @@
|
|
|
2
2
|
export { tanstackQuery, type TanstackQueryOpts } from "./tanstack-query.js";
|
|
3
3
|
export { tanstackGrid, type TanstackGridOpts } from "./tanstack-grid.js";
|
|
4
4
|
export { tanstackGridHook, type TanstackGridHookOpts } from "./tanstack-grid-hook.js";
|
|
5
|
+
|
|
6
|
+
// FR-040 §4.2(b) — public so an owned generator composes the engine rather than
|
|
7
|
+
// forking it. Signatures are stable API: (entity, ctx) => string.
|
|
8
|
+
export { renderHooksFile } from "./templates/hooks-file.js";
|
|
9
|
+
export { renderColumnsFile } from "./templates/columns-file.js";
|
|
10
|
+
export { renderGridHookFile } from "./templates/grid-hook-file.js";
|
|
11
|
+
|
|
12
|
+
// FR-040 §4.2(b) — the grid/grid-hook data-grid opt-in gate is a STEP in the pipeline
|
|
13
|
+
// those two owned templates compose, not an internal detail either may fork. Public so
|
|
14
|
+
// `grid.ts` and `grid-hook.ts` import one shared implementation instead of each
|
|
15
|
+
// carrying its own copy.
|
|
16
|
+
export { hasDataGridLayout, warnMissingDataGridLayout } from "./data-grid-gate.js";
|
|
17
|
+
|
|
18
|
+
// FR-040 §4.1 — the copyable reference generators this package ships in
|
|
19
|
+
// `src/reference/`, and the reader `meta init`/`meta eject` use to read them.
|
|
20
|
+
export { resolveReferenceRoot, readReferenceTemplate, REFERENCE_GENERATOR_NAMES } from "./reference-templates.js";
|
|
21
|
+
// The name union travels with the names array — codegen-ts exports both, and a
|
|
22
|
+
// consumer keying anything by ejectable name needs the type as much as the values.
|
|
23
|
+
export type { ReferenceGeneratorName } from "./reference-templates.js";
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// REFERENCE TEMPLATE — copy this into your repo (e.g. codegen/generators/grid-hook.ts) and own it.
|
|
2
|
+
// Then import it LOCALLY in metaobjects.config.ts:
|
|
3
|
+
// import { tanstackGridHook } from "./codegen/generators/grid-hook.js";
|
|
4
|
+
//
|
|
5
|
+
// RUNTIME: this file executes under whatever runs `meta gen` — NODE, even in a Bun
|
|
6
|
+
// project. Do not reach for `Bun.*` globals here.
|
|
7
|
+
// targets: TanStack Query. The emitted hook calls `useEntityFetcher()` from
|
|
8
|
+
// `@metaobjectsdev/tanstack`, so the module is a CLIENT component.
|
|
9
|
+
// If your framework compiles server and client from one tree and resolves
|
|
10
|
+
// each half under different conditions, the emitted file may need a marker
|
|
11
|
+
// directive — prepend it to `renderGridHookFile`'s result below. That is a
|
|
12
|
+
// one-line change in THIS file and is the intended way to do it.
|
|
13
|
+
// use-when: you want a use<Entity><Grid>Grid() state hook — sort/filter/pagination
|
|
14
|
+
// wired to TanStack Query — for each `layout.dataGrid` an entity declares.
|
|
15
|
+
// emits: <target>/<Entity>.grid.ts, plus the DB-free <Entity>.meta.ts descriptor
|
|
16
|
+
// the hook module imports from. Emissions byte-identical to another UI
|
|
17
|
+
// generator's copy of the same descriptor collapse to one file (#266).
|
|
18
|
+
// customize: this generator is YOURS. `renderGridHookFile` (exported from
|
|
19
|
+
// @metaobjectsdev/codegen-ts-tanstack) produces the hook body — wrap it,
|
|
20
|
+
// prepend to it, or replace the call entirely with your own renderer.
|
|
21
|
+
// composes-with: grid.ts (the column definitions this hook's grid state pairs with) —
|
|
22
|
+
// pass the SAME `tphSubtypeGrids` predicate to both, or a TPH subtype gets
|
|
23
|
+
// a .grid.ts with no .columns.tsx beside it (#287).
|
|
24
|
+
|
|
25
|
+
import { type MetaObject } from "@metaobjectsdev/metadata";
|
|
26
|
+
import {
|
|
27
|
+
perEntity,
|
|
28
|
+
type Generator,
|
|
29
|
+
type GeneratorFactory,
|
|
30
|
+
formatTs,
|
|
31
|
+
entityOutputPath,
|
|
32
|
+
entityMetaFileName,
|
|
33
|
+
renderEntityMetaFile,
|
|
34
|
+
servesReadApi,
|
|
35
|
+
isTphSubtype,
|
|
36
|
+
withClientDirective,
|
|
37
|
+
namesRef,
|
|
38
|
+
namesConstArg,
|
|
39
|
+
} from "@metaobjectsdev/codegen-ts";
|
|
40
|
+
import {
|
|
41
|
+
renderGridHookFile,
|
|
42
|
+
hasDataGridLayout,
|
|
43
|
+
warnMissingDataGridLayout,
|
|
44
|
+
} from "@metaobjectsdev/codegen-ts-tanstack";
|
|
45
|
+
|
|
46
|
+
export interface TanstackGridHookOpts {
|
|
47
|
+
filter?: (entity: MetaObject) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Opt a TPH subtype IN to its own per-subtype grid. Default `() => false`: a
|
|
50
|
+
* discriminator base emits ONE polymorphic grid and its subtypes emit none, which is
|
|
51
|
+
* the single-source-of-truth arrangement almost every TPH model wants.
|
|
52
|
+
*
|
|
53
|
+
* This is an OPTION rather than a `filter` clause because it WIDENS. A `filter` is
|
|
54
|
+
* ANDed with the built-in gates, so it can only ever narrow — an opt-in is not
|
|
55
|
+
* expressible through it. (It is not a metadata attribute either: `@emitGrid` was
|
|
56
|
+
* never registered vocabulary, so authoring it failed `meta verify`.)
|
|
57
|
+
*
|
|
58
|
+
* Pass the SAME predicate to `tanstackGrid()` and `tanstackGridHook()`. If they
|
|
59
|
+
* disagree you reproduce #287 exactly: the hook emits a `<Sub>.grid.ts` whose sibling
|
|
60
|
+
* `<Sub>.columns.tsx` is never emitted — a dangling `use<Sub>DefaultGrid()`, and an
|
|
61
|
+
* outright TS2307 when the inherited layout carries an `@filter` preset, since the hook
|
|
62
|
+
* then imports `<sub>DefaultFilter` from the missing columns module.
|
|
63
|
+
*/
|
|
64
|
+
tphSubtypeGrids?: (entity: MetaObject) => boolean;
|
|
65
|
+
target?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Per-entity generator that emits <Entity>.grid.ts — one
|
|
70
|
+
* use<Entity><Grid>Grid() hook per layout[dataGrid] declared on the entity.
|
|
71
|
+
*
|
|
72
|
+
* Per-entity opt-IN: presence of at least one dataGrid layout on the object
|
|
73
|
+
* (mirrors tanstackGrid).
|
|
74
|
+
*
|
|
75
|
+
* A TPH subtype additionally needs `tphSubtypeGrids` — pass the SAME predicate to
|
|
76
|
+
* tanstackGrid(), or this generator emits a `<Sub>.grid.ts` with no `<Sub>.columns.tsx`
|
|
77
|
+
* beside it.
|
|
78
|
+
*
|
|
79
|
+
* Decide per generator what you consume: wire only the generators whose output you
|
|
80
|
+
* actually import, and narrow this one with its `filter` option. There is no `@emit*`
|
|
81
|
+
* metadata attribute — those were never registered vocabulary, so `meta verify` rejects
|
|
82
|
+
* them (ERR_UNKNOWN_ATTR).
|
|
83
|
+
*/
|
|
84
|
+
export const tanstackGridHook = function tanstackGridHook(opts?: TanstackGridHookOpts): Generator {
|
|
85
|
+
const userFilter = opts?.filter ?? (() => true);
|
|
86
|
+
// Default OFF — byte-identical to the behaviour every project that never declared a
|
|
87
|
+
// per-subtype grid already had.
|
|
88
|
+
const tphSubtypeGrids = opts?.tphSubtypeGrids ?? (() => false);
|
|
89
|
+
// Every gate EXCEPT the dataGrid-layout opt-in: the framework instance-artifact
|
|
90
|
+
// guard (skips abstract types) and the user filter. Split out so the discoverability
|
|
91
|
+
// note can name exactly the entities the LAYOUT gate alone held back (#287).
|
|
92
|
+
//
|
|
93
|
+
// The TPH clause must MATCH tanstackGrid's exactly, which means the SAME
|
|
94
|
+
// `tphSubtypeGrids` predicate must be passed to both. A TPH subtype inherits its base's
|
|
95
|
+
// dataGrid layout via extends, so `hasDataGridLayout` is true for it — but tanstackGrid
|
|
96
|
+
// deliberately emits no per-subtype columns unless `tphSubtypeGrids` opts it in (the
|
|
97
|
+
// base's polymorphic grid is the single source of truth). Where the two predicates
|
|
98
|
+
// disagree, a TPH subtype gets a `<Sub>.grid.ts` whose sibling `<Sub>.columns.tsx` is
|
|
99
|
+
// never emitted: a dangling `use<Sub>DefaultGrid()` with nothing to pair it with, and an
|
|
100
|
+
// outright TS2307 when the inherited layout carries an `@filter` preset (the hook then
|
|
101
|
+
// imports `<sub>DefaultFilter` from the missing columns module).
|
|
102
|
+
const passesOtherGates = (e: MetaObject): boolean =>
|
|
103
|
+
servesReadApi(e)
|
|
104
|
+
&& userFilter(e)
|
|
105
|
+
&& (!isTphSubtype(e) || tphSubtypeGrids(e));
|
|
106
|
+
const emit = perEntity(async (entity: MetaObject, ctx) => {
|
|
107
|
+
if (!ctx.renderContext) {
|
|
108
|
+
throw new Error("tanstack-grid-hook: renderContext is required (provided by runGen)");
|
|
109
|
+
}
|
|
110
|
+
// Also emit the DB-free descriptor module this file imports from. Each UI
|
|
111
|
+
// generator emits it rather than relying on the consumer wiring an extra one:
|
|
112
|
+
// the entity generator is scaffold-and-own (ADR-0034), so it cannot be changed
|
|
113
|
+
// from the package. Emissions are byte-identical between generators, which the
|
|
114
|
+
// runner collapses (#266).
|
|
115
|
+
//
|
|
116
|
+
// §A6/§B2 — same `namesRef` pair every other §A6 site builds, scoped to THIS
|
|
117
|
+
// generator's own render context (see hooks.ts's matching comment for why
|
|
118
|
+
// `.meta.ts` needs its own target-scoped check rather than reusing the entity
|
|
119
|
+
// module's).
|
|
120
|
+
const rc = ctx.renderContext;
|
|
121
|
+
const metaNames = namesRef(entity, rc);
|
|
122
|
+
return [{
|
|
123
|
+
path: entityOutputPath(ctx.renderContext.outputLayout, entity.package,
|
|
124
|
+
entityMetaFileName(entity.name)),
|
|
125
|
+
content: await formatTs(renderEntityMetaFile(
|
|
126
|
+
entity,
|
|
127
|
+
ctx.renderContext.apiPrefix,
|
|
128
|
+
namesConstArg(metaNames),
|
|
129
|
+
)),
|
|
130
|
+
}, {
|
|
131
|
+
path: entityOutputPath(
|
|
132
|
+
ctx.renderContext.outputLayout,
|
|
133
|
+
entity.package,
|
|
134
|
+
`${entity.name}.grid.ts`,
|
|
135
|
+
),
|
|
136
|
+
content: withClientDirective(
|
|
137
|
+
await formatTs(renderGridHookFile(entity, ctx.renderContext)),
|
|
138
|
+
ctx.renderContext.clientDirective,
|
|
139
|
+
),
|
|
140
|
+
}];
|
|
141
|
+
});
|
|
142
|
+
const generator: Generator = {
|
|
143
|
+
name: "tanstack-grid-hook",
|
|
144
|
+
filter: (e: MetaObject) => passesOtherGates(e) && hasDataGridLayout(e),
|
|
145
|
+
generate: async (ctx) => {
|
|
146
|
+
warnMissingDataGridLayout(ctx, passesOtherGates, "<Entity>.grid.ts");
|
|
147
|
+
return emit(ctx);
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
if (opts?.target) {
|
|
151
|
+
generator.target = opts.target;
|
|
152
|
+
}
|
|
153
|
+
return generator;
|
|
154
|
+
} as GeneratorFactory<TanstackGridHookOpts | void>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// REFERENCE TEMPLATE — copy this into your repo (e.g. codegen/generators/grid.ts) and own it.
|
|
2
|
+
// Then import it LOCALLY in metaobjects.config.ts:
|
|
3
|
+
// import { tanstackGrid } from "./codegen/generators/grid.js";
|
|
4
|
+
//
|
|
5
|
+
// RUNTIME: this file executes under whatever runs `meta gen` — NODE, even in a Bun
|
|
6
|
+
// project. Do not reach for `Bun.*` globals here.
|
|
7
|
+
// targets: TanStack Table. The emitted module's `ColumnDef` comes from
|
|
8
|
+
// `@tanstack/react-table`, so it is a CLIENT component.
|
|
9
|
+
// If your framework compiles server and client from one tree and resolves
|
|
10
|
+
// each half under different conditions, the emitted file may need a marker
|
|
11
|
+
// directive — prepend it to `renderColumnsFile`'s result below. That is a
|
|
12
|
+
// one-line change in THIS file and is the intended way to do it.
|
|
13
|
+
// use-when: you want generated grid column definitions for any entity declaring a
|
|
14
|
+
// `layout.dataGrid` child.
|
|
15
|
+
// emits: <target>/<Entity>.columns.tsx — one column set per declared dataGrid
|
|
16
|
+
// layout; a TPH discriminator base's grid folds in its subtypes' fields.
|
|
17
|
+
// customize: this generator is YOURS. `renderColumnsFile` (exported from
|
|
18
|
+
// @metaobjectsdev/codegen-ts-tanstack) produces the column definitions —
|
|
19
|
+
// wrap it, prepend to it, or replace the call entirely with your own
|
|
20
|
+
// renderer.
|
|
21
|
+
// composes-with: entity.ts (imports the Row type the columns are typed against),
|
|
22
|
+
// hooks.ts (the query hook a grid usually pairs with),
|
|
23
|
+
// grid-hook.ts (pass it the SAME `tphSubtypeGrids` predicate).
|
|
24
|
+
|
|
25
|
+
import { type MetaObject } from "@metaobjectsdev/metadata";
|
|
26
|
+
import {
|
|
27
|
+
perEntity,
|
|
28
|
+
type Generator,
|
|
29
|
+
type GeneratorFactory,
|
|
30
|
+
formatTs,
|
|
31
|
+
entityOutputPath,
|
|
32
|
+
servesReadApi,
|
|
33
|
+
isTphSubtype,
|
|
34
|
+
withClientDirective,
|
|
35
|
+
} from "@metaobjectsdev/codegen-ts";
|
|
36
|
+
import {
|
|
37
|
+
renderColumnsFile,
|
|
38
|
+
hasDataGridLayout,
|
|
39
|
+
warnMissingDataGridLayout,
|
|
40
|
+
} from "@metaobjectsdev/codegen-ts-tanstack";
|
|
41
|
+
|
|
42
|
+
export interface TanstackGridOpts {
|
|
43
|
+
filter?: (entity: MetaObject) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Opt a TPH subtype IN to its own per-subtype grid. Default `() => false`: a
|
|
46
|
+
* discriminator base emits ONE polymorphic grid and its subtypes emit none, which is
|
|
47
|
+
* the single-source-of-truth arrangement almost every TPH model wants.
|
|
48
|
+
*
|
|
49
|
+
* This is an OPTION rather than a `filter` clause because it WIDENS. A `filter` is
|
|
50
|
+
* ANDed with the built-in gates, so it can only ever narrow — an opt-in is not
|
|
51
|
+
* expressible through it. (It is not a metadata attribute either: `@emitGrid` was
|
|
52
|
+
* never registered vocabulary, so authoring it failed `meta verify`.)
|
|
53
|
+
*
|
|
54
|
+
* Pass the SAME predicate to `tanstackGrid()` and `tanstackGridHook()`. If they
|
|
55
|
+
* disagree you reproduce #287 exactly: the hook emits a `<Sub>.grid.ts` whose sibling
|
|
56
|
+
* `<Sub>.columns.tsx` is never emitted — a dangling `use<Sub>DefaultGrid()`, and an
|
|
57
|
+
* outright TS2307 when the inherited layout carries an `@filter` preset, since the hook
|
|
58
|
+
* then imports `<sub>DefaultFilter` from the missing columns module.
|
|
59
|
+
*/
|
|
60
|
+
tphSubtypeGrids?: (entity: MetaObject) => boolean;
|
|
61
|
+
target?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Per-entity opt-IN: presence of at least one `dataGrid` layout on the object. If that
|
|
66
|
+
* passes and the user-supplied filter passes, the generator emits.
|
|
67
|
+
*
|
|
68
|
+
* A TPH subtype additionally needs `tphSubtypeGrids` — pass the SAME predicate to
|
|
69
|
+
* tanstackGridHook(), or the emitted `<Sub>.grid.ts` has no `<Sub>.columns.tsx`.
|
|
70
|
+
*
|
|
71
|
+
* Decide per generator what you consume: wire only the generators whose output you
|
|
72
|
+
* actually import, and narrow this one with its `filter` option. There is no `@emit*`
|
|
73
|
+
* metadata attribute — those were never registered vocabulary, so `meta verify` rejects
|
|
74
|
+
* them (ERR_UNKNOWN_ATTR).
|
|
75
|
+
*/
|
|
76
|
+
export const tanstackGrid = function tanstackGrid(opts?: TanstackGridOpts): Generator {
|
|
77
|
+
const userFilter = opts?.filter ?? (() => true);
|
|
78
|
+
// Default OFF — byte-identical to the behaviour every project that never declared a
|
|
79
|
+
// per-subtype grid already had.
|
|
80
|
+
const tphSubtypeGrids = opts?.tphSubtypeGrids ?? (() => false);
|
|
81
|
+
// Every gate EXCEPT the dataGrid-layout opt-in: the framework instance-artifact
|
|
82
|
+
// guard (skips abstract types) and the user filter.
|
|
83
|
+
// FR-017 Tier 3: a TPH discriminator base emits ONE polymorphic grid. Its
|
|
84
|
+
// subtypes inherit the base's dataGrid layout via extends, but per-subtype grids
|
|
85
|
+
// are opt-IN only, via the `tphSubtypeGrids` option — otherwise the polymorphic
|
|
86
|
+
// grid is the single source of truth. Pass the SAME predicate to tanstackGridHook().
|
|
87
|
+
// Split out so the discoverability note can name exactly the entities the LAYOUT
|
|
88
|
+
// gate alone held back (#287) — an abstract type is not a surprise.
|
|
89
|
+
const passesOtherGates = (e: MetaObject): boolean =>
|
|
90
|
+
servesReadApi(e)
|
|
91
|
+
&& userFilter(e)
|
|
92
|
+
&& (!isTphSubtype(e) || tphSubtypeGrids(e));
|
|
93
|
+
const emit = perEntity(async (entity: MetaObject, ctx) => {
|
|
94
|
+
if (!ctx.renderContext) {
|
|
95
|
+
throw new Error("tanstack-grid: renderContext is required (provided by runGen)");
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
path: entityOutputPath(ctx.renderContext.outputLayout, entity.package, `${entity.name}.columns.tsx`),
|
|
99
|
+
content: withClientDirective(
|
|
100
|
+
await formatTs(renderColumnsFile(entity, ctx.renderContext)),
|
|
101
|
+
ctx.renderContext.clientDirective,
|
|
102
|
+
),
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
const generator: Generator = {
|
|
106
|
+
name: "tanstack-grid",
|
|
107
|
+
filter: (e: MetaObject) => passesOtherGates(e) && hasDataGridLayout(e),
|
|
108
|
+
generate: async (ctx) => {
|
|
109
|
+
warnMissingDataGridLayout(ctx, passesOtherGates, "<Entity>.columns.tsx");
|
|
110
|
+
return emit(ctx);
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
if (opts?.target) {
|
|
114
|
+
generator.target = opts.target;
|
|
115
|
+
}
|
|
116
|
+
return generator;
|
|
117
|
+
} as GeneratorFactory<TanstackGridOpts | void>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// REFERENCE TEMPLATE — copy this into your repo (e.g. codegen/generators/hooks.ts) and own it.
|
|
2
|
+
// Then import it LOCALLY in metaobjects.config.ts:
|
|
3
|
+
// import { tanstackQuery } from "./codegen/generators/hooks.js";
|
|
4
|
+
//
|
|
5
|
+
// RUNTIME: this file executes under whatever runs `meta gen` — NODE, even in a Bun
|
|
6
|
+
// project. Do not reach for `Bun.*` globals here.
|
|
7
|
+
// targets: TanStack Query. The emitted hooks call `useEntityFetcher()` from
|
|
8
|
+
// `@metaobjectsdev/tanstack`, so the module is a CLIENT component.
|
|
9
|
+
// If your framework compiles server and client from one tree and resolves
|
|
10
|
+
// each half under different conditions, the emitted file may need a marker
|
|
11
|
+
// directive — prepend it to `renderHooksFile`'s result below. That is a
|
|
12
|
+
// one-line change in THIS file and is the intended way to do it.
|
|
13
|
+
// use-when: you want a query-key factory plus 2 query hooks and 3 mutation hooks,
|
|
14
|
+
// backed by TanStack Query, per entity.
|
|
15
|
+
// emits: <target>/<Entity>.hooks.ts, plus the DB-free <Entity>.meta.ts descriptor
|
|
16
|
+
// the hooks module imports from. Emissions byte-identical to another UI
|
|
17
|
+
// generator's copy of the same descriptor collapse to one file (#266).
|
|
18
|
+
// customize: this generator is YOURS. `renderHooksFile` (exported from
|
|
19
|
+
// @metaobjectsdev/codegen-ts-tanstack) produces the hooks body — wrap it,
|
|
20
|
+
// prepend to it, or replace the call entirely with your own renderer.
|
|
21
|
+
// composes-with: entity.ts (imports the table/schemas these hooks fetch/validate against).
|
|
22
|
+
|
|
23
|
+
import { type MetaObject } from "@metaobjectsdev/metadata";
|
|
24
|
+
import {
|
|
25
|
+
perEntity,
|
|
26
|
+
type Generator,
|
|
27
|
+
type GeneratorFactory,
|
|
28
|
+
formatTs,
|
|
29
|
+
entityOutputPath,
|
|
30
|
+
entityMetaFileName,
|
|
31
|
+
renderEntityMetaFile,
|
|
32
|
+
servesReadApi,
|
|
33
|
+
isTphSubtype,
|
|
34
|
+
|
|
35
|
+
withClientDirective,
|
|
36
|
+
namesRef,
|
|
37
|
+
namesConstArg,
|
|
38
|
+
} from "@metaobjectsdev/codegen-ts";
|
|
39
|
+
import { renderHooksFile } from "@metaobjectsdev/codegen-ts-tanstack";
|
|
40
|
+
|
|
41
|
+
export interface TanstackQueryOpts {
|
|
42
|
+
filter?: (entity: MetaObject) => boolean;
|
|
43
|
+
target?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Per-entity generator that emits <Entity>.hooks.ts — a query-key factory
|
|
48
|
+
* plus 2 query hooks and 3 mutation hooks backed by useEntityFetcher().
|
|
49
|
+
*
|
|
50
|
+
* If the user supplies their own filter, it AND-composes with the built-in gates.
|
|
51
|
+
*
|
|
52
|
+
* Decide per generator what you consume: wire only the generators whose output you
|
|
53
|
+
* actually import, and narrow this one with its `filter` option. There is no `@emit*`
|
|
54
|
+
* metadata attribute — those were never registered vocabulary, so `meta verify` rejects
|
|
55
|
+
* them (ERR_UNKNOWN_ATTR).
|
|
56
|
+
*/
|
|
57
|
+
export const tanstackQuery = function tanstackQuery(opts?: TanstackQueryOpts): Generator {
|
|
58
|
+
const userFilter = opts?.filter ?? (() => true);
|
|
59
|
+
const generator: Generator = {
|
|
60
|
+
name: "tanstack-query",
|
|
61
|
+
// AND-composes the framework instance-artifact guard (skips abstract types —
|
|
62
|
+
// they contribute shape via inheritance only and have no instance to query)
|
|
63
|
+
// with the optional user filter. Projections still pass here and get read-only
|
|
64
|
+
// hooks via renderHooksFile's isProjection branch.
|
|
65
|
+
// FR-017 Tier 3: TPH subtypes get no standalone hooks file — their per-subtype
|
|
66
|
+
// hooks live in the discriminator base's hooks file (polymorphic + per-subtype).
|
|
67
|
+
filter: (e: MetaObject) => servesReadApi(e) && !isTphSubtype(e) && userFilter(e),
|
|
68
|
+
generate: perEntity(async (entity, ctx) => {
|
|
69
|
+
if (!ctx.renderContext) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
"tanstack-query: renderContext is required (provided by runGen)",
|
|
72
|
+
);
|
|
73
|
+
} // Also emit the DB-free descriptor module this file imports from. Each UI
|
|
74
|
+
// generator emits it rather than relying on the consumer wiring an extra
|
|
75
|
+
// generator: the entity generator is scaffold-and-own (ADR-0034), so it cannot
|
|
76
|
+
// be changed from the package. Emissions are byte-identical between generators,
|
|
77
|
+
// which the runner collapses (#266).
|
|
78
|
+
//
|
|
79
|
+
// §A6/§B2 — same `namesRef` pair every other §A6 site builds, scoped to THIS
|
|
80
|
+
// generator's own render context: `.meta.ts` is a UI-generator artifact that can
|
|
81
|
+
// sit on a DIFFERENT target from `namesFile()` (unlike the entity module, which
|
|
82
|
+
// shares a target with names by construction — see names-file.ts).
|
|
83
|
+
// `ctx.renderContext.includeNames` is already computed per-target by the runner,
|
|
84
|
+
// so it is false here whenever the names artifact does not land in THIS
|
|
85
|
+
// generator's own target — no separate check needed.
|
|
86
|
+
const rc = ctx.renderContext;
|
|
87
|
+
const metaNames = namesRef(entity, rc);
|
|
88
|
+
const metaFile = {
|
|
89
|
+
path: entityOutputPath(ctx.renderContext.outputLayout, entity.package,
|
|
90
|
+
entityMetaFileName(entity.name)),
|
|
91
|
+
content: await formatTs(renderEntityMetaFile(
|
|
92
|
+
entity,
|
|
93
|
+
ctx.renderContext.apiPrefix,
|
|
94
|
+
namesConstArg(metaNames),
|
|
95
|
+
)),
|
|
96
|
+
};
|
|
97
|
+
return [metaFile, {
|
|
98
|
+
path: entityOutputPath(ctx.renderContext.outputLayout, entity.package, `${entity.name}.hooks.ts`),
|
|
99
|
+
// Outside formatTs deliberately: the directive must stay the module's first
|
|
100
|
+
// token, and a formatter is entitled to move a leading string expression.
|
|
101
|
+
content: withClientDirective(
|
|
102
|
+
await formatTs(renderHooksFile(entity, ctx.renderContext)),
|
|
103
|
+
ctx.renderContext.clientDirective,
|
|
104
|
+
),
|
|
105
|
+
}];
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
if (opts?.target) {
|
|
109
|
+
generator.target = opts.target;
|
|
110
|
+
}
|
|
111
|
+
return generator;
|
|
112
|
+
} as GeneratorFactory<TanstackQueryOpts | void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// FR-040 §4.1 — this package hosts its own copyable reference generators in
|
|
2
|
+
// `src/reference/`, read through the shared factory so the resolver is not duplicated.
|
|
3
|
+
import { makeReferenceReader } from "@metaobjectsdev/codegen-ts";
|
|
4
|
+
|
|
5
|
+
export const REFERENCE_GENERATOR_NAMES = ["hooks", "grid", "grid-hook"] as const;
|
|
6
|
+
export type ReferenceGeneratorName = (typeof REFERENCE_GENERATOR_NAMES)[number];
|
|
7
|
+
|
|
8
|
+
const reader = makeReferenceReader(import.meta.url, REFERENCE_GENERATOR_NAMES);
|
|
9
|
+
|
|
10
|
+
export function resolveReferenceRoot(): string {
|
|
11
|
+
return reader.resolveReferenceRoot();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function readReferenceTemplate(name: ReferenceGeneratorName): string {
|
|
15
|
+
return reader.readReferenceTemplate(name);
|
|
16
|
+
}
|