@cosmicdrift/kumiko-types 0.159.1 → 0.161.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.
@@ -0,0 +1,25 @@
1
+ // WhereValue: primitive for eq, array for IN, null for IS NULL, or an
2
+ // operator-object for range/comparisons.
3
+ export type WhereOperator = {
4
+ readonly gt?: unknown;
5
+ readonly gte?: unknown;
6
+ readonly lt?: unknown;
7
+ readonly lte?: unknown;
8
+ readonly ne?: unknown;
9
+ readonly in?: readonly unknown[];
10
+ readonly like?: string;
11
+ };
12
+ export type WhereValue = unknown | WhereOperator;
13
+ export type WhereObject = Record<string, WhereValue>;
14
+
15
+ export type OrderByClause = {
16
+ readonly col: string;
17
+ readonly direction?: "asc" | "desc";
18
+ };
19
+
20
+ export type SelectOptions = {
21
+ readonly limit?: number;
22
+ // Single column or array for multi-column tie-breaks (e.g.
23
+ // [{col: "createdAt"}, {col: "id"}] for chronological-with-stable-id).
24
+ readonly orderBy?: OrderByClause | readonly OrderByClause[];
25
+ };
@@ -0,0 +1,42 @@
1
+ import type { AccessRule } from "./handlers";
2
+
3
+ // Workspace declaration. A workspace is a persona-/role-scoped UI surface:
4
+ // pure UI composition with no backend, DB or auth impact. The engine stores
5
+ // these verbatim and the active web shell (shellWorkspaces) renders the
6
+ // switcher and filters the nav tree by membership + access.
7
+ //
8
+ // Membership is computed from two sources, merged at boot:
9
+ // 1. r.workspace({ nav: [...] }) — explicit list of nav QNs
10
+ // 2. r.nav({ workspaces: [...] }) — nav entry self-assigns to workspaces
11
+ // A nav entry that appears in neither source belongs to no workspace and
12
+ // only shows up when no workspace is active (legacy / non-workspace apps).
13
+ //
14
+ // Cross-feature references are allowed: `nav` may point at any registered
15
+ // nav QN. The boot validator checks references exist and that workspace
16
+ // IDs referenced from r.nav are real.
17
+ export type WorkspaceDefinition = {
18
+ // Feature author writes the short id ("disposition"); the registry
19
+ // overwrites `id` with the qualified name ("bmc:workspace:disposition")
20
+ // in its stored copy. Same pattern as NavDefinition / ScreenDefinition.
21
+ readonly id: string;
22
+ // i18n translation key. Resolved at render time by the renderer's
23
+ // useTranslation hook; engine keeps it opaque.
24
+ readonly label: string;
25
+ // Icon key — whatever the icon registry of the active renderer understands.
26
+ // Engine doesn't validate; unknown icons surface as a missing icon on
27
+ // screen, not a boot failure (mirrors NavDefinition.icon).
28
+ readonly icon?: string;
29
+ // Sort weight in the workspace switcher (lower = earlier). Ties broken
30
+ // by registration order — features registered later appear lower.
31
+ readonly order?: number;
32
+ // Role / openToAll gate. Only users matching this rule see the workspace
33
+ // in their switcher. Mirrors NavDefinition.access — same semantics across
34
+ // the UI surface, so a default-deny app can do `{ roles: [] }`.
35
+ readonly access?: AccessRule;
36
+ // Explicit nav QNs that belong to this workspace. Merged with any nav
37
+ // entries that self-assign via r.nav({ workspaces: [...] }).
38
+ readonly nav?: readonly string[];
39
+ // Default workspace at login when the user has access to multiple. Boot
40
+ // validator rejects more than one default per app.
41
+ readonly default?: boolean;
42
+ };
@@ -0,0 +1,22 @@
1
+ // Plain, JSON-serializable snapshot of a KumikoError for use on the write-path
2
+ // (WriteResult.error, BatchResult.error). The dispatcher stores results under
3
+ // an idempotency key — a KumikoError instance wouldn't round-trip through
4
+ // JSON, so we keep structural data only and rebuild the instance on demand
5
+ // via reraiseAsKumikoError when we need to throw upstream again.
6
+ export type WriteErrorInfo = {
7
+ readonly code: string;
8
+ readonly httpStatus: number;
9
+ readonly i18nKey: string;
10
+ readonly i18nParams?: Readonly<Record<string, unknown>>;
11
+ readonly message: string;
12
+ readonly details?: unknown;
13
+ };
14
+
15
+ // The failure half of WriteResult — `{ isSuccess: false } + error`. Named
16
+ // so the write-failure factories in write-error-info.ts and WriteResult
17
+ // share one shape instead of restating it. Not generic: the error carries
18
+ // zero data, so there's nothing for the caller to narrow.
19
+ export type WriteFailure = {
20
+ readonly isSuccess: false;
21
+ readonly error: WriteErrorInfo;
22
+ };