@cosmicdrift/kumiko-types 0.351.0 → 0.352.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/dist/fields.d.ts CHANGED
@@ -213,6 +213,14 @@ export type SelectFieldDef<TOptions extends readonly string[] = readonly string[
213
213
  /** Payload sent with every `optionsQuery` call. `{ field }` entries re-load the
214
214
  * options when that sibling field changes. */
215
215
  readonly optionsQueryPayload?: OptionsQueryPayload;
216
+ /** Marks static options as unavailable per tenant (e.g. by tier). Contract:
217
+ * `{ rows: { value: string; disabled?: boolean; hint?: string }[] }`. The renderer
218
+ * loads it (with `optionsQueryPayload` resolved like for `optionsQuery`, `{}` when
219
+ * absent) and merges it onto `options`: `disabled` disables the option, `hint` becomes
220
+ * its description. The currently stored value always stays enabled; unknown values
221
+ * are ignored. Static `options` stay authoritative, and the write path must enforce
222
+ * the same rule (see `withTierOptionGate`), the renderer only mirrors it. */
223
+ readonly optionsAvailabilityQuery?: string;
216
224
  } & ResolvedPiiFlags;
217
225
  export type MultiSelectFieldDef<TOptions extends readonly string[] = readonly string[]> = {
218
226
  readonly type: "multiSelect";
@@ -2,7 +2,7 @@ import type { Redis } from "ioredis";
2
2
  import type { ZodType } from "zod";
3
3
  import type { CacheSyncBus } from "./cache-sync-types.js";
4
4
  import type { ConfigAccessor, ConfigAccessorFactory, ConfigResolver } from "./config.js";
5
- import type { DbConnection } from "./db-connection.js";
5
+ import type { DbConnection, DbTx } from "./db-connection.js";
6
6
  import type { DerivativesContext } from "./derivatives-types.js";
7
7
  import type { EntityCache } from "./entity-cache.js";
8
8
  import type { EventMetadata, WriteOrigin } from "./event-store-types.js";
@@ -505,12 +505,24 @@ export type AgentExposure = {
505
505
  };
506
506
  /** Undoes a reservation made before the handler transaction. */
507
507
  export type ReservationRelease = () => Promise<void>;
508
- /** Runs in the dispatcher after access and schema checks but before the
509
- * handler transaction opens, so it must commit its own short write instead
510
- * of holding a second connection while the transaction is open. The returned
511
- * release runs when the transaction does not commit (failure result, throw,
512
- * rollback, failed commit). Throwing a KumikoError rejects the write. */
513
- export type PreTransactionReservation = (event: WriteEvent, ctx: HandlerContext) => Promise<ReservationRelease | undefined>;
508
+ /** The dispatcher's own open handler transaction: a reservation must settle on it, not on
509
+ * HandlerContext, whose db is fail-closed for r.systemScope() handlers. */
510
+ export type ReservationConfirmContext = {
511
+ readonly tx: DbTx;
512
+ readonly tenantId: TenantId;
513
+ };
514
+ /** A reservation that also settles inside the handler transaction. `confirmInTransaction` runs
515
+ * after the handler succeeded and before COMMIT; a throw fails the write and rolls it back. */
516
+ export type ReservationHandle = {
517
+ readonly release: ReservationRelease;
518
+ readonly confirmInTransaction: (confirm: ReservationConfirmContext) => Promise<void>;
519
+ };
520
+ /** Runs in the dispatcher after every pre-handler gate (feature, rate limit, access, schema,
521
+ * validation, field roles) passed but before the handler transaction opens, so it must commit
522
+ * its own short write instead of holding a second connection while the transaction is open.
523
+ * The returned release (or handle.release) runs when the transaction does not commit (failure
524
+ * result, throw, rollback, failed commit). Throwing a KumikoError rejects the write. */
525
+ export type PreTransactionReservation = (event: WriteEvent, ctx: HandlerContext) => Promise<ReservationRelease | ReservationHandle | undefined>;
514
526
  export type WriteHandlerDef = {
515
527
  readonly name: string;
516
528
  readonly schema: ZodType;
package/dist/screen.d.ts CHANGED
@@ -734,7 +734,10 @@ export type DashboardStatPanel = DashboardPanelQueryOptions & DashboardPanelGate
734
734
  /** Static CSS color value (e.g. "var(--color-debt)") for the icon chip,
735
735
  * passed straight to the tile without a registry lookup. Applies ONLY when
736
736
  * `icon` is set (StatCard renders the chip only together with an icon);
737
- * without an icon the value is silently dropped. */
737
+ * without an icon the value is silently dropped. Without `accentColor` the
738
+ * chip follows the tone, including a `toneField` value delivered per result.
739
+ * An accent that should change with the result (e.g. by sign) goes through
740
+ * `toneField`; leave `accentColor` unset then. */
738
741
  readonly accentColor?: string;
739
742
  };
740
743
  export type DashboardChartKind = "timeseries" | "stacked-bars" | "segment-bars" | "stacked-area";
@@ -796,6 +799,7 @@ export type DashboardStatGroupPanel = DashboardPanelGate & {
796
799
  readonly label?: string;
797
800
  /** i18n key, a line under `label`; the boot validator requires `label`. */
798
801
  readonly subtitle?: string;
802
+ readonly span?: DashboardPanelSpan;
799
803
  readonly stats: readonly DashboardStatPanel[];
800
804
  };
801
805
  export type DashboardFeedPanel = DashboardPanelQueryOptions & DashboardPanelEmptyState & DashboardPanelGate & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-types",
3
- "version": "0.351.0",
3
+ "version": "0.352.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/changes.json CHANGED
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "version": "0.352.0",
4
+ "type": "improvement",
5
+ "title": "SelectFieldDef.optionsAvailabilityQuery marks static select options as unavailable per tenant",
6
+ "detail": "The query returns { rows: { value, disabled?, hint? }[] }; the renderer merges it onto options and keeps the stored value enabled."
7
+ },
8
+ {
9
+ "version": "0.352.0",
10
+ "type": "breaking",
11
+ "title": "Apps must import Temporal from @cosmicdrift/kumiko-types/temporal instead of temporal-polyfill (affects every app since 0.351.0)",
12
+ "detail": "Since 0.351.0 the native globalThis.Temporal wins over the polyfill. A Temporal imported from \"temporal-polyfill\" is a second implementation, so instanceof and z.instanceof(Temporal.Instant) reject values the framework creates. This applies whether you upgrade from before 0.351.0 or are already on it.",
13
+ "migration": "Replace every value import from \"temporal-polyfill\" in app code and tests, e.g. `import { Temporal } from \"temporal-polyfill\"`, with `import { Temporal } from \"@cosmicdrift/kumiko-types/temporal\"`, and drop side-effect imports of \"temporal-polyfill/global\" (importing @cosmicdrift/kumiko-types/temporal already installs the global when the runtime has none). `import type` and `/// <reference types=\"temporal-polyfill/global\" />` may stay. Then run `kumiko check`; the No-Temporal-Polyfill-Import guard lists anything left. Close the step with `kumiko-upgrade --resolve <id> --reason \"<what you changed>\"`, or add `--not-applicable` when the repo never imported temporal-polyfill."
14
+ },
2
15
  {
3
16
  "version": "0.351.0",
4
17
  "type": "fix",