flexorch-sdk 0.3.2 → 0.3.3
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 +31 -7
- package/dist/index.d.cts +16 -3
- package/dist/index.d.ts +16 -3
- package/dist/index.js +31 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -325,7 +325,7 @@ var Transport = class {
|
|
|
325
325
|
this.fetchFn = fetchFn ?? globalThis.fetch.bind(globalThis);
|
|
326
326
|
this.defaultHeaders = {
|
|
327
327
|
"X-API-KEY": apiKey,
|
|
328
|
-
"User-Agent": "flexorch-sdk-js/0.3.
|
|
328
|
+
"User-Agent": "flexorch-sdk-js/0.3.3"
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
331
|
url(path, params) {
|
|
@@ -848,14 +848,25 @@ var UsageResource = class {
|
|
|
848
848
|
};
|
|
849
849
|
|
|
850
850
|
// src/resources/webhooks.ts
|
|
851
|
-
var VALID_EVENTS = /* @__PURE__ */ new Set(["dataset.ready", "job.completed", "job.failed"]);
|
|
851
|
+
var VALID_EVENTS = /* @__PURE__ */ new Set(["dataset.ready", "job.completed", "job.failed", "quota.warning"]);
|
|
852
|
+
function autoExportFromDict(data) {
|
|
853
|
+
if (!data || typeof data !== "object") return null;
|
|
854
|
+
const d = data;
|
|
855
|
+
return {
|
|
856
|
+
connectorId: Number(d["connector_id"] ?? 0),
|
|
857
|
+
format: String(d["format"] ?? ""),
|
|
858
|
+
prefix: d["prefix"] !== void 0 ? String(d["prefix"]) : void 0
|
|
859
|
+
};
|
|
860
|
+
}
|
|
852
861
|
function webhookFromDict(data) {
|
|
853
862
|
return {
|
|
854
863
|
id: String(data["id"] ?? ""),
|
|
855
864
|
url: String(data["url"] ?? ""),
|
|
856
865
|
events: data["events"] ?? [],
|
|
857
866
|
active: Boolean(data["active"] ?? true),
|
|
858
|
-
createdAt: String(data["created_at"] ?? "")
|
|
867
|
+
createdAt: String(data["created_at"] ?? ""),
|
|
868
|
+
autoExport: autoExportFromDict(data["auto_export"]),
|
|
869
|
+
secret: data["secret"] ?? null
|
|
859
870
|
};
|
|
860
871
|
}
|
|
861
872
|
var WebhooksResource = class {
|
|
@@ -863,12 +874,20 @@ var WebhooksResource = class {
|
|
|
863
874
|
this._t = _t;
|
|
864
875
|
}
|
|
865
876
|
_t;
|
|
866
|
-
async register(url, events) {
|
|
877
|
+
async register(url, events, autoExport) {
|
|
867
878
|
const invalid = events.filter((e) => !VALID_EVENTS.has(e));
|
|
868
879
|
if (invalid.length > 0) {
|
|
869
880
|
throw new Error(`Unknown event types: ${invalid.join(", ")}. Valid: ${[...VALID_EVENTS].join(", ")}`);
|
|
870
881
|
}
|
|
871
|
-
const
|
|
882
|
+
const body = { url, events };
|
|
883
|
+
if (autoExport) {
|
|
884
|
+
body["auto_export"] = {
|
|
885
|
+
connector_id: autoExport.connectorId,
|
|
886
|
+
format: autoExport.format,
|
|
887
|
+
...autoExport.prefix !== void 0 ? { prefix: autoExport.prefix } : {}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
const data = await this._t.post("/webhooks", body);
|
|
872
891
|
return webhookFromDict(data);
|
|
873
892
|
}
|
|
874
893
|
async list() {
|
|
@@ -890,6 +909,9 @@ var Connector = class _Connector {
|
|
|
890
909
|
lastTestedAt;
|
|
891
910
|
lastUsedAt;
|
|
892
911
|
createdAt;
|
|
912
|
+
/** Non-secret config fields (bucket/region, folder_id, index_name, etc.) —
|
|
913
|
+
* credentials are never included. */
|
|
914
|
+
config;
|
|
893
915
|
constructor(data) {
|
|
894
916
|
this.id = data.id;
|
|
895
917
|
this.name = data.name;
|
|
@@ -898,6 +920,7 @@ var Connector = class _Connector {
|
|
|
898
920
|
this.lastTestedAt = data.lastTestedAt;
|
|
899
921
|
this.lastUsedAt = data.lastUsedAt;
|
|
900
922
|
this.createdAt = data.createdAt;
|
|
923
|
+
this.config = data.config ?? {};
|
|
901
924
|
}
|
|
902
925
|
static fromDict(data) {
|
|
903
926
|
return new _Connector({
|
|
@@ -907,7 +930,8 @@ var Connector = class _Connector {
|
|
|
907
930
|
active: Boolean(data["active"] ?? true),
|
|
908
931
|
lastTestedAt: data["last_tested_at"] ?? null,
|
|
909
932
|
lastUsedAt: data["last_used_at"] ?? null,
|
|
910
|
-
createdAt: String(data["created_at"] ?? "")
|
|
933
|
+
createdAt: String(data["created_at"] ?? ""),
|
|
934
|
+
config: data["config"] ?? {}
|
|
911
935
|
});
|
|
912
936
|
}
|
|
913
937
|
toString() {
|
|
@@ -1302,7 +1326,7 @@ var FlexOrchReader = class {
|
|
|
1302
1326
|
};
|
|
1303
1327
|
|
|
1304
1328
|
// src/index.ts
|
|
1305
|
-
var version = "0.3.
|
|
1329
|
+
var version = "0.3.3";
|
|
1306
1330
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1307
1331
|
0 && (module.exports = {
|
|
1308
1332
|
AuthError,
|
package/dist/index.d.cts
CHANGED
|
@@ -346,18 +346,27 @@ declare class UsageResource {
|
|
|
346
346
|
rateLimits(): Promise<RateLimitStatus>;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
349
|
+
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed" | "quota.warning";
|
|
350
|
+
interface WebhookAutoExport {
|
|
351
|
+
connectorId: number;
|
|
352
|
+
format: string;
|
|
353
|
+
prefix?: string;
|
|
354
|
+
}
|
|
350
355
|
interface Webhook {
|
|
351
356
|
id: string;
|
|
352
357
|
url: string;
|
|
353
358
|
events: WebhookEvent[];
|
|
354
359
|
active: boolean;
|
|
355
360
|
createdAt: string;
|
|
361
|
+
autoExport: WebhookAutoExport | null;
|
|
362
|
+
/** Signing secret — only present on the response from register(). Store it
|
|
363
|
+
* securely; it is never returned again by list()/get(). */
|
|
364
|
+
secret: string | null;
|
|
356
365
|
}
|
|
357
366
|
declare class WebhooksResource {
|
|
358
367
|
private readonly _t;
|
|
359
368
|
constructor(_t: Transport);
|
|
360
|
-
register(url: string, events: WebhookEvent[]): Promise<Webhook>;
|
|
369
|
+
register(url: string, events: WebhookEvent[], autoExport?: WebhookAutoExport): Promise<Webhook>;
|
|
361
370
|
list(): Promise<Webhook[]>;
|
|
362
371
|
delete(webhookId: string): Promise<void>;
|
|
363
372
|
}
|
|
@@ -370,6 +379,9 @@ declare class Connector {
|
|
|
370
379
|
readonly lastTestedAt: string | null;
|
|
371
380
|
readonly lastUsedAt: string | null;
|
|
372
381
|
readonly createdAt: string;
|
|
382
|
+
/** Non-secret config fields (bucket/region, folder_id, index_name, etc.) —
|
|
383
|
+
* credentials are never included. */
|
|
384
|
+
readonly config: Record<string, unknown>;
|
|
373
385
|
constructor(data: {
|
|
374
386
|
id: string;
|
|
375
387
|
name: string;
|
|
@@ -378,6 +390,7 @@ declare class Connector {
|
|
|
378
390
|
lastTestedAt: string | null;
|
|
379
391
|
lastUsedAt: string | null;
|
|
380
392
|
createdAt: string;
|
|
393
|
+
config?: Record<string, unknown>;
|
|
381
394
|
});
|
|
382
395
|
static fromDict(data: Record<string, unknown>): Connector;
|
|
383
396
|
toString(): string;
|
|
@@ -618,6 +631,6 @@ declare class FlexOrchReader {
|
|
|
618
631
|
toString(): string;
|
|
619
632
|
}
|
|
620
633
|
|
|
621
|
-
declare const version = "0.3.
|
|
634
|
+
declare const version = "0.3.3";
|
|
622
635
|
|
|
623
636
|
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
|
@@ -346,18 +346,27 @@ declare class UsageResource {
|
|
|
346
346
|
rateLimits(): Promise<RateLimitStatus>;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
-
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed";
|
|
349
|
+
type WebhookEvent = "dataset.ready" | "job.completed" | "job.failed" | "quota.warning";
|
|
350
|
+
interface WebhookAutoExport {
|
|
351
|
+
connectorId: number;
|
|
352
|
+
format: string;
|
|
353
|
+
prefix?: string;
|
|
354
|
+
}
|
|
350
355
|
interface Webhook {
|
|
351
356
|
id: string;
|
|
352
357
|
url: string;
|
|
353
358
|
events: WebhookEvent[];
|
|
354
359
|
active: boolean;
|
|
355
360
|
createdAt: string;
|
|
361
|
+
autoExport: WebhookAutoExport | null;
|
|
362
|
+
/** Signing secret — only present on the response from register(). Store it
|
|
363
|
+
* securely; it is never returned again by list()/get(). */
|
|
364
|
+
secret: string | null;
|
|
356
365
|
}
|
|
357
366
|
declare class WebhooksResource {
|
|
358
367
|
private readonly _t;
|
|
359
368
|
constructor(_t: Transport);
|
|
360
|
-
register(url: string, events: WebhookEvent[]): Promise<Webhook>;
|
|
369
|
+
register(url: string, events: WebhookEvent[], autoExport?: WebhookAutoExport): Promise<Webhook>;
|
|
361
370
|
list(): Promise<Webhook[]>;
|
|
362
371
|
delete(webhookId: string): Promise<void>;
|
|
363
372
|
}
|
|
@@ -370,6 +379,9 @@ declare class Connector {
|
|
|
370
379
|
readonly lastTestedAt: string | null;
|
|
371
380
|
readonly lastUsedAt: string | null;
|
|
372
381
|
readonly createdAt: string;
|
|
382
|
+
/** Non-secret config fields (bucket/region, folder_id, index_name, etc.) —
|
|
383
|
+
* credentials are never included. */
|
|
384
|
+
readonly config: Record<string, unknown>;
|
|
373
385
|
constructor(data: {
|
|
374
386
|
id: string;
|
|
375
387
|
name: string;
|
|
@@ -378,6 +390,7 @@ declare class Connector {
|
|
|
378
390
|
lastTestedAt: string | null;
|
|
379
391
|
lastUsedAt: string | null;
|
|
380
392
|
createdAt: string;
|
|
393
|
+
config?: Record<string, unknown>;
|
|
381
394
|
});
|
|
382
395
|
static fromDict(data: Record<string, unknown>): Connector;
|
|
383
396
|
toString(): string;
|
|
@@ -618,6 +631,6 @@ declare class FlexOrchReader {
|
|
|
618
631
|
toString(): string;
|
|
619
632
|
}
|
|
620
633
|
|
|
621
|
-
declare const version = "0.3.
|
|
634
|
+
declare const version = "0.3.3";
|
|
622
635
|
|
|
623
636
|
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.
|
|
126
|
+
"User-Agent": "flexorch-sdk-js/0.3.3"
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
129
|
url(path, params) {
|
|
@@ -645,14 +645,25 @@ var UsageResource = class {
|
|
|
645
645
|
};
|
|
646
646
|
|
|
647
647
|
// src/resources/webhooks.ts
|
|
648
|
-
var VALID_EVENTS = /* @__PURE__ */ new Set(["dataset.ready", "job.completed", "job.failed"]);
|
|
648
|
+
var VALID_EVENTS = /* @__PURE__ */ new Set(["dataset.ready", "job.completed", "job.failed", "quota.warning"]);
|
|
649
|
+
function autoExportFromDict(data) {
|
|
650
|
+
if (!data || typeof data !== "object") return null;
|
|
651
|
+
const d = data;
|
|
652
|
+
return {
|
|
653
|
+
connectorId: Number(d["connector_id"] ?? 0),
|
|
654
|
+
format: String(d["format"] ?? ""),
|
|
655
|
+
prefix: d["prefix"] !== void 0 ? String(d["prefix"]) : void 0
|
|
656
|
+
};
|
|
657
|
+
}
|
|
649
658
|
function webhookFromDict(data) {
|
|
650
659
|
return {
|
|
651
660
|
id: String(data["id"] ?? ""),
|
|
652
661
|
url: String(data["url"] ?? ""),
|
|
653
662
|
events: data["events"] ?? [],
|
|
654
663
|
active: Boolean(data["active"] ?? true),
|
|
655
|
-
createdAt: String(data["created_at"] ?? "")
|
|
664
|
+
createdAt: String(data["created_at"] ?? ""),
|
|
665
|
+
autoExport: autoExportFromDict(data["auto_export"]),
|
|
666
|
+
secret: data["secret"] ?? null
|
|
656
667
|
};
|
|
657
668
|
}
|
|
658
669
|
var WebhooksResource = class {
|
|
@@ -660,12 +671,20 @@ var WebhooksResource = class {
|
|
|
660
671
|
this._t = _t;
|
|
661
672
|
}
|
|
662
673
|
_t;
|
|
663
|
-
async register(url, events) {
|
|
674
|
+
async register(url, events, autoExport) {
|
|
664
675
|
const invalid = events.filter((e) => !VALID_EVENTS.has(e));
|
|
665
676
|
if (invalid.length > 0) {
|
|
666
677
|
throw new Error(`Unknown event types: ${invalid.join(", ")}. Valid: ${[...VALID_EVENTS].join(", ")}`);
|
|
667
678
|
}
|
|
668
|
-
const
|
|
679
|
+
const body = { url, events };
|
|
680
|
+
if (autoExport) {
|
|
681
|
+
body["auto_export"] = {
|
|
682
|
+
connector_id: autoExport.connectorId,
|
|
683
|
+
format: autoExport.format,
|
|
684
|
+
...autoExport.prefix !== void 0 ? { prefix: autoExport.prefix } : {}
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
const data = await this._t.post("/webhooks", body);
|
|
669
688
|
return webhookFromDict(data);
|
|
670
689
|
}
|
|
671
690
|
async list() {
|
|
@@ -687,6 +706,9 @@ var Connector = class _Connector {
|
|
|
687
706
|
lastTestedAt;
|
|
688
707
|
lastUsedAt;
|
|
689
708
|
createdAt;
|
|
709
|
+
/** Non-secret config fields (bucket/region, folder_id, index_name, etc.) —
|
|
710
|
+
* credentials are never included. */
|
|
711
|
+
config;
|
|
690
712
|
constructor(data) {
|
|
691
713
|
this.id = data.id;
|
|
692
714
|
this.name = data.name;
|
|
@@ -695,6 +717,7 @@ var Connector = class _Connector {
|
|
|
695
717
|
this.lastTestedAt = data.lastTestedAt;
|
|
696
718
|
this.lastUsedAt = data.lastUsedAt;
|
|
697
719
|
this.createdAt = data.createdAt;
|
|
720
|
+
this.config = data.config ?? {};
|
|
698
721
|
}
|
|
699
722
|
static fromDict(data) {
|
|
700
723
|
return new _Connector({
|
|
@@ -704,7 +727,8 @@ var Connector = class _Connector {
|
|
|
704
727
|
active: Boolean(data["active"] ?? true),
|
|
705
728
|
lastTestedAt: data["last_tested_at"] ?? null,
|
|
706
729
|
lastUsedAt: data["last_used_at"] ?? null,
|
|
707
|
-
createdAt: String(data["created_at"] ?? "")
|
|
730
|
+
createdAt: String(data["created_at"] ?? ""),
|
|
731
|
+
config: data["config"] ?? {}
|
|
708
732
|
});
|
|
709
733
|
}
|
|
710
734
|
toString() {
|
|
@@ -1096,7 +1120,7 @@ var FlexOrchReader = class {
|
|
|
1096
1120
|
};
|
|
1097
1121
|
|
|
1098
1122
|
// src/index.ts
|
|
1099
|
-
var version = "0.3.
|
|
1123
|
+
var version = "0.3.3";
|
|
1100
1124
|
export {
|
|
1101
1125
|
AuthError,
|
|
1102
1126
|
Connector,
|