@cosmicdrift/kumiko-types 0.231.0 → 0.233.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.231.0",
3
+ "version": "0.233.0",
4
4
  "description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
package/src/fields.ts CHANGED
@@ -371,6 +371,9 @@ export type NumberFieldDef = {
371
371
  /** `true` → `integer` column + `.int()` Zod validation. Omitted/`false` →
372
372
  * `double precision` column, fractional values allowed. */
373
373
  readonly integer?: boolean;
374
+ /** Display-only suffix: a static string, or a sibling field name whose
375
+ * value supplies it. Never converts the stored number. */
376
+ readonly unit?: string | { readonly field: string };
374
377
  } & ResolvedPiiFlags;
375
378
 
376
379
  /**
package/src/nav-icon.ts CHANGED
@@ -1,12 +1,13 @@
1
- // Closed vocabulary of nav icon keys. NavDefinition.icon, ScreenNavSugar.icon
2
- // and ConfigMask.icon are all typed against this union, so an unregistered
3
- // key is a compile error at the r.nav()/r.screen()/config-mask call site
4
- // instead of a silent missing-icon at runtime.
1
+ // Closed vocabulary of nav and button icon keys. NavDefinition.icon,
2
+ // ScreenNavSugar.icon, ConfigMask.icon and ButtonProps.icon/iconEnd are all
3
+ // typed against this union, so an unregistered key is a compile error at the
4
+ // r.nav()/r.screen()/config-mask/button call site instead of a silent
5
+ // missing-icon at runtime.
5
6
  //
6
- // The renderer-web NAV_ICONS map (packages/renderer-web/src/layout/
7
- // nav-tree.tsx) is checked against this same union via `satisfies`, so the
8
- // two can't drift — add a key here only together with its lucide-react entry
9
- // there, and vice versa.
7
+ // The renderer-web NAV_ICONS map (packages/renderer-web/src/icons.tsx) is
8
+ // checked against this same union via `satisfies`, so the two can't drift —
9
+ // add a key here only together with its lucide-react entry there, and vice
10
+ // versa.
10
11
  export type NavIconKey =
11
12
  | "dashboard"
12
13
  | "layout-grid"
@@ -55,4 +56,10 @@ export type NavIconKey =
55
56
  | "upload"
56
57
  | "rocket"
57
58
  | "plus"
58
- | "languages";
59
+ | "languages"
60
+ | "trash"
61
+ | "x"
62
+ | "check"
63
+ | "arrow-left"
64
+ | "arrow-right"
65
+ | "copy";
package/src/screen.ts CHANGED
@@ -34,7 +34,7 @@ export type PlatformComponent = {
34
34
  // formats it as a locale-formatted number with a literal "m²" suffix. The
35
35
  // rest map to a CLDR-sanctioned Intl.NumberFormat unit id and get
36
36
  // locale-correct pluralization/spacing straight from Intl.
37
- export type UnitKey = "m2" | "km" | "m" | "kg" | "percent";
37
+ export type UnitKey = "m2" | "km" | "m" | "kg" | "percent" | "mi";
38
38
 
39
39
  // Built-in value formatters. Apps extend via module augmentation:
40
40
  // declare module "@cosmicdrift/kumiko-framework/engine/types" {
package/src/step.ts CHANGED
@@ -76,6 +76,15 @@ export type PipelineCtx<
76
76
  */
77
77
  export type StepResolver<T, TPayload = unknown> = T | ((ctx: PipelineCtx<TPayload>) => T);
78
78
 
79
+ // Branded event-type string — the only route r.step.waitForEvent's `event`
80
+ // can reach a value. A workflow's `awaits` declaration (D4,
81
+ // workflow-resume-loop.md) is the only source of these; buildPipelineSteps
82
+ // mints them from that declaration's raw strings when it builds the
83
+ // closure's `awaits` binding. A raw string literal at waitForEvent.event is
84
+ // a compile error, so a typo in the awaited key surfaces at build time
85
+ // instead of a run that waits forever.
86
+ export type AwaitedEventType = string & { readonly __awaitedEvent: unique symbol };
87
+
79
88
  // Serializable AST for r.step.waitForEvent's `match` argument. Persisted
80
89
  // verbatim into the waiting-for-event suspension payload (jsonb), so it
81
90
  // must survive a JSON round-trip — a closure cannot.
@@ -164,9 +173,23 @@ export type StepInstance = {
164
173
  * `stepsPipeline<{ greeting: string }, { echoed: string }>(...)`
165
174
  * Better DX is a known follow-up — see step-vocabulary.md M.1-Followups.
166
175
  */
167
- export type PipelineDef<TPayload = unknown, _TData = unknown> = {
176
+ export type PipelineDef<
177
+ TPayload = unknown,
178
+ _TData = unknown,
179
+ TAwaits extends Record<string, AwaitedEventType> = Record<string, AwaitedEventType>,
180
+ > = {
168
181
  readonly __kind: "pipeline";
169
- readonly build: (ctx: PipelineBuildCtx<TPayload>) => readonly StepInstance[];
182
+ // Raw (unbranded) awaits map, set by defineWorkflow — absent for
183
+ // non-workflow pipelines (plain defineWriteHandler perform).
184
+ // buildPipelineSteps reads it and brands it into the closure's `awaits`
185
+ // binding, so every existing buildPipelineSteps caller keeps working
186
+ // unchanged. Deliberately typed as plain strings, NOT `TAwaits` — an
187
+ // extra covariant occurrence of TAwaits here (alongside its contravariant
188
+ // occurrence in `build`'s parameter) breaks TypeScript's contextual
189
+ // inference for a `stepsPipeline(...)` passed inline as `steps` (verified
190
+ // empirically; see fw#2513 Phase 3a).
191
+ readonly awaits?: Readonly<Record<string, string>>;
192
+ readonly build: (ctx: PipelineBuildCtx<TPayload, TAwaits>) => readonly StepInstance[];
170
193
  };
171
194
 
172
195
  /**
@@ -188,9 +211,16 @@ export type PipelineDef<TPayload = unknown, _TData = unknown> = {
188
211
  * skip validation. See validate-projection-allowlist.ts for the
189
212
  * boot-side mechanics.
190
213
  */
191
- export type PipelineBuildCtx<TPayload = unknown> = {
214
+ export type PipelineBuildCtx<
215
+ TPayload = unknown,
216
+ TAwaits extends Record<string, AwaitedEventType> = Record<string, AwaitedEventType>,
217
+ > = {
192
218
  readonly event: WriteEvent<TPayload>;
193
219
  readonly r: StepBuilder;
220
+ // Declared awaited events (D4, workflow-resume-loop.md) — the only way
221
+ // r.step.waitForEvent's `event` arg can reference an event type. `{}` for
222
+ // non-workflow pipelines and workflows without an `awaits` declaration.
223
+ readonly awaits: TAwaits;
194
224
  };
195
225
 
196
226
  /**
@@ -339,7 +369,7 @@ export type StepNamespace = {
339
369
  // Runtime guard: throws when used inside sync defineWriteHandler.
340
370
  readonly wait: (args: { readonly for: StepResolver<string> }) => StepInstance;
341
371
  readonly waitForEvent: (args: {
342
- readonly event: string;
372
+ readonly event: AwaitedEventType;
343
373
  readonly match?: StepResolver<EventMatch>;
344
374
  readonly timeout: StepResolver<string>;
345
375
  }) => StepInstance;