@aletheia-dev/api-client 0.1.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/CHANGELOG.md +15 -0
- package/LICENSE +202 -0
- package/README.md +22 -0
- package/dist/index.cjs +948 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2215 -0
- package/dist/index.d.ts +2215 -0
- package/dist/index.js +1065 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2215 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import * as _aletheia_dev_core from '@aletheia-dev/core';
|
|
3
|
+
import { TenantSettings, AuditFilter, AuditEvent, AuditExportFormat, DefinitionKind, DefinitionVersionSummary, DefinitionDiff, ApprovalCommentInput, DefinitionApproval, StepTypeDescription, FieldTypeDescription, UpsertCollectionFlowInput, UpsertWorkflowDefinitionInput, CaseStatus, CasePriority, CaseSlaState, CaseSort, SortOrder, DecideCaseInput, AssignCaseInput, CloseCaseInput, CaseNoteInput, UpsertCaseQueueInput, CaseQueue, CaseView, CaseNote, DirectoryUser, DocumentStatus, CreateDocumentInput, DocumentUploadTicket, Document, DocumentDownload, StartWorkflowRunInput, WorkflowRun, AddListEntriesInput, CreateSubjectInput, Subject, SubjectListQuery, TimelineQuery, TimelineEntry, CreateSubmissionInput, SaveSubmissionInput, CollectionSubmission, IngestEventsInput, IngestEventsResult, Event, StartBacktestInput, Backtest, Decision, PluginDefinition, ConfigurePluginInput, PluginInvocation, List, UpsertListInput, ListEntry, ListImportResult, RemoveListEntriesInput, UpsertRuleDefinitionInput, UpsertRuleSetInput } from '@aletheia-dev/core';
|
|
4
|
+
export { ActorType, AddListEntriesInput, AggregationPolicy, ApprovalCommentInput, ApprovalDecision, AssignCaseInput, AuditEvent, AuditExportFormat, AuditFilter, Backtest, BacktestProgress, BacktestSample, BacktestSampleFailure, BacktestStatus, BacktestSummary, Case, CaseFilter, CaseNote, CaseNoteInput, CasePriority, CaseQueue, CaseSlaState, CaseSort, CaseStatus, CaseView, CloseCaseInput, Condition, ConditionOp, CreateDocumentInput, DEFINITION_PATHS, DOCUMENT_CONTENT_TYPES, DOCUMENT_MAX_BYTES, DOCUMENT_OPEN_STATUSES, DefinitionApproval, DefinitionDiff, DefinitionIssue, DefinitionKind, DefinitionVersionSummary, DiffChange, DiffOp, DirectoryUser, Document, DocumentContentType, DocumentDownload, DocumentScan, DocumentStatus, DocumentUploadTicket, Event, EventKey, FieldTypeDescription, FileFieldValue, FormUiHints, IngestEventsInput, IngestEventsResult, IssueSeverity, List, ListEntry, ListImportResult, ListKind, NewEvent, NewListEntry, RemoveListEntriesInput, RuleSetBody, RuleSetDefinition, RuleSetRule, RuleSetUseCase, ScoreBand, ScoreClamp, SortOrder, StartBacktestInput, StepTypeDescription, Subject, SubjectKind, SubjectListQuery, SubjectStatus, TenantSettings, TimelineEntry, TimelineKind, TimelineQuery, UpsertCaseQueueInput, UpsertListInput, UpsertRuleSetInput, ValidationReport, WebOrigin, bandFor, caseSlaState, normalizeListValue } from '@aletheia-dev/core';
|
|
5
|
+
|
|
6
|
+
/** Shape of every non-2xx body returned by the API. */
|
|
7
|
+
interface ApiErrorBody {
|
|
8
|
+
error: {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
details?: unknown;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Thrown by the client for any non-2xx response. `status` is the HTTP status. */
|
|
15
|
+
declare class ApiError extends Error {
|
|
16
|
+
readonly status: number;
|
|
17
|
+
readonly code: string;
|
|
18
|
+
readonly details?: unknown | undefined;
|
|
19
|
+
constructor(message: string, status: number, code: string, details?: unknown | undefined);
|
|
20
|
+
/** Builds an ApiError from a response status and its (possibly non-JSON) body. */
|
|
21
|
+
static fromResponse(status: number, statusText: string, body: unknown): ApiError;
|
|
22
|
+
}
|
|
23
|
+
declare function isApiErrorBody(value: unknown): value is ApiErrorBody;
|
|
24
|
+
declare function isApiError(value: unknown): value is ApiError;
|
|
25
|
+
/** True for a 401 `unauthenticated` response: the caller must (re-)sign in. */
|
|
26
|
+
declare function isUnauthenticated(value: unknown): value is ApiError;
|
|
27
|
+
/** Permission or provisioning failures: the caller is signed in but may not act. */
|
|
28
|
+
declare const FORBIDDEN_CODES: readonly ["forbidden", "tenant_not_provisioned"];
|
|
29
|
+
/** True for a 403 response (`forbidden` or `tenant_not_provisioned`). */
|
|
30
|
+
declare function isForbidden(value: unknown): value is ApiError;
|
|
31
|
+
/** True when the signed-in organization has no tenant in Aletheia yet. */
|
|
32
|
+
declare function isTenantNotProvisioned(value: unknown): value is ApiError;
|
|
33
|
+
|
|
34
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
35
|
+
/** Returns the current bearer token, or nothing when the caller is not signed in. */
|
|
36
|
+
type AccessTokenProvider = () => Promise<string | undefined> | string | undefined;
|
|
37
|
+
interface HttpOptions {
|
|
38
|
+
baseUrl: string;
|
|
39
|
+
getAccessToken: AccessTokenProvider;
|
|
40
|
+
fetch: FetchLike;
|
|
41
|
+
}
|
|
42
|
+
/** One query value; arrays are serialised as repeated parameters (`status=a&status=b`). */
|
|
43
|
+
type QueryValue = string | number | boolean | undefined | null | readonly string[];
|
|
44
|
+
type Query = Record<string, QueryValue>;
|
|
45
|
+
/** A body sent verbatim with an explicit content type (e.g. a CSV upload). */
|
|
46
|
+
interface RawBody {
|
|
47
|
+
content: string;
|
|
48
|
+
contentType: string;
|
|
49
|
+
}
|
|
50
|
+
interface RequestOptions {
|
|
51
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
52
|
+
query?: Query;
|
|
53
|
+
/** JSON-encoded request body. Ignored when `raw` is set. */
|
|
54
|
+
body?: unknown;
|
|
55
|
+
/** Raw text body; takes precedence over `body`. */
|
|
56
|
+
raw?: RawBody;
|
|
57
|
+
}
|
|
58
|
+
/** Minimal transport: sets the bearer header, encodes query & body (JSON or raw text), maps errors. */
|
|
59
|
+
declare class Http {
|
|
60
|
+
private readonly options;
|
|
61
|
+
constructor(options: HttpOptions);
|
|
62
|
+
request(path: string, options?: RequestOptions): Promise<unknown>;
|
|
63
|
+
/** Requests and parses the body with `schema` (dates are coerced by the core schemas). */
|
|
64
|
+
parsed<T extends z.ZodType>(schema: T, path: string, options?: RequestOptions): Promise<z.output<T>>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Tenant-level settings (`/tenants/me/settings`, `tenants:settings`). */
|
|
68
|
+
interface TenantsClient {
|
|
69
|
+
getSettings: () => Promise<TenantSettings>;
|
|
70
|
+
/** Replaces the whole settings object; the API rejects malformed origins with a 400. */
|
|
71
|
+
/** Full replace; omitted sections (e.g. `cases`) fall back to their defaults. */
|
|
72
|
+
updateSettings: (body: z.input<typeof TenantSettings>) => Promise<TenantSettings>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Filters of `GET /audit-events` and its export. `action` is a prefix match (`case.` matches
|
|
77
|
+
* `case.decided`); `from`/`to` bound `occurredAt` and are sent as ISO strings.
|
|
78
|
+
*/
|
|
79
|
+
type AuditFilterQuery = Omit<AuditFilter, 'from' | 'to'> & {
|
|
80
|
+
from?: Date | string;
|
|
81
|
+
to?: Date | string;
|
|
82
|
+
};
|
|
83
|
+
/** `GET /audit-events` query: the filters plus offset paging (newest first). */
|
|
84
|
+
type AuditListQuery = AuditFilterQuery & {
|
|
85
|
+
limit?: number;
|
|
86
|
+
offset?: number;
|
|
87
|
+
};
|
|
88
|
+
interface AuditClient {
|
|
89
|
+
/** Audit events matching `query`, newest first (`audit:read`). */
|
|
90
|
+
list: (query?: AuditListQuery) => Promise<AuditEvent[]>;
|
|
91
|
+
/** Absolute URL of the export endpoint for a filter (the request still needs the bearer token). */
|
|
92
|
+
exportUrl: (format: AuditExportFormat, filter?: AuditFilterQuery) => string;
|
|
93
|
+
/** Downloads the filtered export with the bearer token; the last line is the manifest. */
|
|
94
|
+
export: (format: AuditExportFormat, filter?: AuditFilterQuery) => Promise<Blob>;
|
|
95
|
+
}
|
|
96
|
+
/** Flattens the filter into transport parameters (empty values are dropped by `buildUrl`). */
|
|
97
|
+
declare function auditFilterParams(filter?: AuditFilterQuery): Query;
|
|
98
|
+
/** Outcome of checking an export against its trailing manifest. */
|
|
99
|
+
interface ExportVerification {
|
|
100
|
+
/** True when a manifest was found and its digest matches the body. */
|
|
101
|
+
ok: boolean;
|
|
102
|
+
/** Row count stated by the manifest (0 when there is none). */
|
|
103
|
+
rows: number;
|
|
104
|
+
/** Digest stated by the manifest, when present. */
|
|
105
|
+
expected?: string;
|
|
106
|
+
/** SHA-256 (hex) of the body before the manifest line. */
|
|
107
|
+
actual: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Checks an exported file against its manifest (the last line: `# sha256=<hex> rows=<n>` for
|
|
111
|
+
* CSV, `{"_manifest":{"sha256","rows"}}` for JSONL). The digest covers every byte before the
|
|
112
|
+
* manifest line, including the newline that ends the last data row, as the server hashes it.
|
|
113
|
+
*/
|
|
114
|
+
declare function verifyExport(text: string, format: AuditExportFormat): Promise<ExportVerification>;
|
|
115
|
+
|
|
116
|
+
/** Response of `POST .../approve` and `.../reject`: the decided approval and the definition. */
|
|
117
|
+
declare const ApprovalOutcome: z.ZodObject<{
|
|
118
|
+
approval: z.ZodObject<{
|
|
119
|
+
id: z.ZodGUID;
|
|
120
|
+
tenantId: z.ZodGUID;
|
|
121
|
+
kind: z.ZodEnum<{
|
|
122
|
+
workflow: "workflow";
|
|
123
|
+
rule: "rule";
|
|
124
|
+
rule_set: "rule_set";
|
|
125
|
+
collection_flow: "collection_flow";
|
|
126
|
+
}>;
|
|
127
|
+
key: z.ZodString;
|
|
128
|
+
version: z.ZodNumber;
|
|
129
|
+
requestedBy: z.ZodString;
|
|
130
|
+
requestedAt: z.ZodCoercedDate<unknown>;
|
|
131
|
+
comment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
132
|
+
decidedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
133
|
+
decidedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
134
|
+
decision: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
135
|
+
rejected: "rejected";
|
|
136
|
+
approved: "approved";
|
|
137
|
+
}>>>;
|
|
138
|
+
decisionComment: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
definition: z.ZodUnknown;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
type ApprovalOutcome = z.infer<typeof ApprovalOutcome>;
|
|
143
|
+
/** Version pair of a diff; `from` defaults to the published version, `to` to the latest. */
|
|
144
|
+
interface DiffQuery {
|
|
145
|
+
from?: number;
|
|
146
|
+
to?: number;
|
|
147
|
+
}
|
|
148
|
+
interface ApprovalListQuery {
|
|
149
|
+
kind?: DefinitionKind;
|
|
150
|
+
}
|
|
151
|
+
interface GovernanceClient {
|
|
152
|
+
/** Every version of a definition, with status, author and approval (`definitions:read`). */
|
|
153
|
+
versions: (kind: DefinitionKind, key: string) => Promise<DefinitionVersionSummary[]>;
|
|
154
|
+
/** The full definition entity of one version, e.g. to restore it as a draft. */
|
|
155
|
+
getVersion: (kind: DefinitionKind, key: string, version: number) => Promise<unknown>;
|
|
156
|
+
/** Structured diff between two versions with a readable summary per change. */
|
|
157
|
+
diff: (kind: DefinitionKind, key: string, query?: DiffQuery) => Promise<DefinitionDiff>;
|
|
158
|
+
/** Moves a draft to `pending_approval` (`definitions:write`). */
|
|
159
|
+
requestApproval: (kind: DefinitionKind, key: string, version: number, body?: ApprovalCommentInput) => Promise<DefinitionApproval>;
|
|
160
|
+
/** Approves and publishes a pending version (`definitions:approve`). */
|
|
161
|
+
approve: (kind: DefinitionKind, key: string, version: number, body?: ApprovalCommentInput) => Promise<ApprovalOutcome>;
|
|
162
|
+
/** Sends a pending version back to draft (`definitions:approve`). */
|
|
163
|
+
reject: (kind: DefinitionKind, key: string, version: number, body?: ApprovalCommentInput) => Promise<ApprovalOutcome>;
|
|
164
|
+
approvals: {
|
|
165
|
+
/** Approvals awaiting a decision, optionally for one definition kind. */
|
|
166
|
+
listOpen: (query?: ApprovalListQuery) => Promise<DefinitionApproval[]>;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/** Schema endpoints that drive the builder's forms (`definitions:read`). */
|
|
171
|
+
interface BuilderClient {
|
|
172
|
+
/** Every workflow step type with its config JSON Schema, ui hints and data paths. */
|
|
173
|
+
stepTypes: () => Promise<StepTypeDescription[]>;
|
|
174
|
+
/** Every collection-flow field type with its options and value schemas. */
|
|
175
|
+
fieldTypes: () => Promise<FieldTypeDescription[]>;
|
|
176
|
+
}
|
|
177
|
+
type ValidateWorkflowBody = z.input<typeof UpsertWorkflowDefinitionInput>;
|
|
178
|
+
type ValidateCollectionFlowBody = z.input<typeof UpsertCollectionFlowInput>;
|
|
179
|
+
|
|
180
|
+
type DecideCaseBody = z.input<typeof DecideCaseInput>;
|
|
181
|
+
type AssignCaseBody = z.input<typeof AssignCaseInput>;
|
|
182
|
+
type CloseCaseBody = z.input<typeof CloseCaseInput>;
|
|
183
|
+
type CaseNoteBody = z.input<typeof CaseNoteInput>;
|
|
184
|
+
/** Body of `POST/PUT /case-queues`; `filter`, `sort`, `order` and `position` have defaults. */
|
|
185
|
+
type UpsertCaseQueueBody = z.input<typeof UpsertCaseQueueInput>;
|
|
186
|
+
/**
|
|
187
|
+
* Filters of `GET /cases`. Array filters are sent as repeated parameters
|
|
188
|
+
* (`status=open&status=in_review`); a single value is accepted for convenience.
|
|
189
|
+
* `assignee` is `me`, `unassigned` or a directory user id.
|
|
190
|
+
*/
|
|
191
|
+
type CaseListQuery = {
|
|
192
|
+
status?: CaseStatus | CaseStatus[];
|
|
193
|
+
priority?: CasePriority | CasePriority[];
|
|
194
|
+
assignee?: string;
|
|
195
|
+
type?: string;
|
|
196
|
+
subjectId?: string;
|
|
197
|
+
slaState?: CaseSlaState | CaseSlaState[];
|
|
198
|
+
dueBefore?: Date | string;
|
|
199
|
+
search?: string;
|
|
200
|
+
sort?: CaseSort;
|
|
201
|
+
order?: SortOrder;
|
|
202
|
+
limit?: number;
|
|
203
|
+
offset?: number;
|
|
204
|
+
};
|
|
205
|
+
type UserListQuery = {
|
|
206
|
+
/** Only users holding this role (e.g. `analyst`, `admin`). */
|
|
207
|
+
role?: string;
|
|
208
|
+
};
|
|
209
|
+
declare const CaseDetail: z.ZodObject<{
|
|
210
|
+
case: z.ZodObject<{
|
|
211
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
212
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
213
|
+
id: z.ZodGUID;
|
|
214
|
+
tenantId: z.ZodGUID;
|
|
215
|
+
subjectId: z.ZodGUID;
|
|
216
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
217
|
+
type: z.ZodString;
|
|
218
|
+
status: z.ZodEnum<{
|
|
219
|
+
closed: "closed";
|
|
220
|
+
open: "open";
|
|
221
|
+
in_review: "in_review";
|
|
222
|
+
decided: "decided";
|
|
223
|
+
}>;
|
|
224
|
+
priority: z.ZodEnum<{
|
|
225
|
+
low: "low";
|
|
226
|
+
medium: "medium";
|
|
227
|
+
high: "high";
|
|
228
|
+
critical: "critical";
|
|
229
|
+
}>;
|
|
230
|
+
assigneeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
231
|
+
decisionId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
232
|
+
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
233
|
+
dueAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
234
|
+
slaBreachedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
235
|
+
firstResponseAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
236
|
+
decidedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
237
|
+
closedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
238
|
+
closedReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
slaState: z.ZodEnum<{
|
|
240
|
+
none: "none";
|
|
241
|
+
ok: "ok";
|
|
242
|
+
due_soon: "due_soon";
|
|
243
|
+
breached: "breached";
|
|
244
|
+
}>;
|
|
245
|
+
}, z.core.$strip>;
|
|
246
|
+
subject: z.ZodObject<{
|
|
247
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
248
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
249
|
+
id: z.ZodGUID;
|
|
250
|
+
tenantId: z.ZodGUID;
|
|
251
|
+
kind: z.ZodEnum<{
|
|
252
|
+
user: "user";
|
|
253
|
+
merchant: "merchant";
|
|
254
|
+
seller: "seller";
|
|
255
|
+
}>;
|
|
256
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
257
|
+
status: z.ZodEnum<{
|
|
258
|
+
active: "active";
|
|
259
|
+
blocked: "blocked";
|
|
260
|
+
closed: "closed";
|
|
261
|
+
}>;
|
|
262
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
263
|
+
riskScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
264
|
+
tags: z.ZodArray<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
run: z.ZodNullable<z.ZodObject<{
|
|
267
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
268
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
269
|
+
id: z.ZodGUID;
|
|
270
|
+
tenantId: z.ZodGUID;
|
|
271
|
+
definitionId: z.ZodGUID;
|
|
272
|
+
definitionKey: z.ZodString;
|
|
273
|
+
definitionVersion: z.ZodNumber;
|
|
274
|
+
subjectId: z.ZodGUID;
|
|
275
|
+
temporalWorkflowId: z.ZodString;
|
|
276
|
+
temporalRunId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
277
|
+
status: z.ZodEnum<{
|
|
278
|
+
running: "running";
|
|
279
|
+
waiting_collection: "waiting_collection";
|
|
280
|
+
waiting_manual: "waiting_manual";
|
|
281
|
+
waiting_callback: "waiting_callback";
|
|
282
|
+
completed: "completed";
|
|
283
|
+
failed: "failed";
|
|
284
|
+
cancelled: "cancelled";
|
|
285
|
+
}>;
|
|
286
|
+
currentStepId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
287
|
+
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
288
|
+
decisionId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
289
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
290
|
+
startedAt: z.ZodCoercedDate<unknown>;
|
|
291
|
+
finishedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
292
|
+
}, z.core.$strip>>;
|
|
293
|
+
decisions: z.ZodArray<z.ZodObject<{
|
|
294
|
+
id: z.ZodGUID;
|
|
295
|
+
tenantId: z.ZodGUID;
|
|
296
|
+
subjectId: z.ZodGUID;
|
|
297
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
298
|
+
caseId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
299
|
+
outcome: z.ZodEnum<{
|
|
300
|
+
approve: "approve";
|
|
301
|
+
reject: "reject";
|
|
302
|
+
manual_review: "manual_review";
|
|
303
|
+
}>;
|
|
304
|
+
riskScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
305
|
+
reasons: z.ZodArray<z.ZodObject<{
|
|
306
|
+
code: z.ZodString;
|
|
307
|
+
message: z.ZodString;
|
|
308
|
+
ruleKey: z.ZodOptional<z.ZodString>;
|
|
309
|
+
}, z.core.$strip>>;
|
|
310
|
+
source: z.ZodEnum<{
|
|
311
|
+
automated: "automated";
|
|
312
|
+
manual: "manual";
|
|
313
|
+
}>;
|
|
314
|
+
decidedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
315
|
+
ruleResults: z.ZodArray<z.ZodObject<{
|
|
316
|
+
ruleId: z.ZodString;
|
|
317
|
+
ruleKey: z.ZodString;
|
|
318
|
+
ruleVersion: z.ZodNumber;
|
|
319
|
+
severity: z.ZodEnum<{
|
|
320
|
+
info: "info";
|
|
321
|
+
warn: "warn";
|
|
322
|
+
block: "block";
|
|
323
|
+
}>;
|
|
324
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
325
|
+
outcome: z.ZodEnum<{
|
|
326
|
+
error: "error";
|
|
327
|
+
pass: "pass";
|
|
328
|
+
fail: "fail";
|
|
329
|
+
skipped: "skipped";
|
|
330
|
+
}>;
|
|
331
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
332
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
333
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
334
|
+
durationMs: z.ZodNumber;
|
|
335
|
+
shadow: z.ZodOptional<z.ZodBoolean>;
|
|
336
|
+
}, z.core.$strip>>;
|
|
337
|
+
ruleSetKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
338
|
+
ruleSetVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
339
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
340
|
+
}, z.core.$strip>>;
|
|
341
|
+
}, z.core.$strip>;
|
|
342
|
+
type CaseDetail = z.infer<typeof CaseDetail>;
|
|
343
|
+
declare const DecideCaseResult: z.ZodObject<{
|
|
344
|
+
case: z.ZodObject<{
|
|
345
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
346
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
347
|
+
id: z.ZodGUID;
|
|
348
|
+
tenantId: z.ZodGUID;
|
|
349
|
+
subjectId: z.ZodGUID;
|
|
350
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
351
|
+
type: z.ZodString;
|
|
352
|
+
status: z.ZodEnum<{
|
|
353
|
+
closed: "closed";
|
|
354
|
+
open: "open";
|
|
355
|
+
in_review: "in_review";
|
|
356
|
+
decided: "decided";
|
|
357
|
+
}>;
|
|
358
|
+
priority: z.ZodEnum<{
|
|
359
|
+
low: "low";
|
|
360
|
+
medium: "medium";
|
|
361
|
+
high: "high";
|
|
362
|
+
critical: "critical";
|
|
363
|
+
}>;
|
|
364
|
+
assigneeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
365
|
+
decisionId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
366
|
+
context: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
367
|
+
dueAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
368
|
+
slaBreachedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
369
|
+
firstResponseAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
370
|
+
decidedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
371
|
+
closedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
372
|
+
closedReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
373
|
+
}, z.core.$strip>;
|
|
374
|
+
decision: z.ZodObject<{
|
|
375
|
+
id: z.ZodGUID;
|
|
376
|
+
tenantId: z.ZodGUID;
|
|
377
|
+
subjectId: z.ZodGUID;
|
|
378
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
379
|
+
caseId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
380
|
+
outcome: z.ZodEnum<{
|
|
381
|
+
approve: "approve";
|
|
382
|
+
reject: "reject";
|
|
383
|
+
manual_review: "manual_review";
|
|
384
|
+
}>;
|
|
385
|
+
riskScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
386
|
+
reasons: z.ZodArray<z.ZodObject<{
|
|
387
|
+
code: z.ZodString;
|
|
388
|
+
message: z.ZodString;
|
|
389
|
+
ruleKey: z.ZodOptional<z.ZodString>;
|
|
390
|
+
}, z.core.$strip>>;
|
|
391
|
+
source: z.ZodEnum<{
|
|
392
|
+
automated: "automated";
|
|
393
|
+
manual: "manual";
|
|
394
|
+
}>;
|
|
395
|
+
decidedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
396
|
+
ruleResults: z.ZodArray<z.ZodObject<{
|
|
397
|
+
ruleId: z.ZodString;
|
|
398
|
+
ruleKey: z.ZodString;
|
|
399
|
+
ruleVersion: z.ZodNumber;
|
|
400
|
+
severity: z.ZodEnum<{
|
|
401
|
+
info: "info";
|
|
402
|
+
warn: "warn";
|
|
403
|
+
block: "block";
|
|
404
|
+
}>;
|
|
405
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
406
|
+
outcome: z.ZodEnum<{
|
|
407
|
+
error: "error";
|
|
408
|
+
pass: "pass";
|
|
409
|
+
fail: "fail";
|
|
410
|
+
skipped: "skipped";
|
|
411
|
+
}>;
|
|
412
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
413
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
414
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
415
|
+
durationMs: z.ZodNumber;
|
|
416
|
+
shadow: z.ZodOptional<z.ZodBoolean>;
|
|
417
|
+
}, z.core.$strip>>;
|
|
418
|
+
ruleSetKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
419
|
+
ruleSetVersion: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
420
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
421
|
+
}, z.core.$strip>;
|
|
422
|
+
}, z.core.$strip>;
|
|
423
|
+
type DecideCaseResult = z.infer<typeof DecideCaseResult>;
|
|
424
|
+
/** One row of `GET /case-queues/counts`: how many cases match the queue's filter right now. */
|
|
425
|
+
declare const CaseQueueCount: z.ZodObject<{
|
|
426
|
+
queueId: z.ZodString;
|
|
427
|
+
count: z.ZodNumber;
|
|
428
|
+
}, z.core.$strip>;
|
|
429
|
+
type CaseQueueCount = z.infer<typeof CaseQueueCount>;
|
|
430
|
+
/** Flattens a `CaseListQuery` into transport parameters; arrays repeat, dates become ISO. */
|
|
431
|
+
declare function caseListParams(query: CaseListQuery): Query;
|
|
432
|
+
declare function casesDomain(http: Http): {
|
|
433
|
+
/** Cases matching `query`, in the requested order (`createdAt` desc by default). */
|
|
434
|
+
list: (query?: CaseListQuery) => Promise<CaseView[]>;
|
|
435
|
+
get: (id: string) => Promise<CaseDetail>;
|
|
436
|
+
decide: (id: string, body: DecideCaseBody) => Promise<DecideCaseResult>;
|
|
437
|
+
/** Sets or clears (`assigneeId: null`) the assignee (`cases:assign`). */
|
|
438
|
+
assign: (id: string, body: AssignCaseBody) => Promise<CaseView>;
|
|
439
|
+
/** Assigns the case to the caller (`cases:claim`). */
|
|
440
|
+
claim: (id: string) => Promise<CaseView>;
|
|
441
|
+
/**
|
|
442
|
+
* Closes the case (`cases:decide`). An undecided case gets a `reject` decision with reason
|
|
443
|
+
* code `case_closed` so its workflow run does not wait forever.
|
|
444
|
+
*/
|
|
445
|
+
close: (id: string, body?: CloseCaseBody) => Promise<CaseView>;
|
|
446
|
+
/** Analyst notes on a case (`cases:notes`); edits and deletes are limited to the author or an admin. */
|
|
447
|
+
notes: {
|
|
448
|
+
list: (id: string) => Promise<CaseNote[]>;
|
|
449
|
+
create: (id: string, body: CaseNoteBody) => Promise<CaseNote>;
|
|
450
|
+
update: (id: string, noteId: string, body: CaseNoteBody) => Promise<CaseNote>;
|
|
451
|
+
remove: (id: string, noteId: string) => Promise<void>;
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
type CasesClient = ReturnType<typeof casesDomain>;
|
|
455
|
+
/** Saved case filters (`cases:read` to list, `cases:assign` to manage). */
|
|
456
|
+
declare function caseQueuesDomain(http: Http): {
|
|
457
|
+
list: () => Promise<CaseQueue[]>;
|
|
458
|
+
counts: () => Promise<CaseQueueCount[]>;
|
|
459
|
+
create: (body: UpsertCaseQueueBody) => Promise<CaseQueue>;
|
|
460
|
+
update: (id: string, body: UpsertCaseQueueBody) => Promise<CaseQueue>;
|
|
461
|
+
remove: (id: string) => Promise<void>;
|
|
462
|
+
};
|
|
463
|
+
type CaseQueuesClient = ReturnType<typeof caseQueuesDomain>;
|
|
464
|
+
/** The reviewer directory (`cases:assign` or `cases:claim`); empty when none is configured. */
|
|
465
|
+
declare function usersDomain(http: Http): {
|
|
466
|
+
list: (query?: UserListQuery) => Promise<DirectoryUser[]>;
|
|
467
|
+
};
|
|
468
|
+
type UsersClient = ReturnType<typeof usersDomain>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Applicants (submission-token clients) must name their submission on every `/documents/:id`
|
|
472
|
+
* route; operators and integrations omit it.
|
|
473
|
+
*/
|
|
474
|
+
interface DocumentScope {
|
|
475
|
+
submissionId?: string;
|
|
476
|
+
}
|
|
477
|
+
/** Filters of `GET /documents` (`documents:read`). */
|
|
478
|
+
interface DocumentListQuery {
|
|
479
|
+
subjectId?: string;
|
|
480
|
+
submissionId?: string;
|
|
481
|
+
caseId?: string;
|
|
482
|
+
status?: DocumentStatus;
|
|
483
|
+
limit?: number;
|
|
484
|
+
offset?: number;
|
|
485
|
+
}
|
|
486
|
+
declare const DocumentList: z.ZodObject<{
|
|
487
|
+
items: z.ZodArray<z.ZodObject<{
|
|
488
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
489
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
490
|
+
id: z.ZodGUID;
|
|
491
|
+
tenantId: z.ZodGUID;
|
|
492
|
+
subjectId: z.ZodGUID;
|
|
493
|
+
submissionId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
494
|
+
caseId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
495
|
+
fieldKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
496
|
+
fileName: z.ZodString;
|
|
497
|
+
contentType: z.ZodString;
|
|
498
|
+
sizeBytes: z.ZodNumber;
|
|
499
|
+
sha256: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
500
|
+
storageKey: z.ZodString;
|
|
501
|
+
status: z.ZodEnum<{
|
|
502
|
+
pending: "pending";
|
|
503
|
+
uploaded: "uploaded";
|
|
504
|
+
scanning: "scanning";
|
|
505
|
+
clean: "clean";
|
|
506
|
+
infected: "infected";
|
|
507
|
+
rejected: "rejected";
|
|
508
|
+
}>;
|
|
509
|
+
scan: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
510
|
+
engine: z.ZodString;
|
|
511
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
512
|
+
scannedAt: z.ZodCoercedDate<unknown>;
|
|
513
|
+
}, z.core.$strip>>>;
|
|
514
|
+
rejectionReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
515
|
+
uploadedBy: z.ZodString;
|
|
516
|
+
}, z.core.$strip>>;
|
|
517
|
+
}, z.core.$strip>;
|
|
518
|
+
type DocumentList = z.infer<typeof DocumentList>;
|
|
519
|
+
declare function documentsDomain(http: Http): {
|
|
520
|
+
/**
|
|
521
|
+
* Registers a pending document and returns the presigned POST to send the bytes with
|
|
522
|
+
* (`uploadToStorage`). Applicants pass their `submissionId` and the `fieldKey`.
|
|
523
|
+
*/
|
|
524
|
+
create: (input: CreateDocumentInput) => Promise<DocumentUploadTicket>;
|
|
525
|
+
/**
|
|
526
|
+
* Verifies the uploaded object and starts the scan. Resolves with status `uploaded` or
|
|
527
|
+
* `rejected` (see `rejectionReason`); throws a 409 `ApiError` when nothing was uploaded.
|
|
528
|
+
*/
|
|
529
|
+
finalize: (id: string, opts?: DocumentScope) => Promise<Document>;
|
|
530
|
+
get: (id: string, opts?: DocumentScope) => Promise<Document>;
|
|
531
|
+
list: (filters?: DocumentListQuery) => Promise<DocumentList>;
|
|
532
|
+
/** A 60-second presigned GET on the storage origin; open it directly, never via the API. */
|
|
533
|
+
download: (id: string, opts?: DocumentScope) => Promise<DocumentDownload>;
|
|
534
|
+
};
|
|
535
|
+
type DocumentsClient = ReturnType<typeof documentsDomain>;
|
|
536
|
+
/** Thrown by `uploadToStorage`; `status` is 0 for network errors, aborts and timeouts. */
|
|
537
|
+
declare class UploadError extends Error {
|
|
538
|
+
readonly status: number;
|
|
539
|
+
constructor(message: string, status: number);
|
|
540
|
+
}
|
|
541
|
+
interface UploadProgressEvent {
|
|
542
|
+
lengthComputable: boolean;
|
|
543
|
+
loaded: number;
|
|
544
|
+
total: number;
|
|
545
|
+
}
|
|
546
|
+
/** The slice of `XMLHttpRequest` the uploader uses; injectable so tests need no network. */
|
|
547
|
+
interface UploadXhr {
|
|
548
|
+
readonly status: number;
|
|
549
|
+
open(method: string, url: string): void;
|
|
550
|
+
send(body: FormData): void;
|
|
551
|
+
abort(): void;
|
|
552
|
+
addEventListener(type: 'load' | 'error' | 'abort' | 'timeout', listener: () => void): void;
|
|
553
|
+
upload: {
|
|
554
|
+
addEventListener(type: 'progress', listener: (event: UploadProgressEvent) => void): void;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
interface UploadOptions {
|
|
558
|
+
/** Called with 0..1 as bytes leave the browser; called with 1 once storage accepts the file. */
|
|
559
|
+
onProgress?: (fraction: number) => void;
|
|
560
|
+
signal?: AbortSignal;
|
|
561
|
+
/** XMLHttpRequest factory; defaults to the global one. */
|
|
562
|
+
xhr?: () => UploadXhr;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Posts `file` to the presigned URL of `ticket` as multipart form data: the policy fields first,
|
|
566
|
+
* in order, then the file under `file`. The browser sets the multipart content type itself.
|
|
567
|
+
*/
|
|
568
|
+
declare function uploadToStorage(ticket: DocumentUploadTicket, file: Blob, opts?: UploadOptions): Promise<void>;
|
|
569
|
+
type FileCheck = {
|
|
570
|
+
ok: true;
|
|
571
|
+
} | {
|
|
572
|
+
ok: false;
|
|
573
|
+
reason: string;
|
|
574
|
+
};
|
|
575
|
+
/** Client-side pre-check mirroring the policy storage enforces; saves a doomed round trip. */
|
|
576
|
+
declare function checkFileBeforeUpload(file: {
|
|
577
|
+
type: string;
|
|
578
|
+
size: number;
|
|
579
|
+
name: string;
|
|
580
|
+
}): FileCheck;
|
|
581
|
+
interface PollOptions extends DocumentScope {
|
|
582
|
+
intervalMs?: number;
|
|
583
|
+
timeoutMs?: number;
|
|
584
|
+
signal?: AbortSignal;
|
|
585
|
+
}
|
|
586
|
+
/** Thrown by `pollDocument` when the scan does not settle within `timeoutMs`. */
|
|
587
|
+
declare class DocumentPollTimeoutError extends Error {
|
|
588
|
+
readonly documentId: string;
|
|
589
|
+
constructor(documentId: string);
|
|
590
|
+
}
|
|
591
|
+
declare function isTerminalDocumentStatus(status: DocumentStatus): boolean;
|
|
592
|
+
/**
|
|
593
|
+
* Reads the document until its status is terminal (`clean`, `infected` or `rejected`). The first
|
|
594
|
+
* read is immediate; later ones every `intervalMs` (750 ms) until `timeoutMs` (60 s).
|
|
595
|
+
*/
|
|
596
|
+
declare function pollDocument(client: {
|
|
597
|
+
documents: Pick<DocumentsClient, 'get'>;
|
|
598
|
+
}, id: string, opts?: PollOptions): Promise<Document>;
|
|
599
|
+
|
|
600
|
+
type StartWorkflowRunBody = z.input<typeof StartWorkflowRunInput>;
|
|
601
|
+
/** Workflow runs: start, read, list by subject and the admin-only event history. */
|
|
602
|
+
interface WorkflowRunsClient {
|
|
603
|
+
start: (body: StartWorkflowRunBody) => Promise<WorkflowRun>;
|
|
604
|
+
get: (id: string) => Promise<WorkflowRun>;
|
|
605
|
+
listBySubject: (subjectId: string) => Promise<WorkflowRun[]>;
|
|
606
|
+
/**
|
|
607
|
+
* The run's Temporal event history as proto JSON, for replaying it against a new worker
|
|
608
|
+
* bundle (`node dist/replay.js`). Admin only; 409 when the API has no Temporal client.
|
|
609
|
+
*/
|
|
610
|
+
history: (id: string) => Promise<unknown>;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
interface ApiClientOptions {
|
|
614
|
+
/** API origin, e.g. `http://localhost:4000`. A trailing slash is tolerated. */
|
|
615
|
+
baseUrl: string;
|
|
616
|
+
/**
|
|
617
|
+
* Returns the bearer token for the current caller (a Zitadel access token, or an applicant
|
|
618
|
+
* submission token). When it yields nothing the request is sent without `Authorization`.
|
|
619
|
+
*/
|
|
620
|
+
getAccessToken: AccessTokenProvider;
|
|
621
|
+
/** Injectable for tests; defaults to the global fetch. */
|
|
622
|
+
fetch?: FetchLike;
|
|
623
|
+
}
|
|
624
|
+
type CreateSubjectBody = z.input<typeof CreateSubjectInput>;
|
|
625
|
+
|
|
626
|
+
type ConfigurePluginBody = z.input<typeof ConfigurePluginInput>;
|
|
627
|
+
type UpsertWorkflowDefinitionBody = z.input<typeof UpsertWorkflowDefinitionInput>;
|
|
628
|
+
type UpsertRuleDefinitionBody = z.input<typeof UpsertRuleDefinitionInput>;
|
|
629
|
+
/** Body of `PUT /rule-sets/:key`; `enabled`/`shadow` on each rule and `useCase` may be omitted. */
|
|
630
|
+
type UpsertRuleSetBody = z.input<typeof UpsertRuleSetInput>;
|
|
631
|
+
type UpsertCollectionFlowBody = z.input<typeof UpsertCollectionFlowInput>;
|
|
632
|
+
type CreateSubmissionBody = z.input<typeof CreateSubmissionInput>;
|
|
633
|
+
type SaveSubmissionBody = z.input<typeof SaveSubmissionInput>;
|
|
634
|
+
type UpsertListBody = z.input<typeof UpsertListInput>;
|
|
635
|
+
type AddListEntriesBody = z.input<typeof AddListEntriesInput>;
|
|
636
|
+
type RemoveListEntriesBody = z.input<typeof RemoveListEntriesInput>;
|
|
637
|
+
/** Body of `POST /events`: up to 1 000 events; `occurredAt` may be a Date or ISO string. */
|
|
638
|
+
type IngestEventsBody = z.input<typeof IngestEventsInput>;
|
|
639
|
+
/**
|
|
640
|
+
* Body of `POST /backtests`. `version` defaults to the latest version of the rule (drafts
|
|
641
|
+
* included); `sample` defaults to the last 30 days, 1 000 subjects.
|
|
642
|
+
*/
|
|
643
|
+
type StartBacktestBody = z.input<typeof StartBacktestInput>;
|
|
644
|
+
/** Input of a dry run: a stored subject's id, or an inline data object (exactly one of the two). */
|
|
645
|
+
type DryRunInput = {
|
|
646
|
+
subjectId: string;
|
|
647
|
+
data?: undefined;
|
|
648
|
+
} | {
|
|
649
|
+
data: Record<string, unknown>;
|
|
650
|
+
subjectId?: undefined;
|
|
651
|
+
};
|
|
652
|
+
/** Body of `POST /rule-definitions/:key/dry-run`. `version` defaults to the latest draft. */
|
|
653
|
+
type DryRunBody = DryRunInput & {
|
|
654
|
+
version?: number;
|
|
655
|
+
};
|
|
656
|
+
declare const HealthStatus: z.ZodObject<{
|
|
657
|
+
status: z.ZodLiteral<"ok">;
|
|
658
|
+
}, z.core.$strip>;
|
|
659
|
+
type HealthStatus = z.infer<typeof HealthStatus>;
|
|
660
|
+
/** Who the API resolved the bearer token to (`GET /me`). */
|
|
661
|
+
declare const MePrincipal: z.ZodObject<{
|
|
662
|
+
kind: z.ZodEnum<{
|
|
663
|
+
applicant: "applicant";
|
|
664
|
+
human: "human";
|
|
665
|
+
machine: "machine";
|
|
666
|
+
}>;
|
|
667
|
+
subject: z.ZodString;
|
|
668
|
+
name: z.ZodOptional<z.ZodString>;
|
|
669
|
+
email: z.ZodOptional<z.ZodString>;
|
|
670
|
+
}, z.core.$strip>;
|
|
671
|
+
type MePrincipal = z.infer<typeof MePrincipal>;
|
|
672
|
+
declare const Me: z.ZodObject<{
|
|
673
|
+
principal: z.ZodObject<{
|
|
674
|
+
kind: z.ZodEnum<{
|
|
675
|
+
applicant: "applicant";
|
|
676
|
+
human: "human";
|
|
677
|
+
machine: "machine";
|
|
678
|
+
}>;
|
|
679
|
+
subject: z.ZodString;
|
|
680
|
+
name: z.ZodOptional<z.ZodString>;
|
|
681
|
+
email: z.ZodOptional<z.ZodString>;
|
|
682
|
+
}, z.core.$strip>;
|
|
683
|
+
tenantId: z.ZodString;
|
|
684
|
+
orgId: z.ZodOptional<z.ZodString>;
|
|
685
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
686
|
+
}, z.core.$strip>;
|
|
687
|
+
type Me = z.infer<typeof Me>;
|
|
688
|
+
declare const ReadyStatus: z.ZodObject<{
|
|
689
|
+
status: z.ZodEnum<{
|
|
690
|
+
ok: "ok";
|
|
691
|
+
degraded: "degraded";
|
|
692
|
+
}>;
|
|
693
|
+
checks: z.ZodObject<{
|
|
694
|
+
db: z.ZodEnum<{
|
|
695
|
+
error: "error";
|
|
696
|
+
ok: "ok";
|
|
697
|
+
}>;
|
|
698
|
+
temporal: z.ZodEnum<{
|
|
699
|
+
error: "error";
|
|
700
|
+
ok: "ok";
|
|
701
|
+
}>;
|
|
702
|
+
}, z.core.$strip>;
|
|
703
|
+
}, z.core.$strip>;
|
|
704
|
+
type ReadyStatus = z.infer<typeof ReadyStatus>;
|
|
705
|
+
/** A plugin compiled into the deployment (`GET /plugins/available`). */
|
|
706
|
+
declare const PluginSummary: z.ZodObject<{
|
|
707
|
+
name: z.ZodString;
|
|
708
|
+
version: z.ZodString;
|
|
709
|
+
description: z.ZodOptional<z.ZodString>;
|
|
710
|
+
capabilities: z.ZodArray<z.ZodString>;
|
|
711
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
712
|
+
actions: z.ZodArray<z.ZodString>;
|
|
713
|
+
configSchema: z.ZodUnknown;
|
|
714
|
+
}, z.core.$strip>;
|
|
715
|
+
type PluginSummary = z.infer<typeof PluginSummary>;
|
|
716
|
+
/** Rendering hints for the builder's schema-driven config forms; every part is optional. */
|
|
717
|
+
declare const RuleUiHints: z.ZodObject<{
|
|
718
|
+
fieldOrder: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
719
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
720
|
+
help: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
721
|
+
listPicker: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
722
|
+
}, z.core.$strip>;
|
|
723
|
+
type RuleUiHints = z.infer<typeof RuleUiHints>;
|
|
724
|
+
declare const RuleTypeDescription: z.ZodObject<{
|
|
725
|
+
type: z.ZodEnum<{
|
|
726
|
+
plugin: "plugin";
|
|
727
|
+
comparison: "comparison";
|
|
728
|
+
list_lookup: "list_lookup";
|
|
729
|
+
score_threshold: "score_threshold";
|
|
730
|
+
expression: "expression";
|
|
731
|
+
velocity: "velocity";
|
|
732
|
+
}>;
|
|
733
|
+
description: z.ZodString;
|
|
734
|
+
configSchema: z.ZodUnknown;
|
|
735
|
+
dataPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
736
|
+
uiHints: z.ZodOptional<z.ZodObject<{
|
|
737
|
+
fieldOrder: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
738
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
739
|
+
help: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
740
|
+
listPicker: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
741
|
+
}, z.core.$strip>>;
|
|
742
|
+
}, z.core.$strip>;
|
|
743
|
+
type RuleTypeDescription = z.infer<typeof RuleTypeDescription>;
|
|
744
|
+
/** Response of `POST /rule-definitions/:key/dry-run`: the evaluation plus what was evaluated. */
|
|
745
|
+
declare const DryRunResult: z.ZodObject<{
|
|
746
|
+
result: z.ZodObject<{
|
|
747
|
+
ruleId: z.ZodString;
|
|
748
|
+
ruleKey: z.ZodString;
|
|
749
|
+
ruleVersion: z.ZodNumber;
|
|
750
|
+
severity: z.ZodEnum<{
|
|
751
|
+
info: "info";
|
|
752
|
+
warn: "warn";
|
|
753
|
+
block: "block";
|
|
754
|
+
}>;
|
|
755
|
+
weight: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
756
|
+
outcome: z.ZodEnum<{
|
|
757
|
+
error: "error";
|
|
758
|
+
pass: "pass";
|
|
759
|
+
fail: "fail";
|
|
760
|
+
skipped: "skipped";
|
|
761
|
+
}>;
|
|
762
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
763
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
764
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
765
|
+
durationMs: z.ZodNumber;
|
|
766
|
+
shadow: z.ZodOptional<z.ZodBoolean>;
|
|
767
|
+
}, z.core.$strip>;
|
|
768
|
+
rule: z.ZodObject<{
|
|
769
|
+
key: z.ZodString;
|
|
770
|
+
version: z.ZodNumber;
|
|
771
|
+
status: z.ZodEnum<{
|
|
772
|
+
draft: "draft";
|
|
773
|
+
pending_approval: "pending_approval";
|
|
774
|
+
published: "published";
|
|
775
|
+
archived: "archived";
|
|
776
|
+
}>;
|
|
777
|
+
type: z.ZodEnum<{
|
|
778
|
+
plugin: "plugin";
|
|
779
|
+
comparison: "comparison";
|
|
780
|
+
list_lookup: "list_lookup";
|
|
781
|
+
score_threshold: "score_threshold";
|
|
782
|
+
expression: "expression";
|
|
783
|
+
velocity: "velocity";
|
|
784
|
+
}>;
|
|
785
|
+
}, z.core.$strip>;
|
|
786
|
+
dataPaths: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
787
|
+
}, z.core.$strip>;
|
|
788
|
+
type DryRunResult = z.infer<typeof DryRunResult>;
|
|
789
|
+
/** Response of `DELETE /lists/:key/entries`. */
|
|
790
|
+
declare const RemovedCount: z.ZodObject<{
|
|
791
|
+
removed: z.ZodNumber;
|
|
792
|
+
}, z.core.$strip>;
|
|
793
|
+
type RemovedCount = z.infer<typeof RemovedCount>;
|
|
794
|
+
declare const SubmissionDetail: z.ZodObject<{
|
|
795
|
+
submission: z.ZodObject<{
|
|
796
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
797
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
798
|
+
id: z.ZodGUID;
|
|
799
|
+
tenantId: z.ZodGUID;
|
|
800
|
+
flowDefinitionId: z.ZodGUID;
|
|
801
|
+
flowKey: z.ZodString;
|
|
802
|
+
flowVersion: z.ZodNumber;
|
|
803
|
+
subjectId: z.ZodGUID;
|
|
804
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
805
|
+
status: z.ZodEnum<{
|
|
806
|
+
in_progress: "in_progress";
|
|
807
|
+
submitted: "submitted";
|
|
808
|
+
}>;
|
|
809
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
810
|
+
currentStepId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
811
|
+
submittedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
812
|
+
}, z.core.$strip>;
|
|
813
|
+
flow: z.ZodObject<{
|
|
814
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
815
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
816
|
+
id: z.ZodGUID;
|
|
817
|
+
tenantId: z.ZodGUID;
|
|
818
|
+
createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
819
|
+
key: z.ZodString;
|
|
820
|
+
version: z.ZodNumber;
|
|
821
|
+
name: z.ZodString;
|
|
822
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
823
|
+
status: z.ZodEnum<{
|
|
824
|
+
draft: "draft";
|
|
825
|
+
pending_approval: "pending_approval";
|
|
826
|
+
published: "published";
|
|
827
|
+
archived: "archived";
|
|
828
|
+
}>;
|
|
829
|
+
definition: z.ZodObject<{
|
|
830
|
+
entryStepId: z.ZodString;
|
|
831
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
832
|
+
id: z.ZodString;
|
|
833
|
+
title: z.ZodString;
|
|
834
|
+
description: z.ZodOptional<z.ZodString>;
|
|
835
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
836
|
+
key: z.ZodString;
|
|
837
|
+
label: z.ZodString;
|
|
838
|
+
type: z.ZodEnum<{
|
|
839
|
+
number: "number";
|
|
840
|
+
boolean: "boolean";
|
|
841
|
+
date: "date";
|
|
842
|
+
file: "file";
|
|
843
|
+
email: "email";
|
|
844
|
+
text: "text";
|
|
845
|
+
select: "select";
|
|
846
|
+
}>;
|
|
847
|
+
required: z.ZodDefault<z.ZodBoolean>;
|
|
848
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
849
|
+
help: z.ZodOptional<z.ZodString>;
|
|
850
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
851
|
+
value: z.ZodString;
|
|
852
|
+
label: z.ZodString;
|
|
853
|
+
}, z.core.$strip>>>;
|
|
854
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
855
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
856
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
857
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
858
|
+
}, z.core.$strip>>;
|
|
859
|
+
visibleWhen: z.ZodOptional<z.ZodObject<{
|
|
860
|
+
path: z.ZodString;
|
|
861
|
+
op: z.ZodEnum<{
|
|
862
|
+
in: "in";
|
|
863
|
+
eq: "eq";
|
|
864
|
+
neq: "neq";
|
|
865
|
+
gt: "gt";
|
|
866
|
+
gte: "gte";
|
|
867
|
+
lt: "lt";
|
|
868
|
+
lte: "lte";
|
|
869
|
+
exists: "exists";
|
|
870
|
+
}>;
|
|
871
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
872
|
+
}, z.core.$strip>>;
|
|
873
|
+
}, z.core.$strip>>;
|
|
874
|
+
next: z.ZodOptional<z.ZodString>;
|
|
875
|
+
branches: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
876
|
+
when: z.ZodObject<{
|
|
877
|
+
path: z.ZodString;
|
|
878
|
+
op: z.ZodEnum<{
|
|
879
|
+
in: "in";
|
|
880
|
+
eq: "eq";
|
|
881
|
+
neq: "neq";
|
|
882
|
+
gt: "gt";
|
|
883
|
+
gte: "gte";
|
|
884
|
+
lt: "lt";
|
|
885
|
+
lte: "lte";
|
|
886
|
+
exists: "exists";
|
|
887
|
+
}>;
|
|
888
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
889
|
+
}, z.core.$strip>;
|
|
890
|
+
next: z.ZodString;
|
|
891
|
+
}, z.core.$strip>>>;
|
|
892
|
+
}, z.core.$strip>>;
|
|
893
|
+
linkTtlSeconds: z.ZodDefault<z.ZodNumber>;
|
|
894
|
+
}, z.core.$strip>;
|
|
895
|
+
}, z.core.$strip>;
|
|
896
|
+
}, z.core.$strip>;
|
|
897
|
+
type SubmissionDetail = z.infer<typeof SubmissionDetail>;
|
|
898
|
+
/**
|
|
899
|
+
* Response of `GET /collection-submissions/:id/status`: the applicant-readable view of a
|
|
900
|
+
* submission and of where its workflow run is. The collection flow polls it after submit.
|
|
901
|
+
*/
|
|
902
|
+
declare const SubmissionStatus: z.ZodObject<{
|
|
903
|
+
submission: z.ZodObject<{
|
|
904
|
+
id: z.ZodGUID;
|
|
905
|
+
status: z.ZodEnum<{
|
|
906
|
+
in_progress: "in_progress";
|
|
907
|
+
submitted: "submitted";
|
|
908
|
+
}>;
|
|
909
|
+
submittedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
910
|
+
}, z.core.$strip>;
|
|
911
|
+
run: z.ZodNullable<z.ZodObject<{
|
|
912
|
+
id: z.ZodGUID;
|
|
913
|
+
status: z.ZodEnum<{
|
|
914
|
+
running: "running";
|
|
915
|
+
waiting_collection: "waiting_collection";
|
|
916
|
+
waiting_manual: "waiting_manual";
|
|
917
|
+
waiting_callback: "waiting_callback";
|
|
918
|
+
completed: "completed";
|
|
919
|
+
failed: "failed";
|
|
920
|
+
cancelled: "cancelled";
|
|
921
|
+
}>;
|
|
922
|
+
currentStepId: z.ZodNullable<z.ZodString>;
|
|
923
|
+
decision: z.ZodNullable<z.ZodObject<{
|
|
924
|
+
outcome: z.ZodEnum<{
|
|
925
|
+
approve: "approve";
|
|
926
|
+
reject: "reject";
|
|
927
|
+
manual_review: "manual_review";
|
|
928
|
+
}>;
|
|
929
|
+
}, z.core.$strip>>;
|
|
930
|
+
}, z.core.$strip>>;
|
|
931
|
+
}, z.core.$strip>;
|
|
932
|
+
type SubmissionStatus = z.infer<typeof SubmissionStatus>;
|
|
933
|
+
/**
|
|
934
|
+
* Response of `POST /collection-submissions`. `link` is the collection-flow URL carrying the
|
|
935
|
+
* applicant token (hand it to the applicant or the embed loader; never log it); it is `null` when
|
|
936
|
+
* the API cannot mint applicant tokens.
|
|
937
|
+
*/
|
|
938
|
+
declare const CreatedSubmission: z.ZodObject<{
|
|
939
|
+
submission: z.ZodObject<{
|
|
940
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
941
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
942
|
+
id: z.ZodGUID;
|
|
943
|
+
tenantId: z.ZodGUID;
|
|
944
|
+
flowDefinitionId: z.ZodGUID;
|
|
945
|
+
flowKey: z.ZodString;
|
|
946
|
+
flowVersion: z.ZodNumber;
|
|
947
|
+
subjectId: z.ZodGUID;
|
|
948
|
+
workflowRunId: z.ZodOptional<z.ZodNullable<z.ZodGUID>>;
|
|
949
|
+
status: z.ZodEnum<{
|
|
950
|
+
in_progress: "in_progress";
|
|
951
|
+
submitted: "submitted";
|
|
952
|
+
}>;
|
|
953
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
954
|
+
currentStepId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
955
|
+
submittedAt: z.ZodOptional<z.ZodNullable<z.ZodCoercedDate<unknown>>>;
|
|
956
|
+
}, z.core.$strip>;
|
|
957
|
+
link: z.ZodNullable<z.ZodString>;
|
|
958
|
+
}, z.core.$strip>;
|
|
959
|
+
type CreatedSubmission = z.infer<typeof CreatedSubmission>;
|
|
960
|
+
/** Response of `GET /collection-submissions/:id/embed`: what the embedded flow may be framed by. */
|
|
961
|
+
declare const SubmissionEmbed: z.ZodObject<{
|
|
962
|
+
embedOrigins: z.ZodArray<z.ZodString>;
|
|
963
|
+
flowName: z.ZodString;
|
|
964
|
+
}, z.core.$strip>;
|
|
965
|
+
type SubmissionEmbed = z.infer<typeof SubmissionEmbed>;
|
|
966
|
+
type PageQuery = {
|
|
967
|
+
limit?: number;
|
|
968
|
+
offset?: number;
|
|
969
|
+
};
|
|
970
|
+
/** @deprecated Use `AuditListQuery`; kept so existing `auditEvents.list` callers compile. */
|
|
971
|
+
type AuditEventQuery = AuditListQuery;
|
|
972
|
+
type PluginInvocationQuery = {
|
|
973
|
+
workflowRunId?: string;
|
|
974
|
+
limit?: number;
|
|
975
|
+
};
|
|
976
|
+
type ListEntryQuery = PageQuery & {
|
|
977
|
+
/** Substring match on the entry value. */
|
|
978
|
+
search?: string;
|
|
979
|
+
};
|
|
980
|
+
/** Filters of `GET /events`; `from`/`to` bound `occurredAt` and are sent as ISO strings. */
|
|
981
|
+
type EventListQuery = PageQuery & {
|
|
982
|
+
subjectId?: string;
|
|
983
|
+
type?: string;
|
|
984
|
+
from?: Date | string;
|
|
985
|
+
to?: Date | string;
|
|
986
|
+
};
|
|
987
|
+
/** Builds a typed client for the Aletheia API. Methods throw `ApiError` on non-2xx responses. */
|
|
988
|
+
declare function createApiClient(options: ApiClientOptions): {
|
|
989
|
+
health: {
|
|
990
|
+
check: () => Promise<HealthStatus>;
|
|
991
|
+
ready: () => Promise<ReadyStatus>;
|
|
992
|
+
};
|
|
993
|
+
/** The caller's principal, tenant and permissions as the API sees the bearer token. */
|
|
994
|
+
me: () => Promise<Me>;
|
|
995
|
+
subjects: {
|
|
996
|
+
create: (body: CreateSubjectBody) => Promise<Subject>;
|
|
997
|
+
/**
|
|
998
|
+
* Subjects matching `query`: `search` matches the external id and `data.name` /
|
|
999
|
+
* `data.legalName`; `riskScoreMin`/`riskScoreMax` bound the risk score (`subjects:read`).
|
|
1000
|
+
*/
|
|
1001
|
+
list: (query?: SubjectListQuery) => Promise<Subject[]>;
|
|
1002
|
+
get: (id: string) => Promise<Subject>;
|
|
1003
|
+
/**
|
|
1004
|
+
* The subject's history, newest first (`subjects:read`). Entries of kinds the caller may
|
|
1005
|
+
* not read are omitted by the API; page with `offset`.
|
|
1006
|
+
*/
|
|
1007
|
+
timeline: (id: string, query?: TimelineQuery) => Promise<TimelineEntry[]>;
|
|
1008
|
+
};
|
|
1009
|
+
workflowRuns: WorkflowRunsClient;
|
|
1010
|
+
/** Review cases: filtered lists, detail, decide, assign/claim/close and notes. See `cases.ts`. */
|
|
1011
|
+
cases: {
|
|
1012
|
+
list: (query?: CaseListQuery) => Promise<_aletheia_dev_core.CaseView[]>;
|
|
1013
|
+
get: (id: string) => Promise<CaseDetail>;
|
|
1014
|
+
decide: (id: string, body: DecideCaseBody) => Promise<DecideCaseResult>;
|
|
1015
|
+
assign: (id: string, body: AssignCaseBody) => Promise<_aletheia_dev_core.CaseView>;
|
|
1016
|
+
claim: (id: string) => Promise<_aletheia_dev_core.CaseView>;
|
|
1017
|
+
close: (id: string, body?: CloseCaseBody) => Promise<_aletheia_dev_core.CaseView>;
|
|
1018
|
+
notes: {
|
|
1019
|
+
list: (id: string) => Promise<_aletheia_dev_core.CaseNote[]>;
|
|
1020
|
+
create: (id: string, body: CaseNoteBody) => Promise<_aletheia_dev_core.CaseNote>;
|
|
1021
|
+
update: (id: string, noteId: string, body: CaseNoteBody) => Promise<_aletheia_dev_core.CaseNote>;
|
|
1022
|
+
remove: (id: string, noteId: string) => Promise<void>;
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
/** Saved case filters shown in the workbench rail, with live counts. */
|
|
1026
|
+
caseQueues: {
|
|
1027
|
+
list: () => Promise<_aletheia_dev_core.CaseQueue[]>;
|
|
1028
|
+
counts: () => Promise<CaseQueueCount[]>;
|
|
1029
|
+
create: (body: UpsertCaseQueueBody) => Promise<_aletheia_dev_core.CaseQueue>;
|
|
1030
|
+
update: (id: string, body: UpsertCaseQueueBody) => Promise<_aletheia_dev_core.CaseQueue>;
|
|
1031
|
+
remove: (id: string) => Promise<void>;
|
|
1032
|
+
};
|
|
1033
|
+
/** The reviewer directory, for assignment and resolving assignee names. */
|
|
1034
|
+
users: {
|
|
1035
|
+
list: (query?: UserListQuery) => Promise<_aletheia_dev_core.DirectoryUser[]>;
|
|
1036
|
+
};
|
|
1037
|
+
workflowDefinitions: {
|
|
1038
|
+
/** Validates a draft body without saving; issues carry step ids. */
|
|
1039
|
+
validate: (body: {
|
|
1040
|
+
name: string;
|
|
1041
|
+
definition: {
|
|
1042
|
+
entryStepId: string;
|
|
1043
|
+
steps: ({
|
|
1044
|
+
id: string;
|
|
1045
|
+
type: "evaluate_rules";
|
|
1046
|
+
name?: string | undefined;
|
|
1047
|
+
next?: string | undefined;
|
|
1048
|
+
ruleKeys?: string[] | undefined;
|
|
1049
|
+
ruleSetKey?: string | undefined;
|
|
1050
|
+
outputKey?: string | undefined;
|
|
1051
|
+
} | {
|
|
1052
|
+
id: string;
|
|
1053
|
+
type: "call_plugin";
|
|
1054
|
+
plugin: string;
|
|
1055
|
+
action: string;
|
|
1056
|
+
outputKey: string;
|
|
1057
|
+
name?: string | undefined;
|
|
1058
|
+
next?: string | undefined;
|
|
1059
|
+
input?: Record<string, unknown> | undefined;
|
|
1060
|
+
inputMapping?: Record<string, string> | undefined;
|
|
1061
|
+
retry?: {
|
|
1062
|
+
maximumAttempts?: number | undefined;
|
|
1063
|
+
initialIntervalSeconds?: number | undefined;
|
|
1064
|
+
} | undefined;
|
|
1065
|
+
} | {
|
|
1066
|
+
id: string;
|
|
1067
|
+
type: "wait_for_collection";
|
|
1068
|
+
flowKey: string;
|
|
1069
|
+
name?: string | undefined;
|
|
1070
|
+
next?: string | undefined;
|
|
1071
|
+
timeoutSeconds?: number | undefined;
|
|
1072
|
+
outputKey?: string | undefined;
|
|
1073
|
+
} | {
|
|
1074
|
+
id: string;
|
|
1075
|
+
type: "create_case";
|
|
1076
|
+
caseType: string;
|
|
1077
|
+
name?: string | undefined;
|
|
1078
|
+
next?: string | undefined;
|
|
1079
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1080
|
+
slaHours?: number | undefined;
|
|
1081
|
+
outputKey?: string | undefined;
|
|
1082
|
+
} | {
|
|
1083
|
+
id: string;
|
|
1084
|
+
type: "emit_decision";
|
|
1085
|
+
name?: string | undefined;
|
|
1086
|
+
next?: string | undefined;
|
|
1087
|
+
mode?: "fixed" | "from_rules" | undefined;
|
|
1088
|
+
rulesKey?: string | undefined;
|
|
1089
|
+
manualDecisionKey?: string | undefined;
|
|
1090
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1091
|
+
} | {
|
|
1092
|
+
id: string;
|
|
1093
|
+
type: "branch";
|
|
1094
|
+
conditions: {
|
|
1095
|
+
when: {
|
|
1096
|
+
path: string;
|
|
1097
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1098
|
+
value?: unknown;
|
|
1099
|
+
};
|
|
1100
|
+
next: string;
|
|
1101
|
+
}[];
|
|
1102
|
+
default: string;
|
|
1103
|
+
name?: string | undefined;
|
|
1104
|
+
next?: string | undefined;
|
|
1105
|
+
})[];
|
|
1106
|
+
ui?: {
|
|
1107
|
+
positions?: Record<string, {
|
|
1108
|
+
x: number;
|
|
1109
|
+
y: number;
|
|
1110
|
+
}> | undefined;
|
|
1111
|
+
} | undefined;
|
|
1112
|
+
};
|
|
1113
|
+
description?: string | undefined;
|
|
1114
|
+
trigger?: "manual" | "subject.created" | "event" | undefined;
|
|
1115
|
+
}) => Promise<_aletheia_dev_core.ValidationReport>;
|
|
1116
|
+
list: () => Promise<{
|
|
1117
|
+
createdAt: Date;
|
|
1118
|
+
updatedAt: Date;
|
|
1119
|
+
id: string;
|
|
1120
|
+
tenantId: string;
|
|
1121
|
+
key: string;
|
|
1122
|
+
version: number;
|
|
1123
|
+
name: string;
|
|
1124
|
+
trigger: "manual" | "subject.created" | "event";
|
|
1125
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1126
|
+
definition: {
|
|
1127
|
+
entryStepId: string;
|
|
1128
|
+
steps: ({
|
|
1129
|
+
id: string;
|
|
1130
|
+
type: "evaluate_rules";
|
|
1131
|
+
outputKey: string;
|
|
1132
|
+
name?: string | undefined;
|
|
1133
|
+
next?: string | undefined;
|
|
1134
|
+
ruleKeys?: string[] | undefined;
|
|
1135
|
+
ruleSetKey?: string | undefined;
|
|
1136
|
+
} | {
|
|
1137
|
+
id: string;
|
|
1138
|
+
type: "call_plugin";
|
|
1139
|
+
plugin: string;
|
|
1140
|
+
action: string;
|
|
1141
|
+
input: Record<string, unknown>;
|
|
1142
|
+
inputMapping: Record<string, string>;
|
|
1143
|
+
outputKey: string;
|
|
1144
|
+
name?: string | undefined;
|
|
1145
|
+
next?: string | undefined;
|
|
1146
|
+
retry?: {
|
|
1147
|
+
maximumAttempts?: number | undefined;
|
|
1148
|
+
initialIntervalSeconds?: number | undefined;
|
|
1149
|
+
} | undefined;
|
|
1150
|
+
} | {
|
|
1151
|
+
id: string;
|
|
1152
|
+
type: "wait_for_collection";
|
|
1153
|
+
flowKey: string;
|
|
1154
|
+
outputKey: string;
|
|
1155
|
+
name?: string | undefined;
|
|
1156
|
+
next?: string | undefined;
|
|
1157
|
+
timeoutSeconds?: number | undefined;
|
|
1158
|
+
} | {
|
|
1159
|
+
id: string;
|
|
1160
|
+
type: "create_case";
|
|
1161
|
+
caseType: string;
|
|
1162
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
1163
|
+
outputKey: string;
|
|
1164
|
+
name?: string | undefined;
|
|
1165
|
+
next?: string | undefined;
|
|
1166
|
+
slaHours?: number | undefined;
|
|
1167
|
+
} | {
|
|
1168
|
+
id: string;
|
|
1169
|
+
type: "emit_decision";
|
|
1170
|
+
mode: "fixed" | "from_rules";
|
|
1171
|
+
rulesKey: string;
|
|
1172
|
+
manualDecisionKey: string;
|
|
1173
|
+
name?: string | undefined;
|
|
1174
|
+
next?: string | undefined;
|
|
1175
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1176
|
+
} | {
|
|
1177
|
+
id: string;
|
|
1178
|
+
type: "branch";
|
|
1179
|
+
conditions: {
|
|
1180
|
+
when: {
|
|
1181
|
+
path: string;
|
|
1182
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1183
|
+
value?: unknown;
|
|
1184
|
+
};
|
|
1185
|
+
next: string;
|
|
1186
|
+
}[];
|
|
1187
|
+
default: string;
|
|
1188
|
+
name?: string | undefined;
|
|
1189
|
+
next?: string | undefined;
|
|
1190
|
+
})[];
|
|
1191
|
+
ui?: {
|
|
1192
|
+
positions: Record<string, {
|
|
1193
|
+
x: number;
|
|
1194
|
+
y: number;
|
|
1195
|
+
}>;
|
|
1196
|
+
} | undefined;
|
|
1197
|
+
};
|
|
1198
|
+
createdBy?: string | null | undefined;
|
|
1199
|
+
description?: string | null | undefined;
|
|
1200
|
+
}[]>;
|
|
1201
|
+
get: (key: string) => Promise<{
|
|
1202
|
+
createdAt: Date;
|
|
1203
|
+
updatedAt: Date;
|
|
1204
|
+
id: string;
|
|
1205
|
+
tenantId: string;
|
|
1206
|
+
key: string;
|
|
1207
|
+
version: number;
|
|
1208
|
+
name: string;
|
|
1209
|
+
trigger: "manual" | "subject.created" | "event";
|
|
1210
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1211
|
+
definition: {
|
|
1212
|
+
entryStepId: string;
|
|
1213
|
+
steps: ({
|
|
1214
|
+
id: string;
|
|
1215
|
+
type: "evaluate_rules";
|
|
1216
|
+
outputKey: string;
|
|
1217
|
+
name?: string | undefined;
|
|
1218
|
+
next?: string | undefined;
|
|
1219
|
+
ruleKeys?: string[] | undefined;
|
|
1220
|
+
ruleSetKey?: string | undefined;
|
|
1221
|
+
} | {
|
|
1222
|
+
id: string;
|
|
1223
|
+
type: "call_plugin";
|
|
1224
|
+
plugin: string;
|
|
1225
|
+
action: string;
|
|
1226
|
+
input: Record<string, unknown>;
|
|
1227
|
+
inputMapping: Record<string, string>;
|
|
1228
|
+
outputKey: string;
|
|
1229
|
+
name?: string | undefined;
|
|
1230
|
+
next?: string | undefined;
|
|
1231
|
+
retry?: {
|
|
1232
|
+
maximumAttempts?: number | undefined;
|
|
1233
|
+
initialIntervalSeconds?: number | undefined;
|
|
1234
|
+
} | undefined;
|
|
1235
|
+
} | {
|
|
1236
|
+
id: string;
|
|
1237
|
+
type: "wait_for_collection";
|
|
1238
|
+
flowKey: string;
|
|
1239
|
+
outputKey: string;
|
|
1240
|
+
name?: string | undefined;
|
|
1241
|
+
next?: string | undefined;
|
|
1242
|
+
timeoutSeconds?: number | undefined;
|
|
1243
|
+
} | {
|
|
1244
|
+
id: string;
|
|
1245
|
+
type: "create_case";
|
|
1246
|
+
caseType: string;
|
|
1247
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
1248
|
+
outputKey: string;
|
|
1249
|
+
name?: string | undefined;
|
|
1250
|
+
next?: string | undefined;
|
|
1251
|
+
slaHours?: number | undefined;
|
|
1252
|
+
} | {
|
|
1253
|
+
id: string;
|
|
1254
|
+
type: "emit_decision";
|
|
1255
|
+
mode: "fixed" | "from_rules";
|
|
1256
|
+
rulesKey: string;
|
|
1257
|
+
manualDecisionKey: string;
|
|
1258
|
+
name?: string | undefined;
|
|
1259
|
+
next?: string | undefined;
|
|
1260
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1261
|
+
} | {
|
|
1262
|
+
id: string;
|
|
1263
|
+
type: "branch";
|
|
1264
|
+
conditions: {
|
|
1265
|
+
when: {
|
|
1266
|
+
path: string;
|
|
1267
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1268
|
+
value?: unknown;
|
|
1269
|
+
};
|
|
1270
|
+
next: string;
|
|
1271
|
+
}[];
|
|
1272
|
+
default: string;
|
|
1273
|
+
name?: string | undefined;
|
|
1274
|
+
next?: string | undefined;
|
|
1275
|
+
})[];
|
|
1276
|
+
ui?: {
|
|
1277
|
+
positions: Record<string, {
|
|
1278
|
+
x: number;
|
|
1279
|
+
y: number;
|
|
1280
|
+
}>;
|
|
1281
|
+
} | undefined;
|
|
1282
|
+
};
|
|
1283
|
+
createdBy?: string | null | undefined;
|
|
1284
|
+
description?: string | null | undefined;
|
|
1285
|
+
}>;
|
|
1286
|
+
upsert: (key: string, body: {
|
|
1287
|
+
name: string;
|
|
1288
|
+
definition: {
|
|
1289
|
+
entryStepId: string;
|
|
1290
|
+
steps: ({
|
|
1291
|
+
id: string;
|
|
1292
|
+
type: "evaluate_rules";
|
|
1293
|
+
name?: string | undefined;
|
|
1294
|
+
next?: string | undefined;
|
|
1295
|
+
ruleKeys?: string[] | undefined;
|
|
1296
|
+
ruleSetKey?: string | undefined;
|
|
1297
|
+
outputKey?: string | undefined;
|
|
1298
|
+
} | {
|
|
1299
|
+
id: string;
|
|
1300
|
+
type: "call_plugin";
|
|
1301
|
+
plugin: string;
|
|
1302
|
+
action: string;
|
|
1303
|
+
outputKey: string;
|
|
1304
|
+
name?: string | undefined;
|
|
1305
|
+
next?: string | undefined;
|
|
1306
|
+
input?: Record<string, unknown> | undefined;
|
|
1307
|
+
inputMapping?: Record<string, string> | undefined;
|
|
1308
|
+
retry?: {
|
|
1309
|
+
maximumAttempts?: number | undefined;
|
|
1310
|
+
initialIntervalSeconds?: number | undefined;
|
|
1311
|
+
} | undefined;
|
|
1312
|
+
} | {
|
|
1313
|
+
id: string;
|
|
1314
|
+
type: "wait_for_collection";
|
|
1315
|
+
flowKey: string;
|
|
1316
|
+
name?: string | undefined;
|
|
1317
|
+
next?: string | undefined;
|
|
1318
|
+
timeoutSeconds?: number | undefined;
|
|
1319
|
+
outputKey?: string | undefined;
|
|
1320
|
+
} | {
|
|
1321
|
+
id: string;
|
|
1322
|
+
type: "create_case";
|
|
1323
|
+
caseType: string;
|
|
1324
|
+
name?: string | undefined;
|
|
1325
|
+
next?: string | undefined;
|
|
1326
|
+
priority?: "low" | "medium" | "high" | "critical" | undefined;
|
|
1327
|
+
slaHours?: number | undefined;
|
|
1328
|
+
outputKey?: string | undefined;
|
|
1329
|
+
} | {
|
|
1330
|
+
id: string;
|
|
1331
|
+
type: "emit_decision";
|
|
1332
|
+
name?: string | undefined;
|
|
1333
|
+
next?: string | undefined;
|
|
1334
|
+
mode?: "fixed" | "from_rules" | undefined;
|
|
1335
|
+
rulesKey?: string | undefined;
|
|
1336
|
+
manualDecisionKey?: string | undefined;
|
|
1337
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1338
|
+
} | {
|
|
1339
|
+
id: string;
|
|
1340
|
+
type: "branch";
|
|
1341
|
+
conditions: {
|
|
1342
|
+
when: {
|
|
1343
|
+
path: string;
|
|
1344
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1345
|
+
value?: unknown;
|
|
1346
|
+
};
|
|
1347
|
+
next: string;
|
|
1348
|
+
}[];
|
|
1349
|
+
default: string;
|
|
1350
|
+
name?: string | undefined;
|
|
1351
|
+
next?: string | undefined;
|
|
1352
|
+
})[];
|
|
1353
|
+
ui?: {
|
|
1354
|
+
positions?: Record<string, {
|
|
1355
|
+
x: number;
|
|
1356
|
+
y: number;
|
|
1357
|
+
}> | undefined;
|
|
1358
|
+
} | undefined;
|
|
1359
|
+
};
|
|
1360
|
+
description?: string | undefined;
|
|
1361
|
+
trigger?: "manual" | "subject.created" | "event" | undefined;
|
|
1362
|
+
}) => Promise<{
|
|
1363
|
+
createdAt: Date;
|
|
1364
|
+
updatedAt: Date;
|
|
1365
|
+
id: string;
|
|
1366
|
+
tenantId: string;
|
|
1367
|
+
key: string;
|
|
1368
|
+
version: number;
|
|
1369
|
+
name: string;
|
|
1370
|
+
trigger: "manual" | "subject.created" | "event";
|
|
1371
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1372
|
+
definition: {
|
|
1373
|
+
entryStepId: string;
|
|
1374
|
+
steps: ({
|
|
1375
|
+
id: string;
|
|
1376
|
+
type: "evaluate_rules";
|
|
1377
|
+
outputKey: string;
|
|
1378
|
+
name?: string | undefined;
|
|
1379
|
+
next?: string | undefined;
|
|
1380
|
+
ruleKeys?: string[] | undefined;
|
|
1381
|
+
ruleSetKey?: string | undefined;
|
|
1382
|
+
} | {
|
|
1383
|
+
id: string;
|
|
1384
|
+
type: "call_plugin";
|
|
1385
|
+
plugin: string;
|
|
1386
|
+
action: string;
|
|
1387
|
+
input: Record<string, unknown>;
|
|
1388
|
+
inputMapping: Record<string, string>;
|
|
1389
|
+
outputKey: string;
|
|
1390
|
+
name?: string | undefined;
|
|
1391
|
+
next?: string | undefined;
|
|
1392
|
+
retry?: {
|
|
1393
|
+
maximumAttempts?: number | undefined;
|
|
1394
|
+
initialIntervalSeconds?: number | undefined;
|
|
1395
|
+
} | undefined;
|
|
1396
|
+
} | {
|
|
1397
|
+
id: string;
|
|
1398
|
+
type: "wait_for_collection";
|
|
1399
|
+
flowKey: string;
|
|
1400
|
+
outputKey: string;
|
|
1401
|
+
name?: string | undefined;
|
|
1402
|
+
next?: string | undefined;
|
|
1403
|
+
timeoutSeconds?: number | undefined;
|
|
1404
|
+
} | {
|
|
1405
|
+
id: string;
|
|
1406
|
+
type: "create_case";
|
|
1407
|
+
caseType: string;
|
|
1408
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
1409
|
+
outputKey: string;
|
|
1410
|
+
name?: string | undefined;
|
|
1411
|
+
next?: string | undefined;
|
|
1412
|
+
slaHours?: number | undefined;
|
|
1413
|
+
} | {
|
|
1414
|
+
id: string;
|
|
1415
|
+
type: "emit_decision";
|
|
1416
|
+
mode: "fixed" | "from_rules";
|
|
1417
|
+
rulesKey: string;
|
|
1418
|
+
manualDecisionKey: string;
|
|
1419
|
+
name?: string | undefined;
|
|
1420
|
+
next?: string | undefined;
|
|
1421
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1422
|
+
} | {
|
|
1423
|
+
id: string;
|
|
1424
|
+
type: "branch";
|
|
1425
|
+
conditions: {
|
|
1426
|
+
when: {
|
|
1427
|
+
path: string;
|
|
1428
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1429
|
+
value?: unknown;
|
|
1430
|
+
};
|
|
1431
|
+
next: string;
|
|
1432
|
+
}[];
|
|
1433
|
+
default: string;
|
|
1434
|
+
name?: string | undefined;
|
|
1435
|
+
next?: string | undefined;
|
|
1436
|
+
})[];
|
|
1437
|
+
ui?: {
|
|
1438
|
+
positions: Record<string, {
|
|
1439
|
+
x: number;
|
|
1440
|
+
y: number;
|
|
1441
|
+
}>;
|
|
1442
|
+
} | undefined;
|
|
1443
|
+
};
|
|
1444
|
+
createdBy?: string | null | undefined;
|
|
1445
|
+
description?: string | null | undefined;
|
|
1446
|
+
}>;
|
|
1447
|
+
publish: (key: string) => Promise<{
|
|
1448
|
+
createdAt: Date;
|
|
1449
|
+
updatedAt: Date;
|
|
1450
|
+
id: string;
|
|
1451
|
+
tenantId: string;
|
|
1452
|
+
key: string;
|
|
1453
|
+
version: number;
|
|
1454
|
+
name: string;
|
|
1455
|
+
trigger: "manual" | "subject.created" | "event";
|
|
1456
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1457
|
+
definition: {
|
|
1458
|
+
entryStepId: string;
|
|
1459
|
+
steps: ({
|
|
1460
|
+
id: string;
|
|
1461
|
+
type: "evaluate_rules";
|
|
1462
|
+
outputKey: string;
|
|
1463
|
+
name?: string | undefined;
|
|
1464
|
+
next?: string | undefined;
|
|
1465
|
+
ruleKeys?: string[] | undefined;
|
|
1466
|
+
ruleSetKey?: string | undefined;
|
|
1467
|
+
} | {
|
|
1468
|
+
id: string;
|
|
1469
|
+
type: "call_plugin";
|
|
1470
|
+
plugin: string;
|
|
1471
|
+
action: string;
|
|
1472
|
+
input: Record<string, unknown>;
|
|
1473
|
+
inputMapping: Record<string, string>;
|
|
1474
|
+
outputKey: string;
|
|
1475
|
+
name?: string | undefined;
|
|
1476
|
+
next?: string | undefined;
|
|
1477
|
+
retry?: {
|
|
1478
|
+
maximumAttempts?: number | undefined;
|
|
1479
|
+
initialIntervalSeconds?: number | undefined;
|
|
1480
|
+
} | undefined;
|
|
1481
|
+
} | {
|
|
1482
|
+
id: string;
|
|
1483
|
+
type: "wait_for_collection";
|
|
1484
|
+
flowKey: string;
|
|
1485
|
+
outputKey: string;
|
|
1486
|
+
name?: string | undefined;
|
|
1487
|
+
next?: string | undefined;
|
|
1488
|
+
timeoutSeconds?: number | undefined;
|
|
1489
|
+
} | {
|
|
1490
|
+
id: string;
|
|
1491
|
+
type: "create_case";
|
|
1492
|
+
caseType: string;
|
|
1493
|
+
priority: "low" | "medium" | "high" | "critical";
|
|
1494
|
+
outputKey: string;
|
|
1495
|
+
name?: string | undefined;
|
|
1496
|
+
next?: string | undefined;
|
|
1497
|
+
slaHours?: number | undefined;
|
|
1498
|
+
} | {
|
|
1499
|
+
id: string;
|
|
1500
|
+
type: "emit_decision";
|
|
1501
|
+
mode: "fixed" | "from_rules";
|
|
1502
|
+
rulesKey: string;
|
|
1503
|
+
manualDecisionKey: string;
|
|
1504
|
+
name?: string | undefined;
|
|
1505
|
+
next?: string | undefined;
|
|
1506
|
+
outcome?: "approve" | "reject" | "manual_review" | undefined;
|
|
1507
|
+
} | {
|
|
1508
|
+
id: string;
|
|
1509
|
+
type: "branch";
|
|
1510
|
+
conditions: {
|
|
1511
|
+
when: {
|
|
1512
|
+
path: string;
|
|
1513
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1514
|
+
value?: unknown;
|
|
1515
|
+
};
|
|
1516
|
+
next: string;
|
|
1517
|
+
}[];
|
|
1518
|
+
default: string;
|
|
1519
|
+
name?: string | undefined;
|
|
1520
|
+
next?: string | undefined;
|
|
1521
|
+
})[];
|
|
1522
|
+
ui?: {
|
|
1523
|
+
positions: Record<string, {
|
|
1524
|
+
x: number;
|
|
1525
|
+
y: number;
|
|
1526
|
+
}>;
|
|
1527
|
+
} | undefined;
|
|
1528
|
+
};
|
|
1529
|
+
createdBy?: string | null | undefined;
|
|
1530
|
+
description?: string | null | undefined;
|
|
1531
|
+
}>;
|
|
1532
|
+
};
|
|
1533
|
+
/** Step and field type schemas behind the builder's forms. */
|
|
1534
|
+
builder: BuilderClient;
|
|
1535
|
+
ruleDefinitions: {
|
|
1536
|
+
/** Evaluates one rule version against a subject or inline data; nothing is recorded. */
|
|
1537
|
+
dryRun: (key: string, body: DryRunBody) => Promise<DryRunResult>;
|
|
1538
|
+
list: () => Promise<{
|
|
1539
|
+
createdAt: Date;
|
|
1540
|
+
updatedAt: Date;
|
|
1541
|
+
id: string;
|
|
1542
|
+
tenantId: string;
|
|
1543
|
+
key: string;
|
|
1544
|
+
version: number;
|
|
1545
|
+
name: string;
|
|
1546
|
+
type: "plugin" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity";
|
|
1547
|
+
config: unknown;
|
|
1548
|
+
severity: "info" | "warn" | "block";
|
|
1549
|
+
enabled: boolean;
|
|
1550
|
+
tags: string[];
|
|
1551
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1552
|
+
createdBy?: string | null | undefined;
|
|
1553
|
+
description?: string | null | undefined;
|
|
1554
|
+
weight?: number | null | undefined;
|
|
1555
|
+
}[]>;
|
|
1556
|
+
get: (key: string) => Promise<{
|
|
1557
|
+
createdAt: Date;
|
|
1558
|
+
updatedAt: Date;
|
|
1559
|
+
id: string;
|
|
1560
|
+
tenantId: string;
|
|
1561
|
+
key: string;
|
|
1562
|
+
version: number;
|
|
1563
|
+
name: string;
|
|
1564
|
+
type: "plugin" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity";
|
|
1565
|
+
config: unknown;
|
|
1566
|
+
severity: "info" | "warn" | "block";
|
|
1567
|
+
enabled: boolean;
|
|
1568
|
+
tags: string[];
|
|
1569
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1570
|
+
createdBy?: string | null | undefined;
|
|
1571
|
+
description?: string | null | undefined;
|
|
1572
|
+
weight?: number | null | undefined;
|
|
1573
|
+
}>;
|
|
1574
|
+
upsert: (key: string, body: {
|
|
1575
|
+
name: string;
|
|
1576
|
+
type: "plugin" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity";
|
|
1577
|
+
config: unknown;
|
|
1578
|
+
description?: string | undefined;
|
|
1579
|
+
severity?: "info" | "warn" | "block" | undefined;
|
|
1580
|
+
weight?: number | undefined;
|
|
1581
|
+
enabled?: boolean | undefined;
|
|
1582
|
+
tags?: string[] | undefined;
|
|
1583
|
+
}) => Promise<{
|
|
1584
|
+
createdAt: Date;
|
|
1585
|
+
updatedAt: Date;
|
|
1586
|
+
id: string;
|
|
1587
|
+
tenantId: string;
|
|
1588
|
+
key: string;
|
|
1589
|
+
version: number;
|
|
1590
|
+
name: string;
|
|
1591
|
+
type: "plugin" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity";
|
|
1592
|
+
config: unknown;
|
|
1593
|
+
severity: "info" | "warn" | "block";
|
|
1594
|
+
enabled: boolean;
|
|
1595
|
+
tags: string[];
|
|
1596
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1597
|
+
createdBy?: string | null | undefined;
|
|
1598
|
+
description?: string | null | undefined;
|
|
1599
|
+
weight?: number | null | undefined;
|
|
1600
|
+
}>;
|
|
1601
|
+
publish: (key: string) => Promise<{
|
|
1602
|
+
createdAt: Date;
|
|
1603
|
+
updatedAt: Date;
|
|
1604
|
+
id: string;
|
|
1605
|
+
tenantId: string;
|
|
1606
|
+
key: string;
|
|
1607
|
+
version: number;
|
|
1608
|
+
name: string;
|
|
1609
|
+
type: "plugin" | "comparison" | "list_lookup" | "score_threshold" | "expression" | "velocity";
|
|
1610
|
+
config: unknown;
|
|
1611
|
+
severity: "info" | "warn" | "block";
|
|
1612
|
+
enabled: boolean;
|
|
1613
|
+
tags: string[];
|
|
1614
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1615
|
+
createdBy?: string | null | undefined;
|
|
1616
|
+
description?: string | null | undefined;
|
|
1617
|
+
weight?: number | null | undefined;
|
|
1618
|
+
}>;
|
|
1619
|
+
};
|
|
1620
|
+
ruleTypes: {
|
|
1621
|
+
list: () => Promise<RuleTypeDescription[]>;
|
|
1622
|
+
};
|
|
1623
|
+
/** Versioned, ordered groups of rules with an aggregation policy (`/rule-sets`). */
|
|
1624
|
+
ruleSets: {
|
|
1625
|
+
list: () => Promise<{
|
|
1626
|
+
createdAt: Date;
|
|
1627
|
+
updatedAt: Date;
|
|
1628
|
+
id: string;
|
|
1629
|
+
tenantId: string;
|
|
1630
|
+
key: string;
|
|
1631
|
+
version: number;
|
|
1632
|
+
name: string;
|
|
1633
|
+
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
|
|
1634
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1635
|
+
definition: {
|
|
1636
|
+
rules: {
|
|
1637
|
+
ruleKey: string;
|
|
1638
|
+
enabled: boolean;
|
|
1639
|
+
shadow: boolean;
|
|
1640
|
+
weightOverride?: number | undefined;
|
|
1641
|
+
}[];
|
|
1642
|
+
policy: {
|
|
1643
|
+
mode: "max_severity";
|
|
1644
|
+
} | {
|
|
1645
|
+
mode: "sum_weights";
|
|
1646
|
+
clamp: {
|
|
1647
|
+
min: number;
|
|
1648
|
+
max: number;
|
|
1649
|
+
};
|
|
1650
|
+
bands: {
|
|
1651
|
+
min: number;
|
|
1652
|
+
max: number;
|
|
1653
|
+
outcome: "approve" | "reject" | "manual_review";
|
|
1654
|
+
}[];
|
|
1655
|
+
} | {
|
|
1656
|
+
mode: "first_match";
|
|
1657
|
+
default: "approve" | "reject" | "manual_review";
|
|
1658
|
+
};
|
|
1659
|
+
};
|
|
1660
|
+
createdBy?: string | null | undefined;
|
|
1661
|
+
description?: string | null | undefined;
|
|
1662
|
+
}[]>;
|
|
1663
|
+
get: (key: string) => Promise<{
|
|
1664
|
+
createdAt: Date;
|
|
1665
|
+
updatedAt: Date;
|
|
1666
|
+
id: string;
|
|
1667
|
+
tenantId: string;
|
|
1668
|
+
key: string;
|
|
1669
|
+
version: number;
|
|
1670
|
+
name: string;
|
|
1671
|
+
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
|
|
1672
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1673
|
+
definition: {
|
|
1674
|
+
rules: {
|
|
1675
|
+
ruleKey: string;
|
|
1676
|
+
enabled: boolean;
|
|
1677
|
+
shadow: boolean;
|
|
1678
|
+
weightOverride?: number | undefined;
|
|
1679
|
+
}[];
|
|
1680
|
+
policy: {
|
|
1681
|
+
mode: "max_severity";
|
|
1682
|
+
} | {
|
|
1683
|
+
mode: "sum_weights";
|
|
1684
|
+
clamp: {
|
|
1685
|
+
min: number;
|
|
1686
|
+
max: number;
|
|
1687
|
+
};
|
|
1688
|
+
bands: {
|
|
1689
|
+
min: number;
|
|
1690
|
+
max: number;
|
|
1691
|
+
outcome: "approve" | "reject" | "manual_review";
|
|
1692
|
+
}[];
|
|
1693
|
+
} | {
|
|
1694
|
+
mode: "first_match";
|
|
1695
|
+
default: "approve" | "reject" | "manual_review";
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
createdBy?: string | null | undefined;
|
|
1699
|
+
description?: string | null | undefined;
|
|
1700
|
+
}>;
|
|
1701
|
+
upsert: (key: string, body: {
|
|
1702
|
+
name: string;
|
|
1703
|
+
definition: {
|
|
1704
|
+
rules: {
|
|
1705
|
+
ruleKey: string;
|
|
1706
|
+
enabled?: boolean | undefined;
|
|
1707
|
+
weightOverride?: number | undefined;
|
|
1708
|
+
shadow?: boolean | undefined;
|
|
1709
|
+
}[];
|
|
1710
|
+
policy: {
|
|
1711
|
+
mode: "max_severity";
|
|
1712
|
+
} | {
|
|
1713
|
+
mode: "sum_weights";
|
|
1714
|
+
bands: {
|
|
1715
|
+
min: number;
|
|
1716
|
+
max: number;
|
|
1717
|
+
outcome: "approve" | "reject" | "manual_review";
|
|
1718
|
+
}[];
|
|
1719
|
+
clamp?: {
|
|
1720
|
+
min?: number | undefined;
|
|
1721
|
+
max?: number | undefined;
|
|
1722
|
+
} | undefined;
|
|
1723
|
+
} | {
|
|
1724
|
+
mode: "first_match";
|
|
1725
|
+
default?: "approve" | "reject" | "manual_review" | undefined;
|
|
1726
|
+
};
|
|
1727
|
+
};
|
|
1728
|
+
description?: string | undefined;
|
|
1729
|
+
useCase?: "custom" | "onboarding" | "underwriting" | "monitoring" | undefined;
|
|
1730
|
+
}) => Promise<{
|
|
1731
|
+
createdAt: Date;
|
|
1732
|
+
updatedAt: Date;
|
|
1733
|
+
id: string;
|
|
1734
|
+
tenantId: string;
|
|
1735
|
+
key: string;
|
|
1736
|
+
version: number;
|
|
1737
|
+
name: string;
|
|
1738
|
+
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
|
|
1739
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1740
|
+
definition: {
|
|
1741
|
+
rules: {
|
|
1742
|
+
ruleKey: string;
|
|
1743
|
+
enabled: boolean;
|
|
1744
|
+
shadow: boolean;
|
|
1745
|
+
weightOverride?: number | undefined;
|
|
1746
|
+
}[];
|
|
1747
|
+
policy: {
|
|
1748
|
+
mode: "max_severity";
|
|
1749
|
+
} | {
|
|
1750
|
+
mode: "sum_weights";
|
|
1751
|
+
clamp: {
|
|
1752
|
+
min: number;
|
|
1753
|
+
max: number;
|
|
1754
|
+
};
|
|
1755
|
+
bands: {
|
|
1756
|
+
min: number;
|
|
1757
|
+
max: number;
|
|
1758
|
+
outcome: "approve" | "reject" | "manual_review";
|
|
1759
|
+
}[];
|
|
1760
|
+
} | {
|
|
1761
|
+
mode: "first_match";
|
|
1762
|
+
default: "approve" | "reject" | "manual_review";
|
|
1763
|
+
};
|
|
1764
|
+
};
|
|
1765
|
+
createdBy?: string | null | undefined;
|
|
1766
|
+
description?: string | null | undefined;
|
|
1767
|
+
}>;
|
|
1768
|
+
publish: (key: string) => Promise<{
|
|
1769
|
+
createdAt: Date;
|
|
1770
|
+
updatedAt: Date;
|
|
1771
|
+
id: string;
|
|
1772
|
+
tenantId: string;
|
|
1773
|
+
key: string;
|
|
1774
|
+
version: number;
|
|
1775
|
+
name: string;
|
|
1776
|
+
useCase: "custom" | "onboarding" | "underwriting" | "monitoring";
|
|
1777
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1778
|
+
definition: {
|
|
1779
|
+
rules: {
|
|
1780
|
+
ruleKey: string;
|
|
1781
|
+
enabled: boolean;
|
|
1782
|
+
shadow: boolean;
|
|
1783
|
+
weightOverride?: number | undefined;
|
|
1784
|
+
}[];
|
|
1785
|
+
policy: {
|
|
1786
|
+
mode: "max_severity";
|
|
1787
|
+
} | {
|
|
1788
|
+
mode: "sum_weights";
|
|
1789
|
+
clamp: {
|
|
1790
|
+
min: number;
|
|
1791
|
+
max: number;
|
|
1792
|
+
};
|
|
1793
|
+
bands: {
|
|
1794
|
+
min: number;
|
|
1795
|
+
max: number;
|
|
1796
|
+
outcome: "approve" | "reject" | "manual_review";
|
|
1797
|
+
}[];
|
|
1798
|
+
} | {
|
|
1799
|
+
mode: "first_match";
|
|
1800
|
+
default: "approve" | "reject" | "manual_review";
|
|
1801
|
+
};
|
|
1802
|
+
};
|
|
1803
|
+
createdBy?: string | null | undefined;
|
|
1804
|
+
description?: string | null | undefined;
|
|
1805
|
+
}>;
|
|
1806
|
+
};
|
|
1807
|
+
collectionFlows: {
|
|
1808
|
+
/** Validates a draft flow body without saving; issues carry step / field keys. */
|
|
1809
|
+
validate: (body: {
|
|
1810
|
+
name: string;
|
|
1811
|
+
definition: {
|
|
1812
|
+
entryStepId: string;
|
|
1813
|
+
steps: {
|
|
1814
|
+
id: string;
|
|
1815
|
+
title: string;
|
|
1816
|
+
fields: {
|
|
1817
|
+
key: string;
|
|
1818
|
+
label: string;
|
|
1819
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
1820
|
+
required?: boolean | undefined;
|
|
1821
|
+
placeholder?: string | undefined;
|
|
1822
|
+
help?: string | undefined;
|
|
1823
|
+
options?: {
|
|
1824
|
+
value: string;
|
|
1825
|
+
label: string;
|
|
1826
|
+
}[] | undefined;
|
|
1827
|
+
validation?: {
|
|
1828
|
+
min?: number | undefined;
|
|
1829
|
+
max?: number | undefined;
|
|
1830
|
+
pattern?: string | undefined;
|
|
1831
|
+
} | undefined;
|
|
1832
|
+
visibleWhen?: {
|
|
1833
|
+
path: string;
|
|
1834
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1835
|
+
value?: unknown;
|
|
1836
|
+
} | undefined;
|
|
1837
|
+
}[];
|
|
1838
|
+
description?: string | undefined;
|
|
1839
|
+
next?: string | undefined;
|
|
1840
|
+
branches?: {
|
|
1841
|
+
when: {
|
|
1842
|
+
path: string;
|
|
1843
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1844
|
+
value?: unknown;
|
|
1845
|
+
};
|
|
1846
|
+
next: string;
|
|
1847
|
+
}[] | undefined;
|
|
1848
|
+
}[];
|
|
1849
|
+
linkTtlSeconds?: number | undefined;
|
|
1850
|
+
};
|
|
1851
|
+
description?: string | undefined;
|
|
1852
|
+
}) => Promise<_aletheia_dev_core.ValidationReport>;
|
|
1853
|
+
list: () => Promise<{
|
|
1854
|
+
createdAt: Date;
|
|
1855
|
+
updatedAt: Date;
|
|
1856
|
+
id: string;
|
|
1857
|
+
tenantId: string;
|
|
1858
|
+
key: string;
|
|
1859
|
+
version: number;
|
|
1860
|
+
name: string;
|
|
1861
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1862
|
+
definition: {
|
|
1863
|
+
entryStepId: string;
|
|
1864
|
+
steps: {
|
|
1865
|
+
id: string;
|
|
1866
|
+
title: string;
|
|
1867
|
+
fields: {
|
|
1868
|
+
key: string;
|
|
1869
|
+
label: string;
|
|
1870
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
1871
|
+
required: boolean;
|
|
1872
|
+
placeholder?: string | undefined;
|
|
1873
|
+
help?: string | undefined;
|
|
1874
|
+
options?: {
|
|
1875
|
+
value: string;
|
|
1876
|
+
label: string;
|
|
1877
|
+
}[] | undefined;
|
|
1878
|
+
validation?: {
|
|
1879
|
+
min?: number | undefined;
|
|
1880
|
+
max?: number | undefined;
|
|
1881
|
+
pattern?: string | undefined;
|
|
1882
|
+
} | undefined;
|
|
1883
|
+
visibleWhen?: {
|
|
1884
|
+
path: string;
|
|
1885
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1886
|
+
value?: unknown;
|
|
1887
|
+
} | undefined;
|
|
1888
|
+
}[];
|
|
1889
|
+
description?: string | undefined;
|
|
1890
|
+
next?: string | undefined;
|
|
1891
|
+
branches?: {
|
|
1892
|
+
when: {
|
|
1893
|
+
path: string;
|
|
1894
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1895
|
+
value?: unknown;
|
|
1896
|
+
};
|
|
1897
|
+
next: string;
|
|
1898
|
+
}[] | undefined;
|
|
1899
|
+
}[];
|
|
1900
|
+
linkTtlSeconds: number;
|
|
1901
|
+
};
|
|
1902
|
+
createdBy?: string | null | undefined;
|
|
1903
|
+
description?: string | null | undefined;
|
|
1904
|
+
}[]>;
|
|
1905
|
+
get: (key: string) => Promise<{
|
|
1906
|
+
createdAt: Date;
|
|
1907
|
+
updatedAt: Date;
|
|
1908
|
+
id: string;
|
|
1909
|
+
tenantId: string;
|
|
1910
|
+
key: string;
|
|
1911
|
+
version: number;
|
|
1912
|
+
name: string;
|
|
1913
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
1914
|
+
definition: {
|
|
1915
|
+
entryStepId: string;
|
|
1916
|
+
steps: {
|
|
1917
|
+
id: string;
|
|
1918
|
+
title: string;
|
|
1919
|
+
fields: {
|
|
1920
|
+
key: string;
|
|
1921
|
+
label: string;
|
|
1922
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
1923
|
+
required: boolean;
|
|
1924
|
+
placeholder?: string | undefined;
|
|
1925
|
+
help?: string | undefined;
|
|
1926
|
+
options?: {
|
|
1927
|
+
value: string;
|
|
1928
|
+
label: string;
|
|
1929
|
+
}[] | undefined;
|
|
1930
|
+
validation?: {
|
|
1931
|
+
min?: number | undefined;
|
|
1932
|
+
max?: number | undefined;
|
|
1933
|
+
pattern?: string | undefined;
|
|
1934
|
+
} | undefined;
|
|
1935
|
+
visibleWhen?: {
|
|
1936
|
+
path: string;
|
|
1937
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1938
|
+
value?: unknown;
|
|
1939
|
+
} | undefined;
|
|
1940
|
+
}[];
|
|
1941
|
+
description?: string | undefined;
|
|
1942
|
+
next?: string | undefined;
|
|
1943
|
+
branches?: {
|
|
1944
|
+
when: {
|
|
1945
|
+
path: string;
|
|
1946
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1947
|
+
value?: unknown;
|
|
1948
|
+
};
|
|
1949
|
+
next: string;
|
|
1950
|
+
}[] | undefined;
|
|
1951
|
+
}[];
|
|
1952
|
+
linkTtlSeconds: number;
|
|
1953
|
+
};
|
|
1954
|
+
createdBy?: string | null | undefined;
|
|
1955
|
+
description?: string | null | undefined;
|
|
1956
|
+
}>;
|
|
1957
|
+
upsert: (key: string, body: {
|
|
1958
|
+
name: string;
|
|
1959
|
+
definition: {
|
|
1960
|
+
entryStepId: string;
|
|
1961
|
+
steps: {
|
|
1962
|
+
id: string;
|
|
1963
|
+
title: string;
|
|
1964
|
+
fields: {
|
|
1965
|
+
key: string;
|
|
1966
|
+
label: string;
|
|
1967
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
1968
|
+
required?: boolean | undefined;
|
|
1969
|
+
placeholder?: string | undefined;
|
|
1970
|
+
help?: string | undefined;
|
|
1971
|
+
options?: {
|
|
1972
|
+
value: string;
|
|
1973
|
+
label: string;
|
|
1974
|
+
}[] | undefined;
|
|
1975
|
+
validation?: {
|
|
1976
|
+
min?: number | undefined;
|
|
1977
|
+
max?: number | undefined;
|
|
1978
|
+
pattern?: string | undefined;
|
|
1979
|
+
} | undefined;
|
|
1980
|
+
visibleWhen?: {
|
|
1981
|
+
path: string;
|
|
1982
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1983
|
+
value?: unknown;
|
|
1984
|
+
} | undefined;
|
|
1985
|
+
}[];
|
|
1986
|
+
description?: string | undefined;
|
|
1987
|
+
next?: string | undefined;
|
|
1988
|
+
branches?: {
|
|
1989
|
+
when: {
|
|
1990
|
+
path: string;
|
|
1991
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
1992
|
+
value?: unknown;
|
|
1993
|
+
};
|
|
1994
|
+
next: string;
|
|
1995
|
+
}[] | undefined;
|
|
1996
|
+
}[];
|
|
1997
|
+
linkTtlSeconds?: number | undefined;
|
|
1998
|
+
};
|
|
1999
|
+
description?: string | undefined;
|
|
2000
|
+
}) => Promise<{
|
|
2001
|
+
createdAt: Date;
|
|
2002
|
+
updatedAt: Date;
|
|
2003
|
+
id: string;
|
|
2004
|
+
tenantId: string;
|
|
2005
|
+
key: string;
|
|
2006
|
+
version: number;
|
|
2007
|
+
name: string;
|
|
2008
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
2009
|
+
definition: {
|
|
2010
|
+
entryStepId: string;
|
|
2011
|
+
steps: {
|
|
2012
|
+
id: string;
|
|
2013
|
+
title: string;
|
|
2014
|
+
fields: {
|
|
2015
|
+
key: string;
|
|
2016
|
+
label: string;
|
|
2017
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
2018
|
+
required: boolean;
|
|
2019
|
+
placeholder?: string | undefined;
|
|
2020
|
+
help?: string | undefined;
|
|
2021
|
+
options?: {
|
|
2022
|
+
value: string;
|
|
2023
|
+
label: string;
|
|
2024
|
+
}[] | undefined;
|
|
2025
|
+
validation?: {
|
|
2026
|
+
min?: number | undefined;
|
|
2027
|
+
max?: number | undefined;
|
|
2028
|
+
pattern?: string | undefined;
|
|
2029
|
+
} | undefined;
|
|
2030
|
+
visibleWhen?: {
|
|
2031
|
+
path: string;
|
|
2032
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
2033
|
+
value?: unknown;
|
|
2034
|
+
} | undefined;
|
|
2035
|
+
}[];
|
|
2036
|
+
description?: string | undefined;
|
|
2037
|
+
next?: string | undefined;
|
|
2038
|
+
branches?: {
|
|
2039
|
+
when: {
|
|
2040
|
+
path: string;
|
|
2041
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
2042
|
+
value?: unknown;
|
|
2043
|
+
};
|
|
2044
|
+
next: string;
|
|
2045
|
+
}[] | undefined;
|
|
2046
|
+
}[];
|
|
2047
|
+
linkTtlSeconds: number;
|
|
2048
|
+
};
|
|
2049
|
+
createdBy?: string | null | undefined;
|
|
2050
|
+
description?: string | null | undefined;
|
|
2051
|
+
}>;
|
|
2052
|
+
publish: (key: string) => Promise<{
|
|
2053
|
+
createdAt: Date;
|
|
2054
|
+
updatedAt: Date;
|
|
2055
|
+
id: string;
|
|
2056
|
+
tenantId: string;
|
|
2057
|
+
key: string;
|
|
2058
|
+
version: number;
|
|
2059
|
+
name: string;
|
|
2060
|
+
status: "draft" | "pending_approval" | "published" | "archived";
|
|
2061
|
+
definition: {
|
|
2062
|
+
entryStepId: string;
|
|
2063
|
+
steps: {
|
|
2064
|
+
id: string;
|
|
2065
|
+
title: string;
|
|
2066
|
+
fields: {
|
|
2067
|
+
key: string;
|
|
2068
|
+
label: string;
|
|
2069
|
+
type: "number" | "boolean" | "date" | "file" | "email" | "text" | "select";
|
|
2070
|
+
required: boolean;
|
|
2071
|
+
placeholder?: string | undefined;
|
|
2072
|
+
help?: string | undefined;
|
|
2073
|
+
options?: {
|
|
2074
|
+
value: string;
|
|
2075
|
+
label: string;
|
|
2076
|
+
}[] | undefined;
|
|
2077
|
+
validation?: {
|
|
2078
|
+
min?: number | undefined;
|
|
2079
|
+
max?: number | undefined;
|
|
2080
|
+
pattern?: string | undefined;
|
|
2081
|
+
} | undefined;
|
|
2082
|
+
visibleWhen?: {
|
|
2083
|
+
path: string;
|
|
2084
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
2085
|
+
value?: unknown;
|
|
2086
|
+
} | undefined;
|
|
2087
|
+
}[];
|
|
2088
|
+
description?: string | undefined;
|
|
2089
|
+
next?: string | undefined;
|
|
2090
|
+
branches?: {
|
|
2091
|
+
when: {
|
|
2092
|
+
path: string;
|
|
2093
|
+
op: "in" | "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "exists";
|
|
2094
|
+
value?: unknown;
|
|
2095
|
+
};
|
|
2096
|
+
next: string;
|
|
2097
|
+
}[] | undefined;
|
|
2098
|
+
}[];
|
|
2099
|
+
linkTtlSeconds: number;
|
|
2100
|
+
};
|
|
2101
|
+
createdBy?: string | null | undefined;
|
|
2102
|
+
description?: string | null | undefined;
|
|
2103
|
+
}>;
|
|
2104
|
+
};
|
|
2105
|
+
collectionSubmissions: {
|
|
2106
|
+
/** Creates the submission and returns the applicant link alongside it. */
|
|
2107
|
+
create: (body: CreateSubmissionBody) => Promise<CreatedSubmission>;
|
|
2108
|
+
get: (id: string) => Promise<SubmissionDetail>;
|
|
2109
|
+
save: (id: string, body: SaveSubmissionBody) => Promise<CollectionSubmission>;
|
|
2110
|
+
submit: (id: string) => Promise<CollectionSubmission>;
|
|
2111
|
+
/** Where the submission's workflow run is; readable with the applicant's token. */
|
|
2112
|
+
status: (id: string) => Promise<SubmissionStatus>;
|
|
2113
|
+
/** Embed allow-list and flow name for the submission; readable with the applicant's token. */
|
|
2114
|
+
embed: (id: string) => Promise<SubmissionEmbed>;
|
|
2115
|
+
};
|
|
2116
|
+
/** Subject events: the facts velocity rules aggregate over. */
|
|
2117
|
+
events: {
|
|
2118
|
+
/** Inserts events; re-sent idempotency keys are counted as `duplicates`, not errors. */
|
|
2119
|
+
ingest: (body: IngestEventsBody) => Promise<IngestEventsResult>;
|
|
2120
|
+
/** Newest first. */
|
|
2121
|
+
list: (query?: EventListQuery) => Promise<Event[]>;
|
|
2122
|
+
};
|
|
2123
|
+
/**
|
|
2124
|
+
* Replays recorded evaluations against a rule version (`backtests:run`). `start` returns the
|
|
2125
|
+
* queued job; poll `get` until its status is `completed` (with `summary`) or `failed`.
|
|
2126
|
+
*/
|
|
2127
|
+
backtests: {
|
|
2128
|
+
start: (body: StartBacktestBody) => Promise<Backtest>;
|
|
2129
|
+
/** Newest first. */
|
|
2130
|
+
list: (query?: PageQuery) => Promise<Backtest[]>;
|
|
2131
|
+
get: (id: string) => Promise<Backtest>;
|
|
2132
|
+
};
|
|
2133
|
+
decisions: {
|
|
2134
|
+
listBySubject: (subjectId: string) => Promise<Decision[]>;
|
|
2135
|
+
};
|
|
2136
|
+
/** Filtered audit trail, exports and manifest verification (`audit:read`). See `audit.ts`. */
|
|
2137
|
+
audit: AuditClient;
|
|
2138
|
+
/** @deprecated Alias of `audit`, kept for existing callers. */
|
|
2139
|
+
auditEvents: {
|
|
2140
|
+
list: (query?: AuditEventQuery) => Promise<AuditEvent[]>;
|
|
2141
|
+
};
|
|
2142
|
+
/** Version history, diffs and the approval workflow of definitions. See `governance.ts`. */
|
|
2143
|
+
governance: GovernanceClient;
|
|
2144
|
+
plugins: {
|
|
2145
|
+
list: () => Promise<PluginDefinition[]>;
|
|
2146
|
+
available: () => Promise<PluginSummary[]>;
|
|
2147
|
+
configure: (name: string, body: ConfigurePluginBody) => Promise<PluginDefinition>;
|
|
2148
|
+
};
|
|
2149
|
+
pluginInvocations: {
|
|
2150
|
+
list: (query?: PluginInvocationQuery) => Promise<PluginInvocation[]>;
|
|
2151
|
+
};
|
|
2152
|
+
/**
|
|
2153
|
+
* Uploaded files: `create` -> `uploadToStorage` (helper) -> `finalize` -> `pollDocument`
|
|
2154
|
+
* (helper) until the scan settles. See `documents.ts`.
|
|
2155
|
+
*/
|
|
2156
|
+
documents: {
|
|
2157
|
+
create: (input: _aletheia_dev_core.CreateDocumentInput) => Promise<_aletheia_dev_core.DocumentUploadTicket>;
|
|
2158
|
+
finalize: (id: string, opts?: DocumentScope) => Promise<_aletheia_dev_core.Document>;
|
|
2159
|
+
get: (id: string, opts?: DocumentScope) => Promise<_aletheia_dev_core.Document>;
|
|
2160
|
+
list: (filters?: DocumentListQuery) => Promise<DocumentList>;
|
|
2161
|
+
download: (id: string, opts?: DocumentScope) => Promise<_aletheia_dev_core.DocumentDownload>;
|
|
2162
|
+
};
|
|
2163
|
+
/** Tenant settings such as the embed origin allow-list (`tenants:settings`). */
|
|
2164
|
+
tenants: TenantsClient;
|
|
2165
|
+
/** Tenant lists (blocklists / allowlists) and their entries. Lists are keyed, not versioned. */
|
|
2166
|
+
lists: {
|
|
2167
|
+
list: () => Promise<List[]>;
|
|
2168
|
+
get: (key: string) => Promise<List>;
|
|
2169
|
+
/** Creates the list or updates its metadata; entries are untouched. */
|
|
2170
|
+
upsert: (key: string, body: UpsertListBody) => Promise<List>;
|
|
2171
|
+
remove: (key: string) => Promise<void>;
|
|
2172
|
+
entries: (key: string, query?: ListEntryQuery) => Promise<ListEntry[]>;
|
|
2173
|
+
addEntries: (key: string, body: AddListEntriesBody) => Promise<ListImportResult>;
|
|
2174
|
+
removeEntries: (key: string, body: RemoveListEntriesBody) => Promise<RemovedCount>;
|
|
2175
|
+
/** Uploads a CSV (one value per line, optional `value,reason,expires_at` header). */
|
|
2176
|
+
importCsv: (key: string, csv: string) => Promise<ListImportResult>;
|
|
2177
|
+
};
|
|
2178
|
+
};
|
|
2179
|
+
type ApiClient = ReturnType<typeof createApiClient>;
|
|
2180
|
+
|
|
2181
|
+
/**
|
|
2182
|
+
* Runtime configuration for the UIs, served as `GET /config.json` from the same origin as the
|
|
2183
|
+
* app. The `web` image's entrypoint writes one file per app from environment variables, so one
|
|
2184
|
+
* image serves every environment. The dev servers serve `public/config.json`, an empty object,
|
|
2185
|
+
* so the `VITE_*` values from the root `.env` and the localhost defaults apply instead.
|
|
2186
|
+
*
|
|
2187
|
+
* Every key is optional and an empty string counts as absent, so a partially rendered file
|
|
2188
|
+
* falls through to the next source. `zitadelClientId` differs per app.
|
|
2189
|
+
*/
|
|
2190
|
+
declare const RuntimeConfig: z.ZodObject<{
|
|
2191
|
+
apiUrl: z.ZodOptional<z.ZodString>;
|
|
2192
|
+
zitadelIssuer: z.ZodOptional<z.ZodString>;
|
|
2193
|
+
zitadelProjectId: z.ZodOptional<z.ZodString>;
|
|
2194
|
+
zitadelClientId: z.ZodOptional<z.ZodString>;
|
|
2195
|
+
zitadelOrgDomain: z.ZodOptional<z.ZodString>;
|
|
2196
|
+
collectionFlowUrl: z.ZodOptional<z.ZodString>;
|
|
2197
|
+
}, z.core.$strip>;
|
|
2198
|
+
type RuntimeConfig = z.infer<typeof RuntimeConfig>;
|
|
2199
|
+
type RuntimeConfigKey = keyof RuntimeConfig;
|
|
2200
|
+
/** Every key resolved to a string (possibly empty when no source provides it). */
|
|
2201
|
+
type ResolvedConfig = Record<RuntimeConfigKey, string>;
|
|
2202
|
+
declare const RUNTIME_CONFIG_PATH = "/config.json";
|
|
2203
|
+
/**
|
|
2204
|
+
* Fetches `/config.json` without caching so a redeploy with new values takes effect on the next
|
|
2205
|
+
* load. A missing file, a non-JSON body, a body that fails the schema or a network error all
|
|
2206
|
+
* yield `{}`: the caller's fallbacks then apply.
|
|
2207
|
+
*/
|
|
2208
|
+
declare function loadRuntimeConfig(fetchImpl?: FetchLike): Promise<RuntimeConfig>;
|
|
2209
|
+
/**
|
|
2210
|
+
* Merges the three sources: the runtime file wins, then the build-time `VITE_*` values the app
|
|
2211
|
+
* maps onto the same keys, then the app's defaults. Empty strings never win over a later source.
|
|
2212
|
+
*/
|
|
2213
|
+
declare function resolveConfig(runtime: RuntimeConfig, env: Partial<Record<RuntimeConfigKey, string | undefined>>, defaults: ResolvedConfig): ResolvedConfig;
|
|
2214
|
+
|
|
2215
|
+
export { type AccessTokenProvider, type AddListEntriesBody, type ApiClient, type ApiClientOptions, ApiError, type ApiErrorBody, type ApprovalListQuery, ApprovalOutcome, type AssignCaseBody, type AuditClient, type AuditEventQuery, type AuditFilterQuery, type AuditListQuery, type BuilderClient, CaseDetail, type CaseListQuery, type CaseNoteBody, CaseQueueCount, type CaseQueuesClient, type CasesClient, type CloseCaseBody, type CreateSubjectBody, type CreateSubmissionBody, CreatedSubmission, type DecideCaseBody, DecideCaseResult, type DiffQuery, DocumentList, type DocumentListQuery, DocumentPollTimeoutError, type DocumentScope, type DocumentsClient, type DryRunBody, type DryRunInput, DryRunResult, type EventListQuery, type ExportVerification, FORBIDDEN_CODES, type FetchLike, type FileCheck, type GovernanceClient, HealthStatus, type IngestEventsBody, type ListEntryQuery, Me, MePrincipal, type PageQuery, type PluginInvocationQuery, PluginSummary, type PollOptions, RUNTIME_CONFIG_PATH, type RawBody, ReadyStatus, type RemoveListEntriesBody, RemovedCount, type ResolvedConfig, RuleTypeDescription, RuleUiHints, RuntimeConfig, type RuntimeConfigKey, type SaveSubmissionBody, type StartBacktestBody, type StartWorkflowRunBody, SubmissionDetail, SubmissionEmbed, SubmissionStatus, type TenantsClient, UploadError, type UploadOptions, type UploadProgressEvent, type UploadXhr, type UpsertCaseQueueBody, type UpsertCollectionFlowBody, type UpsertListBody, type UpsertRuleDefinitionBody, type UpsertRuleSetBody, type UpsertWorkflowDefinitionBody, type UserListQuery, type UsersClient, type ValidateCollectionFlowBody, type ValidateWorkflowBody, auditFilterParams, caseListParams, checkFileBeforeUpload, createApiClient, isApiError, isApiErrorBody, isForbidden, isTenantNotProvisioned, isTerminalDocumentStatus, isUnauthenticated, loadRuntimeConfig, pollDocument, resolveConfig, uploadToStorage, verifyExport };
|