flexorch-sdk 0.2.3 → 0.3.1
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 +369 -18
- package/dist/index.d.cts +204 -8
- package/dist/index.d.ts +204 -8
- package/dist/index.js +347 -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,16 +69,38 @@ 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;
|
|
102
|
+
/** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
|
|
103
|
+
readonly datasetId: number | null;
|
|
80
104
|
/**
|
|
81
105
|
* True when the underlying pipeline execution completed but one or more
|
|
82
106
|
* non-critical steps failed (e.g. structured extraction couldn't find a
|
|
@@ -95,7 +119,9 @@ declare class Job {
|
|
|
95
119
|
qualityGrade: string | null;
|
|
96
120
|
qualityScore: number | null;
|
|
97
121
|
documentId: string | null;
|
|
122
|
+
executionId: number | null;
|
|
98
123
|
hasDataset: boolean;
|
|
124
|
+
datasetId: number | null;
|
|
99
125
|
degraded: boolean;
|
|
100
126
|
failureReason: string | null;
|
|
101
127
|
_transport: Transport;
|
|
@@ -106,6 +132,31 @@ declare class Job {
|
|
|
106
132
|
pollInterval?: number;
|
|
107
133
|
}): Promise<Job>;
|
|
108
134
|
dataset(): Promise<Dataset | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Build a dataset from this job's execution.
|
|
137
|
+
*
|
|
138
|
+
* A completed data_process job does not have a dataset yet — building one
|
|
139
|
+
* is a separate, explicit step (`POST
|
|
140
|
+
* /datasets/build-from-execution/{executionId}`). Call this after
|
|
141
|
+
* `.wait()`, then `.wait()` again on the returned dataset_build Job before
|
|
142
|
+
* calling `.dataset()`:
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* const job = await client.process("invoice.pdf");
|
|
146
|
+
* const done = await job.wait();
|
|
147
|
+
* const dataset = await (await done.buildDataset()).wait().then(j => j.dataset());
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @throws {Error} If this job has no executionId to build a dataset from
|
|
151
|
+
* (e.g. it failed, or is itself a dataset_build job).
|
|
152
|
+
*/
|
|
153
|
+
buildDataset(opts?: {
|
|
154
|
+
name?: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
slug?: string;
|
|
157
|
+
forceRebuild?: boolean;
|
|
158
|
+
replaceExisting?: boolean;
|
|
159
|
+
}): Promise<Job>;
|
|
109
160
|
toString(): string;
|
|
110
161
|
}
|
|
111
162
|
|
|
@@ -144,6 +195,20 @@ declare class JobsResource {
|
|
|
144
195
|
page?: number;
|
|
145
196
|
pageSize?: number;
|
|
146
197
|
}): Promise<Job[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Submit user feedback for a completed job. Upsert — a second call for the
|
|
200
|
+
* same job replaces the previous feedback.
|
|
201
|
+
*
|
|
202
|
+
* @param rating "up" or "down".
|
|
203
|
+
* @param opts.issue When rating="down": "wrong_doc_type" | "missing_fields" |
|
|
204
|
+
* "wrong_values" | "pii_missed" | "pii_over_masked" | "other".
|
|
205
|
+
*/
|
|
206
|
+
submitFeedback(jobId: string, rating: "up" | "down", opts?: {
|
|
207
|
+
issue?: string;
|
|
208
|
+
notes?: string;
|
|
209
|
+
}): Promise<JobFeedback>;
|
|
210
|
+
/** Existing feedback for a job, or null if none was submitted. */
|
|
211
|
+
getFeedback(jobId: string): Promise<JobFeedback | null>;
|
|
147
212
|
}
|
|
148
213
|
|
|
149
214
|
declare class DatasetsResource {
|
|
@@ -153,22 +218,120 @@ declare class DatasetsResource {
|
|
|
153
218
|
list(opts?: {
|
|
154
219
|
page?: number;
|
|
155
220
|
pageSize?: number;
|
|
221
|
+
status?: string;
|
|
222
|
+
sourceExecutionId?: number;
|
|
223
|
+
sourceDocumentId?: number;
|
|
224
|
+
q?: string;
|
|
156
225
|
}): Promise<Dataset[]>;
|
|
226
|
+
/**
|
|
227
|
+
* Build a dataset from a completed execution.
|
|
228
|
+
*
|
|
229
|
+
* Prefer `Job.buildDataset()` when you already have a Job object — this is
|
|
230
|
+
* the lower-level call for when you only have an executionId (e.g. from
|
|
231
|
+
* `Document.latestExecution`).
|
|
232
|
+
*
|
|
233
|
+
* @returns A dataset_build Job — call `.wait()` then `.dataset()`.
|
|
234
|
+
*/
|
|
235
|
+
buildFromExecution(executionId: number, opts?: {
|
|
236
|
+
name?: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
slug?: string;
|
|
239
|
+
forceRebuild?: boolean;
|
|
240
|
+
replaceExisting?: boolean;
|
|
241
|
+
}): Promise<Job>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare class Document {
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly filename: string;
|
|
247
|
+
readonly fileExt: string;
|
|
248
|
+
readonly status: string;
|
|
249
|
+
readonly storagePath: string;
|
|
250
|
+
readonly createdAt: string;
|
|
251
|
+
readonly processingCount: number;
|
|
252
|
+
readonly latestExecution: Record<string, unknown> | null;
|
|
253
|
+
readonly dataset: Record<string, unknown> | null;
|
|
254
|
+
readonly processingHistory: Record<string, unknown>[];
|
|
255
|
+
readonly relatedDatasets: Record<string, unknown>[];
|
|
256
|
+
private readonly _transport;
|
|
257
|
+
constructor(data: {
|
|
258
|
+
id: string;
|
|
259
|
+
filename: string;
|
|
260
|
+
fileExt: string;
|
|
261
|
+
status: string;
|
|
262
|
+
storagePath: string;
|
|
263
|
+
createdAt: string;
|
|
264
|
+
processingCount: number;
|
|
265
|
+
latestExecution: Record<string, unknown> | null;
|
|
266
|
+
dataset: Record<string, unknown> | null;
|
|
267
|
+
processingHistory: Record<string, unknown>[];
|
|
268
|
+
relatedDatasets: Record<string, unknown>[];
|
|
269
|
+
_transport: Transport;
|
|
270
|
+
});
|
|
271
|
+
static fromDict(data: Record<string, unknown>, transport: Transport): Document;
|
|
272
|
+
/**
|
|
273
|
+
* Re-queue this document through the processing pipeline.
|
|
274
|
+
*
|
|
275
|
+
* Raises (via the API): 400 DOCUMENT_FILE_NOT_AVAILABLE if the source file
|
|
276
|
+
* is no longer on disk, or 400 REPROCESS_NOT_SUPPORTED for
|
|
277
|
+
* connector-sourced (e.g. S3) documents.
|
|
278
|
+
*/
|
|
279
|
+
reprocess(pipelineConfig?: Record<string, unknown>): Promise<Job>;
|
|
280
|
+
toString(): string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare class DocumentsResource {
|
|
284
|
+
private readonly _t;
|
|
285
|
+
constructor(_t: Transport);
|
|
286
|
+
/** Fetch a single document, including processingHistory and relatedDatasets. */
|
|
287
|
+
get(documentId: string): Promise<Document>;
|
|
288
|
+
/** List documents for the current tenant, newest first. */
|
|
289
|
+
list(opts?: {
|
|
290
|
+
page?: number;
|
|
291
|
+
pageSize?: number;
|
|
292
|
+
}): Promise<Document[]>;
|
|
157
293
|
}
|
|
158
294
|
|
|
159
295
|
interface UsageSnapshot {
|
|
160
296
|
plan: string;
|
|
161
297
|
creditsUsed: number;
|
|
162
|
-
creditsLimit: number;
|
|
163
|
-
creditsRemaining: number;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
298
|
+
creditsLimit: number | null;
|
|
299
|
+
creditsRemaining: number | null;
|
|
300
|
+
isTrial: boolean;
|
|
301
|
+
trialEndsAt: string | null;
|
|
302
|
+
trialDaysRemaining: number | null;
|
|
303
|
+
}
|
|
304
|
+
interface UsageHistoryItem {
|
|
305
|
+
date: string;
|
|
306
|
+
creditsUsed: number;
|
|
307
|
+
jobsCount: number;
|
|
308
|
+
}
|
|
309
|
+
interface QualityTrendItem {
|
|
310
|
+
date: string;
|
|
311
|
+
avgQualityScore: number;
|
|
312
|
+
gradeDistribution: Record<string, number>;
|
|
313
|
+
avgFieldFillRate: number | null;
|
|
314
|
+
jobCount: number;
|
|
315
|
+
}
|
|
316
|
+
interface RateLimitStatus {
|
|
317
|
+
plan: string;
|
|
318
|
+
unlimited: boolean;
|
|
319
|
+
limit: number | null;
|
|
320
|
+
used: number | null;
|
|
321
|
+
remaining: number | null;
|
|
322
|
+
windowSeconds: number;
|
|
323
|
+
resetInSeconds: number | null;
|
|
167
324
|
}
|
|
168
325
|
declare class UsageResource {
|
|
169
326
|
private readonly _t;
|
|
170
327
|
constructor(_t: Transport);
|
|
171
328
|
current(): Promise<UsageSnapshot>;
|
|
329
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
330
|
+
history(period?: string): Promise<UsageHistoryItem[]>;
|
|
331
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
332
|
+
qualityTrend(period?: string): Promise<QualityTrendItem[]>;
|
|
333
|
+
/** Current rate limit configuration and window usage. Does not consume a request slot. */
|
|
334
|
+
rateLimits(): Promise<RateLimitStatus>;
|
|
172
335
|
}
|
|
173
336
|
|
|
174
337
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -220,6 +383,28 @@ interface S3ConnectorConfig {
|
|
|
220
383
|
secretAccessKey: string;
|
|
221
384
|
prefix?: string;
|
|
222
385
|
}
|
|
386
|
+
interface SyncSchedule {
|
|
387
|
+
id: string;
|
|
388
|
+
connectorId: string;
|
|
389
|
+
cronExpression: string;
|
|
390
|
+
prefixFilter: string | null;
|
|
391
|
+
isActive: boolean;
|
|
392
|
+
lastRunAt: string | null;
|
|
393
|
+
nextRunAt: string | null;
|
|
394
|
+
createdAt: string;
|
|
395
|
+
}
|
|
396
|
+
interface SyncLog {
|
|
397
|
+
id: string;
|
|
398
|
+
scheduleId: string;
|
|
399
|
+
startedAt: string;
|
|
400
|
+
completedAt: string | null;
|
|
401
|
+
filesFound: number;
|
|
402
|
+
filesNew: number;
|
|
403
|
+
filesSkipped: number;
|
|
404
|
+
filesFailed: number;
|
|
405
|
+
status: string;
|
|
406
|
+
errorMessage: string | null;
|
|
407
|
+
}
|
|
223
408
|
|
|
224
409
|
declare class ConnectorsResource {
|
|
225
410
|
private readonly _t;
|
|
@@ -229,6 +414,16 @@ declare class ConnectorsResource {
|
|
|
229
414
|
get(connectorId: string): Promise<Connector>;
|
|
230
415
|
delete(connectorId: string): Promise<void>;
|
|
231
416
|
test(connectorId: string): Promise<ConnectorTestResult>;
|
|
417
|
+
/** Define a scheduled sync for a connector (Pro+ required). */
|
|
418
|
+
createSchedule(connectorId: string, cronExpression: string, prefixFilter?: string | null): Promise<SyncSchedule>;
|
|
419
|
+
/** Active schedules for a connector. */
|
|
420
|
+
listSchedules(connectorId: string): Promise<SyncSchedule[]>;
|
|
421
|
+
/** Delete a scheduled sync. */
|
|
422
|
+
deleteSchedule(connectorId: string, scheduleId: string): Promise<void>;
|
|
423
|
+
/** Run a schedule immediately instead of waiting for its cron time. */
|
|
424
|
+
triggerSchedule(connectorId: string, scheduleId: string): Promise<SyncLog>;
|
|
425
|
+
/** Recent sync run logs for a schedule. */
|
|
426
|
+
scheduleLogs(connectorId: string, scheduleId: string): Promise<SyncLog[]>;
|
|
232
427
|
}
|
|
233
428
|
|
|
234
429
|
interface FlexOrchClientOptions {
|
|
@@ -242,6 +437,7 @@ interface FlexOrchClientOptions {
|
|
|
242
437
|
declare class FlexOrchClient {
|
|
243
438
|
readonly jobs: JobsResource;
|
|
244
439
|
readonly datasets: DatasetsResource;
|
|
440
|
+
readonly documents: DocumentsResource;
|
|
245
441
|
readonly usage: UsageResource;
|
|
246
442
|
readonly webhooks: WebhooksResource;
|
|
247
443
|
readonly connectors: ConnectorsResource;
|
|
@@ -410,6 +606,6 @@ declare class FlexOrchReader {
|
|
|
410
606
|
toString(): string;
|
|
411
607
|
}
|
|
412
608
|
|
|
413
|
-
declare const version = "0.
|
|
609
|
+
declare const version = "0.3.1";
|
|
414
610
|
|
|
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 };
|
|
611
|
+
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,16 +69,38 @@ 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;
|
|
102
|
+
/** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
|
|
103
|
+
readonly datasetId: number | null;
|
|
80
104
|
/**
|
|
81
105
|
* True when the underlying pipeline execution completed but one or more
|
|
82
106
|
* non-critical steps failed (e.g. structured extraction couldn't find a
|
|
@@ -95,7 +119,9 @@ declare class Job {
|
|
|
95
119
|
qualityGrade: string | null;
|
|
96
120
|
qualityScore: number | null;
|
|
97
121
|
documentId: string | null;
|
|
122
|
+
executionId: number | null;
|
|
98
123
|
hasDataset: boolean;
|
|
124
|
+
datasetId: number | null;
|
|
99
125
|
degraded: boolean;
|
|
100
126
|
failureReason: string | null;
|
|
101
127
|
_transport: Transport;
|
|
@@ -106,6 +132,31 @@ declare class Job {
|
|
|
106
132
|
pollInterval?: number;
|
|
107
133
|
}): Promise<Job>;
|
|
108
134
|
dataset(): Promise<Dataset | null>;
|
|
135
|
+
/**
|
|
136
|
+
* Build a dataset from this job's execution.
|
|
137
|
+
*
|
|
138
|
+
* A completed data_process job does not have a dataset yet — building one
|
|
139
|
+
* is a separate, explicit step (`POST
|
|
140
|
+
* /datasets/build-from-execution/{executionId}`). Call this after
|
|
141
|
+
* `.wait()`, then `.wait()` again on the returned dataset_build Job before
|
|
142
|
+
* calling `.dataset()`:
|
|
143
|
+
*
|
|
144
|
+
* ```ts
|
|
145
|
+
* const job = await client.process("invoice.pdf");
|
|
146
|
+
* const done = await job.wait();
|
|
147
|
+
* const dataset = await (await done.buildDataset()).wait().then(j => j.dataset());
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* @throws {Error} If this job has no executionId to build a dataset from
|
|
151
|
+
* (e.g. it failed, or is itself a dataset_build job).
|
|
152
|
+
*/
|
|
153
|
+
buildDataset(opts?: {
|
|
154
|
+
name?: string;
|
|
155
|
+
description?: string;
|
|
156
|
+
slug?: string;
|
|
157
|
+
forceRebuild?: boolean;
|
|
158
|
+
replaceExisting?: boolean;
|
|
159
|
+
}): Promise<Job>;
|
|
109
160
|
toString(): string;
|
|
110
161
|
}
|
|
111
162
|
|
|
@@ -144,6 +195,20 @@ declare class JobsResource {
|
|
|
144
195
|
page?: number;
|
|
145
196
|
pageSize?: number;
|
|
146
197
|
}): Promise<Job[]>;
|
|
198
|
+
/**
|
|
199
|
+
* Submit user feedback for a completed job. Upsert — a second call for the
|
|
200
|
+
* same job replaces the previous feedback.
|
|
201
|
+
*
|
|
202
|
+
* @param rating "up" or "down".
|
|
203
|
+
* @param opts.issue When rating="down": "wrong_doc_type" | "missing_fields" |
|
|
204
|
+
* "wrong_values" | "pii_missed" | "pii_over_masked" | "other".
|
|
205
|
+
*/
|
|
206
|
+
submitFeedback(jobId: string, rating: "up" | "down", opts?: {
|
|
207
|
+
issue?: string;
|
|
208
|
+
notes?: string;
|
|
209
|
+
}): Promise<JobFeedback>;
|
|
210
|
+
/** Existing feedback for a job, or null if none was submitted. */
|
|
211
|
+
getFeedback(jobId: string): Promise<JobFeedback | null>;
|
|
147
212
|
}
|
|
148
213
|
|
|
149
214
|
declare class DatasetsResource {
|
|
@@ -153,22 +218,120 @@ declare class DatasetsResource {
|
|
|
153
218
|
list(opts?: {
|
|
154
219
|
page?: number;
|
|
155
220
|
pageSize?: number;
|
|
221
|
+
status?: string;
|
|
222
|
+
sourceExecutionId?: number;
|
|
223
|
+
sourceDocumentId?: number;
|
|
224
|
+
q?: string;
|
|
156
225
|
}): Promise<Dataset[]>;
|
|
226
|
+
/**
|
|
227
|
+
* Build a dataset from a completed execution.
|
|
228
|
+
*
|
|
229
|
+
* Prefer `Job.buildDataset()` when you already have a Job object — this is
|
|
230
|
+
* the lower-level call for when you only have an executionId (e.g. from
|
|
231
|
+
* `Document.latestExecution`).
|
|
232
|
+
*
|
|
233
|
+
* @returns A dataset_build Job — call `.wait()` then `.dataset()`.
|
|
234
|
+
*/
|
|
235
|
+
buildFromExecution(executionId: number, opts?: {
|
|
236
|
+
name?: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
slug?: string;
|
|
239
|
+
forceRebuild?: boolean;
|
|
240
|
+
replaceExisting?: boolean;
|
|
241
|
+
}): Promise<Job>;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
declare class Document {
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly filename: string;
|
|
247
|
+
readonly fileExt: string;
|
|
248
|
+
readonly status: string;
|
|
249
|
+
readonly storagePath: string;
|
|
250
|
+
readonly createdAt: string;
|
|
251
|
+
readonly processingCount: number;
|
|
252
|
+
readonly latestExecution: Record<string, unknown> | null;
|
|
253
|
+
readonly dataset: Record<string, unknown> | null;
|
|
254
|
+
readonly processingHistory: Record<string, unknown>[];
|
|
255
|
+
readonly relatedDatasets: Record<string, unknown>[];
|
|
256
|
+
private readonly _transport;
|
|
257
|
+
constructor(data: {
|
|
258
|
+
id: string;
|
|
259
|
+
filename: string;
|
|
260
|
+
fileExt: string;
|
|
261
|
+
status: string;
|
|
262
|
+
storagePath: string;
|
|
263
|
+
createdAt: string;
|
|
264
|
+
processingCount: number;
|
|
265
|
+
latestExecution: Record<string, unknown> | null;
|
|
266
|
+
dataset: Record<string, unknown> | null;
|
|
267
|
+
processingHistory: Record<string, unknown>[];
|
|
268
|
+
relatedDatasets: Record<string, unknown>[];
|
|
269
|
+
_transport: Transport;
|
|
270
|
+
});
|
|
271
|
+
static fromDict(data: Record<string, unknown>, transport: Transport): Document;
|
|
272
|
+
/**
|
|
273
|
+
* Re-queue this document through the processing pipeline.
|
|
274
|
+
*
|
|
275
|
+
* Raises (via the API): 400 DOCUMENT_FILE_NOT_AVAILABLE if the source file
|
|
276
|
+
* is no longer on disk, or 400 REPROCESS_NOT_SUPPORTED for
|
|
277
|
+
* connector-sourced (e.g. S3) documents.
|
|
278
|
+
*/
|
|
279
|
+
reprocess(pipelineConfig?: Record<string, unknown>): Promise<Job>;
|
|
280
|
+
toString(): string;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
declare class DocumentsResource {
|
|
284
|
+
private readonly _t;
|
|
285
|
+
constructor(_t: Transport);
|
|
286
|
+
/** Fetch a single document, including processingHistory and relatedDatasets. */
|
|
287
|
+
get(documentId: string): Promise<Document>;
|
|
288
|
+
/** List documents for the current tenant, newest first. */
|
|
289
|
+
list(opts?: {
|
|
290
|
+
page?: number;
|
|
291
|
+
pageSize?: number;
|
|
292
|
+
}): Promise<Document[]>;
|
|
157
293
|
}
|
|
158
294
|
|
|
159
295
|
interface UsageSnapshot {
|
|
160
296
|
plan: string;
|
|
161
297
|
creditsUsed: number;
|
|
162
|
-
creditsLimit: number;
|
|
163
|
-
creditsRemaining: number;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
298
|
+
creditsLimit: number | null;
|
|
299
|
+
creditsRemaining: number | null;
|
|
300
|
+
isTrial: boolean;
|
|
301
|
+
trialEndsAt: string | null;
|
|
302
|
+
trialDaysRemaining: number | null;
|
|
303
|
+
}
|
|
304
|
+
interface UsageHistoryItem {
|
|
305
|
+
date: string;
|
|
306
|
+
creditsUsed: number;
|
|
307
|
+
jobsCount: number;
|
|
308
|
+
}
|
|
309
|
+
interface QualityTrendItem {
|
|
310
|
+
date: string;
|
|
311
|
+
avgQualityScore: number;
|
|
312
|
+
gradeDistribution: Record<string, number>;
|
|
313
|
+
avgFieldFillRate: number | null;
|
|
314
|
+
jobCount: number;
|
|
315
|
+
}
|
|
316
|
+
interface RateLimitStatus {
|
|
317
|
+
plan: string;
|
|
318
|
+
unlimited: boolean;
|
|
319
|
+
limit: number | null;
|
|
320
|
+
used: number | null;
|
|
321
|
+
remaining: number | null;
|
|
322
|
+
windowSeconds: number;
|
|
323
|
+
resetInSeconds: number | null;
|
|
167
324
|
}
|
|
168
325
|
declare class UsageResource {
|
|
169
326
|
private readonly _t;
|
|
170
327
|
constructor(_t: Transport);
|
|
171
328
|
current(): Promise<UsageSnapshot>;
|
|
329
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
330
|
+
history(period?: string): Promise<UsageHistoryItem[]>;
|
|
331
|
+
/** @param period "7d" | "30d" | "90d". Default: "30d". */
|
|
332
|
+
qualityTrend(period?: string): Promise<QualityTrendItem[]>;
|
|
333
|
+
/** Current rate limit configuration and window usage. Does not consume a request slot. */
|
|
334
|
+
rateLimits(): Promise<RateLimitStatus>;
|
|
172
335
|
}
|
|
173
336
|
|
|
174
337
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -220,6 +383,28 @@ interface S3ConnectorConfig {
|
|
|
220
383
|
secretAccessKey: string;
|
|
221
384
|
prefix?: string;
|
|
222
385
|
}
|
|
386
|
+
interface SyncSchedule {
|
|
387
|
+
id: string;
|
|
388
|
+
connectorId: string;
|
|
389
|
+
cronExpression: string;
|
|
390
|
+
prefixFilter: string | null;
|
|
391
|
+
isActive: boolean;
|
|
392
|
+
lastRunAt: string | null;
|
|
393
|
+
nextRunAt: string | null;
|
|
394
|
+
createdAt: string;
|
|
395
|
+
}
|
|
396
|
+
interface SyncLog {
|
|
397
|
+
id: string;
|
|
398
|
+
scheduleId: string;
|
|
399
|
+
startedAt: string;
|
|
400
|
+
completedAt: string | null;
|
|
401
|
+
filesFound: number;
|
|
402
|
+
filesNew: number;
|
|
403
|
+
filesSkipped: number;
|
|
404
|
+
filesFailed: number;
|
|
405
|
+
status: string;
|
|
406
|
+
errorMessage: string | null;
|
|
407
|
+
}
|
|
223
408
|
|
|
224
409
|
declare class ConnectorsResource {
|
|
225
410
|
private readonly _t;
|
|
@@ -229,6 +414,16 @@ declare class ConnectorsResource {
|
|
|
229
414
|
get(connectorId: string): Promise<Connector>;
|
|
230
415
|
delete(connectorId: string): Promise<void>;
|
|
231
416
|
test(connectorId: string): Promise<ConnectorTestResult>;
|
|
417
|
+
/** Define a scheduled sync for a connector (Pro+ required). */
|
|
418
|
+
createSchedule(connectorId: string, cronExpression: string, prefixFilter?: string | null): Promise<SyncSchedule>;
|
|
419
|
+
/** Active schedules for a connector. */
|
|
420
|
+
listSchedules(connectorId: string): Promise<SyncSchedule[]>;
|
|
421
|
+
/** Delete a scheduled sync. */
|
|
422
|
+
deleteSchedule(connectorId: string, scheduleId: string): Promise<void>;
|
|
423
|
+
/** Run a schedule immediately instead of waiting for its cron time. */
|
|
424
|
+
triggerSchedule(connectorId: string, scheduleId: string): Promise<SyncLog>;
|
|
425
|
+
/** Recent sync run logs for a schedule. */
|
|
426
|
+
scheduleLogs(connectorId: string, scheduleId: string): Promise<SyncLog[]>;
|
|
232
427
|
}
|
|
233
428
|
|
|
234
429
|
interface FlexOrchClientOptions {
|
|
@@ -242,6 +437,7 @@ interface FlexOrchClientOptions {
|
|
|
242
437
|
declare class FlexOrchClient {
|
|
243
438
|
readonly jobs: JobsResource;
|
|
244
439
|
readonly datasets: DatasetsResource;
|
|
440
|
+
readonly documents: DocumentsResource;
|
|
245
441
|
readonly usage: UsageResource;
|
|
246
442
|
readonly webhooks: WebhooksResource;
|
|
247
443
|
readonly connectors: ConnectorsResource;
|
|
@@ -410,6 +606,6 @@ declare class FlexOrchReader {
|
|
|
410
606
|
toString(): string;
|
|
411
607
|
}
|
|
412
608
|
|
|
413
|
-
declare const version = "0.
|
|
609
|
+
declare const version = "0.3.1";
|
|
414
610
|
|
|
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 };
|
|
611
|
+
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 };
|