flexorch-sdk 0.3.0 → 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/dist/index.cjs CHANGED
@@ -312,7 +312,7 @@ var Transport = class {
312
312
  this.fetchFn = fetchFn ?? globalThis.fetch.bind(globalThis);
313
313
  this.defaultHeaders = {
314
314
  "X-API-KEY": apiKey,
315
- "User-Agent": "flexorch-sdk-js/0.3.0"
315
+ "User-Agent": "flexorch-sdk-js/0.3.1"
316
316
  };
317
317
  }
318
318
  url(path, params) {
@@ -405,6 +405,8 @@ var Job = class _Job {
405
405
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
406
406
  executionId;
407
407
  hasDataset;
408
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
409
+ datasetId;
408
410
  /**
409
411
  * True when the underlying pipeline execution completed but one or more
410
412
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -425,6 +427,7 @@ var Job = class _Job {
425
427
  this.documentId = data.documentId;
426
428
  this.executionId = data.executionId;
427
429
  this.hasDataset = data.hasDataset;
430
+ this.datasetId = data.datasetId;
428
431
  this.degraded = data.degraded;
429
432
  this.failureReason = data.failureReason;
430
433
  this._transport = data._transport;
@@ -432,6 +435,7 @@ var Job = class _Job {
432
435
  static fromDict(data, transport) {
433
436
  const executionSummary = data["execution_summary"];
434
437
  const processingSummary = data["processing_summary"];
438
+ const datasetSummary = data["dataset_summary"];
435
439
  let quality = data["quality"];
436
440
  if (!quality && processingSummary) {
437
441
  quality = processingSummary["quality"];
@@ -445,7 +449,13 @@ var Job = class _Job {
445
449
  qualityScore: quality["score"] ?? null,
446
450
  documentId: data["document_id"] ?? null,
447
451
  executionId,
448
- hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? false),
452
+ // dataset_summary is only present on a completed dataset_build job's
453
+ // response — neither has_dataset nor processing_summary is ever set
454
+ // for that job type, so without this .dataset() always returned null
455
+ // for the job.buildDataset().wait().dataset() chain even though the
456
+ // dataset had been built successfully.
457
+ hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? Boolean(datasetSummary) ?? false),
458
+ datasetId: datasetSummary?.["dataset_id"] ?? null,
449
459
  degraded: Boolean(executionSummary?.["degraded"] ?? false),
450
460
  failureReason: data["failure_reason"] ?? null,
451
461
  _transport: transport
@@ -473,13 +483,17 @@ var Job = class _Job {
473
483
  throw new JobTimeoutError(this.id, timeout);
474
484
  }
475
485
  async dataset() {
486
+ const { Dataset: Dataset2 } = await Promise.resolve().then(() => (init_dataset(), dataset_exports));
487
+ if (this.datasetId !== null) {
488
+ const data2 = await this._transport.get(`/datasets/${this.datasetId}`);
489
+ return Dataset2.fromDict(data2, this._transport);
490
+ }
476
491
  if (!this.hasDataset) return null;
477
492
  const data = await this._transport.get("/datasets", {
478
493
  job_id: this.id
479
494
  });
480
495
  const items = data["items"] ?? [];
481
496
  if (items.length === 0) return null;
482
- const { Dataset: Dataset2 } = await Promise.resolve().then(() => (init_dataset(), dataset_exports));
483
497
  return Dataset2.fromDict(items[0], this._transport);
484
498
  }
485
499
  /**
@@ -1261,7 +1275,7 @@ var FlexOrchReader = class {
1261
1275
  };
1262
1276
 
1263
1277
  // src/index.ts
1264
- var version = "0.3.0";
1278
+ var version = "0.3.1";
1265
1279
  // Annotate the CommonJS export names for ESM import in node:
1266
1280
  0 && (module.exports = {
1267
1281
  AuthError,
package/dist/index.d.cts CHANGED
@@ -99,6 +99,8 @@ declare class Job {
99
99
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
100
100
  readonly executionId: number | null;
101
101
  readonly hasDataset: boolean;
102
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
103
+ readonly datasetId: number | null;
102
104
  /**
103
105
  * True when the underlying pipeline execution completed but one or more
104
106
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -119,6 +121,7 @@ declare class Job {
119
121
  documentId: string | null;
120
122
  executionId: number | null;
121
123
  hasDataset: boolean;
124
+ datasetId: number | null;
122
125
  degraded: boolean;
123
126
  failureReason: string | null;
124
127
  _transport: Transport;
@@ -603,6 +606,6 @@ declare class FlexOrchReader {
603
606
  toString(): string;
604
607
  }
605
608
 
606
- declare const version = "0.3.0";
609
+ declare const version = "0.3.1";
607
610
 
608
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
@@ -99,6 +99,8 @@ declare class Job {
99
99
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
100
100
  readonly executionId: number | null;
101
101
  readonly hasDataset: boolean;
102
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
103
+ readonly datasetId: number | null;
102
104
  /**
103
105
  * True when the underlying pipeline execution completed but one or more
104
106
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -119,6 +121,7 @@ declare class Job {
119
121
  documentId: string | null;
120
122
  executionId: number | null;
121
123
  hasDataset: boolean;
124
+ datasetId: number | null;
122
125
  degraded: boolean;
123
126
  failureReason: string | null;
124
127
  _transport: Transport;
@@ -603,6 +606,6 @@ declare class FlexOrchReader {
603
606
  toString(): string;
604
607
  }
605
608
 
606
- declare const version = "0.3.0";
609
+ declare const version = "0.3.1";
607
610
 
608
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.js CHANGED
@@ -123,7 +123,7 @@ var Transport = class {
123
123
  this.fetchFn = fetchFn ?? globalThis.fetch.bind(globalThis);
124
124
  this.defaultHeaders = {
125
125
  "X-API-KEY": apiKey,
126
- "User-Agent": "flexorch-sdk-js/0.3.0"
126
+ "User-Agent": "flexorch-sdk-js/0.3.1"
127
127
  };
128
128
  }
129
129
  url(path, params) {
@@ -216,6 +216,8 @@ var Job = class _Job {
216
216
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
217
217
  executionId;
218
218
  hasDataset;
219
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
220
+ datasetId;
219
221
  /**
220
222
  * True when the underlying pipeline execution completed but one or more
221
223
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -236,6 +238,7 @@ var Job = class _Job {
236
238
  this.documentId = data.documentId;
237
239
  this.executionId = data.executionId;
238
240
  this.hasDataset = data.hasDataset;
241
+ this.datasetId = data.datasetId;
239
242
  this.degraded = data.degraded;
240
243
  this.failureReason = data.failureReason;
241
244
  this._transport = data._transport;
@@ -243,6 +246,7 @@ var Job = class _Job {
243
246
  static fromDict(data, transport) {
244
247
  const executionSummary = data["execution_summary"];
245
248
  const processingSummary = data["processing_summary"];
249
+ const datasetSummary = data["dataset_summary"];
246
250
  let quality = data["quality"];
247
251
  if (!quality && processingSummary) {
248
252
  quality = processingSummary["quality"];
@@ -256,7 +260,13 @@ var Job = class _Job {
256
260
  qualityScore: quality["score"] ?? null,
257
261
  documentId: data["document_id"] ?? null,
258
262
  executionId,
259
- hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? false),
263
+ // dataset_summary is only present on a completed dataset_build job's
264
+ // response — neither has_dataset nor processing_summary is ever set
265
+ // for that job type, so without this .dataset() always returned null
266
+ // for the job.buildDataset().wait().dataset() chain even though the
267
+ // dataset had been built successfully.
268
+ hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? Boolean(datasetSummary) ?? false),
269
+ datasetId: datasetSummary?.["dataset_id"] ?? null,
260
270
  degraded: Boolean(executionSummary?.["degraded"] ?? false),
261
271
  failureReason: data["failure_reason"] ?? null,
262
272
  _transport: transport
@@ -284,13 +294,17 @@ var Job = class _Job {
284
294
  throw new JobTimeoutError(this.id, timeout);
285
295
  }
286
296
  async dataset() {
297
+ const { Dataset: Dataset2 } = await import("./dataset-E7EXJETI.js");
298
+ if (this.datasetId !== null) {
299
+ const data2 = await this._transport.get(`/datasets/${this.datasetId}`);
300
+ return Dataset2.fromDict(data2, this._transport);
301
+ }
287
302
  if (!this.hasDataset) return null;
288
303
  const data = await this._transport.get("/datasets", {
289
304
  job_id: this.id
290
305
  });
291
306
  const items = data["items"] ?? [];
292
307
  if (items.length === 0) return null;
293
- const { Dataset: Dataset2 } = await import("./dataset-E7EXJETI.js");
294
308
  return Dataset2.fromDict(items[0], this._transport);
295
309
  }
296
310
  /**
@@ -1068,7 +1082,7 @@ var FlexOrchReader = class {
1068
1082
  };
1069
1083
 
1070
1084
  // src/index.ts
1071
- var version = "0.3.0";
1085
+ var version = "0.3.1";
1072
1086
  export {
1073
1087
  AuthError,
1074
1088
  Connector,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flexorch-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript/JavaScript SDK for the FlexOrch API — process documents, build LLM-ready datasets",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",