@metaobjectsdev/codegen-ts 0.15.13 → 0.15.14-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.
@@ -1 +1 @@
1
- {"version":3,"file":"template-payload-tree.d.ts","sourceRoot":"","sources":["../../src/generators/template-payload-tree.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,QAAQ,EAId,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,WAAW,CAAC,MAAM,CAAa,GACpC,oBAAoB,EAAE,CAyBxB"}
1
+ {"version":3,"file":"template-payload-tree.d.ts","sourceRoot":"","sources":["../../src/generators/template-payload-tree.ts"],"names":[],"mappings":"AAoBA,OAAO,EAEL,KAAK,QAAQ,EAMd,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAY1E;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,WAAW,CAAC,MAAM,CAAa,GACpC,oBAAoB,EAAE,CA0BxB"}
@@ -17,8 +17,15 @@
17
17
  // • isFieldRequired / neutralTypeStr — the SAME helpers the entity Constraints
18
18
  // table uses, so the documented type/required can never drift from the
19
19
  // entity page.
20
- import { FIELD_SUBTYPE_OBJECT, FIELD_ATTR_OBJECT_REF, stripPackage, } from "@metaobjectsdev/metadata";
20
+ import { TYPE_OBJECT, FIELD_SUBTYPE_OBJECT, FIELD_ATTR_OBJECT_REF, stripPackage, refMatchesObject, } from "@metaobjectsdev/metadata";
21
21
  import { isFieldRequired, neutralTypeStr } from "./docs-data-builder.js";
22
+ // ADR-0041: FQN-exact object resolution — a "::"-qualified @objectRef binds the exact
23
+ // package (never a bare-tail fallback), so a same-named object.value in another package
24
+ // can't be wrongly bound (which would attach the wrong owner/type/link to a doc node).
25
+ // Mirrors render-helper.ts's findObject + the CLI payload-field-tree resolver.
26
+ function findObject(root, ref) {
27
+ return root.children().find((c) => c.type === TYPE_OBJECT && refMatchesObject(c, ref));
28
+ }
22
29
  /**
23
30
  * Walk the payload VO `voName` into an enriched `AnnotatePayloadField[]`. Each
24
31
  * node carries `owner` (the short name of the VO that DECLARES the field — the
@@ -33,7 +40,7 @@ import { isFieldRequired, neutralTypeStr } from "./docs-data-builder.js";
33
40
  export function buildEnrichedPayloadTree(root, voName, seen = new Set()) {
34
41
  if (seen.has(voName))
35
42
  return [];
36
- const vo = root.findObject(voName);
43
+ const vo = findObject(root, voName);
37
44
  if (vo === undefined)
38
45
  return [];
39
46
  const owner = stripPackage(vo.name);
@@ -50,8 +57,9 @@ export function buildEnrichedPayloadTree(root, voName, seen = new Set()) {
50
57
  const ref = f.attr(FIELD_ATTR_OBJECT_REF);
51
58
  if (typeof ref === "string" && ref.length > 0) {
52
59
  // Owner switches to the nested VO for its fields (the recursion below
53
- // re-derives `owner` from the resolved VO's own name).
54
- node.fields = buildEnrichedPayloadTree(root, stripPackage(ref), nextSeen);
60
+ // re-derives `owner` from the resolved VO's own name). Pass the FULL ref
61
+ // (not stripPackage) so findObject resolves it FQN-exact (ADR-0041).
62
+ node.fields = buildEnrichedPayloadTree(root, ref, nextSeen);
55
63
  }
56
64
  }
57
65
  out.push(node);
@@ -1 +1 @@
1
- {"version":3,"file":"template-payload-tree.js","sourceRoot":"","sources":["../../src/generators/template-payload-tree.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yCAAyC;AACzC,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,uDAAuD;AACvD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,iF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M,GAAG,wBAAwB,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"template-payload-tree.js","sourceRoot":"","sources":["../../src/generators/template-payload-tree.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yCAAyC;AACzC,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,uDAAuD;AACvD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,6EAA6E;AAC7E,EAAE;AACF,+BAA+B;AAC/B,iFAAiF;AACjF,2EAA2E;AAC3E,mBAAmB;AAEnB,OAAO,EAGL,WAAW,EACX,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGzE,sFAAsF;AACtF,wFAAwF;AACxF,uFAAuF;AACvF,+EAA+E;AAC/E,SAAS,UAAU,CAAC,IAAc,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,IAAI,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC,CAExE,CAAC;AAChB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAc,EACd,MAAc,EACd,OAA4B,IAAI,GAAG,EAAE;IAErC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,EAAE,GAA2B,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,IAAI,EAAE,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3C,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAyB;YACjC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK;YACL,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;YACvB,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC;SAC7B,CAAC;QACF,IAAI,CAAC,CAAC,OAAO,KAAK,oBAAoB,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC9C,sEAAsE;gBACtE,yEAAyE;gBACzE,qEAAqE;gBACrE,IAAI,CAAC,MAAM,GAAG,wBAAwB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YAC9D,CAAC;QACH,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metaobjectsdev/codegen-ts",
3
- "version": "0.15.13",
3
+ "version": "0.15.14-rc.1",
4
4
  "description": "TypeScript codegen engine for MetaObjects — emits Drizzle, Zod, and Fastify artifacts.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -111,8 +111,8 @@
111
111
  "access": "public"
112
112
  },
113
113
  "dependencies": {
114
- "@metaobjectsdev/metadata": "0.15.13",
115
- "@metaobjectsdev/render": "0.15.13",
114
+ "@metaobjectsdev/metadata": "0.15.14-rc.1",
115
+ "@metaobjectsdev/render": "0.15.14-rc.1",
116
116
  "@biomejs/js-api": "^0.7.0",
117
117
  "@biomejs/wasm-nodejs": "^1.9.4",
118
118
  "ts-poet": "^6.10.0"
@@ -123,9 +123,9 @@
123
123
  },
124
124
  "devDependencies": {
125
125
  "@biomejs/biome": "^1.9.0",
126
- "@metaobjectsdev/codegen-ts-react": "0.15.13",
127
- "@metaobjectsdev/migrate-ts": "0.15.13",
128
- "@metaobjectsdev/runtime-ts": "0.15.13",
126
+ "@metaobjectsdev/codegen-ts-react": "0.15.14-rc.1",
127
+ "@metaobjectsdev/migrate-ts": "0.15.14-rc.1",
128
+ "@metaobjectsdev/runtime-ts": "0.15.14-rc.1",
129
129
  "bun-types": "latest",
130
130
  "drizzle-orm": "^0.36.0",
131
131
  "hono": "^4.6.0",
@@ -21,13 +21,25 @@
21
21
  import {
22
22
  type MetaObject,
23
23
  type MetaRoot,
24
+ TYPE_OBJECT,
24
25
  FIELD_SUBTYPE_OBJECT,
25
26
  FIELD_ATTR_OBJECT_REF,
26
27
  stripPackage,
28
+ refMatchesObject,
27
29
  } from "@metaobjectsdev/metadata";
28
30
  import { isFieldRequired, neutralTypeStr } from "./docs-data-builder.js";
29
31
  import type { AnnotatePayloadField } from "./template-source-annotate.js";
30
32
 
33
+ // ADR-0041: FQN-exact object resolution — a "::"-qualified @objectRef binds the exact
34
+ // package (never a bare-tail fallback), so a same-named object.value in another package
35
+ // can't be wrongly bound (which would attach the wrong owner/type/link to a doc node).
36
+ // Mirrors render-helper.ts's findObject + the CLI payload-field-tree resolver.
37
+ function findObject(root: MetaRoot, ref: string): MetaObject | undefined {
38
+ return root.children().find((c) => c.type === TYPE_OBJECT && refMatchesObject(c, ref)) as
39
+ | MetaObject
40
+ | undefined;
41
+ }
42
+
31
43
  /**
32
44
  * Walk the payload VO `voName` into an enriched `AnnotatePayloadField[]`. Each
33
45
  * node carries `owner` (the short name of the VO that DECLARES the field — the
@@ -45,7 +57,7 @@ export function buildEnrichedPayloadTree(
45
57
  seen: ReadonlySet<string> = new Set(),
46
58
  ): AnnotatePayloadField[] {
47
59
  if (seen.has(voName)) return [];
48
- const vo: MetaObject | undefined = root.findObject(voName);
60
+ const vo: MetaObject | undefined = findObject(root, voName);
49
61
  if (vo === undefined) return [];
50
62
  const owner = stripPackage(vo.name);
51
63
  const nextSeen = new Set(seen).add(voName);
@@ -61,8 +73,9 @@ export function buildEnrichedPayloadTree(
61
73
  const ref = f.attr(FIELD_ATTR_OBJECT_REF);
62
74
  if (typeof ref === "string" && ref.length > 0) {
63
75
  // Owner switches to the nested VO for its fields (the recursion below
64
- // re-derives `owner` from the resolved VO's own name).
65
- node.fields = buildEnrichedPayloadTree(root, stripPackage(ref), nextSeen);
76
+ // re-derives `owner` from the resolved VO's own name). Pass the FULL ref
77
+ // (not stripPackage) so findObject resolves it FQN-exact (ADR-0041).
78
+ node.fields = buildEnrichedPayloadTree(root, ref, nextSeen);
66
79
  }
67
80
  }
68
81
  out.push(node);