@kweaver-ai/kweaver-sdk 0.4.11 → 0.4.13
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 +59 -3
- package/README.zh.md +40 -1
- package/dist/api/dataflow.d.ts +2 -0
- package/dist/api/dataflow.js +5 -3
- package/dist/api/dataviews.d.ts +98 -1
- package/dist/api/dataviews.js +167 -14
- package/dist/api/vega.js +1 -1
- package/dist/auth/oauth.d.ts +21 -0
- package/dist/auth/oauth.js +226 -54
- package/dist/cli.js +13 -0
- package/dist/client.d.ts +12 -0
- package/dist/client.js +16 -0
- package/dist/commands/agent.js +15 -15
- package/dist/commands/auth.js +80 -6
- package/dist/commands/bkn.d.ts +11 -0
- package/dist/commands/bkn.js +102 -59
- package/dist/commands/dataview.d.ts +1 -0
- package/dist/commands/dataview.js +303 -0
- package/dist/commands/vega.js +7 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/dist/resources/dataflows.d.ts +17 -0
- package/dist/resources/dataflows.js +22 -0
- package/dist/resources/datasources.d.ts +52 -0
- package/dist/resources/datasources.js +54 -0
- package/dist/resources/dataviews.d.ts +37 -0
- package/dist/resources/dataviews.js +47 -0
- package/dist/resources/vega.d.ts +41 -0
- package/dist/resources/vega.js +80 -0
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { vegaHealth, listVegaCatalogs, getVegaCatalog, vegaCatalogHealthStatus, testVegaCatalogConnection, discoverVegaCatalog, listVegaCatalogResources, listVegaResources, getVegaResource, queryVegaResourceData, previewVegaResource, listVegaConnectorTypes, getVegaConnectorType, listVegaDiscoverTasks, } from "../api/vega.js";
|
|
2
|
+
function unwrapArray(raw) {
|
|
3
|
+
const parsed = JSON.parse(raw);
|
|
4
|
+
if (Array.isArray(parsed))
|
|
5
|
+
return parsed;
|
|
6
|
+
if (parsed && typeof parsed === "object") {
|
|
7
|
+
const obj = parsed;
|
|
8
|
+
const items = obj.entries ?? obj.data ?? obj.records;
|
|
9
|
+
if (Array.isArray(items))
|
|
10
|
+
return items;
|
|
11
|
+
}
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
export class VegaResource {
|
|
15
|
+
ctx;
|
|
16
|
+
constructor(ctx) {
|
|
17
|
+
this.ctx = ctx;
|
|
18
|
+
}
|
|
19
|
+
// ── Health ──────────────────────────────────────────────────────────────────
|
|
20
|
+
async health() {
|
|
21
|
+
const raw = await vegaHealth(this.ctx.base());
|
|
22
|
+
return JSON.parse(raw);
|
|
23
|
+
}
|
|
24
|
+
// ── Catalogs ────────────────────────────────────────────────────────────────
|
|
25
|
+
async listCatalogs(opts = {}) {
|
|
26
|
+
const raw = await listVegaCatalogs({ ...this.ctx.base(), ...opts });
|
|
27
|
+
return unwrapArray(raw);
|
|
28
|
+
}
|
|
29
|
+
async getCatalog(id) {
|
|
30
|
+
const raw = await getVegaCatalog({ ...this.ctx.base(), id });
|
|
31
|
+
return JSON.parse(raw);
|
|
32
|
+
}
|
|
33
|
+
async catalogHealthStatus(ids) {
|
|
34
|
+
const raw = await vegaCatalogHealthStatus({ ...this.ctx.base(), ids });
|
|
35
|
+
return JSON.parse(raw);
|
|
36
|
+
}
|
|
37
|
+
async testCatalogConnection(id) {
|
|
38
|
+
const raw = await testVegaCatalogConnection({ ...this.ctx.base(), id });
|
|
39
|
+
return JSON.parse(raw);
|
|
40
|
+
}
|
|
41
|
+
async discoverCatalog(id, opts = {}) {
|
|
42
|
+
const raw = await discoverVegaCatalog({ ...this.ctx.base(), id, ...opts });
|
|
43
|
+
return JSON.parse(raw);
|
|
44
|
+
}
|
|
45
|
+
async listCatalogResources(id, opts = {}) {
|
|
46
|
+
const raw = await listVegaCatalogResources({ ...this.ctx.base(), id, ...opts });
|
|
47
|
+
return unwrapArray(raw);
|
|
48
|
+
}
|
|
49
|
+
// ── Resources ───────────────────────────────────────────────────────────────
|
|
50
|
+
async listResources(opts = {}) {
|
|
51
|
+
const raw = await listVegaResources({ ...this.ctx.base(), ...opts });
|
|
52
|
+
return unwrapArray(raw);
|
|
53
|
+
}
|
|
54
|
+
async getResource(id) {
|
|
55
|
+
const raw = await getVegaResource({ ...this.ctx.base(), id });
|
|
56
|
+
return JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
async queryResourceData(id, body) {
|
|
59
|
+
const raw = await queryVegaResourceData({ ...this.ctx.base(), id, body });
|
|
60
|
+
return JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
async previewResource(id, opts = {}) {
|
|
63
|
+
const raw = await previewVegaResource({ ...this.ctx.base(), id, ...opts });
|
|
64
|
+
return JSON.parse(raw);
|
|
65
|
+
}
|
|
66
|
+
// ── Connector Types ─────────────────────────────────────────────────────────
|
|
67
|
+
async listConnectorTypes() {
|
|
68
|
+
const raw = await listVegaConnectorTypes(this.ctx.base());
|
|
69
|
+
return unwrapArray(raw);
|
|
70
|
+
}
|
|
71
|
+
async getConnectorType(type) {
|
|
72
|
+
const raw = await getVegaConnectorType({ ...this.ctx.base(), type });
|
|
73
|
+
return JSON.parse(raw);
|
|
74
|
+
}
|
|
75
|
+
// ── Discover Tasks ──────────────────────────────────────────────────────────
|
|
76
|
+
async listDiscoverTasks(opts = {}) {
|
|
77
|
+
const raw = await listVegaDiscoverTasks({ ...this.ctx.base(), ...opts });
|
|
78
|
+
return unwrapArray(raw);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/package.json
CHANGED