@stndrds/schema 0.1.0-alpha.53 → 0.1.0-alpha.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2EIZ6QXN.mjs → chunk-4NLKDJWD.mjs} +3505 -1417
- package/dist/{chunk-67XEOXQL.js → chunk-QBDGRMSC.js} +3619 -1531
- package/dist/index.d.mts +320 -150
- package/dist/index.d.ts +320 -150
- package/dist/index.js +95 -7
- package/dist/index.mjs +122 -34
- package/dist/{runtime-B5JYQdZx.d.mts → runtime-ka1bmD0F.d.mts} +2849 -633
- package/dist/{runtime-B5JYQdZx.d.ts → runtime-ka1bmD0F.d.ts} +2849 -633
- package/dist/runtime.d.mts +2 -1
- package/dist/runtime.d.ts +2 -1
- package/dist/runtime.js +32 -2
- package/dist/runtime.mjs +45 -15
- package/package.json +4 -2
|
@@ -1,6 +1,262 @@
|
|
|
1
1
|
import { ColorId, IconName, CountryIso3, CurrencyCode, MimeType } from '@stndrds/constants';
|
|
2
|
+
import { JWTPayload } from 'jose';
|
|
2
3
|
import { z } from 'zod';
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* OCR Adapter Interface for extracting text from documents.
|
|
7
|
+
*
|
|
8
|
+
* Implementations:
|
|
9
|
+
* - GoogleVisionAdapter (schema-nestjs/adapters/ocr/)
|
|
10
|
+
* - TesseractAdapter (schema-nestjs/adapters/ocr/)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* class GoogleVisionAdapter implements OcrAdapter {
|
|
15
|
+
* readonly name = "google-vision";
|
|
16
|
+
* readonly supportedMimeTypes = ["image/jpeg", "image/png", "application/pdf"];
|
|
17
|
+
*
|
|
18
|
+
* async extractText(input: OcrInput): Promise<OcrResult> {
|
|
19
|
+
* // Call Google Cloud Vision API
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
interface OcrAdapter {
|
|
25
|
+
/** Provider name for identification */
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** MIME types this adapter can process */
|
|
28
|
+
readonly supportedMimeTypes: readonly string[];
|
|
29
|
+
/** Extract text from a document */
|
|
30
|
+
extractText(input: OcrInput): Promise<OcrResult>;
|
|
31
|
+
}
|
|
32
|
+
interface OcrInput {
|
|
33
|
+
/** File content as Buffer */
|
|
34
|
+
buffer: Buffer;
|
|
35
|
+
/** MIME type of the file */
|
|
36
|
+
mimeType: string;
|
|
37
|
+
/** Original filename */
|
|
38
|
+
filename: string;
|
|
39
|
+
/** OCR options */
|
|
40
|
+
options?: OcrOptions;
|
|
41
|
+
}
|
|
42
|
+
interface OcrOptions {
|
|
43
|
+
/** Languages to detect (ISO 639-1 codes) */
|
|
44
|
+
languages?: string[];
|
|
45
|
+
/** Enable structured data extraction (forms, tables) */
|
|
46
|
+
extractStructured?: boolean;
|
|
47
|
+
}
|
|
48
|
+
interface OcrResult {
|
|
49
|
+
/** Extracted full text */
|
|
50
|
+
text: string;
|
|
51
|
+
/** Overall confidence score (0-1) */
|
|
52
|
+
confidence: number;
|
|
53
|
+
/** Per-page results */
|
|
54
|
+
pages?: OcrPage[];
|
|
55
|
+
/** Structured data if extracted (forms, tables) */
|
|
56
|
+
structuredData?: Record<string, unknown>;
|
|
57
|
+
}
|
|
58
|
+
interface OcrPage {
|
|
59
|
+
pageNumber: number;
|
|
60
|
+
text: string;
|
|
61
|
+
confidence: number;
|
|
62
|
+
/** Bounding boxes for detected text blocks */
|
|
63
|
+
blocks?: OcrTextBlock[];
|
|
64
|
+
}
|
|
65
|
+
interface OcrTextBlock {
|
|
66
|
+
text: string;
|
|
67
|
+
confidence: number;
|
|
68
|
+
boundingBox: BoundingBox;
|
|
69
|
+
}
|
|
70
|
+
interface BoundingBox {
|
|
71
|
+
x: number;
|
|
72
|
+
y: number;
|
|
73
|
+
width: number;
|
|
74
|
+
height: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Signature Adapter Interface for electronic signatures.
|
|
78
|
+
*
|
|
79
|
+
* Implementations:
|
|
80
|
+
* - YousignAdapter (schema-nestjs/adapters/signature/)
|
|
81
|
+
* - DocusignAdapter (schema-nestjs/adapters/signature/)
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* class YousignAdapter implements SignatureAdapter {
|
|
86
|
+
* readonly name = "yousign";
|
|
87
|
+
*
|
|
88
|
+
* async createSignatureRequest(input): Promise<SignatureRequestResult> {
|
|
89
|
+
* // Create signature request via Yousign API
|
|
90
|
+
* }
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
interface SignatureAdapter {
|
|
95
|
+
/** Provider name for identification */
|
|
96
|
+
readonly name: string;
|
|
97
|
+
/** Create a new signature request */
|
|
98
|
+
createSignatureRequest(input: CreateSignatureInput): Promise<SignatureRequestResult>;
|
|
99
|
+
/** Get current status of a signature request */
|
|
100
|
+
getStatus(externalId: string): Promise<SignatureStatusResult>;
|
|
101
|
+
/** Cancel a pending signature request */
|
|
102
|
+
cancel(externalId: string): Promise<void>;
|
|
103
|
+
/** Download the signed document */
|
|
104
|
+
downloadSignedDocument(externalId: string): Promise<Buffer>;
|
|
105
|
+
}
|
|
106
|
+
interface CreateSignatureInput {
|
|
107
|
+
/** Document content as Buffer */
|
|
108
|
+
documentBuffer: Buffer;
|
|
109
|
+
/** Document filename */
|
|
110
|
+
documentName: string;
|
|
111
|
+
/** List of signers */
|
|
112
|
+
signers: SignerRequest[];
|
|
113
|
+
/** Expiration date for the signature request */
|
|
114
|
+
expiresAt?: Date;
|
|
115
|
+
/** Webhook URL for status updates */
|
|
116
|
+
webhookUrl?: string;
|
|
117
|
+
/** Custom metadata to attach */
|
|
118
|
+
metadata?: Record<string, string>;
|
|
119
|
+
}
|
|
120
|
+
interface SignerRequest {
|
|
121
|
+
/** Signer's email address */
|
|
122
|
+
email: string;
|
|
123
|
+
/** Signer's first name */
|
|
124
|
+
firstName: string;
|
|
125
|
+
/** Signer's last name */
|
|
126
|
+
lastName: string;
|
|
127
|
+
/** Phone number for SMS verification */
|
|
128
|
+
phone?: string;
|
|
129
|
+
/** Signature position on the document */
|
|
130
|
+
signaturePosition?: SignaturePosition;
|
|
131
|
+
/** Order in which to sign (1-based) */
|
|
132
|
+
order?: number;
|
|
133
|
+
}
|
|
134
|
+
interface SignaturePosition {
|
|
135
|
+
/** Page number (1-based) */
|
|
136
|
+
page: number;
|
|
137
|
+
/** X coordinate (from left) */
|
|
138
|
+
x: number;
|
|
139
|
+
/** Y coordinate (from top) */
|
|
140
|
+
y: number;
|
|
141
|
+
/** Signature box width */
|
|
142
|
+
width: number;
|
|
143
|
+
/** Signature box height */
|
|
144
|
+
height: number;
|
|
145
|
+
}
|
|
146
|
+
interface SignatureRequestResult {
|
|
147
|
+
/** External ID from the provider */
|
|
148
|
+
externalId: string;
|
|
149
|
+
/** URL for signers to access */
|
|
150
|
+
signatureUrl: string;
|
|
151
|
+
/** Per-signer URLs if different */
|
|
152
|
+
signerUrls?: Record<string, string>;
|
|
153
|
+
/** Current status */
|
|
154
|
+
status: SignatureStatus;
|
|
155
|
+
}
|
|
156
|
+
interface SignatureStatusResult {
|
|
157
|
+
/** External ID */
|
|
158
|
+
externalId: string;
|
|
159
|
+
/** Current status */
|
|
160
|
+
status: SignatureStatus;
|
|
161
|
+
/** Per-signer status */
|
|
162
|
+
signers?: SignerStatus[];
|
|
163
|
+
/** Signed document available for download */
|
|
164
|
+
signedDocumentAvailable?: boolean;
|
|
165
|
+
/** Completion timestamp */
|
|
166
|
+
completedAt?: Date;
|
|
167
|
+
/** Reason for decline (if status is "declined") */
|
|
168
|
+
declineReason?: string;
|
|
169
|
+
}
|
|
170
|
+
interface SignerStatus {
|
|
171
|
+
email: string;
|
|
172
|
+
status: "pending" | "signed" | "declined";
|
|
173
|
+
signedAt?: Date;
|
|
174
|
+
}
|
|
175
|
+
type SignatureStatus = "pending" | "signed" | "declined" | "expired" | "cancelled";
|
|
176
|
+
/**
|
|
177
|
+
* Identity Verification Adapter Interface for KYC document verification.
|
|
178
|
+
*
|
|
179
|
+
* Implementations:
|
|
180
|
+
* - OnfidoAdapter (schema-nestjs/adapters/identity/)
|
|
181
|
+
* - VeriffAdapter (schema-nestjs/adapters/identity/)
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* class OnfidoAdapter implements IdentityVerificationAdapter {
|
|
186
|
+
* readonly name = "onfido";
|
|
187
|
+
* readonly supportedDocumentTypes = ["passport", "national_id", "driving_license"];
|
|
188
|
+
*
|
|
189
|
+
* async verify(input): Promise<VerificationResult> {
|
|
190
|
+
* // Verify document via Onfido API
|
|
191
|
+
* }
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
interface IdentityVerificationAdapter {
|
|
196
|
+
/** Provider name for identification */
|
|
197
|
+
readonly name: string;
|
|
198
|
+
/** Supported document types */
|
|
199
|
+
readonly supportedDocumentTypes: readonly string[];
|
|
200
|
+
/** Verify an identity document */
|
|
201
|
+
verify(input: VerifyInput): Promise<VerificationResult>;
|
|
202
|
+
}
|
|
203
|
+
interface VerifyInput {
|
|
204
|
+
/** Front side of the document */
|
|
205
|
+
frontBuffer: Buffer;
|
|
206
|
+
/** Back side of the document (optional for some document types) */
|
|
207
|
+
backBuffer?: Buffer;
|
|
208
|
+
/** Document type (e.g., "passport", "national_id") */
|
|
209
|
+
documentType: string;
|
|
210
|
+
/** Country code (ISO 3166-1 alpha-3) */
|
|
211
|
+
countryCode?: string;
|
|
212
|
+
}
|
|
213
|
+
interface VerificationResult {
|
|
214
|
+
/** Overall verification passed */
|
|
215
|
+
verified: boolean;
|
|
216
|
+
/** Confidence score (0-1) */
|
|
217
|
+
confidence: number;
|
|
218
|
+
/** Extracted document data */
|
|
219
|
+
documentData?: DocumentData;
|
|
220
|
+
/** Individual verification checks */
|
|
221
|
+
checks: VerificationCheck[];
|
|
222
|
+
/** Provider-specific raw response */
|
|
223
|
+
rawResponse?: Record<string, unknown>;
|
|
224
|
+
}
|
|
225
|
+
interface DocumentData {
|
|
226
|
+
/** First name */
|
|
227
|
+
firstName?: string;
|
|
228
|
+
/** Last name */
|
|
229
|
+
lastName?: string;
|
|
230
|
+
/** Full name if not split */
|
|
231
|
+
fullName?: string;
|
|
232
|
+
/** Date of birth (ISO 8601) */
|
|
233
|
+
dateOfBirth?: string;
|
|
234
|
+
/** Document number */
|
|
235
|
+
documentNumber?: string;
|
|
236
|
+
/** Expiry date (ISO 8601) */
|
|
237
|
+
expiryDate?: string;
|
|
238
|
+
/** Issue date (ISO 8601) */
|
|
239
|
+
issueDate?: string;
|
|
240
|
+
/** Nationality (ISO 3166-1 alpha-3) */
|
|
241
|
+
nationality?: string;
|
|
242
|
+
/** Gender */
|
|
243
|
+
gender?: "M" | "F" | "X";
|
|
244
|
+
/** Address if present on document */
|
|
245
|
+
address?: string;
|
|
246
|
+
/** MRZ data if available */
|
|
247
|
+
mrz?: string;
|
|
248
|
+
}
|
|
249
|
+
interface VerificationCheck {
|
|
250
|
+
/** Check name (e.g., "document_authenticity", "face_match") */
|
|
251
|
+
name: string;
|
|
252
|
+
/** Check result */
|
|
253
|
+
status: "passed" | "failed" | "warning" | "not_applicable";
|
|
254
|
+
/** Human-readable message */
|
|
255
|
+
message?: string;
|
|
256
|
+
/** Detailed sub-checks */
|
|
257
|
+
details?: Record<string, unknown>;
|
|
258
|
+
}
|
|
259
|
+
|
|
4
260
|
/**
|
|
5
261
|
* Message role in a conversation
|
|
6
262
|
*/
|
|
@@ -156,6 +412,39 @@ type AIQuestionAnswer = {
|
|
|
156
412
|
type: "multiselect";
|
|
157
413
|
value: string[];
|
|
158
414
|
};
|
|
415
|
+
/**
|
|
416
|
+
* Option for batch questions
|
|
417
|
+
*/
|
|
418
|
+
interface AIBatchQuestionOption {
|
|
419
|
+
/** Value returned when selected */
|
|
420
|
+
value: string;
|
|
421
|
+
/** Display label */
|
|
422
|
+
label: string;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Question in a batch (for ask_questions tool)
|
|
426
|
+
*/
|
|
427
|
+
interface AIBatchQuestion {
|
|
428
|
+
/** Unique question ID */
|
|
429
|
+
id: string;
|
|
430
|
+
/** Question text to display */
|
|
431
|
+
question: string;
|
|
432
|
+
/** Predefined options (if provided, displayed as buttons) */
|
|
433
|
+
options?: AIBatchQuestionOption[];
|
|
434
|
+
/** Allow custom text input in addition to options */
|
|
435
|
+
allowCustomAnswer?: boolean;
|
|
436
|
+
/** Placeholder for custom input field */
|
|
437
|
+
placeholder?: string;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Answer returned by the AgentQuestions widget
|
|
441
|
+
*/
|
|
442
|
+
interface AIBatchQuestionAnswer {
|
|
443
|
+
/** True if user skipped all questions */
|
|
444
|
+
skipped: boolean;
|
|
445
|
+
/** Map of question ID to answer value */
|
|
446
|
+
answers: Record<string, string>;
|
|
447
|
+
}
|
|
159
448
|
/**
|
|
160
449
|
* Todo item status
|
|
161
450
|
*/
|
|
@@ -381,8 +670,46 @@ declare function generateId(): Uuid;
|
|
|
381
670
|
* ```
|
|
382
671
|
*/
|
|
383
672
|
declare function generatePrefixedId(prefix: string): Uuid;
|
|
673
|
+
/**
|
|
674
|
+
* Convert a string to a valid kebab-case slug.
|
|
675
|
+
* Removes accents, special chars, and normalizes spaces.
|
|
676
|
+
*
|
|
677
|
+
* @param input - The string to slugify
|
|
678
|
+
* @returns A kebab-case slug matching pattern ^[a-z][a-z0-9-]*$
|
|
679
|
+
*
|
|
680
|
+
* @example
|
|
681
|
+
* ```typescript
|
|
682
|
+
* slugify("Contrat de Vente");
|
|
683
|
+
* // "contrat-de-vente"
|
|
684
|
+
*
|
|
685
|
+
* slugify("Éléphant café");
|
|
686
|
+
* // "elephant-cafe"
|
|
687
|
+
*
|
|
688
|
+
* slugify(" Multiple Spaces ");
|
|
689
|
+
* // "multiple-spaces"
|
|
690
|
+
* ```
|
|
691
|
+
*/
|
|
692
|
+
declare function slugify(input: string): string;
|
|
693
|
+
/**
|
|
694
|
+
* Generate a unique template name from a label.
|
|
695
|
+
* Format: {slugified-label}-{8-char-suffix}
|
|
696
|
+
* Matches DB constraint: ^[a-z][a-z0-9_-]*$
|
|
697
|
+
*
|
|
698
|
+
* @param label - The label to generate a name from
|
|
699
|
+
* @returns A unique kebab-case name
|
|
700
|
+
*
|
|
701
|
+
* @example
|
|
702
|
+
* ```typescript
|
|
703
|
+
* generateTemplateName("Contrat de Vente");
|
|
704
|
+
* // "contrat-de-vente-a1b2c3d4"
|
|
705
|
+
*
|
|
706
|
+
* generateTemplateName("");
|
|
707
|
+
* // "template-a1b2c3d4"
|
|
708
|
+
* ```
|
|
709
|
+
*/
|
|
710
|
+
declare function generateTemplateName(label: string): string;
|
|
384
711
|
|
|
385
|
-
type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup";
|
|
712
|
+
type AttributeType = "text" | "textarea" | "richtext" | "number" | "checkbox" | "date" | "phone" | "currency" | "status" | "location" | "select" | "multiselect" | "file" | "user" | "relation" | "rating" | "formula" | "rollup" | "document";
|
|
386
713
|
/**
|
|
387
714
|
* Status group categorization
|
|
388
715
|
*/
|
|
@@ -748,7 +1075,57 @@ interface RollupAttribute extends Omit<BaseAttribute<never>, "defaultValue" | "r
|
|
|
748
1075
|
*/
|
|
749
1076
|
targetAttributeOptions?: Option[];
|
|
750
1077
|
}
|
|
751
|
-
|
|
1078
|
+
/**
|
|
1079
|
+
* DocumentAttribute - References one or multiple documents with templates.
|
|
1080
|
+
*
|
|
1081
|
+
* Unlike FileAttribute which stores raw file references, DocumentAttribute
|
|
1082
|
+
* provides structured document handling with templates, multi-file support,
|
|
1083
|
+
* and automatic processing (OCR, signature, identity verification).
|
|
1084
|
+
*
|
|
1085
|
+
* @example Single document with template choice
|
|
1086
|
+
* ```typescript
|
|
1087
|
+
* document({ name: "identityDocument", label: "Pièce d'identité" })
|
|
1088
|
+
* .templates(["french_id_card", "passport"])
|
|
1089
|
+
* .autoProcess()
|
|
1090
|
+
* .required()
|
|
1091
|
+
* ```
|
|
1092
|
+
*
|
|
1093
|
+
* @example Multiple documents with fixed template
|
|
1094
|
+
* ```typescript
|
|
1095
|
+
* document({ name: "contracts", label: "Contrats" })
|
|
1096
|
+
* .template("signable_contract")
|
|
1097
|
+
* .multiple()
|
|
1098
|
+
* .maxDocuments(10)
|
|
1099
|
+
* ```
|
|
1100
|
+
*/
|
|
1101
|
+
interface DocumentAttribute extends BaseAttribute<string | string[]> {
|
|
1102
|
+
type: "document";
|
|
1103
|
+
/**
|
|
1104
|
+
* Single template ID (strict mode).
|
|
1105
|
+
* If set, only documents using this template can be attached.
|
|
1106
|
+
*/
|
|
1107
|
+
templateId?: string;
|
|
1108
|
+
/**
|
|
1109
|
+
* Multiple allowed template IDs.
|
|
1110
|
+
* User can choose which template to use when uploading.
|
|
1111
|
+
*/
|
|
1112
|
+
allowedTemplates?: string[];
|
|
1113
|
+
/**
|
|
1114
|
+
* Allow multiple documents.
|
|
1115
|
+
* If true, value is string[] (document IDs).
|
|
1116
|
+
* If false/undefined, value is string (single document ID).
|
|
1117
|
+
*/
|
|
1118
|
+
multiple?: boolean;
|
|
1119
|
+
/**
|
|
1120
|
+
* Maximum number of documents when multiple: true.
|
|
1121
|
+
*/
|
|
1122
|
+
maxDocuments?: number;
|
|
1123
|
+
/**
|
|
1124
|
+
* Automatically trigger processing (OCR, verification) on upload.
|
|
1125
|
+
*/
|
|
1126
|
+
autoProcess?: boolean;
|
|
1127
|
+
}
|
|
1128
|
+
type Attribute = TextAttribute | TextAreaAttribute | RichtextAttribute | NumberAttribute | CheckboxAttribute | DateAttribute | PhoneAttribute | CurrencyAttribute | StatusAttribute | LocationAttribute | SelectAttribute | MultiselectAttribute | FileAttribute | UserAttribute | RelationAttribute | RatingAttribute | FormulaAttribute | RollupAttribute | DocumentAttribute;
|
|
752
1129
|
|
|
753
1130
|
/**
|
|
754
1131
|
* Type of resource that can be audited
|
|
@@ -853,6 +1230,175 @@ interface AuditServiceOptions {
|
|
|
853
1230
|
flushIntervalMs?: number;
|
|
854
1231
|
}
|
|
855
1232
|
|
|
1233
|
+
/**
|
|
1234
|
+
* Variable mapping from template placeholder to context path
|
|
1235
|
+
*/
|
|
1236
|
+
interface VariableMapping {
|
|
1237
|
+
/** Placeholder name in the template */
|
|
1238
|
+
variableName: string;
|
|
1239
|
+
/** Path in WorkflowExecutionContext (e.g., "slots.client.firstName") */
|
|
1240
|
+
contextPath: string;
|
|
1241
|
+
/** Display label for the UI */
|
|
1242
|
+
label: string;
|
|
1243
|
+
/** Whether this variable is required */
|
|
1244
|
+
required?: boolean;
|
|
1245
|
+
/** Fallback value if the context path resolves to null/undefined */
|
|
1246
|
+
fallback?: string;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Field positioned on a PDF template
|
|
1250
|
+
* Coordinates are in PDF points (72 dpi)
|
|
1251
|
+
*/
|
|
1252
|
+
interface PdfTemplateField {
|
|
1253
|
+
/** Unique field identifier */
|
|
1254
|
+
id: string;
|
|
1255
|
+
/** Page number (0-indexed) */
|
|
1256
|
+
page: number;
|
|
1257
|
+
/** X coordinate in PDF points */
|
|
1258
|
+
x: number;
|
|
1259
|
+
/** Y coordinate in PDF points */
|
|
1260
|
+
y: number;
|
|
1261
|
+
/** Field width in PDF points */
|
|
1262
|
+
width: number;
|
|
1263
|
+
/** Field height in PDF points */
|
|
1264
|
+
height: number;
|
|
1265
|
+
/** Font size in points */
|
|
1266
|
+
fontSize?: number;
|
|
1267
|
+
/** Font family name */
|
|
1268
|
+
fontFamily?: string;
|
|
1269
|
+
/** Font weight */
|
|
1270
|
+
fontWeight?: "normal" | "bold";
|
|
1271
|
+
/** Text alignment */
|
|
1272
|
+
align?: "left" | "center" | "right";
|
|
1273
|
+
/** Path in WorkflowExecutionContext (e.g., "slots.client.firstName") */
|
|
1274
|
+
contextPath: string;
|
|
1275
|
+
/** Display label for the UI */
|
|
1276
|
+
label: string;
|
|
1277
|
+
/** Fallback value if the context path resolves to null/undefined */
|
|
1278
|
+
fallback?: string;
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Template source - discriminated union for PDF vs DOCX modes
|
|
1282
|
+
*/
|
|
1283
|
+
type TemplateSource = {
|
|
1284
|
+
type: "pdf";
|
|
1285
|
+
/** ID of the uploaded PDF file */
|
|
1286
|
+
fileId: string;
|
|
1287
|
+
/** Positioned fields on the PDF */
|
|
1288
|
+
fields: PdfTemplateField[];
|
|
1289
|
+
} | {
|
|
1290
|
+
type: "docx";
|
|
1291
|
+
/** ID of the uploaded DOCX file */
|
|
1292
|
+
fileId: string;
|
|
1293
|
+
/** Variables detected in the DOCX (e.g., {{firstName}}) */
|
|
1294
|
+
detectedVariables: string[];
|
|
1295
|
+
};
|
|
1296
|
+
/**
|
|
1297
|
+
* Document generation template
|
|
1298
|
+
*
|
|
1299
|
+
* Templates define how to generate PDF documents by injecting
|
|
1300
|
+
* workflow context data into a PDF template file.
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```typescript
|
|
1304
|
+
* const template: DocumentGenerationTemplate = {
|
|
1305
|
+
* id: "tmpl_123",
|
|
1306
|
+
* name: "sales-contract",
|
|
1307
|
+
* label: "Sales Contract",
|
|
1308
|
+
* source: {
|
|
1309
|
+
* type: "pdf",
|
|
1310
|
+
* fileId: "file_456",
|
|
1311
|
+
* fields: [
|
|
1312
|
+
* {
|
|
1313
|
+
* id: "f1",
|
|
1314
|
+
* page: 0,
|
|
1315
|
+
* x: 120, y: 340,
|
|
1316
|
+
* width: 150, height: 20,
|
|
1317
|
+
* contextPath: "slots.client.firstName",
|
|
1318
|
+
* label: "Client First Name"
|
|
1319
|
+
* }
|
|
1320
|
+
* ]
|
|
1321
|
+
* },
|
|
1322
|
+
* variableMappings: [],
|
|
1323
|
+
* createdAt: new Date(),
|
|
1324
|
+
* updatedAt: new Date()
|
|
1325
|
+
* };
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
interface DocumentGenerationTemplate {
|
|
1329
|
+
/** Unique identifier */
|
|
1330
|
+
id: string;
|
|
1331
|
+
/** Tenant ID (optional for system templates) */
|
|
1332
|
+
tenantId?: string;
|
|
1333
|
+
/** Unique name within tenant (kebab-case) */
|
|
1334
|
+
name: string;
|
|
1335
|
+
/** Display label */
|
|
1336
|
+
label: string;
|
|
1337
|
+
/** Optional description */
|
|
1338
|
+
description?: string;
|
|
1339
|
+
/** Template source (PDF) */
|
|
1340
|
+
source: TemplateSource;
|
|
1341
|
+
/** Variable mappings (for DOCX mode, deprecated) */
|
|
1342
|
+
variableMappings: VariableMapping[];
|
|
1343
|
+
/** Creation timestamp */
|
|
1344
|
+
createdAt: Date;
|
|
1345
|
+
/** Last update timestamp */
|
|
1346
|
+
updatedAt: Date;
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Input for creating a document generation template
|
|
1350
|
+
*/
|
|
1351
|
+
interface CreateDocumentGenerationTemplate {
|
|
1352
|
+
name: string;
|
|
1353
|
+
label: string;
|
|
1354
|
+
description?: string;
|
|
1355
|
+
source: TemplateSource;
|
|
1356
|
+
variableMappings?: VariableMapping[];
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1359
|
+
* Input for updating a document generation template
|
|
1360
|
+
*/
|
|
1361
|
+
interface UpdateDocumentGenerationTemplate {
|
|
1362
|
+
label?: string;
|
|
1363
|
+
description?: string;
|
|
1364
|
+
source?: TemplateSource;
|
|
1365
|
+
variableMappings?: VariableMapping[];
|
|
1366
|
+
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Pending document generation request in execution context.
|
|
1369
|
+
* The consumer (NestJS, Supabase) is responsible for fulfilling this request.
|
|
1370
|
+
*/
|
|
1371
|
+
interface PendingDocumentRequest {
|
|
1372
|
+
/** Unique request identifier (same as node ID) */
|
|
1373
|
+
id: string;
|
|
1374
|
+
/** Template ID to use for generation */
|
|
1375
|
+
templateId: string;
|
|
1376
|
+
/** Custom filename (supports variable interpolation) */
|
|
1377
|
+
filename?: string;
|
|
1378
|
+
/** Slot IDs of records to attach the generated document to */
|
|
1379
|
+
targetSlotIds?: string[];
|
|
1380
|
+
/** Request status */
|
|
1381
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
1382
|
+
/** Error message if failed */
|
|
1383
|
+
error?: string;
|
|
1384
|
+
/** Generated document URL (when completed) */
|
|
1385
|
+
url?: string;
|
|
1386
|
+
/** File size in bytes (when completed) */
|
|
1387
|
+
size?: number;
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Check if a template source is PDF type
|
|
1391
|
+
*/
|
|
1392
|
+
declare function isPdfTemplateSource(source: TemplateSource): source is Extract<TemplateSource, {
|
|
1393
|
+
type: "pdf";
|
|
1394
|
+
}>;
|
|
1395
|
+
/**
|
|
1396
|
+
* Check if a template source is DOCX type
|
|
1397
|
+
*/
|
|
1398
|
+
declare function isDocxTemplateSource(source: TemplateSource): source is Extract<TemplateSource, {
|
|
1399
|
+
type: "docx";
|
|
1400
|
+
}>;
|
|
1401
|
+
|
|
856
1402
|
/**
|
|
857
1403
|
* Timestamps for tracking creation and updates
|
|
858
1404
|
*/
|
|
@@ -1022,52 +1568,339 @@ declare const RESERVED_ATTRIBUTE_NAMES: readonly ["id", "createdAt", "updatedAt"
|
|
|
1022
1568
|
type ReservedAttributeName = (typeof RESERVED_ATTRIBUTE_NAMES)[number];
|
|
1023
1569
|
|
|
1024
1570
|
/**
|
|
1025
|
-
*
|
|
1571
|
+
* DocumentTemplate defines the structure and processing rules for a document type.
|
|
1572
|
+
*
|
|
1573
|
+
* Templates can be:
|
|
1574
|
+
* - System templates: Defined in code, available to all tenants (tenantId: null)
|
|
1575
|
+
* - Custom templates: Created by tenants for their specific needs
|
|
1576
|
+
*
|
|
1577
|
+
* @example
|
|
1578
|
+
* ```typescript
|
|
1579
|
+
* const FRENCH_ID_CARD: DocumentTemplate = {
|
|
1580
|
+
* name: "french_id_card",
|
|
1581
|
+
* label: "Carte d'identité française",
|
|
1582
|
+
* system: true,
|
|
1583
|
+
* slots: [
|
|
1584
|
+
* { name: "front", label: "Recto", required: true, order: 1 },
|
|
1585
|
+
* { name: "back", label: "Verso", required: true, order: 2 },
|
|
1586
|
+
* ],
|
|
1587
|
+
* autoProcessing: {
|
|
1588
|
+
* ocr: { enabled: true },
|
|
1589
|
+
* identityVerification: { enabled: true, documentType: "national_id" },
|
|
1590
|
+
* },
|
|
1591
|
+
* };
|
|
1592
|
+
* ```
|
|
1026
1593
|
*/
|
|
1027
|
-
|
|
1594
|
+
interface DocumentTemplate extends Timestamps {
|
|
1595
|
+
id: Uuid;
|
|
1596
|
+
/** null = system template available to all tenants */
|
|
1597
|
+
tenantId?: Uuid | null;
|
|
1598
|
+
/** Technical name (kebab-case, unique per tenant) */
|
|
1599
|
+
name: string;
|
|
1600
|
+
/** Display name */
|
|
1601
|
+
label: string;
|
|
1602
|
+
description?: string;
|
|
1603
|
+
icon?: IconName;
|
|
1604
|
+
/** Slot definitions for multi-file documents */
|
|
1605
|
+
slots: DocumentSlotDefinition[];
|
|
1606
|
+
/** Allow uploading additional files beyond defined slots */
|
|
1607
|
+
allowAdditionalFiles: boolean;
|
|
1608
|
+
/** Auto-processing configuration */
|
|
1609
|
+
autoProcessing?: DocumentAutoProcessing;
|
|
1610
|
+
/** Mapping for extracting data to record attributes */
|
|
1611
|
+
extractionMapping?: ExtractionMapping;
|
|
1612
|
+
/** System templates are defined in code and cannot be modified */
|
|
1613
|
+
system: boolean;
|
|
1614
|
+
}
|
|
1028
1615
|
/**
|
|
1029
|
-
*
|
|
1616
|
+
* Defines a file slot within a document template.
|
|
1617
|
+
*
|
|
1618
|
+
* @example ID card with front/back
|
|
1619
|
+
* ```typescript
|
|
1620
|
+
* slots: [
|
|
1621
|
+
* { name: "front", label: "Recto", required: true, order: 1 },
|
|
1622
|
+
* { name: "back", label: "Verso", required: true, order: 2 },
|
|
1623
|
+
* ]
|
|
1624
|
+
* ```
|
|
1030
1625
|
*/
|
|
1031
|
-
|
|
1626
|
+
interface DocumentSlotDefinition {
|
|
1627
|
+
/** Technical name (e.g., "front", "back", "main") */
|
|
1628
|
+
name: string;
|
|
1629
|
+
/** Display label */
|
|
1630
|
+
label: string;
|
|
1631
|
+
description?: string;
|
|
1632
|
+
/** Whether this slot must be filled */
|
|
1633
|
+
required: boolean;
|
|
1634
|
+
/** Allowed MIME types (e.g., ["image/jpeg", "application/pdf"]) */
|
|
1635
|
+
allowedMimeTypes?: MimeType[];
|
|
1636
|
+
/** Max file size in bytes */
|
|
1637
|
+
maxSize?: number;
|
|
1638
|
+
/** Display order */
|
|
1639
|
+
order: number;
|
|
1640
|
+
}
|
|
1032
1641
|
/**
|
|
1033
|
-
*
|
|
1642
|
+
* Auto-processing configuration for document templates.
|
|
1643
|
+
* Defines which processing jobs to run automatically on upload.
|
|
1644
|
+
*/
|
|
1645
|
+
interface DocumentAutoProcessing {
|
|
1646
|
+
ocr?: {
|
|
1647
|
+
enabled: boolean;
|
|
1648
|
+
provider?: string;
|
|
1649
|
+
languages?: string[];
|
|
1650
|
+
};
|
|
1651
|
+
identityVerification?: {
|
|
1652
|
+
enabled: boolean;
|
|
1653
|
+
provider?: string;
|
|
1654
|
+
documentType?: string;
|
|
1655
|
+
};
|
|
1656
|
+
signature?: {
|
|
1657
|
+
enabled: boolean;
|
|
1658
|
+
provider?: string;
|
|
1659
|
+
};
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Mapping configuration for extracting OCR data to record attributes.
|
|
1663
|
+
*/
|
|
1664
|
+
interface ExtractionMapping {
|
|
1665
|
+
fields: ExtractionField[];
|
|
1666
|
+
}
|
|
1667
|
+
interface ExtractionField {
|
|
1668
|
+
/** Source field path in OCR result */
|
|
1669
|
+
source: string;
|
|
1670
|
+
/** Target attribute name on the record */
|
|
1671
|
+
target: string;
|
|
1672
|
+
/** Optional transformation function name */
|
|
1673
|
+
transform?: string;
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* Document wraps one or more files with metadata, status, and processing results.
|
|
1034
1677
|
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
* - Manages file storage, permissions, and metadata
|
|
1038
|
-
* - uploadedBy links to user_profiles table
|
|
1039
|
-
* - Supports soft delete via deletedAt
|
|
1678
|
+
* Documents are linked to records via the record's `values` (document attribute).
|
|
1679
|
+
* Each document references a template that defines its structure.
|
|
1040
1680
|
*
|
|
1041
1681
|
* @example
|
|
1042
1682
|
* ```typescript
|
|
1043
|
-
* const
|
|
1044
|
-
* id: "
|
|
1683
|
+
* const document: Document = {
|
|
1684
|
+
* id: "doc-123",
|
|
1045
1685
|
* tenantId: "tenant-456",
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
* storageProvider: "s3",
|
|
1051
|
-
* storagePath: "tenants/456/files/2025/11/contract-2025.pdf",
|
|
1052
|
-
* storageBucket: "my-app-files",
|
|
1053
|
-
* url: "https://cdn.example.com/files/file-123",
|
|
1054
|
-
* uploadedBy: "profile-789",
|
|
1055
|
-
* folderPath: "/contracts/2025",
|
|
1056
|
-
* tags: ["contract", "legal"],
|
|
1057
|
-
* visibility: "restricted",
|
|
1058
|
-
* allowedUsers: ["profile-789", "profile-456"],
|
|
1059
|
-
* createdAt: new Date(),
|
|
1060
|
-
* updatedAt: new Date(),
|
|
1686
|
+
* templateId: "tpl-french-id",
|
|
1687
|
+
* status: "completed",
|
|
1688
|
+
* title: "CNI - Jean Dupont",
|
|
1689
|
+
* tags: ["identity", "verified"],
|
|
1061
1690
|
* };
|
|
1062
1691
|
* ```
|
|
1063
1692
|
*/
|
|
1064
|
-
interface
|
|
1693
|
+
interface Document extends Timestamps {
|
|
1065
1694
|
id: Uuid;
|
|
1066
1695
|
tenantId: Uuid;
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1696
|
+
templateId: Uuid;
|
|
1697
|
+
/** Current processing/lifecycle status */
|
|
1698
|
+
status: DocumentStatus;
|
|
1699
|
+
/** Display title */
|
|
1700
|
+
title: string;
|
|
1701
|
+
description?: string;
|
|
1702
|
+
/** Tags for categorization and search */
|
|
1703
|
+
tags: string[];
|
|
1704
|
+
/** Hash of all slot file contents for deduplication */
|
|
1705
|
+
contentHash?: string;
|
|
1706
|
+
/** PostgreSQL tsvector for full-text search */
|
|
1707
|
+
searchVector?: unknown;
|
|
1708
|
+
/** User who created this document */
|
|
1709
|
+
createdBy?: Uuid;
|
|
1710
|
+
/** User who last updated this document */
|
|
1711
|
+
updatedBy?: Uuid;
|
|
1712
|
+
/** Soft delete timestamp */
|
|
1713
|
+
deletedAt?: Date | null;
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Document lifecycle status.
|
|
1717
|
+
*
|
|
1718
|
+
* - `draft`: Missing required slots, incomplete
|
|
1719
|
+
* - `pending`: All slots uploaded, awaiting processing
|
|
1720
|
+
* - `processing`: One or more jobs running
|
|
1721
|
+
* - `completed`: All jobs completed successfully
|
|
1722
|
+
* - `failed`: At least one job failed
|
|
1723
|
+
* - `signed`: Signature workflow completed
|
|
1724
|
+
*/
|
|
1725
|
+
type DocumentStatus = "draft" | "pending" | "processing" | "completed" | "failed" | "signed";
|
|
1726
|
+
/**
|
|
1727
|
+
* DocumentSlot represents a single file within a document.
|
|
1728
|
+
*
|
|
1729
|
+
* Each slot corresponds to a slot definition in the template,
|
|
1730
|
+
* or is marked as "additional" for extra files.
|
|
1731
|
+
*/
|
|
1732
|
+
interface DocumentSlot extends Timestamps {
|
|
1733
|
+
id: Uuid;
|
|
1734
|
+
documentId: Uuid;
|
|
1735
|
+
/** Slot name from template definition */
|
|
1736
|
+
slotName: string;
|
|
1737
|
+
/** True if this is an additional file beyond template slots */
|
|
1738
|
+
isAdditional: boolean;
|
|
1739
|
+
/** Reference to the uploaded file */
|
|
1740
|
+
fileId: Uuid;
|
|
1741
|
+
/** Processing status for this slot */
|
|
1742
|
+
status: SlotStatus;
|
|
1743
|
+
/** Extracted text from OCR */
|
|
1744
|
+
ocrText?: string;
|
|
1745
|
+
/** OCR confidence score (0-1) */
|
|
1746
|
+
ocrConfidence?: number;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Slot processing status.
|
|
1750
|
+
*/
|
|
1751
|
+
type SlotStatus = "uploaded" | "processing" | "completed" | "failed";
|
|
1752
|
+
/**
|
|
1753
|
+
* ProcessingJob tracks an async processing task for a document.
|
|
1754
|
+
*
|
|
1755
|
+
* Jobs are created for OCR, identity verification, or signature requests.
|
|
1756
|
+
* They can be document-level or slot-level.
|
|
1757
|
+
*/
|
|
1758
|
+
interface ProcessingJob extends Timestamps {
|
|
1759
|
+
id: Uuid;
|
|
1760
|
+
tenantId: Uuid;
|
|
1761
|
+
documentId: Uuid;
|
|
1762
|
+
/** Slot name if job is slot-specific, null for document-level jobs */
|
|
1763
|
+
slotName?: string | null;
|
|
1764
|
+
/** Job type */
|
|
1765
|
+
type: ProcessingJobType;
|
|
1766
|
+
/** Provider used (e.g., "google-vision", "yousign") */
|
|
1767
|
+
provider: string;
|
|
1768
|
+
/** Current job status */
|
|
1769
|
+
status: ProcessingJobStatus;
|
|
1770
|
+
/** Provider-specific input data */
|
|
1771
|
+
input?: Record<string, unknown>;
|
|
1772
|
+
/** Provider response data */
|
|
1773
|
+
result?: Record<string, unknown>;
|
|
1774
|
+
/** Error message if failed */
|
|
1775
|
+
error?: string;
|
|
1776
|
+
/** When processing started */
|
|
1777
|
+
startedAt?: Date | null;
|
|
1778
|
+
/** When processing completed */
|
|
1779
|
+
completedAt?: Date | null;
|
|
1780
|
+
/** Expiration time (for signature requests) */
|
|
1781
|
+
expiresAt?: Date | null;
|
|
1782
|
+
/** User who initiated the job */
|
|
1783
|
+
createdBy?: Uuid;
|
|
1784
|
+
}
|
|
1785
|
+
type ProcessingJobType = "ocr" | "identity_verification" | "signature";
|
|
1786
|
+
type ProcessingJobStatus = "pending" | "processing" | "completed" | "failed" | "cancelled";
|
|
1787
|
+
interface CreateDocument {
|
|
1788
|
+
templateId: Uuid;
|
|
1789
|
+
title: string;
|
|
1790
|
+
description?: string;
|
|
1791
|
+
tags?: string[];
|
|
1792
|
+
}
|
|
1793
|
+
interface UpdateDocument {
|
|
1794
|
+
title?: string;
|
|
1795
|
+
description?: string;
|
|
1796
|
+
tags?: string[];
|
|
1797
|
+
status?: DocumentStatus;
|
|
1798
|
+
}
|
|
1799
|
+
interface CreateDocumentTemplate {
|
|
1800
|
+
name: string;
|
|
1801
|
+
label: string;
|
|
1802
|
+
description?: string;
|
|
1803
|
+
icon?: IconName;
|
|
1804
|
+
slots: DocumentSlotDefinition[];
|
|
1805
|
+
allowAdditionalFiles?: boolean;
|
|
1806
|
+
autoProcessing?: DocumentAutoProcessing;
|
|
1807
|
+
extractionMapping?: ExtractionMapping;
|
|
1808
|
+
}
|
|
1809
|
+
interface UpdateDocumentTemplate {
|
|
1810
|
+
label?: string;
|
|
1811
|
+
description?: string;
|
|
1812
|
+
icon?: IconName;
|
|
1813
|
+
slots?: DocumentSlotDefinition[];
|
|
1814
|
+
allowAdditionalFiles?: boolean;
|
|
1815
|
+
autoProcessing?: DocumentAutoProcessing;
|
|
1816
|
+
extractionMapping?: ExtractionMapping;
|
|
1817
|
+
}
|
|
1818
|
+
interface CreateDocumentSlot {
|
|
1819
|
+
documentId: Uuid;
|
|
1820
|
+
slotName: string;
|
|
1821
|
+
fileId: Uuid;
|
|
1822
|
+
isAdditional?: boolean;
|
|
1823
|
+
}
|
|
1824
|
+
interface UpdateDocumentSlot {
|
|
1825
|
+
status?: SlotStatus;
|
|
1826
|
+
ocrText?: string;
|
|
1827
|
+
ocrConfidence?: number;
|
|
1828
|
+
}
|
|
1829
|
+
interface CreateProcessingJob {
|
|
1830
|
+
documentId: Uuid;
|
|
1831
|
+
slotName?: string;
|
|
1832
|
+
type: ProcessingJobType;
|
|
1833
|
+
provider: string;
|
|
1834
|
+
input?: Record<string, unknown>;
|
|
1835
|
+
expiresAt?: Date;
|
|
1836
|
+
}
|
|
1837
|
+
interface UpdateProcessingJob {
|
|
1838
|
+
status?: ProcessingJobStatus;
|
|
1839
|
+
result?: Record<string, unknown>;
|
|
1840
|
+
error?: string;
|
|
1841
|
+
startedAt?: Date;
|
|
1842
|
+
completedAt?: Date;
|
|
1843
|
+
}
|
|
1844
|
+
interface DocumentListOptions {
|
|
1845
|
+
limit?: number;
|
|
1846
|
+
offset?: number;
|
|
1847
|
+
templateId?: Uuid;
|
|
1848
|
+
status?: DocumentStatus;
|
|
1849
|
+
tags?: string[];
|
|
1850
|
+
}
|
|
1851
|
+
interface DocumentTemplateListOptions {
|
|
1852
|
+
systemOnly?: boolean;
|
|
1853
|
+
limit?: number;
|
|
1854
|
+
offset?: number;
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/**
|
|
1858
|
+
* Storage provider type
|
|
1859
|
+
*/
|
|
1860
|
+
type StorageProvider = "s3" | "gcs" | "azure" | "local" | "cloudflare-r2" | string;
|
|
1861
|
+
/**
|
|
1862
|
+
* File visibility level
|
|
1863
|
+
*/
|
|
1864
|
+
type FileVisibility = "public" | "private" | "restricted";
|
|
1865
|
+
/**
|
|
1866
|
+
* File - Represents uploaded file metadata and storage info
|
|
1867
|
+
*
|
|
1868
|
+
* ARCHITECTURE:
|
|
1869
|
+
* - Fixed table (no custom attributes)
|
|
1870
|
+
* - Manages file storage, permissions, and metadata
|
|
1871
|
+
* - uploadedBy links to user_profiles table
|
|
1872
|
+
* - Supports soft delete via deletedAt
|
|
1873
|
+
*
|
|
1874
|
+
* @example
|
|
1875
|
+
* ```typescript
|
|
1876
|
+
* const file: File = {
|
|
1877
|
+
* id: "file-123",
|
|
1878
|
+
* tenantId: "tenant-456",
|
|
1879
|
+
* name: "contract-2025.pdf",
|
|
1880
|
+
* originalName: "Contract Acme Corp 2025.pdf",
|
|
1881
|
+
* mimeType: "application/pdf",
|
|
1882
|
+
* size: 2458624,
|
|
1883
|
+
* storageProvider: "s3",
|
|
1884
|
+
* storagePath: "tenants/456/files/2025/11/contract-2025.pdf",
|
|
1885
|
+
* storageBucket: "my-app-files",
|
|
1886
|
+
* url: "https://cdn.example.com/files/file-123",
|
|
1887
|
+
* uploadedBy: "profile-789",
|
|
1888
|
+
* folderPath: "/contracts/2025",
|
|
1889
|
+
* tags: ["contract", "legal"],
|
|
1890
|
+
* visibility: "restricted",
|
|
1891
|
+
* allowedUsers: ["profile-789", "profile-456"],
|
|
1892
|
+
* createdAt: new Date(),
|
|
1893
|
+
* updatedAt: new Date(),
|
|
1894
|
+
* };
|
|
1895
|
+
* ```
|
|
1896
|
+
*/
|
|
1897
|
+
interface File extends Timestamps {
|
|
1898
|
+
id: Uuid;
|
|
1899
|
+
tenantId: Uuid;
|
|
1900
|
+
/**
|
|
1901
|
+
* File name (sanitized for storage)
|
|
1902
|
+
*/
|
|
1903
|
+
name: string;
|
|
1071
1904
|
/**
|
|
1072
1905
|
* Original file name (as uploaded by user)
|
|
1073
1906
|
*/
|
|
@@ -1576,6 +2409,8 @@ type AttributeValueMap = {
|
|
|
1576
2409
|
user: string;
|
|
1577
2410
|
relation: string;
|
|
1578
2411
|
rating: number;
|
|
2412
|
+
/** Document ID(s) - string if single, string[] if multiple */
|
|
2413
|
+
document: string | string[];
|
|
1579
2414
|
};
|
|
1580
2415
|
/**
|
|
1581
2416
|
* Infer status value from options (union of option values)
|
|
@@ -2094,7 +2929,7 @@ interface AssignRoleInput {
|
|
|
2094
2929
|
* Document generated during workflow execution
|
|
2095
2930
|
*/
|
|
2096
2931
|
interface GeneratedDocument {
|
|
2097
|
-
/** Document ID */
|
|
2932
|
+
/** Document ID (file ID) */
|
|
2098
2933
|
id: string;
|
|
2099
2934
|
/** URL to access the document */
|
|
2100
2935
|
url: string;
|
|
@@ -2106,6 +2941,8 @@ interface GeneratedDocument {
|
|
|
2106
2941
|
size?: number;
|
|
2107
2942
|
/** Additional metadata */
|
|
2108
2943
|
metadata?: Record<string, unknown>;
|
|
2944
|
+
/** IDs of Document records created (one per target slot) */
|
|
2945
|
+
attachedDocumentIds?: string[];
|
|
2109
2946
|
}
|
|
2110
2947
|
/**
|
|
2111
2948
|
* Accumulated context during workflow execution.
|
|
@@ -2453,6 +3290,44 @@ interface ConditionNode extends BaseNode {
|
|
|
2453
3290
|
/** ID of node to execute if condition is false (optional for drafts) */
|
|
2454
3291
|
onFalse?: string | null;
|
|
2455
3292
|
}
|
|
3293
|
+
/**
|
|
3294
|
+
* Document generation node.
|
|
3295
|
+
* Generates a PDF document by injecting workflow data into a template.
|
|
3296
|
+
*
|
|
3297
|
+
* The actual generation is delegated to the consumer (NestJS, Supabase).
|
|
3298
|
+
* The executor creates a pending document request in the context.
|
|
3299
|
+
*
|
|
3300
|
+
* @example
|
|
3301
|
+
* ```typescript
|
|
3302
|
+
* const node: DocumentNode = {
|
|
3303
|
+
* type: "document",
|
|
3304
|
+
* id: "generate-contract",
|
|
3305
|
+
* label: "Generate Contract",
|
|
3306
|
+
* templateId: "tmpl_sales-contract",
|
|
3307
|
+
* outputFormat: "pdf",
|
|
3308
|
+
* filename: "contract_{{slots.client.lastName}}.pdf",
|
|
3309
|
+
* targetSlotIds: ["client", "vendor"],
|
|
3310
|
+
* next: "send-email"
|
|
3311
|
+
* };
|
|
3312
|
+
* ```
|
|
3313
|
+
*/
|
|
3314
|
+
interface DocumentNode extends BaseNode {
|
|
3315
|
+
type: "document";
|
|
3316
|
+
/** Display label for the node */
|
|
3317
|
+
label: string;
|
|
3318
|
+
/** Optional description */
|
|
3319
|
+
description?: string;
|
|
3320
|
+
/** ID of the DocumentGenerationTemplate to use */
|
|
3321
|
+
templateId: string;
|
|
3322
|
+
/** Output format for generated document */
|
|
3323
|
+
outputFormat: "pdf" | "docx";
|
|
3324
|
+
/** Custom filename (supports variable interpolation like {{slots.client.lastName}}) */
|
|
3325
|
+
filename?: string;
|
|
3326
|
+
/** ID of the next node to execute */
|
|
3327
|
+
next?: string | null;
|
|
3328
|
+
/** Slot IDs of records to attach the generated document to */
|
|
3329
|
+
targetSlotIds?: string[];
|
|
3330
|
+
}
|
|
2456
3331
|
/**
|
|
2457
3332
|
* Terminal node marking the end of a workflow path.
|
|
2458
3333
|
* A workflow can have multiple EndNodes for different outcomes.
|
|
@@ -2488,7 +3363,7 @@ interface EndNode extends BaseNode {
|
|
|
2488
3363
|
* Union of all workflow node types.
|
|
2489
3364
|
* Use discriminated union on `type` field for type narrowing.
|
|
2490
3365
|
*/
|
|
2491
|
-
type WorkflowNode = StartNode | FormNode | ConditionNode | EndNode;
|
|
3366
|
+
type WorkflowNode = StartNode | FormNode | ConditionNode | DocumentNode | EndNode;
|
|
2492
3367
|
/**
|
|
2493
3368
|
* All possible node types
|
|
2494
3369
|
*/
|
|
@@ -2505,6 +3380,10 @@ declare function isFormNode(node: WorkflowNode): node is FormNode;
|
|
|
2505
3380
|
* Check if a node is a ConditionNode
|
|
2506
3381
|
*/
|
|
2507
3382
|
declare function isConditionNode(node: WorkflowNode): node is ConditionNode;
|
|
3383
|
+
/**
|
|
3384
|
+
* Check if a node is a DocumentNode
|
|
3385
|
+
*/
|
|
3386
|
+
declare function isDocumentNode(node: WorkflowNode): node is DocumentNode;
|
|
2508
3387
|
/**
|
|
2509
3388
|
* Check if a node is an EndNode
|
|
2510
3389
|
*/
|
|
@@ -2667,70 +3546,6 @@ interface WorkflowLayout {
|
|
|
2667
3546
|
/** Canvas viewport state */
|
|
2668
3547
|
viewport?: CanvasViewport;
|
|
2669
3548
|
}
|
|
2670
|
-
/**
|
|
2671
|
-
* Authentication method for external participants
|
|
2672
|
-
*/
|
|
2673
|
-
type AuthMethod = "signed_link" | "pin_code";
|
|
2674
|
-
/**
|
|
2675
|
-
* Channel for sending authentication credentials
|
|
2676
|
-
*/
|
|
2677
|
-
type AuthChannel = "email" | "sms";
|
|
2678
|
-
/**
|
|
2679
|
-
* Default authentication configuration for a participant
|
|
2680
|
-
*/
|
|
2681
|
-
interface ParticipantAuthConfig {
|
|
2682
|
-
/** Authentication method */
|
|
2683
|
-
method: AuthMethod;
|
|
2684
|
-
/** Link/code expiration (e.g., "7d", "24h") */
|
|
2685
|
-
expiresIn?: string;
|
|
2686
|
-
/** Channel for sending credentials */
|
|
2687
|
-
channel?: AuthChannel;
|
|
2688
|
-
}
|
|
2689
|
-
/**
|
|
2690
|
-
* Template for a participant in the workflow.
|
|
2691
|
-
* Defines who can participate and how they authenticate.
|
|
2692
|
-
*
|
|
2693
|
-
* Note: This is a template defined in WorkflowDefinition.
|
|
2694
|
-
* At runtime, WorkflowParticipation instances are created from this.
|
|
2695
|
-
*
|
|
2696
|
-
* @example
|
|
2697
|
-
* ```typescript
|
|
2698
|
-
* const externalClient: ParticipantTemplate = {
|
|
2699
|
-
* id: "external-client",
|
|
2700
|
-
* label: "Client Externe",
|
|
2701
|
-
* type: "external",
|
|
2702
|
-
* emailSource: "slots.client.email",
|
|
2703
|
-
* defaultAuth: {
|
|
2704
|
-
* method: "signed_link",
|
|
2705
|
-
* expiresIn: "7d",
|
|
2706
|
-
* channel: "email"
|
|
2707
|
-
* },
|
|
2708
|
-
* allowedNodeIds: ["client-form", "signature-step"]
|
|
2709
|
-
* };
|
|
2710
|
-
* ```
|
|
2711
|
-
*/
|
|
2712
|
-
interface ParticipantTemplate {
|
|
2713
|
-
/** Unique identifier */
|
|
2714
|
-
id: string;
|
|
2715
|
-
/** Display label */
|
|
2716
|
-
label: string;
|
|
2717
|
-
/** Type of participant */
|
|
2718
|
-
type: "internal" | "external";
|
|
2719
|
-
/**
|
|
2720
|
-
* Path to email in execution context (for external participants).
|
|
2721
|
-
* Supports dot notation: "slots.client.email"
|
|
2722
|
-
*/
|
|
2723
|
-
emailSource?: string;
|
|
2724
|
-
/**
|
|
2725
|
-
* Path to phone in execution context (for SMS auth).
|
|
2726
|
-
* Supports dot notation: "slots.client.phone"
|
|
2727
|
-
*/
|
|
2728
|
-
phoneSource?: string;
|
|
2729
|
-
/** Default authentication configuration */
|
|
2730
|
-
defaultAuth: ParticipantAuthConfig;
|
|
2731
|
-
/** IDs of nodes this participant can execute */
|
|
2732
|
-
allowedNodeIds: string[];
|
|
2733
|
-
}
|
|
2734
3549
|
/**
|
|
2735
3550
|
* Global configuration options for a workflow
|
|
2736
3551
|
*/
|
|
@@ -2765,8 +3580,7 @@ type WorkflowStatus = "draft" | "published" | "archived";
|
|
|
2765
3580
|
* "form-1": { type: "form", id: "form-1", label: "Info", slotId: "client", fields: ["name"], next: "end" },
|
|
2766
3581
|
* "end": { type: "end", id: "end" }
|
|
2767
3582
|
* },
|
|
2768
|
-
* startNodeId: "start"
|
|
2769
|
-
* layout: { positions: { "start": { x: 0, y: 0 }, "form-1": { x: 200, y: 0 }, "end": { x: 400, y: 0 } } }
|
|
3583
|
+
* startNodeId: "start"
|
|
2770
3584
|
* };
|
|
2771
3585
|
* ```
|
|
2772
3586
|
*/
|
|
@@ -2791,10 +3605,8 @@ interface WorkflowDefinition {
|
|
|
2791
3605
|
nodes: Record<string, WorkflowNode>;
|
|
2792
3606
|
/** ID of the start node */
|
|
2793
3607
|
startNodeId: string;
|
|
2794
|
-
/** Layout information for the visual builder */
|
|
2795
|
-
layout
|
|
2796
|
-
/** Participant templates (for external users) */
|
|
2797
|
-
participants?: ParticipantTemplate[];
|
|
3608
|
+
/** Layout information for the visual builder (optional, used by legacy canvas) */
|
|
3609
|
+
layout?: WorkflowLayout;
|
|
2798
3610
|
/** Theming for external-facing interface */
|
|
2799
3611
|
theme?: WorkflowTheme;
|
|
2800
3612
|
/** Global configuration options */
|
|
@@ -3005,7 +3817,7 @@ interface Group {
|
|
|
3005
3817
|
collapsed?: boolean;
|
|
3006
3818
|
order?: number;
|
|
3007
3819
|
}
|
|
3008
|
-
type TabType = "form" | "table" | "custom" | "activity" | "notes" | "flows";
|
|
3820
|
+
type TabType = "form" | "table" | "custom" | "activity" | "notes" | "flows" | "documents";
|
|
3009
3821
|
/**
|
|
3010
3822
|
* Base properties shared by all tab types
|
|
3011
3823
|
*/
|
|
@@ -3160,10 +3972,45 @@ interface FlowsTab extends BaseTab {
|
|
|
3160
3972
|
/** Columns to display in the instances table */
|
|
3161
3973
|
columns?: ("workflow" | "status" | "startedBy" | "createdAt" | "updatedAt")[];
|
|
3162
3974
|
}
|
|
3975
|
+
/**
|
|
3976
|
+
* Documents tab - displays all documents attached to the record
|
|
3977
|
+
*
|
|
3978
|
+
* Shows documents from:
|
|
3979
|
+
* - Document attributes defined on the object
|
|
3980
|
+
* - System `attachments` attribute (free-form documents)
|
|
3981
|
+
*
|
|
3982
|
+
* Allows uploading new documents either to a specific attribute or as attachments.
|
|
3983
|
+
*
|
|
3984
|
+
* @example
|
|
3985
|
+
* ```typescript
|
|
3986
|
+
* {
|
|
3987
|
+
* type: "documents",
|
|
3988
|
+
* id: "documents",
|
|
3989
|
+
* name: "documents",
|
|
3990
|
+
* label: "Documents",
|
|
3991
|
+
* allowUpload: true,
|
|
3992
|
+
* allowRemove: true,
|
|
3993
|
+
* showProcessing: true
|
|
3994
|
+
* }
|
|
3995
|
+
* ```
|
|
3996
|
+
*/
|
|
3997
|
+
interface DocumentsTab extends BaseTab {
|
|
3998
|
+
type: "documents";
|
|
3999
|
+
/** Allow uploading new documents (default: true) */
|
|
4000
|
+
allowUpload?: boolean;
|
|
4001
|
+
/** Allow removing documents (default: true) */
|
|
4002
|
+
allowRemove?: boolean;
|
|
4003
|
+
/** Show processing actions (OCR, verify, sign) (default: true) */
|
|
4004
|
+
showProcessing?: boolean;
|
|
4005
|
+
/** Highlight empty required document attributes (default: true) */
|
|
4006
|
+
showRequiredWarnings?: boolean;
|
|
4007
|
+
/** Hide system attachments section (default: false) */
|
|
4008
|
+
hideAttachments?: boolean;
|
|
4009
|
+
}
|
|
3163
4010
|
/**
|
|
3164
4011
|
* Union of all tab types
|
|
3165
4012
|
*/
|
|
3166
|
-
type Tab = FormTab | TableTab | CustomTab | ActivityTab | NotesTab | FlowsTab;
|
|
4013
|
+
type Tab = FormTab | TableTab | CustomTab | ActivityTab | NotesTab | FlowsTab | DocumentsTab;
|
|
3167
4014
|
/**
|
|
3168
4015
|
* View layout mode
|
|
3169
4016
|
* - `page`: Full view with multiple tabs (form, table, activity, notes, custom)
|
|
@@ -3249,125 +4096,173 @@ declare function isNotesTab(tab: Tab): tab is NotesTab;
|
|
|
3249
4096
|
* Check if a tab is a flows tab
|
|
3250
4097
|
*/
|
|
3251
4098
|
declare function isFlowsTab(tab: Tab): tab is FlowsTab;
|
|
4099
|
+
/**
|
|
4100
|
+
* Check if a tab is a documents tab
|
|
4101
|
+
*/
|
|
4102
|
+
declare function isDocumentsTab(tab: Tab): tab is DocumentsTab;
|
|
3252
4103
|
|
|
3253
4104
|
/**
|
|
3254
|
-
* Status of a workflow
|
|
4105
|
+
* Status of a workflow invitation
|
|
3255
4106
|
*/
|
|
3256
|
-
type
|
|
4107
|
+
type InvitationStatus = "pending" | "accepted" | "expired" | "revoked";
|
|
3257
4108
|
/**
|
|
3258
|
-
*
|
|
4109
|
+
* Represents an invitation to access a workflow instance.
|
|
4110
|
+
*
|
|
4111
|
+
* When an admin wants to share a workflow with an external user,
|
|
4112
|
+
* they create an invitation. The invitation generates a magic link
|
|
4113
|
+
* that the user clicks to get an access grant.
|
|
4114
|
+
*
|
|
4115
|
+
* @example
|
|
4116
|
+
* ```typescript
|
|
4117
|
+
* const invitation: WorkflowInvitation = {
|
|
4118
|
+
* id: "inv_123",
|
|
4119
|
+
* instanceId: "inst_456",
|
|
4120
|
+
* recipientEmail: "client@example.com",
|
|
4121
|
+
* recipientName: "John Doe",
|
|
4122
|
+
* status: "pending",
|
|
4123
|
+
* createdBy: "user_789",
|
|
4124
|
+
* createdAt: new Date(),
|
|
4125
|
+
* expiresAt: new Date("2024-02-15")
|
|
4126
|
+
* };
|
|
4127
|
+
* ```
|
|
3259
4128
|
*/
|
|
3260
|
-
interface
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
4129
|
+
interface WorkflowInvitation {
|
|
4130
|
+
/** Unique invitation ID */
|
|
4131
|
+
id: Uuid;
|
|
4132
|
+
/** ID of the workflow instance */
|
|
4133
|
+
instanceId: Uuid;
|
|
4134
|
+
/** Recipient's email */
|
|
4135
|
+
recipientEmail: string;
|
|
4136
|
+
/** Recipient's display name */
|
|
4137
|
+
recipientName?: string;
|
|
4138
|
+
/** Current invitation status */
|
|
4139
|
+
status: InvitationStatus;
|
|
4140
|
+
/** ID of the user who created the invitation */
|
|
4141
|
+
createdBy: string;
|
|
4142
|
+
/** When the invitation was created */
|
|
4143
|
+
createdAt: Date;
|
|
4144
|
+
/** When the invitation was accepted */
|
|
4145
|
+
acceptedAt?: Date;
|
|
4146
|
+
/** When the invitation expires */
|
|
3265
4147
|
expiresAt: Date;
|
|
3266
|
-
/** Whether the link has been used */
|
|
3267
|
-
used: boolean;
|
|
3268
|
-
/** IP address that used the link (for audit) */
|
|
3269
|
-
usedFromIp?: string;
|
|
3270
4148
|
}
|
|
3271
4149
|
/**
|
|
3272
|
-
*
|
|
4150
|
+
* Input for creating a workflow invitation
|
|
3273
4151
|
*/
|
|
3274
|
-
interface
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
4152
|
+
interface CreateInvitationInput {
|
|
4153
|
+
/** Workflow instance ID */
|
|
4154
|
+
instanceId: string;
|
|
4155
|
+
/** Recipient email */
|
|
4156
|
+
recipientEmail: string;
|
|
4157
|
+
/** Recipient name (optional) */
|
|
4158
|
+
recipientName?: string;
|
|
4159
|
+
/** Expiration in days (default: 7) */
|
|
4160
|
+
expiresInDays?: number;
|
|
4161
|
+
/** Whether to send notification email */
|
|
4162
|
+
sendEmail?: boolean;
|
|
4163
|
+
}
|
|
4164
|
+
/**
|
|
4165
|
+
* Result of creating a workflow invitation
|
|
4166
|
+
*/
|
|
4167
|
+
interface CreateInvitationResult {
|
|
4168
|
+
/** The created invitation */
|
|
4169
|
+
invitation: WorkflowInvitation;
|
|
4170
|
+
/** Full magic link URL to access the workflow */
|
|
4171
|
+
magicLink: string;
|
|
3288
4172
|
}
|
|
3289
4173
|
/**
|
|
3290
|
-
*
|
|
4174
|
+
* Check if invitation is still valid (not expired, not revoked)
|
|
4175
|
+
*/
|
|
4176
|
+
declare function isInvitationValid(invitation: WorkflowInvitation): boolean;
|
|
4177
|
+
/**
|
|
4178
|
+
* Check if invitation has been accepted
|
|
3291
4179
|
*/
|
|
3292
|
-
|
|
4180
|
+
declare function isInvitationAccepted(invitation: WorkflowInvitation): boolean;
|
|
3293
4181
|
/**
|
|
3294
|
-
*
|
|
4182
|
+
* Check if invitation has expired
|
|
4183
|
+
*/
|
|
4184
|
+
declare function isInvitationExpired(invitation: WorkflowInvitation): boolean;
|
|
4185
|
+
|
|
4186
|
+
/**
|
|
4187
|
+
* Represents an access grant to a workflow instance.
|
|
4188
|
+
*
|
|
4189
|
+
* A grant is created after a user successfully authenticates via magic link.
|
|
4190
|
+
* It allows them to access the workflow forms with JWT access tokens.
|
|
3295
4191
|
*
|
|
3296
|
-
*
|
|
3297
|
-
*
|
|
4192
|
+
* The grant can be revoked entirely (revokedAt) or individual tokens
|
|
4193
|
+
* can be revoked via the revokedTokenJtis array.
|
|
3298
4194
|
*
|
|
3299
4195
|
* @example
|
|
3300
4196
|
* ```typescript
|
|
3301
|
-
* const
|
|
3302
|
-
* id: "
|
|
3303
|
-
*
|
|
3304
|
-
*
|
|
3305
|
-
*
|
|
3306
|
-
*
|
|
3307
|
-
*
|
|
3308
|
-
*
|
|
3309
|
-
* type: "signed_link",
|
|
3310
|
-
* token: "eyJ...",
|
|
3311
|
-
* expiresAt: new Date("2024-01-15"),
|
|
3312
|
-
* used: false
|
|
3313
|
-
* },
|
|
3314
|
-
* allowedNodeIds: ["client-form", "signature-step"],
|
|
3315
|
-
* status: "pending",
|
|
4197
|
+
* const grant: WorkflowAccessGrant = {
|
|
4198
|
+
* id: "grant_123",
|
|
4199
|
+
* invitationId: "inv_456",
|
|
4200
|
+
* instanceId: "inst_789",
|
|
4201
|
+
* grantedTo: "client@example.com",
|
|
4202
|
+
* scope: ["*"],
|
|
4203
|
+
* revokedTokenJtis: [],
|
|
4204
|
+
* validUntil: new Date("2024-03-15"),
|
|
3316
4205
|
* createdAt: new Date()
|
|
3317
4206
|
* };
|
|
3318
4207
|
* ```
|
|
3319
4208
|
*/
|
|
3320
|
-
interface
|
|
3321
|
-
/** Unique
|
|
4209
|
+
interface WorkflowAccessGrant {
|
|
4210
|
+
/** Unique grant ID */
|
|
3322
4211
|
id: Uuid;
|
|
4212
|
+
/** ID of the invitation that created this grant */
|
|
4213
|
+
invitationId: Uuid;
|
|
3323
4214
|
/** ID of the workflow instance */
|
|
3324
4215
|
instanceId: Uuid;
|
|
3325
|
-
/**
|
|
3326
|
-
|
|
3327
|
-
/**
|
|
3328
|
-
|
|
3329
|
-
/**
|
|
3330
|
-
|
|
3331
|
-
/**
|
|
3332
|
-
|
|
3333
|
-
/**
|
|
3334
|
-
|
|
3335
|
-
/**
|
|
3336
|
-
auth: ParticipationAuth;
|
|
3337
|
-
/** IDs of nodes this participant can execute */
|
|
3338
|
-
allowedNodeIds: string[];
|
|
3339
|
-
/** Current participation status */
|
|
3340
|
-
status: ParticipationStatus;
|
|
3341
|
-
/** When the participant authenticated */
|
|
3342
|
-
authenticatedAt?: Date;
|
|
3343
|
-
/** Last activity timestamp */
|
|
3344
|
-
lastActivityAt?: Date;
|
|
3345
|
-
/** Completed node IDs */
|
|
3346
|
-
completedNodeIds: string[];
|
|
3347
|
-
/** Timestamps */
|
|
4216
|
+
/** Email of the user who has access */
|
|
4217
|
+
grantedTo: string;
|
|
4218
|
+
/** Scope of access: ["*"] for full access, or ["node:xyz"] for specific nodes */
|
|
4219
|
+
scope: string[];
|
|
4220
|
+
/** Array of JWT IDs (jti) that have been revoked */
|
|
4221
|
+
revokedTokenJtis: string[];
|
|
4222
|
+
/** When the entire grant was revoked (null if active) */
|
|
4223
|
+
revokedAt?: Date;
|
|
4224
|
+
/** When this grant expires */
|
|
4225
|
+
validUntil: Date;
|
|
4226
|
+
/** When the grant was created */
|
|
3348
4227
|
createdAt: Date;
|
|
3349
|
-
|
|
4228
|
+
/** Last time the grant was used */
|
|
4229
|
+
lastUsedAt?: Date;
|
|
4230
|
+
}
|
|
4231
|
+
/**
|
|
4232
|
+
* Input for creating an access grant
|
|
4233
|
+
*/
|
|
4234
|
+
interface CreateGrantInput {
|
|
4235
|
+
/** Invitation ID that originated this grant */
|
|
4236
|
+
invitationId: string;
|
|
4237
|
+
/** Instance ID to grant access to */
|
|
4238
|
+
instanceId: string;
|
|
4239
|
+
/** Email of the user getting access */
|
|
4240
|
+
grantedTo: string;
|
|
4241
|
+
/** Scope of access (default: ["*"]) */
|
|
4242
|
+
scope?: string[];
|
|
4243
|
+
/** Validity in days (default: 30) */
|
|
4244
|
+
validDays?: number;
|
|
3350
4245
|
}
|
|
3351
4246
|
/**
|
|
3352
|
-
* Check if
|
|
4247
|
+
* Check if grant is still valid (not revoked, not expired)
|
|
3353
4248
|
*/
|
|
3354
|
-
declare function
|
|
4249
|
+
declare function isGrantValid(grant: WorkflowAccessGrant): boolean;
|
|
3355
4250
|
/**
|
|
3356
|
-
* Check if
|
|
4251
|
+
* Check if grant has been revoked
|
|
3357
4252
|
*/
|
|
3358
|
-
declare function
|
|
4253
|
+
declare function isGrantRevoked(grant: WorkflowAccessGrant): boolean;
|
|
3359
4254
|
/**
|
|
3360
|
-
* Check if
|
|
4255
|
+
* Check if a specific token has been revoked
|
|
3361
4256
|
*/
|
|
3362
|
-
declare function
|
|
4257
|
+
declare function isTokenRevoked(grant: WorkflowAccessGrant, jti: string): boolean;
|
|
3363
4258
|
/**
|
|
3364
|
-
* Check if
|
|
4259
|
+
* Check if grant has expired
|
|
3365
4260
|
*/
|
|
3366
|
-
declare function
|
|
4261
|
+
declare function isGrantExpired(grant: WorkflowAccessGrant): boolean;
|
|
3367
4262
|
/**
|
|
3368
|
-
* Check if
|
|
4263
|
+
* Check if scope allows access to a specific node
|
|
3369
4264
|
*/
|
|
3370
|
-
declare function
|
|
4265
|
+
declare function canAccessNode(grant: WorkflowAccessGrant, nodeId: string): boolean;
|
|
3371
4266
|
|
|
3372
4267
|
/**
|
|
3373
4268
|
* Workflow access mode - determines how the user is authenticated
|
|
@@ -3379,7 +4274,7 @@ type WorkflowAccessMode = {
|
|
|
3379
4274
|
} | {
|
|
3380
4275
|
type: "external";
|
|
3381
4276
|
token: string;
|
|
3382
|
-
|
|
4277
|
+
grantId: string;
|
|
3383
4278
|
};
|
|
3384
4279
|
/**
|
|
3385
4280
|
* Reason why a field is read-only
|
|
@@ -3727,8 +4622,7 @@ interface DBWorkflow {
|
|
|
3727
4622
|
slots: WorkflowSlot[];
|
|
3728
4623
|
nodes: Record<string, WorkflowNode>;
|
|
3729
4624
|
start_node_id: string;
|
|
3730
|
-
layout
|
|
3731
|
-
participants: ParticipantTemplate[] | null;
|
|
4625
|
+
layout?: WorkflowLayout;
|
|
3732
4626
|
theme: WorkflowTheme | null;
|
|
3733
4627
|
config: WorkflowConfig | null;
|
|
3734
4628
|
system: boolean;
|
|
@@ -3750,8 +4644,7 @@ interface CreateDBWorkflow {
|
|
|
3750
4644
|
slots: WorkflowSlot[];
|
|
3751
4645
|
nodes: Record<string, WorkflowNode>;
|
|
3752
4646
|
startNodeId: string;
|
|
3753
|
-
layout
|
|
3754
|
-
participants?: ParticipantTemplate[];
|
|
4647
|
+
layout?: WorkflowLayout;
|
|
3755
4648
|
theme?: WorkflowTheme;
|
|
3756
4649
|
config?: WorkflowConfig;
|
|
3757
4650
|
system?: boolean;
|
|
@@ -3770,7 +4663,6 @@ interface UpdateDBWorkflow {
|
|
|
3770
4663
|
nodes?: Record<string, WorkflowNode>;
|
|
3771
4664
|
startNodeId?: string;
|
|
3772
4665
|
layout?: WorkflowLayout;
|
|
3773
|
-
participants?: ParticipantTemplate[];
|
|
3774
4666
|
theme?: WorkflowTheme;
|
|
3775
4667
|
config?: WorkflowConfig;
|
|
3776
4668
|
metadata?: Record<string, unknown>;
|
|
@@ -3835,51 +4727,77 @@ interface UpdateDBWorkflowInstance {
|
|
|
3835
4727
|
completedAt?: Date | null;
|
|
3836
4728
|
}
|
|
3837
4729
|
/**
|
|
3838
|
-
* Workflow
|
|
4730
|
+
* Workflow invitation as stored in database.
|
|
3839
4731
|
* Uses snake_case to match database column names.
|
|
3840
4732
|
*/
|
|
3841
|
-
interface
|
|
4733
|
+
interface DBWorkflowInvitation {
|
|
3842
4734
|
id: string;
|
|
3843
4735
|
tenant_id: string;
|
|
3844
4736
|
instance_id: string;
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
phone: string | null;
|
|
3850
|
-
auth: ParticipationAuth;
|
|
3851
|
-
allowed_node_ids: string[];
|
|
3852
|
-
status: ParticipationStatus;
|
|
3853
|
-
authenticated_at: string | null;
|
|
3854
|
-
last_activity_at: string | null;
|
|
3855
|
-
completed_node_ids: string[];
|
|
4737
|
+
recipient_email: string;
|
|
4738
|
+
recipient_name: string | null;
|
|
4739
|
+
status: InvitationStatus;
|
|
4740
|
+
created_by: string;
|
|
3856
4741
|
created_at: string;
|
|
3857
|
-
|
|
4742
|
+
accepted_at: string | null;
|
|
4743
|
+
expires_at: string;
|
|
3858
4744
|
}
|
|
3859
4745
|
/**
|
|
3860
|
-
* Data for creating a workflow
|
|
4746
|
+
* Data for creating a workflow invitation.
|
|
3861
4747
|
* Tenant ID is automatically set from the execution context.
|
|
3862
4748
|
*/
|
|
3863
|
-
interface
|
|
4749
|
+
interface CreateDBWorkflowInvitation {
|
|
3864
4750
|
instanceId: string;
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
4751
|
+
recipientEmail: string;
|
|
4752
|
+
recipientName?: string;
|
|
4753
|
+
status?: InvitationStatus;
|
|
4754
|
+
createdBy: string;
|
|
4755
|
+
expiresAt: Date;
|
|
4756
|
+
}
|
|
4757
|
+
/**
|
|
4758
|
+
* Data for updating a workflow invitation.
|
|
4759
|
+
*/
|
|
4760
|
+
interface UpdateDBWorkflowInvitation {
|
|
4761
|
+
status?: InvitationStatus;
|
|
4762
|
+
acceptedAt?: Date | null;
|
|
4763
|
+
expiresAt?: Date;
|
|
4764
|
+
}
|
|
4765
|
+
/**
|
|
4766
|
+
* Workflow access grant as stored in database.
|
|
4767
|
+
* Uses snake_case to match database column names.
|
|
4768
|
+
*/
|
|
4769
|
+
interface DBWorkflowAccessGrant {
|
|
4770
|
+
id: string;
|
|
4771
|
+
tenant_id: string;
|
|
4772
|
+
invitation_id: string;
|
|
4773
|
+
instance_id: string;
|
|
4774
|
+
granted_to: string;
|
|
4775
|
+
scope: string[];
|
|
4776
|
+
revoked_token_jtis: string[];
|
|
4777
|
+
created_at: string;
|
|
4778
|
+
last_used_at: string | null;
|
|
4779
|
+
valid_until: string;
|
|
4780
|
+
revoked_at: string | null;
|
|
4781
|
+
}
|
|
4782
|
+
/**
|
|
4783
|
+
* Data for creating a workflow access grant.
|
|
4784
|
+
* Tenant ID is automatically set from the execution context.
|
|
4785
|
+
*/
|
|
4786
|
+
interface CreateDBWorkflowAccessGrant {
|
|
4787
|
+
invitationId: string;
|
|
4788
|
+
instanceId: string;
|
|
4789
|
+
grantedTo: string;
|
|
4790
|
+
scope?: string[];
|
|
4791
|
+
revokedTokenJtis?: string[];
|
|
4792
|
+
validUntil: Date;
|
|
3873
4793
|
}
|
|
3874
4794
|
/**
|
|
3875
|
-
* Data for updating a workflow
|
|
4795
|
+
* Data for updating a workflow access grant.
|
|
3876
4796
|
*/
|
|
3877
|
-
interface
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
lastActivityAt?: Date | null;
|
|
3882
|
-
completedNodeIds?: string[];
|
|
4797
|
+
interface UpdateDBWorkflowAccessGrant {
|
|
4798
|
+
lastUsedAt?: Date;
|
|
4799
|
+
revokedTokenJtis?: string[];
|
|
4800
|
+
revokedAt?: Date | null;
|
|
3883
4801
|
}
|
|
3884
4802
|
/**
|
|
3885
4803
|
* Result of an operation
|
|
@@ -4800,6 +5718,26 @@ declare const rollupConfigSchema: z.ZodObject<{
|
|
|
4800
5718
|
}>>;
|
|
4801
5719
|
}, z.core.$strip>>>;
|
|
4802
5720
|
}, z.core.$strip>;
|
|
5721
|
+
/**
|
|
5722
|
+
* Document attribute config schema
|
|
5723
|
+
*/
|
|
5724
|
+
declare const documentConfigSchema: z.ZodObject<{
|
|
5725
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
5726
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
5727
|
+
description: z.ZodOptional<z.ZodString>;
|
|
5728
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
5729
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
5730
|
+
order: z.ZodOptional<z.ZodNumber>;
|
|
5731
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
5732
|
+
archived: z.ZodOptional<z.ZodBoolean>;
|
|
5733
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
5734
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
5735
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
5736
|
+
allowedTemplates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
5737
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
5738
|
+
maxDocuments: z.ZodOptional<z.ZodNumber>;
|
|
5739
|
+
autoProcess: z.ZodOptional<z.ZodBoolean>;
|
|
5740
|
+
}, z.core.$strip>;
|
|
4803
5741
|
/**
|
|
4804
5742
|
* Map of attribute type to config schema
|
|
4805
5743
|
*/
|
|
@@ -5905,45 +6843,76 @@ interface WorkflowInstancesRepository {
|
|
|
5905
6843
|
* All operations are automatically scoped to the current tenant
|
|
5906
6844
|
* from the execution context (via AsyncLocalStorage).
|
|
5907
6845
|
*/
|
|
5908
|
-
|
|
6846
|
+
/**
|
|
6847
|
+
* Repository for workflow invitations.
|
|
6848
|
+
*
|
|
6849
|
+
* All operations are automatically scoped to the current tenant
|
|
6850
|
+
* from the execution context (via AsyncLocalStorage).
|
|
6851
|
+
*/
|
|
6852
|
+
interface WorkflowInvitationsRepository {
|
|
5909
6853
|
/**
|
|
5910
|
-
* Find
|
|
6854
|
+
* Find invitation by ID.
|
|
5911
6855
|
* Automatically filtered by current tenant context.
|
|
5912
6856
|
*/
|
|
5913
|
-
findById(id: Uuid): Promise<
|
|
6857
|
+
findById(id: Uuid): Promise<DBWorkflowInvitation | null>;
|
|
5914
6858
|
/**
|
|
5915
|
-
* Find
|
|
6859
|
+
* Find invitations by instance ID.
|
|
5916
6860
|
* Automatically filtered by current tenant context.
|
|
5917
6861
|
*/
|
|
5918
|
-
findByInstanceId(instanceId: Uuid): Promise<
|
|
6862
|
+
findByInstanceId(instanceId: Uuid): Promise<DBWorkflowInvitation[]>;
|
|
5919
6863
|
/**
|
|
5920
|
-
* Find
|
|
6864
|
+
* Find invitations by recipient email.
|
|
5921
6865
|
* Automatically filtered by current tenant context.
|
|
5922
6866
|
*/
|
|
5923
|
-
findByEmail(email: string): Promise<
|
|
6867
|
+
findByEmail(email: string): Promise<DBWorkflowInvitation[]>;
|
|
5924
6868
|
/**
|
|
5925
|
-
* Create
|
|
6869
|
+
* Create invitation.
|
|
5926
6870
|
* Tenant ID is automatically set from context.
|
|
5927
6871
|
*/
|
|
5928
|
-
create(data:
|
|
6872
|
+
create(data: CreateDBWorkflowInvitation): Promise<DBWorkflowInvitation>;
|
|
6873
|
+
/**
|
|
6874
|
+
* Update invitation.
|
|
6875
|
+
* Automatically filtered by current tenant context.
|
|
6876
|
+
*/
|
|
6877
|
+
update(id: Uuid, data: UpdateDBWorkflowInvitation): Promise<DBWorkflowInvitation>;
|
|
6878
|
+
}
|
|
6879
|
+
/**
|
|
6880
|
+
* Repository for workflow access grants.
|
|
6881
|
+
*
|
|
6882
|
+
* All operations are automatically scoped to the current tenant
|
|
6883
|
+
* from the execution context (via AsyncLocalStorage).
|
|
6884
|
+
*/
|
|
6885
|
+
interface WorkflowAccessGrantsRepository {
|
|
6886
|
+
/**
|
|
6887
|
+
* Find grant by ID.
|
|
6888
|
+
* Automatically filtered by current tenant context.
|
|
6889
|
+
*/
|
|
6890
|
+
findById(id: Uuid): Promise<DBWorkflowAccessGrant | null>;
|
|
5929
6891
|
/**
|
|
5930
|
-
*
|
|
6892
|
+
* Find grants by invitation ID.
|
|
5931
6893
|
* Automatically filtered by current tenant context.
|
|
5932
6894
|
*/
|
|
5933
|
-
|
|
6895
|
+
findByInvitationId(invitationId: Uuid): Promise<DBWorkflowAccessGrant[]>;
|
|
5934
6896
|
/**
|
|
5935
|
-
*
|
|
6897
|
+
* Find grants by instance ID.
|
|
6898
|
+
* Automatically filtered by current tenant context.
|
|
6899
|
+
*/
|
|
6900
|
+
findByInstanceId(instanceId: Uuid): Promise<DBWorkflowAccessGrant[]>;
|
|
6901
|
+
/**
|
|
6902
|
+
* Find grants by email.
|
|
6903
|
+
* Automatically filtered by current tenant context.
|
|
6904
|
+
*/
|
|
6905
|
+
findByEmail(email: string): Promise<DBWorkflowAccessGrant[]>;
|
|
6906
|
+
/**
|
|
6907
|
+
* Create grant.
|
|
5936
6908
|
* Tenant ID is automatically set from context.
|
|
5937
6909
|
*/
|
|
5938
|
-
|
|
5939
|
-
id: string;
|
|
5940
|
-
}): Promise<DBWorkflowParticipation>;
|
|
6910
|
+
create(data: CreateDBWorkflowAccessGrant): Promise<DBWorkflowAccessGrant>;
|
|
5941
6911
|
/**
|
|
5942
|
-
* Update
|
|
5943
|
-
* Used for recording failed PIN attempts without touching other fields.
|
|
6912
|
+
* Update grant.
|
|
5944
6913
|
* Automatically filtered by current tenant context.
|
|
5945
6914
|
*/
|
|
5946
|
-
|
|
6915
|
+
update(id: Uuid, data: UpdateDBWorkflowAccessGrant): Promise<DBWorkflowAccessGrant>;
|
|
5947
6916
|
}
|
|
5948
6917
|
/**
|
|
5949
6918
|
* Repository for audit logs.
|
|
@@ -6213,7 +7182,256 @@ interface AIUsageMetricsRepository {
|
|
|
6213
7182
|
}
|
|
6214
7183
|
|
|
6215
7184
|
/**
|
|
6216
|
-
*
|
|
7185
|
+
* Repository for document templates.
|
|
7186
|
+
*
|
|
7187
|
+
* Templates define the structure of documents (slots, processing, etc.).
|
|
7188
|
+
* System templates are available to all tenants.
|
|
7189
|
+
* Custom templates are tenant-specific.
|
|
7190
|
+
*
|
|
7191
|
+
* All operations are automatically scoped to the current tenant
|
|
7192
|
+
* from the execution context (via AsyncLocalStorage).
|
|
7193
|
+
*/
|
|
7194
|
+
interface DocumentTemplatesRepository {
|
|
7195
|
+
/**
|
|
7196
|
+
* Find template by ID.
|
|
7197
|
+
* Returns system templates or tenant-specific templates.
|
|
7198
|
+
*/
|
|
7199
|
+
findById(id: Uuid): Promise<DocumentTemplate | null>;
|
|
7200
|
+
/**
|
|
7201
|
+
* Find template by name.
|
|
7202
|
+
* First checks tenant-specific templates, then falls back to system templates.
|
|
7203
|
+
*/
|
|
7204
|
+
findByName(name: string): Promise<DocumentTemplate | null>;
|
|
7205
|
+
/**
|
|
7206
|
+
* Find multiple templates by names.
|
|
7207
|
+
*/
|
|
7208
|
+
findByNames(names: string[]): Promise<DocumentTemplate[]>;
|
|
7209
|
+
/**
|
|
7210
|
+
* List all available templates.
|
|
7211
|
+
* Includes both system templates and tenant-specific templates.
|
|
7212
|
+
*/
|
|
7213
|
+
list(options?: DocumentTemplateListOptions): Promise<DocumentTemplate[]>;
|
|
7214
|
+
/**
|
|
7215
|
+
* Create a custom template.
|
|
7216
|
+
* Tenant ID is automatically set from context.
|
|
7217
|
+
*/
|
|
7218
|
+
create(data: CreateDocumentTemplate): Promise<DocumentTemplate>;
|
|
7219
|
+
/**
|
|
7220
|
+
* Update a template.
|
|
7221
|
+
* Only tenant-specific templates can be updated.
|
|
7222
|
+
*/
|
|
7223
|
+
update(id: Uuid, data: UpdateDocumentTemplate): Promise<DocumentTemplate>;
|
|
7224
|
+
/**
|
|
7225
|
+
* Delete a template.
|
|
7226
|
+
* Only tenant-specific templates can be deleted.
|
|
7227
|
+
*/
|
|
7228
|
+
delete(id: Uuid): Promise<void>;
|
|
7229
|
+
}
|
|
7230
|
+
/**
|
|
7231
|
+
* Repository for documents.
|
|
7232
|
+
*
|
|
7233
|
+
* Documents are wrappers around files with templates, slots, and processing.
|
|
7234
|
+
* They are linked to records via record.values (document attribute).
|
|
7235
|
+
*
|
|
7236
|
+
* All operations are automatically scoped to the current tenant
|
|
7237
|
+
* from the execution context (via AsyncLocalStorage).
|
|
7238
|
+
*/
|
|
7239
|
+
interface DocumentsRepository {
|
|
7240
|
+
/**
|
|
7241
|
+
* Create a new document.
|
|
7242
|
+
* Tenant ID is automatically set from context.
|
|
7243
|
+
*/
|
|
7244
|
+
create(data: CreateDocument): Promise<Document>;
|
|
7245
|
+
/**
|
|
7246
|
+
* Find document by ID.
|
|
7247
|
+
* Automatically filtered by current tenant context.
|
|
7248
|
+
*/
|
|
7249
|
+
findById(id: Uuid): Promise<Document | null>;
|
|
7250
|
+
/**
|
|
7251
|
+
* Find multiple documents by IDs.
|
|
7252
|
+
* Automatically filtered by current tenant context.
|
|
7253
|
+
*/
|
|
7254
|
+
findByIds(ids: Uuid[]): Promise<Document[]>;
|
|
7255
|
+
/**
|
|
7256
|
+
* Update a document.
|
|
7257
|
+
* Automatically filtered by current tenant context.
|
|
7258
|
+
*/
|
|
7259
|
+
update(id: Uuid, data: UpdateDocument): Promise<Document>;
|
|
7260
|
+
/**
|
|
7261
|
+
* Update document status.
|
|
7262
|
+
* Convenience method for status transitions.
|
|
7263
|
+
*/
|
|
7264
|
+
updateStatus(id: Uuid, status: DocumentStatus): Promise<Document>;
|
|
7265
|
+
/**
|
|
7266
|
+
* Soft delete a document.
|
|
7267
|
+
* Automatically filtered by current tenant context.
|
|
7268
|
+
*/
|
|
7269
|
+
delete(id: Uuid): Promise<void>;
|
|
7270
|
+
/**
|
|
7271
|
+
* Hard delete a document.
|
|
7272
|
+
* Automatically filtered by current tenant context.
|
|
7273
|
+
*/
|
|
7274
|
+
hardDelete(id: Uuid): Promise<void>;
|
|
7275
|
+
/**
|
|
7276
|
+
* List documents with optional filters.
|
|
7277
|
+
* Automatically filtered by current tenant context.
|
|
7278
|
+
*/
|
|
7279
|
+
list(options?: DocumentListOptions): Promise<Document[]>;
|
|
7280
|
+
/**
|
|
7281
|
+
* Search documents by text.
|
|
7282
|
+
* Uses full-text search on title, description, and OCR content.
|
|
7283
|
+
*/
|
|
7284
|
+
search(query: string, options?: DocumentListOptions): Promise<Document[]>;
|
|
7285
|
+
}
|
|
7286
|
+
/**
|
|
7287
|
+
* Repository for document slots.
|
|
7288
|
+
*
|
|
7289
|
+
* Slots are individual file entries within a document.
|
|
7290
|
+
* Each slot corresponds to a slot definition in the template.
|
|
7291
|
+
*/
|
|
7292
|
+
interface DocumentSlotsRepository {
|
|
7293
|
+
/**
|
|
7294
|
+
* Create a slot (upload a file to a document).
|
|
7295
|
+
*/
|
|
7296
|
+
create(data: CreateDocumentSlot): Promise<DocumentSlot>;
|
|
7297
|
+
/**
|
|
7298
|
+
* Find slot by ID.
|
|
7299
|
+
*/
|
|
7300
|
+
findById(id: Uuid): Promise<DocumentSlot | null>;
|
|
7301
|
+
/**
|
|
7302
|
+
* Find all slots for a document.
|
|
7303
|
+
*/
|
|
7304
|
+
findByDocumentId(documentId: Uuid): Promise<DocumentSlot[]>;
|
|
7305
|
+
/**
|
|
7306
|
+
* Find a specific slot by document and slot name.
|
|
7307
|
+
*/
|
|
7308
|
+
findByDocumentAndSlot(documentId: Uuid, slotName: string): Promise<DocumentSlot | null>;
|
|
7309
|
+
/**
|
|
7310
|
+
* Update a slot (status, OCR results, etc.).
|
|
7311
|
+
*/
|
|
7312
|
+
update(id: Uuid, data: UpdateDocumentSlot): Promise<DocumentSlot>;
|
|
7313
|
+
/**
|
|
7314
|
+
* Update slot status.
|
|
7315
|
+
*/
|
|
7316
|
+
updateStatus(id: Uuid, status: SlotStatus): Promise<DocumentSlot>;
|
|
7317
|
+
/**
|
|
7318
|
+
* Delete a slot.
|
|
7319
|
+
*/
|
|
7320
|
+
delete(id: Uuid): Promise<void>;
|
|
7321
|
+
/**
|
|
7322
|
+
* Delete all slots for a document.
|
|
7323
|
+
*/
|
|
7324
|
+
deleteByDocumentId(documentId: Uuid): Promise<void>;
|
|
7325
|
+
}
|
|
7326
|
+
/**
|
|
7327
|
+
* Repository for document processing jobs.
|
|
7328
|
+
*
|
|
7329
|
+
* Jobs track async processing tasks (OCR, signature, verification).
|
|
7330
|
+
* They are linked to documents and optionally to specific slots.
|
|
7331
|
+
*/
|
|
7332
|
+
interface DocumentJobsRepository {
|
|
7333
|
+
/**
|
|
7334
|
+
* Create a processing job.
|
|
7335
|
+
* Tenant ID is automatically set from context.
|
|
7336
|
+
*/
|
|
7337
|
+
create(data: CreateProcessingJob): Promise<ProcessingJob>;
|
|
7338
|
+
/**
|
|
7339
|
+
* Find job by ID.
|
|
7340
|
+
*/
|
|
7341
|
+
findById(id: Uuid): Promise<ProcessingJob | null>;
|
|
7342
|
+
/**
|
|
7343
|
+
* Find all jobs for a document.
|
|
7344
|
+
*/
|
|
7345
|
+
findByDocumentId(documentId: Uuid): Promise<ProcessingJob[]>;
|
|
7346
|
+
/**
|
|
7347
|
+
* Find jobs by status (for processing queue).
|
|
7348
|
+
*/
|
|
7349
|
+
findByStatus(status: ProcessingJobStatus, limit?: number): Promise<ProcessingJob[]>;
|
|
7350
|
+
/**
|
|
7351
|
+
* Find pending jobs (for processing queue).
|
|
7352
|
+
*/
|
|
7353
|
+
findPending(limit?: number): Promise<ProcessingJob[]>;
|
|
7354
|
+
/**
|
|
7355
|
+
* Update a job.
|
|
7356
|
+
*/
|
|
7357
|
+
update(id: Uuid, data: UpdateProcessingJob): Promise<ProcessingJob>;
|
|
7358
|
+
/**
|
|
7359
|
+
* Mark job as started.
|
|
7360
|
+
*/
|
|
7361
|
+
markStarted(id: Uuid): Promise<ProcessingJob>;
|
|
7362
|
+
/**
|
|
7363
|
+
* Mark job as completed with result.
|
|
7364
|
+
*/
|
|
7365
|
+
markCompleted(id: Uuid, result: Record<string, unknown>): Promise<ProcessingJob>;
|
|
7366
|
+
/**
|
|
7367
|
+
* Mark job as failed with error.
|
|
7368
|
+
*/
|
|
7369
|
+
markFailed(id: Uuid, error: string): Promise<ProcessingJob>;
|
|
7370
|
+
/**
|
|
7371
|
+
* Cancel a job.
|
|
7372
|
+
*/
|
|
7373
|
+
cancel(id: Uuid): Promise<ProcessingJob>;
|
|
7374
|
+
/**
|
|
7375
|
+
* Find job by external ID (e.g., signature provider ID).
|
|
7376
|
+
* Used for webhook callbacks.
|
|
7377
|
+
*/
|
|
7378
|
+
findByExternalId?(externalId: string): Promise<ProcessingJob | null>;
|
|
7379
|
+
}
|
|
7380
|
+
/**
|
|
7381
|
+
* List options for document generation templates
|
|
7382
|
+
*/
|
|
7383
|
+
interface DocumentGenerationTemplateListOptions {
|
|
7384
|
+
/** Filter by source type */
|
|
7385
|
+
sourceType?: "pdf" | "docx";
|
|
7386
|
+
/** Limit results */
|
|
7387
|
+
limit?: number;
|
|
7388
|
+
/** Offset for pagination */
|
|
7389
|
+
offset?: number;
|
|
7390
|
+
}
|
|
7391
|
+
/**
|
|
7392
|
+
* Repository for document generation templates.
|
|
7393
|
+
*
|
|
7394
|
+
* Document generation templates define how to generate documents by injecting
|
|
7395
|
+
* workflow context data into PDF or DOCX template files.
|
|
7396
|
+
*
|
|
7397
|
+
* All operations are automatically scoped to the current tenant
|
|
7398
|
+
* from the execution context (via AsyncLocalStorage).
|
|
7399
|
+
*/
|
|
7400
|
+
interface DocumentGenerationTemplatesRepository {
|
|
7401
|
+
/**
|
|
7402
|
+
* Find template by ID.
|
|
7403
|
+
* Automatically filtered by current tenant context.
|
|
7404
|
+
*/
|
|
7405
|
+
findById(id: Uuid): Promise<DocumentGenerationTemplate | null>;
|
|
7406
|
+
/**
|
|
7407
|
+
* Find template by name.
|
|
7408
|
+
* Automatically filtered by current tenant context.
|
|
7409
|
+
*/
|
|
7410
|
+
findByName(name: string): Promise<DocumentGenerationTemplate | null>;
|
|
7411
|
+
/**
|
|
7412
|
+
* List all templates for current tenant.
|
|
7413
|
+
* Automatically filtered by current tenant context.
|
|
7414
|
+
*/
|
|
7415
|
+
list(options?: DocumentGenerationTemplateListOptions): Promise<DocumentGenerationTemplate[]>;
|
|
7416
|
+
/**
|
|
7417
|
+
* Create template.
|
|
7418
|
+
* Tenant ID is automatically set from context.
|
|
7419
|
+
*/
|
|
7420
|
+
create(data: CreateDocumentGenerationTemplate): Promise<DocumentGenerationTemplate>;
|
|
7421
|
+
/**
|
|
7422
|
+
* Update template.
|
|
7423
|
+
* Automatically filtered by current tenant context.
|
|
7424
|
+
*/
|
|
7425
|
+
update(id: Uuid, data: UpdateDocumentGenerationTemplate): Promise<DocumentGenerationTemplate>;
|
|
7426
|
+
/**
|
|
7427
|
+
* Delete template.
|
|
7428
|
+
* Automatically filtered by current tenant context.
|
|
7429
|
+
*/
|
|
7430
|
+
delete(id: Uuid): Promise<void>;
|
|
7431
|
+
}
|
|
7432
|
+
|
|
7433
|
+
/**
|
|
7434
|
+
* File content type - supports various formats
|
|
6217
7435
|
* Use Uint8Array for cross-platform compatibility
|
|
6218
7436
|
*/
|
|
6219
7437
|
type FileContent = Uint8Array | ArrayBuffer | Blob | ReadableStream<Uint8Array>;
|
|
@@ -6369,6 +7587,16 @@ interface StorageAdapter {
|
|
|
6369
7587
|
* @returns true if file exists
|
|
6370
7588
|
*/
|
|
6371
7589
|
exists?(storagePath: string): Promise<boolean>;
|
|
7590
|
+
/**
|
|
7591
|
+
* Download file content from storage
|
|
7592
|
+
*
|
|
7593
|
+
* Optional method - required for document processing features.
|
|
7594
|
+
* If not implemented, processing features will be unavailable.
|
|
7595
|
+
*
|
|
7596
|
+
* @param storagePath - Path to the file in storage
|
|
7597
|
+
* @returns File content as Buffer
|
|
7598
|
+
*/
|
|
7599
|
+
download?(storagePath: string): Promise<Buffer>;
|
|
6372
7600
|
}
|
|
6373
7601
|
/**
|
|
6374
7602
|
* Input for FileService.uploadFile() method
|
|
@@ -6439,7 +7667,8 @@ interface DatabaseAdapter {
|
|
|
6439
7667
|
views: ViewsRepository;
|
|
6440
7668
|
workflows?: WorkflowsRepository;
|
|
6441
7669
|
workflowInstances?: WorkflowInstancesRepository;
|
|
6442
|
-
|
|
7670
|
+
workflowInvitations?: WorkflowInvitationsRepository;
|
|
7671
|
+
workflowAccessGrants?: WorkflowAccessGrantsRepository;
|
|
6443
7672
|
userProfiles: UserProfilesRepository;
|
|
6444
7673
|
files: FilesRepository;
|
|
6445
7674
|
objectRecords: ObjectRecordsRepository;
|
|
@@ -6450,154 +7679,177 @@ interface DatabaseAdapter {
|
|
|
6450
7679
|
aiConversations?: AIConversationsRepository;
|
|
6451
7680
|
aiUserMemory?: AIUserMemoryRepository;
|
|
6452
7681
|
aiUsageMetrics?: AIUsageMetricsRepository;
|
|
7682
|
+
documents?: DocumentsRepository;
|
|
7683
|
+
documentTemplates?: DocumentTemplatesRepository;
|
|
7684
|
+
documentSlots?: DocumentSlotsRepository;
|
|
7685
|
+
documentJobs?: DocumentJobsRepository;
|
|
7686
|
+
documentGenerationTemplates?: DocumentGenerationTemplatesRepository;
|
|
6453
7687
|
transaction<T>(callback: (adapter: DatabaseAdapter) => Promise<T>): Promise<T>;
|
|
6454
7688
|
}
|
|
6455
7689
|
|
|
6456
7690
|
/**
|
|
6457
|
-
*
|
|
7691
|
+
* Base JWT claims for workflow tokens
|
|
6458
7692
|
*/
|
|
6459
|
-
interface
|
|
6460
|
-
/**
|
|
6461
|
-
|
|
6462
|
-
/**
|
|
6463
|
-
|
|
6464
|
-
/**
|
|
6465
|
-
|
|
6466
|
-
/** Expiration timestamp
|
|
7693
|
+
interface BaseWorkflowClaims extends JWTPayload {
|
|
7694
|
+
/** Issuer */
|
|
7695
|
+
iss: string;
|
|
7696
|
+
/** Audience (tenant ID) */
|
|
7697
|
+
aud: string;
|
|
7698
|
+
/** Subject (invitation or grant ID) */
|
|
7699
|
+
sub: string;
|
|
7700
|
+
/** Expiration timestamp */
|
|
6467
7701
|
exp: number;
|
|
6468
|
-
/** Issued at timestamp
|
|
7702
|
+
/** Issued at timestamp */
|
|
6469
7703
|
iat: number;
|
|
6470
|
-
/**
|
|
7704
|
+
/** JWT ID (for revocation) */
|
|
6471
7705
|
jti: string;
|
|
6472
7706
|
}
|
|
6473
7707
|
/**
|
|
6474
|
-
*
|
|
7708
|
+
* Magic link JWT payload (one-time use for accepting invitation)
|
|
6475
7709
|
*/
|
|
6476
|
-
interface
|
|
6477
|
-
/**
|
|
6478
|
-
|
|
7710
|
+
interface MagicLinkPayload extends BaseWorkflowClaims {
|
|
7711
|
+
/** Token type */
|
|
7712
|
+
typ: "magic_link";
|
|
7713
|
+
/** Workflow instance ID */
|
|
7714
|
+
instance: string;
|
|
7715
|
+
/** Tenant ID */
|
|
7716
|
+
tenant: string;
|
|
6479
7717
|
}
|
|
6480
7718
|
/**
|
|
6481
|
-
*
|
|
7719
|
+
* Access token JWT payload (long-lived for accessing workflow)
|
|
6482
7720
|
*/
|
|
6483
|
-
interface
|
|
7721
|
+
interface WorkflowAccessPayload extends BaseWorkflowClaims {
|
|
7722
|
+
/** Token type */
|
|
7723
|
+
typ: "workflow_access";
|
|
7724
|
+
/** Grant ID */
|
|
7725
|
+
sub: string;
|
|
7726
|
+
/** Workflow instance ID */
|
|
7727
|
+
instance: string;
|
|
7728
|
+
/** Tenant ID */
|
|
7729
|
+
tenant: string;
|
|
7730
|
+
/** Access scope */
|
|
7731
|
+
scope: string[];
|
|
7732
|
+
}
|
|
7733
|
+
type WorkflowJwtPayload = MagicLinkPayload | WorkflowAccessPayload;
|
|
7734
|
+
interface JwtVerificationResult {
|
|
6484
7735
|
valid: boolean;
|
|
6485
|
-
payload?:
|
|
7736
|
+
payload?: WorkflowJwtPayload;
|
|
6486
7737
|
error?: string;
|
|
7738
|
+
errorCode?: "EXPIRED" | "INVALID_SIGNATURE" | "MALFORMED" | "UNKNOWN";
|
|
7739
|
+
}
|
|
7740
|
+
interface WorkflowJwtConfig {
|
|
7741
|
+
/** Private key for signing (PEM string or CryptoKey) */
|
|
7742
|
+
privateKey: string | CryptoKey;
|
|
7743
|
+
/** Public key for verification (PEM string or CryptoKey) */
|
|
7744
|
+
publicKey: string | CryptoKey;
|
|
7745
|
+
/** Issuer claim (default: "stndrds/workflows") */
|
|
7746
|
+
issuer?: string;
|
|
7747
|
+
/** Access token TTL (default: "7d") */
|
|
7748
|
+
accessTokenTTL?: string;
|
|
7749
|
+
/** Magic link TTL (default: "15m") */
|
|
7750
|
+
magicLinkTTL?: string;
|
|
6487
7751
|
}
|
|
6488
7752
|
/**
|
|
6489
|
-
* Service for generating and verifying
|
|
7753
|
+
* Service for generating and verifying workflow JWT tokens.
|
|
6490
7754
|
*
|
|
6491
|
-
*
|
|
6492
|
-
*
|
|
7755
|
+
* Uses ES256 (ECDSA with P-256 curve) for signing, which is:
|
|
7756
|
+
* - More secure than HMAC (asymmetric)
|
|
7757
|
+
* - Smaller signatures than RSA
|
|
7758
|
+
* - Edge-runtime compatible (via jose)
|
|
6493
7759
|
*
|
|
6494
|
-
*
|
|
7760
|
+
* @example
|
|
7761
|
+
* ```typescript
|
|
7762
|
+
* const jwtService = await WorkflowJwtService.create({
|
|
7763
|
+
* privateKey: process.env.WORKFLOW_JWT_PRIVATE_KEY!,
|
|
7764
|
+
* publicKey: process.env.WORKFLOW_JWT_PUBLIC_KEY!,
|
|
7765
|
+
* });
|
|
7766
|
+
*
|
|
7767
|
+
* // Generate magic link
|
|
7768
|
+
* const token = await jwtService.signMagicLink({
|
|
7769
|
+
* invitationId: "inv_123",
|
|
7770
|
+
* instanceId: "inst_456",
|
|
7771
|
+
* tenantId: "tenant_789",
|
|
7772
|
+
* });
|
|
7773
|
+
*
|
|
7774
|
+
* // Verify token
|
|
7775
|
+
* const result = await jwtService.verify(token);
|
|
7776
|
+
* if (result.valid && result.payload?.typ === "magic_link") {
|
|
7777
|
+
* // Handle magic link
|
|
7778
|
+
* }
|
|
7779
|
+
* ```
|
|
6495
7780
|
*/
|
|
6496
|
-
declare class
|
|
6497
|
-
private
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
7781
|
+
declare class WorkflowJwtService {
|
|
7782
|
+
private config;
|
|
7783
|
+
private privateKey;
|
|
7784
|
+
private publicKey;
|
|
7785
|
+
private issuer;
|
|
7786
|
+
private accessTokenTTL;
|
|
7787
|
+
private magicLinkTTL;
|
|
7788
|
+
private initialized;
|
|
7789
|
+
private constructor();
|
|
6505
7790
|
/**
|
|
6506
|
-
*
|
|
7791
|
+
* Create and initialize the JWT service.
|
|
7792
|
+
* Handles async key import from PEM strings.
|
|
6507
7793
|
*/
|
|
6508
|
-
|
|
7794
|
+
static create(config: WorkflowJwtConfig): Promise<WorkflowJwtService>;
|
|
7795
|
+
private initialize;
|
|
6509
7796
|
/**
|
|
6510
|
-
*
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
* Extract token from a participation link
|
|
7797
|
+
* Sign a magic link JWT (one-time use, short-lived)
|
|
7798
|
+
*
|
|
7799
|
+
* @param params - Magic link parameters
|
|
7800
|
+
* @returns Signed JWT token
|
|
6515
7801
|
*/
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
private base64Decode;
|
|
6523
|
-
}
|
|
6524
|
-
/**
|
|
6525
|
-
* Get the default token service instance
|
|
6526
|
-
*/
|
|
6527
|
-
declare function getDefaultTokenService(): ParticipationTokenService;
|
|
6528
|
-
/**
|
|
6529
|
-
* Initialize the token service with a custom secret
|
|
6530
|
-
*/
|
|
6531
|
-
declare function initializeTokenService(secret: string): ParticipationTokenService;
|
|
6532
|
-
|
|
6533
|
-
/**
|
|
6534
|
-
* Options for PIN code generation
|
|
6535
|
-
*/
|
|
6536
|
-
interface PinCodeGenerationOptions {
|
|
6537
|
-
/** Length of the PIN code (default: 6) */
|
|
6538
|
-
length?: number;
|
|
6539
|
-
/** Expiration duration (e.g., "24h", "7d") */
|
|
6540
|
-
expiresIn?: string;
|
|
6541
|
-
/** Maximum attempts before lockout (default: 3) */
|
|
6542
|
-
maxAttempts?: number;
|
|
6543
|
-
}
|
|
6544
|
-
/**
|
|
6545
|
-
* Result of PIN code verification
|
|
6546
|
-
*/
|
|
6547
|
-
interface PinCodeVerificationResult {
|
|
6548
|
-
valid: boolean;
|
|
6549
|
-
error?: string;
|
|
6550
|
-
attemptsRemaining?: number;
|
|
6551
|
-
lockedUntil?: Date;
|
|
6552
|
-
}
|
|
6553
|
-
/**
|
|
6554
|
-
* Service for generating and verifying PIN codes.
|
|
6555
|
-
*
|
|
6556
|
-
* PIN codes are hashed before storage for security.
|
|
6557
|
-
* This implementation uses a simple hash for demonstration.
|
|
6558
|
-
* In production, use bcrypt or argon2.
|
|
6559
|
-
*/
|
|
6560
|
-
declare class PinCodeService {
|
|
6561
|
-
private salt;
|
|
6562
|
-
constructor(salt?: string);
|
|
7802
|
+
signMagicLink(params: {
|
|
7803
|
+
invitationId: string;
|
|
7804
|
+
instanceId: string;
|
|
7805
|
+
tenantId: string;
|
|
7806
|
+
expiresIn?: string;
|
|
7807
|
+
}): Promise<string>;
|
|
6563
7808
|
/**
|
|
6564
|
-
*
|
|
7809
|
+
* Sign an access token JWT (long-lived)
|
|
7810
|
+
*
|
|
7811
|
+
* @param params - Access token parameters
|
|
7812
|
+
* @returns Signed JWT token
|
|
6565
7813
|
*/
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
7814
|
+
signAccessToken(params: {
|
|
7815
|
+
grantId: string;
|
|
7816
|
+
instanceId: string;
|
|
7817
|
+
tenantId: string;
|
|
7818
|
+
scope: string[];
|
|
7819
|
+
expiresIn?: string;
|
|
7820
|
+
}): Promise<string>;
|
|
6570
7821
|
/**
|
|
6571
|
-
* Verify
|
|
7822
|
+
* Verify and decode a JWT token.
|
|
7823
|
+
*
|
|
7824
|
+
* Returns a result object with:
|
|
7825
|
+
* - valid: boolean
|
|
7826
|
+
* - payload: the decoded payload if valid
|
|
7827
|
+
* - error: human-readable error message if invalid
|
|
7828
|
+
* - errorCode: machine-readable error code if invalid
|
|
7829
|
+
*
|
|
7830
|
+
* @param token - JWT token to verify
|
|
7831
|
+
* @returns Verification result
|
|
6572
7832
|
*/
|
|
6573
|
-
verify(
|
|
7833
|
+
verify(token: string): Promise<JwtVerificationResult>;
|
|
6574
7834
|
/**
|
|
6575
|
-
*
|
|
7835
|
+
* Verify token and return payload directly.
|
|
7836
|
+
* Throws on invalid token.
|
|
7837
|
+
*
|
|
7838
|
+
* @param token - JWT token to verify
|
|
7839
|
+
* @returns Decoded payload
|
|
7840
|
+
* @throws Error if token is invalid
|
|
6576
7841
|
*/
|
|
6577
|
-
|
|
7842
|
+
verifyOrThrow(token: string): Promise<WorkflowJwtPayload>;
|
|
7843
|
+
private handleVerifyError;
|
|
6578
7844
|
/**
|
|
6579
|
-
*
|
|
7845
|
+
* Generate a magic link URL from a token
|
|
6580
7846
|
*/
|
|
6581
|
-
|
|
7847
|
+
generateMagicLinkUrl(baseUrl: string, token: string): string;
|
|
6582
7848
|
/**
|
|
6583
|
-
*
|
|
7849
|
+
* Extract token from a magic link URL
|
|
6584
7850
|
*/
|
|
6585
|
-
|
|
6586
|
-
code: string;
|
|
6587
|
-
auth: PinCodeAuth;
|
|
6588
|
-
};
|
|
6589
|
-
private generateNumericCode;
|
|
6590
|
-
private hashCode;
|
|
6591
|
-
private parseExpiration;
|
|
7851
|
+
extractTokenFromUrl(url: string): string | null;
|
|
6592
7852
|
}
|
|
6593
|
-
/**
|
|
6594
|
-
* Get the default PIN code service instance
|
|
6595
|
-
*/
|
|
6596
|
-
declare function getDefaultPinCodeService(): PinCodeService;
|
|
6597
|
-
/**
|
|
6598
|
-
* Initialize the PIN code service with a custom salt
|
|
6599
|
-
*/
|
|
6600
|
-
declare function initializePinCodeService(salt: string): PinCodeService;
|
|
6601
7853
|
|
|
6602
7854
|
/**
|
|
6603
7855
|
* Formatted record with values flattened to root level.
|
|
@@ -6648,6 +7900,8 @@ interface QueryBuilderState {
|
|
|
6648
7900
|
includeDeleted: boolean;
|
|
6649
7901
|
/** Group results by attribute (for Kanban views - status/select only) */
|
|
6650
7902
|
groupBy?: string;
|
|
7903
|
+
/** Full-text search query */
|
|
7904
|
+
search?: string;
|
|
6651
7905
|
/** Explicit tenant ID (overrides AsyncLocalStorage context) */
|
|
6652
7906
|
tenantId?: TenantId;
|
|
6653
7907
|
/** Explicit user ID (overrides AsyncLocalStorage context) */
|
|
@@ -8901,7 +10155,7 @@ declare function createContextForRestore(schema: ObjectDefinition, tenantId: str
|
|
|
8901
10155
|
|
|
8902
10156
|
/**
|
|
8903
10157
|
* Fluent query builder for schema records.
|
|
8904
|
-
* Supports chained filters, sorts, and
|
|
10158
|
+
* Supports chained filters, sorts, pagination, and full-text search.
|
|
8905
10159
|
*
|
|
8906
10160
|
* @example
|
|
8907
10161
|
* ```typescript
|
|
@@ -8912,6 +10166,12 @@ declare function createContextForRestore(schema: ObjectDefinition, tenantId: str
|
|
|
8912
10166
|
* .limit(20)
|
|
8913
10167
|
* .fetch();
|
|
8914
10168
|
*
|
|
10169
|
+
* // Full-text search
|
|
10170
|
+
* const results = await qb
|
|
10171
|
+
* .search('nike air')
|
|
10172
|
+
* .limit(20)
|
|
10173
|
+
* .fetch();
|
|
10174
|
+
*
|
|
8915
10175
|
* // Get single record
|
|
8916
10176
|
* const product = await qb.eq('sku', 'ABC-123').single();
|
|
8917
10177
|
*
|
|
@@ -9030,6 +10290,27 @@ declare class QueryBuilder<T extends Record<string, unknown> = Record<string, un
|
|
|
9030
10290
|
* Include soft-deleted records
|
|
9031
10291
|
*/
|
|
9032
10292
|
withDeleted(): QueryBuilder<T, TRaw>;
|
|
10293
|
+
/**
|
|
10294
|
+
* Full-text search across record fields.
|
|
10295
|
+
* Can be combined with filters, sorts, and pagination.
|
|
10296
|
+
*
|
|
10297
|
+
* @example
|
|
10298
|
+
* ```typescript
|
|
10299
|
+
* // Search with pagination
|
|
10300
|
+
* const products = await qb
|
|
10301
|
+
* .search("nike air")
|
|
10302
|
+
* .orderBy("createdAt", "desc")
|
|
10303
|
+
* .limit(20)
|
|
10304
|
+
* .fetch();
|
|
10305
|
+
*
|
|
10306
|
+
* // Search with filters
|
|
10307
|
+
* const activeNikeProducts = await qb
|
|
10308
|
+
* .search("nike")
|
|
10309
|
+
* .eq("status", "active")
|
|
10310
|
+
* .fetch();
|
|
10311
|
+
* ```
|
|
10312
|
+
*/
|
|
10313
|
+
search(query: string): QueryBuilder<T, TRaw>;
|
|
9033
10314
|
/**
|
|
9034
10315
|
* Group results by an attribute (for Kanban views).
|
|
9035
10316
|
* Only status and select attributes are supported.
|
|
@@ -9720,6 +11001,36 @@ declare class ConditionExecutor implements NodeExecutor<ConditionNode> {
|
|
|
9720
11001
|
validate(node: ConditionNode): string[];
|
|
9721
11002
|
}
|
|
9722
11003
|
|
|
11004
|
+
/**
|
|
11005
|
+
* Executor for DocumentNode.
|
|
11006
|
+
*
|
|
11007
|
+
* This executor handles document generation nodes. It validates the node configuration
|
|
11008
|
+
* and creates a pending document request in the execution context.
|
|
11009
|
+
*
|
|
11010
|
+
* The actual document generation is delegated to the consumer (NestJS, Supabase, etc.)
|
|
11011
|
+
* which processes pending document requests before advancing to the next node.
|
|
11012
|
+
*
|
|
11013
|
+
* Behavior:
|
|
11014
|
+
* - Validates that templateId is set
|
|
11015
|
+
* - Creates a pending document request in context.documents
|
|
11016
|
+
* - Returns success with the next node ID
|
|
11017
|
+
*
|
|
11018
|
+
* The consumer is responsible for:
|
|
11019
|
+
* 1. Detecting pending document requests (status: "pending")
|
|
11020
|
+
* 2. Loading the template from DocumentGenerationTemplatesRepository
|
|
11021
|
+
* 3. Resolving variable values from the execution context
|
|
11022
|
+
* 4. Generating the PDF using pdf-lib
|
|
11023
|
+
* 5. Uploading the generated document to storage
|
|
11024
|
+
* 6. Attaching to target records via DocumentsRepository
|
|
11025
|
+
* 7. Updating context.documents with the final URL and metadata
|
|
11026
|
+
*/
|
|
11027
|
+
declare class DocumentExecutor implements NodeExecutor<DocumentNode> {
|
|
11028
|
+
readonly nodeType: "document";
|
|
11029
|
+
execute(node: DocumentNode, _context: ExecutorContext): ExecutorResult;
|
|
11030
|
+
canExecute(_node: DocumentNode, _context: ExecutorContext): boolean;
|
|
11031
|
+
validate(node: DocumentNode): string[];
|
|
11032
|
+
}
|
|
11033
|
+
|
|
9723
11034
|
/**
|
|
9724
11035
|
* Executor for EndNode.
|
|
9725
11036
|
* Marks the workflow as completed with an optional status.
|
|
@@ -10128,7 +11439,8 @@ interface MockStores {
|
|
|
10128
11439
|
userRoles: Map<Uuid, UserRoleAssignment>;
|
|
10129
11440
|
workflows: Map<Uuid, DBWorkflow>;
|
|
10130
11441
|
workflowInstances: Map<Uuid, DBWorkflowInstance>;
|
|
10131
|
-
|
|
11442
|
+
workflowInvitations: Map<Uuid, DBWorkflowInvitation>;
|
|
11443
|
+
workflowAccessGrants: Map<Uuid, DBWorkflowAccessGrant>;
|
|
10132
11444
|
aiConversations: Map<Uuid, AIConversation>;
|
|
10133
11445
|
aiMessages: Map<Uuid, AIMessage>;
|
|
10134
11446
|
aiUserMemory: Map<string, AIUserMemory>;
|
|
@@ -10190,51 +11502,882 @@ declare function createMockAdapter(): DatabaseAdapter & {
|
|
|
10190
11502
|
declare const notesPolicy: RecordPolicy;
|
|
10191
11503
|
|
|
10192
11504
|
/**
|
|
10193
|
-
*
|
|
11505
|
+
* Document Generation Service
|
|
11506
|
+
*
|
|
11507
|
+
* Manages document generation templates used in workflow document nodes.
|
|
11508
|
+
* Templates define how to generate PDF documents by injecting workflow
|
|
11509
|
+
* context data into PDF template files.
|
|
10194
11510
|
*/
|
|
10195
|
-
|
|
10196
|
-
name: string;
|
|
10197
|
-
label: string;
|
|
10198
|
-
description?: string;
|
|
10199
|
-
icon?: IconName;
|
|
10200
|
-
slots: WorkflowSlot[];
|
|
10201
|
-
nodes: Record<string, WorkflowNode>;
|
|
10202
|
-
startNodeId: string;
|
|
10203
|
-
layout: WorkflowLayout;
|
|
10204
|
-
participants?: ParticipantTemplate[];
|
|
10205
|
-
theme?: WorkflowTheme;
|
|
10206
|
-
config?: WorkflowConfig;
|
|
10207
|
-
metadata?: Record<string, unknown>;
|
|
10208
|
-
}
|
|
11511
|
+
|
|
10209
11512
|
/**
|
|
10210
|
-
*
|
|
11513
|
+
* Error thrown when document generation template is not found
|
|
10211
11514
|
*/
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
icon?: IconName;
|
|
10216
|
-
slots?: WorkflowSlot[];
|
|
10217
|
-
nodes?: Record<string, WorkflowNode>;
|
|
10218
|
-
startNodeId?: string;
|
|
10219
|
-
layout?: WorkflowLayout;
|
|
10220
|
-
participants?: ParticipantTemplate[];
|
|
10221
|
-
theme?: WorkflowTheme;
|
|
10222
|
-
config?: WorkflowConfig;
|
|
10223
|
-
metadata?: Record<string, unknown>;
|
|
11515
|
+
declare class DocumentGenerationTemplateNotFoundError extends Error {
|
|
11516
|
+
readonly templateId: string;
|
|
11517
|
+
constructor(templateId: string);
|
|
10224
11518
|
}
|
|
10225
11519
|
/**
|
|
10226
|
-
*
|
|
11520
|
+
* Error thrown when document generation templates repository is not available
|
|
10227
11521
|
*/
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
* System workflows to register (in-memory, not from database).
|
|
10231
|
-
*/
|
|
10232
|
-
systemWorkflows?: WorkflowDefinition[];
|
|
11522
|
+
declare class DocumentGenerationNotConfiguredError extends Error {
|
|
11523
|
+
constructor();
|
|
10233
11524
|
}
|
|
10234
11525
|
/**
|
|
10235
|
-
* Service for managing
|
|
10236
|
-
*
|
|
10237
|
-
*
|
|
11526
|
+
* Service for managing document generation templates.
|
|
11527
|
+
*
|
|
11528
|
+
* Used by:
|
|
11529
|
+
* - Workflow builder UI (create/edit templates)
|
|
11530
|
+
* - Workflow document nodes (load template for generation)
|
|
11531
|
+
* - NestJS controller (CRUD API)
|
|
11532
|
+
*
|
|
11533
|
+
* @example
|
|
11534
|
+
* ```typescript
|
|
11535
|
+
* const service = new DocumentGenerationService(adapter);
|
|
11536
|
+
*
|
|
11537
|
+
* // Create a new template
|
|
11538
|
+
* const template = await service.create({
|
|
11539
|
+
* name: "sales-contract",
|
|
11540
|
+
* label: "Sales Contract",
|
|
11541
|
+
* source: {
|
|
11542
|
+
* type: "pdf",
|
|
11543
|
+
* fileId: "file_123",
|
|
11544
|
+
* fields: [
|
|
11545
|
+
* { id: "f1", page: 0, x: 100, y: 200, width: 150, height: 20, contextPath: "slots.client.name", label: "Client Name" }
|
|
11546
|
+
* ]
|
|
11547
|
+
* }
|
|
11548
|
+
* });
|
|
11549
|
+
*
|
|
11550
|
+
* // Get template for workflow execution
|
|
11551
|
+
* const template = await service.getById(templateId);
|
|
11552
|
+
* ```
|
|
11553
|
+
*/
|
|
11554
|
+
declare class DocumentGenerationService extends BaseService {
|
|
11555
|
+
/**
|
|
11556
|
+
* Get the document generation templates repository.
|
|
11557
|
+
* @throws DocumentGenerationNotConfiguredError if repository not available
|
|
11558
|
+
*/
|
|
11559
|
+
private get repo();
|
|
11560
|
+
/**
|
|
11561
|
+
* Get a template by ID.
|
|
11562
|
+
*
|
|
11563
|
+
* @param id - Template ID
|
|
11564
|
+
* @returns Template or null if not found
|
|
11565
|
+
*/
|
|
11566
|
+
getById(id: Uuid): Promise<DocumentGenerationTemplate | null>;
|
|
11567
|
+
/**
|
|
11568
|
+
* Get a template by ID, throwing if not found.
|
|
11569
|
+
*
|
|
11570
|
+
* @param id - Template ID
|
|
11571
|
+
* @returns Template
|
|
11572
|
+
* @throws DocumentGenerationTemplateNotFoundError if not found
|
|
11573
|
+
*/
|
|
11574
|
+
getByIdOrThrow(id: Uuid): Promise<DocumentGenerationTemplate>;
|
|
11575
|
+
/**
|
|
11576
|
+
* Get a template by name.
|
|
11577
|
+
*
|
|
11578
|
+
* @param name - Template name (unique within tenant)
|
|
11579
|
+
* @returns Template or null if not found
|
|
11580
|
+
*/
|
|
11581
|
+
getByName(name: string): Promise<DocumentGenerationTemplate | null>;
|
|
11582
|
+
/**
|
|
11583
|
+
* List templates for the current tenant.
|
|
11584
|
+
*
|
|
11585
|
+
* @param options - List options (sourceType filter, pagination)
|
|
11586
|
+
* @returns Array of templates
|
|
11587
|
+
*/
|
|
11588
|
+
list(options?: {
|
|
11589
|
+
sourceType?: "pdf" | "docx";
|
|
11590
|
+
limit?: number;
|
|
11591
|
+
offset?: number;
|
|
11592
|
+
}): Promise<DocumentGenerationTemplate[]>;
|
|
11593
|
+
/**
|
|
11594
|
+
* Create a new document generation template.
|
|
11595
|
+
*
|
|
11596
|
+
* @param input - Template data
|
|
11597
|
+
* @returns Created template
|
|
11598
|
+
*/
|
|
11599
|
+
create(input: CreateDocumentGenerationTemplate): Promise<DocumentGenerationTemplate>;
|
|
11600
|
+
/**
|
|
11601
|
+
* Update a template.
|
|
11602
|
+
*
|
|
11603
|
+
* @param id - Template ID
|
|
11604
|
+
* @param input - Fields to update
|
|
11605
|
+
* @returns Updated template
|
|
11606
|
+
*/
|
|
11607
|
+
update(id: Uuid, input: UpdateDocumentGenerationTemplate): Promise<DocumentGenerationTemplate>;
|
|
11608
|
+
/**
|
|
11609
|
+
* Delete a template.
|
|
11610
|
+
*
|
|
11611
|
+
* @param id - Template ID
|
|
11612
|
+
*/
|
|
11613
|
+
delete(id: Uuid): Promise<void>;
|
|
11614
|
+
}
|
|
11615
|
+
|
|
11616
|
+
/**
|
|
11617
|
+
* Options for FileService constructor
|
|
11618
|
+
*/
|
|
11619
|
+
interface FileServiceOptions {
|
|
11620
|
+
/**
|
|
11621
|
+
* Audit service for logging file operations.
|
|
11622
|
+
* If provided, audit logging is enabled using userId from context.
|
|
11623
|
+
* If not provided, no audit logs are created (backward compatible).
|
|
11624
|
+
*/
|
|
11625
|
+
auditService?: AuditService;
|
|
11626
|
+
}
|
|
11627
|
+
/**
|
|
11628
|
+
* Service for managing files.
|
|
11629
|
+
*
|
|
11630
|
+
* Handles file metadata CRUD, permissions, storage operations, and audit logging.
|
|
11631
|
+
* Works with optional StorageAdapter for file upload/download operations.
|
|
11632
|
+
* Automatically uses tenant context from AsyncLocalStorage.
|
|
11633
|
+
*
|
|
11634
|
+
* @example
|
|
11635
|
+
* ```typescript
|
|
11636
|
+
* // Basic usage (metadata only)
|
|
11637
|
+
* const service = new FileService(adapter);
|
|
11638
|
+
*
|
|
11639
|
+
* // With audit logging
|
|
11640
|
+
* const auditService = new AuditService(adapter);
|
|
11641
|
+
* const service = new FileService(adapter, { auditService });
|
|
11642
|
+
*
|
|
11643
|
+
* // Upload file (requires StorageAdapter)
|
|
11644
|
+
* const file = await service.uploadFile({
|
|
11645
|
+
* content: fileBuffer,
|
|
11646
|
+
* fileName: "contract.pdf",
|
|
11647
|
+
* mimeType: "application/pdf",
|
|
11648
|
+
* size: 12345,
|
|
11649
|
+
* uploadedBy: "user-456",
|
|
11650
|
+
* });
|
|
11651
|
+
* ```
|
|
11652
|
+
*/
|
|
11653
|
+
declare class FileService extends BaseService {
|
|
11654
|
+
private auditService?;
|
|
11655
|
+
constructor(adapter: DatabaseAdapter, options?: FileServiceOptions);
|
|
11656
|
+
/**
|
|
11657
|
+
* Upload a file to storage and create metadata record.
|
|
11658
|
+
*
|
|
11659
|
+
* This method orchestrates:
|
|
11660
|
+
* 1. Upload to storage (via StorageAdapter)
|
|
11661
|
+
* 2. Create file metadata in database
|
|
11662
|
+
* 3. Audit log the operation
|
|
11663
|
+
*
|
|
11664
|
+
* Requires `adapter.storage` to be configured.
|
|
11665
|
+
*
|
|
11666
|
+
* @param input - File content and metadata
|
|
11667
|
+
* @returns Created file record
|
|
11668
|
+
* @throws Error if StorageAdapter is not configured
|
|
11669
|
+
*
|
|
11670
|
+
* @example
|
|
11671
|
+
* ```typescript
|
|
11672
|
+
* const file = await service.uploadFile({
|
|
11673
|
+
* content: fileBuffer,
|
|
11674
|
+
* fileName: "document.pdf",
|
|
11675
|
+
* mimeType: "application/pdf",
|
|
11676
|
+
* size: 12345,
|
|
11677
|
+
* uploadedBy: "user-123",
|
|
11678
|
+
* visibility: "private",
|
|
11679
|
+
* folderPath: "/documents",
|
|
11680
|
+
* tags: ["contract", "2025"],
|
|
11681
|
+
* });
|
|
11682
|
+
* ```
|
|
11683
|
+
*/
|
|
11684
|
+
uploadFile(input: UploadFileInput): Promise<File>;
|
|
11685
|
+
/**
|
|
11686
|
+
* Create a new file record (after upload to storage).
|
|
11687
|
+
*
|
|
11688
|
+
* Use this method when handling storage externally (e.g., with Multer + S3).
|
|
11689
|
+
* For integrated upload, use `uploadFile()` instead.
|
|
11690
|
+
*
|
|
11691
|
+
* @param data - File metadata
|
|
11692
|
+
* @returns Created file record
|
|
11693
|
+
*
|
|
11694
|
+
* @example
|
|
11695
|
+
* ```typescript
|
|
11696
|
+
* // After uploading to S3 with Multer
|
|
11697
|
+
* const file = await service.createFile({
|
|
11698
|
+
* tenantId: "tenant-123",
|
|
11699
|
+
* name: "contract-2025.pdf",
|
|
11700
|
+
* originalName: "Contract Acme Corp 2025.pdf",
|
|
11701
|
+
* mimeType: "application/pdf",
|
|
11702
|
+
* size: 2458624,
|
|
11703
|
+
* storageProvider: "s3",
|
|
11704
|
+
* storagePath: "tenants/123/files/2025/contract.pdf",
|
|
11705
|
+
* storageBucket: "my-app-files",
|
|
11706
|
+
* url: "https://cdn.example.com/files/file-123",
|
|
11707
|
+
* uploadedBy: "profile-456",
|
|
11708
|
+
* visibility: "private"
|
|
11709
|
+
* });
|
|
11710
|
+
* ```
|
|
11711
|
+
*/
|
|
11712
|
+
createFile(data: CreateFile): Promise<File>;
|
|
11713
|
+
/**
|
|
11714
|
+
* Get file by ID
|
|
11715
|
+
*/
|
|
11716
|
+
getFile(fileId: string): Promise<File | null>;
|
|
11717
|
+
/**
|
|
11718
|
+
* Get file by ID or throw
|
|
11719
|
+
*/
|
|
11720
|
+
getFileOrThrow(fileId: string): Promise<File>;
|
|
11721
|
+
/**
|
|
11722
|
+
* Update file metadata
|
|
11723
|
+
*
|
|
11724
|
+
* @param fileId - File UUID
|
|
11725
|
+
* @param data - Data to update
|
|
11726
|
+
* @returns Updated file
|
|
11727
|
+
*/
|
|
11728
|
+
updateFile(fileId: string, data: UpdateFile): Promise<File>;
|
|
11729
|
+
/**
|
|
11730
|
+
* Delete file (soft delete by default)
|
|
11731
|
+
*
|
|
11732
|
+
* @param fileId - File UUID
|
|
11733
|
+
* @param options - Delete options
|
|
11734
|
+
*/
|
|
11735
|
+
deleteFile(fileId: string, options?: {
|
|
11736
|
+
hard?: boolean;
|
|
11737
|
+
checkOwnership?: boolean;
|
|
11738
|
+
userId?: string;
|
|
11739
|
+
}): Promise<void>;
|
|
11740
|
+
/**
|
|
11741
|
+
* Delete file from both storage and database.
|
|
11742
|
+
*
|
|
11743
|
+
* Requires `adapter.storage` to be configured.
|
|
11744
|
+
*
|
|
11745
|
+
* @param fileId - File UUID
|
|
11746
|
+
* @param options - Delete options
|
|
11747
|
+
* @throws Error if StorageAdapter is not configured
|
|
11748
|
+
*/
|
|
11749
|
+
deleteFileWithStorage(fileId: string, options?: {
|
|
11750
|
+
hard?: boolean;
|
|
11751
|
+
}): Promise<void>;
|
|
11752
|
+
/**
|
|
11753
|
+
* Delete multiple files
|
|
11754
|
+
*
|
|
11755
|
+
* @param fileIds - Array of file UUIDs
|
|
11756
|
+
* @param options - Delete options
|
|
11757
|
+
*/
|
|
11758
|
+
bulkDelete(fileIds: string[], options?: {
|
|
11759
|
+
hard?: boolean;
|
|
11760
|
+
deleteFromStorage?: boolean;
|
|
11761
|
+
}): Promise<void>;
|
|
11762
|
+
/**
|
|
11763
|
+
* List files for the tenant
|
|
11764
|
+
*/
|
|
11765
|
+
listFiles(options?: FileListOptions): Promise<File[]>;
|
|
11766
|
+
/**
|
|
11767
|
+
* List files by folder
|
|
11768
|
+
*/
|
|
11769
|
+
listFilesByFolder(folderPath: string): Promise<File[]>;
|
|
11770
|
+
/**
|
|
11771
|
+
* List files uploaded by a specific user
|
|
11772
|
+
*/
|
|
11773
|
+
listFilesByUploader(uploadedBy: string): Promise<File[]>;
|
|
11774
|
+
/**
|
|
11775
|
+
* Get a signed URL for private file access.
|
|
11776
|
+
*
|
|
11777
|
+
* Checks access permissions before generating URL.
|
|
11778
|
+
* Requires `adapter.storage` to be configured.
|
|
11779
|
+
*
|
|
11780
|
+
* @param fileId - File UUID
|
|
11781
|
+
* @param userId - User requesting access
|
|
11782
|
+
* @param options - Signed URL options
|
|
11783
|
+
* @returns Signed URL
|
|
11784
|
+
* @throws Error if user doesn't have access or StorageAdapter is not configured
|
|
11785
|
+
*
|
|
11786
|
+
* @example
|
|
11787
|
+
* ```typescript
|
|
11788
|
+
* const url = await service.getSignedUrl("file-123", "user-456", {
|
|
11789
|
+
* expiresIn: 3600, // 1 hour
|
|
11790
|
+
* });
|
|
11791
|
+
* ```
|
|
11792
|
+
*/
|
|
11793
|
+
getSignedUrl(fileId: string, userId: string, options?: SignedUrlOptions): Promise<string>;
|
|
11794
|
+
/**
|
|
11795
|
+
* Check if user has access to a file
|
|
11796
|
+
*
|
|
11797
|
+
* @param fileId - File UUID
|
|
11798
|
+
* @param userId - User ID to check
|
|
11799
|
+
* @returns true if user can access the file
|
|
11800
|
+
*/
|
|
11801
|
+
checkAccess(fileId: string, userId: string): Promise<boolean>;
|
|
11802
|
+
/**
|
|
11803
|
+
* @deprecated Use checkAccess() instead
|
|
11804
|
+
*/
|
|
11805
|
+
canAccess(fileId: string, userId: string): Promise<boolean>;
|
|
11806
|
+
/**
|
|
11807
|
+
* Change file visibility
|
|
11808
|
+
*
|
|
11809
|
+
* @param fileId - File UUID
|
|
11810
|
+
* @param visibility - New visibility level
|
|
11811
|
+
* @param allowedUsers - Users allowed to access (if restricted)
|
|
11812
|
+
*/
|
|
11813
|
+
changeVisibility(fileId: string, visibility: FileVisibility, allowedUsers?: string[]): Promise<File>;
|
|
11814
|
+
/**
|
|
11815
|
+
* Grant access to a file for specific users
|
|
11816
|
+
*
|
|
11817
|
+
* @param fileId - File UUID
|
|
11818
|
+
* @param userIds - User IDs to grant access
|
|
11819
|
+
*/
|
|
11820
|
+
grantAccess(fileId: string, userIds: string[]): Promise<File>;
|
|
11821
|
+
/**
|
|
11822
|
+
* Revoke access to a file for specific users
|
|
11823
|
+
*
|
|
11824
|
+
* @param fileId - File UUID
|
|
11825
|
+
* @param userIds - User IDs to revoke access
|
|
11826
|
+
*/
|
|
11827
|
+
revokeAccess(fileId: string, userIds: string[]): Promise<File>;
|
|
11828
|
+
/**
|
|
11829
|
+
* Move file to different folder
|
|
11830
|
+
*/
|
|
11831
|
+
moveToFolder(fileId: string, newFolderPath: string): Promise<File>;
|
|
11832
|
+
/**
|
|
11833
|
+
* Add tags to file
|
|
11834
|
+
*/
|
|
11835
|
+
addTags(fileId: string, tags: string[]): Promise<File>;
|
|
11836
|
+
/**
|
|
11837
|
+
* Remove tags from file
|
|
11838
|
+
*/
|
|
11839
|
+
removeTags(fileId: string, tags: string[]): Promise<File>;
|
|
11840
|
+
}
|
|
11841
|
+
|
|
11842
|
+
/**
|
|
11843
|
+
* Service for managing document templates.
|
|
11844
|
+
*
|
|
11845
|
+
* Templates define the structure of documents (slots, auto-processing, etc.).
|
|
11846
|
+
* System templates are defined in code and available to all tenants.
|
|
11847
|
+
* Custom templates can be created by tenants for specific needs.
|
|
11848
|
+
*
|
|
11849
|
+
* @example
|
|
11850
|
+
* ```typescript
|
|
11851
|
+
* const service = new DocumentTemplateService(adapter);
|
|
11852
|
+
*
|
|
11853
|
+
* // Get a template by name (checks custom first, then system)
|
|
11854
|
+
* const template = await service.getTemplateByName("french_id_card");
|
|
11855
|
+
*
|
|
11856
|
+
* // List all available templates
|
|
11857
|
+
* const templates = await service.listTemplates();
|
|
11858
|
+
*
|
|
11859
|
+
* // Create a custom template
|
|
11860
|
+
* const customTemplate = await service.createTemplate({
|
|
11861
|
+
* name: "company_contract",
|
|
11862
|
+
* label: "Contrat d'entreprise",
|
|
11863
|
+
* slots: [{ name: "contract", label: "Contrat", required: true, order: 1 }],
|
|
11864
|
+
* });
|
|
11865
|
+
* ```
|
|
11866
|
+
*/
|
|
11867
|
+
declare class DocumentTemplateService extends BaseService {
|
|
11868
|
+
constructor(adapter: DatabaseAdapter);
|
|
11869
|
+
/**
|
|
11870
|
+
* Get a template by ID.
|
|
11871
|
+
* Checks custom templates first, then system templates.
|
|
11872
|
+
*/
|
|
11873
|
+
getTemplate(templateId: string): Promise<DocumentTemplate | null>;
|
|
11874
|
+
/**
|
|
11875
|
+
* Get a template by name.
|
|
11876
|
+
* Checks custom templates first (tenant-specific), then system templates.
|
|
11877
|
+
*/
|
|
11878
|
+
getTemplateByName(name: string): Promise<DocumentTemplate | null>;
|
|
11879
|
+
/**
|
|
11880
|
+
* Get multiple templates by names.
|
|
11881
|
+
*/
|
|
11882
|
+
getTemplatesByNames(names: string[]): Promise<DocumentTemplate[]>;
|
|
11883
|
+
/**
|
|
11884
|
+
* Get a template or throw if not found.
|
|
11885
|
+
*/
|
|
11886
|
+
getTemplateOrThrow(templateId: string): Promise<DocumentTemplate>;
|
|
11887
|
+
/**
|
|
11888
|
+
* Get a template by name or throw if not found.
|
|
11889
|
+
*/
|
|
11890
|
+
getTemplateByNameOrThrow(name: string): Promise<DocumentTemplate>;
|
|
11891
|
+
/**
|
|
11892
|
+
* List all available templates.
|
|
11893
|
+
* Includes both system templates and tenant-specific templates.
|
|
11894
|
+
*/
|
|
11895
|
+
listTemplates(options?: DocumentTemplateListOptions): Promise<DocumentTemplate[]>;
|
|
11896
|
+
/**
|
|
11897
|
+
* Get only system templates.
|
|
11898
|
+
*/
|
|
11899
|
+
getSystemTemplates(): DocumentTemplate[];
|
|
11900
|
+
/**
|
|
11901
|
+
* Create a custom template.
|
|
11902
|
+
* System templates cannot be created via this method.
|
|
11903
|
+
*/
|
|
11904
|
+
createTemplate(data: CreateDocumentTemplate): Promise<DocumentTemplate>;
|
|
11905
|
+
/**
|
|
11906
|
+
* Update a custom template.
|
|
11907
|
+
* System templates cannot be updated.
|
|
11908
|
+
*/
|
|
11909
|
+
updateTemplate(templateId: string, data: UpdateDocumentTemplate): Promise<DocumentTemplate>;
|
|
11910
|
+
/**
|
|
11911
|
+
* Delete a custom template.
|
|
11912
|
+
* System templates cannot be deleted.
|
|
11913
|
+
*/
|
|
11914
|
+
deleteTemplate(templateId: string): Promise<void>;
|
|
11915
|
+
}
|
|
11916
|
+
|
|
11917
|
+
interface RecordDocumentsResult {
|
|
11918
|
+
/** Documents grouped by attribute name (includes system 'attachments' attribute) */
|
|
11919
|
+
byAttribute: Record<string, Document[]>;
|
|
11920
|
+
/** Total count of all documents */
|
|
11921
|
+
total: number;
|
|
11922
|
+
}
|
|
11923
|
+
interface CreateRecordDocumentInput {
|
|
11924
|
+
/** Object name (used for folder path) */
|
|
11925
|
+
objectName: string;
|
|
11926
|
+
/** Record ID (used for folder path) */
|
|
11927
|
+
recordId: string;
|
|
11928
|
+
/** File content */
|
|
11929
|
+
fileContent: Buffer;
|
|
11930
|
+
/** Original file name */
|
|
11931
|
+
fileName: string;
|
|
11932
|
+
/** MIME type */
|
|
11933
|
+
mimeType: string;
|
|
11934
|
+
/** File size */
|
|
11935
|
+
fileSize: number;
|
|
11936
|
+
/** User ID who uploads */
|
|
11937
|
+
uploadedBy: string;
|
|
11938
|
+
/** Optional document title (defaults to fileName) */
|
|
11939
|
+
title?: string;
|
|
11940
|
+
/** Optional template ID (defaults to generic_document) */
|
|
11941
|
+
templateId?: string;
|
|
11942
|
+
}
|
|
11943
|
+
interface CreateRecordDocumentResult {
|
|
11944
|
+
document: Document;
|
|
11945
|
+
file: {
|
|
11946
|
+
id: string;
|
|
11947
|
+
url?: string;
|
|
11948
|
+
};
|
|
11949
|
+
slot: DocumentSlot;
|
|
11950
|
+
}
|
|
11951
|
+
interface DocumentServiceOptions {
|
|
11952
|
+
/**
|
|
11953
|
+
* Template service instance.
|
|
11954
|
+
* If not provided, a new one will be created.
|
|
11955
|
+
*/
|
|
11956
|
+
templateService?: DocumentTemplateService;
|
|
11957
|
+
/**
|
|
11958
|
+
* File service instance (required for createRecordDocument).
|
|
11959
|
+
*/
|
|
11960
|
+
fileService?: FileService;
|
|
11961
|
+
}
|
|
11962
|
+
/**
|
|
11963
|
+
* Service for managing documents.
|
|
11964
|
+
*
|
|
11965
|
+
* Documents are structured wrappers around files with:
|
|
11966
|
+
* - Template-based structure (slots)
|
|
11967
|
+
* - Status tracking (draft, pending, processing, completed, failed, signed)
|
|
11968
|
+
* - Processing jobs (OCR, signature, verification)
|
|
11969
|
+
*
|
|
11970
|
+
* Documents are linked to records via `record.values` (document attribute).
|
|
11971
|
+
*
|
|
11972
|
+
* @example
|
|
11973
|
+
* ```typescript
|
|
11974
|
+
* const service = new DocumentService(adapter);
|
|
11975
|
+
*
|
|
11976
|
+
* // Create a document
|
|
11977
|
+
* const document = await service.createDocument({
|
|
11978
|
+
* templateId: SYSTEM_TEMPLATE_IDS.FRENCH_ID_CARD,
|
|
11979
|
+
* title: "CNI - Jean Dupont",
|
|
11980
|
+
* });
|
|
11981
|
+
*
|
|
11982
|
+
* // Add files to slots
|
|
11983
|
+
* await service.addSlot(document.id, {
|
|
11984
|
+
* slotName: "front",
|
|
11985
|
+
* fileId: "file-123",
|
|
11986
|
+
* });
|
|
11987
|
+
*
|
|
11988
|
+
* // Get document with slots
|
|
11989
|
+
* const doc = await service.getDocument(document.id);
|
|
11990
|
+
* const slots = await service.getSlots(document.id);
|
|
11991
|
+
* ```
|
|
11992
|
+
*/
|
|
11993
|
+
declare class DocumentService extends BaseService {
|
|
11994
|
+
private templateService;
|
|
11995
|
+
private fileService;
|
|
11996
|
+
constructor(adapter: DatabaseAdapter, options?: DocumentServiceOptions);
|
|
11997
|
+
/**
|
|
11998
|
+
* Create a new document.
|
|
11999
|
+
*
|
|
12000
|
+
* @param data - Document creation data
|
|
12001
|
+
* @returns Created document with status "draft"
|
|
12002
|
+
*/
|
|
12003
|
+
createDocument(data: CreateDocument): Promise<Document>;
|
|
12004
|
+
/**
|
|
12005
|
+
* Create a document with a template name instead of ID.
|
|
12006
|
+
*/
|
|
12007
|
+
createDocumentByTemplateName(templateName: string, data: Omit<CreateDocument, "templateId">): Promise<Document>;
|
|
12008
|
+
/**
|
|
12009
|
+
* Get a document by ID.
|
|
12010
|
+
*/
|
|
12011
|
+
getDocument(documentId: string): Promise<Document | null>;
|
|
12012
|
+
/**
|
|
12013
|
+
* Get a document by ID or throw if not found.
|
|
12014
|
+
*/
|
|
12015
|
+
getDocumentOrThrow(documentId: string): Promise<Document>;
|
|
12016
|
+
/**
|
|
12017
|
+
* Get multiple documents by IDs.
|
|
12018
|
+
*/
|
|
12019
|
+
getDocuments(documentIds: string[]): Promise<Document[]>;
|
|
12020
|
+
/**
|
|
12021
|
+
* Get the template for a document.
|
|
12022
|
+
*/
|
|
12023
|
+
getDocumentTemplate(documentId: string): Promise<DocumentTemplate>;
|
|
12024
|
+
/**
|
|
12025
|
+
* List documents with optional filters.
|
|
12026
|
+
*/
|
|
12027
|
+
listDocuments(options?: DocumentListOptions): Promise<Document[]>;
|
|
12028
|
+
/**
|
|
12029
|
+
* Search documents by text.
|
|
12030
|
+
*/
|
|
12031
|
+
searchDocuments(query: string, options?: DocumentListOptions): Promise<Document[]>;
|
|
12032
|
+
/**
|
|
12033
|
+
* Update a document's metadata.
|
|
12034
|
+
*/
|
|
12035
|
+
updateDocument(documentId: string, data: {
|
|
12036
|
+
title?: string;
|
|
12037
|
+
description?: string;
|
|
12038
|
+
tags?: string[];
|
|
12039
|
+
}): Promise<Document>;
|
|
12040
|
+
/**
|
|
12041
|
+
* Update document status.
|
|
12042
|
+
* This is usually called automatically based on slots and jobs.
|
|
12043
|
+
*/
|
|
12044
|
+
updateStatus(documentId: string, status: DocumentStatus): Promise<Document>;
|
|
12045
|
+
/**
|
|
12046
|
+
* Soft delete a document.
|
|
12047
|
+
*/
|
|
12048
|
+
deleteDocument(documentId: string): Promise<void>;
|
|
12049
|
+
/**
|
|
12050
|
+
* Hard delete a document and all its slots.
|
|
12051
|
+
*/
|
|
12052
|
+
hardDeleteDocument(documentId: string): Promise<void>;
|
|
12053
|
+
/**
|
|
12054
|
+
* Get all slots for a document.
|
|
12055
|
+
*/
|
|
12056
|
+
getSlots(documentId: string): Promise<DocumentSlot[]>;
|
|
12057
|
+
/**
|
|
12058
|
+
* Add a file to a document slot.
|
|
12059
|
+
*/
|
|
12060
|
+
addSlot(documentId: string, data: Omit<CreateDocumentSlot, "documentId">): Promise<DocumentSlot>;
|
|
12061
|
+
/**
|
|
12062
|
+
* Remove a slot from a document.
|
|
12063
|
+
*/
|
|
12064
|
+
removeSlot(slotId: string): Promise<void>;
|
|
12065
|
+
/**
|
|
12066
|
+
* Recalculate and update document status based on slots and jobs.
|
|
12067
|
+
*
|
|
12068
|
+
* Status flow:
|
|
12069
|
+
* - draft: Missing required slots
|
|
12070
|
+
* - pending: All required slots filled, no processing started
|
|
12071
|
+
* - processing: At least one job is pending or processing
|
|
12072
|
+
* - completed: All jobs completed successfully (no signature)
|
|
12073
|
+
* - signed: Signature job completed successfully
|
|
12074
|
+
* - failed: At least one job failed
|
|
12075
|
+
*/
|
|
12076
|
+
recalculateStatus(documentId: string): Promise<Document>;
|
|
12077
|
+
/**
|
|
12078
|
+
* Check if a document is complete (all required slots filled).
|
|
12079
|
+
*/
|
|
12080
|
+
isComplete(documentId: string): Promise<boolean>;
|
|
12081
|
+
/**
|
|
12082
|
+
* Get document with its template and slots.
|
|
12083
|
+
*/
|
|
12084
|
+
getDocumentWithDetails(documentId: string): Promise<{
|
|
12085
|
+
document: Document;
|
|
12086
|
+
template: DocumentTemplate;
|
|
12087
|
+
slots: DocumentSlot[];
|
|
12088
|
+
}>;
|
|
12089
|
+
/**
|
|
12090
|
+
* Get all documents attached to a record.
|
|
12091
|
+
*
|
|
12092
|
+
* Retrieves documents from document attributes in record values.
|
|
12093
|
+
* This includes the system 'attachments' attribute for free-form documents.
|
|
12094
|
+
*
|
|
12095
|
+
* @param schema - Object schema with attributes
|
|
12096
|
+
* @param recordValues - Record values containing document IDs
|
|
12097
|
+
*/
|
|
12098
|
+
getRecordDocuments(schema: ObjectDefinition, recordValues: Record<string, unknown>): Promise<RecordDocumentsResult>;
|
|
12099
|
+
/**
|
|
12100
|
+
* Create a document for a record.
|
|
12101
|
+
*
|
|
12102
|
+
* This method:
|
|
12103
|
+
* 1. Uploads the file
|
|
12104
|
+
* 2. Creates a document with the specified template
|
|
12105
|
+
* 3. Adds the file to the document slot
|
|
12106
|
+
*
|
|
12107
|
+
* Note: The caller is responsible for updating record.values with the document ID.
|
|
12108
|
+
*
|
|
12109
|
+
* @param input - Document creation input
|
|
12110
|
+
*/
|
|
12111
|
+
createRecordDocument(input: CreateRecordDocumentInput): Promise<CreateRecordDocumentResult>;
|
|
12112
|
+
}
|
|
12113
|
+
|
|
12114
|
+
/**
|
|
12115
|
+
* Document Processing Hook
|
|
12116
|
+
*
|
|
12117
|
+
* Processes pending document generation requests in workflow execution context.
|
|
12118
|
+
* Called after each node execution to fulfill document generation.
|
|
12119
|
+
*/
|
|
12120
|
+
|
|
12121
|
+
/**
|
|
12122
|
+
* Options for the document processing hook
|
|
12123
|
+
*/
|
|
12124
|
+
interface DocumentProcessingHookOptions {
|
|
12125
|
+
/** Document generation service for loading templates */
|
|
12126
|
+
documentGenerationService: DocumentGenerationService;
|
|
12127
|
+
/** Document service for creating record documents */
|
|
12128
|
+
documentService?: DocumentService;
|
|
12129
|
+
/** Record service for updating records with attachments */
|
|
12130
|
+
recordService?: RecordService;
|
|
12131
|
+
/** Schema service for attribute definitions (enables intelligent formatting) */
|
|
12132
|
+
schemaService?: ObjectSchemaService;
|
|
12133
|
+
/** Relation service for resolving relation labels */
|
|
12134
|
+
relationService?: RelationService;
|
|
12135
|
+
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Hook for processing pending document generation requests.
|
|
12138
|
+
*
|
|
12139
|
+
* This hook is called after each node execution in WorkflowInstanceService.
|
|
12140
|
+
* It detects pending document requests in context.documents and:
|
|
12141
|
+
* 1. Loads the template
|
|
12142
|
+
* 2. Renders the PDF using DocumentRendererService
|
|
12143
|
+
* 3. Uploads the generated PDF
|
|
12144
|
+
* 4. Attaches to target records
|
|
12145
|
+
* 5. Updates context.documents with the result
|
|
12146
|
+
*
|
|
12147
|
+
* @example
|
|
12148
|
+
* ```typescript
|
|
12149
|
+
* const hook = new DocumentProcessingHook(
|
|
12150
|
+
* adapter,
|
|
12151
|
+
* storageAdapter,
|
|
12152
|
+
* {
|
|
12153
|
+
* documentGenerationService,
|
|
12154
|
+
* documentService,
|
|
12155
|
+
* recordService,c
|
|
12156
|
+
* }
|
|
12157
|
+
* );
|
|
12158
|
+
*
|
|
12159
|
+
* // In WorkflowInstanceService.executeCurrentNode()
|
|
12160
|
+
* const processedContext = await hook.process(context, workflow, userId);
|
|
12161
|
+
* ```
|
|
12162
|
+
*/
|
|
12163
|
+
declare class DocumentProcessingHook extends BaseService {
|
|
12164
|
+
readonly adapter: DatabaseAdapter;
|
|
12165
|
+
private readonly storageAdapter;
|
|
12166
|
+
private readonly options;
|
|
12167
|
+
private readonly renderer;
|
|
12168
|
+
constructor(adapter: DatabaseAdapter, storageAdapter: StorageAdapter, options: DocumentProcessingHookOptions);
|
|
12169
|
+
/**
|
|
12170
|
+
* Process all pending document requests in the context.
|
|
12171
|
+
*
|
|
12172
|
+
* @param context - Current workflow execution context
|
|
12173
|
+
* @param workflow - Workflow definition (for slot/object info)
|
|
12174
|
+
* @param userId - User ID for audit/permissions
|
|
12175
|
+
* @returns Updated context with processed documents
|
|
12176
|
+
*/
|
|
12177
|
+
process(context: WorkflowExecutionContext, workflow: WorkflowDefinition, userId: string): Promise<WorkflowExecutionContext>;
|
|
12178
|
+
/**
|
|
12179
|
+
* Find node IDs with pending document requests
|
|
12180
|
+
*/
|
|
12181
|
+
private findPendingDocuments;
|
|
12182
|
+
/**
|
|
12183
|
+
* Upload the generated PDF to storage
|
|
12184
|
+
*/
|
|
12185
|
+
private uploadGeneratedDocument;
|
|
12186
|
+
/**
|
|
12187
|
+
* Attach generated document to target records
|
|
12188
|
+
*/
|
|
12189
|
+
private attachToRecords;
|
|
12190
|
+
}
|
|
12191
|
+
|
|
12192
|
+
declare class GrantNotFoundError extends Error {
|
|
12193
|
+
grantId: string;
|
|
12194
|
+
constructor(grantId: string);
|
|
12195
|
+
}
|
|
12196
|
+
declare class GrantExpiredError extends Error {
|
|
12197
|
+
grantId: string;
|
|
12198
|
+
constructor(grantId: string);
|
|
12199
|
+
}
|
|
12200
|
+
declare class GrantRevokedError extends Error {
|
|
12201
|
+
grantId: string;
|
|
12202
|
+
constructor(grantId: string);
|
|
12203
|
+
}
|
|
12204
|
+
declare class TokenRevokedError extends Error {
|
|
12205
|
+
grantId: string;
|
|
12206
|
+
jti: string;
|
|
12207
|
+
constructor(grantId: string, jti: string);
|
|
12208
|
+
}
|
|
12209
|
+
interface GrantServiceConfig {
|
|
12210
|
+
/** Default grant validity in days (default: 30) */
|
|
12211
|
+
defaultValidityDays?: number;
|
|
12212
|
+
/** Access token TTL (default: "7d") */
|
|
12213
|
+
accessTokenTTL?: string;
|
|
12214
|
+
}
|
|
12215
|
+
interface CreateGrantResult {
|
|
12216
|
+
grant: WorkflowAccessGrant;
|
|
12217
|
+
accessToken: string;
|
|
12218
|
+
}
|
|
12219
|
+
/**
|
|
12220
|
+
* Service for managing workflow access grants.
|
|
12221
|
+
*
|
|
12222
|
+
* Grants are created after a user successfully authenticates via magic link.
|
|
12223
|
+
* They allow the user to access the workflow with JWT access tokens.
|
|
12224
|
+
*
|
|
12225
|
+
* Key features:
|
|
12226
|
+
* - Grants have an expiration date (validUntil)
|
|
12227
|
+
* - Grants can be revoked entirely (revokedAt)
|
|
12228
|
+
* - Individual tokens can be revoked (revokedTokenJtis)
|
|
12229
|
+
*
|
|
12230
|
+
* @example
|
|
12231
|
+
* ```typescript
|
|
12232
|
+
* const grantService = new WorkflowAccessGrantService(adapter, jwtService, {
|
|
12233
|
+
* defaultValidityDays: 30,
|
|
12234
|
+
* });
|
|
12235
|
+
*
|
|
12236
|
+
* // Create grant after magic link acceptance
|
|
12237
|
+
* const { grant, accessToken } = await grantService.createGrant({
|
|
12238
|
+
* invitationId: "inv_123",
|
|
12239
|
+
* instanceId: "inst_456",
|
|
12240
|
+
* grantedTo: "client@example.com",
|
|
12241
|
+
* });
|
|
12242
|
+
*
|
|
12243
|
+
* // Later: revoke a specific token
|
|
12244
|
+
* await grantService.revokeToken(grant.id, "jti_to_revoke");
|
|
12245
|
+
*
|
|
12246
|
+
* // Or revoke the entire grant
|
|
12247
|
+
* await grantService.revokeGrant(grant.id);
|
|
12248
|
+
* ```
|
|
12249
|
+
*/
|
|
12250
|
+
declare class WorkflowAccessGrantService extends BaseService {
|
|
12251
|
+
private jwtService;
|
|
12252
|
+
private config;
|
|
12253
|
+
constructor(adapter: DatabaseAdapter, jwtService: WorkflowJwtService, config?: GrantServiceConfig);
|
|
12254
|
+
/**
|
|
12255
|
+
* Find grant by ID
|
|
12256
|
+
*/
|
|
12257
|
+
findById(id: Uuid): Promise<WorkflowAccessGrant | null>;
|
|
12258
|
+
/**
|
|
12259
|
+
* Find grants by invitation ID
|
|
12260
|
+
*/
|
|
12261
|
+
findByInvitationId(invitationId: Uuid): Promise<WorkflowAccessGrant[]>;
|
|
12262
|
+
/**
|
|
12263
|
+
* Find grants by instance ID
|
|
12264
|
+
*/
|
|
12265
|
+
findByInstanceId(instanceId: Uuid): Promise<WorkflowAccessGrant[]>;
|
|
12266
|
+
/**
|
|
12267
|
+
* Find grants by email
|
|
12268
|
+
*/
|
|
12269
|
+
findByEmail(email: string): Promise<WorkflowAccessGrant[]>;
|
|
12270
|
+
/**
|
|
12271
|
+
* Create a new access grant and generate an access token.
|
|
12272
|
+
*
|
|
12273
|
+
* This is called after a magic link has been successfully verified.
|
|
12274
|
+
*/
|
|
12275
|
+
createGrant(input: CreateGrantInput): Promise<CreateGrantResult>;
|
|
12276
|
+
/**
|
|
12277
|
+
* Revoke an entire grant.
|
|
12278
|
+
*
|
|
12279
|
+
* After revocation, all tokens issued for this grant will be invalid.
|
|
12280
|
+
*/
|
|
12281
|
+
revokeGrant(grantId: Uuid): Promise<WorkflowAccessGrant>;
|
|
12282
|
+
/**
|
|
12283
|
+
* Revoke a specific token by its JTI.
|
|
12284
|
+
*
|
|
12285
|
+
* This allows revoking a single token without invalidating other tokens.
|
|
12286
|
+
* Useful for logout or token refresh scenarios.
|
|
12287
|
+
*/
|
|
12288
|
+
revokeToken(grantId: Uuid, jti: string): Promise<WorkflowAccessGrant>;
|
|
12289
|
+
/**
|
|
12290
|
+
* Update the last used timestamp for a grant.
|
|
12291
|
+
*/
|
|
12292
|
+
updateLastUsed(grantId: Uuid): Promise<void>;
|
|
12293
|
+
/**
|
|
12294
|
+
* Issue a new access token for an existing grant.
|
|
12295
|
+
*
|
|
12296
|
+
* Used for token refresh scenarios.
|
|
12297
|
+
*/
|
|
12298
|
+
refreshAccessToken(grantId: Uuid): Promise<{
|
|
12299
|
+
accessToken: string;
|
|
12300
|
+
grant: WorkflowAccessGrant;
|
|
12301
|
+
}>;
|
|
12302
|
+
/**
|
|
12303
|
+
* Validate that a grant is still valid (sync version for internal use).
|
|
12304
|
+
* Throws appropriate error if validation fails.
|
|
12305
|
+
*/
|
|
12306
|
+
validateGrantSync(dbGrant: DBWorkflowAccessGrant): void;
|
|
12307
|
+
/**
|
|
12308
|
+
* Validate that a grant is still valid by ID.
|
|
12309
|
+
* Fetches the grant and validates it.
|
|
12310
|
+
*/
|
|
12311
|
+
validateGrant(grantId: Uuid): Promise<WorkflowAccessGrant>;
|
|
12312
|
+
/**
|
|
12313
|
+
* Validate that a specific token is still valid.
|
|
12314
|
+
* Calls validateGrantSync first, then checks token-specific revocation.
|
|
12315
|
+
*/
|
|
12316
|
+
validateTokenSync(dbGrant: DBWorkflowAccessGrant, jti: string): void;
|
|
12317
|
+
/**
|
|
12318
|
+
* Validate that a specific token is still valid by grant ID.
|
|
12319
|
+
* Fetches the grant and validates both grant and token.
|
|
12320
|
+
*/
|
|
12321
|
+
validateToken(grantId: Uuid, jti: string): Promise<void>;
|
|
12322
|
+
/**
|
|
12323
|
+
* Check if a specific token has been revoked.
|
|
12324
|
+
*/
|
|
12325
|
+
isTokenRevoked(dbGrant: DBWorkflowAccessGrant, jti: string): boolean;
|
|
12326
|
+
/**
|
|
12327
|
+
* Validate access token payload against the grant.
|
|
12328
|
+
*/
|
|
12329
|
+
validateAccessPayload(payload: WorkflowAccessPayload): Promise<{
|
|
12330
|
+
valid: boolean;
|
|
12331
|
+
grant?: WorkflowAccessGrant;
|
|
12332
|
+
error?: string;
|
|
12333
|
+
}>;
|
|
12334
|
+
private mapFromDB;
|
|
12335
|
+
}
|
|
12336
|
+
|
|
12337
|
+
/**
|
|
12338
|
+
* Input for creating a workflow
|
|
12339
|
+
*/
|
|
12340
|
+
interface CreateWorkflowInput {
|
|
12341
|
+
name: string;
|
|
12342
|
+
label: string;
|
|
12343
|
+
description?: string;
|
|
12344
|
+
icon?: IconName;
|
|
12345
|
+
slots: WorkflowSlot[];
|
|
12346
|
+
nodes: Record<string, WorkflowNode>;
|
|
12347
|
+
startNodeId: string;
|
|
12348
|
+
layout?: WorkflowLayout;
|
|
12349
|
+
theme?: WorkflowTheme;
|
|
12350
|
+
config?: WorkflowConfig;
|
|
12351
|
+
metadata?: Record<string, unknown>;
|
|
12352
|
+
}
|
|
12353
|
+
/**
|
|
12354
|
+
* Input for updating a workflow
|
|
12355
|
+
*/
|
|
12356
|
+
interface UpdateWorkflowInput {
|
|
12357
|
+
label?: string;
|
|
12358
|
+
description?: string;
|
|
12359
|
+
icon?: IconName;
|
|
12360
|
+
slots?: WorkflowSlot[];
|
|
12361
|
+
nodes?: Record<string, WorkflowNode>;
|
|
12362
|
+
startNodeId?: string;
|
|
12363
|
+
layout?: WorkflowLayout;
|
|
12364
|
+
theme?: WorkflowTheme;
|
|
12365
|
+
config?: WorkflowConfig;
|
|
12366
|
+
metadata?: Record<string, unknown>;
|
|
12367
|
+
}
|
|
12368
|
+
/**
|
|
12369
|
+
* Options for WorkflowService constructor
|
|
12370
|
+
*/
|
|
12371
|
+
interface WorkflowServiceOptions {
|
|
12372
|
+
/**
|
|
12373
|
+
* System workflows to register (in-memory, not from database).
|
|
12374
|
+
*/
|
|
12375
|
+
systemWorkflows?: WorkflowDefinition[];
|
|
12376
|
+
}
|
|
12377
|
+
/**
|
|
12378
|
+
* Service for managing workflow definitions.
|
|
12379
|
+
* Handles fusion of system workflows (from registry) and custom workflows (from database).
|
|
12380
|
+
* Automatically uses tenant context from AsyncLocalStorage.
|
|
10238
12381
|
*
|
|
10239
12382
|
* Supports optional caching via CacheAdapter for improved performance.
|
|
10240
12383
|
* Cache is automatically invalidated when workflows are modified.
|
|
@@ -10337,6 +12480,8 @@ interface WorkflowInstanceServiceOptions {
|
|
|
10337
12480
|
schemaService?: ObjectSchemaService;
|
|
10338
12481
|
/** Record service for persisting slots at workflow completion */
|
|
10339
12482
|
recordService?: RecordService;
|
|
12483
|
+
/** Document processing hook for generating PDFs in document nodes */
|
|
12484
|
+
documentProcessingHook?: DocumentProcessingHook;
|
|
10340
12485
|
}
|
|
10341
12486
|
/**
|
|
10342
12487
|
* Service for executing and managing workflow instances.
|
|
@@ -10347,6 +12492,7 @@ declare class WorkflowInstanceService extends BaseService {
|
|
|
10347
12492
|
private executorRegistry;
|
|
10348
12493
|
private schemaService?;
|
|
10349
12494
|
private recordService?;
|
|
12495
|
+
private documentProcessingHook?;
|
|
10350
12496
|
constructor(adapter: DatabaseAdapter, workflowService: WorkflowService, options?: WorkflowInstanceServiceOptions);
|
|
10351
12497
|
/**
|
|
10352
12498
|
* Start a new workflow instance
|
|
@@ -10447,85 +12593,101 @@ declare class WorkflowInstanceService extends BaseService {
|
|
|
10447
12593
|
private convertDBInstanceToInstance;
|
|
10448
12594
|
}
|
|
10449
12595
|
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
}
|
|
10467
|
-
|
|
10468
|
-
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
*
|
|
10488
|
-
*
|
|
12596
|
+
interface InvitationServiceConfig {
|
|
12597
|
+
/** Base URL for the magic link (e.g., "https://app.example.com") */
|
|
12598
|
+
baseUrl: string;
|
|
12599
|
+
/** Default invitation expiry in days (default: 7) */
|
|
12600
|
+
defaultExpiryDays?: number;
|
|
12601
|
+
/** Callback to send notification email */
|
|
12602
|
+
sendEmailCallback?: (params: {
|
|
12603
|
+
recipientEmail: string;
|
|
12604
|
+
recipientName?: string;
|
|
12605
|
+
magicLink: string;
|
|
12606
|
+
instanceId: string;
|
|
12607
|
+
}) => Promise<void>;
|
|
12608
|
+
}
|
|
12609
|
+
declare class InvitationNotFoundError extends Error {
|
|
12610
|
+
invitationId: string;
|
|
12611
|
+
constructor(invitationId: string);
|
|
12612
|
+
}
|
|
12613
|
+
declare class InvitationExpiredError extends Error {
|
|
12614
|
+
invitationId: string;
|
|
12615
|
+
constructor(invitationId: string);
|
|
12616
|
+
}
|
|
12617
|
+
declare class InvitationAlreadyAcceptedError extends Error {
|
|
12618
|
+
invitationId: string;
|
|
12619
|
+
constructor(invitationId: string);
|
|
12620
|
+
}
|
|
12621
|
+
declare class InvitationRevokedError extends Error {
|
|
12622
|
+
invitationId: string;
|
|
12623
|
+
constructor(invitationId: string);
|
|
12624
|
+
}
|
|
12625
|
+
/**
|
|
12626
|
+
* Service for managing workflow invitations.
|
|
12627
|
+
*
|
|
12628
|
+
* Invitations are the first step in the external user authentication flow:
|
|
12629
|
+
* 1. Admin creates an invitation → generates magic link
|
|
12630
|
+
* 2. External user clicks magic link → invitation is accepted
|
|
12631
|
+
* 3. Grant is created → user gets access token
|
|
12632
|
+
*
|
|
12633
|
+
* @example
|
|
12634
|
+
* ```typescript
|
|
12635
|
+
* const invitationService = new WorkflowInvitationService(adapter, jwtService, {
|
|
12636
|
+
* baseUrl: "https://app.example.com",
|
|
12637
|
+
* sendEmailCallback: async ({ recipientEmail, magicLink }) => {
|
|
12638
|
+
* await sendMagicLinkEmail(recipientEmail, magicLink);
|
|
12639
|
+
* },
|
|
12640
|
+
* });
|
|
12641
|
+
*
|
|
12642
|
+
* const { invitation, magicLink } = await invitationService.createInvitation({
|
|
12643
|
+
* instanceId: "inst_123",
|
|
12644
|
+
* recipientEmail: "client@example.com",
|
|
12645
|
+
* recipientName: "John Doe",
|
|
12646
|
+
* sendEmail: true,
|
|
12647
|
+
* });
|
|
12648
|
+
* ```
|
|
10489
12649
|
*/
|
|
10490
|
-
declare class
|
|
10491
|
-
private
|
|
10492
|
-
private
|
|
10493
|
-
|
|
10494
|
-
constructor(adapter: DatabaseAdapter, instanceService: WorkflowInstanceService, tokenService?: ParticipationTokenService, pinCodeService?: PinCodeService);
|
|
12650
|
+
declare class WorkflowInvitationService extends BaseService {
|
|
12651
|
+
private jwtService;
|
|
12652
|
+
private config;
|
|
12653
|
+
constructor(adapter: DatabaseAdapter, jwtService: WorkflowJwtService, config: InvitationServiceConfig);
|
|
10495
12654
|
/**
|
|
10496
|
-
*
|
|
12655
|
+
* Find invitation by ID
|
|
10497
12656
|
*/
|
|
10498
|
-
|
|
12657
|
+
findById(id: Uuid): Promise<WorkflowInvitation | null>;
|
|
10499
12658
|
/**
|
|
10500
|
-
*
|
|
12659
|
+
* Find invitations by instance ID
|
|
10501
12660
|
*/
|
|
10502
|
-
|
|
12661
|
+
findByInstanceId(instanceId: Uuid): Promise<WorkflowInvitation[]>;
|
|
10503
12662
|
/**
|
|
10504
|
-
*
|
|
12663
|
+
* Find invitations by recipient email
|
|
10505
12664
|
*/
|
|
10506
|
-
|
|
12665
|
+
findByEmail(email: string): Promise<WorkflowInvitation[]>;
|
|
10507
12666
|
/**
|
|
10508
|
-
*
|
|
12667
|
+
* Create a new invitation and generate a magic link.
|
|
12668
|
+
*
|
|
12669
|
+
* Optionally sends an email notification to the recipient.
|
|
10509
12670
|
*/
|
|
10510
|
-
|
|
12671
|
+
createInvitation(input: CreateInvitationInput): Promise<CreateInvitationResult>;
|
|
10511
12672
|
/**
|
|
10512
|
-
*
|
|
12673
|
+
* Mark an invitation as accepted.
|
|
12674
|
+
*
|
|
12675
|
+
* This is called internally when a magic link is exchanged for an access token.
|
|
12676
|
+
* It should not be called directly.
|
|
10513
12677
|
*/
|
|
10514
|
-
|
|
12678
|
+
markAsAccepted(invitationId: Uuid): Promise<WorkflowInvitation>;
|
|
10515
12679
|
/**
|
|
10516
|
-
*
|
|
12680
|
+
* Revoke an invitation.
|
|
12681
|
+
*
|
|
12682
|
+
* Once revoked, the magic link will no longer work.
|
|
10517
12683
|
*/
|
|
10518
|
-
|
|
12684
|
+
revoke(invitationId: Uuid): Promise<WorkflowInvitation>;
|
|
10519
12685
|
/**
|
|
10520
|
-
*
|
|
12686
|
+
* Validate that an invitation can be accepted.
|
|
12687
|
+
* Throws appropriate error if validation fails.
|
|
10521
12688
|
*/
|
|
10522
|
-
|
|
10523
|
-
private
|
|
10524
|
-
private resolvePhoneFromContext;
|
|
10525
|
-
private markAuthenticated;
|
|
10526
|
-
private updateParticipationAuth;
|
|
10527
|
-
private saveParticipation;
|
|
10528
|
-
private convertDBToParticipation;
|
|
12689
|
+
validateForAcceptance(dbInvitation: DBWorkflowInvitation): void;
|
|
12690
|
+
private mapFromDB;
|
|
10529
12691
|
}
|
|
10530
12692
|
|
|
10531
12693
|
/**
|
|
@@ -10558,7 +12720,7 @@ interface FieldReadOnlyResult {
|
|
|
10558
12720
|
* // Check if a field is read-only for external users
|
|
10559
12721
|
* const { readOnly, reason } = service.isFieldReadOnly(
|
|
10560
12722
|
* userAttribute,
|
|
10561
|
-
* { type: "external", token: "...",
|
|
12723
|
+
* { type: "external", token: "...", grantId: "..." }
|
|
10562
12724
|
* );
|
|
10563
12725
|
* ```
|
|
10564
12726
|
*/
|
|
@@ -10880,229 +13042,283 @@ declare class UserProfileService extends BaseService {
|
|
|
10880
13042
|
declare function buildAuditChanges<T extends Record<string, unknown>>(oldValues: T, newValues: Partial<T>, fieldsToCheck: (keyof T)[]): AuditChange[];
|
|
10881
13043
|
|
|
10882
13044
|
/**
|
|
10883
|
-
*
|
|
13045
|
+
* Configuration for document processing adapters.
|
|
13046
|
+
* All adapters are optional - features are disabled if not provided.
|
|
10884
13047
|
*/
|
|
10885
|
-
interface
|
|
10886
|
-
/**
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
13048
|
+
interface DocumentProcessingConfig {
|
|
13049
|
+
/** OCR adapter for text extraction */
|
|
13050
|
+
ocrAdapter?: OcrAdapter;
|
|
13051
|
+
/** Signature adapter for electronic signatures */
|
|
13052
|
+
signatureAdapter?: SignatureAdapter;
|
|
13053
|
+
/** Identity verification adapter for KYC */
|
|
13054
|
+
identityAdapter?: IdentityVerificationAdapter;
|
|
10892
13055
|
}
|
|
10893
13056
|
/**
|
|
10894
|
-
* Service for
|
|
13057
|
+
* Service for orchestrating document processing jobs.
|
|
10895
13058
|
*
|
|
10896
|
-
*
|
|
10897
|
-
*
|
|
10898
|
-
* Automatically uses tenant context from AsyncLocalStorage.
|
|
13059
|
+
* This service is AGNOSTIC - it receives adapters via dependency injection.
|
|
13060
|
+
* Concrete adapter implementations live in @stndrds/schema-nestjs or dedicated packages.
|
|
10899
13061
|
*
|
|
10900
13062
|
* @example
|
|
10901
13063
|
* ```typescript
|
|
10902
|
-
* //
|
|
10903
|
-
* const service = new
|
|
13064
|
+
* // In NestJS, adapters are injected via DI
|
|
13065
|
+
* const service = new DocumentProcessingService(adapter, {
|
|
13066
|
+
* ocrAdapter: googleVisionAdapter,
|
|
13067
|
+
* signatureAdapter: yousignAdapter,
|
|
13068
|
+
* identityAdapter: onfidoAdapter,
|
|
13069
|
+
* });
|
|
10904
13070
|
*
|
|
10905
|
-
* //
|
|
10906
|
-
* const
|
|
10907
|
-
* const service = new FileService(adapter, { auditService });
|
|
13071
|
+
* // Process OCR on a document slot
|
|
13072
|
+
* const job = await service.processOcr(documentId, "front");
|
|
10908
13073
|
*
|
|
10909
|
-
* //
|
|
10910
|
-
* const
|
|
10911
|
-
*
|
|
10912
|
-
*
|
|
10913
|
-
* mimeType: "application/pdf",
|
|
10914
|
-
* size: 12345,
|
|
10915
|
-
* uploadedBy: "user-456",
|
|
10916
|
-
* });
|
|
13074
|
+
* // Start signature workflow
|
|
13075
|
+
* const signJob = await service.startSignature(documentId, [
|
|
13076
|
+
* { email: "signer@example.com", firstName: "John", lastName: "Doe" }
|
|
13077
|
+
* ]);
|
|
10917
13078
|
* ```
|
|
10918
13079
|
*/
|
|
10919
|
-
declare class
|
|
10920
|
-
private
|
|
10921
|
-
|
|
13080
|
+
declare class DocumentProcessingService extends BaseService {
|
|
13081
|
+
private readonly config;
|
|
13082
|
+
private readonly documentService;
|
|
13083
|
+
private readonly templateService;
|
|
13084
|
+
constructor(adapter: DatabaseAdapter, config: DocumentProcessingConfig);
|
|
10922
13085
|
/**
|
|
10923
|
-
*
|
|
10924
|
-
*
|
|
10925
|
-
* This method orchestrates:
|
|
10926
|
-
* 1. Upload to storage (via StorageAdapter)
|
|
10927
|
-
* 2. Create file metadata in database
|
|
10928
|
-
* 3. Audit log the operation
|
|
10929
|
-
*
|
|
10930
|
-
* Requires `adapter.storage` to be configured.
|
|
10931
|
-
*
|
|
10932
|
-
* @param input - File content and metadata
|
|
10933
|
-
* @returns Created file record
|
|
10934
|
-
* @throws Error if StorageAdapter is not configured
|
|
13086
|
+
* Process OCR on a document slot.
|
|
10935
13087
|
*
|
|
10936
|
-
* @
|
|
10937
|
-
*
|
|
10938
|
-
*
|
|
10939
|
-
* content: fileBuffer,
|
|
10940
|
-
* fileName: "document.pdf",
|
|
10941
|
-
* mimeType: "application/pdf",
|
|
10942
|
-
* size: 12345,
|
|
10943
|
-
* uploadedBy: "user-123",
|
|
10944
|
-
* visibility: "private",
|
|
10945
|
-
* folderPath: "/documents",
|
|
10946
|
-
* tags: ["contract", "2025"],
|
|
10947
|
-
* });
|
|
10948
|
-
* ```
|
|
13088
|
+
* @param documentId - Document ID
|
|
13089
|
+
* @param slotName - Slot name to process
|
|
13090
|
+
* @returns Created processing job
|
|
10949
13091
|
*/
|
|
10950
|
-
|
|
13092
|
+
processOcr(documentId: string, slotName: string): Promise<ProcessingJob>;
|
|
10951
13093
|
/**
|
|
10952
|
-
*
|
|
10953
|
-
*
|
|
10954
|
-
* Use this method when handling storage externally (e.g., with Multer + S3).
|
|
10955
|
-
* For integrated upload, use `uploadFile()` instead.
|
|
10956
|
-
*
|
|
10957
|
-
* @param data - File metadata
|
|
10958
|
-
* @returns Created file record
|
|
10959
|
-
*
|
|
10960
|
-
* @example
|
|
10961
|
-
* ```typescript
|
|
10962
|
-
* // After uploading to S3 with Multer
|
|
10963
|
-
* const file = await service.createFile({
|
|
10964
|
-
* tenantId: "tenant-123",
|
|
10965
|
-
* name: "contract-2025.pdf",
|
|
10966
|
-
* originalName: "Contract Acme Corp 2025.pdf",
|
|
10967
|
-
* mimeType: "application/pdf",
|
|
10968
|
-
* size: 2458624,
|
|
10969
|
-
* storageProvider: "s3",
|
|
10970
|
-
* storagePath: "tenants/123/files/2025/contract.pdf",
|
|
10971
|
-
* storageBucket: "my-app-files",
|
|
10972
|
-
* url: "https://cdn.example.com/files/file-123",
|
|
10973
|
-
* uploadedBy: "profile-456",
|
|
10974
|
-
* visibility: "private"
|
|
10975
|
-
* });
|
|
10976
|
-
* ```
|
|
13094
|
+
* Execute pending OCR job.
|
|
13095
|
+
* This is typically called by a background worker.
|
|
10977
13096
|
*/
|
|
10978
|
-
|
|
13097
|
+
executeOcrJob(jobId: string): Promise<ProcessingJob>;
|
|
10979
13098
|
/**
|
|
10980
|
-
*
|
|
13099
|
+
* Start a signature workflow for a document.
|
|
13100
|
+
*
|
|
13101
|
+
* @param documentId - Document ID
|
|
13102
|
+
* @param signers - List of signers
|
|
13103
|
+
* @param options - Signature options
|
|
13104
|
+
* @returns Created processing job
|
|
10981
13105
|
*/
|
|
10982
|
-
|
|
13106
|
+
startSignature(documentId: string, signers: SignerRequest[], options?: {
|
|
13107
|
+
expiresAt?: Date;
|
|
13108
|
+
webhookUrl?: string;
|
|
13109
|
+
}): Promise<ProcessingJob>;
|
|
10983
13110
|
/**
|
|
10984
|
-
*
|
|
13111
|
+
* Execute pending signature job.
|
|
13112
|
+
* This sends the document to the signature provider.
|
|
10985
13113
|
*/
|
|
10986
|
-
|
|
13114
|
+
executeSignatureJob(jobId: string): Promise<ProcessingJob>;
|
|
10987
13115
|
/**
|
|
10988
|
-
*
|
|
13116
|
+
* Handle signature webhook callback.
|
|
13117
|
+
* Updates job status based on provider response.
|
|
10989
13118
|
*
|
|
10990
|
-
* @param
|
|
10991
|
-
* @
|
|
10992
|
-
* @returns Updated file
|
|
13119
|
+
* @param externalId - External ID from the signature provider
|
|
13120
|
+
* @returns Updated job, or null if job not found
|
|
10993
13121
|
*/
|
|
10994
|
-
|
|
13122
|
+
handleSignatureWebhook(externalId: string): Promise<ProcessingJob | null>;
|
|
10995
13123
|
/**
|
|
10996
|
-
*
|
|
13124
|
+
* Verify identity document.
|
|
10997
13125
|
*
|
|
10998
|
-
* @param
|
|
10999
|
-
* @
|
|
13126
|
+
* @param documentId - Document ID (must be an identity document)
|
|
13127
|
+
* @returns Created processing job
|
|
11000
13128
|
*/
|
|
11001
|
-
|
|
11002
|
-
hard?: boolean;
|
|
11003
|
-
checkOwnership?: boolean;
|
|
11004
|
-
userId?: string;
|
|
11005
|
-
}): Promise<void>;
|
|
13129
|
+
verifyIdentity(documentId: string): Promise<ProcessingJob>;
|
|
11006
13130
|
/**
|
|
11007
|
-
*
|
|
11008
|
-
*
|
|
11009
|
-
* Requires `adapter.storage` to be configured.
|
|
11010
|
-
*
|
|
11011
|
-
* @param fileId - File UUID
|
|
11012
|
-
* @param options - Delete options
|
|
11013
|
-
* @throws Error if StorageAdapter is not configured
|
|
13131
|
+
* Execute pending identity verification job.
|
|
11014
13132
|
*/
|
|
11015
|
-
|
|
11016
|
-
hard?: boolean;
|
|
11017
|
-
}): Promise<void>;
|
|
13133
|
+
executeIdentityVerificationJob(jobId: string): Promise<ProcessingJob>;
|
|
11018
13134
|
/**
|
|
11019
|
-
*
|
|
11020
|
-
*
|
|
11021
|
-
* @param fileIds - Array of file UUIDs
|
|
11022
|
-
* @param options - Delete options
|
|
13135
|
+
* Trigger auto-processing based on template configuration.
|
|
13136
|
+
* Called after all required slots are uploaded.
|
|
11023
13137
|
*/
|
|
11024
|
-
|
|
11025
|
-
hard?: boolean;
|
|
11026
|
-
deleteFromStorage?: boolean;
|
|
11027
|
-
}): Promise<void>;
|
|
13138
|
+
triggerAutoProcessing(documentId: string): Promise<ProcessingJob[]>;
|
|
11028
13139
|
/**
|
|
11029
|
-
*
|
|
13140
|
+
* Get all jobs for a document.
|
|
11030
13141
|
*/
|
|
11031
|
-
|
|
13142
|
+
getJobsForDocument(documentId: string): Promise<ProcessingJob[]>;
|
|
11032
13143
|
/**
|
|
11033
|
-
*
|
|
13144
|
+
* Get pending jobs for processing.
|
|
11034
13145
|
*/
|
|
11035
|
-
|
|
13146
|
+
getPendingJobs(limit?: number): Promise<ProcessingJob[]>;
|
|
11036
13147
|
/**
|
|
11037
|
-
*
|
|
13148
|
+
* Cancel a pending job.
|
|
11038
13149
|
*/
|
|
11039
|
-
|
|
13150
|
+
cancelJob(jobId: string): Promise<ProcessingJob>;
|
|
11040
13151
|
/**
|
|
11041
|
-
*
|
|
11042
|
-
*
|
|
11043
|
-
* Checks access permissions before generating URL.
|
|
11044
|
-
* Requires `adapter.storage` to be configured.
|
|
11045
|
-
*
|
|
11046
|
-
* @param fileId - File UUID
|
|
11047
|
-
* @param userId - User requesting access
|
|
11048
|
-
* @param options - Signed URL options
|
|
11049
|
-
* @returns Signed URL
|
|
11050
|
-
* @throws Error if user doesn't have access or StorageAdapter is not configured
|
|
11051
|
-
*
|
|
11052
|
-
* @example
|
|
11053
|
-
* ```typescript
|
|
11054
|
-
* const url = await service.getSignedUrl("file-123", "user-456", {
|
|
11055
|
-
* expiresIn: 3600, // 1 hour
|
|
11056
|
-
* });
|
|
11057
|
-
* ```
|
|
13152
|
+
* Check if OCR is available.
|
|
11058
13153
|
*/
|
|
11059
|
-
|
|
13154
|
+
isOcrAvailable(): boolean;
|
|
11060
13155
|
/**
|
|
11061
|
-
* Check if
|
|
11062
|
-
*
|
|
11063
|
-
* @param fileId - File UUID
|
|
11064
|
-
* @param userId - User ID to check
|
|
11065
|
-
* @returns true if user can access the file
|
|
13156
|
+
* Check if signature is available.
|
|
11066
13157
|
*/
|
|
11067
|
-
|
|
13158
|
+
isSignatureAvailable(): boolean;
|
|
11068
13159
|
/**
|
|
11069
|
-
*
|
|
13160
|
+
* Check if identity verification is available.
|
|
11070
13161
|
*/
|
|
11071
|
-
|
|
13162
|
+
isIdentityVerificationAvailable(): boolean;
|
|
11072
13163
|
/**
|
|
11073
|
-
*
|
|
11074
|
-
*
|
|
11075
|
-
* @param fileId - File UUID
|
|
11076
|
-
* @param visibility - New visibility level
|
|
11077
|
-
* @param allowedUsers - Users allowed to access (if restricted)
|
|
13164
|
+
* Get available processing capabilities.
|
|
11078
13165
|
*/
|
|
11079
|
-
|
|
13166
|
+
getCapabilities(): {
|
|
13167
|
+
ocr: {
|
|
13168
|
+
available: boolean;
|
|
13169
|
+
provider?: string;
|
|
13170
|
+
};
|
|
13171
|
+
signature: {
|
|
13172
|
+
available: boolean;
|
|
13173
|
+
provider?: string;
|
|
13174
|
+
};
|
|
13175
|
+
identityVerification: {
|
|
13176
|
+
available: boolean;
|
|
13177
|
+
provider?: string;
|
|
13178
|
+
};
|
|
13179
|
+
};
|
|
13180
|
+
}
|
|
13181
|
+
|
|
13182
|
+
/**
|
|
13183
|
+
* Document Renderer Service
|
|
13184
|
+
*
|
|
13185
|
+
* Generates PDF documents by injecting workflow context data into PDF templates.
|
|
13186
|
+
* Uses pdf-lib for PDF manipulation.
|
|
13187
|
+
*
|
|
13188
|
+
* Supports intelligent attribute formatting when SchemaService is provided:
|
|
13189
|
+
* - Currency, dates, numbers formatted according to attribute config
|
|
13190
|
+
* - Relations resolved to their display labels
|
|
13191
|
+
* - Select/multiselect values resolved to option labels
|
|
13192
|
+
*/
|
|
13193
|
+
|
|
13194
|
+
/**
|
|
13195
|
+
* Input for rendering a document
|
|
13196
|
+
*/
|
|
13197
|
+
interface RenderDocumentInput {
|
|
13198
|
+
/** The document generation template to use */
|
|
13199
|
+
template: DocumentGenerationTemplate;
|
|
13200
|
+
/** The workflow execution context containing the data */
|
|
13201
|
+
context: WorkflowExecutionContext;
|
|
13202
|
+
/** The workflow definition (for slot metadata) */
|
|
13203
|
+
workflow?: WorkflowDefinition;
|
|
13204
|
+
/** Custom filename (supports {{path}} interpolation) */
|
|
13205
|
+
filename?: string;
|
|
13206
|
+
}
|
|
13207
|
+
/**
|
|
13208
|
+
* Options for DocumentRendererService
|
|
13209
|
+
*/
|
|
13210
|
+
interface DocumentRendererOptions {
|
|
13211
|
+
/** Schema service for attribute definitions (enables intelligent formatting) */
|
|
13212
|
+
schemaService?: ObjectSchemaService;
|
|
13213
|
+
/** Relation service for resolving relation labels */
|
|
13214
|
+
relationService?: RelationService;
|
|
13215
|
+
/** Files repository for resolving fileId to storagePath */
|
|
13216
|
+
filesRepository?: FilesRepository;
|
|
13217
|
+
}
|
|
13218
|
+
/**
|
|
13219
|
+
* Result of document rendering
|
|
13220
|
+
*/
|
|
13221
|
+
interface RenderDocumentResult {
|
|
13222
|
+
/** The generated PDF as a buffer */
|
|
13223
|
+
buffer: Buffer;
|
|
13224
|
+
/** The resolved filename */
|
|
13225
|
+
filename: string;
|
|
13226
|
+
/** MIME type (always application/pdf) */
|
|
13227
|
+
mimeType: "application/pdf";
|
|
13228
|
+
/** Number of pages in the document */
|
|
13229
|
+
pageCount: number;
|
|
13230
|
+
}
|
|
13231
|
+
/**
|
|
13232
|
+
* Error thrown when document rendering fails
|
|
13233
|
+
*/
|
|
13234
|
+
declare class DocumentRenderError extends Error {
|
|
13235
|
+
readonly templateId: string;
|
|
13236
|
+
readonly cause?: unknown | undefined;
|
|
13237
|
+
constructor(message: string, templateId: string, cause?: unknown | undefined);
|
|
13238
|
+
}
|
|
13239
|
+
/**
|
|
13240
|
+
* Error thrown when storage adapter doesn't support download
|
|
13241
|
+
*/
|
|
13242
|
+
declare class StorageDownloadNotSupportedError extends Error {
|
|
13243
|
+
constructor();
|
|
13244
|
+
}
|
|
13245
|
+
/**
|
|
13246
|
+
* Service for rendering PDF documents from templates.
|
|
13247
|
+
*
|
|
13248
|
+
* Responsibilities:
|
|
13249
|
+
* - Load template PDF from storage
|
|
13250
|
+
* - Resolve field values from workflow context
|
|
13251
|
+
* - Format values using attribute definitions (if available)
|
|
13252
|
+
* - Resolve relation labels (if RelationService provided)
|
|
13253
|
+
* - Inject text into PDF using pdf-lib
|
|
13254
|
+
* - Return generated PDF buffer
|
|
13255
|
+
*
|
|
13256
|
+
* @example
|
|
13257
|
+
* ```typescript
|
|
13258
|
+
* // Basic usage
|
|
13259
|
+
* const renderer = new DocumentRendererService(storageAdapter);
|
|
13260
|
+
*
|
|
13261
|
+
* // With intelligent formatting
|
|
13262
|
+
* const renderer = new DocumentRendererService(storageAdapter, {
|
|
13263
|
+
* schemaService,
|
|
13264
|
+
* relationService,
|
|
13265
|
+
* });
|
|
13266
|
+
*
|
|
13267
|
+
* const result = await renderer.render({
|
|
13268
|
+
* template,
|
|
13269
|
+
* context: workflowContext,
|
|
13270
|
+
* workflow: workflowDefinition,
|
|
13271
|
+
* filename: "contract-{{slots.client.name}}.pdf"
|
|
13272
|
+
* });
|
|
13273
|
+
* ```
|
|
13274
|
+
*/
|
|
13275
|
+
declare class DocumentRendererService {
|
|
13276
|
+
private readonly storageAdapter;
|
|
13277
|
+
private readonly options?;
|
|
13278
|
+
private schemaCache;
|
|
13279
|
+
constructor(storageAdapter: StorageAdapter, options?: DocumentRendererOptions | undefined);
|
|
11080
13280
|
/**
|
|
11081
|
-
*
|
|
13281
|
+
* Render a document from a template and context.
|
|
11082
13282
|
*
|
|
11083
|
-
* @param
|
|
11084
|
-
* @
|
|
13283
|
+
* @param input - Template, context, and optional filename
|
|
13284
|
+
* @returns Generated PDF buffer with metadata
|
|
13285
|
+
* @throws DocumentRenderError if rendering fails
|
|
13286
|
+
* @throws StorageDownloadNotSupportedError if storage doesn't support download
|
|
11085
13287
|
*/
|
|
11086
|
-
|
|
13288
|
+
render(input: RenderDocumentInput): Promise<RenderDocumentResult>;
|
|
11087
13289
|
/**
|
|
11088
|
-
*
|
|
11089
|
-
*
|
|
11090
|
-
* @param fileId - File UUID
|
|
11091
|
-
* @param userIds - User IDs to revoke access
|
|
13290
|
+
* Download the template PDF from storage
|
|
11092
13291
|
*/
|
|
11093
|
-
|
|
13292
|
+
private downloadTemplate;
|
|
11094
13293
|
/**
|
|
11095
|
-
*
|
|
13294
|
+
* Resolve all field values, including relations and formatted attributes
|
|
11096
13295
|
*/
|
|
11097
|
-
|
|
13296
|
+
private resolveAllFieldValues;
|
|
11098
13297
|
/**
|
|
11099
|
-
*
|
|
13298
|
+
* Get attribute info from contextPath
|
|
13299
|
+
* Parses paths like "slots.client.firstName" to find the attribute definition
|
|
11100
13300
|
*/
|
|
11101
|
-
|
|
13301
|
+
private getAttributeInfo;
|
|
11102
13302
|
/**
|
|
11103
|
-
*
|
|
13303
|
+
* Draw a single field on the PDF
|
|
11104
13304
|
*/
|
|
11105
|
-
|
|
13305
|
+
private drawField;
|
|
13306
|
+
/**
|
|
13307
|
+
* Simple value formatting (fallback when no attribute definition available)
|
|
13308
|
+
*/
|
|
13309
|
+
private formatValueSimple;
|
|
13310
|
+
/**
|
|
13311
|
+
* Interpolate filename with context values
|
|
13312
|
+
*
|
|
13313
|
+
* Supports {{path}} syntax for variable interpolation.
|
|
13314
|
+
*
|
|
13315
|
+
* @example
|
|
13316
|
+
* ```typescript
|
|
13317
|
+
* interpolateFilename("contract-{{slots.client.name}}.pdf", context, template)
|
|
13318
|
+
* // => "contract-John Doe.pdf"
|
|
13319
|
+
* ```
|
|
13320
|
+
*/
|
|
13321
|
+
private interpolateFilename;
|
|
11106
13322
|
}
|
|
11107
13323
|
|
|
11108
13324
|
/**
|
|
@@ -11550,4 +13766,4 @@ interface FullSyncOptions extends SyncOptions, ViewSyncOptions {
|
|
|
11550
13766
|
*/
|
|
11551
13767
|
declare function syncAll(adapter: DatabaseAdapter, objectRegistry: typeof registry, nativeViewRegistry: typeof viewRegistry, options?: FullSyncOptions): Promise<FullSyncResult>;
|
|
11552
13768
|
|
|
11553
|
-
export { type FlowRow as $, type Attribute as A, type DirectTableTab as B, type CheckboxAttribute as C, type DateAttribute as D, type WorkflowConfig as E, type FileAttribute as F, type Group as G, type SlotMode as H, type InferAttributeValue as I, type AuthMethod as J, type AuthChannel as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectAction as O, type PhoneAttribute as P, type ParticipantTemplate as Q, type RichtextAttribute as R, type SystemResource as S, type TextAttribute as T, type UserAttribute as U, type ViewLayout as V, type WorkflowTheme as W, type ConditionGroup as X, type ConditionRule as Y, type WorkflowNode as Z, type WorkflowDefinition as _, type SystemAction as a, type FilterValue as a$, type AIMessageRole as a0, type AIThinkingLevel as a1, type AIToolCallStatus as a2, type AIToolCall as a3, type AIChatMessagePartType as a4, type TextPartData as a5, type ToolPartData as a6, type ThinkingPartData as a7, type ReasoningPartData as a8, type AIChatMessagePart as a9, RELATION_TARGET_ANY as aA, type RelationAttribute as aB, isUniversalRelation as aC, type AuditResourceType as aD, type AuditAction as aE, type AuditActorType as aF, type AuditChange as aG, type AuditLogEntry as aH, type CreateAuditLogInput as aI, type AuditListOptions as aJ, type AuditServiceOptions as aK, type StorageProvider as aL, type FileVisibility as aM, type File as aN, type CreateFile as aO, type UpdateFile as aP, type TextFilterOperator as aQ, type NumberFilterOperator as aR, type CheckboxFilterOperator as aS, type DateFilterOperator as aT, type SelectFilterOperator as aU, type MultiselectFilterOperator as aV, type RelationFilterOperator as aW, type FilterOperator as aX, type RelativeDateValue as aY, type CurrencyFilterValue as aZ, type PhoneFilterValue as a_, type AIChatMessage as aa, type AIQuestionType as ab, type AIQuestionOption as ac, type AIQuestion as ad, type AIQuestionAnswer as ae, type AITodoStatus as af, type AITodoItem as ag, type AITodoList as ah, type AIMessageAttachment as ai, type AIConversation as aj, type AIMessage as ak, type AIToolCallRecord as al, type AIUserMemory as am, type AIUsageMetrics as an, type AIProviderMetrics as ao, type CreateAIMessageInput as ap, type StatusGroup as aq, type AttributeGroup as ar, type BaseAttribute as as, type NumberUnit as at, type DateFormat as au, type DateValue as av, type Phone as aw, type Currency as ax, type Location as ay, type LocationGranularity as az, type TextAreaAttribute as b, type Permission as b$, type FilterRule as b0, type ExtendedFilterRule as b1, type FilterCombinator as b2, type FilterGroup as b3, type AdvancedFilterState as b4, isAdvancedFilterState as b5, toAdvancedFilterState as b6, toSimpleFilterState as b7, type SortDirection as b8, type QueryState as b9, type InferRecordInput as bA, type InferRecordUpdate as bB, type CustomAttributeValue as bC, type WithCustomAttributes as bD, type RecordMetadata as bE, type SystemFields as bF, type ExtractRecord as bG, type ExtractRecordStrict as bH, type ExtractRecordInput as bI, type ExtractRecordInputStrict as bJ, type ExtractRecordUpdate as bK, type ExtractRecordUpdateStrict as bL, type ExtractAttributes as bM, type TypedObjectRecord as bN, type ExtractObjectRecord as bO, type ExtractObjectRecordWithCustom as bP, RESERVED_ATTRIBUTE_NAMES as bQ, SYSTEM_FIELD_NAMES as bR, type ReservedAttributeName as bS, type SystemFieldName as bT, type Timestamps as bU, type SharingMode as bV, type ObjectAttribute as bW, type CompletionStatus as bX, type ObjectRecord as bY, type PermissionScope as bZ, type Role as b_, OPERATORS_BY_TYPE as ba, type NoValueOperator as bb, NO_VALUE_OPERATORS as bc, isNoValueOperator as bd, type FlowSlot as be, type FlowRowField as bf, type FlowPage as bg, type FlowRelation as bh, type FlowStatus as bi, type FlowDefinition as bj, isFlowDefinition as bk, isFlowPublished as bl, isSystemFlow as bm, type GeocodingSuggestion as bn, type GeocodingAutocompleteParams as bo, type ReverseGeocodingParams as bp, type GeocodingParams as bq, type GeocodingAdapter as br, NoopGeocodingAdapter as bs, type AttributeSchema as bt, type InferRecordFromSchema as bu, type InferRecordWithRequirements as bv, type TypedAttribute as bw, type AttributeMap as bx, type AddAttribute as by, type InferRecord as bz, type RichtextFeature as c, type WorkflowTransition as c$, type UserRoleAssignment as c0, type EffectivePermissions as c1, type ObjectPermissions as c2, type SystemPermissions as c3, type CreateRoleInput as c4, type UpdateRoleInput as c5, type CreatePermissionInput as c6, type AssignRoleInput as c7, type PolicyContext as c8, type RecordPolicy as c9, type WorkflowNodeType as cA, isStartNode as cB, isFormNode as cC, isConditionNode as cD, isEndNode as cE, isSimpleFormNode as cF, isAdvancedFormNode as cG, getNodeOutputs as cH, type ConditionOperator as cI, isConditionRule as cJ, isConditionGroup as cK, eq as cL, neq as cM, and as cN, or as cO, inValues as cP, isEmpty as cQ, isNotEmpty as cR, type WorkflowSlot as cS, type NodePosition as cT, type CanvasViewport as cU, type WorkflowLayout as cV, type ParticipantAuthConfig as cW, type WorkflowStatus as cX, isWorkflowDefinition as cY, isWorkflowPublished as cZ, isSystemWorkflow as c_, PolicyViolationError as ca, type UserRole as cb, type UserStatus as cc, type UserProfile as cd, type CreateUserProfile as ce, type UpdateUserProfile as cf, type InviteUserInput as cg, type TabType as ch, type FormTab as ci, type CustomTab as cj, type ActivityTab as ck, type NotesTab as cl, type FlowsTab as cm, isFormTab as cn, isTableTab as co, isDirectTableTab as cp, isInverseTableTab as cq, isCustomTab as cr, isActivityTab as cs, isNotesTab as ct, isFlowsTab as cu, type StartNode as cv, type FormNode as cw, type FormFieldRef as cx, type ConditionNode as cy, type EndNode as cz, type CurrencyAttribute as d, formulaConfigSchema as d$, type WorkflowError as d0, type PendingAction as d1, type WorkflowInstance as d2, isInstanceTerminal as d3, isInstanceWaiting as d4, canResumeInstance as d5, createStartTransition as d6, type ParticipationStatus as d7, type SignedLinkAuth as d8, type PinCodeAuth as d9, type Uuid as dA, type TenantId as dB, type UserId as dC, asTenantId as dD, asUserId as dE, generateId as dF, generatePrefixedId as dG, registry as dH, viewRegistry as dI, type ValidationMessages as dJ, DEFAULT_VALIDATION_MESSAGES as dK, textConfigSchema as dL, textareaConfigSchema as dM, richtextConfigSchema as dN, numberConfigSchema as dO, checkboxConfigSchema as dP, dateConfigSchema as dQ, phoneConfigSchema as dR, currencyConfigSchema as dS, statusConfigSchema as dT, locationConfigSchema as dU, selectConfigSchema as dV, multiselectConfigSchema as dW, fileConfigSchema as dX, userConfigSchema as dY, relationConfigSchema as dZ, ratingConfigSchema as d_, type ParticipationAuth as da, type WorkflowParticipation as db, isSignedLinkAuth as dc, isPinCodeAuth as dd, canParticipate as de, canAuthenticate as df, canExecuteNode as dg, type GeneratedDocument as dh, type WorkflowExecutionContext as di, createEmptyContext as dj, getContextValue as dk, setContextValue as dl, mergeFormToSlot as dm, type WorkflowAccessMode as dn, type ReadOnlyReason as dp, type FormFieldContext as dq, type FormFieldRow as dr, type FormNodeInfo as ds, type FormContextResponse as dt, type ThemeLogo as du, type ThemeColors as dv, type ThemeTypography as dw, DEFAULT_THEME as dx, mergeWithDefaults as dy, generateCssVariables as dz, type Option as e, type QueryBuilderState as e$, rollupConfigSchema as e0, attributeConfigSchemas as e1, getAttributeConfigSchema as e2, validateAttributeConfig as e3, parseAttributeConfig as e4, safeParseAttributeConfig as e5, createTextValidator as e6, createNumberValidator as e7, createCheckboxValidator as e8, createDateValidator as e9, getMissingRequiredAttributes as eA, isRecordComplete as eB, computeRecordStatus as eC, type DatabaseAdapter as eD, ParticipationTokenService as eE, getDefaultTokenService as eF, initializeTokenService as eG, type ParticipationTokenPayload as eH, type TokenGenerationOptions as eI, type TokenVerificationResult as eJ, PinCodeService as eK, getDefaultPinCodeService as eL, initializePinCodeService as eM, type PinCodeGenerationOptions as eN, type PinCodeVerificationResult as eO, type CacheKeyType as eP, hashOptions as eQ, type CacheAdapter as eR, type CacheOptions as eS, cacheKeys as eT, cacheTtl as eU, defaultTtl as eV, NoopCacheAdapter as eW, type FetchResult as eX, type FormattedRecord as eY, type GroupedFetchResult as eZ, type InsertOptions as e_, createPhoneValidator as ea, createCurrencyValidator as eb, createStatusValidator as ec, createSelectValidator as ed, createMultiselectValidator as ee, createLocationValidator as ef, createFileValidator as eg, createUserValidator as eh, createSingleRelationValidator as ei, createMultiRelationValidator as ej, createRelationValidator as ek, createRatingValidator as el, createFormulaValidator as em, createRollupValidator as en, createTextAreaValidator as eo, createRichtextValidator as ep, createAttributeValidator as eq, createFormAttributeValidator as er, createObjectValidator as es, type ValidationResult as et, validateAttribute as eu, validateObject as ev, validateObjectOrThrow as ew, createDraftValidator as ex, validateDraft as ey, validateDraftOrThrow as ez, type StatusAttribute as f, type FormulaResult as f$, type RegistryMap as f0, type RegistryObjectNames as f1, type ShortcutOperator as f2, createDefaultState as f3, formatRecord as f4, formatRecords as f5, QueryMultipleResultsError as f6, QueryNoResultError as f7, SHORTCUT_TO_FILTER_OPERATOR as f8, createQueryBuilder as f9, type ExecutorContext as fA, type ExecutorErrorResult as fB, type ExecutorResult as fC, type ExecutorSuccessResult as fD, type ExecutorWaitResult as fE, type NodeExecutor as fF, complete as fG, error as fH, ExecutorRegistry as fI, success as fJ, wait as fK, ConditionExecutor as fL, EndExecutor as fM, FormExecutor as fN, StartExecutor as fO, evaluateFormula as fP, evaluateFormulaAttribute as fQ, evaluateFormulaAttributeWithRelations as fR, evaluateFormulaWithRelations as fS, evaluateFormulaWithResult as fT, extractFormulaVariables as fU, extractRelationNames as fV, extractRelationReferences as fW, flattenRelationsForEval as fX, formatFormulaResult as fY, hasRelationReferences as fZ, validateFormulaExpression as f_, QueryBuilder as fa, type QueryBuilderOptions as fb, type EvaluationResult as fc, type EvaluationTrace as fd, evaluateCondition as fe, evaluate as ff, evaluateWithTrace as fg, TenantContextError as fh, addSchemaToContext as fi, getSchemaByNameFromContext as fj, getSchemaContext as fk, getSchemaFromContext as fl, hasSchemaContext as fm, runWithMergedSchemaContext as fn, runWithSchemaContext as fo, type SchemaContext as fp, getContext as fq, getTenantId as fr, getUserId as fs, hasContext as ft, runWithContext as fu, withTenantContext as fv, type TenantContext as fw, createDefaultExecutorRegistry as fx, getDefaultExecutorRegistry as fy, type ExecutorCompleteResult as fz, type SelectAttribute as g, type RelationOptionsResponse as g$, getPathDepth as g0, getRelationPath as g1, getTargetAttributeName as g2, InvalidPathError as g3, MaxDepthExceededError as g4, parsePath as g5, pathHasManyCardinality as g6, validatePath as g7, type PathCardinality as g8, type PathSegment as g9, type WorkflowParticipationsRepository as gA, type AuditRepository as gB, type PermissionsRepository as gC, type AIConversationsRepository as gD, type AIUserMemoryRepository as gE, type AIUsageMetricsRepository as gF, BaseService as gG, BaseRepository as gH, type SchemaContextAware as gI, SchemaContextAwareRepository as gJ, TenantAwareRepository as gK, TenantAwareService as gL, type CreateCustomObjectInput as gM, type AddAttributeInput as gN, type UpdateObjectInput as gO, type ObjectSchemaServiceOptions as gP, ObjectSchemaService as gQ, type RecordServiceOptions as gR, RecordService as gS, type RecordQueryServiceOptions as gT, type QueryOptions as gU, type SearchQueryOptions as gV, type QueryResult as gW, RecordQueryService as gX, type RelationValidationResult as gY, type RelationValidationError as gZ, type RelationOption as g_, type PathSegmentType as ga, type SchemaResolver as gb, resolveMultiplePaths as gc, resolveSingleValue as gd, traversePath as ge, type TraversalOptions as gf, type TraversalResult as gg, type AttributeChange as gh, type HookContext as gi, type HookDefinition as gj, type HookHandler as gk, type HookType as gl, NoopHookRegistry as gm, type HookRegistry as gn, createMockAdapter as go, defaultPolicyRegistry as gp, PolicyRegistry as gq, notesPolicy as gr, type ObjectsRepository as gs, type AttributesRepository as gt, type UserProfilesRepository as gu, type FilesRepository as gv, type ObjectRecordsRepository as gw, type ViewsRepository as gx, type WorkflowsRepository as gy, type WorkflowInstancesRepository as gz, type SingleRelationAttribute as h, type StorageUploadInput as h$, type GetRelationOptionsParams as h0, type RelationServiceOptions as h1, type ResolveIdsBatchRequest as h2, type ResolveIdsBatchResponse as h3, RelationService as h4, RecordResolverService as h5, type ResolvedRelations as h6, type FormulaResolverServiceOptions as h7, FormulaResolverService as h8, type RollupResult as h9, type StartWorkflowInput as hA, type ResumeWorkflowInput as hB, type WorkflowInstanceServiceOptions as hC, WorkflowInstanceService as hD, type CreateParticipationInput as hE, type CreateParticipationResult as hF, type AuthenticationResult as hG, WorkflowParticipationService as hH, type FieldReadOnlyResult as hI, WorkflowRelationService as hJ, type UserValidationResult as hK, type UserValidationError as hL, UserService as hM, type UserProfileServiceOptions as hN, UserProfileService as hO, AuditService as hP, buildAuditChanges as hQ, type FileServiceOptions as hR, FileService as hS, GeocodingService as hT, GlobalSearchService as hU, type PermissionServiceOptions as hV, PermissionService as hW, type CreateViewInput as hX, type UpdateViewInput as hY, ViewService as hZ, type FileContent as h_, type RollupServiceOptions as ha, RollupService as hb, type RollupSchedulerOptions as hc, RollupScheduler as hd, applyDefaultValues as he, checkPermission as hf, getPolicy as hg, buildPolicyContext as hh, checkRecordAccess as hi, checkRecordModifyOrThrow as hj, checkRecordDeleteOrThrow as hk, checkSharedObjectWriteAccess as hl, computeLabel as hm, type LabelResolver as hn, enrichWithFormulas as ho, enrichRecordsWithFormulas as hp, createContextForCreate as hq, createContextForUpdate as hr, createContextForDelete as hs, createContextForRestore as ht, recalculateParentRollups as hu, type RollupCascadeContext as hv, type CreateWorkflowInput as hw, type UpdateWorkflowInput as hx, type WorkflowServiceOptions as hy, WorkflowService as hz, type MultiRelationAttribute as i, type StorageUploadResult as i0, type SignedUrlOptions as i1, type StorageAdapter as i2, type UploadFileInput as i3, type SyncResult as i4, type SyncOptions as i5, syncNativeObjects as i6, verifyNativeObjectsSync as i7, getSyncPreview as i8, type FullSyncResult as i9, type FileListOptions as iA, type DBView as iB, type CreateDBView as iC, type UpdateDBView as iD, type UpsertDBView as iE, type DBWorkflow as iF, type CreateDBWorkflow as iG, type UpdateDBWorkflow as iH, type DBWorkflowInstance as iI, type CreateDBWorkflowInstance as iJ, type UpdateDBWorkflowInstance as iK, type DBWorkflowParticipation as iL, type CreateDBWorkflowParticipation as iM, type UpdateDBWorkflowParticipation as iN, type OperationResult as iO, type ViewSyncResult as iP, type ViewSyncOptions as iQ, syncNativeViews as iR, verifyNativeViewsSync as iS, getViewSyncPreview as iT, type FullSyncOptions as ia, syncAll as ib, DEFAULT_LABEL_FALLBACK as ic, renderLabelExpression as id, isLabelExpression as ie, extractAttributeNames as ig, enrichValuesForDisplay as ih, enrichValuesWithSelectLabels as ii, extractRelationIds as ij, type RelationLabelResolver as ik, computeLabelWithRelations as il, type DBObject as im, type CreateDBObject as io, type UpdateDBObject as ip, type UpsertDBObject as iq, type DBAttribute as ir, type CreateDBAttribute as is, type UpdateDBAttribute as it, type UpsertDBAttribute as iu, type CreateObjectRecord as iv, type ListOptions as iw, type SearchOptions as ix, type GlobalSearchOptions as iy, type GlobalSearchResultItem as iz, type RelationTarget as j, type RatingAttribute as k, type FormulaAttribute as l, type FormulaReturnType as m, type RollupAttribute as n, type RollupFunction as o, type AttributeType as p, type ObjectDefinition as q, type Field as r, type AttributeGroupField as s, type TableTab as t, type InverseTableTab as u, type ViewDefinition as v, type InstanceStatus as w, type Tab as x, type FilterState as y, type SortRule as z };
|
|
13769
|
+
export { type OcrAdapter as $, type Attribute as A, type SortRule as B, type CheckboxAttribute as C, type DateAttribute as D, type DirectTableTab as E, type FileAttribute as F, type Group as G, type WorkflowConfig as H, type InferAttributeValue as I, type SlotMode as J, type ConditionGroup as K, type LocationAttribute as L, type MultiselectAttribute as M, type NumberAttribute as N, type ObjectAction as O, type PhoneAttribute as P, type ConditionRule as Q, type RichtextAttribute as R, type SystemResource as S, type TextAttribute as T, type UserAttribute as U, type ViewLayout as V, type WorkflowTheme as W, type WorkflowNode as X, type WorkflowDefinition as Y, type FlowRow as Z, type DocumentTemplate as _, type DocumentAttribute as a, type AuditActorType as a$, type OcrInput as a0, type OcrOptions as a1, type OcrResult as a2, type OcrPage as a3, type OcrTextBlock as a4, type BoundingBox as a5, type SignatureAdapter as a6, type CreateSignatureInput as a7, type SignerRequest as a8, type SignaturePosition as a9, type AIBatchQuestionAnswer as aA, type AITodoStatus as aB, type AITodoItem as aC, type AITodoList as aD, type AIMessageAttachment as aE, type AIConversation as aF, type AIMessage as aG, type AIToolCallRecord as aH, type AIUserMemory as aI, type AIUsageMetrics as aJ, type AIProviderMetrics as aK, type CreateAIMessageInput as aL, type StatusGroup as aM, type AttributeGroup as aN, type BaseAttribute as aO, type NumberUnit as aP, type DateFormat as aQ, type DateValue as aR, type Phone as aS, type Currency as aT, type Location as aU, type LocationGranularity as aV, RELATION_TARGET_ANY as aW, type RelationAttribute as aX, isUniversalRelation as aY, type AuditResourceType as aZ, type AuditAction as a_, type SignatureRequestResult as aa, type SignatureStatusResult as ab, type SignerStatus as ac, type SignatureStatus as ad, type IdentityVerificationAdapter as ae, type VerifyInput as af, type VerificationResult as ag, type DocumentData as ah, type VerificationCheck as ai, type AIMessageRole as aj, type AIThinkingLevel as ak, type AIToolCallStatus as al, type AIToolCall as am, type AIChatMessagePartType as an, type TextPartData as ao, type ToolPartData as ap, type ThinkingPartData as aq, type ReasoningPartData as ar, type AIChatMessagePart as as, type AIChatMessage as at, type AIQuestionType as au, type AIQuestionOption as av, type AIQuestion as aw, type AIQuestionAnswer as ax, type AIBatchQuestionOption as ay, type AIBatchQuestion as az, type SystemAction as b, type NoValueOperator as b$, type AuditChange as b0, type AuditLogEntry as b1, type CreateAuditLogInput as b2, type AuditListOptions as b3, type AuditServiceOptions as b4, type VariableMapping as b5, type PdfTemplateField as b6, type TemplateSource as b7, type DocumentGenerationTemplate as b8, type CreateDocumentGenerationTemplate as b9, type FileVisibility as bA, type File as bB, type CreateFile as bC, type UpdateFile as bD, type TextFilterOperator as bE, type NumberFilterOperator as bF, type CheckboxFilterOperator as bG, type DateFilterOperator as bH, type SelectFilterOperator as bI, type MultiselectFilterOperator as bJ, type RelationFilterOperator as bK, type FilterOperator as bL, type RelativeDateValue as bM, type CurrencyFilterValue as bN, type PhoneFilterValue as bO, type FilterValue as bP, type FilterRule as bQ, type ExtendedFilterRule as bR, type FilterCombinator as bS, type FilterGroup as bT, type AdvancedFilterState as bU, isAdvancedFilterState as bV, toAdvancedFilterState as bW, toSimpleFilterState as bX, type SortDirection as bY, type QueryState as bZ, OPERATORS_BY_TYPE as b_, type UpdateDocumentGenerationTemplate as ba, type PendingDocumentRequest as bb, isPdfTemplateSource as bc, isDocxTemplateSource as bd, type DocumentSlotDefinition as be, type DocumentAutoProcessing as bf, type ExtractionMapping as bg, type ExtractionField as bh, type Document as bi, type DocumentStatus as bj, type DocumentSlot as bk, type SlotStatus as bl, type ProcessingJob as bm, type ProcessingJobType as bn, type ProcessingJobStatus as bo, type CreateDocument as bp, type UpdateDocument as bq, type CreateDocumentTemplate as br, type UpdateDocumentTemplate as bs, type CreateDocumentSlot as bt, type UpdateDocumentSlot as bu, type CreateProcessingJob as bv, type UpdateProcessingJob as bw, type DocumentListOptions as bx, type DocumentTemplateListOptions as by, type StorageProvider as bz, type TextAreaAttribute as c, type UserRole as c$, NO_VALUE_OPERATORS as c0, isNoValueOperator as c1, type FlowSlot as c2, type FlowRowField as c3, type FlowPage as c4, type FlowRelation as c5, type FlowStatus as c6, type FlowDefinition as c7, isFlowDefinition as c8, isFlowPublished as c9, type ExtractAttributes as cA, type TypedObjectRecord as cB, type ExtractObjectRecord as cC, type ExtractObjectRecordWithCustom as cD, RESERVED_ATTRIBUTE_NAMES as cE, SYSTEM_FIELD_NAMES as cF, type ReservedAttributeName as cG, type SystemFieldName as cH, type Timestamps as cI, type SharingMode as cJ, type ObjectAttribute as cK, type CompletionStatus as cL, type ObjectRecord as cM, type PermissionScope as cN, type Role as cO, type Permission as cP, type UserRoleAssignment as cQ, type EffectivePermissions as cR, type ObjectPermissions as cS, type SystemPermissions as cT, type CreateRoleInput as cU, type UpdateRoleInput as cV, type CreatePermissionInput as cW, type AssignRoleInput as cX, type PolicyContext as cY, type RecordPolicy as cZ, PolicyViolationError as c_, isSystemFlow as ca, type GeocodingSuggestion as cb, type GeocodingAutocompleteParams as cc, type ReverseGeocodingParams as cd, type GeocodingParams as ce, type GeocodingAdapter as cf, NoopGeocodingAdapter as cg, type AttributeSchema as ch, type InferRecordFromSchema as ci, type InferRecordWithRequirements as cj, type TypedAttribute as ck, type AttributeMap as cl, type AddAttribute as cm, type InferRecord as cn, type InferRecordInput as co, type InferRecordUpdate as cp, type CustomAttributeValue as cq, type WithCustomAttributes as cr, type RecordMetadata as cs, type SystemFields as ct, type ExtractRecord as cu, type ExtractRecordStrict as cv, type ExtractRecordInput as cw, type ExtractRecordInputStrict as cx, type ExtractRecordUpdate as cy, type ExtractRecordUpdateStrict as cz, type RichtextFeature as d, type CreateInvitationInput as d$, type UserStatus as d0, type UserProfile as d1, type CreateUserProfile as d2, type UpdateUserProfile as d3, type InviteUserInput as d4, type TabType as d5, type FormTab as d6, type CustomTab as d7, type ActivityTab as d8, type NotesTab as d9, isStartNode as dA, type ConditionOperator as dB, and as dC, eq as dD, inValues as dE, isConditionGroup as dF, isConditionRule as dG, isEmpty as dH, isNotEmpty as dI, neq as dJ, or as dK, type CanvasViewport as dL, type NodePosition as dM, type WorkflowLayout as dN, type WorkflowSlot as dO, type WorkflowStatus as dP, isSystemWorkflow as dQ, isWorkflowDefinition as dR, isWorkflowPublished as dS, type PendingAction as dT, type WorkflowError as dU, type WorkflowInstance as dV, type WorkflowTransition as dW, canResumeInstance as dX, createStartTransition as dY, isInstanceTerminal as dZ, isInstanceWaiting as d_, type FlowsTab as da, type DocumentsTab as db, isFormTab as dc, isTableTab as dd, isDirectTableTab as de, isInverseTableTab as df, isCustomTab as dg, isActivityTab as dh, isNotesTab as di, isFlowsTab as dj, isDocumentsTab as dk, type ConditionNode as dl, type DocumentNode as dm, type EndNode as dn, type FormFieldRef as dp, type FormNode as dq, type StartNode as dr, type WorkflowNodeType as ds, getNodeOutputs as dt, isAdvancedFormNode as du, isConditionNode as dv, isDocumentNode as dw, isEndNode as dx, isFormNode as dy, isSimpleFormNode as dz, type CurrencyAttribute as e, attributeConfigSchemas as e$, type CreateInvitationResult as e0, type InvitationStatus as e1, type WorkflowInvitation as e2, isInvitationAccepted as e3, isInvitationExpired as e4, isInvitationValid as e5, type CreateGrantInput as e6, type WorkflowAccessGrant as e7, canAccessNode as e8, isGrantExpired as e9, generateId as eA, generatePrefixedId as eB, slugify as eC, generateTemplateName as eD, registry as eE, viewRegistry as eF, type ValidationMessages as eG, DEFAULT_VALIDATION_MESSAGES as eH, textConfigSchema as eI, textareaConfigSchema as eJ, richtextConfigSchema as eK, numberConfigSchema as eL, checkboxConfigSchema as eM, dateConfigSchema as eN, phoneConfigSchema as eO, currencyConfigSchema as eP, statusConfigSchema as eQ, locationConfigSchema as eR, selectConfigSchema as eS, multiselectConfigSchema as eT, fileConfigSchema as eU, userConfigSchema as eV, relationConfigSchema as eW, ratingConfigSchema as eX, formulaConfigSchema as eY, rollupConfigSchema as eZ, documentConfigSchema as e_, isGrantRevoked as ea, isGrantValid as eb, isTokenRevoked as ec, type GeneratedDocument as ed, type WorkflowExecutionContext as ee, createEmptyContext as ef, getContextValue as eg, mergeFormToSlot as eh, setContextValue as ei, type FormContextResponse as ej, type FormFieldContext as ek, type FormFieldRow as el, type FormNodeInfo as em, type ReadOnlyReason as en, type WorkflowAccessMode as eo, type ThemeColors as ep, type ThemeLogo as eq, type ThemeTypography as er, DEFAULT_THEME as es, generateCssVariables as et, mergeWithDefaults as eu, type Uuid as ev, type TenantId as ew, type UserId as ex, asTenantId as ey, asUserId as ez, type Option as f, QueryMultipleResultsError as f$, getAttributeConfigSchema as f0, validateAttributeConfig as f1, parseAttributeConfig as f2, safeParseAttributeConfig as f3, createTextValidator as f4, createNumberValidator as f5, createCheckboxValidator as f6, createDateValidator as f7, createPhoneValidator as f8, createCurrencyValidator as f9, computeRecordStatus as fA, type DatabaseAdapter as fB, WorkflowJwtService as fC, type JwtVerificationResult as fD, type MagicLinkPayload as fE, type WorkflowAccessPayload as fF, type WorkflowJwtConfig as fG, type WorkflowJwtPayload as fH, type CacheKeyType as fI, hashOptions as fJ, type CacheAdapter as fK, type CacheOptions as fL, cacheKeys as fM, cacheTtl as fN, defaultTtl as fO, NoopCacheAdapter as fP, type FetchResult as fQ, type FormattedRecord as fR, type GroupedFetchResult as fS, type InsertOptions as fT, type QueryBuilderState as fU, type RegistryMap as fV, type RegistryObjectNames as fW, type ShortcutOperator as fX, createDefaultState as fY, formatRecord as fZ, formatRecords as f_, createStatusValidator as fa, createSelectValidator as fb, createMultiselectValidator as fc, createLocationValidator as fd, createFileValidator as fe, createUserValidator as ff, createSingleRelationValidator as fg, createMultiRelationValidator as fh, createRelationValidator as fi, createRatingValidator as fj, createFormulaValidator as fk, createRollupValidator as fl, createTextAreaValidator as fm, createRichtextValidator as fn, createAttributeValidator as fo, createFormAttributeValidator as fp, createObjectValidator as fq, type ValidationResult as fr, validateAttribute as fs, validateObject as ft, validateObjectOrThrow as fu, createDraftValidator as fv, validateDraft as fw, validateDraftOrThrow as fx, getMissingRequiredAttributes as fy, isRecordComplete as fz, type StatusAttribute as g, parsePath as g$, QueryNoResultError as g0, SHORTCUT_TO_FILTER_OPERATOR as g1, createQueryBuilder as g2, QueryBuilder as g3, type QueryBuilderOptions as g4, type EvaluationResult as g5, type EvaluationTrace as g6, evaluateCondition as g7, evaluate as g8, evaluateWithTrace as g9, error as gA, ExecutorRegistry as gB, success as gC, wait as gD, ConditionExecutor as gE, DocumentExecutor as gF, EndExecutor as gG, FormExecutor as gH, StartExecutor as gI, evaluateFormula as gJ, evaluateFormulaAttribute as gK, evaluateFormulaAttributeWithRelations as gL, evaluateFormulaWithRelations as gM, evaluateFormulaWithResult as gN, extractFormulaVariables as gO, extractRelationNames as gP, extractRelationReferences as gQ, flattenRelationsForEval as gR, formatFormulaResult as gS, hasRelationReferences as gT, validateFormulaExpression as gU, type FormulaResult as gV, getPathDepth as gW, getRelationPath as gX, getTargetAttributeName as gY, InvalidPathError as gZ, MaxDepthExceededError as g_, TenantContextError as ga, addSchemaToContext as gb, getSchemaByNameFromContext as gc, getSchemaContext as gd, getSchemaFromContext as ge, hasSchemaContext as gf, runWithMergedSchemaContext as gg, runWithSchemaContext as gh, type SchemaContext as gi, getContext as gj, getTenantId as gk, getUserId as gl, hasContext as gm, runWithContext as gn, withTenantContext as go, type TenantContext as gp, createDefaultExecutorRegistry as gq, getDefaultExecutorRegistry as gr, type ExecutorCompleteResult as gs, type ExecutorContext as gt, type ExecutorErrorResult as gu, type ExecutorResult as gv, type ExecutorSuccessResult as gw, type ExecutorWaitResult as gx, type NodeExecutor as gy, complete as gz, type SelectAttribute as h, type RelationOption as h$, pathHasManyCardinality as h0, validatePath as h1, type PathCardinality as h2, type PathSegment as h3, type PathSegmentType as h4, type SchemaResolver as h5, resolveMultiplePaths as h6, resolveSingleValue as h7, traversePath as h8, type TraversalOptions as h9, type AIUsageMetricsRepository as hA, type DocumentTemplatesRepository as hB, type DocumentsRepository as hC, type DocumentSlotsRepository as hD, type DocumentJobsRepository as hE, type DocumentGenerationTemplateListOptions as hF, type DocumentGenerationTemplatesRepository as hG, BaseService as hH, BaseRepository as hI, type SchemaContextAware as hJ, SchemaContextAwareRepository as hK, TenantAwareRepository as hL, TenantAwareService as hM, type CreateCustomObjectInput as hN, type AddAttributeInput as hO, type UpdateObjectInput as hP, type ObjectSchemaServiceOptions as hQ, ObjectSchemaService as hR, type RecordServiceOptions as hS, RecordService as hT, type RecordQueryServiceOptions as hU, type QueryOptions as hV, type SearchQueryOptions as hW, type QueryResult as hX, RecordQueryService as hY, type RelationValidationResult as hZ, type RelationValidationError as h_, type TraversalResult as ha, type AttributeChange as hb, type HookContext as hc, type HookDefinition as hd, type HookHandler as he, type HookType as hf, NoopHookRegistry as hg, type HookRegistry as hh, createMockAdapter as hi, defaultPolicyRegistry as hj, PolicyRegistry as hk, notesPolicy as hl, type ObjectsRepository as hm, type AttributesRepository as hn, type UserProfilesRepository as ho, type FilesRepository as hp, type ObjectRecordsRepository as hq, type ViewsRepository as hr, type WorkflowsRepository as hs, type WorkflowInstancesRepository as ht, type WorkflowInvitationsRepository as hu, type WorkflowAccessGrantsRepository as hv, type AuditRepository as hw, type PermissionsRepository as hx, type AIConversationsRepository as hy, type AIUserMemoryRepository as hz, type SingleRelationAttribute as i, type UserProfileServiceOptions as i$, type RelationOptionsResponse as i0, type GetRelationOptionsParams as i1, type RelationServiceOptions as i2, type ResolveIdsBatchRequest as i3, type ResolveIdsBatchResponse as i4, RelationService as i5, RecordResolverService as i6, type ResolvedRelations as i7, type FormulaResolverServiceOptions as i8, FormulaResolverService as i9, DocumentProcessingHook as iA, GrantNotFoundError as iB, GrantExpiredError as iC, GrantRevokedError as iD, TokenRevokedError as iE, type GrantServiceConfig as iF, type CreateGrantResult as iG, WorkflowAccessGrantService as iH, type StartWorkflowInput as iI, type ResumeWorkflowInput as iJ, type WorkflowInstanceServiceOptions as iK, WorkflowInstanceService as iL, type InvitationServiceConfig as iM, InvitationNotFoundError as iN, InvitationExpiredError as iO, InvitationAlreadyAcceptedError as iP, InvitationRevokedError as iQ, WorkflowInvitationService as iR, type FieldReadOnlyResult as iS, WorkflowRelationService as iT, type CreateWorkflowInput as iU, type UpdateWorkflowInput as iV, type WorkflowServiceOptions as iW, WorkflowService as iX, type UserValidationResult as iY, type UserValidationError as iZ, UserService as i_, type RollupResult as ia, type RollupServiceOptions as ib, RollupService as ic, type RollupSchedulerOptions as id, RollupScheduler as ie, applyDefaultValues as ig, checkPermission as ih, getPolicy as ii, buildPolicyContext as ij, checkRecordAccess as ik, checkRecordModifyOrThrow as il, checkRecordDeleteOrThrow as im, checkSharedObjectWriteAccess as io, computeLabel as ip, type LabelResolver as iq, enrichWithFormulas as ir, enrichRecordsWithFormulas as is, createContextForCreate as it, createContextForUpdate as iu, createContextForDelete as iv, createContextForRestore as iw, recalculateParentRollups as ix, type RollupCascadeContext as iy, type DocumentProcessingHookOptions as iz, type MultiRelationAttribute as j, type GlobalSearchOptions as j$, UserProfileService as j0, AuditService as j1, buildAuditChanges as j2, DocumentGenerationTemplateNotFoundError as j3, DocumentGenerationNotConfiguredError as j4, DocumentGenerationService as j5, type DocumentProcessingConfig as j6, DocumentProcessingService as j7, type RenderDocumentInput as j8, type DocumentRendererOptions as j9, type SyncOptions as jA, syncNativeObjects as jB, verifyNativeObjectsSync as jC, getSyncPreview as jD, type FullSyncResult as jE, type FullSyncOptions as jF, syncAll as jG, DEFAULT_LABEL_FALLBACK as jH, renderLabelExpression as jI, isLabelExpression as jJ, extractAttributeNames as jK, enrichValuesForDisplay as jL, enrichValuesWithSelectLabels as jM, extractRelationIds as jN, type RelationLabelResolver as jO, computeLabelWithRelations as jP, type DBObject as jQ, type CreateDBObject as jR, type UpdateDBObject as jS, type UpsertDBObject as jT, type DBAttribute as jU, type CreateDBAttribute as jV, type UpdateDBAttribute as jW, type UpsertDBAttribute as jX, type CreateObjectRecord as jY, type ListOptions as jZ, type SearchOptions as j_, type RenderDocumentResult as ja, DocumentRenderError as jb, StorageDownloadNotSupportedError as jc, DocumentRendererService as jd, DocumentTemplateService as je, type RecordDocumentsResult as jf, type CreateRecordDocumentInput as jg, type CreateRecordDocumentResult as jh, type DocumentServiceOptions as ji, DocumentService as jj, type FileServiceOptions as jk, FileService as jl, GeocodingService as jm, GlobalSearchService as jn, type PermissionServiceOptions as jo, PermissionService as jp, type CreateViewInput as jq, type UpdateViewInput as jr, ViewService as js, type FileContent as jt, type StorageUploadInput as ju, type StorageUploadResult as jv, type SignedUrlOptions as jw, type StorageAdapter as jx, type UploadFileInput as jy, type SyncResult as jz, type RelationTarget as k, type GlobalSearchResultItem as k0, type FileListOptions as k1, type DBView as k2, type CreateDBView as k3, type UpdateDBView as k4, type UpsertDBView as k5, type DBWorkflow as k6, type CreateDBWorkflow as k7, type UpdateDBWorkflow as k8, type DBWorkflowInstance as k9, type CreateDBWorkflowInstance as ka, type UpdateDBWorkflowInstance as kb, type DBWorkflowInvitation as kc, type CreateDBWorkflowInvitation as kd, type UpdateDBWorkflowInvitation as ke, type DBWorkflowAccessGrant as kf, type CreateDBWorkflowAccessGrant as kg, type UpdateDBWorkflowAccessGrant as kh, type OperationResult as ki, type ViewSyncResult as kj, type ViewSyncOptions as kk, syncNativeViews as kl, verifyNativeViewsSync as km, getViewSyncPreview as kn, type RatingAttribute as l, type FormulaAttribute as m, type FormulaReturnType as n, type RollupAttribute as o, type RollupFunction as p, type AttributeType as q, type ObjectDefinition as r, type Field as s, type AttributeGroupField as t, type TableTab as u, type InverseTableTab as v, type ViewDefinition as w, type InstanceStatus as x, type Tab as y, type FilterState as z };
|