@cosmicdrift/kumiko-types 0.390.1 → 0.391.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.
@@ -12,6 +12,7 @@ import type { AccessRule, AuthClaimsFn, ClaimKeyHandle, ClaimKeyType, Declarativ
12
12
  import type { HookPhase, PostDeleteHookFn, PostQueryHookFn, PostSaveHookFn, PreDeleteHookFn, PreSaveHookFn, SearchPayloadContributorFn, ValidationHookFn } from "./hooks.ts";
13
13
  import type { HttpRouteDefinition } from "./http-route.ts";
14
14
  import type { ContentCollectionDefinition, NavDefinition } from "./nav.ts";
15
+ import type { ProbeOptions } from "./probe.ts";
15
16
  import type { EntityProjectionExtension, MultiStreamProjectionDefinition, ProjectionDefinition } from "./projection.ts";
16
17
  import type { RelationDefinition } from "./relations.ts";
17
18
  import type { ScreenDefinition } from "./screen.ts";
@@ -293,6 +294,7 @@ export type FeatureRegistrar<TFeature extends string = string> = {
293
294
  secret(definition: {
294
295
  readonly name: string;
295
296
  } & SecretOptions): SecretKeyHandle;
297
+ probe(options: ProbeOptions): void;
296
298
  secretNamespace(shortName: string, options: SecretNamespaceOptions): SecretNamespaceHandle;
297
299
  secretNamespace(definition: {
298
300
  readonly name: string;
package/dist/feature.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { AuthClaimsFn, AuthClaimsHookDef, ClaimKeyDefinition, EventDef, Eve
7
7
  import type { EntityHookMap, HookMap, HookPhase, OwnedFn, PostDeleteHookFn, PostQueryHookFn, PostSaveHookFn, PreDeleteHookFn, PreSaveHookFn, SearchPayloadContributorFn } from "./hooks.ts";
8
8
  import type { HttpRouteDefinition } from "./http-route.ts";
9
9
  import type { ContentCollectionDefinition, NavDefinition } from "./nav.ts";
10
+ import type { ProbeDefinition } from "./probe.ts";
10
11
  import type { EntityProjectionExtension, MultiStreamProjectionDefinition, ProjectionDefinition } from "./projection.ts";
11
12
  import type { EntityRelations, RelationDefinition } from "./relations.ts";
12
13
  import type { ScreenDefinition } from "./screen.ts";
@@ -179,6 +180,7 @@ export type FeatureDefinition = {
179
180
  readonly metrics: Readonly<Record<string, FeatureMetricDef>>;
180
181
  readonly secretKeys: Readonly<Record<string, SecretKeyDefinition>>;
181
182
  readonly secretNamespaces: Readonly<Record<string, SecretNamespaceDefinition>>;
183
+ readonly probes?: Readonly<Record<string, ProbeDefinition>>;
182
184
  readonly projections: Readonly<Record<string, ProjectionDefinition>>;
183
185
  readonly entityProjectionExtensions?: Readonly<Record<string, readonly EntityProjectionExtension[]>>;
184
186
  readonly multiStreamProjections: Readonly<Record<string, MultiStreamProjectionDefinition>>;
package/dist/fields.d.ts CHANGED
@@ -233,11 +233,11 @@ export type SelectFieldDef<TOptions extends readonly string[] = readonly string[
233
233
  readonly optionTones?: {
234
234
  readonly [K in TOptions[number]]?: SelectOptionTone;
235
235
  };
236
- /** Loads the options from this query (QN). Contract:
237
- * `{ rows: { value, label, description?, group? }[] }`, labels are shown verbatim
238
- * (not translated); description is a muted second line, group a heading. `options` must be empty when set.
239
- * Only valid on configEdit/actionForm screen fields and config keys, not on entity
240
- * fields: the stored value would not be checked against the query result. */
236
+ /** Loads the options from this query (QN), labels shown verbatim: `{ rows: { value, label,
237
+ * description?, group?, default? }[] }`; description is a muted second line, group a heading.
238
+ * actionForm only: the first `default: true` row seeds an empty field like a prefill (not a
239
+ * change); set `submitPrefilled` to submit it unchanged. `options` must be empty when set.
240
+ * Only valid on configEdit/actionForm screen fields and config keys, not entity fields. */
241
241
  readonly optionsQuery?: string;
242
242
  /** Payload sent with every `optionsQuery` call. `{ field }` entries re-load the
243
243
  * options when that sibling field changes. */
@@ -0,0 +1,45 @@
1
+ import type { JobContext } from "./handlers.ts";
2
+ import type { TenantId } from "./identifiers.ts";
3
+ export type ProbeScope = "tenant" | "system";
4
+ export type ProbeCost = "free" | "paid";
5
+ export type ProbeText = {
6
+ readonly key: string;
7
+ readonly params?: Readonly<Record<string, string | number>>;
8
+ };
9
+ export type ProbeTarget = {
10
+ readonly id: string;
11
+ readonly label: ProbeText;
12
+ readonly ownerUserId?: string;
13
+ };
14
+ export type ProbeVerdict = {
15
+ readonly status: "ok";
16
+ readonly message: ProbeText;
17
+ } | {
18
+ readonly status: "skipped";
19
+ readonly message: ProbeText;
20
+ };
21
+ export type ProbeContext = Pick<JobContext, "db" | "registry" | "obs" | "tz" | "services"> & {
22
+ readonly probeRunId: string;
23
+ readonly tenantId: TenantId;
24
+ readonly triggeredByUserId: string;
25
+ readonly triggeredByEmail: string | undefined;
26
+ };
27
+ export type ProbeOptions = {
28
+ readonly name: string;
29
+ readonly scope: ProbeScope;
30
+ readonly cost: ProbeCost;
31
+ /** i18n key, column "Bereich" */
32
+ readonly area: string;
33
+ /** i18n key, column "Check" (used when the probe has no targets) */
34
+ readonly label: string;
35
+ /** Default 10_000 */
36
+ readonly timeoutMs?: number;
37
+ /** Screen QN linked from a failed result */
38
+ readonly fixScreen?: string;
39
+ readonly targets?: (ctx: ProbeContext) => Promise<readonly ProbeTarget[]>;
40
+ /** Failure = throw */
41
+ readonly run: (ctx: ProbeContext, target: ProbeTarget | undefined) => Promise<ProbeVerdict>;
42
+ };
43
+ export type ProbeDefinition = ProbeOptions & {
44
+ readonly qualifiedName: string;
45
+ };
package/dist/probe.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -70,6 +70,11 @@ export type ListColumnSpec = string | {
70
70
  readonly display?: ListColumnDisplay;
71
71
  /** Row field naming the badge tone; only with `display: "badge"`. */
72
72
  readonly badgeToneField?: string;
73
+ /** Row field holding a screen QN (`<feature>:screen:<id>`): the cell links
74
+ * to that screen when the row sets it and the user may open it. For
75
+ * query-backed lists (projectionList, relatedList), whose rows can point
76
+ * at a different screen each. */
77
+ readonly linkScreenField?: string;
73
78
  };
74
79
  export type ListColumnDisplay = "bar" | "badge" | "datetime";
75
80
  export type ListBadgeTone = "positive" | "warn" | "negative" | "neutral";
@@ -1,7 +1,8 @@
1
1
  import type { SelectOptionTone } from "./fields.ts";
2
2
  import type { AccessRule, AgentScreenHints } from "./handlers.ts";
3
+ import type { NavIconKey } from "./nav-icon.ts";
3
4
  import type { PlatformComponent, ScreenNavSugar, ScreenSlots } from "./screen.ts";
4
- import type { DashboardPanelVisibility } from "./screen-dashboard.ts";
5
+ import type { DashboardPanelVisibility, DashboardStatTone } from "./screen-dashboard.ts";
5
6
  import type { EditLayout, ListEmptyStateSpec } from "./screen-entity-edit.ts";
6
7
  import type { ListColumnSpec, ListPaginationMode, ListSortSpec, RowAction, RowActionMode, RowFieldExtractor, ScreenFilter, ToolbarAction } from "./screen-entity-list.ts";
7
8
  import type { ListBulkAction } from "./screen-list-bulk.ts";
@@ -150,6 +151,10 @@ export type MetricSpec = {
150
151
  readonly field: string;
151
152
  readonly label: string;
152
153
  readonly navigate?: MetricNavigate;
154
+ /** Tile color as on dashboard stat panels; not applied while the value is 0. */
155
+ readonly tone?: DashboardStatTone;
156
+ /** Icon chip of the tile; only drawn with `metricsStyle: "tiles"`. */
157
+ readonly icon?: NavIconKey;
153
158
  };
154
159
  export type ProjectionDetailScreenDefinition = {
155
160
  readonly id: string;
@@ -187,6 +192,10 @@ export type ProjectionDetailScreenDefinition = {
187
192
  * can reach the query — a stray id on the path is ignored, never
188
193
  * forwarded. */
189
194
  readonly singleton?: boolean;
195
+ /** Refetches the record and its relatedList sections when their entity
196
+ * changes (live SSE), for a screen that shows work a background job is
197
+ * still doing. Needs queries named `<feature>:query:<entity>:<verb>`. */
198
+ readonly live?: boolean;
190
199
  readonly layout: EditLayout;
191
200
  /** Optional per-field label i18n key (field name → key), analogous to
192
201
  * entityEdit.fieldLabels. The pseudo entity `__projection-detail__` has
@@ -199,6 +208,8 @@ export type ProjectionDetailScreenDefinition = {
199
208
  /** Metric band above the layout — column names in the query row, each with its own i18n `label`.
200
209
  * Rendered only when set. */
201
210
  readonly metrics?: readonly MetricSpec[];
211
+ /** "tiles" draws the metrics as the dashboard KPI tiles (StatCard) instead of the plain band. */
212
+ readonly metricsStyle?: "band" | "tiles";
202
213
  /** Parent list screen (short id) for a "back" navigation. */
203
214
  readonly listScreenId?: string;
204
215
  readonly slots?: ScreenSlots;
package/dist/screen.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { SelectOptionTone } from "./fields.ts";
1
2
  import type { NavIconKey } from "./nav-icon.ts";
2
3
  import type { ActionFormScreenDefinition, SecretMintScreenDefinition } from "./screen-action-form.ts";
3
4
  import type { ConfigEditScreenDefinition, CustomScreenDefinition, SecretsEditScreenDefinition } from "./screen-custom-config.ts";
@@ -59,7 +60,11 @@ export interface FieldFormatRegistry {
59
60
  };
60
61
  enumOption: {
61
62
  readonly keyPrefix: string;
63
+ readonly tones?: Readonly<Partial<Record<string, SelectOptionTone>>>;
62
64
  };
65
+ /** Value is a `DashboardI18nText` (`{ i18nKey, i18nParams }`) a query built
66
+ * server-side, or a plain i18n key, translated in the user's language. */
67
+ i18nText: Record<never, never>;
63
68
  /** JSON-safe structured value rendered as indented text. */
64
69
  json: {
65
70
  readonly indent?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.390.1",
3
+ "version": "0.391.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": "MIT",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -285,6 +285,10 @@
285
285
  "./temporal": {
286
286
  "types": "./dist/temporal.d.ts",
287
287
  "default": "./dist/temporal.js"
288
+ },
289
+ "./probe": {
290
+ "types": "./dist/probe.d.ts",
291
+ "default": "./dist/probe.js"
288
292
  }
289
293
  },
290
294
  "devDependencies": {
@@ -572,6 +576,10 @@
572
576
  "./temporal": {
573
577
  "types": "./dist/temporal.d.ts",
574
578
  "default": "./dist/temporal.js"
579
+ },
580
+ "./probe": {
581
+ "types": "./dist/probe.d.ts",
582
+ "default": "./dist/probe.js"
575
583
  }
576
584
  }
577
585
  },
package/src/changes.json CHANGED
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.391.0",
4
+ "type": "improvement",
5
+ "title": "i18nText format, enumOption tones, linkScreenField, live projectionDetail and metric tiles",
6
+ "detail": "FormatSpec gains { format: \"i18nText\" } for values that are a server-built { i18nKey, i18nParams } or a plain i18n key. enumOption takes tones per option value. ListColumnSpec takes linkScreenField, the row field holding the screen QN the cell links to. ProjectionDetailScreenDefinition takes live and metricsStyle (\"band\" or \"tiles\"); MetricSpec takes tone and icon."
7
+ },
2
8
  {
3
9
  "version": "0.389.0",
4
10
  "type": "breaking",