Commit befe75f
committed
refactor(types)!: the action sub-vocabularies derive from @objectstack/spec (objectstack#4074)
`packages/types/src/ui-action.ts` imported exactly one of the spec's action
vocabularies — `ActionType`, derived in #2231/#2901 — and hand-declared the rest
under doc comments claiming spec canonicity. `ActionLocation`'s comment said the
single source of truth was `@objectstack/spec/ui` and that this file "re-export"s
it, while the code re-DECLARED a parallel union, `as const` tuple, and `z.enum`.
That is why objectstack#3856 predicted a compile error when spec 17 removed
`action.execute` and there wasn't one: nothing here was bound to the spec's
`z.infer`, so a key removal upstream produced no signal in objectui.
Already drifted, not merely drift-prone. `ActionParamSchema.type` is
`FieldType.optional()` and `FieldType` carries 49 members; the hand-written
`ActionParamFieldType` listed 16. A spec-valid param typed `lookup`,
`multiselect`, `currency`, `user`, `tags` or `json` failed `tsc` against this
package even though the dialog renders it — the same failure `ActionType` had
before it was derived (missing `form` while `executeForm` implemented it).
- `ActionLocation` / `ACTION_LOCATIONS` / `ActionLocationSchema` are now the
spec's own three symbols. The latter two stay VALUE exports: #2561 decision
(a) drops spec/ui's `…Schema` names from this package but explicitly keeps
these, so they must not sit in an `export type` block that erases them.
- `ActionComponent` is `NonNullable<Action['component']>`, read off the spec's
resolved `Action` rather than `ActionSchema.shape.component` — spec exports
`ActionSchema` as a `lazySchema` proxy that does not forward `.shape`.
- `ActionParamFieldType` is the spec's `FieldType`, with
`ACTION_PARAM_FIELD_TYPES` as a runtime witness: a type alias erases, so
identity against `FieldType.options` is what catches a future re-fork.
- `ActionParam` gains the 13 optional capability fields it could not express
(`visible`, `accept`, `maxSize`, `multiple`, and the lookup-picker group),
all already declared by core's `ActionParamDef` and mapped into the shared
field renderer by app-shell's `paramToField.ts` (ADR-0059).
A blind derivation would have broken authored metadata: `paramToField.ts`'s
`PARAM_TYPE_ALIASES` still accepts `checkbox`, `reference` and `datetime-local`,
none of which is a spec `FieldType`. They are now declared as
`ObjectUiLocalParamFieldType` and `ActionParam.type` takes
`ResolvableParamFieldType` (spec ∪ local) — the shape this file already uses for
`navigation`, so the dialect is visible to an importer instead of hidden in a
`Record<string, string>` in another package.
Also corrects this guard file's own claim. Its header said the `satisfies` checks
"are the real enforcement"; they are not. Every package tsconfig excludes test
files by glob and there is no vitest `typecheck` project, so no `tsc` invocation
reads that file — reverting `ActionParamFieldType` to the 16-member fork produces
zero type errors. The #4074 cases are therefore runtime identity and membership
checks, which do fail against the pre-fix source.
BREAKING CHANGE: `ActionParamFieldType` widens from 16 members to 49, so an
exhaustive `switch` over a param `type` stops being exhaustive. All 16 previous
members remain valid, so no authored metadata breaks. The new `ActionParam`
fields are optional and additive.
Refs objectstack#4074, objectstack#3856, #2231, #2901, #2561, #2944
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DBMo8gnFduzgpuSHd5Eje1 parent 6f29aa5 commit befe75f
4 files changed
Lines changed: 336 additions & 70 deletions
File tree
- .changeset
- packages/types/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 102 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
44 | 52 | | |
45 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
46 | 61 | | |
47 | 62 | | |
48 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
49 | 70 | | |
50 | 71 | | |
51 | 72 | | |
| |||
60 | 81 | | |
61 | 82 | | |
62 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
63 | 98 | | |
64 | | - | |
| 99 | + | |
65 | 100 | | |
66 | 101 | | |
67 | 102 | | |
| |||
116 | 151 | | |
117 | 152 | | |
118 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
119 | 215 | | |
120 | 216 | | |
121 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
870 | 870 | | |
871 | 871 | | |
872 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
873 | 876 | | |
874 | 877 | | |
875 | 878 | | |
| |||
886 | 889 | | |
887 | 890 | | |
888 | 891 | | |
889 | | - | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
890 | 899 | | |
891 | 900 | | |
892 | 901 | | |
| |||
0 commit comments