flexorch-sdk 0.2.2 → 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 +93 -37
- package/dist/{chunk-35RGZSFP.js → chunk-4KCMMRD7.js} +22 -2
- package/dist/{dataset-PP755LIW.js → dataset-E7EXJETI.js} +1 -1
- package/dist/index.cjs +367 -17
- package/dist/index.d.cts +212 -8
- package/dist/index.d.ts +212 -8
- package/dist/index.js +346 -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,46 @@ 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
|
+
/**
|
|
103
|
+
* True when the underlying pipeline execution completed but one or more
|
|
104
|
+
* non-critical steps failed (e.g. structured extraction couldn't find a
|
|
105
|
+
* table in the document). The job still succeeds — PII detection and
|
|
106
|
+
* quality scoring results are still meaningful — but `records`/columns
|
|
107
|
+
* may be empty. Read from `execution_summary.degraded`; false for jobs
|
|
108
|
+
* with no execution (e.g. dataset_build). wait() does not throw for a
|
|
109
|
+
* degraded completion.
|
|
110
|
+
*/
|
|
111
|
+
readonly degraded: boolean;
|
|
80
112
|
readonly failureReason: string | null;
|
|
81
113
|
private readonly _transport;
|
|
82
114
|
constructor(data: {
|
|
@@ -85,7 +117,9 @@ declare class Job {
|
|
|
85
117
|
qualityGrade: string | null;
|
|
86
118
|
qualityScore: number | null;
|
|
87
119
|
documentId: string | null;
|
|
120
|
+
executionId: number | null;
|
|
88
121
|
hasDataset: boolean;
|
|
122
|
+
degraded: boolean;
|
|
89
123
|
failureReason: string | null;
|
|
90
124
|
_transport: Transport;
|
|
91
125
|
});
|
|
@@ -95,6 +129,31 @@ declare class Job {
|
|
|
95
129
|
pollInterval?: number;
|
|
96
130
|
}): Promise<Job>;
|
|
97
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>;
|
|
98
157
|
toString(): string;
|
|
99
158
|
}
|
|
100
159
|
|
|
@@ -133,6 +192,20 @@ declare class JobsResource {
|
|
|
133
192
|
page?: number;
|
|
134
193
|
pageSize?: number;
|
|
135
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>;
|
|
136
209
|
}
|
|
137
210
|
|
|
138
211
|
declare class DatasetsResource {
|
|
@@ -142,22 +215,120 @@ declare class DatasetsResource {
|
|
|
142
215
|
list(opts?: {
|
|
143
216
|
page?: number;
|
|
144
217
|
pageSize?: number;
|
|
218
|
+
status?: string;
|
|
219
|
+
sourceExecutionId?: number;
|
|
220
|
+
sourceDocumentId?: number;
|
|
221
|
+
q?: string;
|
|
145
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[]>;
|
|
146
290
|
}
|
|
147
291
|
|
|
148
292
|
interface UsageSnapshot {
|
|
149
293
|
plan: string;
|
|
150
294
|
creditsUsed: number;
|
|
151
|
-
creditsLimit: number;
|
|
152
|
-
creditsRemaining: number;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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;
|
|
156
321
|
}
|
|
157
322
|
declare class UsageResource {
|
|
158
323
|
private readonly _t;
|
|
159
324
|
constructor(_t: Transport);
|
|
160
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>;
|
|
161
332
|
}
|
|
162
333
|
|
|
163
334
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -209,6 +380,28 @@ interface S3ConnectorConfig {
|
|
|
209
380
|
secretAccessKey: string;
|
|
210
381
|
prefix?: string;
|
|
211
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
|
+
}
|
|
212
405
|
|
|
213
406
|
declare class ConnectorsResource {
|
|
214
407
|
private readonly _t;
|
|
@@ -218,6 +411,16 @@ declare class ConnectorsResource {
|
|
|
218
411
|
get(connectorId: string): Promise<Connector>;
|
|
219
412
|
delete(connectorId: string): Promise<void>;
|
|
220
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[]>;
|
|
221
424
|
}
|
|
222
425
|
|
|
223
426
|
interface FlexOrchClientOptions {
|
|
@@ -231,6 +434,7 @@ interface FlexOrchClientOptions {
|
|
|
231
434
|
declare class FlexOrchClient {
|
|
232
435
|
readonly jobs: JobsResource;
|
|
233
436
|
readonly datasets: DatasetsResource;
|
|
437
|
+
readonly documents: DocumentsResource;
|
|
234
438
|
readonly usage: UsageResource;
|
|
235
439
|
readonly webhooks: WebhooksResource;
|
|
236
440
|
readonly connectors: ConnectorsResource;
|
|
@@ -399,6 +603,6 @@ declare class FlexOrchReader {
|
|
|
399
603
|
toString(): string;
|
|
400
604
|
}
|
|
401
605
|
|
|
402
|
-
declare const version = "0.
|
|
606
|
+
declare const version = "0.3.0";
|
|
403
607
|
|
|
404
|
-
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,16 +69,46 @@ 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
|
+
/**
|
|
103
|
+
* True when the underlying pipeline execution completed but one or more
|
|
104
|
+
* non-critical steps failed (e.g. structured extraction couldn't find a
|
|
105
|
+
* table in the document). The job still succeeds — PII detection and
|
|
106
|
+
* quality scoring results are still meaningful — but `records`/columns
|
|
107
|
+
* may be empty. Read from `execution_summary.degraded`; false for jobs
|
|
108
|
+
* with no execution (e.g. dataset_build). wait() does not throw for a
|
|
109
|
+
* degraded completion.
|
|
110
|
+
*/
|
|
111
|
+
readonly degraded: boolean;
|
|
80
112
|
readonly failureReason: string | null;
|
|
81
113
|
private readonly _transport;
|
|
82
114
|
constructor(data: {
|
|
@@ -85,7 +117,9 @@ declare class Job {
|
|
|
85
117
|
qualityGrade: string | null;
|
|
86
118
|
qualityScore: number | null;
|
|
87
119
|
documentId: string | null;
|
|
120
|
+
executionId: number | null;
|
|
88
121
|
hasDataset: boolean;
|
|
122
|
+
degraded: boolean;
|
|
89
123
|
failureReason: string | null;
|
|
90
124
|
_transport: Transport;
|
|
91
125
|
});
|
|
@@ -95,6 +129,31 @@ declare class Job {
|
|
|
95
129
|
pollInterval?: number;
|
|
96
130
|
}): Promise<Job>;
|
|
97
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>;
|
|
98
157
|
toString(): string;
|
|
99
158
|
}
|
|
100
159
|
|
|
@@ -133,6 +192,20 @@ declare class JobsResource {
|
|
|
133
192
|
page?: number;
|
|
134
193
|
pageSize?: number;
|
|
135
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>;
|
|
136
209
|
}
|
|
137
210
|
|
|
138
211
|
declare class DatasetsResource {
|
|
@@ -142,22 +215,120 @@ declare class DatasetsResource {
|
|
|
142
215
|
list(opts?: {
|
|
143
216
|
page?: number;
|
|
144
217
|
pageSize?: number;
|
|
218
|
+
status?: string;
|
|
219
|
+
sourceExecutionId?: number;
|
|
220
|
+
sourceDocumentId?: number;
|
|
221
|
+
q?: string;
|
|
145
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[]>;
|
|
146
290
|
}
|
|
147
291
|
|
|
148
292
|
interface UsageSnapshot {
|
|
149
293
|
plan: string;
|
|
150
294
|
creditsUsed: number;
|
|
151
|
-
creditsLimit: number;
|
|
152
|
-
creditsRemaining: number;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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;
|
|
156
321
|
}
|
|
157
322
|
declare class UsageResource {
|
|
158
323
|
private readonly _t;
|
|
159
324
|
constructor(_t: Transport);
|
|
160
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>;
|
|
161
332
|
}
|
|
162
333
|
|
|
163
334
|
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
@@ -209,6 +380,28 @@ interface S3ConnectorConfig {
|
|
|
209
380
|
secretAccessKey: string;
|
|
210
381
|
prefix?: string;
|
|
211
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
|
+
}
|
|
212
405
|
|
|
213
406
|
declare class ConnectorsResource {
|
|
214
407
|
private readonly _t;
|
|
@@ -218,6 +411,16 @@ declare class ConnectorsResource {
|
|
|
218
411
|
get(connectorId: string): Promise<Connector>;
|
|
219
412
|
delete(connectorId: string): Promise<void>;
|
|
220
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[]>;
|
|
221
424
|
}
|
|
222
425
|
|
|
223
426
|
interface FlexOrchClientOptions {
|
|
@@ -231,6 +434,7 @@ interface FlexOrchClientOptions {
|
|
|
231
434
|
declare class FlexOrchClient {
|
|
232
435
|
readonly jobs: JobsResource;
|
|
233
436
|
readonly datasets: DatasetsResource;
|
|
437
|
+
readonly documents: DocumentsResource;
|
|
234
438
|
readonly usage: UsageResource;
|
|
235
439
|
readonly webhooks: WebhooksResource;
|
|
236
440
|
readonly connectors: ConnectorsResource;
|
|
@@ -399,6 +603,6 @@ declare class FlexOrchReader {
|
|
|
399
603
|
toString(): string;
|
|
400
604
|
}
|
|
401
605
|
|
|
402
|
-
declare const version = "0.
|
|
606
|
+
declare const version = "0.3.0";
|
|
403
607
|
|
|
404
|
-
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 };
|