@omnilex/platform-sdk 0.1.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/dist/index.cjs ADDED
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ PlatformClient: () => PlatformClient
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ async function request(config, method, path, body, params) {
27
+ const url = new URL(path, config.baseUrl);
28
+ if (params) {
29
+ for (const [k, v] of Object.entries(params)) {
30
+ url.searchParams.set(k, String(v));
31
+ }
32
+ }
33
+ const headers = {
34
+ "X-API-Key": config.apiKey,
35
+ "Content-Type": "application/json"
36
+ };
37
+ const resp = await fetch(url.toString(), {
38
+ method,
39
+ headers,
40
+ body: body ? JSON.stringify(body) : void 0
41
+ });
42
+ if (!resp.ok) {
43
+ const errorBody = await resp.text();
44
+ throw new Error(`Platform API ${method} ${path} failed (${resp.status}): ${errorBody}`);
45
+ }
46
+ return resp.json();
47
+ }
48
+ var PlatformClient = class {
49
+ config;
50
+ crawl;
51
+ pipeline;
52
+ sync;
53
+ status;
54
+ deploy;
55
+ constructor(baseUrl, apiKey) {
56
+ this.config = { baseUrl: baseUrl.replace(/\/$/, ""), apiKey };
57
+ this.crawl = new CrawlNamespace(this.config);
58
+ this.pipeline = new PipelineNamespace(this.config);
59
+ this.sync = new SyncNamespace(this.config);
60
+ this.status = new StatusNamespace(this.config);
61
+ this.deploy = new DeployNamespace(this.config);
62
+ }
63
+ /** Health check (unauthenticated). */
64
+ async health() {
65
+ return request(this.config, "GET", "/health");
66
+ }
67
+ };
68
+ var CrawlNamespace = class {
69
+ constructor(config) {
70
+ this.config = config;
71
+ }
72
+ async trigger(input) {
73
+ return request(this.config, "POST", "/v1/crawl/trigger", input);
74
+ }
75
+ async listRuns(limit = 20) {
76
+ return request(this.config, "GET", "/v1/crawl/runs", void 0, { limit });
77
+ }
78
+ async getRun(runId) {
79
+ return request(this.config, "GET", `/v1/crawl/runs/${runId}`);
80
+ }
81
+ };
82
+ var PipelineNamespace = class {
83
+ constructor(config) {
84
+ this.config = config;
85
+ }
86
+ async listJobs() {
87
+ return request(this.config, "GET", "/v1/pipeline/jobs");
88
+ }
89
+ async trigger(input) {
90
+ return request(this.config, "POST", "/v1/pipeline/trigger", input);
91
+ }
92
+ async listRuns(limit = 20) {
93
+ return request(this.config, "GET", "/v1/pipeline/runs", void 0, { limit });
94
+ }
95
+ async getRun(runId) {
96
+ return request(this.config, "GET", `/v1/pipeline/runs/${runId}`);
97
+ }
98
+ };
99
+ var SyncNamespace = class {
100
+ constructor(config) {
101
+ this.config = config;
102
+ }
103
+ async listConnections() {
104
+ return request(this.config, "GET", "/v1/sync/connections");
105
+ }
106
+ async trigger(input) {
107
+ return request(this.config, "POST", "/v1/sync/trigger", input);
108
+ }
109
+ async getJob(jobId) {
110
+ return request(this.config, "GET", `/v1/sync/jobs/${jobId}`);
111
+ }
112
+ };
113
+ var StatusNamespace = class {
114
+ constructor(config) {
115
+ this.config = config;
116
+ }
117
+ async getAll() {
118
+ return request(this.config, "GET", "/v1/status");
119
+ }
120
+ async getDagster() {
121
+ return request(this.config, "GET", "/v1/status/dagster");
122
+ }
123
+ async getCrawlee() {
124
+ return request(this.config, "GET", "/v1/status/crawlee");
125
+ }
126
+ async getAirbyte() {
127
+ return request(this.config, "GET", "/v1/status/airbyte");
128
+ }
129
+ };
130
+ var DeployNamespace = class {
131
+ constructor(config) {
132
+ this.config = config;
133
+ }
134
+ /** Build and deploy a Crawlee Actor. */
135
+ async crawleeActor(input) {
136
+ return request(this.config, "POST", "/v1/deploy/crawlee/actor", input);
137
+ }
138
+ /** List Airbyte sources. */
139
+ async listAirbyteSources() {
140
+ return request(this.config, "GET", "/v1/deploy/airbyte/sources");
141
+ }
142
+ /** List Airbyte destinations. */
143
+ async listAirbyteDestinations() {
144
+ return request(this.config, "GET", "/v1/deploy/airbyte/destinations");
145
+ }
146
+ /** Create or update an Airbyte connection. */
147
+ async upsertAirbyteConnection(config) {
148
+ return request(this.config, "POST", "/v1/deploy/airbyte/connection", config);
149
+ }
150
+ /** Trigger dbt build via silver_dbt Dagster job. */
151
+ async dbtRun(input) {
152
+ return request(this.config, "POST", "/v1/deploy/dbt/run", input);
153
+ }
154
+ /** Trigger dbt seed via reference_seed Dagster job. */
155
+ async dbtSeed() {
156
+ return request(this.config, "POST", "/v1/deploy/dbt/seed");
157
+ }
158
+ };
159
+ // Annotate the CommonJS export names for ESM import in node:
160
+ 0 && (module.exports = {
161
+ PlatformClient
162
+ });
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @omnilex/platform-sdk — TypeScript client for the Omnilex Platform API.
3
+ *
4
+ * Usage:
5
+ * import { PlatformClient } from '@omnilex/platform-sdk';
6
+ * const client = new PlatformClient('https://platform-api.data.omnilex.ai', 'your-api-key');
7
+ * const status = await client.status.getAll();
8
+ * const run = await client.pipeline.trigger({ job_name: 'ingestion_ingest' });
9
+ */
10
+ interface PlatformClientConfig {
11
+ baseUrl: string;
12
+ apiKey: string;
13
+ }
14
+ declare class PlatformClient {
15
+ private config;
16
+ crawl: CrawlNamespace;
17
+ pipeline: PipelineNamespace;
18
+ sync: SyncNamespace;
19
+ status: StatusNamespace;
20
+ deploy: DeployNamespace;
21
+ constructor(baseUrl: string, apiKey: string);
22
+ /** Health check (unauthenticated). */
23
+ health(): Promise<{
24
+ status: string;
25
+ service: string;
26
+ version: string;
27
+ }>;
28
+ }
29
+ declare class CrawlNamespace {
30
+ private config;
31
+ constructor(config: PlatformClientConfig);
32
+ trigger(input: {
33
+ source_key: string;
34
+ max_pages?: number;
35
+ steps?: string[];
36
+ reset_state?: boolean;
37
+ }): Promise<unknown>;
38
+ listRuns(limit?: number): Promise<unknown>;
39
+ getRun(runId: string): Promise<unknown>;
40
+ }
41
+ declare class PipelineNamespace {
42
+ private config;
43
+ constructor(config: PlatformClientConfig);
44
+ listJobs(): Promise<unknown>;
45
+ trigger(input: {
46
+ job_name: string;
47
+ run_config?: Record<string, unknown>;
48
+ tags?: Record<string, string>;
49
+ }): Promise<unknown>;
50
+ listRuns(limit?: number): Promise<unknown>;
51
+ getRun(runId: string): Promise<unknown>;
52
+ }
53
+ declare class SyncNamespace {
54
+ private config;
55
+ constructor(config: PlatformClientConfig);
56
+ listConnections(): Promise<unknown>;
57
+ trigger(input: {
58
+ connection_id: string;
59
+ }): Promise<unknown>;
60
+ getJob(jobId: number): Promise<unknown>;
61
+ }
62
+ declare class StatusNamespace {
63
+ private config;
64
+ constructor(config: PlatformClientConfig);
65
+ getAll(): Promise<unknown>;
66
+ getDagster(): Promise<unknown>;
67
+ getCrawlee(): Promise<unknown>;
68
+ getAirbyte(): Promise<unknown>;
69
+ }
70
+ declare class DeployNamespace {
71
+ private config;
72
+ constructor(config: PlatformClientConfig);
73
+ /** Build and deploy a Crawlee Actor. */
74
+ crawleeActor(input?: Record<string, unknown>): Promise<unknown>;
75
+ /** List Airbyte sources. */
76
+ listAirbyteSources(): Promise<unknown>;
77
+ /** List Airbyte destinations. */
78
+ listAirbyteDestinations(): Promise<unknown>;
79
+ /** Create or update an Airbyte connection. */
80
+ upsertAirbyteConnection(config: Record<string, unknown>): Promise<unknown>;
81
+ /** Trigger dbt build via silver_dbt Dagster job. */
82
+ dbtRun(input?: {
83
+ run_config?: Record<string, unknown>;
84
+ tags?: Record<string, string>;
85
+ }): Promise<unknown>;
86
+ /** Trigger dbt seed via reference_seed Dagster job. */
87
+ dbtSeed(): Promise<unknown>;
88
+ }
89
+
90
+ export { PlatformClient, type PlatformClientConfig };
@@ -0,0 +1,90 @@
1
+ /**
2
+ * @omnilex/platform-sdk — TypeScript client for the Omnilex Platform API.
3
+ *
4
+ * Usage:
5
+ * import { PlatformClient } from '@omnilex/platform-sdk';
6
+ * const client = new PlatformClient('https://platform-api.data.omnilex.ai', 'your-api-key');
7
+ * const status = await client.status.getAll();
8
+ * const run = await client.pipeline.trigger({ job_name: 'ingestion_ingest' });
9
+ */
10
+ interface PlatformClientConfig {
11
+ baseUrl: string;
12
+ apiKey: string;
13
+ }
14
+ declare class PlatformClient {
15
+ private config;
16
+ crawl: CrawlNamespace;
17
+ pipeline: PipelineNamespace;
18
+ sync: SyncNamespace;
19
+ status: StatusNamespace;
20
+ deploy: DeployNamespace;
21
+ constructor(baseUrl: string, apiKey: string);
22
+ /** Health check (unauthenticated). */
23
+ health(): Promise<{
24
+ status: string;
25
+ service: string;
26
+ version: string;
27
+ }>;
28
+ }
29
+ declare class CrawlNamespace {
30
+ private config;
31
+ constructor(config: PlatformClientConfig);
32
+ trigger(input: {
33
+ source_key: string;
34
+ max_pages?: number;
35
+ steps?: string[];
36
+ reset_state?: boolean;
37
+ }): Promise<unknown>;
38
+ listRuns(limit?: number): Promise<unknown>;
39
+ getRun(runId: string): Promise<unknown>;
40
+ }
41
+ declare class PipelineNamespace {
42
+ private config;
43
+ constructor(config: PlatformClientConfig);
44
+ listJobs(): Promise<unknown>;
45
+ trigger(input: {
46
+ job_name: string;
47
+ run_config?: Record<string, unknown>;
48
+ tags?: Record<string, string>;
49
+ }): Promise<unknown>;
50
+ listRuns(limit?: number): Promise<unknown>;
51
+ getRun(runId: string): Promise<unknown>;
52
+ }
53
+ declare class SyncNamespace {
54
+ private config;
55
+ constructor(config: PlatformClientConfig);
56
+ listConnections(): Promise<unknown>;
57
+ trigger(input: {
58
+ connection_id: string;
59
+ }): Promise<unknown>;
60
+ getJob(jobId: number): Promise<unknown>;
61
+ }
62
+ declare class StatusNamespace {
63
+ private config;
64
+ constructor(config: PlatformClientConfig);
65
+ getAll(): Promise<unknown>;
66
+ getDagster(): Promise<unknown>;
67
+ getCrawlee(): Promise<unknown>;
68
+ getAirbyte(): Promise<unknown>;
69
+ }
70
+ declare class DeployNamespace {
71
+ private config;
72
+ constructor(config: PlatformClientConfig);
73
+ /** Build and deploy a Crawlee Actor. */
74
+ crawleeActor(input?: Record<string, unknown>): Promise<unknown>;
75
+ /** List Airbyte sources. */
76
+ listAirbyteSources(): Promise<unknown>;
77
+ /** List Airbyte destinations. */
78
+ listAirbyteDestinations(): Promise<unknown>;
79
+ /** Create or update an Airbyte connection. */
80
+ upsertAirbyteConnection(config: Record<string, unknown>): Promise<unknown>;
81
+ /** Trigger dbt build via silver_dbt Dagster job. */
82
+ dbtRun(input?: {
83
+ run_config?: Record<string, unknown>;
84
+ tags?: Record<string, string>;
85
+ }): Promise<unknown>;
86
+ /** Trigger dbt seed via reference_seed Dagster job. */
87
+ dbtSeed(): Promise<unknown>;
88
+ }
89
+
90
+ export { PlatformClient, type PlatformClientConfig };
package/dist/index.js ADDED
@@ -0,0 +1,137 @@
1
+ // src/index.ts
2
+ async function request(config, method, path, body, params) {
3
+ const url = new URL(path, config.baseUrl);
4
+ if (params) {
5
+ for (const [k, v] of Object.entries(params)) {
6
+ url.searchParams.set(k, String(v));
7
+ }
8
+ }
9
+ const headers = {
10
+ "X-API-Key": config.apiKey,
11
+ "Content-Type": "application/json"
12
+ };
13
+ const resp = await fetch(url.toString(), {
14
+ method,
15
+ headers,
16
+ body: body ? JSON.stringify(body) : void 0
17
+ });
18
+ if (!resp.ok) {
19
+ const errorBody = await resp.text();
20
+ throw new Error(`Platform API ${method} ${path} failed (${resp.status}): ${errorBody}`);
21
+ }
22
+ return resp.json();
23
+ }
24
+ var PlatformClient = class {
25
+ config;
26
+ crawl;
27
+ pipeline;
28
+ sync;
29
+ status;
30
+ deploy;
31
+ constructor(baseUrl, apiKey) {
32
+ this.config = { baseUrl: baseUrl.replace(/\/$/, ""), apiKey };
33
+ this.crawl = new CrawlNamespace(this.config);
34
+ this.pipeline = new PipelineNamespace(this.config);
35
+ this.sync = new SyncNamespace(this.config);
36
+ this.status = new StatusNamespace(this.config);
37
+ this.deploy = new DeployNamespace(this.config);
38
+ }
39
+ /** Health check (unauthenticated). */
40
+ async health() {
41
+ return request(this.config, "GET", "/health");
42
+ }
43
+ };
44
+ var CrawlNamespace = class {
45
+ constructor(config) {
46
+ this.config = config;
47
+ }
48
+ async trigger(input) {
49
+ return request(this.config, "POST", "/v1/crawl/trigger", input);
50
+ }
51
+ async listRuns(limit = 20) {
52
+ return request(this.config, "GET", "/v1/crawl/runs", void 0, { limit });
53
+ }
54
+ async getRun(runId) {
55
+ return request(this.config, "GET", `/v1/crawl/runs/${runId}`);
56
+ }
57
+ };
58
+ var PipelineNamespace = class {
59
+ constructor(config) {
60
+ this.config = config;
61
+ }
62
+ async listJobs() {
63
+ return request(this.config, "GET", "/v1/pipeline/jobs");
64
+ }
65
+ async trigger(input) {
66
+ return request(this.config, "POST", "/v1/pipeline/trigger", input);
67
+ }
68
+ async listRuns(limit = 20) {
69
+ return request(this.config, "GET", "/v1/pipeline/runs", void 0, { limit });
70
+ }
71
+ async getRun(runId) {
72
+ return request(this.config, "GET", `/v1/pipeline/runs/${runId}`);
73
+ }
74
+ };
75
+ var SyncNamespace = class {
76
+ constructor(config) {
77
+ this.config = config;
78
+ }
79
+ async listConnections() {
80
+ return request(this.config, "GET", "/v1/sync/connections");
81
+ }
82
+ async trigger(input) {
83
+ return request(this.config, "POST", "/v1/sync/trigger", input);
84
+ }
85
+ async getJob(jobId) {
86
+ return request(this.config, "GET", `/v1/sync/jobs/${jobId}`);
87
+ }
88
+ };
89
+ var StatusNamespace = class {
90
+ constructor(config) {
91
+ this.config = config;
92
+ }
93
+ async getAll() {
94
+ return request(this.config, "GET", "/v1/status");
95
+ }
96
+ async getDagster() {
97
+ return request(this.config, "GET", "/v1/status/dagster");
98
+ }
99
+ async getCrawlee() {
100
+ return request(this.config, "GET", "/v1/status/crawlee");
101
+ }
102
+ async getAirbyte() {
103
+ return request(this.config, "GET", "/v1/status/airbyte");
104
+ }
105
+ };
106
+ var DeployNamespace = class {
107
+ constructor(config) {
108
+ this.config = config;
109
+ }
110
+ /** Build and deploy a Crawlee Actor. */
111
+ async crawleeActor(input) {
112
+ return request(this.config, "POST", "/v1/deploy/crawlee/actor", input);
113
+ }
114
+ /** List Airbyte sources. */
115
+ async listAirbyteSources() {
116
+ return request(this.config, "GET", "/v1/deploy/airbyte/sources");
117
+ }
118
+ /** List Airbyte destinations. */
119
+ async listAirbyteDestinations() {
120
+ return request(this.config, "GET", "/v1/deploy/airbyte/destinations");
121
+ }
122
+ /** Create or update an Airbyte connection. */
123
+ async upsertAirbyteConnection(config) {
124
+ return request(this.config, "POST", "/v1/deploy/airbyte/connection", config);
125
+ }
126
+ /** Trigger dbt build via silver_dbt Dagster job. */
127
+ async dbtRun(input) {
128
+ return request(this.config, "POST", "/v1/deploy/dbt/run", input);
129
+ }
130
+ /** Trigger dbt seed via reference_seed Dagster job. */
131
+ async dbtSeed() {
132
+ return request(this.config, "POST", "/v1/deploy/dbt/seed");
133
+ }
134
+ };
135
+ export {
136
+ PlatformClient
137
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@omnilex/platform-sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for the Omnilex Platform Orchestration API — auto-generated from OpenAPI spec",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "generate": "openapi-ts --input ./openapi.json --output ./src/generated --client @hey-api/client-fetch",
21
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean",
22
+ "prepublishOnly": "npm run generate && npm run build"
23
+ },
24
+ "devDependencies": {
25
+ "@hey-api/openapi-ts": "^0.46.0",
26
+ "@hey-api/client-fetch": "^0.2.0",
27
+ "tsup": "^8.0.0",
28
+ "typescript": "^5.4.0"
29
+ },
30
+ "peerDependencies": {
31
+ "@hey-api/client-fetch": "^0.2.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "restricted",
35
+ "registry": "https://registry.npmjs.org/"
36
+ },
37
+ "license": "UNLICENSED",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/philipplukas/omnilex-data-platform"
41
+ }
42
+ }