@object-ui/core 17.5.0 → 17.7.0

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 (157) hide show
  1. package/CHANGELOG.md +7404 -0
  2. package/README.md +127 -26
  3. package/dist/actions/ActionEngine.d.ts +5 -3
  4. package/dist/actions/ActionEngine.js +14 -10
  5. package/dist/actions/ActionRunner.d.ts +363 -30
  6. package/dist/actions/ActionRunner.js +544 -58
  7. package/dist/actions/TransactionManager.d.ts +7 -2
  8. package/dist/actions/actionKeys.d.ts +75 -13
  9. package/dist/actions/actionKeys.js +131 -16
  10. package/dist/actions/actionResponse.js +3 -3
  11. package/dist/actions/index.d.ts +2 -0
  12. package/dist/actions/index.js +2 -0
  13. package/dist/actions/recordDelete.d.ts +118 -0
  14. package/dist/actions/recordDelete.js +112 -0
  15. package/dist/actions/recordIdParam.d.ts +77 -0
  16. package/dist/actions/recordIdParam.js +37 -0
  17. package/dist/actions/serverActionHandler.d.ts +1 -1
  18. package/dist/actions/serverActionHandler.js +1 -1
  19. package/dist/adapters/ValueDataSource.d.ts +6 -1
  20. package/dist/adapters/ValueDataSource.js +1090 -98
  21. package/dist/adapters/batchTransaction.d.ts +1 -1
  22. package/dist/adapters/batchTransaction.js +1 -1
  23. package/dist/builder/schema-builder.d.ts +38 -81
  24. package/dist/builder/schema-builder.js +33 -152
  25. package/dist/data-scope/ViewDataProvider.d.ts +1 -1
  26. package/dist/data-scope/ViewDataProvider.js +21 -1
  27. package/dist/data-scope/element-data-source.d.ts +261 -7
  28. package/dist/data-scope/element-data-source.js +342 -52
  29. package/dist/data-scope/index.d.ts +9 -4
  30. package/dist/data-scope/index.js +9 -4
  31. package/dist/evaluator/ExpressionEvaluator.d.ts +128 -1
  32. package/dist/evaluator/ExpressionEvaluator.js +226 -13
  33. package/dist/evaluator/FormulaFunctions.d.ts +0 -10
  34. package/dist/evaluator/FormulaFunctions.js +166 -27
  35. package/dist/evaluator/SafeExpressionParser.js +0 -4
  36. package/dist/evaluator/declaredPredicate.d.ts +93 -9
  37. package/dist/evaluator/declaredPredicate.js +118 -17
  38. package/dist/evaluator/fieldRules.d.ts +107 -4
  39. package/dist/evaluator/fieldRules.js +231 -35
  40. package/dist/evaluator/index.d.ts +2 -0
  41. package/dist/evaluator/index.js +2 -0
  42. package/dist/evaluator/listConditional.d.ts +125 -9
  43. package/dist/evaluator/listConditional.js +167 -26
  44. package/dist/evaluator/optionRules.d.ts +126 -0
  45. package/dist/evaluator/optionRules.js +141 -4
  46. package/dist/evaluator/predicateInput.d.ts +15 -4
  47. package/dist/evaluator/predicateInput.js +35 -2
  48. package/dist/evaluator/rowPredicateCanon.d.ts +56 -0
  49. package/dist/evaluator/rowPredicateCanon.js +158 -0
  50. package/dist/evaluator/subjectPermissions.d.ts +76 -0
  51. package/dist/evaluator/subjectPermissions.js +44 -0
  52. package/dist/evaluator/unevaluablePredicate.d.ts +57 -0
  53. package/dist/evaluator/unevaluablePredicate.js +70 -0
  54. package/dist/index.d.ts +18 -0
  55. package/dist/index.js +97 -2
  56. package/dist/protocols/index.d.ts +0 -1
  57. package/dist/protocols/index.js +9 -1
  58. package/dist/registry/Registry.d.ts +397 -48
  59. package/dist/registry/Registry.js +263 -11
  60. package/dist/registry/WidgetRegistry.js +7 -3
  61. package/dist/registry/html-tier-intrinsics.d.ts +90 -0
  62. package/dist/registry/html-tier-intrinsics.js +110 -0
  63. package/dist/registry/public-blocks.d.ts +8 -0
  64. package/dist/registry/public-blocks.js +57 -0
  65. package/dist/theme/ThemeEngine.js +1 -1
  66. package/dist/theme/index.d.ts +1 -1
  67. package/dist/theme/index.js +1 -1
  68. package/dist/types/index.d.ts +92 -13
  69. package/dist/utils/chart-category-key.d.ts +82 -0
  70. package/dist/utils/chart-category-key.js +84 -0
  71. package/dist/utils/chart-measure-key.d.ts +64 -0
  72. package/dist/utils/chart-measure-key.js +65 -0
  73. package/dist/utils/chart-presentation.d.ts +188 -0
  74. package/dist/utils/chart-presentation.js +345 -0
  75. package/dist/utils/chart-series.d.ts +271 -31
  76. package/dist/utils/chart-series.js +478 -55
  77. package/dist/utils/column-identity.d.ts +43 -0
  78. package/dist/utils/column-identity.js +47 -1
  79. package/dist/utils/column-sortability.d.ts +157 -0
  80. package/dist/utils/column-sortability.js +217 -0
  81. package/dist/utils/dashboard-filters.d.ts +38 -6
  82. package/dist/utils/dashboard-filters.js +107 -61
  83. package/dist/utils/dataset-format.d.ts +211 -30
  84. package/dist/utils/dataset-format.js +407 -52
  85. package/dist/utils/date-display.d.ts +354 -0
  86. package/dist/utils/date-display.js +463 -0
  87. package/dist/utils/date-macros.js +7 -0
  88. package/dist/utils/debug.js +7 -0
  89. package/dist/utils/drill-down.d.ts +78 -0
  90. package/dist/utils/drill-down.js +93 -0
  91. package/dist/utils/emptiness.d.ts +96 -0
  92. package/dist/utils/emptiness.js +101 -0
  93. package/dist/utils/expand-fields.d.ts +171 -11
  94. package/dist/utils/expand-fields.js +171 -11
  95. package/dist/utils/extract-records.d.ts +65 -5
  96. package/dist/utils/extract-records.js +65 -8
  97. package/dist/utils/filter-converter.d.ts +152 -4
  98. package/dist/utils/filter-converter.js +1092 -22
  99. package/dist/utils/filter-tokens.d.ts +49 -5
  100. package/dist/utils/filter-tokens.js +105 -34
  101. package/dist/utils/freeze-schema.d.ts +38 -1
  102. package/dist/utils/freeze-schema.js +10 -0
  103. package/dist/utils/grouping-fields.d.ts +61 -0
  104. package/dist/utils/grouping-fields.js +84 -0
  105. package/dist/utils/humanize-label.d.ts +60 -0
  106. package/dist/utils/humanize-label.js +62 -0
  107. package/dist/utils/managedBy.d.ts +30 -5
  108. package/dist/utils/managedBy.js +5 -5
  109. package/dist/utils/native-date-value.d.ts +48 -0
  110. package/dist/utils/native-date-value.js +167 -0
  111. package/dist/utils/non-grid-row-ceiling.d.ts +143 -0
  112. package/dist/utils/non-grid-row-ceiling.js +141 -0
  113. package/dist/utils/normalize-list-view.d.ts +131 -1
  114. package/dist/utils/normalize-list-view.js +248 -6
  115. package/dist/utils/number-display.d.ts +70 -17
  116. package/dist/utils/number-display.js +34 -12
  117. package/dist/utils/object-aggregate-query.d.ts +113 -0
  118. package/dist/utils/object-aggregate-query.js +50 -0
  119. package/dist/utils/parent-scope.d.ts +123 -0
  120. package/dist/utils/parent-scope.js +140 -0
  121. package/dist/utils/predicate-fields.d.ts +62 -4
  122. package/dist/utils/predicate-fields.js +169 -4
  123. package/dist/utils/record-color.d.ts +75 -0
  124. package/dist/utils/record-color.js +65 -0
  125. package/dist/utils/record-source.d.ts +298 -0
  126. package/dist/utils/record-source.js +331 -0
  127. package/dist/utils/record-title.d.ts +148 -8
  128. package/dist/utils/record-title.js +220 -26
  129. package/dist/utils/reference-keys.d.ts +21 -22
  130. package/dist/utils/reference-keys.js +532 -29
  131. package/dist/utils/retired-field-types.d.ts +90 -0
  132. package/dist/utils/retired-field-types.js +124 -0
  133. package/dist/utils/sort-query.d.ts +128 -26
  134. package/dist/utils/sort-query.js +240 -13
  135. package/dist/utils/text-comparand.d.ts +92 -0
  136. package/dist/utils/text-comparand.js +99 -0
  137. package/dist/utils/unmaterialized-fields.d.ts +52 -0
  138. package/dist/utils/unmaterialized-fields.js +57 -0
  139. package/dist/utils/without-denied-fields.d.ts +49 -0
  140. package/dist/utils/without-denied-fields.js +52 -0
  141. package/dist/validation/index.d.ts +9 -4
  142. package/dist/validation/index.js +9 -4
  143. package/dist/validation/schema-validator.d.ts +1 -1
  144. package/dist/validation/schema-validator.js +305 -82
  145. package/dist/validation/server-owned-value.d.ts +62 -0
  146. package/dist/validation/server-owned-value.js +99 -0
  147. package/dist/validation/validators/object-validation-engine.d.ts +1 -1
  148. package/dist/validation/validators/object-validation-engine.js +14 -5
  149. package/package.json +8 -9
  150. package/dist/__benchmarks__/core.bench.d.ts +0 -8
  151. package/dist/__benchmarks__/core.bench.js +0 -53
  152. package/dist/data-scope/DataScopeManager.d.ts +0 -127
  153. package/dist/data-scope/DataScopeManager.js +0 -229
  154. package/dist/protocols/ResponsiveProtocol.d.ts +0 -73
  155. package/dist/protocols/ResponsiveProtocol.js +0 -158
  156. package/dist/validation/validation-engine.d.ts +0 -88
  157. package/dist/validation/validation-engine.js +0 -434
@@ -24,8 +24,13 @@ export interface TransactionOperation {
24
24
  type: 'create' | 'update' | 'delete';
25
25
  /** Target resource name */
26
26
  resource: string;
27
- /** Record ID (for update/delete) */
28
- id?: string | number;
27
+ /**
28
+ * Record ID (for update/delete). A `string`, as `@objectstack/spec` declares
29
+ * every record door and as this type's own sibling `BatchTransactionOperation.id`
30
+ * already did; the rollback path hands it straight to `DataSource.update`
31
+ * (objectui#9333).
32
+ */
33
+ id?: string;
29
34
  /** Data payload */
30
35
  data?: Record<string, any>;
31
36
  /** Previous state (for rollback) */
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * That asymmetry was the issue. An open key set on a DECLARED METADATA CONTRACT
20
20
  * is what lets a typo (`targt`, `exectue`) and a tombstoned key (`execute`) both
21
- * sail through to a runner that then silently does nothing — the #2169 "Mark
21
+ * sail through to a runner that then silently does nothing — the objectstack-ai/objectstack#2169 "Mark
22
22
  * Done does nothing" shape.
23
23
  *
24
24
  * This module was step 1 of the staged narrowing: make the key set VISIBLE and
@@ -74,10 +74,12 @@
74
74
  * rejection" into a compile error at no cost. Hand-copying would have quietly
75
75
  * re-legitimized two dead keys — which is why the types are derived.
76
76
  *
77
- * 17 keys `ActionDef` declares that the spec does not own — `actionType`, `api`,
77
+ * 16 keys `ActionDef` declares that the spec does not own — `actionType`, `api`,
78
78
  * `chain`, `chainMode`, `close`, `condition`, `confirm`, `endpoint`, `modal`,
79
- * `navigate`, `onClick`, `onFailure`, `onSuccess`, `redirect`, `reload`, `toast`,
80
- * `actionParams`. Step 2 marked `@deprecated`, with the spec spelling to use
79
+ * `navigate`, `onClick`, `onFailure`, `redirect`, `reload`, `toast`,
80
+ * `actionParams`. (`onSuccess` was the 17th until objectui#5934 retired the
81
+ * runner's chained-callback meaning; the key is now spec-owned and derived,
82
+ * like the 18 below.) Step 2 marked `@deprecated`, with the spec spelling to use
81
83
  * instead, ONLY the four the runner itself proves are aliases: `actionType` (→
82
84
  * `type`), `api` and `endpoint` (→ `target`; `executeAPI` resolves
83
85
  * `api || endpoint || target`), and `navigate` (→ flat `target`/`openIn`;
@@ -106,11 +108,12 @@
106
108
  /**
107
109
  * Every property `ActionDef` declares, in declaration order.
108
110
  *
109
- * Kept as data because TypeScript types do not survive to runtime — and
110
- * `keyof ActionDef` cannot substitute for this list: the index signature widens
111
- * it to `string | number`, which is precisely the problem being worked around.
111
+ * Kept as data because TypeScript types do not survive to runtime — `keyof
112
+ * ActionDef` is erased along with the interface, so it cannot hand a runtime
113
+ * classifier a list of anything. `actionKeys.pin.test.ts` re-derives this one
114
+ * from the interface's AST, which is what keeps the data true.
112
115
  */
113
- export declare const ACTION_DEF_KEYS: readonly ["type", "actionType", "name", "label", "description", "confirmText", "confirm", "condition", "disabled", "api", "endpoint", "method", "navigate", "to", "external", "newTab", "replace", "onClick", "reload", "close", "redirect", "toast", "successMessage", "errorMessage", "refreshAfter", "undoable", "params", "actionParams", "resultDialog", "target", "body", "openIn", "modal", "chain", "chainMode", "onSuccess", "onFailure", "opensInNewTab", "newTabUrl", "locations", "visible", "requiredPermissions", "icon", "variant", "order", "component", "objectName", "ai", "aria", "bodyExtra", "bodyShape", "mode", "recordIdField", "recordIdParam", "requiresFeature", "shortcut", "bulkEnabled"];
116
+ export declare const ACTION_DEF_KEYS: readonly ["type", "actionType", "name", "label", "description", "confirmText", "confirm", "condition", "disabled", "api", "endpoint", "method", "navigate", "to", "external", "newTab", "replace", "onClick", "reload", "close", "redirect", "toast", "successMessage", "errorMessage", "refreshAfter", "undoable", "params", "actionParams", "resultDialog", "target", "body", "openIn", "modal", "chain", "chainMode", "onFailure", "opensInNewTab", "newTabUrl", "locations", "visible", "requiredPermissions", "icon", "variant", "order", "component", "objectName", "ai", "bodyExtra", "bodyShape", "operation", "patch", "mode", "recordIdField", "recordIdParam", "requiresFeature", "onSuccess", "outcomeMessages", "shortcut", "bulkEnabled"];
114
117
  /**
115
118
  * Every property `@objectstack/spec`'s `ActionSchema` declares.
116
119
  *
@@ -125,7 +128,7 @@ export declare const ACTION_DEF_KEYS: readonly ["type", "actionType", "name", "l
125
128
  * test and wrong in shipped code — `@object-ui/types` made the same call for
126
129
  * `ActionComponent`. The pin test does the walk and fails the day this drifts.
127
130
  */
128
- export declare const SPEC_ACTION_KEYS: readonly ["_lock", "_lockDocsUrl", "_lockReason", "_lockSource", "_packageId", "_packageVersion", "_provenance", "ai", "aria", "body", "bodyExtra", "bodyShape", "bulkEnabled", "component", "confirmText", "description", "disabled", "errorMessage", "execute", "icon", "label", "locations", "method", "mode", "name", "newTabUrl", "objectName", "openIn", "opensInNewTab", "order", "params", "recordIdField", "recordIdParam", "refreshAfter", "requiredPermissions", "requiresFeature", "resultDialog", "shortcut", "successMessage", "target", "type", "undoable", "variant", "visible"];
131
+ export declare const SPEC_ACTION_KEYS: readonly ["_lock", "_lockDocsUrl", "_lockReason", "_lockSource", "_packageId", "_packageVersion", "_provenance", "ai", "aria", "body", "bodyExtra", "bodyShape", "bulkEnabled", "component", "confirmText", "description", "disabled", "errorMessage", "execute", "execution", "icon", "label", "locations", "method", "mode", "name", "newTabUrl", "objectName", "onSuccess", "openIn", "opensInNewTab", "operation", "order", "outcomeMessages", "params", "patch", "recordIdField", "recordIdParam", "refreshAfter", "requiredPermissions", "requiresFeature", "resultDialog", "shortcut", "successMessage", "target", "type", "undoable", "variant", "visible"];
129
132
  /**
130
133
  * The `navigation` alias's own spelling of a target, read off the action itself
131
134
  * when no nested `navigate` object is present (`ActionRunner.executeNavigation`).
@@ -137,6 +140,54 @@ export declare const SPEC_ACTION_KEYS: readonly ["_lock", "_lockDocsUrl", "_lock
137
140
  * runner itself supports.
138
141
  */
139
142
  export declare const NAVIGATION_ALIAS_KEYS: readonly ["to", "external", "newTab", "replace"];
143
+ /**
144
+ * Keys a HOST composes on the DISPATCH OBJECT at dispatch time — chrome the
145
+ * runtime reads once on its way to the dialog, that no author ever writes and
146
+ * no store ever holds.
147
+ *
148
+ * Distinct from every other list in this module, and the distinction is the
149
+ * whole point: each of the three lists above restates one AUTHORED surface —
150
+ * what `ActionDef` itself declares, what the spec's `ActionSchema` declares,
151
+ * and the `navigation` alias's objectui dialect — so a key joining one of them
152
+ * is a key an author may legally write. This list claims no such derivation and
153
+ * must not acquire one: a key here is the opposite, and writing it in metadata
154
+ * is still a compile error that must stay one. Maintainer ruling
155
+ * 2026-08-22 fixes both halves of that: ⛔ the key is NOT declared on
156
+ * `ActionDef` and ⛔ NOT added to {@link ACTION_DEF_KEYS}; it is declared at the
157
+ * seam, on `packages/app-shell/src/consoleActionDispatch.ts`'s
158
+ * `ConsoleActionDispatch`, and appears HERE only so the dev-mode warning below
159
+ * stops calling it unknown.
160
+ *
161
+ * Why the warning has to know: `classifyActionKeys` sees the object the runner
162
+ * was handed, which is the DISPATCH, not the stored metadata row. With the key
163
+ * absent from the inventory, `warnOnUnknownActionKeys` told the author that a
164
+ * key TWO files read is one "no reader recognizes", and prescribed promoting it
165
+ * to `ActionDef` — the one shape the ruling forbids for it. A diagnostic that
166
+ * fires on the product's own privileged path is how a console gets muted.
167
+ *
168
+ * {@link HOST_STASHED_PARAM_KEYS} below is the same category one level down —
169
+ * host-composed keys inside `params` rather than on the action itself — and
170
+ * cites `DeclaredActionsBar` by name for the same reason this does. Two lists
171
+ * because the two warnings ask different questions of different objects, not
172
+ * because the categories differ.
173
+ *
174
+ * `overrideNotice` — the privileged-override safety copy (objectui#5178),
175
+ * naming the approvers about to be bypassed.
176
+ * - producer: `packages/app-shell/src/views/DeclaredActionsBar.tsx`, on the
177
+ * `can_act:false && can_override:true` branch.
178
+ * - readers: `packages/app-shell/src/hooks/useConsoleActionRuntime.tsx` and
179
+ * `packages/app-shell/src/views/RecordDetailView.tsx`, the console's two
180
+ * param-collection handlers, which render it ahead of the declared
181
+ * description in the dialog's subtitle.
182
+ *
183
+ * Anything added here must satisfy all three of: composed by a host in code,
184
+ * never read back out of stored metadata, and read by the runtime. A key an
185
+ * AUTHOR is meant to write belongs on `ActionDef` — or, when the spec owns it,
186
+ * in `@objectstack/spec` first — and not in this list. `actionKeys.pin.test.ts`
187
+ * pins the contents exactly, so growing the set is a deliberate, reviewed edit
188
+ * rather than a quiet one.
189
+ */
190
+ export declare const HOST_DISPATCH_ACTION_KEYS: readonly ["overrideNotice"];
140
191
  /**
141
192
  * Keys the spec has TOMBSTONED: still present in `ActionSchema` so the parser can
142
193
  * reject them BY NAME with a rename prescription, rather than fail with a bare
@@ -156,7 +207,16 @@ export declare const NAVIGATION_ALIAS_KEYS: readonly ["to", "external", "newTab"
156
207
  * a tombstone the spec keeps only in order to reject it by name.
157
208
  */
158
209
  export declare const RETIRED_ACTION_KEYS: Readonly<Record<string, string>>;
159
- /** Every key an action may legitimately carry today. */
210
+ /**
211
+ * Every key an action may legitimately carry today — authored or host-composed.
212
+ *
213
+ * Four inputs, three of them mirrors of an authored surface and the fourth
214
+ * ({@link HOST_DISPATCH_ACTION_KEYS}) the host-composed dispatch chrome. The
215
+ * union is what `classifyActionKeys` consults, and it is deliberately wider
216
+ * than the authored surface: the runner classifies the object it was HANDED,
217
+ * and a host hands it a dispatch. Membership here grants nothing to an author —
218
+ * `ActionDef` is what decides that, and it is closed.
219
+ */
160
220
  export declare const KNOWN_ACTION_KEYS: ReadonlySet<string>;
161
221
  /** Split an action's own keys into the two things worth saying out loud. */
162
222
  export declare function classifyActionKeys(action: object | null | undefined): {
@@ -169,9 +229,11 @@ export declare function resetActionKeyWarnings(): void;
169
229
  * Dev-mode only: name the keys an action carries that no reader will ever look
170
230
  * at. Non-breaking by construction — it changes no types and rejects nothing.
171
231
  *
172
- * Silently binding no handler is the #2169 "Mark Done does nothing" shape, and
173
- * the compiler cannot help while the index signature stands. Until it comes
174
- * down, this is the audible half.
232
+ * Silently binding no handler is the objectstack-ai/objectstack#2169 "Mark Done does nothing" shape. The
233
+ * compiler now catches it in action literals AUTHORED IN CODE — objectstack#4075
234
+ * step 3 closed `ActionDef` — but not in the actions that arrive as DATA, which
235
+ * reach the runner unparsed and which no compiler ever looked at. This is the
236
+ * audible half for that population; see this module's header.
175
237
  */
176
238
  export declare function warnOnUnknownActionKeys(action: object | null | undefined, where?: string): void;
177
239
  /**
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * That asymmetry was the issue. An open key set on a DECLARED METADATA CONTRACT
20
20
  * is what lets a typo (`targt`, `exectue`) and a tombstoned key (`execute`) both
21
- * sail through to a runner that then silently does nothing — the #2169 "Mark
21
+ * sail through to a runner that then silently does nothing — the objectstack-ai/objectstack#2169 "Mark
22
22
  * Done does nothing" shape.
23
23
  *
24
24
  * This module was step 1 of the staged narrowing: make the key set VISIBLE and
@@ -74,10 +74,12 @@
74
74
  * rejection" into a compile error at no cost. Hand-copying would have quietly
75
75
  * re-legitimized two dead keys — which is why the types are derived.
76
76
  *
77
- * 17 keys `ActionDef` declares that the spec does not own — `actionType`, `api`,
77
+ * 16 keys `ActionDef` declares that the spec does not own — `actionType`, `api`,
78
78
  * `chain`, `chainMode`, `close`, `condition`, `confirm`, `endpoint`, `modal`,
79
- * `navigate`, `onClick`, `onFailure`, `onSuccess`, `redirect`, `reload`, `toast`,
80
- * `actionParams`. Step 2 marked `@deprecated`, with the spec spelling to use
79
+ * `navigate`, `onClick`, `onFailure`, `redirect`, `reload`, `toast`,
80
+ * `actionParams`. (`onSuccess` was the 17th until objectui#5934 retired the
81
+ * runner's chained-callback meaning; the key is now spec-owned and derived,
82
+ * like the 18 below.) Step 2 marked `@deprecated`, with the spec spelling to use
81
83
  * instead, ONLY the four the runner itself proves are aliases: `actionType` (→
82
84
  * `type`), `api` and `endpoint` (→ `target`; `executeAPI` resolves
83
85
  * `api || endpoint || target`), and `navigate` (→ flat `target`/`openIn`;
@@ -106,9 +108,10 @@
106
108
  /**
107
109
  * Every property `ActionDef` declares, in declaration order.
108
110
  *
109
- * Kept as data because TypeScript types do not survive to runtime — and
110
- * `keyof ActionDef` cannot substitute for this list: the index signature widens
111
- * it to `string | number`, which is precisely the problem being worked around.
111
+ * Kept as data because TypeScript types do not survive to runtime — `keyof
112
+ * ActionDef` is erased along with the interface, so it cannot hand a runtime
113
+ * classifier a list of anything. `actionKeys.pin.test.ts` re-derives this one
114
+ * from the interface's AST, which is what keeps the data true.
112
115
  */
113
116
  export const ACTION_DEF_KEYS = [
114
117
  'type',
@@ -153,7 +156,6 @@ export const ACTION_DEF_KEYS = [
153
156
  'modal',
154
157
  'chain',
155
158
  'chainMode',
156
- 'onSuccess',
157
159
  'onFailure',
158
160
  'opensInNewTab',
159
161
  'newTabUrl',
@@ -171,13 +173,30 @@ export const ACTION_DEF_KEYS = [
171
173
  'component',
172
174
  'objectName',
173
175
  'ai',
174
- 'aria',
176
+ // `aria` left this list, with its `ActionDef` field, when `@objectstack/spec`
177
+ // 17.5.0 retired `action.aria` as a `retiredKey()` tombstone (objectui#10929):
178
+ // the derived type had become `undefined`, so the field mirrored nothing. It
179
+ // stays in `SPEC_ACTION_KEYS` below, because `ActionSchema` still declares the
180
+ // tombstone.
175
181
  'bodyExtra',
176
182
  'bodyShape',
183
+ // The declarative single-record field write (spec 17.3.0). Promoted from
184
+ // inventory-only to declared `ActionDef` fields when the runner learned to
185
+ // read them — the branch that dispatches `operation: 'update'` on the
186
+ // platform action route, ahead of `type`.
187
+ 'operation',
188
+ 'patch',
177
189
  'mode',
178
190
  'recordIdField',
179
191
  'recordIdParam',
180
192
  'requiresFeature',
193
+ // Moved from the runner-native cluster above by objectui#5934: the legacy
194
+ // chained-callback meaning is retired and the key's type now derives the
195
+ // spec's `{ navigate, openIn }` block.
196
+ 'onSuccess',
197
+ // Spec 17.6.0's success copy per handler outcome (objectui#11344), declared
198
+ // when the runner learned to read it: the success toast's first rung.
199
+ 'outcomeMessages',
181
200
  'shortcut',
182
201
  'bulkEnabled',
183
202
  ];
@@ -227,6 +246,14 @@ export const SPEC_ACTION_KEYS = [
227
246
  'disabled',
228
247
  'errorMessage',
229
248
  'execute',
249
+ // Added to `ActionSchema` in @objectstack/spec 17.5.0 (objectui#11073): the
250
+ // bulk dispatch contract the action's body is written for, in
251
+ // `bulkActionDefs`' own `'perRecord' | 'aggregate'` vocabulary. Listed for the
252
+ // reason `description` is — this array restates the spec's declared keys, so
253
+ // an action carrying it is not reported as having an unknown key. `ActionDef`
254
+ // does NOT declare it and the runner does not read it: the spec's own
255
+ // enforcement is `@objectstack/lint`'s authoring-time check.
256
+ 'execution',
230
257
  'icon',
231
258
  'label',
232
259
  'locations',
@@ -235,10 +262,35 @@ export const SPEC_ACTION_KEYS = [
235
262
  'name',
236
263
  'newTabUrl',
237
264
  'objectName',
265
+ // Declared by `ActionSchema` as of @objectstack/spec 17.1.0 (objectui#5328).
266
+ // All four declared action surfaces forward it since objectui#5493/#6304, and
267
+ // `ActionDef` derives its type from the spec since objectui#5934 retired the
268
+ // runner's legacy chained-callback meaning for the same key.
269
+ 'onSuccess',
238
270
  'openIn',
239
271
  'opensInNewTab',
272
+ // Added to `ActionSchema` in @objectstack/spec 17.3.0 (objectui#7122), the
273
+ // declarative single-record field write that mirrors a list view's
274
+ // `bulkActionDefs`: `operation: 'update'` applies `patch` (merged UNDER the
275
+ // collected `params`) to the current record on the data plane AS THE CALLER.
276
+ //
277
+ // Both keys were inventory-ONLY when that bump landed, under the maintainer's
278
+ // 2026-09-05 ruling on it ("record both as justified omissions now; forward
279
+ // only the key a runtime actually reads, once its semantics are read from
280
+ // upstream — no speculative forwarding"). That condition is now met: the
281
+ // runner reads both (`executeUpdateOperation`, dispatched ahead of `type`),
282
+ // `ActionDef` declares both, and every action surface forwards them — which
283
+ // is what `check:action-forward-parity` now requires rather than excuses.
284
+ 'operation',
240
285
  'order',
286
+ // Added to `ActionSchema` in @objectstack/spec 17.6.0 (objectstack#21095,
287
+ // objectui#11344): success copy per handler outcome, keyed by the snake_case
288
+ // `outcome` the handler returns. `ActionDef` declares it (derived) and the
289
+ // runner reads it as the success toast's first rung, ahead of
290
+ // `successMessage`.
291
+ 'outcomeMessages',
241
292
  'params',
293
+ 'patch',
242
294
  'recordIdField',
243
295
  'recordIdParam',
244
296
  'refreshAfter',
@@ -264,6 +316,54 @@ export const SPEC_ACTION_KEYS = [
264
316
  * runner itself supports.
265
317
  */
266
318
  export const NAVIGATION_ALIAS_KEYS = ['to', 'external', 'newTab', 'replace'];
319
+ /**
320
+ * Keys a HOST composes on the DISPATCH OBJECT at dispatch time — chrome the
321
+ * runtime reads once on its way to the dialog, that no author ever writes and
322
+ * no store ever holds.
323
+ *
324
+ * Distinct from every other list in this module, and the distinction is the
325
+ * whole point: each of the three lists above restates one AUTHORED surface —
326
+ * what `ActionDef` itself declares, what the spec's `ActionSchema` declares,
327
+ * and the `navigation` alias's objectui dialect — so a key joining one of them
328
+ * is a key an author may legally write. This list claims no such derivation and
329
+ * must not acquire one: a key here is the opposite, and writing it in metadata
330
+ * is still a compile error that must stay one. Maintainer ruling
331
+ * 2026-08-22 fixes both halves of that: ⛔ the key is NOT declared on
332
+ * `ActionDef` and ⛔ NOT added to {@link ACTION_DEF_KEYS}; it is declared at the
333
+ * seam, on `packages/app-shell/src/consoleActionDispatch.ts`'s
334
+ * `ConsoleActionDispatch`, and appears HERE only so the dev-mode warning below
335
+ * stops calling it unknown.
336
+ *
337
+ * Why the warning has to know: `classifyActionKeys` sees the object the runner
338
+ * was handed, which is the DISPATCH, not the stored metadata row. With the key
339
+ * absent from the inventory, `warnOnUnknownActionKeys` told the author that a
340
+ * key TWO files read is one "no reader recognizes", and prescribed promoting it
341
+ * to `ActionDef` — the one shape the ruling forbids for it. A diagnostic that
342
+ * fires on the product's own privileged path is how a console gets muted.
343
+ *
344
+ * {@link HOST_STASHED_PARAM_KEYS} below is the same category one level down —
345
+ * host-composed keys inside `params` rather than on the action itself — and
346
+ * cites `DeclaredActionsBar` by name for the same reason this does. Two lists
347
+ * because the two warnings ask different questions of different objects, not
348
+ * because the categories differ.
349
+ *
350
+ * `overrideNotice` — the privileged-override safety copy (objectui#5178),
351
+ * naming the approvers about to be bypassed.
352
+ * - producer: `packages/app-shell/src/views/DeclaredActionsBar.tsx`, on the
353
+ * `can_act:false && can_override:true` branch.
354
+ * - readers: `packages/app-shell/src/hooks/useConsoleActionRuntime.tsx` and
355
+ * `packages/app-shell/src/views/RecordDetailView.tsx`, the console's two
356
+ * param-collection handlers, which render it ahead of the declared
357
+ * description in the dialog's subtitle.
358
+ *
359
+ * Anything added here must satisfy all three of: composed by a host in code,
360
+ * never read back out of stored metadata, and read by the runtime. A key an
361
+ * AUTHOR is meant to write belongs on `ActionDef` — or, when the spec owns it,
362
+ * in `@objectstack/spec` first — and not in this list. `actionKeys.pin.test.ts`
363
+ * pins the contents exactly, so growing the set is a deliberate, reviewed edit
364
+ * rather than a quiet one.
365
+ */
366
+ export const HOST_DISPATCH_ACTION_KEYS = ['overrideNotice'];
267
367
  /**
268
368
  * Keys the spec has TOMBSTONED: still present in `ActionSchema` so the parser can
269
369
  * reject them BY NAME with a rename prescription, rather than fail with a bare
@@ -283,15 +383,25 @@ export const NAVIGATION_ALIAS_KEYS = ['to', 'external', 'newTab', 'replace'];
283
383
  * a tombstone the spec keeps only in order to reject it by name.
284
384
  */
285
385
  export const RETIRED_ACTION_KEYS = {
286
- execute: '`execute` was removed in @objectstack/spec 17 (#3855) — rename the key to `target`. ' +
386
+ execute: '`execute` was removed in @objectstack/spec 17 (objectstack-ai/objectstack#3855) — rename the key to `target`. ' +
287
387
  'The value (a script name or expression) is unchanged. ' +
288
388
  'Run `os migrate meta --from 16` to rewrite it automatically.',
289
389
  };
290
- /** Every key an action may legitimately carry today. */
390
+ /**
391
+ * Every key an action may legitimately carry today — authored or host-composed.
392
+ *
393
+ * Four inputs, three of them mirrors of an authored surface and the fourth
394
+ * ({@link HOST_DISPATCH_ACTION_KEYS}) the host-composed dispatch chrome. The
395
+ * union is what `classifyActionKeys` consults, and it is deliberately wider
396
+ * than the authored surface: the runner classifies the object it was HANDED,
397
+ * and a host hands it a dispatch. Membership here grants nothing to an author —
398
+ * `ActionDef` is what decides that, and it is closed.
399
+ */
291
400
  export const KNOWN_ACTION_KEYS = new Set([
292
401
  ...ACTION_DEF_KEYS,
293
402
  ...SPEC_ACTION_KEYS,
294
403
  ...NAVIGATION_ALIAS_KEYS,
404
+ ...HOST_DISPATCH_ACTION_KEYS,
295
405
  ].filter((key) => !(key in RETIRED_ACTION_KEYS)));
296
406
  /** Split an action's own keys into the two things worth saying out loud. */
297
407
  export function classifyActionKeys(action) {
@@ -326,9 +436,11 @@ const isDev = () => globalThis.process?.env?.NODE_ENV !==
326
436
  * Dev-mode only: name the keys an action carries that no reader will ever look
327
437
  * at. Non-breaking by construction — it changes no types and rejects nothing.
328
438
  *
329
- * Silently binding no handler is the #2169 "Mark Done does nothing" shape, and
330
- * the compiler cannot help while the index signature stands. Until it comes
331
- * down, this is the audible half.
439
+ * Silently binding no handler is the objectstack-ai/objectstack#2169 "Mark Done does nothing" shape. The
440
+ * compiler now catches it in action literals AUTHORED IN CODE — objectstack#4075
441
+ * step 3 closed `ActionDef` — but not in the actions that arrive as DATA, which
442
+ * reach the runner unparsed and which no compiler ever looked at. This is the
443
+ * audible half for that population; see this module's header.
332
444
  */
333
445
  export function warnOnUnknownActionKeys(action, where = 'ActionRunner') {
334
446
  if (!isDev())
@@ -351,8 +463,11 @@ export function warnOnUnknownActionKeys(action, where = 'ActionRunner') {
351
463
  console.warn(`[${where}] action "${String(name)}" carries ${unknown.length === 1 ? 'a key' : 'keys'} no reader ` +
352
464
  `recognizes: \`${unknown.join('`, `')}\`. Nothing will read ${unknown.length === 1 ? 'it' : 'them'} — ` +
353
465
  'check for a typo, or promote the key to an explicit field on `ActionDef` ' +
354
- '(packages/core/src/actions/actionKeys.ts). Warned rather than rejected because `ActionDef` ' +
355
- 'still carries `[key: string]: any`, so the compiler cannot see this (objectstack#4075).');
466
+ '(packages/core/src/actions/ActionRunner.ts), adding it to `ACTION_DEF_KEYS` ' +
467
+ '(packages/core/src/actions/actionKeys.ts) in the SAME commit — the pin test derives one ' +
468
+ 'from the other, so either edit alone goes red. Warned rather than rejected because `tsc` ' +
469
+ 'only sees actions authored in code: this one may have arrived as DATA, and stored ' +
470
+ '`sys_metadata` rows reach the runner unparsed (objectstack#3903).');
356
471
  }
357
472
  /**
358
473
  * Keys a HOST stashes into an action's `params` for the runner's own plumbing,
@@ -47,7 +47,7 @@
47
47
  * - **transport-level `success: false`** — the outer envelope reporting a
48
48
  * failure directly.
49
49
  */
50
- import { actionErrorDetail } from './actionErrorDetail';
50
+ import { actionErrorDetail } from './actionErrorDetail.js';
51
51
  /**
52
52
  * The handler's own return value — one level deeper than the action envelope.
53
53
  *
@@ -59,7 +59,7 @@ import { actionErrorDetail } from './actionErrorDetail';
59
59
  export function readActionPayload(envelope) {
60
60
  // objectstack#3962 servers single-wrap: `body.data` IS the handler value,
61
61
  // so most of the time this is the identity function. Only the exact LEGACY
62
- // action envelope (pre-#3962: a boolean `success` and no keys beyond the
62
+ // action envelope (pre-objectstack-ai/objectstack#3962: a boolean `success` and no keys beyond the
63
63
  // envelope's own) is unwrapped one more level — a handler value that
64
64
  // merely contains a `success` key passes through untouched.
65
65
  if (isLegacyActionEnvelope(envelope)) {
@@ -82,7 +82,7 @@ export function isLegacyActionEnvelope(v) {
82
82
  */
83
83
  export function interpretActionResponse(res, json, label) {
84
84
  const envelope = json?.data;
85
- // Pre-#3962 servers reported a rejection as HTTP 200 with the inner
85
+ // Pre-objectstack-ai/objectstack#3962 servers reported a rejection as HTTP 200 with the inner
86
86
  // `{success:false, error}`; current servers answer a real status, which
87
87
  // `res.ok` catches first. Detected narrowly so a handler value that merely
88
88
  // contains `success: false` is not misread as a failure.
@@ -14,3 +14,5 @@ export * from './bulkFastPath.js';
14
14
  export * from './actionErrorDetail.js';
15
15
  export * from './actionResponse.js';
16
16
  export * from './serverActionHandler.js';
17
+ export * from './recordIdParam.js';
18
+ export * from './recordDelete.js';
@@ -14,3 +14,5 @@ export * from './bulkFastPath.js';
14
14
  export * from './actionErrorDetail.js';
15
15
  export * from './actionResponse.js';
16
16
  export * from './serverActionHandler.js';
17
+ export * from './recordIdParam.js';
18
+ export * from './recordDelete.js';
@@ -0,0 +1,118 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ /**
9
+ * The ONE record-delete core — the confirm question and the delete itself —
10
+ * that every host's list Delete binds to (objectui#10383).
11
+ *
12
+ * ## Why this lives here, and why there is only one
13
+ *
14
+ * The console's object list deleted through `useObjectActions` (`app-shell`):
15
+ * the confirm question, the single delete with its ADR-0094 detection, the bulk
16
+ * delete and their toasts were written inline in that hook. The registered
17
+ * `object-view` renderer (`plugin-view`) had no delete at all — its grid
18
+ * handlers only refreshed — and the first repair COPIED those steps into a
19
+ * second flow. The copy already diverged on consent: it asked every row the
20
+ * plain "delete this record?" question, while the console asks a package-owned
21
+ * permission set the honest reset question. One operation with two
22
+ * implementations drifts on exactly the part that matters, so the rule is: the
23
+ * side with the governance keeps it, the other side re-binds to it, and there
24
+ * is one copy. This module is that copy, and both hosts call it.
25
+ *
26
+ * `@object-ui/core` is the lowest package both hosts already depend on. The
27
+ * host-specific pieces are INJECTED — the translator, the toast sink, the data
28
+ * source and the refresh — so this package gains no i18n or toast dependency.
29
+ * The host keeps its own confirm UI (`app-shell` runs the question through the
30
+ * action runner's confirm handler; `plugin-view` renders it in its own
31
+ * AlertDialog); the QUESTION comes from {@link recordDelete}.confirmText.
32
+ *
33
+ * ## ADR-0094 — a package-owned permission set is RESET, not deleted
34
+ *
35
+ * "Deleting" a `sys_permission_set` row whose `managed_by` is `'package'` does
36
+ * not remove it: the backend drops the environment overlay and resets the set
37
+ * to its shipped baseline. So the confirm asks the reset question and the
38
+ * success toast says "reset" — a promise of an irreversible delete the user can
39
+ * then see did not happen would be the dishonest copy. The row passed in is
40
+ * read first; when the caller has only an id (an SDUI header delete), the row
41
+ * is looked up with `findOne`, best-effort — a failed lookup falls back to the
42
+ * generic copy rather than blocking the delete.
43
+ *
44
+ * ## The result shape is the action runner's, on purpose
45
+ *
46
+ * `run` returns what a registered `delete` handler returns, because the console
47
+ * registers it as exactly that. The toasts here are the AUTHORITATIVE feedback,
48
+ * so every path returns WITHOUT an `error` key (and success returns `silent`) —
49
+ * otherwise the runner's post-execution hook, which has its own toast handler,
50
+ * would toast the same outcome a second time. The single exception is a
51
+ * request with no record id at all, which toasts nothing here and returns the
52
+ * `error` for the runner to report.
53
+ *
54
+ * Record ids are forwarded exactly as the caller supplied them; nothing here
55
+ * converts them.
56
+ */
57
+ import type { ActionResult } from './ActionRunner.js';
58
+ type Row = Record<string, unknown>;
59
+ /** Translate a key — the host's `t`, injected so core takes no i18n dependency. */
60
+ type Translate = (key: string, options?: Record<string, unknown>) => string;
61
+ /** Everything `run` needs from its host. `confirmText` needs only the first two. */
62
+ interface RecordDeleteDeps {
63
+ objectName: string;
64
+ t: Translate;
65
+ /** The object's display label, used by the toasts. */
66
+ label: string;
67
+ dataSource: {
68
+ delete(resource: string, id: string): Promise<unknown>;
69
+ findOne(resource: string, id: string): Promise<unknown>;
70
+ };
71
+ /** The host's toast sink (sonner's `toast` in both hosts today). */
72
+ toast: {
73
+ success(message: string): unknown;
74
+ error(message: string, data?: {
75
+ description?: string;
76
+ }): unknown;
77
+ };
78
+ /** Re-read the list after a delete. */
79
+ onRefresh?: () => void;
80
+ }
81
+ /**
82
+ * The request, in the action runner's `delete` shape — the console registers
83
+ * `run` as its `delete` handler, so the runner's action arrives here verbatim:
84
+ * `params.records` (several), `params.recordId` + optional `params.record`
85
+ * (one), and the legacy top-level `recordId`.
86
+ */
87
+ interface RecordDeleteRequest {
88
+ params?: {
89
+ records?: unknown;
90
+ recordId?: unknown;
91
+ record?: Row | null;
92
+ };
93
+ recordId?: unknown;
94
+ }
95
+ /**
96
+ * The record-delete core: `confirmText` is the question to ask before deleting
97
+ * one record, `run` performs the delete (one record, or several settled
98
+ * together) and reports it. See the module docblock for objectui#10383 and
99
+ * ADR-0094.
100
+ */
101
+ export declare const recordDelete: Readonly<{
102
+ /**
103
+ * The question to ask before deleting ONE record: the reset question for a
104
+ * package-owned permission set (ADR-0094), the plain delete question
105
+ * otherwise. Reads only the row it is handed — no lookup.
106
+ */
107
+ confirmText(deps: Pick<RecordDeleteDeps, "objectName" | "t">, record?: Row | null): string;
108
+ /**
109
+ * Delete, refresh and report. Several records (`params.records`, more than
110
+ * one with an `id`) are deleted one call each and settled together, then the
111
+ * list refreshes and ONE summary toast reports the batch. Otherwise one
112
+ * record is deleted; on success the list refreshes and a success toast shows
113
+ * (the reset copy for a package-owned permission set), on failure an error
114
+ * toast carries the error message and the list is left as it is.
115
+ */
116
+ run(deps: RecordDeleteDeps, request: RecordDeleteRequest): Promise<ActionResult>;
117
+ }>;
118
+ export {};