flexorch-sdk 0.2.3 → 0.3.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 +90 -38
- package/dist/{chunk-35RGZSFP.js → chunk-4KCMMRD7.js} +22 -2
- package/dist/{dataset-PP755LIW.js → dataset-E7EXJETI.js} +1 -1
- package/dist/index.cjs +354 -17
- package/dist/index.d.cts +201 -8
- package/dist/index.d.ts +201 -8
- package/dist/index.js +333 -17
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -36,7 +36,9 @@ declare class Dataset {
|
|
|
36
36
|
_transport: Transport;
|
|
37
37
|
});
|
|
38
38
|
static fromDict(data: Record<string, unknown>, transport: Transport): Dataset;
|
|
39
|
-
export(format: ExportFormat
|
|
39
|
+
export(format: ExportFormat, opts?: {
|
|
40
|
+
minQuality?: string;
|
|
41
|
+
}): Promise<Uint8Array>;
|
|
40
42
|
exportToS3(connectorId: string, format: ExportFormat, prefix?: string): Promise<{
|
|
41
43
|
s3Key: string;
|
|
42
44
|
sizeBytes: number;
|
|
@@ -67,15 +69,35 @@ declare class Dataset {
|
|
|
67
69
|
chunksIndexed: number;
|
|
68
70
|
totalChunks: number;
|
|
69
71
|
}>;
|
|
72
|
+
/** Preview dataset rows. */
|
|
73
|
+
rows(opts?: {
|
|
74
|
+
page?: number;
|
|
75
|
+
pageSize?: number;
|
|
76
|
+
q?: string;
|
|
77
|
+
}): Promise<Record<string, unknown>>;
|
|
78
|
+
/** Quality/privacy profile — only available once status is "ready". */
|
|
79
|
+
profile(): Promise<Record<string, unknown>>;
|
|
80
|
+
/** KVKK/GDPR processing transparency report (Pro+ required). */
|
|
81
|
+
complianceReport(format?: "json" | "pdf"): Promise<Record<string, unknown> | Uint8Array>;
|
|
70
82
|
toString(): string;
|
|
71
83
|
}
|
|
72
84
|
|
|
85
|
+
interface JobFeedback {
|
|
86
|
+
id: string;
|
|
87
|
+
jobId: string;
|
|
88
|
+
rating: string;
|
|
89
|
+
issue: string | null;
|
|
90
|
+
notes: string | null;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
}
|
|
73
93
|
declare class Job {
|
|
74
94
|
readonly id: string;
|
|
75
95
|
readonly status: string;
|
|
76
96
|
readonly qualityGrade: string | null;
|
|
77
97
|
readonly qualityScore: number | null;
|
|
78
98
|
readonly documentId: string | null;
|
|
99
|
+
/** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
|
|
100
|
+
readonly executionId: number | null;
|
|
79
101
|
readonly hasDataset: boolean;
|
|
80
102
|
/**
|
|
81
103
|
* True when the underlying pipeline execution completed but one or more
|
|
@@ -95,6 +117,7 @@ declare class Job {
|
|
|
95
117
|
qualityGrade: string | null;
|
|
96
118
|
qualityScore: number | null;
|
|
97
119
|
documentId: string | null;
|
|
120
|
+
executionId: number | null;
|
|
98
121
|
hasDataset: boolean;
|
|
99
122
|
degraded: boolean;
|
|
100
123
|
failureReason: string | null;
|
|
@@ -106,6 +129,31 @@ declare class Job {
|
|
|
106
129
|
pollInterval?: number;
|
|
107
130
|
}): Promise<Job>;
|
|
108
131
|
dataset(): Promise<Dataset | null>;
|
|
132
|
+
/**
|
|
133
|
+
* Build a dataset from this job's execution.
|
|
134
|
+
*
|
|
135
|
+
* A completed data_process job does not have a dataset yet — building one
|
|
136
|
+
* is a separate, explicit step (`POST
|
|
137
|
+
* /datasets/build-from-execution/{executionId}`). Call this after
|
|
138
|
+
* `.wait()`, then `.wait()` again on the returned dataset_build Job before
|
|
139
|
+
* calling `.dataset()`:
|
|
140
|
+
*
|
|
141
|
+
* ```ts
|
|
142
|
+
* const job = await client.process("invoice.pdf");
|
|
143
|
+
* const done = await job.wait();
|
|
144
|
+
* const dataset = await (await done.buildDataset()).wait().then(j => j.dataset());
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @throws {Error} If this job has no executionId to build a dataset from
|
|
148
|
+
* (e.g. it failed, or is itself a dataset_build job).
|
|
149
|
+
*/
|
|
150
|
+
buildDataset(opts?: {
|
|
151
|
+
name?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
forceRebuild?: boolean;
|
|
155
|
+
replaceExisting?: boolean;
|
|
156
|
+
}): Promise<Job>;
|
|
109
157
|
toString(): string;
|
|
110
158
|
}
|
|
111
159
|
|
|
@@ -144,6 +192,20 @@ declare class JobsResource {
|
|
|
144
192
|
page?: number;
|
|
145
193
|
pageSize?: number;
|
|
146
194
|
}): Promise<Job[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Submit user feedback for a completed job. Upsert — a second call for the
|
|
197
|
+
* same job replaces the previous feedback.
|
|
198
|
+
*
|
|
199
|
+
* @param rating "up" or "down".
|
|
200
|
+
* @param opts.issue When rating="down": "wrong_doc_type" | "missing_fields" |
|
|
201
|
+
* "wrong_values" | "pii_missed" | "pii_over_masked" | "other".
|
|
202
|
+
*/
|
|
203
|
+
submitFeedback(jobId: string, rating: "up" | "down", opts?: {
|
|
204
|
+
issue?: string;
|
|
205
|
+
notes?: string;
|
|
206
|
+
}): Promise<JobFeedback>;
|
|
207
|
+
/** Existing feedback for a job, or null if none was submitted. */
|
|
208
|
+
getFeedback(jobId: string): Promise<JobFeedback | null>;
|
|
147
209
|
}
|
|
148
210
|
|
|
149
211
|
declare class DatasetsResource {
|
|
@@ -153,22 +215,120 @@ declare class DatasetsResource {
|
|
|
153
215
|
list(opts?: {
|
|
154
216
|
page?: number;
|
|
155
217
|
pageSize?: number;
|
|
218
|
+
status?: string;
|
|
219
|
+
sourceExecutionId?: number;
|
|
220
|
+
sourceDocumentId?: number;
|
|
221
|
+
q?: string;
|
|
156
222
|
}): Promise<Dataset[]>;
|
|
223
|
+
/**
|
|
224
|
+
* Build a dataset from a completed execution.
|
|
225
|
+
*
|
|
226
|
+
* Prefer `Job.buildDataset()` when you already have a Job object — this is
|
|
227
|
+
* the lower-level call for when you only have an executionId (e.g. from
|
|
228
|
+
* `Document.latestExecution`).
|
|
229
|
+
*
|
|
230
|
+
* @returns A dataset_build Job — call `.wait()` then `.dataset()`.
|
|
231
|
+
*/
|
|
232
|
+
buildFromExecution(executionId: number, opts?: {
|
|
233
|
+
name?: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
slug?: string;
|
|
236
|
+
forceRebuild?: boolean;
|
|
237
|
+
replaceExisting?: boolean;
|
|
238
|
+
}): Promise<Job>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare class Document {
|
|
242
|
+
readonly id: string;
|
|
243
|
+
readonly filename: string;
|
|
244
|
+
readonly fileExt: string;
|
|
245
|
+
readonly status: string;
|
|
246
|
+
readonly storagePath: string;
|
|
247
|
+
readonly createdAt: string;
|
|
248
|
+
readonly processingCount: number;
|
|
249
|
+
readonly latestExecution: Record<string, unknown> | null;
|
|
250
|
+
readonly dataset: Record<string, unknown> | null;
|
|
251
|
+
readonly processingHistory: Record<string, unknown>[];
|
|
252
|
+
readonly relatedDatasets: Record<string, unknown>[];
|
|
253
|
+
private readonly _transport;
|
|
254
|
+
constructor(data: {
|
|
255
|
+
id: string;
|
|
256
|
+
filename: string;
|
|
257
|
+
fileExt: string;
|
|
258
|
+
status: string;
|
|
259
|
+
storagePath: string;
|
|
260
|
+
createdAt: string;
|
|
261
|
+
processingCount: number;
|
|
262
|
+
latestExecution: Record<string, unknown> | null;
|
|
263
|
+
dataset: Record<string, unknown> | null;
|
|
264
|
+
processingHistory: Record<string, unknown>[];
|
|
265
|
+
relatedDatasets: Record<string, unknown>[];
|
|
266
|
+
_transport: Transport;
|
|
267
|
+
});
|
|
268
|
+
static fromDict(data: Record<string, unknown>, transport: Transport): Document;
|
|
269
|
+
/**
|
|
270
|
+
* Re-queue this document through the processing pipeline.
|
|
271
|
+
*
|
|
272
|
+
* Raises (via the API): 400 DOCUMENT_FILE_NOT_AVAILABLE if the source file
|
|
273
|
+
* is no longer on disk, or 400 REPROCESS_NOT_SUPPORTED for
|
|
274
|
+
* connector-sourced (e.g. S3) documents.
|
|
275
|
+
*/
|
|
276
|
+
reprocess(pipelineConfig?: Record<string, unknown>): Promise<Job>;
|
|
277
|
+
toString(): string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class DocumentsResource {
|
|
281
|
+
private readonly _t;
|
|
282
|
+
constructor(_t: Transport);
|
|
283
|
+
/** Fetch a single document, including processingHistory and relatedDatasets. */
|
|
284
|
+
get(documentId: string): Promise<Document>;
|
|
285
|
+
/** List documents for the current tenant, newest first. */
|
|
286
|
+
list(opts?: {
|
|
287
|
+
page?: number;
|
|
288
|
+
pageSize?: number;
|
|
289
|
+
}): Promise<Document[]>;
|
|
157
290
|
}
|
|
158
291
|
|
|
159
292
|
interface UsageSnapshot {
|
|
160
293
|
plan: string;
|
|
161
294
|
creditsUsed: number;
|
|
162
|
-
creditsLimit: number;
|
|
163
|
-
creditsRemaining: number;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
295
|
+
creditsLimit: number | null;
|
|
296
|
+
creditsRemaining: number | null;
|
|
297
|
+
isTrial: boolean;
|
|
298
|
+
trialEndsAt: string | null;
|
|
299
|
+
trialDaysRemaining: number | null;
|
|
300
|
+
}
|
|
301
|
+
interface UsageHistoryItem {
|
|
302
|
+
date: string;
|
|
303
|
+
creditsUsed: number;
|
|
304
|
+
jobsCount: number;
|
|
305
|
+
}
|
|
306
|
+
interface QualityTrendItem {
|
|
307
|
+
date: string;
|
|
308
|
+
avgQualityScore: number;
|
|
309
|
+
gradeDistribution: Record<string, number>;
|
|
310
|
+
avgFieldFillRate: number | null;
|
|
311
|
+
jobCount: number;
|
|
312
|
+
}
|
|
313
|
+
interface RateLimitStatus {
|
|
314
|
+
plan: string;
|
|
315
|
+
unlimited: boolean;
|
|
316
|
+
limit: number | null;
|
|
317
|
+
used: number | null;
|
|
318
|
+
remaining: number | null;
|
|
319
|
+
windowSeconds: number;
|
|
320
|
+
resetInSeconds: number | null;
|
|
167
321
|
}
|
|
168
322
|
declare class UsageResource {
|
|
169
323
|
private readonly _t;
|
|
170
324
|
constructor(_t: Transport);
|
|
171
325
|
current(): Promise<UsageSnapshot>;
|
|
326
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
327
|
+
history(period?: string): Promise<UsageHistoryItem[]>;
|
|
328
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
329
|
+
qualityTrend(period?: string): Promise<QualityTrendItem[]>;
|
|
330
|
+
/** Current rate limit configuration and window usage. Does not consume a request slot. */
|
|
331
|
+
rateLimits(): Promise<RateLimitStatus>;
|
|
172
332
|
}
|
|
173
333
|
|
|
174
334
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -220,6 +380,28 @@ interface S3ConnectorConfig {
|
|
|
220
380
|
secretAccessKey: string;
|
|
221
381
|
prefix?: string;
|
|
222
382
|
}
|
|
383
|
+
interface SyncSchedule {
|
|
384
|
+
id: string;
|
|
385
|
+
connectorId: string;
|
|
386
|
+
cronExpression: string;
|
|
387
|
+
prefixFilter: string | null;
|
|
388
|
+
isActive: boolean;
|
|
389
|
+
lastRunAt: string | null;
|
|
390
|
+
nextRunAt: string | null;
|
|
391
|
+
createdAt: string;
|
|
392
|
+
}
|
|
393
|
+
interface SyncLog {
|
|
394
|
+
id: string;
|
|
395
|
+
scheduleId: string;
|
|
396
|
+
startedAt: string;
|
|
397
|
+
completedAt: string | null;
|
|
398
|
+
filesFound: number;
|
|
399
|
+
filesNew: number;
|
|
400
|
+
filesSkipped: number;
|
|
401
|
+
filesFailed: number;
|
|
402
|
+
status: string;
|
|
403
|
+
errorMessage: string | null;
|
|
404
|
+
}
|
|
223
405
|
|
|
224
406
|
declare class ConnectorsResource {
|
|
225
407
|
private readonly _t;
|
|
@@ -229,6 +411,16 @@ declare class ConnectorsResource {
|
|
|
229
411
|
get(connectorId: string): Promise<Connector>;
|
|
230
412
|
delete(connectorId: string): Promise<void>;
|
|
231
413
|
test(connectorId: string): Promise<ConnectorTestResult>;
|
|
414
|
+
/** Define a scheduled sync for a connector (Pro+ required). */
|
|
415
|
+
createSchedule(connectorId: string, cronExpression: string, prefixFilter?: string | null): Promise<SyncSchedule>;
|
|
416
|
+
/** Active schedules for a connector. */
|
|
417
|
+
listSchedules(connectorId: string): Promise<SyncSchedule[]>;
|
|
418
|
+
/** Delete a scheduled sync. */
|
|
419
|
+
deleteSchedule(connectorId: string, scheduleId: string): Promise<void>;
|
|
420
|
+
/** Run a schedule immediately instead of waiting for its cron time. */
|
|
421
|
+
triggerSchedule(connectorId: string, scheduleId: string): Promise<SyncLog>;
|
|
422
|
+
/** Recent sync run logs for a schedule. */
|
|
423
|
+
scheduleLogs(connectorId: string, scheduleId: string): Promise<SyncLog[]>;
|
|
232
424
|
}
|
|
233
425
|
|
|
234
426
|
interface FlexOrchClientOptions {
|
|
@@ -242,6 +434,7 @@ interface FlexOrchClientOptions {
|
|
|
242
434
|
declare class FlexOrchClient {
|
|
243
435
|
readonly jobs: JobsResource;
|
|
244
436
|
readonly datasets: DatasetsResource;
|
|
437
|
+
readonly documents: DocumentsResource;
|
|
245
438
|
readonly usage: UsageResource;
|
|
246
439
|
readonly webhooks: WebhooksResource;
|
|
247
440
|
readonly connectors: ConnectorsResource;
|
|
@@ -410,6 +603,6 @@ declare class FlexOrchReader {
|
|
|
410
603
|
toString(): string;
|
|
411
604
|
}
|
|
412
605
|
|
|
413
|
-
declare const version = "0.
|
|
606
|
+
declare const version = "0.3.0";
|
|
414
607
|
|
|
415
|
-
export { AuthError, Connector, type ConnectorTestResult, type ConnectorType, Dataset, type ExportFormat, FlexOrchClient, type FlexOrchClientOptions, FlexOrchError, FlexOrchReader, FlexOrchRetriever, Job, JobFailedError, JobTimeoutError, NotFoundError, QuotaError, RAGDocument, RateLimitError, type ReaderLoadOptions, type RetrieverOptions, type S3ConnectorConfig, type SearchFilters, SearchResult, ServerError, type UsageSnapshot, ValidationError, type Webhook, type WebhookEvent, version };
|
|
608
|
+
export { AuthError, Connector, type ConnectorTestResult, type ConnectorType, Dataset, Document, type ExportFormat, FlexOrchClient, type FlexOrchClientOptions, FlexOrchError, FlexOrchReader, FlexOrchRetriever, Job, JobFailedError, type JobFeedback, JobTimeoutError, NotFoundError, type QualityTrendItem, QuotaError, RAGDocument, RateLimitError, type RateLimitStatus, type ReaderLoadOptions, type RetrieverOptions, type S3ConnectorConfig, type SearchFilters, SearchResult, ServerError, type SyncLog, type SyncSchedule, type UsageHistoryItem, type UsageSnapshot, ValidationError, type Webhook, type WebhookEvent, version };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,9 @@ declare class Dataset {
|
|
|
36
36
|
_transport: Transport;
|
|
37
37
|
});
|
|
38
38
|
static fromDict(data: Record<string, unknown>, transport: Transport): Dataset;
|
|
39
|
-
export(format: ExportFormat
|
|
39
|
+
export(format: ExportFormat, opts?: {
|
|
40
|
+
minQuality?: string;
|
|
41
|
+
}): Promise<Uint8Array>;
|
|
40
42
|
exportToS3(connectorId: string, format: ExportFormat, prefix?: string): Promise<{
|
|
41
43
|
s3Key: string;
|
|
42
44
|
sizeBytes: number;
|
|
@@ -67,15 +69,35 @@ declare class Dataset {
|
|
|
67
69
|
chunksIndexed: number;
|
|
68
70
|
totalChunks: number;
|
|
69
71
|
}>;
|
|
72
|
+
/** Preview dataset rows. */
|
|
73
|
+
rows(opts?: {
|
|
74
|
+
page?: number;
|
|
75
|
+
pageSize?: number;
|
|
76
|
+
q?: string;
|
|
77
|
+
}): Promise<Record<string, unknown>>;
|
|
78
|
+
/** Quality/privacy profile — only available once status is "ready". */
|
|
79
|
+
profile(): Promise<Record<string, unknown>>;
|
|
80
|
+
/** KVKK/GDPR processing transparency report (Pro+ required). */
|
|
81
|
+
complianceReport(format?: "json" | "pdf"): Promise<Record<string, unknown> | Uint8Array>;
|
|
70
82
|
toString(): string;
|
|
71
83
|
}
|
|
72
84
|
|
|
85
|
+
interface JobFeedback {
|
|
86
|
+
id: string;
|
|
87
|
+
jobId: string;
|
|
88
|
+
rating: string;
|
|
89
|
+
issue: string | null;
|
|
90
|
+
notes: string | null;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
}
|
|
73
93
|
declare class Job {
|
|
74
94
|
readonly id: string;
|
|
75
95
|
readonly status: string;
|
|
76
96
|
readonly qualityGrade: string | null;
|
|
77
97
|
readonly qualityScore: number | null;
|
|
78
98
|
readonly documentId: string | null;
|
|
99
|
+
/** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
|
|
100
|
+
readonly executionId: number | null;
|
|
79
101
|
readonly hasDataset: boolean;
|
|
80
102
|
/**
|
|
81
103
|
* True when the underlying pipeline execution completed but one or more
|
|
@@ -95,6 +117,7 @@ declare class Job {
|
|
|
95
117
|
qualityGrade: string | null;
|
|
96
118
|
qualityScore: number | null;
|
|
97
119
|
documentId: string | null;
|
|
120
|
+
executionId: number | null;
|
|
98
121
|
hasDataset: boolean;
|
|
99
122
|
degraded: boolean;
|
|
100
123
|
failureReason: string | null;
|
|
@@ -106,6 +129,31 @@ declare class Job {
|
|
|
106
129
|
pollInterval?: number;
|
|
107
130
|
}): Promise<Job>;
|
|
108
131
|
dataset(): Promise<Dataset | null>;
|
|
132
|
+
/**
|
|
133
|
+
* Build a dataset from this job's execution.
|
|
134
|
+
*
|
|
135
|
+
* A completed data_process job does not have a dataset yet — building one
|
|
136
|
+
* is a separate, explicit step (`POST
|
|
137
|
+
* /datasets/build-from-execution/{executionId}`). Call this after
|
|
138
|
+
* `.wait()`, then `.wait()` again on the returned dataset_build Job before
|
|
139
|
+
* calling `.dataset()`:
|
|
140
|
+
*
|
|
141
|
+
* ```ts
|
|
142
|
+
* const job = await client.process("invoice.pdf");
|
|
143
|
+
* const done = await job.wait();
|
|
144
|
+
* const dataset = await (await done.buildDataset()).wait().then(j => j.dataset());
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @throws {Error} If this job has no executionId to build a dataset from
|
|
148
|
+
* (e.g. it failed, or is itself a dataset_build job).
|
|
149
|
+
*/
|
|
150
|
+
buildDataset(opts?: {
|
|
151
|
+
name?: string;
|
|
152
|
+
description?: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
forceRebuild?: boolean;
|
|
155
|
+
replaceExisting?: boolean;
|
|
156
|
+
}): Promise<Job>;
|
|
109
157
|
toString(): string;
|
|
110
158
|
}
|
|
111
159
|
|
|
@@ -144,6 +192,20 @@ declare class JobsResource {
|
|
|
144
192
|
page?: number;
|
|
145
193
|
pageSize?: number;
|
|
146
194
|
}): Promise<Job[]>;
|
|
195
|
+
/**
|
|
196
|
+
* Submit user feedback for a completed job. Upsert — a second call for the
|
|
197
|
+
* same job replaces the previous feedback.
|
|
198
|
+
*
|
|
199
|
+
* @param rating "up" or "down".
|
|
200
|
+
* @param opts.issue When rating="down": "wrong_doc_type" | "missing_fields" |
|
|
201
|
+
* "wrong_values" | "pii_missed" | "pii_over_masked" | "other".
|
|
202
|
+
*/
|
|
203
|
+
submitFeedback(jobId: string, rating: "up" | "down", opts?: {
|
|
204
|
+
issue?: string;
|
|
205
|
+
notes?: string;
|
|
206
|
+
}): Promise<JobFeedback>;
|
|
207
|
+
/** Existing feedback for a job, or null if none was submitted. */
|
|
208
|
+
getFeedback(jobId: string): Promise<JobFeedback | null>;
|
|
147
209
|
}
|
|
148
210
|
|
|
149
211
|
declare class DatasetsResource {
|
|
@@ -153,22 +215,120 @@ declare class DatasetsResource {
|
|
|
153
215
|
list(opts?: {
|
|
154
216
|
page?: number;
|
|
155
217
|
pageSize?: number;
|
|
218
|
+
status?: string;
|
|
219
|
+
sourceExecutionId?: number;
|
|
220
|
+
sourceDocumentId?: number;
|
|
221
|
+
q?: string;
|
|
156
222
|
}): Promise<Dataset[]>;
|
|
223
|
+
/**
|
|
224
|
+
* Build a dataset from a completed execution.
|
|
225
|
+
*
|
|
226
|
+
* Prefer `Job.buildDataset()` when you already have a Job object — this is
|
|
227
|
+
* the lower-level call for when you only have an executionId (e.g. from
|
|
228
|
+
* `Document.latestExecution`).
|
|
229
|
+
*
|
|
230
|
+
* @returns A dataset_build Job — call `.wait()` then `.dataset()`.
|
|
231
|
+
*/
|
|
232
|
+
buildFromExecution(executionId: number, opts?: {
|
|
233
|
+
name?: string;
|
|
234
|
+
description?: string;
|
|
235
|
+
slug?: string;
|
|
236
|
+
forceRebuild?: boolean;
|
|
237
|
+
replaceExisting?: boolean;
|
|
238
|
+
}): Promise<Job>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare class Document {
|
|
242
|
+
readonly id: string;
|
|
243
|
+
readonly filename: string;
|
|
244
|
+
readonly fileExt: string;
|
|
245
|
+
readonly status: string;
|
|
246
|
+
readonly storagePath: string;
|
|
247
|
+
readonly createdAt: string;
|
|
248
|
+
readonly processingCount: number;
|
|
249
|
+
readonly latestExecution: Record<string, unknown> | null;
|
|
250
|
+
readonly dataset: Record<string, unknown> | null;
|
|
251
|
+
readonly processingHistory: Record<string, unknown>[];
|
|
252
|
+
readonly relatedDatasets: Record<string, unknown>[];
|
|
253
|
+
private readonly _transport;
|
|
254
|
+
constructor(data: {
|
|
255
|
+
id: string;
|
|
256
|
+
filename: string;
|
|
257
|
+
fileExt: string;
|
|
258
|
+
status: string;
|
|
259
|
+
storagePath: string;
|
|
260
|
+
createdAt: string;
|
|
261
|
+
processingCount: number;
|
|
262
|
+
latestExecution: Record<string, unknown> | null;
|
|
263
|
+
dataset: Record<string, unknown> | null;
|
|
264
|
+
processingHistory: Record<string, unknown>[];
|
|
265
|
+
relatedDatasets: Record<string, unknown>[];
|
|
266
|
+
_transport: Transport;
|
|
267
|
+
});
|
|
268
|
+
static fromDict(data: Record<string, unknown>, transport: Transport): Document;
|
|
269
|
+
/**
|
|
270
|
+
* Re-queue this document through the processing pipeline.
|
|
271
|
+
*
|
|
272
|
+
* Raises (via the API): 400 DOCUMENT_FILE_NOT_AVAILABLE if the source file
|
|
273
|
+
* is no longer on disk, or 400 REPROCESS_NOT_SUPPORTED for
|
|
274
|
+
* connector-sourced (e.g. S3) documents.
|
|
275
|
+
*/
|
|
276
|
+
reprocess(pipelineConfig?: Record<string, unknown>): Promise<Job>;
|
|
277
|
+
toString(): string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class DocumentsResource {
|
|
281
|
+
private readonly _t;
|
|
282
|
+
constructor(_t: Transport);
|
|
283
|
+
/** Fetch a single document, including processingHistory and relatedDatasets. */
|
|
284
|
+
get(documentId: string): Promise<Document>;
|
|
285
|
+
/** List documents for the current tenant, newest first. */
|
|
286
|
+
list(opts?: {
|
|
287
|
+
page?: number;
|
|
288
|
+
pageSize?: number;
|
|
289
|
+
}): Promise<Document[]>;
|
|
157
290
|
}
|
|
158
291
|
|
|
159
292
|
interface UsageSnapshot {
|
|
160
293
|
plan: string;
|
|
161
294
|
creditsUsed: number;
|
|
162
|
-
creditsLimit: number;
|
|
163
|
-
creditsRemaining: number;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
295
|
+
creditsLimit: number | null;
|
|
296
|
+
creditsRemaining: number | null;
|
|
297
|
+
isTrial: boolean;
|
|
298
|
+
trialEndsAt: string | null;
|
|
299
|
+
trialDaysRemaining: number | null;
|
|
300
|
+
}
|
|
301
|
+
interface UsageHistoryItem {
|
|
302
|
+
date: string;
|
|
303
|
+
creditsUsed: number;
|
|
304
|
+
jobsCount: number;
|
|
305
|
+
}
|
|
306
|
+
interface QualityTrendItem {
|
|
307
|
+
date: string;
|
|
308
|
+
avgQualityScore: number;
|
|
309
|
+
gradeDistribution: Record<string, number>;
|
|
310
|
+
avgFieldFillRate: number | null;
|
|
311
|
+
jobCount: number;
|
|
312
|
+
}
|
|
313
|
+
interface RateLimitStatus {
|
|
314
|
+
plan: string;
|
|
315
|
+
unlimited: boolean;
|
|
316
|
+
limit: number | null;
|
|
317
|
+
used: number | null;
|
|
318
|
+
remaining: number | null;
|
|
319
|
+
windowSeconds: number;
|
|
320
|
+
resetInSeconds: number | null;
|
|
167
321
|
}
|
|
168
322
|
declare class UsageResource {
|
|
169
323
|
private readonly _t;
|
|
170
324
|
constructor(_t: Transport);
|
|
171
325
|
current(): Promise<UsageSnapshot>;
|
|
326
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
327
|
+
history(period?: string): Promise<UsageHistoryItem[]>;
|
|
328
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
329
|
+
qualityTrend(period?: string): Promise<QualityTrendItem[]>;
|
|
330
|
+
/** Current rate limit configuration and window usage. Does not consume a request slot. */
|
|
331
|
+
rateLimits(): Promise<RateLimitStatus>;
|
|
172
332
|
}
|
|
173
333
|
|
|
174
334
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -220,6 +380,28 @@ interface S3ConnectorConfig {
|
|
|
220
380
|
secretAccessKey: string;
|
|
221
381
|
prefix?: string;
|
|
222
382
|
}
|
|
383
|
+
interface SyncSchedule {
|
|
384
|
+
id: string;
|
|
385
|
+
connectorId: string;
|
|
386
|
+
cronExpression: string;
|
|
387
|
+
prefixFilter: string | null;
|
|
388
|
+
isActive: boolean;
|
|
389
|
+
lastRunAt: string | null;
|
|
390
|
+
nextRunAt: string | null;
|
|
391
|
+
createdAt: string;
|
|
392
|
+
}
|
|
393
|
+
interface SyncLog {
|
|
394
|
+
id: string;
|
|
395
|
+
scheduleId: string;
|
|
396
|
+
startedAt: string;
|
|
397
|
+
completedAt: string | null;
|
|
398
|
+
filesFound: number;
|
|
399
|
+
filesNew: number;
|
|
400
|
+
filesSkipped: number;
|
|
401
|
+
filesFailed: number;
|
|
402
|
+
status: string;
|
|
403
|
+
errorMessage: string | null;
|
|
404
|
+
}
|
|
223
405
|
|
|
224
406
|
declare class ConnectorsResource {
|
|
225
407
|
private readonly _t;
|
|
@@ -229,6 +411,16 @@ declare class ConnectorsResource {
|
|
|
229
411
|
get(connectorId: string): Promise<Connector>;
|
|
230
412
|
delete(connectorId: string): Promise<void>;
|
|
231
413
|
test(connectorId: string): Promise<ConnectorTestResult>;
|
|
414
|
+
/** Define a scheduled sync for a connector (Pro+ required). */
|
|
415
|
+
createSchedule(connectorId: string, cronExpression: string, prefixFilter?: string | null): Promise<SyncSchedule>;
|
|
416
|
+
/** Active schedules for a connector. */
|
|
417
|
+
listSchedules(connectorId: string): Promise<SyncSchedule[]>;
|
|
418
|
+
/** Delete a scheduled sync. */
|
|
419
|
+
deleteSchedule(connectorId: string, scheduleId: string): Promise<void>;
|
|
420
|
+
/** Run a schedule immediately instead of waiting for its cron time. */
|
|
421
|
+
triggerSchedule(connectorId: string, scheduleId: string): Promise<SyncLog>;
|
|
422
|
+
/** Recent sync run logs for a schedule. */
|
|
423
|
+
scheduleLogs(connectorId: string, scheduleId: string): Promise<SyncLog[]>;
|
|
232
424
|
}
|
|
233
425
|
|
|
234
426
|
interface FlexOrchClientOptions {
|
|
@@ -242,6 +434,7 @@ interface FlexOrchClientOptions {
|
|
|
242
434
|
declare class FlexOrchClient {
|
|
243
435
|
readonly jobs: JobsResource;
|
|
244
436
|
readonly datasets: DatasetsResource;
|
|
437
|
+
readonly documents: DocumentsResource;
|
|
245
438
|
readonly usage: UsageResource;
|
|
246
439
|
readonly webhooks: WebhooksResource;
|
|
247
440
|
readonly connectors: ConnectorsResource;
|
|
@@ -410,6 +603,6 @@ declare class FlexOrchReader {
|
|
|
410
603
|
toString(): string;
|
|
411
604
|
}
|
|
412
605
|
|
|
413
|
-
declare const version = "0.
|
|
606
|
+
declare const version = "0.3.0";
|
|
414
607
|
|
|
415
|
-
export { AuthError, Connector, type ConnectorTestResult, type ConnectorType, Dataset, type ExportFormat, FlexOrchClient, type FlexOrchClientOptions, FlexOrchError, FlexOrchReader, FlexOrchRetriever, Job, JobFailedError, JobTimeoutError, NotFoundError, QuotaError, RAGDocument, RateLimitError, type ReaderLoadOptions, type RetrieverOptions, type S3ConnectorConfig, type SearchFilters, SearchResult, ServerError, type UsageSnapshot, ValidationError, type Webhook, type WebhookEvent, version };
|
|
608
|
+
export { AuthError, Connector, type ConnectorTestResult, type ConnectorType, Dataset, Document, type ExportFormat, FlexOrchClient, type FlexOrchClientOptions, FlexOrchError, FlexOrchReader, FlexOrchRetriever, Job, JobFailedError, type JobFeedback, JobTimeoutError, NotFoundError, type QualityTrendItem, QuotaError, RAGDocument, RateLimitError, type RateLimitStatus, type ReaderLoadOptions, type RetrieverOptions, type S3ConnectorConfig, type SearchFilters, SearchResult, ServerError, type SyncLog, type SyncSchedule, type UsageHistoryItem, type UsageSnapshot, ValidationError, type Webhook, type WebhookEvent, version };
|