MDK Logo

Foundation general

General TypeScript types from ui-foundation

General type definitions from the ui-foundation package.

Package

@tetherto/mdk-ui-foundation

Types

@tetherto/mdk-ui-foundation

Import the public APIs on this page from @tetherto/mdk-ui-foundation.

ApiError

Shared error contract used across HTTP/API surfaces.

type ApiError = { error: string message: string status: number data?: { message?: string } }

ImportResult

The outcome of importing a settings file: whether it succeeded, which settings were applied, and any errors to show.

type ImportResult = { success: boolean applied?: string[] errors?: string[] message?: string }

PermLevel

The access a role has over one resource: read and write, read only, or false for none.

type PermLevel = 'rw' | 'r' | false

RoleOption

A selectable role in a dropdown: the stored value and the label shown for it.

type RoleOption = { label: string value: string }

RolesPermissionsData

The permissions matrix behind the roles screen: the level each role holds over each resource, with the display labels for those resources.

type RolesPermissionsData = { permissions: Record<string, Record<string, PermLevel>> labels: Record<string, string> }

SettingsExportData

The contents of an exported settings file. Every field is optional, so a partial export still imports, and extra product-specific fields can be added.

type SettingsExportData = { headerControls?: Record<string, boolean> featureFlags?: Record<string, boolean> timestamp?: string version?: string } & TExtra

SettingsUser

A user row on the settings screen. Carries the identity and role fields the UI needs, and tolerates extra fields the backend adds.

type SettingsUser = { id: string name?: string email: string role: string last_login?: string lastActive?: string [key: string]: unknown }

SubscriberCallback

A listener called with the new value whenever a store changes.

type SubscriberCallback = (value: T) => void

UnknownRecord

Generic type for objects with unknown structure.

type UnknownRecord = Record<string, unknown>

Unsubscribe

Call to stop a subscription. Returned when you subscribe to a store.

type Unsubscribe = () => void

On this page