flexorch-sdk 0.3.0 → 0.3.2

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.
@@ -16,6 +16,9 @@ var Dataset = class _Dataset {
16
16
  slug;
17
17
  status;
18
18
  rowCount;
19
+ piiMasked;
20
+ piiFindingsCount;
21
+ piiTypeSummary;
19
22
  createdAt;
20
23
  availableFormats;
21
24
  _transport;
@@ -25,6 +28,9 @@ var Dataset = class _Dataset {
25
28
  this.slug = data.slug;
26
29
  this.status = data.status;
27
30
  this.rowCount = data.rowCount;
31
+ this.piiMasked = data.piiMasked;
32
+ this.piiFindingsCount = data.piiFindingsCount;
33
+ this.piiTypeSummary = data.piiTypeSummary;
28
34
  this.createdAt = data.createdAt;
29
35
  this.availableFormats = data.availableFormats;
30
36
  this._transport = data._transport;
@@ -32,12 +38,19 @@ var Dataset = class _Dataset {
32
38
  static fromDict(data, transport) {
33
39
  const fmt = data["format_summary"] ?? {};
34
40
  const files = fmt["files"] ?? {};
41
+ const privacy = data["privacy"];
42
+ const piiMasked = privacy ? Boolean(privacy["privacy_applied"] ?? false) : Boolean(data["privacy_applied"] ?? false);
43
+ const piiFindingsCount = privacy ? Number(privacy["pii_findings_count"] ?? 0) : Number(data["pii_findings_count"] ?? 0);
44
+ const piiTypeSummary = privacy ? privacy["pii_type_summary"] ?? {} : {};
35
45
  return new _Dataset({
36
46
  id: String(data["id"] ?? ""),
37
47
  name: String(data["name"] ?? ""),
38
48
  slug: String(data["slug"] ?? ""),
39
49
  status: String(data["status"] ?? ""),
40
50
  rowCount: Number(data["row_count"] ?? 0),
51
+ piiMasked,
52
+ piiFindingsCount,
53
+ piiTypeSummary,
41
54
  createdAt: String(data["created_at"] ?? ""),
42
55
  availableFormats: Object.keys(files),
43
56
  _transport: transport
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Dataset
3
- } from "./chunk-4KCMMRD7.js";
3
+ } from "./chunk-U2CE5GVG.js";
4
4
  export {
5
5
  Dataset
6
6
  };
package/dist/index.cjs CHANGED
@@ -56,6 +56,9 @@ var init_dataset = __esm({
56
56
  slug;
57
57
  status;
58
58
  rowCount;
59
+ piiMasked;
60
+ piiFindingsCount;
61
+ piiTypeSummary;
59
62
  createdAt;
60
63
  availableFormats;
61
64
  _transport;
@@ -65,6 +68,9 @@ var init_dataset = __esm({
65
68
  this.slug = data.slug;
66
69
  this.status = data.status;
67
70
  this.rowCount = data.rowCount;
71
+ this.piiMasked = data.piiMasked;
72
+ this.piiFindingsCount = data.piiFindingsCount;
73
+ this.piiTypeSummary = data.piiTypeSummary;
68
74
  this.createdAt = data.createdAt;
69
75
  this.availableFormats = data.availableFormats;
70
76
  this._transport = data._transport;
@@ -72,12 +78,19 @@ var init_dataset = __esm({
72
78
  static fromDict(data, transport) {
73
79
  const fmt = data["format_summary"] ?? {};
74
80
  const files = fmt["files"] ?? {};
81
+ const privacy = data["privacy"];
82
+ const piiMasked = privacy ? Boolean(privacy["privacy_applied"] ?? false) : Boolean(data["privacy_applied"] ?? false);
83
+ const piiFindingsCount = privacy ? Number(privacy["pii_findings_count"] ?? 0) : Number(data["pii_findings_count"] ?? 0);
84
+ const piiTypeSummary = privacy ? privacy["pii_type_summary"] ?? {} : {};
75
85
  return new _Dataset({
76
86
  id: String(data["id"] ?? ""),
77
87
  name: String(data["name"] ?? ""),
78
88
  slug: String(data["slug"] ?? ""),
79
89
  status: String(data["status"] ?? ""),
80
90
  rowCount: Number(data["row_count"] ?? 0),
91
+ piiMasked,
92
+ piiFindingsCount,
93
+ piiTypeSummary,
81
94
  createdAt: String(data["created_at"] ?? ""),
82
95
  availableFormats: Object.keys(files),
83
96
  _transport: transport
@@ -312,7 +325,7 @@ var Transport = class {
312
325
  this.fetchFn = fetchFn ?? globalThis.fetch.bind(globalThis);
313
326
  this.defaultHeaders = {
314
327
  "X-API-KEY": apiKey,
315
- "User-Agent": "flexorch-sdk-js/0.3.0"
328
+ "User-Agent": "flexorch-sdk-js/0.3.2"
316
329
  };
317
330
  }
318
331
  url(path, params) {
@@ -405,6 +418,8 @@ var Job = class _Job {
405
418
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
406
419
  executionId;
407
420
  hasDataset;
421
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
422
+ datasetId;
408
423
  /**
409
424
  * True when the underlying pipeline execution completed but one or more
410
425
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -416,6 +431,9 @@ var Job = class _Job {
416
431
  */
417
432
  degraded;
418
433
  failureReason;
434
+ piiMasked;
435
+ piiFindingsCount;
436
+ piiTypeSummary;
419
437
  _transport;
420
438
  constructor(data) {
421
439
  this.id = data.id;
@@ -425,13 +443,19 @@ var Job = class _Job {
425
443
  this.documentId = data.documentId;
426
444
  this.executionId = data.executionId;
427
445
  this.hasDataset = data.hasDataset;
446
+ this.datasetId = data.datasetId;
428
447
  this.degraded = data.degraded;
429
448
  this.failureReason = data.failureReason;
449
+ this.piiMasked = data.piiMasked;
450
+ this.piiFindingsCount = data.piiFindingsCount;
451
+ this.piiTypeSummary = data.piiTypeSummary;
430
452
  this._transport = data._transport;
431
453
  }
432
454
  static fromDict(data, transport) {
433
455
  const executionSummary = data["execution_summary"];
434
456
  const processingSummary = data["processing_summary"];
457
+ const datasetSummary = data["dataset_summary"];
458
+ const privacy = executionSummary?.["privacy"];
435
459
  let quality = data["quality"];
436
460
  if (!quality && processingSummary) {
437
461
  quality = processingSummary["quality"];
@@ -445,9 +469,22 @@ var Job = class _Job {
445
469
  qualityScore: quality["score"] ?? null,
446
470
  documentId: data["document_id"] ?? null,
447
471
  executionId,
448
- hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? false),
472
+ // dataset_summary is only present on a completed dataset_build job's
473
+ // response — neither has_dataset nor processing_summary is ever set
474
+ // for that job type, so without this .dataset() always returned null
475
+ // for the job.buildDataset().wait().dataset() chain even though the
476
+ // dataset had been built successfully.
477
+ hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? Boolean(datasetSummary) ?? false),
478
+ datasetId: datasetSummary?.["dataset_id"] ?? null,
449
479
  degraded: Boolean(executionSummary?.["degraded"] ?? false),
450
480
  failureReason: data["failure_reason"] ?? null,
481
+ // execution_summary.privacy — computed fresh on every GET /jobs/{id}
482
+ // read, not frozen at job-completion time, so this works even for
483
+ // jobs older than this field. Defaults for jobs with no execution
484
+ // (e.g. dataset_build) or against an older API version.
485
+ piiMasked: Boolean(privacy?.["privacy_applied"] ?? false),
486
+ piiFindingsCount: Number(privacy?.["pii_findings_count"] ?? 0),
487
+ piiTypeSummary: privacy?.["pii_type_summary"] ?? {},
451
488
  _transport: transport
452
489
  });
453
490
  }
@@ -473,13 +510,17 @@ var Job = class _Job {
473
510
  throw new JobTimeoutError(this.id, timeout);
474
511
  }
475
512
  async dataset() {
513
+ const { Dataset: Dataset2 } = await Promise.resolve().then(() => (init_dataset(), dataset_exports));
514
+ if (this.datasetId !== null) {
515
+ const data2 = await this._transport.get(`/datasets/${this.datasetId}`);
516
+ return Dataset2.fromDict(data2, this._transport);
517
+ }
476
518
  if (!this.hasDataset) return null;
477
519
  const data = await this._transport.get("/datasets", {
478
520
  job_id: this.id
479
521
  });
480
522
  const items = data["items"] ?? [];
481
523
  if (items.length === 0) return null;
482
- const { Dataset: Dataset2 } = await Promise.resolve().then(() => (init_dataset(), dataset_exports));
483
524
  return Dataset2.fromDict(items[0], this._transport);
484
525
  }
485
526
  /**
@@ -1261,7 +1302,7 @@ var FlexOrchReader = class {
1261
1302
  };
1262
1303
 
1263
1304
  // src/index.ts
1264
- var version = "0.3.0";
1305
+ var version = "0.3.2";
1265
1306
  // Annotate the CommonJS export names for ESM import in node:
1266
1307
  0 && (module.exports = {
1267
1308
  AuthError,
package/dist/index.d.cts CHANGED
@@ -22,6 +22,9 @@ declare class Dataset {
22
22
  readonly slug: string;
23
23
  readonly status: string;
24
24
  readonly rowCount: number;
25
+ readonly piiMasked: boolean;
26
+ readonly piiFindingsCount: number;
27
+ readonly piiTypeSummary: Record<string, number>;
25
28
  readonly createdAt: string;
26
29
  readonly availableFormats: string[];
27
30
  private readonly _transport;
@@ -31,6 +34,9 @@ declare class Dataset {
31
34
  slug: string;
32
35
  status: string;
33
36
  rowCount: number;
37
+ piiMasked: boolean;
38
+ piiFindingsCount: number;
39
+ piiTypeSummary: Record<string, number>;
34
40
  createdAt: string;
35
41
  availableFormats: string[];
36
42
  _transport: Transport;
@@ -99,6 +105,8 @@ declare class Job {
99
105
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
100
106
  readonly executionId: number | null;
101
107
  readonly hasDataset: boolean;
108
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
109
+ readonly datasetId: number | null;
102
110
  /**
103
111
  * True when the underlying pipeline execution completed but one or more
104
112
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -110,6 +118,9 @@ declare class Job {
110
118
  */
111
119
  readonly degraded: boolean;
112
120
  readonly failureReason: string | null;
121
+ readonly piiMasked: boolean;
122
+ readonly piiFindingsCount: number;
123
+ readonly piiTypeSummary: Record<string, number>;
113
124
  private readonly _transport;
114
125
  constructor(data: {
115
126
  id: string;
@@ -119,8 +130,12 @@ declare class Job {
119
130
  documentId: string | null;
120
131
  executionId: number | null;
121
132
  hasDataset: boolean;
133
+ datasetId: number | null;
122
134
  degraded: boolean;
123
135
  failureReason: string | null;
136
+ piiMasked: boolean;
137
+ piiFindingsCount: number;
138
+ piiTypeSummary: Record<string, number>;
124
139
  _transport: Transport;
125
140
  });
126
141
  static fromDict(data: Record<string, unknown>, transport: Transport): Job;
@@ -603,6 +618,6 @@ declare class FlexOrchReader {
603
618
  toString(): string;
604
619
  }
605
620
 
606
- declare const version = "0.3.0";
621
+ declare const version = "0.3.2";
607
622
 
608
623
  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
@@ -22,6 +22,9 @@ declare class Dataset {
22
22
  readonly slug: string;
23
23
  readonly status: string;
24
24
  readonly rowCount: number;
25
+ readonly piiMasked: boolean;
26
+ readonly piiFindingsCount: number;
27
+ readonly piiTypeSummary: Record<string, number>;
25
28
  readonly createdAt: string;
26
29
  readonly availableFormats: string[];
27
30
  private readonly _transport;
@@ -31,6 +34,9 @@ declare class Dataset {
31
34
  slug: string;
32
35
  status: string;
33
36
  rowCount: number;
37
+ piiMasked: boolean;
38
+ piiFindingsCount: number;
39
+ piiTypeSummary: Record<string, number>;
34
40
  createdAt: string;
35
41
  availableFormats: string[];
36
42
  _transport: Transport;
@@ -99,6 +105,8 @@ declare class Job {
99
105
  /** Needed by buildDataset() — POST /datasets/build-from-execution/{executionId}. */
100
106
  readonly executionId: number | null;
101
107
  readonly hasDataset: boolean;
108
+ /** Set from `dataset_summary.dataset_id` on a completed dataset_build job's response. */
109
+ readonly datasetId: number | null;
102
110
  /**
103
111
  * True when the underlying pipeline execution completed but one or more
104
112
  * non-critical steps failed (e.g. structured extraction couldn't find a
@@ -110,6 +118,9 @@ declare class Job {
110
118
  */
111
119
  readonly degraded: boolean;
112
120
  readonly failureReason: string | null;
121
+ readonly piiMasked: boolean;
122
+ readonly piiFindingsCount: number;
123
+ readonly piiTypeSummary: Record<string, number>;
113
124
  private readonly _transport;
114
125
  constructor(data: {
115
126
  id: string;
@@ -119,8 +130,12 @@ declare class Job {
119
130
  documentId: string | null;
120
131
  executionId: number | null;
121
132
  hasDataset: boolean;
133
+ datasetId: number | null;
122
134
  degraded: boolean;
123
135
  failureReason: string | null;
136
+ piiMasked: boolean;
137
+ piiFindingsCount: number;
138
+ piiTypeSummary: Record<string, number>;
124
139
  _transport: Transport;
125
140
  });
126
141
  static fromDict(data: Record<string, unknown>, transport: Transport): Job;
@@ -603,6 +618,6 @@ declare class FlexOrchReader {
603
618
  toString(): string;
604
619
  }
605
620
 
606
- declare const version = "0.3.0";
621
+ declare const version = "0.3.2";
607
622
 
608
623
  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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Dataset
3
- } from "./chunk-4KCMMRD7.js";
3
+ } from "./chunk-U2CE5GVG.js";
4
4
 
5
5
  // src/errors.ts
6
6
  var FlexOrchError = class extends Error {
@@ -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.2"
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
@@ -227,6 +229,9 @@ var Job = class _Job {
227
229
  */
228
230
  degraded;
229
231
  failureReason;
232
+ piiMasked;
233
+ piiFindingsCount;
234
+ piiTypeSummary;
230
235
  _transport;
231
236
  constructor(data) {
232
237
  this.id = data.id;
@@ -236,13 +241,19 @@ var Job = class _Job {
236
241
  this.documentId = data.documentId;
237
242
  this.executionId = data.executionId;
238
243
  this.hasDataset = data.hasDataset;
244
+ this.datasetId = data.datasetId;
239
245
  this.degraded = data.degraded;
240
246
  this.failureReason = data.failureReason;
247
+ this.piiMasked = data.piiMasked;
248
+ this.piiFindingsCount = data.piiFindingsCount;
249
+ this.piiTypeSummary = data.piiTypeSummary;
241
250
  this._transport = data._transport;
242
251
  }
243
252
  static fromDict(data, transport) {
244
253
  const executionSummary = data["execution_summary"];
245
254
  const processingSummary = data["processing_summary"];
255
+ const datasetSummary = data["dataset_summary"];
256
+ const privacy = executionSummary?.["privacy"];
246
257
  let quality = data["quality"];
247
258
  if (!quality && processingSummary) {
248
259
  quality = processingSummary["quality"];
@@ -256,9 +267,22 @@ var Job = class _Job {
256
267
  qualityScore: quality["score"] ?? null,
257
268
  documentId: data["document_id"] ?? null,
258
269
  executionId,
259
- hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? false),
270
+ // dataset_summary is only present on a completed dataset_build job's
271
+ // response — neither has_dataset nor processing_summary is ever set
272
+ // for that job type, so without this .dataset() always returned null
273
+ // for the job.buildDataset().wait().dataset() chain even though the
274
+ // dataset had been built successfully.
275
+ hasDataset: Boolean(data["has_dataset"] ?? processingSummary?.["has_dataset"] ?? Boolean(datasetSummary) ?? false),
276
+ datasetId: datasetSummary?.["dataset_id"] ?? null,
260
277
  degraded: Boolean(executionSummary?.["degraded"] ?? false),
261
278
  failureReason: data["failure_reason"] ?? null,
279
+ // execution_summary.privacy — computed fresh on every GET /jobs/{id}
280
+ // read, not frozen at job-completion time, so this works even for
281
+ // jobs older than this field. Defaults for jobs with no execution
282
+ // (e.g. dataset_build) or against an older API version.
283
+ piiMasked: Boolean(privacy?.["privacy_applied"] ?? false),
284
+ piiFindingsCount: Number(privacy?.["pii_findings_count"] ?? 0),
285
+ piiTypeSummary: privacy?.["pii_type_summary"] ?? {},
262
286
  _transport: transport
263
287
  });
264
288
  }
@@ -284,13 +308,17 @@ var Job = class _Job {
284
308
  throw new JobTimeoutError(this.id, timeout);
285
309
  }
286
310
  async dataset() {
311
+ const { Dataset: Dataset2 } = await import("./dataset-UGUUKKH3.js");
312
+ if (this.datasetId !== null) {
313
+ const data2 = await this._transport.get(`/datasets/${this.datasetId}`);
314
+ return Dataset2.fromDict(data2, this._transport);
315
+ }
287
316
  if (!this.hasDataset) return null;
288
317
  const data = await this._transport.get("/datasets", {
289
318
  job_id: this.id
290
319
  });
291
320
  const items = data["items"] ?? [];
292
321
  if (items.length === 0) return null;
293
- const { Dataset: Dataset2 } = await import("./dataset-E7EXJETI.js");
294
322
  return Dataset2.fromDict(items[0], this._transport);
295
323
  }
296
324
  /**
@@ -1068,7 +1096,7 @@ var FlexOrchReader = class {
1068
1096
  };
1069
1097
 
1070
1098
  // src/index.ts
1071
- var version = "0.3.0";
1099
+ var version = "0.3.2";
1072
1100
  export {
1073
1101
  AuthError,
1074
1102
  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.2",
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",