@metaobjectsdev/codegen-ts 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.
Files changed (237) hide show
  1. package/README.md +37 -12
  2. package/dist/api-surface.d.ts +29 -0
  3. package/dist/api-surface.d.ts.map +1 -1
  4. package/dist/api-surface.js +47 -0
  5. package/dist/api-surface.js.map +1 -1
  6. package/dist/column-mapper.d.ts +12 -0
  7. package/dist/column-mapper.d.ts.map +1 -1
  8. package/dist/column-mapper.js +1 -0
  9. package/dist/column-mapper.js.map +1 -1
  10. package/dist/constants.d.ts +24 -11
  11. package/dist/constants.d.ts.map +1 -1
  12. package/dist/constants.js +54 -19
  13. package/dist/constants.js.map +1 -1
  14. package/dist/db-emitting.d.ts +6 -0
  15. package/dist/db-emitting.d.ts.map +1 -0
  16. package/dist/db-emitting.js +26 -0
  17. package/dist/db-emitting.js.map +1 -0
  18. package/dist/generator-registry.d.ts.map +1 -1
  19. package/dist/generator-registry.js +14 -1
  20. package/dist/generator-registry.js.map +1 -1
  21. package/dist/generator.d.ts +5 -0
  22. package/dist/generator.d.ts.map +1 -1
  23. package/dist/generator.js.map +1 -1
  24. package/dist/generators/agent-docs-file.d.ts +19 -0
  25. package/dist/generators/agent-docs-file.d.ts.map +1 -0
  26. package/dist/generators/agent-docs-file.js +257 -0
  27. package/dist/generators/agent-docs-file.js.map +1 -0
  28. package/dist/generators/agent-requirements-page.d.ts +22 -0
  29. package/dist/generators/agent-requirements-page.d.ts.map +1 -0
  30. package/dist/generators/agent-requirements-page.js +175 -0
  31. package/dist/generators/agent-requirements-page.js.map +1 -0
  32. package/dist/generators/agent-schema-input.d.ts +69 -0
  33. package/dist/generators/agent-schema-input.d.ts.map +1 -0
  34. package/dist/generators/agent-schema-input.js +23 -0
  35. package/dist/generators/agent-schema-input.js.map +1 -0
  36. package/dist/generators/agent-schema-page.d.ts +21 -0
  37. package/dist/generators/agent-schema-page.d.ts.map +1 -0
  38. package/dist/generators/agent-schema-page.js +241 -0
  39. package/dist/generators/agent-schema-page.js.map +1 -0
  40. package/dist/generators/agent-ui-page.d.ts +22 -0
  41. package/dist/generators/agent-ui-page.d.ts.map +1 -0
  42. package/dist/generators/agent-ui-page.js +253 -0
  43. package/dist/generators/agent-ui-page.js.map +1 -0
  44. package/dist/generators/api-docs-file.d.ts.map +1 -1
  45. package/dist/generators/api-docs-file.js +13 -6
  46. package/dist/generators/api-docs-file.js.map +1 -1
  47. package/dist/generators/api-model.d.ts +6 -0
  48. package/dist/generators/api-model.d.ts.map +1 -1
  49. package/dist/generators/api-model.js +54 -35
  50. package/dist/generators/api-model.js.map +1 -1
  51. package/dist/generators/callable-file.js +1 -1
  52. package/dist/generators/callable-file.js.map +1 -1
  53. package/dist/generators/docs-data-builder.d.ts.map +1 -1
  54. package/dist/generators/docs-data-builder.js +47 -2
  55. package/dist/generators/docs-data-builder.js.map +1 -1
  56. package/dist/generators/docs-data.d.ts +6 -2
  57. package/dist/generators/docs-data.d.ts.map +1 -1
  58. package/dist/generators/index.d.ts +3 -8
  59. package/dist/generators/index.d.ts.map +1 -1
  60. package/dist/generators/index.js +19 -14
  61. package/dist/generators/index.js.map +1 -1
  62. package/dist/generators/names-file.d.ts +17 -0
  63. package/dist/generators/names-file.d.ts.map +1 -0
  64. package/dist/generators/names-file.js +95 -0
  65. package/dist/generators/names-file.js.map +1 -0
  66. package/dist/generators/requirements-markdown.d.ts +18 -1
  67. package/dist/generators/requirements-markdown.d.ts.map +1 -1
  68. package/dist/generators/requirements-markdown.js +11 -9
  69. package/dist/generators/requirements-markdown.js.map +1 -1
  70. package/dist/generators/routes-file-hono.d.ts +17 -2
  71. package/dist/generators/routes-file-hono.d.ts.map +1 -1
  72. package/dist/generators/routes-file-hono.js +9 -11
  73. package/dist/generators/routes-file-hono.js.map +1 -1
  74. package/dist/generators/routes-file.d.ts +17 -2
  75. package/dist/generators/routes-file.d.ts.map +1 -1
  76. package/dist/generators/routes-file.js +10 -8
  77. package/dist/generators/routes-file.js.map +1 -1
  78. package/dist/generators/template-generator.d.ts.map +1 -1
  79. package/dist/generators/template-generator.js +20 -6
  80. package/dist/generators/template-generator.js.map +1 -1
  81. package/dist/index.d.ts +20 -5
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +43 -4
  84. package/dist/index.js.map +1 -1
  85. package/dist/metaobjects-config.d.ts +38 -1
  86. package/dist/metaobjects-config.d.ts.map +1 -1
  87. package/dist/metaobjects-config.js +9 -1
  88. package/dist/metaobjects-config.js.map +1 -1
  89. package/dist/names.d.ts +275 -0
  90. package/dist/names.d.ts.map +1 -0
  91. package/dist/names.js +433 -0
  92. package/dist/names.js.map +1 -0
  93. package/dist/overwrite-policy.d.ts.map +1 -1
  94. package/dist/overwrite-policy.js +15 -3
  95. package/dist/overwrite-policy.js.map +1 -1
  96. package/dist/projection/extract-view-spec.d.ts +25 -1
  97. package/dist/projection/extract-view-spec.d.ts.map +1 -1
  98. package/dist/projection/extract-view-spec.js +79 -6
  99. package/dist/projection/extract-view-spec.js.map +1 -1
  100. package/dist/reference-templates.d.ts +1 -1
  101. package/dist/reference-templates.d.ts.map +1 -1
  102. package/dist/reference-templates.js +1 -1
  103. package/dist/reference-templates.js.map +1 -1
  104. package/dist/render-context.d.ts +12 -1
  105. package/dist/render-context.d.ts.map +1 -1
  106. package/dist/render-context.js +1 -0
  107. package/dist/render-context.js.map +1 -1
  108. package/dist/retired-codegen-attrs.d.ts +32 -0
  109. package/dist/retired-codegen-attrs.d.ts.map +1 -0
  110. package/dist/retired-codegen-attrs.js +47 -0
  111. package/dist/retired-codegen-attrs.js.map +1 -0
  112. package/dist/routes-expose.d.ts +63 -0
  113. package/dist/routes-expose.d.ts.map +1 -0
  114. package/dist/routes-expose.js +57 -0
  115. package/dist/routes-expose.js.map +1 -0
  116. package/dist/runner.d.ts +18 -0
  117. package/dist/runner.d.ts.map +1 -1
  118. package/dist/runner.js +109 -7
  119. package/dist/runner.js.map +1 -1
  120. package/dist/templates/callable-file.d.ts +7 -2
  121. package/dist/templates/callable-file.d.ts.map +1 -1
  122. package/dist/templates/callable-file.js +54 -9
  123. package/dist/templates/callable-file.js.map +1 -1
  124. package/dist/templates/drizzle-schema.d.ts.map +1 -1
  125. package/dist/templates/drizzle-schema.js +236 -65
  126. package/dist/templates/drizzle-schema.js.map +1 -1
  127. package/dist/templates/entity-constants.d.ts +15 -6
  128. package/dist/templates/entity-constants.d.ts.map +1 -1
  129. package/dist/templates/entity-constants.js +85 -161
  130. package/dist/templates/entity-constants.js.map +1 -1
  131. package/dist/templates/entity-file.d.ts.map +1 -1
  132. package/dist/templates/entity-file.js +38 -4
  133. package/dist/templates/entity-file.js.map +1 -1
  134. package/dist/templates/entity-meta-file.d.ts +15 -1
  135. package/dist/templates/entity-meta-file.d.ts.map +1 -1
  136. package/dist/templates/entity-meta-file.js +12 -2
  137. package/dist/templates/entity-meta-file.js.map +1 -1
  138. package/dist/templates/entity-ui-descriptor.d.ts +112 -0
  139. package/dist/templates/entity-ui-descriptor.d.ts.map +1 -0
  140. package/dist/templates/entity-ui-descriptor.js +238 -0
  141. package/dist/templates/entity-ui-descriptor.js.map +1 -0
  142. package/dist/templates/field-meta.d.ts +46 -9
  143. package/dist/templates/field-meta.d.ts.map +1 -1
  144. package/dist/templates/field-meta.js +95 -21
  145. package/dist/templates/field-meta.js.map +1 -1
  146. package/dist/templates/names-decl.d.ts +38 -0
  147. package/dist/templates/names-decl.d.ts.map +1 -0
  148. package/dist/templates/names-decl.js +104 -0
  149. package/dist/templates/names-decl.js.map +1 -0
  150. package/dist/templates/projection-decl.d.ts +21 -0
  151. package/dist/templates/projection-decl.d.ts.map +1 -1
  152. package/dist/templates/projection-decl.js +53 -29
  153. package/dist/templates/projection-decl.js.map +1 -1
  154. package/dist/templates/queries-file.d.ts.map +1 -1
  155. package/dist/templates/queries-file.js +17 -2
  156. package/dist/templates/queries-file.js.map +1 -1
  157. package/dist/templates/requirement-test.d.ts.map +1 -1
  158. package/dist/templates/requirement-test.js +13 -2
  159. package/dist/templates/requirement-test.js.map +1 -1
  160. package/dist/templates/routes-file-hono.d.ts +2 -1
  161. package/dist/templates/routes-file-hono.d.ts.map +1 -1
  162. package/dist/templates/routes-file-hono.js +11 -2
  163. package/dist/templates/routes-file-hono.js.map +1 -1
  164. package/dist/templates/routes-file.d.ts +2 -1
  165. package/dist/templates/routes-file.d.ts.map +1 -1
  166. package/dist/templates/routes-file.js +54 -21
  167. package/dist/templates/routes-file.js.map +1 -1
  168. package/dist/templates/value-object-file.d.ts.map +1 -1
  169. package/dist/templates/value-object-file.js +15 -1
  170. package/dist/templates/value-object-file.js.map +1 -1
  171. package/dist/templates/view-decl.d.ts +37 -1
  172. package/dist/templates/view-decl.d.ts.map +1 -1
  173. package/dist/templates/view-decl.js +27 -3
  174. package/dist/templates/view-decl.js.map +1 -1
  175. package/dist/templates/zod-validators.d.ts +21 -0
  176. package/dist/templates/zod-validators.d.ts.map +1 -1
  177. package/dist/templates/zod-validators.js +40 -5
  178. package/dist/templates/zod-validators.js.map +1 -1
  179. package/dist/view-context.d.ts +24 -0
  180. package/dist/view-context.d.ts.map +1 -0
  181. package/dist/view-context.js +81 -0
  182. package/dist/view-context.js.map +1 -0
  183. package/package.json +6 -6
  184. package/src/api-surface.ts +53 -0
  185. package/src/column-mapper.ts +13 -0
  186. package/src/constants.ts +91 -16
  187. package/src/db-emitting.ts +31 -0
  188. package/src/generator-registry.ts +14 -4
  189. package/src/generator.ts +5 -0
  190. package/src/generators/agent-docs-file.ts +297 -0
  191. package/src/generators/agent-requirements-page.ts +199 -0
  192. package/src/generators/agent-schema-input.ts +88 -0
  193. package/src/generators/agent-schema-page.ts +297 -0
  194. package/src/generators/agent-ui-page.ts +290 -0
  195. package/src/generators/api-docs-file.ts +13 -6
  196. package/src/generators/api-model.ts +63 -34
  197. package/src/generators/callable-file.ts +1 -1
  198. package/src/generators/docs-data-builder.ts +46 -2
  199. package/src/generators/docs-data.ts +6 -2
  200. package/src/generators/index.ts +25 -14
  201. package/src/generators/names-file.ts +98 -0
  202. package/src/generators/requirements-markdown.ts +36 -2
  203. package/src/generators/routes-file-hono.ts +19 -10
  204. package/src/generators/routes-file.ts +20 -7
  205. package/src/generators/template-generator.ts +20 -6
  206. package/src/index.ts +64 -4
  207. package/src/metaobjects-config.ts +48 -2
  208. package/src/names.ts +629 -0
  209. package/src/overwrite-policy.ts +15 -3
  210. package/src/projection/extract-view-spec.ts +85 -6
  211. package/src/reference/entity.ts +21 -2
  212. package/src/reference/names.ts +125 -0
  213. package/src/reference/queries.ts +19 -3
  214. package/src/reference/routes-hono.ts +19 -9
  215. package/src/reference/routes.ts +25 -9
  216. package/src/reference-templates.ts +1 -1
  217. package/src/render-context.ts +13 -1
  218. package/src/retired-codegen-attrs.ts +52 -0
  219. package/src/routes-expose.ts +86 -0
  220. package/src/runner.ts +122 -11
  221. package/src/templates/callable-file.ts +60 -8
  222. package/src/templates/drizzle-schema.ts +248 -60
  223. package/src/templates/entity-constants.ts +95 -184
  224. package/src/templates/entity-file.ts +46 -4
  225. package/src/templates/entity-meta-file.ts +16 -3
  226. package/src/templates/entity-ui-descriptor.ts +305 -0
  227. package/src/templates/field-meta.ts +100 -19
  228. package/src/templates/names-decl.ts +165 -0
  229. package/src/templates/projection-decl.ts +72 -31
  230. package/src/templates/queries-file.ts +17 -2
  231. package/src/templates/requirement-test.ts +13 -2
  232. package/src/templates/routes-file-hono.ts +14 -2
  233. package/src/templates/routes-file.ts +69 -24
  234. package/src/templates/value-object-file.ts +15 -1
  235. package/src/templates/view-decl.ts +53 -3
  236. package/src/templates/zod-validators.ts +41 -5
  237. package/src/view-context.ts +88 -0
@@ -0,0 +1,112 @@
1
+ import type { MetaData, MetaField, MetaObject, MetaRoot } from "@metaobjectsdev/metadata";
2
+ /** One validation rule, in the order its source was declared. */
3
+ export type UiRule = {
4
+ readonly kind: "required";
5
+ readonly message: string;
6
+ } | {
7
+ readonly kind: "minLength";
8
+ readonly value: number;
9
+ readonly message: string;
10
+ } | {
11
+ readonly kind: "maxLength";
12
+ readonly value: number;
13
+ readonly message: string;
14
+ }
15
+ /** `pattern` is the RAW authored regex source — never pre-escaped. */
16
+ | {
17
+ readonly kind: "pattern";
18
+ readonly pattern: string;
19
+ readonly message: string;
20
+ };
21
+ export interface UiFieldDescriptor {
22
+ readonly name: string;
23
+ readonly label: string;
24
+ /** The MetaView subtype resolved for the FORM context. */
25
+ readonly view: string;
26
+ /** Present only when the view maps to a real HTML `<input type=…>`. Derived from the
27
+ * view subtype — there is no authored override (see `htmlTypeFromView`). */
28
+ readonly htmlType?: string | undefined;
29
+ /** Empty when the field declares nothing to validate. */
30
+ readonly rules: readonly UiRule[];
31
+ /** Present only for a `field.currency`. */
32
+ readonly currency?: {
33
+ readonly currency: string;
34
+ readonly locale: string;
35
+ } | undefined;
36
+ /**
37
+ * Present when the generated FORM renders this field as a nested value-object
38
+ * sub-form rather than an input — a `field.object` whose `@objectRef` resolves (see
39
+ * `valueObjectFor`). Computed only when `buildEntityUiDescriptor` is given the loaded
40
+ * root; `renderEntityConstants` does not pass one and emits nothing for it, so the
41
+ * `<Entity>` const is byte-identical either way.
42
+ */
43
+ readonly nested?: {
44
+ readonly objectRef: string;
45
+ readonly isArray: boolean;
46
+ } | undefined;
47
+ }
48
+ export interface EntityUiDescriptor {
49
+ readonly entity: string;
50
+ /** The address the generated routes SERVE this object at — `/subscribers`, and
51
+ * `/vehicles/car` for a TPH subtype. Emitted as `$path`. See {@link restPath}. */
52
+ readonly path: string;
53
+ /** Every field, INHERITED INCLUDED (ADR-0039 resolving `fields()`). */
54
+ readonly fields: readonly UiFieldDescriptor[];
55
+ }
56
+ /**
57
+ * An object's OWN pluralized resource path — the one derivation of that spelling, and the
58
+ * input {@link restPath} composes an address from. It is NOT `$path` on its own.
59
+ *
60
+ * A projection is KEBAB-cased and an entity is SNAKE-cased, and that split is not a
61
+ * style choice: both spellings are already mounted. `renderProjectionDecl` emits
62
+ * `$path: "/order-summaries"` and `renderEntityConstants` emits `$path:
63
+ * "/order_summaries"`, and `routes-file.ts` mounts whichever const belongs to the object
64
+ * — so an address computed without the split is wrong for every multi-word projection.
65
+ * It used to live in a second function inside `projection-decl.ts`, which is exactly how
66
+ * `agent/ui.md` and `api/AGENT-API.md` both came to print `/order_summaries` for a
67
+ * projection served at `/order-summaries`.
68
+ *
69
+ * "Subscriber" → "/subscribers"
70
+ * "WorkoutEvent" → "/workout_events"
71
+ * "ProgramSummary" → "/program-summaries" (projection)
72
+ *
73
+ * A TPH SUBTYPE is not addressed by this path — it is mounted under its base — so this is
74
+ * an INPUT to {@link restPath}, not the answer. `$path` carries `restPath`; call this only
75
+ * when you specifically want an object's own pluralized name, never to build an address.
76
+ */
77
+ export declare function resourcePath(entity: MetaData): string;
78
+ /**
79
+ * THE address the generated routes serve this object at — and therefore what the
80
+ * `<Entity>` const emits as `$path`.
81
+ *
82
+ * `resourcePath` answers a different question: an object's own pluralized name. The two
83
+ * agree for everything EXCEPT a TPH subtype, which emits no routes file of its own —
84
+ * `routes-file.ts` mounts the whole hierarchy from the discriminator BASE, giving the
85
+ * union read-only routes at the base path and each subtype a full CRUD set at
86
+ * `<base path>/<route segment>`.
87
+ *
88
+ * `$path` used to carry `resourcePath`, so a subtype's own `$path` named an endpoint that
89
+ * did not exist. That was not confined to prose: `agent/ui.md` printed it as fact, and the
90
+ * TanStack `grid-hook-file.ts` builds its fetch URL from `<Entity>.$path` with no TPH
91
+ * branch at all, so an opted-in per-subtype grid requested an address nothing served.
92
+ * Fixing it here fixes every consumer, because every consumer reads the const.
93
+ *
94
+ * The composition is the same one `routes-file.ts` and `hooks-file.ts` emit as CODE
95
+ * (`Base.$path + "/car"`); they reference the const rather than a computed string, so this
96
+ * is the one place it can be evaluated. The SEGMENT rule is not restated —
97
+ * `tphRouteSegment` owns it, and all three read it from there.
98
+ */
99
+ export declare function restPath(entity: MetaObject): string;
100
+ /**
101
+ * Describe one field's form presentation.
102
+ *
103
+ * `root` is OPTIONAL and only decides whether `nested` is filled in: resolving a
104
+ * `field.object`'s `@objectRef` needs the run's other objects, and the two callers differ
105
+ * — `renderEntityConstants` has no root (it is also ejected into adopter repos with a
106
+ * fixed signature) while the docs surface does. Passing one adds a member the const
107
+ * emitter ignores; it never changes any member the const emits.
108
+ */
109
+ export declare function buildUiFieldDescriptor(field: MetaField, root?: MetaRoot): UiFieldDescriptor;
110
+ /** Describe one object's whole form surface. See {@link buildUiFieldDescriptor} for `root`. */
111
+ export declare function buildEntityUiDescriptor(obj: MetaObject, root?: MetaRoot): EntityUiDescriptor;
112
+ //# sourceMappingURL=entity-ui-descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-ui-descriptor.d.ts","sourceRoot":"","sources":["../../src/templates/entity-ui-descriptor.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAiC1F,iEAAiE;AACjE,MAAM,MAAM,MAAM,GACd;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChF;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAClF,sEAAsE;GACpE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAErF,MAAM,WAAW,iBAAiB;IAChC,QAA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AQ,GAAG,kBAAkB,CAW5F"}
@@ -0,0 +1,238 @@
1
+ // The per-field FORM descriptor — the one derivation of "what does this field look like
2
+ // in a UI", shared by everything that answers that question.
3
+ //
4
+ // Two consumers, and the reason they must share:
5
+ //
6
+ // • `renderEntityConstants()` emits it as the `<Entity>` const in `<Entity>.meta.ts`,
7
+ // which `useEntityForm` reads at RUNTIME to render the form;
8
+ // • the `agent/ui.md` docs surface renders it as a table, which is what an agent reads
9
+ // BEFORE it writes code against that form.
10
+ //
11
+ // If those two were derived separately, the page describing the form and the descriptor
12
+ // driving it could disagree — and the disagreement would be invisible, because the page
13
+ // looks authoritative and nothing compares them. That is the same "a name resolved twice
14
+ // is a name that can disagree with itself" rule `names.ts` states for physical names, one
15
+ // tier up.
16
+ //
17
+ // #356 — THE SURFACE IS THE FORM. `view` resolves through `inferViewKind(field, "form")`,
18
+ // which selects the view named for the form context, so a field declaring several views is
19
+ // described by the one the generated `<Entity>.form.tsx` actually renders. The grid tiers
20
+ // compute their own view kind at codegen time and never read this.
21
+ //
22
+ // RULES ARE AN ORDERED LIST, NOT A KEYED OBJECT, and that is load-bearing rather than
23
+ // stylistic: the emitted `rules: { ... }` object preserves the order the field's validator
24
+ // children were declared in, so a field whose `validator.regex` precedes its
25
+ // `validator.required` emits `pattern` first. A keyed shape would impose one fixed order
26
+ // and silently rewrite every such entity's descriptor.
27
+ //
28
+ // The pattern is carried RAW. Escaping it into a `/.../` literal is a TypeScript-emission
29
+ // concern and belongs to the emitter, not to the description of the field.
30
+ import { VIEW_SUBTYPE_TEXT, VIEW_SUBTYPE_TEXTAREA, VIEW_SUBTYPE_NUMBER, VIEW_SUBTYPE_CHECKBOX, VIEW_SUBTYPE_DATE, VIEW_SUBTYPE_PASSWORD, VIEW_SUBTYPE_HIDDEN, VIEW_SUBTYPE_DROPDOWN, VIEW_SUBTYPE_RADIO, VALIDATOR_SUBTYPE_REQUIRED, VALIDATOR_SUBTYPE_LENGTH, VALIDATOR_SUBTYPE_REGEX, VALIDATOR_ATTR_MIN, VALIDATOR_ATTR_MAX, VALIDATOR_ATTR_PATTERN, FIELD_ATTR_MAX_LENGTH, FIELD_ATTR_REQUIRED, pluralize, toSnakeCase, } from "@metaobjectsdev/metadata";
31
+ import { inferViewKind, currencyMetaFor, labelFor, humanize, valueObjectFor } from "./field-meta.js";
32
+ import { VIEW_CONTEXT_FORM } from "../view-context.js";
33
+ import { isProjection } from "../projection/projection-detector.js";
34
+ // `restPath` lives HERE rather than in api-surface.ts, which is where it used to sit and
35
+ // which now re-exports it. The descriptor is what emits `$path`, so the composition has to
36
+ // be reachable from this module; importing it back from `api-surface.js` would be a cycle,
37
+ // since that module imports `resourcePath` from this one. Neither of these two imports
38
+ // reaches back here, so moving the function down is the acyclic direction.
39
+ import { tphDiscriminatorBase, tphDiscriminatorPin } from "./zod-validators.js";
40
+ import { tphRouteSegment } from "./tph-discriminator.js";
41
+ /**
42
+ * An object's OWN pluralized resource path — the one derivation of that spelling, and the
43
+ * input {@link restPath} composes an address from. It is NOT `$path` on its own.
44
+ *
45
+ * A projection is KEBAB-cased and an entity is SNAKE-cased, and that split is not a
46
+ * style choice: both spellings are already mounted. `renderProjectionDecl` emits
47
+ * `$path: "/order-summaries"` and `renderEntityConstants` emits `$path:
48
+ * "/order_summaries"`, and `routes-file.ts` mounts whichever const belongs to the object
49
+ * — so an address computed without the split is wrong for every multi-word projection.
50
+ * It used to live in a second function inside `projection-decl.ts`, which is exactly how
51
+ * `agent/ui.md` and `api/AGENT-API.md` both came to print `/order_summaries` for a
52
+ * projection served at `/order-summaries`.
53
+ *
54
+ * "Subscriber" → "/subscribers"
55
+ * "WorkoutEvent" → "/workout_events"
56
+ * "ProgramSummary" → "/program-summaries" (projection)
57
+ *
58
+ * A TPH SUBTYPE is not addressed by this path — it is mounted under its base — so this is
59
+ * an INPUT to {@link restPath}, not the answer. `$path` carries `restPath`; call this only
60
+ * when you specifically want an object's own pluralized name, never to build an address.
61
+ */
62
+ export function resourcePath(entity) {
63
+ // The two compositions differ in ORDER as well as separator, and both are load-bearing:
64
+ // pluralize-then-snake is what the projection const has always emitted, snake-then-
65
+ // pluralize is what the entity const has. Neither may be "tidied" into the other.
66
+ return isProjection(entity)
67
+ ? `/${toSnakeCase(pluralize(entity.name)).replace(/_/g, "-")}`
68
+ : `/${pluralize(toSnakeCase(entity.name))}`;
69
+ }
70
+ /**
71
+ * THE address the generated routes serve this object at — and therefore what the
72
+ * `<Entity>` const emits as `$path`.
73
+ *
74
+ * `resourcePath` answers a different question: an object's own pluralized name. The two
75
+ * agree for everything EXCEPT a TPH subtype, which emits no routes file of its own —
76
+ * `routes-file.ts` mounts the whole hierarchy from the discriminator BASE, giving the
77
+ * union read-only routes at the base path and each subtype a full CRUD set at
78
+ * `<base path>/<route segment>`.
79
+ *
80
+ * `$path` used to carry `resourcePath`, so a subtype's own `$path` named an endpoint that
81
+ * did not exist. That was not confined to prose: `agent/ui.md` printed it as fact, and the
82
+ * TanStack `grid-hook-file.ts` builds its fetch URL from `<Entity>.$path` with no TPH
83
+ * branch at all, so an opted-in per-subtype grid requested an address nothing served.
84
+ * Fixing it here fixes every consumer, because every consumer reads the const.
85
+ *
86
+ * The composition is the same one `routes-file.ts` and `hooks-file.ts` emit as CODE
87
+ * (`Base.$path + "/car"`); they reference the const rather than a computed string, so this
88
+ * is the one place it can be evaluated. The SEGMENT rule is not restated —
89
+ * `tphRouteSegment` owns it, and all three read it from there.
90
+ */
91
+ export function restPath(entity) {
92
+ const pin = tphDiscriminatorPin(entity);
93
+ const base = tphDiscriminatorBase(entity);
94
+ if (pin === undefined || base === undefined)
95
+ return resourcePath(entity);
96
+ return `${resourcePath(base)}/${tphRouteSegment(pin.value)}`;
97
+ }
98
+ /**
99
+ * Map a MetaView subtype to a real HTML `<input type=…>` value. Returns undefined for
100
+ * views that don't map to `<input>` at all (textarea, dropdown) — consumers render the
101
+ * right element type themselves.
102
+ *
103
+ * THE MAPPING IS THE ONLY SOURCE. An `@htmlType` override used to be read off the view
104
+ * node ahead of this switch; nothing registers that attribute, so the override was
105
+ * unreachable and this mapping was always the answer. A consumer needing a different
106
+ * `type=` edits the emitted `<Entity>.meta.ts`, whose hand edits the merge preserves.
107
+ */
108
+ function htmlTypeFromView(view) {
109
+ switch (view) {
110
+ case VIEW_SUBTYPE_TEXT:
111
+ return "text";
112
+ case VIEW_SUBTYPE_NUMBER:
113
+ return "number";
114
+ case VIEW_SUBTYPE_DATE:
115
+ return "date";
116
+ case VIEW_SUBTYPE_PASSWORD:
117
+ return "password";
118
+ case VIEW_SUBTYPE_CHECKBOX:
119
+ return "checkbox";
120
+ case VIEW_SUBTYPE_HIDDEN:
121
+ return "hidden";
122
+ case VIEW_SUBTYPE_RADIO:
123
+ return "radio";
124
+ case "month":
125
+ return "month";
126
+ case "email":
127
+ return "email";
128
+ case VIEW_SUBTYPE_TEXTAREA:
129
+ case VIEW_SUBTYPE_DROPDOWN:
130
+ return undefined;
131
+ default:
132
+ return undefined;
133
+ }
134
+ }
135
+ /**
136
+ * The field's validation rules, in DECLARATION ORDER — see the ordering note at the top
137
+ * of this file.
138
+ *
139
+ * The field-level `@required` / `@maxLength` attrs append only when no validator child
140
+ * already supplied that rule, so the two authoring spellings never double up.
141
+ */
142
+ function buildFieldRules(field) {
143
+ const rules = [];
144
+ let hasRequired = false;
145
+ let hasMaxLength = false;
146
+ // ADR-0039: resolving — a validator may inherit its config attrs (@min/@max/@pattern)
147
+ // via extends.
148
+ //
149
+ // THE MESSAGES ARE DERIVED, NOT AUTHORED. `@message` / `@minMessage` / `@maxMessage`
150
+ // used to be read here as overrides; no provider registers any of them, so the reads
151
+ // were unreachable and the defaults below were always what shipped. A consumer wanting
152
+ // different wording edits the emitted `rules` object in `<Entity>.meta.ts`, which is a
153
+ // generated file whose hand edits the three-way merge preserves. See ADR-0023.
154
+ for (const child of field.validators()) {
155
+ if (child.subType === VALIDATOR_SUBTYPE_REQUIRED) {
156
+ rules.push({ kind: "required", message: `${humanize(field.name)} is required` });
157
+ hasRequired = true;
158
+ }
159
+ else if (child.subType === VALIDATOR_SUBTYPE_LENGTH) {
160
+ const min = child.attr(VALIDATOR_ATTR_MIN);
161
+ const max = child.attr(VALIDATOR_ATTR_MAX);
162
+ if (typeof min === "number") {
163
+ rules.push({ kind: "minLength", value: min, message: `Must be at least ${min} characters` });
164
+ }
165
+ if (typeof max === "number") {
166
+ rules.push({ kind: "maxLength", value: max, message: `Must be ${max} characters or fewer` });
167
+ hasMaxLength = true;
168
+ }
169
+ }
170
+ else if (child.subType === VALIDATOR_SUBTYPE_REGEX) {
171
+ const pattern = child.attr(VALIDATOR_ATTR_PATTERN);
172
+ if (typeof pattern === "string") {
173
+ rules.push({ kind: "pattern", pattern, message: "Invalid format" });
174
+ }
175
+ }
176
+ }
177
+ // Field-level @required attr (if not already covered by validator).
178
+ if (!hasRequired && field.attr(FIELD_ATTR_REQUIRED) === true) {
179
+ rules.push({ kind: "required", message: `${humanize(field.name)} is required` });
180
+ }
181
+ // Field-level @maxLength attr (if not already covered).
182
+ const maxLenAttr = field.attr(FIELD_ATTR_MAX_LENGTH);
183
+ if (!hasMaxLength && typeof maxLenAttr === "number") {
184
+ rules.push({
185
+ kind: "maxLength",
186
+ value: maxLenAttr,
187
+ message: `Must be ${maxLenAttr} characters or fewer`,
188
+ });
189
+ }
190
+ return rules;
191
+ }
192
+ /**
193
+ * Describe one field's form presentation.
194
+ *
195
+ * `root` is OPTIONAL and only decides whether `nested` is filled in: resolving a
196
+ * `field.object`'s `@objectRef` needs the run's other objects, and the two callers differ
197
+ * — `renderEntityConstants` has no root (it is also ejected into adopter repos with a
198
+ * fixed signature) while the docs surface does. Passing one adds a member the const
199
+ * emitter ignores; it never changes any member the const emits.
200
+ */
201
+ export function buildUiFieldDescriptor(field, root) {
202
+ // `inferViewKind` IS the resolution: the view child declared for the FORM (own or
203
+ // inherited) wins, else the field subtype's default. This module used to keep a
204
+ // `resolveView` that returned the same string plus the view NODE, and the node existed
205
+ // only to read `@placeholder` / `@helpText` / `@htmlType` off it — none of which any
206
+ // provider registers, so all three reads were unreachable. With them gone the node has
207
+ // no reader and the two functions were the same function.
208
+ const view = inferViewKind(field, VIEW_CONTEXT_FORM);
209
+ const currencyMeta = currencyMetaFor(field, VIEW_CONTEXT_FORM);
210
+ const vo = root === undefined ? undefined : valueObjectFor(field, root);
211
+ return {
212
+ name: field.name,
213
+ label: labelFor(field, VIEW_CONTEXT_FORM),
214
+ view,
215
+ htmlType: htmlTypeFromView(view),
216
+ rules: buildFieldRules(field),
217
+ currency: currencyMeta === null
218
+ ? undefined
219
+ : { currency: currencyMeta.currency, locale: currencyMeta.locale },
220
+ nested: vo === undefined
221
+ ? undefined
222
+ : { objectRef: vo.name, isArray: field.resolvedIsArray() },
223
+ };
224
+ }
225
+ /** Describe one object's whole form surface. See {@link buildUiFieldDescriptor} for `root`. */
226
+ export function buildEntityUiDescriptor(obj, root) {
227
+ return {
228
+ entity: obj.name,
229
+ // `restPath`, not `resourcePath`: `$path` is the address this object is SERVED at.
230
+ // They differ only for a TPH subtype, and for that one case `resourcePath` names an
231
+ // endpoint nothing mounts (see restPath's note).
232
+ path: restPath(obj),
233
+ // ADR-0039: resolving `fields()` so inherited fields appear, exactly as the emitted
234
+ // descriptor has always done.
235
+ fields: obj.fields().map((f) => buildUiFieldDescriptor(f, root)),
236
+ };
237
+ }
238
+ //# sourceMappingURL=entity-ui-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-ui-descriptor.js","sourceRoot":"","sources":["../../src/templates/entity-ui-descriptor.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,6DAA6D;AAC7D,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,wFAAwF;AACxF,iEAAiE;AACjE,yFAAyF;AACzF,+CAA+C;AAC/C,EAAE;AACF,wFAAwF;AACxF,wFAAwF;AACxF,yFAAyF;AACzF,0FAA0F;AAC1F,WAAW;AACX,EAAE;AACF,0FAA0F;AAC1F,2FAA2F;AAC3F,0FA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;QAChC,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC;QAC7B,QAAQ,EAAE,YAAY,KAAK,IAAI;YAC7B,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE;QACpE,MAAM,EAAE,EAAE,KAAK,SAAS;YACtB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,eAAe,EAAE,EAAE;KAC7D,CAAC;AACJ,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,uBAAuB,CAAC,GAAe,EAAE,IAAe;IACtE,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,IAAI;QAChB,mFAAmF;QACnF,oFAAoF;QACpF,iDAAiD;QACjD,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC;QACnB,oFAAoF;QACpF,8BAA8B;QAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACjE,CAAC;AACJ,CAAC"}
@@ -1,9 +1,14 @@
1
1
  import { MetaField } from "@metaobjectsdev/metadata";
2
+ import type { MetaObject, MetaRoot } from "@metaobjectsdev/metadata";
2
3
  /**
3
- * Resolve the cell-renderer key (view kind) for a field.
4
- * Explicit view child wins; field subType determines default.
4
+ * Resolve the cell-renderer key (view kind) for a field, for the surface named
5
+ * by `context`.
6
+ *
7
+ * An explicit view declared for THAT surface wins; field subType determines the
8
+ * default. #356: `context` is required rather than defaulting, because a caller
9
+ * that omits it is exactly the caller that renders somebody else's view.
5
10
  */
6
- export declare function inferViewKind(field: MetaField): string;
11
+ export declare function inferViewKind(field: MetaField, context: string): string;
7
12
  /**
8
13
  * Resolve the Zod validator expression for a field's storage type.
9
14
  *
@@ -18,16 +23,48 @@ export declare function inferViewKind(field: MetaField): string;
18
23
  */
19
24
  export declare function zodTypeFor(field: MetaField, timestampMode?: "date" | "string"): string;
20
25
  /**
21
- * Resolve currency code + locale for a currency-subtype field.
22
- * Returns null for non-currency fields.
26
+ * Resolve currency code + locale for a currency-subtype field, for the surface
27
+ * named by `context`. Returns null for non-currency fields.
23
28
  */
24
- export declare function currencyMetaFor(field: MetaField): {
29
+ export declare function currencyMetaFor(field: MetaField, context: string): {
25
30
  currency: string;
26
31
  locale: string;
27
32
  } | null;
28
33
  /**
29
- * Resolve the human-readable label for a field.
30
- * Uses @label attr on a view child if present; otherwise humanizes the field name.
34
+ * The `object.value` a `field.object`'s `@objectRef` names, or `undefined` when the
35
+ * field is not an object field, declares no ref, or names one that is not in the run.
36
+ *
37
+ * THIS IS THE "DOES THE FORM NEST THIS FIELD?" PREDICATE, and it lives here because two
38
+ * tiers have to give one answer: `codegen-ts-react`'s form generator recurses into the
39
+ * referenced value object as a `<fieldset>` sub-form (or a `useFieldArray` repeatable
40
+ * group when the field is an array) instead of emitting an input at all, and
41
+ * `agent/ui.md` documents what that form renders. When they answered separately the page
42
+ * printed `text` — the field's resolved `view.*` subtype, which the form never consults
43
+ * for a nested field — as if it were the control.
44
+ *
45
+ * The resolution is BARE-NAME on purpose: it is the same lookup the Zod and
46
+ * inferred-type templates perform, and changing it here would change what the generated
47
+ * form nests. A package-aware resolution is a separate decision with its own blast
48
+ * radius (ADR-0042).
49
+ */
50
+ export declare function valueObjectFor(field: MetaField, root: MetaRoot): MetaObject | undefined;
51
+ /**
52
+ * Resolve the human-readable label for a field, for the surface named by `context`.
53
+ * Uses the registered `@title` common attr — on that surface's view first, else on the
54
+ * field itself; otherwise humanizes the field name.
55
+ *
56
+ * #353 — this read `@label`, which no provider registers on any `view.*` subtype, so the
57
+ * override branch was unreachable: authoring it fails the strict load `meta verify` runs
58
+ * (ERR_UNKNOWN_ATTR). `title` is already a registered common attr on every node and
59
+ * already means "a noun phrase", so nothing was registered for this (ADR-0037 step 0).
60
+ */
61
+ export declare function labelFor(field: MetaField, context: string): string;
62
+ /**
63
+ * Convert a camelCase or PascalCase field name to a human-friendly label.
64
+ *
65
+ * THE one copy in this package: `entity-ui-descriptor.ts` re-exports this rather than
66
+ * keeping a second body, because two spellings of "humanize" is two answers to what a
67
+ * field is CALLED — the label a form renders and the label the docs page prints.
31
68
  */
32
- export declare function labelFor(field: MetaField): string;
69
+ export declare function humanize(s: string): string;
33
70
  //# sourceMappingURL=field-meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-meta.d.ts","sourceRoot":"","sources":["../../src/templates/field-meta.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAsCrD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAMtD;AA2BD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,GAAE,MAAM,GAAG,QAAmB,GAAG,MAAM,CAuDhG;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAU7F;AAMD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOjD"}
1
+ {"version":3,"file":"field-meta.d.ts","sourceRoot":"","sources":["../../src/templates/field-meta.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AA2CrE;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAMvE;AA2CD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,aAAa,GAAE,MAAM,GAAG,QAAmB,GAAG,MAAM,CAuDhG;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,MAAM,GACd;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkB7C;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAOvF;AAMD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CASlE;AAMD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM1C"}
@@ -3,19 +3,25 @@
3
3
  //
4
4
  // All helpers take a MetaField node.
5
5
  import { MetaField } from "@metaobjectsdev/metadata";
6
- import { FIELD_SUBTYPE_STRING, FIELD_SUBTYPE_INT, FIELD_SUBTYPE_LONG, FIELD_SUBTYPE_DOUBLE, FIELD_SUBTYPE_FLOAT, FIELD_SUBTYPE_DECIMAL, FIELD_SUBTYPE_BOOLEAN, FIELD_SUBTYPE_DATE, FIELD_SUBTYPE_TIME, FIELD_SUBTYPE_TIMESTAMP, FIELD_SUBTYPE_CURRENCY, FIELD_SUBTYPE_ENUM, FIELD_SUBTYPE_UUID, FIELD_SUBTYPE_URI, FIELD_SUBTYPE_INET, FIELD_ATTR_STRING_FORMAT, FIELD_ATTR_LENIENT, STRING_FORMAT_EMAIL, STRING_FORMAT_HOSTNAME, VIEW_SUBTYPE_TEXT, VIEW_SUBTYPE_DATE, VIEW_SUBTYPE_NUMBER, VIEW_SUBTYPE_CHECKBOX, VIEW_SUBTYPE_CURRENCY, FIELD_ATTR_CURRENCY, FIELD_ATTR_CURRENCY_DEFAULT, VIEW_CURRENCY_ATTR_LOCALE, VIEW_CURRENCY_ATTR_LOCALE_DEFAULT, } from "@metaobjectsdev/metadata";
6
+ import { stripPackage } from "@metaobjectsdev/metadata";
7
+ import { FIELD_SUBTYPE_STRING, FIELD_SUBTYPE_INT, FIELD_SUBTYPE_LONG, FIELD_SUBTYPE_DOUBLE, FIELD_SUBTYPE_FLOAT, FIELD_SUBTYPE_DECIMAL, FIELD_SUBTYPE_BOOLEAN, FIELD_SUBTYPE_DATE, FIELD_SUBTYPE_TIME, FIELD_SUBTYPE_TIMESTAMP, FIELD_SUBTYPE_CURRENCY, FIELD_SUBTYPE_ENUM, FIELD_SUBTYPE_UUID, FIELD_SUBTYPE_URI, FIELD_SUBTYPE_INET, FIELD_SUBTYPE_OBJECT, FIELD_ATTR_OBJECT_REF, FIELD_ATTR_STRING_FORMAT, FIELD_ATTR_LENIENT, STRING_FORMAT_EMAIL, STRING_FORMAT_HOSTNAME, VIEW_SUBTYPE_TEXT, VIEW_SUBTYPE_DATE, VIEW_SUBTYPE_NUMBER, VIEW_SUBTYPE_CHECKBOX, VIEW_SUBTYPE_CURRENCY, VIEW_SUBTYPE_DROPDOWN, FIELD_ATTR_CURRENCY, FIELD_ATTR_CURRENCY_DEFAULT, VIEW_CURRENCY_ATTR_LOCALE, VIEW_CURRENCY_ATTR_LOCALE_DEFAULT, } from "@metaobjectsdev/metadata";
7
8
  import { enumValues, zodEnumExpr } from "../enum-meta.js";
9
+ import { viewForContext } from "../view-context.js";
8
10
  import { ZOD_INET_EXPR } from "./net-regex.js";
9
11
  // ---------------------------------------------------------------------------
10
12
  // inferViewKind
11
13
  // ---------------------------------------------------------------------------
12
14
  /**
13
- * Resolve the cell-renderer key (view kind) for a field.
14
- * Explicit view child wins; field subType determines default.
15
+ * Resolve the cell-renderer key (view kind) for a field, for the surface named
16
+ * by `context`.
17
+ *
18
+ * An explicit view declared for THAT surface wins; field subType determines the
19
+ * default. #356: `context` is required rather than defaulting, because a caller
20
+ * that omits it is exactly the caller that renders somebody else's view.
15
21
  */
16
- export function inferViewKind(field) {
17
- // Explicit view (own or inherited via extends) has highest priority.
18
- const viewChild = field.views()[0];
22
+ export function inferViewKind(field, context) {
23
+ // Explicit view for this surface (own or inherited via extends) has highest priority.
24
+ const viewChild = viewForContext(field, context);
19
25
  if (viewChild)
20
26
  return viewChild.subType;
21
27
  // Field subtype → default view.
@@ -37,6 +43,22 @@ function defaultViewForSubType(subType) {
37
43
  return VIEW_SUBTYPE_DATE;
38
44
  case FIELD_SUBTYPE_CURRENCY:
39
45
  return VIEW_SUBTYPE_CURRENCY;
46
+ case FIELD_SUBTYPE_ENUM:
47
+ // A closed member set is a CHOICE, and the generated form has always rendered it as
48
+ // one: `codegen-ts-react`'s `viewKindFor` returns `dropdown` for an enum declaring no
49
+ // view, and emits a `<select>` with an `<option>` per member.
50
+ //
51
+ // This branch was missing, so the same question had two answers. The emitted
52
+ // `<Entity>` descriptor — which `useEntityForm` reads at RUNTIME — fell through to
53
+ // `text` and told every consumer the control was a free-text input, for the one field
54
+ // subtype where free text is exactly what the model forbids. The form was right and
55
+ // the descriptor describing it was wrong.
56
+ //
57
+ // Fixed HERE rather than in the react tier because this is the shared resolver: the
58
+ // descriptor, the `agent/ui.md` page and the form must give one answer, and pinning
59
+ // the agreement in the tier that renders it would leave the two other readers still
60
+ // computing their own.
61
+ return VIEW_SUBTYPE_DROPDOWN;
40
62
  default:
41
63
  return VIEW_SUBTYPE_TEXT;
42
64
  }
@@ -117,40 +139,92 @@ export function zodTypeFor(field, timestampMode = "string") {
117
139
  // currencyMetaFor
118
140
  // ---------------------------------------------------------------------------
119
141
  /**
120
- * Resolve currency code + locale for a currency-subtype field.
121
- * Returns null for non-currency fields.
142
+ * Resolve currency code + locale for a currency-subtype field, for the surface
143
+ * named by `context`. Returns null for non-currency fields.
122
144
  */
123
- export function currencyMetaFor(field) {
145
+ export function currencyMetaFor(field, context) {
124
146
  if (field.subType !== FIELD_SUBTYPE_CURRENCY)
125
147
  return null;
126
148
  const currency = field.attr(FIELD_ATTR_CURRENCY) ?? FIELD_ATTR_CURRENCY_DEFAULT;
127
- const viewChild = field.views().find((c) => c.subType === VIEW_SUBTYPE_CURRENCY);
149
+ // #356: the surface's own view carries the @locale for that surface — two
150
+ // currency views with different locales must not be resolved by position.
151
+ // When the surface's view is NOT a currency view (or there is none), keep the
152
+ // pre-#356 scan: an authored @locale anywhere on the field beats the default.
153
+ const contextView = viewForContext(field, context);
154
+ const viewChild = contextView?.subType === VIEW_SUBTYPE_CURRENCY
155
+ ? contextView
156
+ : field.views().find((c) => c.subType === VIEW_SUBTYPE_CURRENCY);
128
157
  // ADR-0039: resolving — a view may inherit @locale via extends.
129
158
  const locale = viewChild?.attr(VIEW_CURRENCY_ATTR_LOCALE) ??
130
159
  VIEW_CURRENCY_ATTR_LOCALE_DEFAULT;
131
160
  return { currency, locale };
132
161
  }
133
162
  // ---------------------------------------------------------------------------
163
+ // valueObjectFor
164
+ // ---------------------------------------------------------------------------
165
+ /**
166
+ * The `object.value` a `field.object`'s `@objectRef` names, or `undefined` when the
167
+ * field is not an object field, declares no ref, or names one that is not in the run.
168
+ *
169
+ * THIS IS THE "DOES THE FORM NEST THIS FIELD?" PREDICATE, and it lives here because two
170
+ * tiers have to give one answer: `codegen-ts-react`'s form generator recurses into the
171
+ * referenced value object as a `<fieldset>` sub-form (or a `useFieldArray` repeatable
172
+ * group when the field is an array) instead of emitting an input at all, and
173
+ * `agent/ui.md` documents what that form renders. When they answered separately the page
174
+ * printed `text` — the field's resolved `view.*` subtype, which the form never consults
175
+ * for a nested field — as if it were the control.
176
+ *
177
+ * The resolution is BARE-NAME on purpose: it is the same lookup the Zod and
178
+ * inferred-type templates perform, and changing it here would change what the generated
179
+ * form nests. A package-aware resolution is a separate decision with its own blast
180
+ * radius (ADR-0042).
181
+ */
182
+ export function valueObjectFor(field, root) {
183
+ if (field.subType !== FIELD_SUBTYPE_OBJECT)
184
+ return undefined;
185
+ // ADR-0039: resolving — @objectRef may be inherited via extends.
186
+ const ref = field.attr(FIELD_ATTR_OBJECT_REF);
187
+ if (typeof ref !== "string" || ref.length === 0)
188
+ return undefined;
189
+ const base = stripPackage(ref);
190
+ return root.objects().find((o) => o.name === base);
191
+ }
192
+ // ---------------------------------------------------------------------------
134
193
  // labelFor
135
194
  // ---------------------------------------------------------------------------
136
195
  /**
137
- * Resolve the human-readable label for a field.
138
- * Uses @label attr on a view child if present; otherwise humanizes the field name.
196
+ * Resolve the human-readable label for a field, for the surface named by `context`.
197
+ * Uses the registered `@title` common attr on that surface's view first, else on the
198
+ * field itself; otherwise humanizes the field name.
199
+ *
200
+ * #353 — this read `@label`, which no provider registers on any `view.*` subtype, so the
201
+ * override branch was unreachable: authoring it fails the strict load `meta verify` runs
202
+ * (ERR_UNKNOWN_ATTR). `title` is already a registered common attr on every node and
203
+ * already means "a noun phrase", so nothing was registered for this (ADR-0037 step 0).
139
204
  */
140
- export function labelFor(field) {
141
- for (const child of field.views()) {
142
- // ADR-0039: resolving — a view may inherit @label via extends.
143
- const label = child.attr("label");
144
- if (typeof label === "string" && label.length > 0)
145
- return label;
146
- }
205
+ export function labelFor(field, context) {
206
+ // #356: the label reads the view for THIS surface, not whichever view was
207
+ // declared first — a grid header must not retitle the form's field.
208
+ // ADR-0039: resolving — a view may inherit @title via extends.
209
+ const title = viewForContext(field, context)?.attr("title");
210
+ if (typeof title === "string" && title.length > 0)
211
+ return title;
212
+ const fieldTitle = field.attr("title");
213
+ if (typeof fieldTitle === "string" && fieldTitle.length > 0)
214
+ return fieldTitle;
147
215
  return humanize(field.name);
148
216
  }
149
217
  // ---------------------------------------------------------------------------
150
218
  // Internal
151
219
  // ---------------------------------------------------------------------------
152
- /** Convert a camelCase or PascalCase field name to a human-friendly label. */
153
- function humanize(s) {
220
+ /**
221
+ * Convert a camelCase or PascalCase field name to a human-friendly label.
222
+ *
223
+ * THE one copy in this package: `entity-ui-descriptor.ts` re-exports this rather than
224
+ * keeping a second body, because two spellings of "humanize" is two answers to what a
225
+ * field is CALLED — the label a form renders and the label the docs page prints.
226
+ */
227
+ export function humanize(s) {
154
228
  return s
155
229
  .replace(/([a-z])([A-Z])/g, "$1 $2")
156
230
  .replace(/_/g, " ")
@@ -1 +1 @@
1
- {"version":3,"file":"field-meta.js","sourceRoot":"","sources":["../../src/templates/field-meta.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,+EAA+E;AAC/E,EAAE;AACF,qCAAqC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,2BAA2B,EAC3B,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAgB;IAC5C,qEAAqE;IACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;IACnC,IAAI,SAAS;QAAE,OAAO,SAAS,CAAC,OAAO,CAAC;IACxC,gCAAgC;IAChC,OAAO,qBAAqB,CAAC,KAAK,CAAC,OAAO,CAA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