@metaobjectsdev/codegen-ts-tanstack 0.24.5 → 1.0.0-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.
@@ -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}.$apiPrefix}\${${source}.$path}/\${sourceId}/${e.name}\`),
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}.$apiPrefix}\${${entityName}.$path}/\${id}\`),
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}.$apiPrefix}\${${entityName}.$path}\${qs}\`),
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}.$apiPrefix}\${${entityName}.$path}/\${id}\`),
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}.$apiPrefix}\${${entityName}.$path}\${qs}\`),
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}.$apiPrefix}\${${entityName}.$path}\`, {
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}.$apiPrefix}\${${entityName}.$path}/\${id}\`, {
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}.$apiPrefix}\${${entityName}.$path}/\${id}\`, { method: "DELETE" }),
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/$apiPrefix) and the
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}.$apiPrefix}\${${baseName}.$path}/\${id}\`),
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}.$apiPrefix}\${${baseName}.$path}\${qs}\`),
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}.$apiPrefix}\${${baseName}.$path}/${seg}\``;
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}.$apiPrefix}\${${baseName}.$path}/${seg}\${qs}\`),
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}.$apiPrefix}\${${baseName}.$path}/${seg}/\${id}\`),
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}.$apiPrefix}\${${baseName}.$path}/${seg}/\${id}\`, {
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}.$apiPrefix}\${${baseName}.$path}/${seg}/\${id}\`, { method: "DELETE" }),
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,CAAC,UAAU,EACd,GAAG,CAAC,kBAAkB,EACtB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,IAAI,EACX,GAAG,CAAC,QAAQ,CACb,CAAC;IACF,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU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WAAW,GAAG;;;;;2BAKzC,OAAO;gBAClB,qBAAqB,IAAI,OAAO,YAAY,WAAW;KAClE,oBAAoB,IAAI,OAAO,YAAY,WAAW;oBACvC,mBAAmB;eACxB,iBAAiB;WACrB,cAAc,IAAI,OAAO,YAAY,WAAW;qCACtB,OAAO,KAAK,OAAO;;;;;;;yCAOf,OAAO;;;;;;2BAMrB,OAAO;gBAClB,qBAAqB,IAAI,OAAO,kBAAkB,MAAM,YAAY,WAAW;KAC1F,oBAAoB,IAAI,OAAO,kBAAkB,MAAM,YAAY,WAAW;oBAC/D,mBAAmB;eACxB,iBAAiB;WACrB,cAAc;6CACoB,OAAO,UAAU,QAAQ,WAAW,GAAG;;;;;;;yCAO3C,OAAO;;;;;;2BAMrB,OAAO;gBAClB,qBAAqB,iBAAiB,MAAM;KACvD,oBAAoB,iBAAiB,MAAM;oBAC5B,mBAAmB;eACxB,iBAAiB;WACrB,cAAc;6CACoB,QAAQ,WAAW,GAAG;;;yCAG1B,OAAO;;;;;CAK/C,CAAC;IACA,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAS,QAAQ,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACxF,MAAM,MAAM,GACV,MAAM,gBAAgB,4BAA4B;QAClD,uBAAuB,QAAQ,KAAK,IAAI,CAAC,GAAG,EAAE,8BAA8B,CAAC;IAC/E,OAAO,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/codegen-ts-tanstack",
3
- "version": "0.24.5",
3
+ "version": "1.0.0-rc.1",
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.24.5",
48
- "@metaobjectsdev/codegen-ts": "0.24.5",
47
+ "@metaobjectsdev/metadata": "1.0.0-rc.1",
48
+ "@metaobjectsdev/codegen-ts": "1.0.0-rc.1",
49
49
  "ts-poet": "^6.10.0"
50
50
  },
51
51
  "peerDependencies": {
@@ -53,6 +53,7 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "@biomejs/biome": "^1.9.0",
56
+ "@metaobjectsdev/test-generators": "0.1.0",
56
57
  "bun-types": "latest",
57
58
  "typescript": "^5.6.0"
58
59
  }
@@ -18,7 +18,9 @@
18
18
  // customize: this generator is YOURS. `renderGridHookFile` (exported from
19
19
  // @metaobjectsdev/codegen-ts-tanstack) produces the hook body — wrap it,
20
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).
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).
22
24
 
23
25
  import { type MetaObject } from "@metaobjectsdev/metadata";
24
26
  import {
@@ -31,9 +33,9 @@ import {
31
33
  renderEntityMetaFile,
32
34
  servesReadApi,
33
35
  isTphSubtype,
34
- CODEGEN_ATTR_EMIT_TANSTACK,
35
- CODEGEN_ATTR_EMIT_GRID,
36
36
  withClientDirective,
37
+ namesRef,
38
+ namesConstArg,
37
39
  } from "@metaobjectsdev/codegen-ts";
38
40
  import {
39
41
  renderGridHookFile,
@@ -43,6 +45,23 @@ import {
43
45
 
44
46
  export interface TanstackGridHookOpts {
45
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;
46
65
  target?: string;
47
66
  }
48
67
 
@@ -50,30 +69,40 @@ export interface TanstackGridHookOpts {
50
69
  * Per-entity generator that emits <Entity>.grid.ts — one
51
70
  * use<Entity><Grid>Grid() hook per layout[dataGrid] declared on the entity.
52
71
  *
53
- * Per-entity opt-out via @emitTanstack: false. Per-entity opt-IN: presence of
54
- * at least one dataGrid layout on the object (mirrors tanstackGrid).
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).
55
83
  */
56
84
  export const tanstackGridHook = function tanstackGridHook(opts?: TanstackGridHookOpts): Generator {
57
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);
58
89
  // Every gate EXCEPT the dataGrid-layout opt-in: the framework instance-artifact
59
- // guard (skips abstract types), the metadata opt-out, and the user filter. Split
60
- // out so the discoverability note can name exactly the entities the LAYOUT gate
61
- // alone held back (#287).
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).
62
92
  //
63
- // The TPH clause must MATCH tanstackGrid's exactly. A TPH subtype inherits its base's
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
64
95
  // dataGrid layout via extends, so `hasDataGridLayout` is true for it — but tanstackGrid
65
- // deliberately emits no per-subtype columns without an own `@emitGrid: true` (the base's
66
- // polymorphic grid is the single source of truth). Without the same clause here, a TPH
67
- // subtype got a `<Sub>.grid.ts` whose sibling `<Sub>.columns.tsx` is never emitted:
68
- // a dangling `use<Sub>DefaultGrid()` with nothing to pair it with, and an outright
69
- // TS2307 when the inherited layout carries an `@filter` preset (the hook then imports
70
- // `<sub>DefaultFilter` from the missing columns module).
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).
71
102
  const passesOtherGates = (e: MetaObject): boolean =>
72
103
  servesReadApi(e)
73
- // ADR-0039: resolving — a concrete entity may inherit its @emit* opt-out flag via extends.
74
- && e.attr(CODEGEN_ATTR_EMIT_TANSTACK) !== false
75
104
  && userFilter(e)
76
- && (!isTphSubtype(e) || e.attr(CODEGEN_ATTR_EMIT_GRID) === true);
105
+ && (!isTphSubtype(e) || tphSubtypeGrids(e));
77
106
  const emit = perEntity(async (entity: MetaObject, ctx) => {
78
107
  if (!ctx.renderContext) {
79
108
  throw new Error("tanstack-grid-hook: renderContext is required (provided by runGen)");
@@ -83,10 +112,21 @@ export const tanstackGridHook = function tanstackGridHook(opts?: TanstackGridHoo
83
112
  // the entity generator is scaffold-and-own (ADR-0034), so it cannot be changed
84
113
  // from the package. Emissions are byte-identical between generators, which the
85
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);
86
122
  return [{
87
123
  path: entityOutputPath(ctx.renderContext.outputLayout, entity.package,
88
124
  entityMetaFileName(entity.name)),
89
- content: await formatTs(renderEntityMetaFile(entity, ctx.renderContext.apiPrefix)),
125
+ content: await formatTs(renderEntityMetaFile(
126
+ entity,
127
+ ctx.renderContext.apiPrefix,
128
+ namesConstArg(metaNames),
129
+ )),
90
130
  }, {
91
131
  path: entityOutputPath(
92
132
  ctx.renderContext.outputLayout,
@@ -19,7 +19,8 @@
19
19
  // wrap it, prepend to it, or replace the call entirely with your own
20
20
  // renderer.
21
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).
22
+ // hooks.ts (the query hook a grid usually pairs with),
23
+ // grid-hook.ts (pass it the SAME `tphSubtypeGrids` predicate).
23
24
 
24
25
  import { type MetaObject } from "@metaobjectsdev/metadata";
25
26
  import {
@@ -30,8 +31,6 @@ import {
30
31
  entityOutputPath,
31
32
  servesReadApi,
32
33
  isTphSubtype,
33
- CODEGEN_ATTR_EMIT_TANSTACK,
34
- CODEGEN_ATTR_EMIT_GRID,
35
34
  withClientDirective,
36
35
  } from "@metaobjectsdev/codegen-ts";
37
36
  import {
@@ -42,30 +41,55 @@ import {
42
41
 
43
42
  export interface TanstackGridOpts {
44
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;
45
61
  target?: string;
46
62
  }
47
63
 
48
64
  /**
49
- * Per-entity opt-out via `@emitTanstack: false`. Per-entity opt-IN: presence of
50
- * at least one `dataGrid` layout on the object. If both pass and the user-supplied
51
- * filter passes, the generator emits.
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).
52
75
  */
53
76
  export const tanstackGrid = function tanstackGrid(opts?: TanstackGridOpts): Generator {
54
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);
55
81
  // Every gate EXCEPT the dataGrid-layout opt-in: the framework instance-artifact
56
- // guard (skips abstract types), the metadata opt-out, and the user filter.
82
+ // guard (skips abstract types) and the user filter.
57
83
  // FR-017 Tier 3: a TPH discriminator base emits ONE polymorphic grid. Its
58
84
  // subtypes inherit the base's dataGrid layout via extends, but per-subtype grids
59
- // are opt-IN only (own `@emitGrid: true`) — otherwise the polymorphic grid is the
60
- // single source of truth.
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().
61
87
  // Split out so the discoverability note can name exactly the entities the LAYOUT
62
- // gate alone held back (#287) — an opted-out or abstract type is not a surprise.
88
+ // gate alone held back (#287) — an abstract type is not a surprise.
63
89
  const passesOtherGates = (e: MetaObject): boolean =>
64
90
  servesReadApi(e)
65
- // ADR-0039: resolving — a concrete entity may inherit its @emit* opt-out flag via extends.
66
- && e.attr(CODEGEN_ATTR_EMIT_TANSTACK) !== false
67
91
  && userFilter(e)
68
- && (!isTphSubtype(e) || e.attr(CODEGEN_ATTR_EMIT_GRID) === true);
92
+ && (!isTphSubtype(e) || tphSubtypeGrids(e));
69
93
  const emit = perEntity(async (entity: MetaObject, ctx) => {
70
94
  if (!ctx.renderContext) {
71
95
  throw new Error("tanstack-grid: renderContext is required (provided by runGen)");
@@ -31,8 +31,10 @@ import {
31
31
  renderEntityMetaFile,
32
32
  servesReadApi,
33
33
  isTphSubtype,
34
- CODEGEN_ATTR_EMIT_TANSTACK,
34
+
35
35
  withClientDirective,
36
+ namesRef,
37
+ namesConstArg,
36
38
  } from "@metaobjectsdev/codegen-ts";
37
39
  import { renderHooksFile } from "@metaobjectsdev/codegen-ts-tanstack";
38
40
 
@@ -45,21 +47,24 @@ export interface TanstackQueryOpts {
45
47
  * Per-entity generator that emits <Entity>.hooks.ts — a query-key factory
46
48
  * plus 2 query hooks and 3 mutation hooks backed by useEntityFetcher().
47
49
  *
48
- * Per-entity opt-out via `@emitTanstack: false` is honored. If the user
49
- * supplies their own filter, both must pass (AND).
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).
50
56
  */
51
57
  export const tanstackQuery = function tanstackQuery(opts?: TanstackQueryOpts): Generator {
52
58
  const userFilter = opts?.filter ?? (() => true);
53
59
  const generator: Generator = {
54
60
  name: "tanstack-query",
55
61
  // AND-composes the framework instance-artifact guard (skips abstract types —
56
- // they contribute shape via inheritance only and have no instance to query),
57
- // the metadata opt-out, and the optional user filter. Projections still pass
58
- // here and get read-only hooks via renderHooksFile's isProjection branch.
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.
59
65
  // FR-017 Tier 3: TPH subtypes get no standalone hooks file — their per-subtype
60
66
  // hooks live in the discriminator base's hooks file (polymorphic + per-subtype).
61
- // ADR-0039: resolving a concrete entity may inherit @emitTanstack via extends.
62
- filter: (e: MetaObject) => servesReadApi(e) && e.attr(CODEGEN_ATTR_EMIT_TANSTACK) !== false && !isTphSubtype(e) && userFilter(e),
67
+ filter: (e: MetaObject) => servesReadApi(e) && !isTphSubtype(e) && userFilter(e),
63
68
  generate: perEntity(async (entity, ctx) => {
64
69
  if (!ctx.renderContext) {
65
70
  throw new Error(
@@ -70,10 +75,24 @@ export const tanstackQuery = function tanstackQuery(opts?: TanstackQueryOpts): G
70
75
  // generator: the entity generator is scaffold-and-own (ADR-0034), so it cannot
71
76
  // be changed from the package. Emissions are byte-identical between generators,
72
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);
73
88
  const metaFile = {
74
89
  path: entityOutputPath(ctx.renderContext.outputLayout, entity.package,
75
90
  entityMetaFileName(entity.name)),
76
- content: await formatTs(renderEntityMetaFile(entity, ctx.renderContext.apiPrefix)),
91
+ content: await formatTs(renderEntityMetaFile(
92
+ entity,
93
+ ctx.renderContext.apiPrefix,
94
+ namesConstArg(metaNames),
95
+ )),
77
96
  };
78
97
  return [metaFile, {
79
98
  path: entityOutputPath(ctx.renderContext.outputLayout, entity.package, `${entity.name}.hooks.ts`),
@@ -1,12 +1,29 @@
1
1
  import type { MetaObject } from "@metaobjectsdev/metadata";
2
- import { perEntity, type Generator, type GeneratorFactory, formatTs, entityOutputPath, entityMetaFileName, renderEntityMetaFile, servesReadApi, isTphSubtype, CODEGEN_ATTR_EMIT_TANSTACK, CODEGEN_ATTR_EMIT_GRID,
3
- withClientDirective,
2
+ import { perEntity, type Generator, type GeneratorFactory, formatTs, entityOutputPath, entityMetaFileName, renderEntityMetaFile, servesReadApi, isTphSubtype,
3
+ withClientDirective, namesRef, namesConstArg,
4
4
  } from "@metaobjectsdev/codegen-ts";
5
5
  import { hasDataGridLayout, warnMissingDataGridLayout } from "./data-grid-gate.js";
6
6
  import { renderGridHookFile } from "./templates/grid-hook-file.js";
7
7
 
8
8
  export interface TanstackGridHookOpts {
9
9
  filter?: (entity: MetaObject) => boolean;
10
+ /**
11
+ * Opt a TPH subtype IN to its own per-subtype grid. Default `() => false`: a
12
+ * discriminator base emits ONE polymorphic grid and its subtypes emit none, which is
13
+ * the single-source-of-truth arrangement almost every TPH model wants.
14
+ *
15
+ * This is an OPTION rather than a `filter` clause because it WIDENS. A `filter` is
16
+ * ANDed with the built-in gates, so it can only ever narrow — an opt-in is not
17
+ * expressible through it. (It is not a metadata attribute either: `@emitGrid` was
18
+ * never registered vocabulary, so authoring it failed `meta verify`.)
19
+ *
20
+ * Pass the SAME predicate to `tanstackGrid()` and `tanstackGridHook()`. If they
21
+ * disagree you reproduce #287 exactly: the hook emits a `<Sub>.grid.ts` whose sibling
22
+ * `<Sub>.columns.tsx` is never emitted — a dangling `use<Sub>DefaultGrid()`, and an
23
+ * outright TS2307 when the inherited layout carries an `@filter` preset, since the hook
24
+ * then imports `<sub>DefaultFilter` from the missing columns module.
25
+ */
26
+ tphSubtypeGrids?: (entity: MetaObject) => boolean;
10
27
  target?: string;
11
28
  }
12
29
 
@@ -14,30 +31,40 @@ export interface TanstackGridHookOpts {
14
31
  * Per-entity generator that emits <Entity>.grid.ts — one
15
32
  * use<Entity><Grid>Grid() hook per layout[dataGrid] declared on the entity.
16
33
  *
17
- * Per-entity opt-out via @emitTanstack: false. Per-entity opt-IN: presence of
18
- * at least one dataGrid layout on the object (mirrors tanstackGrid).
34
+ * Per-entity opt-IN: presence of at least one dataGrid layout on the object
35
+ * (mirrors tanstackGrid).
36
+ *
37
+ * A TPH subtype additionally needs `tphSubtypeGrids` — pass the SAME predicate to
38
+ * tanstackGrid(), or this generator emits a `<Sub>.grid.ts` with no `<Sub>.columns.tsx`
39
+ * beside it.
40
+ *
41
+ * Decide per generator what you consume: wire only the generators whose output you
42
+ * actually import, and narrow this one with its `filter` option. There is no `@emit*`
43
+ * metadata attribute — those were never registered vocabulary, so `meta verify` rejects
44
+ * them (ERR_UNKNOWN_ATTR).
19
45
  */
20
46
  export const tanstackGridHook = function tanstackGridHook(opts?: TanstackGridHookOpts): Generator {
21
47
  const userFilter = opts?.filter ?? (() => true);
48
+ // Default OFF — byte-identical to the behaviour every project that never declared a
49
+ // per-subtype grid already had.
50
+ const tphSubtypeGrids = opts?.tphSubtypeGrids ?? (() => false);
22
51
  // Every gate EXCEPT the dataGrid-layout opt-in: the framework instance-artifact
23
- // guard (skips abstract types), the metadata opt-out, and the user filter. Split
24
- // out so the discoverability note can name exactly the entities the LAYOUT gate
25
- // alone held back (#287).
52
+ // guard (skips abstract types) and the user filter. Split out so the discoverability
53
+ // note can name exactly the entities the LAYOUT gate alone held back (#287).
26
54
  //
27
- // The TPH clause must MATCH tanstackGrid's exactly. A TPH subtype inherits its base's
55
+ // The TPH clause must MATCH tanstackGrid's exactly, which means the SAME
56
+ // `tphSubtypeGrids` predicate must be passed to both. A TPH subtype inherits its base's
28
57
  // dataGrid layout via extends, so `hasDataGridLayout` is true for it — but tanstackGrid
29
- // deliberately emits no per-subtype columns without an own `@emitGrid: true` (the base's
30
- // polymorphic grid is the single source of truth). Without the same clause here, a TPH
31
- // subtype got a `<Sub>.grid.ts` whose sibling `<Sub>.columns.tsx` is never emitted:
32
- // a dangling `use<Sub>DefaultGrid()` with nothing to pair it with, and an outright
33
- // TS2307 when the inherited layout carries an `@filter` preset (the hook then imports
34
- // `<sub>DefaultFilter` from the missing columns module).
58
+ // deliberately emits no per-subtype columns unless `tphSubtypeGrids` opts it in (the
59
+ // base's polymorphic grid is the single source of truth). Where the two predicates
60
+ // disagree, a TPH subtype gets a `<Sub>.grid.ts` whose sibling `<Sub>.columns.tsx` is
61
+ // never emitted: a dangling `use<Sub>DefaultGrid()` with nothing to pair it with, and an
62
+ // outright TS2307 when the inherited layout carries an `@filter` preset (the hook then
63
+ // imports `<sub>DefaultFilter` from the missing columns module).
35
64
  const passesOtherGates = (e: MetaObject): boolean =>
36
65
  servesReadApi(e)
37
- // ADR-0039: resolving — a concrete entity may inherit its @emit* opt-out flag via extends.
38
- && e.attr(CODEGEN_ATTR_EMIT_TANSTACK) !== false
39
66
  && userFilter(e)
40
- && (!isTphSubtype(e) || e.attr(CODEGEN_ATTR_EMIT_GRID) === true);
67
+ && (!isTphSubtype(e) || tphSubtypeGrids(e));
41
68
  const emit = perEntity(async (entity: MetaObject, ctx) => {
42
69
  if (!ctx.renderContext) {
43
70
  throw new Error("tanstack-grid-hook: renderContext is required (provided by runGen)");
@@ -47,10 +74,21 @@ export const tanstackGridHook = function tanstackGridHook(opts?: TanstackGridHoo
47
74
  // the entity generator is scaffold-and-own (ADR-0034), so it cannot be changed
48
75
  // from the package. Emissions are byte-identical between generators, which the
49
76
  // runner collapses (#266).
77
+ //
78
+ // §A6/§B2 — same `namesRef` pair every other §A6 site builds, scoped to THIS
79
+ // generator's own render context (see tanstack-query.ts's matching comment for why
80
+ // `.meta.ts` needs its own target-scoped check rather than reusing the entity
81
+ // module's).
82
+ const rc = ctx.renderContext;
83
+ const metaNames = namesRef(entity, rc);
50
84
  return [{
51
85
  path: entityOutputPath(ctx.renderContext.outputLayout, entity.package,
52
86
  entityMetaFileName(entity.name)),
53
- content: await formatTs(renderEntityMetaFile(entity, ctx.renderContext.apiPrefix)),
87
+ content: await formatTs(renderEntityMetaFile(
88
+ entity,
89
+ ctx.renderContext.apiPrefix,
90
+ namesConstArg(metaNames),
91
+ )),
54
92
  }, {
55
93
  path: entityOutputPath(
56
94
  ctx.renderContext.outputLayout,