@metaobjectsdev/codegen-ts-tanstack 1.0.2 → 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/generator-registry.d.ts +3 -0
- package/dist/generator-registry.d.ts.map +1 -0
- package/dist/generator-registry.js +61 -0
- package/dist/generator-registry.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/generator-registry.ts +67 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-registry.d.ts","sourceRoot":"","sources":["../src/generator-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAWzE,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAoD5E,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// ADR-0021 D3 — this package's SLICE of the stable-name generator registry.
|
|
2
|
+
// See the react package's copy for why the catalog is composed rather than central.
|
|
3
|
+
import { tanstackQuery } from "./tanstack-query.js";
|
|
4
|
+
import { tanstackGrid } from "./tanstack-grid.js";
|
|
5
|
+
import { tanstackGridHook } from "./tanstack-grid-hook.js";
|
|
6
|
+
import { REFERENCE_GENERATOR_NAMES } from "./reference-templates.js";
|
|
7
|
+
/** True iff this package ships a copyable reference template for `name`. */
|
|
8
|
+
function ejectable(name) {
|
|
9
|
+
return REFERENCE_GENERATOR_NAMES.includes(name);
|
|
10
|
+
}
|
|
11
|
+
export const tanstackGeneratorRegistry = {
|
|
12
|
+
hooks: {
|
|
13
|
+
name: "hooks",
|
|
14
|
+
kind: "generator",
|
|
15
|
+
layer: "client",
|
|
16
|
+
description: "Per-entity TanStack Query hooks (useEntity / useEntities / useCreate / useUpdate / useDelete).",
|
|
17
|
+
tier: "native",
|
|
18
|
+
factory: () => tanstackQuery(),
|
|
19
|
+
options: "filter?, target?",
|
|
20
|
+
framework: "tanstack",
|
|
21
|
+
requires: ["entity"],
|
|
22
|
+
runtimePackages: ["@metaobjectsdev/runtime-web", "@metaobjectsdev/tanstack"],
|
|
23
|
+
runtimePeers: ["@tanstack/react-query"],
|
|
24
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
25
|
+
ejectable: ejectable("hooks"),
|
|
26
|
+
},
|
|
27
|
+
grid: {
|
|
28
|
+
name: "grid",
|
|
29
|
+
kind: "generator",
|
|
30
|
+
layer: "client",
|
|
31
|
+
description: "Per-entity TanStack Table column definitions, from a layout.dataGrid declaration.",
|
|
32
|
+
tier: "native",
|
|
33
|
+
factory: () => tanstackGrid(),
|
|
34
|
+
options: "filter?, tphSubtypeGrids?, target?",
|
|
35
|
+
framework: "tanstack",
|
|
36
|
+
requires: ["entity"],
|
|
37
|
+
runtimePeers: ["@tanstack/react-table"],
|
|
38
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
39
|
+
ejectable: ejectable("grid"),
|
|
40
|
+
},
|
|
41
|
+
"grid-hook": {
|
|
42
|
+
name: "grid-hook",
|
|
43
|
+
kind: "generator",
|
|
44
|
+
layer: "client",
|
|
45
|
+
description: "Per-entity server-driven grid state hook (sort/filter/page) over the generated columns.",
|
|
46
|
+
tier: "native",
|
|
47
|
+
factory: () => tanstackGridHook(),
|
|
48
|
+
options: "filter?, tphSubtypeGrids?, target?",
|
|
49
|
+
framework: "tanstack",
|
|
50
|
+
// `grid` is here because the emitted hook imports the columns module's filter
|
|
51
|
+
// PRESET constants — an edge that only exists when a layout.dataGrid declares a
|
|
52
|
+
// `filter`. Derived, not assumed: the probe fixture declares one precisely so this
|
|
53
|
+
// edge is visible to the gate rather than left to prose.
|
|
54
|
+
requires: ["entity", "grid", "hooks"],
|
|
55
|
+
runtimePackages: ["@metaobjectsdev/runtime-web", "@metaobjectsdev/tanstack"],
|
|
56
|
+
runtimePeers: ["@tanstack/react-query", "@tanstack/react-table", "react"],
|
|
57
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
58
|
+
ejectable: ejectable("grid-hook"),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=generator-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-registry.js","sourceRoot":"","sources":["../src/generator-registry.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,oFAAoF;AAGpF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,4EAA4E;AAC5E,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAQ,yBAA+C,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,CAAC,MAAM,yBAAyB,GAA2C;IAC/E,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,gGAAgG;QAClG,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE;QAC9B,OAAO,EAAE,kBAAkB;QAC3B,SAAS,EAAE,UAAU;QACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,eAAe,EAAE,CAAC,6BAA6B,EAAE,0BAA0B,CAAC;QAC5E,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,UAAU,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC;QAC3C,SAAS,EAAE,SAAS,CAAC,OAAO,CAAC;KAC9B;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,mFAAmF;QACrF,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,EAAE;QAC7B,OAAO,EAAE,oCAAoC;QAC7C,SAAS,EAAE,UAAU;QACrB,QAAQ,EAAE,CAAC,QAAQ,CAAC;QACpB,YAAY,EAAE,CAAC,uBAAuB,CAAC;QACvC,UAAU,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC;QAC3C,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC;KAC7B;IACD,WAAW,EAAE;QACX,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,yFAAyF;QAC3F,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,EAAE;QACjC,OAAO,EAAE,oCAAoC;QAC7C,SAAS,EAAE,UAAU;QACrB,8EAA8E;QAC9E,gFAAgF;QAChF,mFAAmF;QACnF,yDAAyD;QACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;QACrC,eAAe,EAAE,CAAC,6BAA6B,EAAE,0BAA0B,CAAC;QAC5E,YAAY,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,OAAO,CAAC;QACzE,UAAU,EAAE,CAAC,UAAU,EAAE,iBAAiB,CAAC;QAC3C,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC;KAClC;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { tanstackQuery, type TanstackQueryOpts } from "./tanstack-query.js";
|
|
2
2
|
export { tanstackGrid, type TanstackGridOpts } from "./tanstack-grid.js";
|
|
3
3
|
export { tanstackGridHook, type TanstackGridHookOpts } from "./tanstack-grid-hook.js";
|
|
4
|
+
export { tanstackGeneratorRegistry } from "./generator-registry.js";
|
|
4
5
|
export { renderHooksFile } from "./templates/hooks-file.js";
|
|
5
6
|
export { renderColumnsFile } from "./templates/columns-file.js";
|
|
6
7
|
export { renderGridHookFile } from "./templates/grid-hook-file.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAItF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAInF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGlH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAItF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAIpE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAMnE,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAInF,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAGlH,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
export { tanstackQuery } from "./tanstack-query.js";
|
|
3
3
|
export { tanstackGrid } from "./tanstack-grid.js";
|
|
4
4
|
export { tanstackGridHook } from "./tanstack-grid-hook.js";
|
|
5
|
+
// ADR-0021 D3 — this package's slice of the stable-name generator registry. The CLI
|
|
6
|
+
// unions the three slices into the catalog behind `meta gen --list`.
|
|
7
|
+
export { tanstackGeneratorRegistry } from "./generator-registry.js";
|
|
5
8
|
// FR-040 §4.2(b) — public so an owned generator composes the engine rather than
|
|
6
9
|
// forking it. Signatures are stable API: (entity, ctx) => string.
|
|
7
10
|
export { renderHooksFile } from "./templates/hooks-file.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAA6B,MAAM,yBAAyB,CAAC;AAEtF,gFAAgF;AAChF,kEAAkE;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,sFAAsF;AACtF,uFAAuF;AACvF,gFAAgF;AAChF,yBAAyB;AACzB,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,wEAAwE;AACxE,8EAA8E;AAC9E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,OAAO,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAA6B,MAAM,yBAAyB,CAAC;AAEtF,oFAAoF;AACpF,qEAAqE;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEpE,gFAAgF;AAChF,kEAAkE;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,sFAAsF;AACtF,uFAAuF;AACvF,gFAAgF;AAChF,yBAAyB;AACzB,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEnF,wEAAwE;AACxE,8EAA8E;AAC9E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metaobjectsdev/codegen-ts-tanstack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4-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": "1.0.
|
|
48
|
-
"@metaobjectsdev/codegen-ts": "1.0.
|
|
47
|
+
"@metaobjectsdev/metadata": "1.0.4-rc.1",
|
|
48
|
+
"@metaobjectsdev/codegen-ts": "1.0.4-rc.1",
|
|
49
49
|
"ts-poet": "^6.10.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// ADR-0021 D3 — this package's SLICE of the stable-name generator registry.
|
|
2
|
+
// See the react package's copy for why the catalog is composed rather than central.
|
|
3
|
+
|
|
4
|
+
import type { GeneratorRegistryEntry } from "@metaobjectsdev/codegen-ts";
|
|
5
|
+
import { tanstackQuery } from "./tanstack-query.js";
|
|
6
|
+
import { tanstackGrid } from "./tanstack-grid.js";
|
|
7
|
+
import { tanstackGridHook } from "./tanstack-grid-hook.js";
|
|
8
|
+
import { REFERENCE_GENERATOR_NAMES } from "./reference-templates.js";
|
|
9
|
+
|
|
10
|
+
/** True iff this package ships a copyable reference template for `name`. */
|
|
11
|
+
function ejectable(name: string): boolean {
|
|
12
|
+
return (REFERENCE_GENERATOR_NAMES as readonly string[]).includes(name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const tanstackGeneratorRegistry: Record<string, GeneratorRegistryEntry> = {
|
|
16
|
+
hooks: {
|
|
17
|
+
name: "hooks",
|
|
18
|
+
kind: "generator",
|
|
19
|
+
layer: "client",
|
|
20
|
+
description:
|
|
21
|
+
"Per-entity TanStack Query hooks (useEntity / useEntities / useCreate / useUpdate / useDelete).",
|
|
22
|
+
tier: "native",
|
|
23
|
+
factory: () => tanstackQuery(),
|
|
24
|
+
options: "filter?, target?",
|
|
25
|
+
framework: "tanstack",
|
|
26
|
+
requires: ["entity"],
|
|
27
|
+
runtimePackages: ["@metaobjectsdev/runtime-web", "@metaobjectsdev/tanstack"],
|
|
28
|
+
runtimePeers: ["@tanstack/react-query"],
|
|
29
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
30
|
+
ejectable: ejectable("hooks"),
|
|
31
|
+
},
|
|
32
|
+
grid: {
|
|
33
|
+
name: "grid",
|
|
34
|
+
kind: "generator",
|
|
35
|
+
layer: "client",
|
|
36
|
+
description:
|
|
37
|
+
"Per-entity TanStack Table column definitions, from a layout.dataGrid declaration.",
|
|
38
|
+
tier: "native",
|
|
39
|
+
factory: () => tanstackGrid(),
|
|
40
|
+
options: "filter?, tphSubtypeGrids?, target?",
|
|
41
|
+
framework: "tanstack",
|
|
42
|
+
requires: ["entity"],
|
|
43
|
+
runtimePeers: ["@tanstack/react-table"],
|
|
44
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
45
|
+
ejectable: ejectable("grid"),
|
|
46
|
+
},
|
|
47
|
+
"grid-hook": {
|
|
48
|
+
name: "grid-hook",
|
|
49
|
+
kind: "generator",
|
|
50
|
+
layer: "client",
|
|
51
|
+
description:
|
|
52
|
+
"Per-entity server-driven grid state hook (sort/filter/page) over the generated columns.",
|
|
53
|
+
tier: "native",
|
|
54
|
+
factory: () => tanstackGridHook(),
|
|
55
|
+
options: "filter?, tphSubtypeGrids?, target?",
|
|
56
|
+
framework: "tanstack",
|
|
57
|
+
// `grid` is here because the emitted hook imports the columns module's filter
|
|
58
|
+
// PRESET constants — an edge that only exists when a layout.dataGrid declares a
|
|
59
|
+
// `filter`. Derived, not assumed: the probe fixture declares one precisely so this
|
|
60
|
+
// edge is visible to the gate rather than left to prose.
|
|
61
|
+
requires: ["entity", "grid", "hooks"],
|
|
62
|
+
runtimePackages: ["@metaobjectsdev/runtime-web", "@metaobjectsdev/tanstack"],
|
|
63
|
+
runtimePeers: ["@tanstack/react-query", "@tanstack/react-table", "react"],
|
|
64
|
+
configKeys: ["extStyle", "clientDirective"],
|
|
65
|
+
ejectable: ejectable("grid-hook"),
|
|
66
|
+
},
|
|
67
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,10 @@ 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
5
|
|
|
6
|
+
// ADR-0021 D3 — this package's slice of the stable-name generator registry. The CLI
|
|
7
|
+
// unions the three slices into the catalog behind `meta gen --list`.
|
|
8
|
+
export { tanstackGeneratorRegistry } from "./generator-registry.js";
|
|
9
|
+
|
|
6
10
|
// FR-040 §4.2(b) — public so an owned generator composes the engine rather than
|
|
7
11
|
// forking it. Signatures are stable API: (entity, ctx) => string.
|
|
8
12
|
export { renderHooksFile } from "./templates/hooks-file.js";
|