@docrouter/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.mts +797 -0
- package/dist/index.d.ts +797 -0
- package/dist/index.js +697 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +689 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +82 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,797 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
interface DocRouterConfig {
|
|
4
|
+
baseURL: string;
|
|
5
|
+
token?: string;
|
|
6
|
+
tokenProvider?: () => Promise<string>;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
retries?: number;
|
|
9
|
+
onAuthError?: (error: Error) => void;
|
|
10
|
+
}
|
|
11
|
+
interface DocRouterAccountConfig {
|
|
12
|
+
baseURL: string;
|
|
13
|
+
accountToken: string;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
retries?: number;
|
|
16
|
+
onAuthError?: (error: Error) => void;
|
|
17
|
+
}
|
|
18
|
+
interface DocRouterOrgConfig {
|
|
19
|
+
baseURL: string;
|
|
20
|
+
orgToken: string;
|
|
21
|
+
organizationId: string;
|
|
22
|
+
timeout?: number;
|
|
23
|
+
retries?: number;
|
|
24
|
+
onAuthError?: (error: Error) => void;
|
|
25
|
+
}
|
|
26
|
+
interface ApiError extends Error {
|
|
27
|
+
status?: number;
|
|
28
|
+
code?: string;
|
|
29
|
+
details?: unknown;
|
|
30
|
+
}
|
|
31
|
+
interface CreateTokenRequest {
|
|
32
|
+
name: string;
|
|
33
|
+
lifetime: number;
|
|
34
|
+
}
|
|
35
|
+
interface AccessToken {
|
|
36
|
+
id: string;
|
|
37
|
+
user_id: string;
|
|
38
|
+
organization_id?: string;
|
|
39
|
+
name: string;
|
|
40
|
+
token: string;
|
|
41
|
+
created_at: string;
|
|
42
|
+
lifetime: number;
|
|
43
|
+
}
|
|
44
|
+
interface ListAccessTokensResponse {
|
|
45
|
+
access_tokens: AccessToken[];
|
|
46
|
+
}
|
|
47
|
+
interface OrganizationMember {
|
|
48
|
+
user_id: string;
|
|
49
|
+
role: 'admin' | 'user';
|
|
50
|
+
}
|
|
51
|
+
type OrganizationType = 'individual' | 'team' | 'enterprise';
|
|
52
|
+
interface Organization {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
type: OrganizationType;
|
|
56
|
+
members: OrganizationMember[];
|
|
57
|
+
created_at: string;
|
|
58
|
+
updated_at: string;
|
|
59
|
+
}
|
|
60
|
+
interface CreateOrganizationRequest {
|
|
61
|
+
name: string;
|
|
62
|
+
type?: OrganizationType;
|
|
63
|
+
}
|
|
64
|
+
interface UpdateOrganizationRequest {
|
|
65
|
+
name?: string;
|
|
66
|
+
type?: OrganizationType;
|
|
67
|
+
members?: OrganizationMember[];
|
|
68
|
+
}
|
|
69
|
+
interface ListOrganizationsResponse {
|
|
70
|
+
organizations: Organization[];
|
|
71
|
+
total_count: number;
|
|
72
|
+
skip: number;
|
|
73
|
+
}
|
|
74
|
+
interface Document {
|
|
75
|
+
id: string;
|
|
76
|
+
pdf_id: string;
|
|
77
|
+
document_name: string;
|
|
78
|
+
upload_date: string;
|
|
79
|
+
uploaded_by: string;
|
|
80
|
+
state: string;
|
|
81
|
+
tag_ids: string[];
|
|
82
|
+
type: string;
|
|
83
|
+
metadata: Record<string, string>;
|
|
84
|
+
}
|
|
85
|
+
interface UploadDocument {
|
|
86
|
+
name: string;
|
|
87
|
+
content: ArrayBuffer | Buffer | Uint8Array;
|
|
88
|
+
type: string;
|
|
89
|
+
metadata?: Record<string, string>;
|
|
90
|
+
}
|
|
91
|
+
interface UploadDocumentsParams {
|
|
92
|
+
documents: UploadDocument[];
|
|
93
|
+
}
|
|
94
|
+
interface UploadedDocument {
|
|
95
|
+
document_id: string;
|
|
96
|
+
document_name: string;
|
|
97
|
+
upload_date: string;
|
|
98
|
+
uploaded_by: string;
|
|
99
|
+
state: string;
|
|
100
|
+
tag_ids: string[];
|
|
101
|
+
type?: string;
|
|
102
|
+
metadata: Record<string, string>;
|
|
103
|
+
}
|
|
104
|
+
interface UploadDocumentsResponse {
|
|
105
|
+
documents: UploadedDocument[];
|
|
106
|
+
}
|
|
107
|
+
interface GetDocumentParams {
|
|
108
|
+
documentId: string;
|
|
109
|
+
fileType: string;
|
|
110
|
+
}
|
|
111
|
+
interface GetDocumentResponse {
|
|
112
|
+
id: string;
|
|
113
|
+
pdf_id: string;
|
|
114
|
+
document_name: string;
|
|
115
|
+
upload_date: string;
|
|
116
|
+
uploaded_by: string;
|
|
117
|
+
state: string;
|
|
118
|
+
tag_ids: string[];
|
|
119
|
+
type: string;
|
|
120
|
+
metadata: Record<string, string>;
|
|
121
|
+
content: ArrayBuffer;
|
|
122
|
+
}
|
|
123
|
+
interface UpdateDocumentParams {
|
|
124
|
+
documentId: string;
|
|
125
|
+
documentName?: string;
|
|
126
|
+
tagIds?: string[];
|
|
127
|
+
metadata?: Record<string, string>;
|
|
128
|
+
}
|
|
129
|
+
interface DeleteDocumentParams {
|
|
130
|
+
documentId: string;
|
|
131
|
+
}
|
|
132
|
+
interface ListDocumentsParams {
|
|
133
|
+
skip?: number;
|
|
134
|
+
limit?: number;
|
|
135
|
+
tagIds?: string;
|
|
136
|
+
nameSearch?: string;
|
|
137
|
+
metadataSearch?: string;
|
|
138
|
+
}
|
|
139
|
+
interface ListDocumentsResponse {
|
|
140
|
+
documents: Document[];
|
|
141
|
+
total_count: number;
|
|
142
|
+
skip: number;
|
|
143
|
+
}
|
|
144
|
+
interface GetOCRBlocksParams {
|
|
145
|
+
documentId: string;
|
|
146
|
+
}
|
|
147
|
+
interface GetOCRTextParams {
|
|
148
|
+
documentId: string;
|
|
149
|
+
pageNum?: number;
|
|
150
|
+
}
|
|
151
|
+
interface GetOCRMetadataParams {
|
|
152
|
+
documentId: string;
|
|
153
|
+
}
|
|
154
|
+
interface GetOCRMetadataResponse {
|
|
155
|
+
document_id: string;
|
|
156
|
+
page_count: number;
|
|
157
|
+
processing_status: string;
|
|
158
|
+
created_at: string;
|
|
159
|
+
updated_at: string;
|
|
160
|
+
}
|
|
161
|
+
interface LLMChatMessage {
|
|
162
|
+
role: 'system' | 'user' | 'assistant';
|
|
163
|
+
content: string;
|
|
164
|
+
}
|
|
165
|
+
interface LLMChatRequest {
|
|
166
|
+
messages: LLMChatMessage[];
|
|
167
|
+
model?: string;
|
|
168
|
+
temperature?: number;
|
|
169
|
+
max_tokens?: number;
|
|
170
|
+
stream?: boolean;
|
|
171
|
+
}
|
|
172
|
+
interface LLMChatResponse {
|
|
173
|
+
message: LLMChatMessage;
|
|
174
|
+
usage?: {
|
|
175
|
+
prompt_tokens: number;
|
|
176
|
+
completion_tokens: number;
|
|
177
|
+
total_tokens: number;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
interface LLMChatStreamChunk {
|
|
181
|
+
type: 'chunk';
|
|
182
|
+
content: string;
|
|
183
|
+
done: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface LLMChatStreamError {
|
|
186
|
+
type: 'error';
|
|
187
|
+
error: string;
|
|
188
|
+
done: true;
|
|
189
|
+
}
|
|
190
|
+
interface ListLLMModelsParams {
|
|
191
|
+
providerName?: string;
|
|
192
|
+
providerEnabled?: boolean;
|
|
193
|
+
llmEnabled?: boolean;
|
|
194
|
+
}
|
|
195
|
+
interface LLMModel {
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
provider: string;
|
|
199
|
+
enabled: boolean;
|
|
200
|
+
}
|
|
201
|
+
interface ListLLMModelsResponse {
|
|
202
|
+
models: LLMModel[];
|
|
203
|
+
}
|
|
204
|
+
interface ListLLMProvidersResponse {
|
|
205
|
+
providers: Array<{
|
|
206
|
+
name: string;
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
configured: boolean;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
interface SetLLMProviderConfigRequest {
|
|
212
|
+
api_key?: string;
|
|
213
|
+
base_url?: string;
|
|
214
|
+
enabled?: boolean;
|
|
215
|
+
}
|
|
216
|
+
interface RunLLMParams {
|
|
217
|
+
documentId: string;
|
|
218
|
+
promptRevId: string;
|
|
219
|
+
force?: boolean;
|
|
220
|
+
}
|
|
221
|
+
interface RunLLMResponse {
|
|
222
|
+
result_id: string;
|
|
223
|
+
status: string;
|
|
224
|
+
}
|
|
225
|
+
interface GetLLMResultParams {
|
|
226
|
+
documentId: string;
|
|
227
|
+
promptRevId: string;
|
|
228
|
+
fallback?: boolean;
|
|
229
|
+
}
|
|
230
|
+
interface GetLLMResultResponse {
|
|
231
|
+
result: Record<string, unknown>;
|
|
232
|
+
is_verified: boolean;
|
|
233
|
+
created_at: string;
|
|
234
|
+
updated_at: string;
|
|
235
|
+
}
|
|
236
|
+
interface DeleteLLMResultParams {
|
|
237
|
+
documentId: string;
|
|
238
|
+
promptId: string;
|
|
239
|
+
}
|
|
240
|
+
interface User {
|
|
241
|
+
id: string;
|
|
242
|
+
email: string;
|
|
243
|
+
name: string;
|
|
244
|
+
role: string;
|
|
245
|
+
created_at: string;
|
|
246
|
+
updated_at: string;
|
|
247
|
+
}
|
|
248
|
+
interface UserCreate {
|
|
249
|
+
email: string;
|
|
250
|
+
name: string;
|
|
251
|
+
password: string;
|
|
252
|
+
}
|
|
253
|
+
interface UserUpdate {
|
|
254
|
+
name?: string;
|
|
255
|
+
email?: string;
|
|
256
|
+
password?: string;
|
|
257
|
+
}
|
|
258
|
+
interface UserResponse {
|
|
259
|
+
user: User;
|
|
260
|
+
}
|
|
261
|
+
interface ListUsersParams {
|
|
262
|
+
skip?: number;
|
|
263
|
+
limit?: number;
|
|
264
|
+
organization_id?: string;
|
|
265
|
+
user_id?: string;
|
|
266
|
+
search_name?: string;
|
|
267
|
+
}
|
|
268
|
+
interface ListUsersResponse {
|
|
269
|
+
users: User[];
|
|
270
|
+
total_count: number;
|
|
271
|
+
skip: number;
|
|
272
|
+
}
|
|
273
|
+
interface Tag {
|
|
274
|
+
id: string;
|
|
275
|
+
name: string;
|
|
276
|
+
color: string;
|
|
277
|
+
created_at: string;
|
|
278
|
+
updated_at: string;
|
|
279
|
+
}
|
|
280
|
+
interface CreateTagParams {
|
|
281
|
+
tag: Omit<Tag, 'id' | 'created_at' | 'updated_at'>;
|
|
282
|
+
}
|
|
283
|
+
interface ListTagsParams {
|
|
284
|
+
skip?: number;
|
|
285
|
+
limit?: number;
|
|
286
|
+
nameSearch?: string;
|
|
287
|
+
}
|
|
288
|
+
interface ListTagsResponse {
|
|
289
|
+
tags: Tag[];
|
|
290
|
+
total_count: number;
|
|
291
|
+
skip: number;
|
|
292
|
+
}
|
|
293
|
+
interface UpdateTagParams {
|
|
294
|
+
tagId: string;
|
|
295
|
+
tag: Partial<Omit<Tag, 'id' | 'created_at' | 'updated_at'>>;
|
|
296
|
+
}
|
|
297
|
+
interface DeleteTagParams {
|
|
298
|
+
tagId: string;
|
|
299
|
+
}
|
|
300
|
+
interface PortalSessionResponse {
|
|
301
|
+
url: string;
|
|
302
|
+
}
|
|
303
|
+
interface SubscriptionResponse {
|
|
304
|
+
id: string;
|
|
305
|
+
status: string;
|
|
306
|
+
current_period_start: string;
|
|
307
|
+
current_period_end: string;
|
|
308
|
+
plan_id: string;
|
|
309
|
+
}
|
|
310
|
+
interface UsageResponse {
|
|
311
|
+
credits_used: number;
|
|
312
|
+
credits_remaining: number;
|
|
313
|
+
period_start: string;
|
|
314
|
+
period_end: string;
|
|
315
|
+
}
|
|
316
|
+
interface CreditConfig {
|
|
317
|
+
cost_per_credit: number;
|
|
318
|
+
credits_per_dollar: number;
|
|
319
|
+
}
|
|
320
|
+
interface CreditUpdateResponse {
|
|
321
|
+
credits_added: number;
|
|
322
|
+
new_balance: number;
|
|
323
|
+
}
|
|
324
|
+
interface UsageRangeRequest {
|
|
325
|
+
start_date: string;
|
|
326
|
+
end_date: string;
|
|
327
|
+
}
|
|
328
|
+
interface UsageRangeResponse {
|
|
329
|
+
usage: Array<{
|
|
330
|
+
date: string;
|
|
331
|
+
credits_used: number;
|
|
332
|
+
}>;
|
|
333
|
+
}
|
|
334
|
+
interface Form {
|
|
335
|
+
form_revid: string;
|
|
336
|
+
form_id: string;
|
|
337
|
+
form_version: number;
|
|
338
|
+
name: string;
|
|
339
|
+
response_format: {
|
|
340
|
+
json_formio?: Array<Record<string, unknown>>;
|
|
341
|
+
json_formio_mapping?: Record<string, Record<string, unknown>>;
|
|
342
|
+
};
|
|
343
|
+
created_at: string;
|
|
344
|
+
created_by: string;
|
|
345
|
+
}
|
|
346
|
+
interface CreateFormParams {
|
|
347
|
+
organizationId: string;
|
|
348
|
+
name: string;
|
|
349
|
+
response_format: {
|
|
350
|
+
json_formio?: Array<Record<string, unknown>>;
|
|
351
|
+
json_formio_mapping?: Record<string, Record<string, unknown>>;
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
interface ListFormsParams {
|
|
355
|
+
organizationId: string;
|
|
356
|
+
skip?: number;
|
|
357
|
+
limit?: number;
|
|
358
|
+
tag_ids?: string;
|
|
359
|
+
}
|
|
360
|
+
interface ListFormsResponse {
|
|
361
|
+
forms: Form[];
|
|
362
|
+
total_count: number;
|
|
363
|
+
skip: number;
|
|
364
|
+
}
|
|
365
|
+
interface GetFormParams {
|
|
366
|
+
organizationId: string;
|
|
367
|
+
formRevId: string;
|
|
368
|
+
}
|
|
369
|
+
interface UpdateFormParams {
|
|
370
|
+
organizationId: string;
|
|
371
|
+
formId: string;
|
|
372
|
+
form: Partial<Omit<Form, 'id' | 'created_at' | 'updated_at'>>;
|
|
373
|
+
}
|
|
374
|
+
interface DeleteFormParams {
|
|
375
|
+
organizationId: string;
|
|
376
|
+
formId: string;
|
|
377
|
+
}
|
|
378
|
+
interface FormSubmission {
|
|
379
|
+
id: string;
|
|
380
|
+
organization_id: string;
|
|
381
|
+
form_revid: string;
|
|
382
|
+
submission_data: Record<string, unknown>;
|
|
383
|
+
submitted_by?: string;
|
|
384
|
+
created_at: string;
|
|
385
|
+
updated_at: string;
|
|
386
|
+
}
|
|
387
|
+
interface SubmitFormParams {
|
|
388
|
+
organizationId: string;
|
|
389
|
+
documentId: string;
|
|
390
|
+
formRevId: string;
|
|
391
|
+
submission_data: Record<string, unknown>;
|
|
392
|
+
submitted_by?: string;
|
|
393
|
+
}
|
|
394
|
+
interface GetFormSubmissionParams {
|
|
395
|
+
organizationId: string;
|
|
396
|
+
documentId: string;
|
|
397
|
+
formRevId: string;
|
|
398
|
+
}
|
|
399
|
+
interface DeleteFormSubmissionParams {
|
|
400
|
+
organizationId: string;
|
|
401
|
+
documentId: string;
|
|
402
|
+
formRevId: string;
|
|
403
|
+
}
|
|
404
|
+
interface Prompt {
|
|
405
|
+
id: string;
|
|
406
|
+
name: string;
|
|
407
|
+
content: string;
|
|
408
|
+
created_at: string;
|
|
409
|
+
updated_at: string;
|
|
410
|
+
}
|
|
411
|
+
interface CreatePromptParams {
|
|
412
|
+
organizationId: string;
|
|
413
|
+
prompt: Omit<Prompt, 'id' | 'created_at' | 'updated_at'>;
|
|
414
|
+
}
|
|
415
|
+
interface ListPromptsParams {
|
|
416
|
+
organizationId: string;
|
|
417
|
+
skip?: number;
|
|
418
|
+
limit?: number;
|
|
419
|
+
document_id?: string;
|
|
420
|
+
tag_ids?: string;
|
|
421
|
+
nameSearch?: string;
|
|
422
|
+
}
|
|
423
|
+
interface ListPromptsResponse {
|
|
424
|
+
prompts: Prompt[];
|
|
425
|
+
total_count: number;
|
|
426
|
+
skip: number;
|
|
427
|
+
}
|
|
428
|
+
interface GetPromptParams {
|
|
429
|
+
organizationId: string;
|
|
430
|
+
promptRevId: string;
|
|
431
|
+
}
|
|
432
|
+
interface UpdatePromptParams {
|
|
433
|
+
organizationId: string;
|
|
434
|
+
promptId: string;
|
|
435
|
+
prompt: Partial<Omit<Prompt, 'id' | 'created_at' | 'updated_at'>>;
|
|
436
|
+
}
|
|
437
|
+
interface DeletePromptParams {
|
|
438
|
+
organizationId: string;
|
|
439
|
+
promptId: string;
|
|
440
|
+
}
|
|
441
|
+
interface Flow {
|
|
442
|
+
id: string;
|
|
443
|
+
name: string;
|
|
444
|
+
definition: Record<string, unknown>;
|
|
445
|
+
created_at: string;
|
|
446
|
+
updated_at: string;
|
|
447
|
+
}
|
|
448
|
+
interface CreateFlowParams {
|
|
449
|
+
organizationId: string;
|
|
450
|
+
flow: Omit<Flow, 'id' | 'created_at' | 'updated_at'>;
|
|
451
|
+
}
|
|
452
|
+
interface UpdateFlowParams {
|
|
453
|
+
organizationId: string;
|
|
454
|
+
flowId: string;
|
|
455
|
+
flow: Partial<Omit<Flow, 'id' | 'created_at' | 'updated_at'>>;
|
|
456
|
+
}
|
|
457
|
+
interface ListFlowsParams {
|
|
458
|
+
organizationId: string;
|
|
459
|
+
skip?: number;
|
|
460
|
+
limit?: number;
|
|
461
|
+
}
|
|
462
|
+
interface ListFlowsResponse {
|
|
463
|
+
flows: Flow[];
|
|
464
|
+
total_count: number;
|
|
465
|
+
skip: number;
|
|
466
|
+
}
|
|
467
|
+
interface GetFlowParams {
|
|
468
|
+
organizationId: string;
|
|
469
|
+
flowId: string;
|
|
470
|
+
}
|
|
471
|
+
interface DeleteFlowParams {
|
|
472
|
+
organizationId: string;
|
|
473
|
+
flowId: string;
|
|
474
|
+
}
|
|
475
|
+
interface Schema {
|
|
476
|
+
schema_revid: string;
|
|
477
|
+
schema_id: string;
|
|
478
|
+
schema_version: number;
|
|
479
|
+
name: string;
|
|
480
|
+
response_format: {
|
|
481
|
+
type: 'json_schema';
|
|
482
|
+
json_schema: Record<string, unknown>;
|
|
483
|
+
};
|
|
484
|
+
created_at: string;
|
|
485
|
+
created_by: string;
|
|
486
|
+
}
|
|
487
|
+
interface CreateSchemaParams {
|
|
488
|
+
organizationId: string;
|
|
489
|
+
name: string;
|
|
490
|
+
response_format: {
|
|
491
|
+
type: 'json_schema';
|
|
492
|
+
json_schema: Record<string, unknown>;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
interface ListSchemasParams {
|
|
496
|
+
organizationId: string;
|
|
497
|
+
skip?: number;
|
|
498
|
+
limit?: number;
|
|
499
|
+
nameSearch?: string;
|
|
500
|
+
}
|
|
501
|
+
interface ListSchemasResponse {
|
|
502
|
+
schemas: Schema[];
|
|
503
|
+
total_count: number;
|
|
504
|
+
skip: number;
|
|
505
|
+
}
|
|
506
|
+
interface GetSchemaParams {
|
|
507
|
+
organizationId: string;
|
|
508
|
+
schemaRevId: string;
|
|
509
|
+
}
|
|
510
|
+
interface UpdateSchemaParams {
|
|
511
|
+
organizationId: string;
|
|
512
|
+
schemaId: string;
|
|
513
|
+
schema: Partial<Omit<Schema, 'id' | 'created_at' | 'updated_at'>>;
|
|
514
|
+
}
|
|
515
|
+
interface DeleteSchemaParams {
|
|
516
|
+
organizationId: string;
|
|
517
|
+
schemaId: string;
|
|
518
|
+
}
|
|
519
|
+
interface InvitationResponse {
|
|
520
|
+
id: string;
|
|
521
|
+
email: string;
|
|
522
|
+
organization_id: string;
|
|
523
|
+
role: string;
|
|
524
|
+
created_at: string;
|
|
525
|
+
expires_at: string;
|
|
526
|
+
}
|
|
527
|
+
interface CreateInvitationRequest {
|
|
528
|
+
email: string;
|
|
529
|
+
organization_id: string;
|
|
530
|
+
role: string;
|
|
531
|
+
}
|
|
532
|
+
interface ListInvitationsParams {
|
|
533
|
+
skip?: number;
|
|
534
|
+
limit?: number;
|
|
535
|
+
}
|
|
536
|
+
interface ListInvitationsResponse {
|
|
537
|
+
invitations: InvitationResponse[];
|
|
538
|
+
total_count: number;
|
|
539
|
+
skip: number;
|
|
540
|
+
}
|
|
541
|
+
interface AcceptInvitationRequest {
|
|
542
|
+
name: string;
|
|
543
|
+
password: string;
|
|
544
|
+
}
|
|
545
|
+
interface AWSConfig {
|
|
546
|
+
access_key_id: string;
|
|
547
|
+
secret_access_key: string;
|
|
548
|
+
region: string;
|
|
549
|
+
created_at: string;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
declare class HttpClient {
|
|
553
|
+
private axios;
|
|
554
|
+
private config;
|
|
555
|
+
private isRefreshing;
|
|
556
|
+
private failedQueue;
|
|
557
|
+
constructor(config: DocRouterConfig);
|
|
558
|
+
private setupInterceptors;
|
|
559
|
+
private getToken;
|
|
560
|
+
private processQueue;
|
|
561
|
+
private handleAuthError;
|
|
562
|
+
private createApiError;
|
|
563
|
+
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
564
|
+
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
565
|
+
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
566
|
+
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
567
|
+
request<T = unknown>(config: AxiosRequestConfig): Promise<T>;
|
|
568
|
+
stream(url: string, data: unknown, onChunk: (chunk: unknown) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
|
|
569
|
+
updateToken(token: string): void;
|
|
570
|
+
updateTokenProvider(provider: () => Promise<string>): void;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* DocRouterAccount - For account-level operations with account tokens
|
|
575
|
+
* Use this for server-to-server integrations that need full account access
|
|
576
|
+
*/
|
|
577
|
+
declare class DocRouterAccount {
|
|
578
|
+
private http;
|
|
579
|
+
constructor(config: DocRouterAccountConfig);
|
|
580
|
+
/**
|
|
581
|
+
* Update the account token
|
|
582
|
+
*/
|
|
583
|
+
updateToken(token: string): void;
|
|
584
|
+
listOrganizations(params?: {
|
|
585
|
+
userId?: string;
|
|
586
|
+
organizationId?: string;
|
|
587
|
+
nameSearch?: string;
|
|
588
|
+
memberSearch?: string;
|
|
589
|
+
skip?: number;
|
|
590
|
+
limit?: number;
|
|
591
|
+
}): Promise<ListOrganizationsResponse>;
|
|
592
|
+
getOrganization(organizationId: string): Promise<Organization>;
|
|
593
|
+
createOrganization(organization: CreateOrganizationRequest): Promise<Organization>;
|
|
594
|
+
updateOrganization(organizationId: string, update: UpdateOrganizationRequest): Promise<Organization>;
|
|
595
|
+
deleteOrganization(organizationId: string): Promise<unknown>;
|
|
596
|
+
createAccountToken(request: CreateTokenRequest): Promise<unknown>;
|
|
597
|
+
getAccountTokens(): Promise<ListAccessTokensResponse | unknown>;
|
|
598
|
+
deleteAccountToken(tokenId: string): Promise<unknown>;
|
|
599
|
+
createOrganizationToken(request: CreateTokenRequest, organizationId: string): Promise<unknown>;
|
|
600
|
+
getOrganizationTokens(organizationId: string): Promise<unknown>;
|
|
601
|
+
deleteOrganizationToken(tokenId: string, organizationId: string): Promise<unknown>;
|
|
602
|
+
listLLMModels(params: ListLLMModelsParams): Promise<ListLLMModelsResponse>;
|
|
603
|
+
listLLMProviders(): Promise<ListLLMProvidersResponse>;
|
|
604
|
+
setLLMProviderConfig(providerName: string, request: SetLLMProviderConfigRequest): Promise<SetLLMProviderConfigRequest>;
|
|
605
|
+
listUsers(params?: ListUsersParams): Promise<ListUsersResponse>;
|
|
606
|
+
getUser(userId: string): Promise<UserResponse>;
|
|
607
|
+
createUser(user: UserCreate): Promise<UserResponse>;
|
|
608
|
+
updateUser(userId: string, update: UserUpdate): Promise<UserResponse>;
|
|
609
|
+
deleteUser(userId: string): Promise<void>;
|
|
610
|
+
sendVerificationEmail(userId: string): Promise<unknown>;
|
|
611
|
+
sendRegistrationVerificationEmail(userId: string): Promise<unknown>;
|
|
612
|
+
verifyEmail(token: string): Promise<unknown>;
|
|
613
|
+
createAWSConfig(config: Omit<AWSConfig, 'created_at'>): Promise<unknown>;
|
|
614
|
+
getAWSConfig(): Promise<unknown>;
|
|
615
|
+
deleteAWSConfig(): Promise<unknown>;
|
|
616
|
+
/**
|
|
617
|
+
* Get the current HTTP client (for advanced usage)
|
|
618
|
+
*/
|
|
619
|
+
getHttpClient(): HttpClient;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* DocRouterOrg - For organization-scoped operations with org tokens
|
|
624
|
+
* Use this when you have an organization token and want to work within that org
|
|
625
|
+
*/
|
|
626
|
+
declare class DocRouterOrg {
|
|
627
|
+
readonly organizationId: string;
|
|
628
|
+
private http;
|
|
629
|
+
constructor(config: DocRouterOrgConfig);
|
|
630
|
+
/**
|
|
631
|
+
* Update the organization token
|
|
632
|
+
*/
|
|
633
|
+
updateToken(token: string): void;
|
|
634
|
+
uploadDocuments(params: {
|
|
635
|
+
documents: Array<{
|
|
636
|
+
name: string;
|
|
637
|
+
content: ArrayBuffer | Buffer | Uint8Array;
|
|
638
|
+
type: string;
|
|
639
|
+
metadata?: Record<string, string>;
|
|
640
|
+
}>;
|
|
641
|
+
}): Promise<UploadDocumentsResponse>;
|
|
642
|
+
listDocuments(params?: {
|
|
643
|
+
skip?: number;
|
|
644
|
+
limit?: number;
|
|
645
|
+
tagIds?: string;
|
|
646
|
+
nameSearch?: string;
|
|
647
|
+
metadataSearch?: string;
|
|
648
|
+
}): Promise<ListDocumentsResponse>;
|
|
649
|
+
getDocument(params: {
|
|
650
|
+
documentId: string;
|
|
651
|
+
fileType: string;
|
|
652
|
+
}): Promise<GetDocumentResponse>;
|
|
653
|
+
updateDocument(params: {
|
|
654
|
+
documentId: string;
|
|
655
|
+
documentName?: string;
|
|
656
|
+
tagIds?: string[];
|
|
657
|
+
metadata?: Record<string, string>;
|
|
658
|
+
}): Promise<unknown>;
|
|
659
|
+
deleteDocument(params: {
|
|
660
|
+
documentId: string;
|
|
661
|
+
}): Promise<unknown>;
|
|
662
|
+
getOCRBlocks(params: {
|
|
663
|
+
documentId: string;
|
|
664
|
+
}): Promise<unknown>;
|
|
665
|
+
getOCRText(params: {
|
|
666
|
+
documentId: string;
|
|
667
|
+
pageNum?: number;
|
|
668
|
+
}): Promise<unknown>;
|
|
669
|
+
getOCRMetadata(params: {
|
|
670
|
+
documentId: string;
|
|
671
|
+
}): Promise<GetOCRMetadataResponse>;
|
|
672
|
+
runLLM(params: {
|
|
673
|
+
documentId: string;
|
|
674
|
+
promptRevId: string;
|
|
675
|
+
force?: boolean;
|
|
676
|
+
}): Promise<RunLLMResponse>;
|
|
677
|
+
getLLMResult(params: {
|
|
678
|
+
documentId: string;
|
|
679
|
+
promptRevId: string;
|
|
680
|
+
fallback?: boolean;
|
|
681
|
+
}): Promise<GetLLMResultResponse>;
|
|
682
|
+
updateLLMResult({ documentId, promptId, result, isVerified }: {
|
|
683
|
+
documentId: string;
|
|
684
|
+
promptId: string;
|
|
685
|
+
result: Record<string, unknown>;
|
|
686
|
+
isVerified?: boolean;
|
|
687
|
+
}): Promise<unknown>;
|
|
688
|
+
deleteLLMResult(params: {
|
|
689
|
+
documentId: string;
|
|
690
|
+
promptId: string;
|
|
691
|
+
}): Promise<unknown>;
|
|
692
|
+
downloadAllLLMResults(params: {
|
|
693
|
+
documentId: string;
|
|
694
|
+
}): Promise<unknown>;
|
|
695
|
+
createTag(params: {
|
|
696
|
+
tag: Omit<Tag, 'id' | 'created_at' | 'updated_at'>;
|
|
697
|
+
}): Promise<Tag>;
|
|
698
|
+
getTag({ tagId }: {
|
|
699
|
+
tagId: string;
|
|
700
|
+
}): Promise<Tag>;
|
|
701
|
+
listTags(params?: {
|
|
702
|
+
skip?: number;
|
|
703
|
+
limit?: number;
|
|
704
|
+
nameSearch?: string;
|
|
705
|
+
}): Promise<ListTagsResponse>;
|
|
706
|
+
updateTag(params: {
|
|
707
|
+
tagId: string;
|
|
708
|
+
tag: Partial<Omit<Tag, 'id' | 'created_at' | 'updated_at'>>;
|
|
709
|
+
}): Promise<Tag>;
|
|
710
|
+
deleteTag(params: {
|
|
711
|
+
tagId: string;
|
|
712
|
+
}): Promise<{
|
|
713
|
+
message: string;
|
|
714
|
+
}>;
|
|
715
|
+
createForm(form: Omit<CreateFormParams, 'organizationId'>): Promise<Form>;
|
|
716
|
+
listForms(params?: Omit<ListFormsParams, 'organizationId'>): Promise<ListFormsResponse>;
|
|
717
|
+
getForm(params: Omit<GetFormParams, 'organizationId'>): Promise<Form>;
|
|
718
|
+
updateForm(params: Omit<UpdateFormParams, 'organizationId'>): Promise<Form>;
|
|
719
|
+
deleteForm(params: Omit<DeleteFormParams, 'organizationId'>): Promise<{
|
|
720
|
+
message: string;
|
|
721
|
+
}>;
|
|
722
|
+
submitForm(params: Omit<SubmitFormParams, 'organizationId'>): Promise<FormSubmission>;
|
|
723
|
+
getFormSubmission(params: Omit<GetFormSubmissionParams, 'organizationId'>): Promise<FormSubmission | null>;
|
|
724
|
+
deleteFormSubmission(params: Omit<DeleteFormSubmissionParams, 'organizationId'>): Promise<void>;
|
|
725
|
+
createPrompt(params: Omit<CreatePromptParams, 'organizationId'>): Promise<Prompt>;
|
|
726
|
+
listPrompts(params: Omit<ListPromptsParams, 'organizationId'>): Promise<ListPromptsResponse>;
|
|
727
|
+
getPrompt(params: Omit<GetPromptParams, 'organizationId'>): Promise<Prompt>;
|
|
728
|
+
updatePrompt(params: Omit<UpdatePromptParams, 'organizationId'>): Promise<Prompt>;
|
|
729
|
+
deletePrompt(params: Omit<DeletePromptParams, 'organizationId'>): Promise<{
|
|
730
|
+
message: string;
|
|
731
|
+
}>;
|
|
732
|
+
createSchema(schema: Omit<CreateSchemaParams, 'organizationId'>): Promise<Schema>;
|
|
733
|
+
listSchemas(params: Omit<ListSchemasParams, 'organizationId'>): Promise<ListSchemasResponse>;
|
|
734
|
+
getSchema(params: Omit<GetSchemaParams, 'organizationId'>): Promise<Schema>;
|
|
735
|
+
updateSchema(params: Omit<UpdateSchemaParams, 'organizationId'>): Promise<Schema>;
|
|
736
|
+
deleteSchema(params: Omit<DeleteSchemaParams, 'organizationId'>): Promise<{
|
|
737
|
+
message: string;
|
|
738
|
+
}>;
|
|
739
|
+
validateAgainstSchema(params: {
|
|
740
|
+
schemaRevId: string;
|
|
741
|
+
data: Record<string, unknown>;
|
|
742
|
+
}): Promise<{
|
|
743
|
+
valid: boolean;
|
|
744
|
+
errors?: string[];
|
|
745
|
+
}>;
|
|
746
|
+
createFlow(params: Omit<CreateFlowParams, 'organizationId'>): Promise<Flow>;
|
|
747
|
+
updateFlow(params: Omit<UpdateFlowParams, 'organizationId'>): Promise<Flow>;
|
|
748
|
+
listFlows(params?: Omit<ListFlowsParams, 'organizationId'>): Promise<ListFlowsResponse>;
|
|
749
|
+
getFlow(params: Omit<GetFlowParams, 'organizationId'>): Promise<Flow>;
|
|
750
|
+
deleteFlow(params: Omit<DeleteFlowParams, 'organizationId'>): Promise<void>;
|
|
751
|
+
getCustomerPortal(): Promise<PortalSessionResponse>;
|
|
752
|
+
getSubscription(): Promise<SubscriptionResponse>;
|
|
753
|
+
activateSubscription(): Promise<{
|
|
754
|
+
status: string;
|
|
755
|
+
message: string;
|
|
756
|
+
}>;
|
|
757
|
+
cancelSubscription(): Promise<{
|
|
758
|
+
status: string;
|
|
759
|
+
message: string;
|
|
760
|
+
}>;
|
|
761
|
+
getCurrentUsage(): Promise<UsageResponse>;
|
|
762
|
+
addCredits(amount: number): Promise<CreditUpdateResponse>;
|
|
763
|
+
getCreditConfig(): Promise<CreditConfig>;
|
|
764
|
+
purchaseCredits(request: {
|
|
765
|
+
credits: number;
|
|
766
|
+
success_url: string;
|
|
767
|
+
cancel_url: string;
|
|
768
|
+
}): Promise<unknown>;
|
|
769
|
+
getUsageRange(request: UsageRangeRequest): Promise<UsageRangeResponse>;
|
|
770
|
+
createCheckoutSession(planId: string): Promise<PortalSessionResponse>;
|
|
771
|
+
runLLMChat(request: {
|
|
772
|
+
messages: Array<{
|
|
773
|
+
role: 'system' | 'user' | 'assistant';
|
|
774
|
+
content: string;
|
|
775
|
+
}>;
|
|
776
|
+
model?: string;
|
|
777
|
+
temperature?: number;
|
|
778
|
+
max_tokens?: number;
|
|
779
|
+
stream?: boolean;
|
|
780
|
+
}): Promise<unknown>;
|
|
781
|
+
runLLMChatStream(request: {
|
|
782
|
+
messages: Array<{
|
|
783
|
+
role: 'system' | 'user' | 'assistant';
|
|
784
|
+
content: string;
|
|
785
|
+
}>;
|
|
786
|
+
model?: string;
|
|
787
|
+
temperature?: number;
|
|
788
|
+
max_tokens?: number;
|
|
789
|
+
stream?: boolean;
|
|
790
|
+
}, onChunk: (chunk: unknown) => void, onError?: (error: Error) => void, abortSignal?: AbortSignal): Promise<void>;
|
|
791
|
+
/**
|
|
792
|
+
* Get the current HTTP client (for advanced usage)
|
|
793
|
+
*/
|
|
794
|
+
getHttpClient(): HttpClient;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
export { type AWSConfig, type AcceptInvitationRequest, type AccessToken, type ApiError, type CreateFlowParams, type CreateFormParams, type CreateInvitationRequest, type CreateOrganizationRequest, type CreatePromptParams, type CreateSchemaParams, type CreateTagParams, type CreateTokenRequest, type CreditConfig, type CreditUpdateResponse, type DeleteDocumentParams, type DeleteFlowParams, type DeleteFormParams, type DeleteFormSubmissionParams, type DeleteLLMResultParams, type DeletePromptParams, type DeleteSchemaParams, type DeleteTagParams, DocRouterAccount, type DocRouterAccountConfig, type DocRouterConfig, DocRouterOrg, type DocRouterOrgConfig, type Document, type Flow, type Form, type FormSubmission, type GetDocumentParams, type GetDocumentResponse, type GetFlowParams, type GetFormParams, type GetFormSubmissionParams, type GetLLMResultParams, type GetLLMResultResponse, type GetOCRBlocksParams, type GetOCRMetadataParams, type GetOCRMetadataResponse, type GetOCRTextParams, type GetPromptParams, type GetSchemaParams, HttpClient, type InvitationResponse, type LLMChatMessage, type LLMChatRequest, type LLMChatResponse, type LLMChatStreamChunk, type LLMChatStreamError, type LLMModel, type ListAccessTokensResponse, type ListDocumentsParams, type ListDocumentsResponse, type ListFlowsParams, type ListFlowsResponse, type ListFormsParams, type ListFormsResponse, type ListInvitationsParams, type ListInvitationsResponse, type ListLLMModelsParams, type ListLLMModelsResponse, type ListLLMProvidersResponse, type ListOrganizationsResponse, type ListPromptsParams, type ListPromptsResponse, type ListSchemasParams, type ListSchemasResponse, type ListTagsParams, type ListTagsResponse, type ListUsersParams, type ListUsersResponse, type Organization, type OrganizationMember, type OrganizationType, type PortalSessionResponse, type Prompt, type RunLLMParams, type RunLLMResponse, type Schema, type SetLLMProviderConfigRequest, type SubmitFormParams, type SubscriptionResponse, type Tag, type UpdateDocumentParams, type UpdateFlowParams, type UpdateFormParams, type UpdateOrganizationRequest, type UpdatePromptParams, type UpdateSchemaParams, type UpdateTagParams, type UploadDocument, type UploadDocumentsParams, type UploadDocumentsResponse, type UploadedDocument, type UsageRangeRequest, type UsageRangeResponse, type UsageResponse, type User, type UserCreate, type UserResponse, type UserUpdate };
|