UNPKG

integreat

Version:
78 lines (77 loc) 2.44 kB
import type { TransformDefinition } from 'map-transform/types.js'; import type { Action, Transporter, Adapter, Condition, ValidateObject } from '../types.js'; export type TransformDefinitions = Record<string, string | TransformDefinition>; export interface IdentConfigProps { id?: string; roles?: string | null; tokens?: string | null; } export interface IdentConfig { type: string; props?: IdentConfigProps; mapping?: Record<string, string | null>; completeIdent?: boolean; } export type ActionMapper = (action: Action) => Action; export type AuthOptions = Record<string, unknown>; export interface Authentication extends Record<string, unknown> { status: string; error?: string; authKey?: string; expire?: number; } export interface AuthDef { id: string; authenticator: string; options: AuthOptions; overrideAuthAsMethod?: string; } export type AuthProp = AuthDef | string | boolean | null; export interface AuthObject { incoming?: AuthProp | AuthProp[]; outgoing?: AuthProp; } export interface TransporterOptions extends Record<string, unknown> { doSetTargetService?: boolean; incoming?: Record<string, unknown>; } export interface ServiceOptions extends TransporterOptions { transporter?: TransporterOptions; adapters?: Record<string, Record<string, unknown>>; } export interface PreparedOptions { transporter: TransporterOptions; adapters?: Record<string, Record<string, unknown>>; } export interface MatchObject { action?: string | string[]; type?: string | string[]; scope?: string | string[]; params?: Record<string, boolean | undefined>; conditions?: TransformDefinition[]; filters?: Record<string, Condition | boolean | undefined>; incoming?: boolean; } export interface EndpointDef { id?: string; adapters?: (string | Adapter)[]; auth?: AuthObject | AuthProp; match?: MatchObject; validate?: ValidateObject[]; mutation?: TransformDefinition; mutate?: TransformDefinition; allowRawRequest?: boolean; allowRawResponse?: boolean; castWithoutDefaults?: boolean; options?: ServiceOptions; } export interface ServiceDef { id: string; transporter?: string | Transporter; adapters?: (string | Adapter)[]; auth?: AuthObject | AuthProp; meta?: string; options?: ServiceOptions; mutation?: TransformDefinition; endpoints: EndpointDef[]; }