@kweaver-ai/kweaver-sdk 0.6.1 → 0.6.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.
- package/README.md +25 -2
- package/README.zh.md +28 -0
- package/dist/api/vega.d.ts +8 -0
- package/dist/api/vega.js +18 -0
- package/dist/cli.js +2 -1
- package/dist/commands/vega.js +101 -2
- package/dist/resources/vega.d.ts +2 -0
- package/dist/resources/vega.js +6 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -126,9 +126,18 @@ const result = await client.dataflows.execute({
|
|
|
126
126
|
steps: [{ id: "s1", title: "load", operator: "csv_import", parameters: {} }],
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
// Vega observability
|
|
129
|
+
// Vega — observability and query
|
|
130
130
|
const catalogs = await client.vega.listCatalogs();
|
|
131
131
|
const health = await client.vega.health();
|
|
132
|
+
// Structured query — POST /api/vega-backend/v1/query/execute (JSON string body)
|
|
133
|
+
const structured = await client.vega.executeQuery(
|
|
134
|
+
JSON.stringify({ tables: [{ resource_id: "res-1" }], output_fields: ["*"], limit: 20 }),
|
|
135
|
+
);
|
|
136
|
+
// Direct SQL or OpenSearch DSL — POST /api/vega-backend/v1/resources/query
|
|
137
|
+
// Use {{resource_id}} placeholders so vega-backend routes to the correct catalog connector.
|
|
138
|
+
const rows = await client.vega.sqlQuery(
|
|
139
|
+
JSON.stringify({ query: "SELECT * FROM {{res-1}} LIMIT 5", resource_type: "mysql" }),
|
|
140
|
+
);
|
|
132
141
|
|
|
133
142
|
// Context Loader (semantic search over a BKN via MCP)
|
|
134
143
|
const cl = client.contextLoader(mcpUrl, "bkn-id");
|
|
@@ -164,7 +173,7 @@ kweaver bkn action-execution get
|
|
|
164
173
|
kweaver bkn action-log list/get/cancel
|
|
165
174
|
kweaver agent list/get/create/update/delete/chat/sessions/history/publish/unpublish
|
|
166
175
|
kweaver skill list/market/get/register/status/delete/content/read-file/download/install
|
|
167
|
-
kweaver vega health/stats/inspect/catalog/resource/connector-type
|
|
176
|
+
kweaver vega health/stats/inspect/sql/catalog/resource/connector-type
|
|
168
177
|
kweaver context-loader config set/use/list/show
|
|
169
178
|
kweaver context-loader kn-search/query-object-instance/...
|
|
170
179
|
kweaver call <path> [-X METHOD] [-d BODY] [-H header]
|
|
@@ -184,6 +193,20 @@ kweaver dataflow logs <dagId> <instanceId> --detail
|
|
|
184
193
|
|
|
185
194
|
`kweaver dataflow runs --since` filters one local natural day. If the value cannot be parsed by `new Date(...)`, the CLI falls back to the most recent 20 runs. `kweaver dataflow logs` defaults to summary output; add `--detail` to print indented `input` and `output` payloads.
|
|
186
195
|
|
|
196
|
+
### Vega `sql` CLI examples
|
|
197
|
+
|
|
198
|
+
Direct SQL against catalog-backed resources (`POST /api/vega-backend/v1/resources/query`). In SQL, use **`{{<resource_id>}}`** or **`{{.<resource_id>}}`** (Vega resource id from `vega resource list` / `get`) so the backend resolves the physical table and connector. `--resource-type` accepts the connector type of the target data source (run `kweaver vega connector-type list` to see available types). In simple mode, **quote the entire `--query` value** so the shell does not treat `{` / `}` specially.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Simple mode (recommended): avoid JSON-escaping the query string
|
|
202
|
+
kweaver vega sql --resource-type mysql --query "SELECT * FROM {{res-1}} LIMIT 5"
|
|
203
|
+
|
|
204
|
+
# Advanced mode: full JSON body (optional fields like query_timeout, stream_size, OpenSearch DSL object)
|
|
205
|
+
kweaver vega sql -d '{"resource_type":"mysql","query":"SELECT * FROM {{res-1}} LIMIT 5"}'
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
If both `-d` and `--query` / `--resource-type` are present, **only `-d` is used**.
|
|
209
|
+
|
|
187
210
|
**No-auth platforms:** If OAuth is not enabled, use `kweaver auth <url> --no-auth` (or run a normal `auth login`; a **404** on `POST /oauth2/clients` switches to no-auth automatically). Credentials are still saved under `~/.kweaver/` and work with `auth use` / `auth list`. Optional: `KWEAVER_NO_AUTH=1` with `KWEAVER_BASE_URL` when no token env is set. SDK: `new KWeaverClient({ baseUrl, auth: false })` or `kweaver.configure({ baseUrl, auth: false })`.
|
|
188
211
|
|
|
189
212
|
## Environment Variables
|
package/README.zh.md
CHANGED
|
@@ -119,6 +119,19 @@ const queryRows = await client.dataviews.query(viewId, {
|
|
|
119
119
|
needTotal: true,
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
// Vega — 可观测性与查询
|
|
123
|
+
const catalogs = await client.vega.listCatalogs();
|
|
124
|
+
const health = await client.vega.health();
|
|
125
|
+
// 结构化查询 — POST /api/vega-backend/v1/query/execute(body 为 JSON 字符串)
|
|
126
|
+
const structured = await client.vega.executeQuery(
|
|
127
|
+
JSON.stringify({ tables: [{ resource_id: "res-1" }], output_fields: ["*"], limit: 20 }),
|
|
128
|
+
);
|
|
129
|
+
// 直连 SQL 或 OpenSearch DSL — POST /api/vega-backend/v1/resources/query
|
|
130
|
+
// 使用 {{resource_id}} 占位符以路由到正确的 catalog connector
|
|
131
|
+
const rows = await client.vega.sqlQuery(
|
|
132
|
+
JSON.stringify({ query: "SELECT * FROM {{res-1}} LIMIT 5", resource_type: "mysql" }),
|
|
133
|
+
);
|
|
134
|
+
|
|
122
135
|
// Context Loader(通过 MCP 对 BKN 做语义搜索)
|
|
123
136
|
const cl = client.contextLoader(mcpUrl, "bkn-id");
|
|
124
137
|
const results = await cl.search({ query: "高血压 治疗" });
|
|
@@ -149,6 +162,7 @@ kweaver bkn action-execution get
|
|
|
149
162
|
kweaver bkn action-log list/get/cancel
|
|
150
163
|
kweaver agent list/get/chat/sessions/history
|
|
151
164
|
kweaver skill list/market/get/register/status/delete/content/read-file/download/install
|
|
165
|
+
kweaver vega health|stats|inspect|sql|catalog|resource|connector-type
|
|
152
166
|
kweaver context-loader config set/use/list/show
|
|
153
167
|
kweaver context-loader kn-search/query-object-instance/...
|
|
154
168
|
kweaver call <path> [-X METHOD] [-d BODY] [-H header]
|
|
@@ -168,6 +182,20 @@ kweaver dataflow logs <dagId> <instanceId> --detail
|
|
|
168
182
|
|
|
169
183
|
`kweaver dataflow runs --since` 会按本地自然日过滤;如果参数无法被 `new Date(...)` 解析,CLI 会回退到最近 20 条运行记录。`kweaver dataflow logs` 默认输出摘要;加上 `--detail` 会打印带缩进的 `input` 和 `output` 载荷。
|
|
170
184
|
|
|
185
|
+
### Vega `sql` CLI 示例
|
|
186
|
+
|
|
187
|
+
对 Catalog 资源执行直连 SQL(`POST /api/vega-backend/v1/resources/query`)。SQL 中使用 **`{{<resource_id>}}`** 或 **`{{.<resource_id>}}`**(资源 id 来自 `vega resource list` / `get`),后端据此解析物理表与 connector。`--resource-type` 为目标数据源的连接器类型,可通过 `kweaver vega connector-type list` 查看。简单模式下请**用引号包住整个 `--query` 参数**,避免 shell 对花括号做特殊处理。
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# 简单模式(推荐):避免在 JSON 里转义整段 SQL
|
|
191
|
+
kweaver vega sql --resource-type mysql --query "SELECT * FROM {{res-1}} LIMIT 5"
|
|
192
|
+
|
|
193
|
+
# 高级模式:完整 JSON(可带 query_timeout、stream_size,或 OpenSearch DSL 对象等)
|
|
194
|
+
kweaver vega sql -d '{"resource_type":"mysql","query":"SELECT * FROM {{res-1}} LIMIT 5"}'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
若同时提供 `-d` 与 `--query` / `--resource-type`,**仅以 `-d` 为准**。
|
|
198
|
+
|
|
171
199
|
**无 OAuth 的平台:** 使用 `kweaver auth <url> --no-auth`,或照常 `auth login`;若 `POST /oauth2/clients` 返回 **404**,CLI 会提示并自动保存为 no-auth。凭据仍在 `~/.kweaver/`,可用 `auth use` / `auth list` 切换。可选环境变量 `KWEAVER_NO_AUTH=1`(未设置 `KWEAVER_TOKEN` 时)配合 `KWEAVER_BASE_URL`。SDK:`new KWeaverClient({ baseUrl, auth: false })` 或 `kweaver.configure({ baseUrl, auth: false })`。
|
|
172
200
|
|
|
173
201
|
## 环境变量
|
package/dist/api/vega.d.ts
CHANGED
|
@@ -220,6 +220,14 @@ export interface ExecuteVegaQueryOptions {
|
|
|
220
220
|
businessDomain?: string;
|
|
221
221
|
}
|
|
222
222
|
export declare function executeVegaQuery(options: ExecuteVegaQueryOptions): Promise<string>;
|
|
223
|
+
export interface VegaSQLQueryOptions {
|
|
224
|
+
baseUrl: string;
|
|
225
|
+
accessToken: string;
|
|
226
|
+
body: string;
|
|
227
|
+
businessDomain?: string;
|
|
228
|
+
}
|
|
229
|
+
/** POST /api/vega-backend/v1/resources/query — direct SQL (or OpenSearch DSL) against catalog-backed resources. */
|
|
230
|
+
export declare function vegaSQLQuery(options: VegaSQLQueryOptions): Promise<string>;
|
|
223
231
|
export interface ListAllVegaResourcesOptions {
|
|
224
232
|
baseUrl: string;
|
|
225
233
|
accessToken: string;
|
package/dist/api/vega.js
CHANGED
|
@@ -458,6 +458,24 @@ export async function executeVegaQuery(options) {
|
|
|
458
458
|
throw new HttpError(response.status, response.statusText, body);
|
|
459
459
|
return body;
|
|
460
460
|
}
|
|
461
|
+
/** POST /api/vega-backend/v1/resources/query — direct SQL (or OpenSearch DSL) against catalog-backed resources. */
|
|
462
|
+
export async function vegaSQLQuery(options) {
|
|
463
|
+
const { baseUrl, accessToken, body: requestBody, businessDomain = "bd_public" } = options;
|
|
464
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
465
|
+
const url = `${base}${VEGA_BASE}/resources/query`;
|
|
466
|
+
const response = await fetch(url, {
|
|
467
|
+
method: "POST",
|
|
468
|
+
headers: {
|
|
469
|
+
...buildHeaders(accessToken, businessDomain),
|
|
470
|
+
"content-type": "application/json",
|
|
471
|
+
},
|
|
472
|
+
body: requestBody,
|
|
473
|
+
});
|
|
474
|
+
const body = await response.text();
|
|
475
|
+
if (!response.ok)
|
|
476
|
+
throw new HttpError(response.status, response.statusText, body);
|
|
477
|
+
return body;
|
|
478
|
+
}
|
|
461
479
|
export async function listAllVegaResources(options) {
|
|
462
480
|
const { baseUrl, accessToken, limit, offset, businessDomain = "bd_public" } = options;
|
|
463
481
|
const base = baseUrl.replace(/\/+$/, "");
|
package/dist/cli.js
CHANGED
|
@@ -102,6 +102,7 @@ Usage:
|
|
|
102
102
|
kweaver vega health|stats|inspect
|
|
103
103
|
kweaver vega catalog list|get|health|test-connection|discover|resources [options]
|
|
104
104
|
kweaver vega resource list|get|query [options]
|
|
105
|
+
kweaver vega query execute|sql [options]
|
|
105
106
|
kweaver vega connector-type list|get [options]
|
|
106
107
|
|
|
107
108
|
kweaver context-loader config set|use|list|remove|show [options]
|
|
@@ -128,7 +129,7 @@ Commands:
|
|
|
128
129
|
object-type, relation-type, subgraph, action-type, action-execution, action-log)
|
|
129
130
|
config Per-platform configuration (business domain)
|
|
130
131
|
skill Skill registry and market (register, search, progressive read, download/install)
|
|
131
|
-
vega Vega observability (catalog, resource, connector-type, health/stats/inspect)
|
|
132
|
+
vega Vega observability (catalog, resource, query/sql, connector-type, health/stats/inspect)
|
|
132
133
|
context-loader Context-loader MCP (config, tools, resources, prompts, kn-search, query-*, etc.)
|
|
133
134
|
help Show this message`);
|
|
134
135
|
}
|
package/dist/commands/vega.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInterface } from "node:readline";
|
|
2
2
|
import { ensureValidToken, formatHttpError, with401RefreshRetry } from "../auth/oauth.js";
|
|
3
|
-
import { vegaHealth, listVegaCatalogs, getVegaCatalog, createVegaCatalog, updateVegaCatalog, deleteVegaCatalogs, vegaCatalogHealthStatus, testVegaCatalogConnection, discoverVegaCatalog, listVegaCatalogResources, listVegaResources, getVegaResource, queryVegaResourceData, createVegaResource, updateVegaResource, deleteVegaResources, listVegaConnectorTypes, getVegaConnectorType, registerVegaConnectorType, updateVegaConnectorType, deleteVegaConnectorType, setVegaConnectorTypeEnabled, createVegaDatasetDocs, updateVegaDatasetDocs, deleteVegaDatasetDocs, deleteVegaDatasetDocsQuery, buildVegaDataset, getVegaDatasetBuildStatus, executeVegaQuery, listAllVegaResources, } from "../api/vega.js";
|
|
3
|
+
import { vegaHealth, listVegaCatalogs, getVegaCatalog, createVegaCatalog, updateVegaCatalog, deleteVegaCatalogs, vegaCatalogHealthStatus, testVegaCatalogConnection, discoverVegaCatalog, listVegaCatalogResources, listVegaResources, getVegaResource, queryVegaResourceData, createVegaResource, updateVegaResource, deleteVegaResources, listVegaConnectorTypes, getVegaConnectorType, registerVegaConnectorType, updateVegaConnectorType, deleteVegaConnectorType, setVegaConnectorTypeEnabled, createVegaDatasetDocs, updateVegaDatasetDocs, deleteVegaDatasetDocs, deleteVegaDatasetDocsQuery, buildVegaDataset, getVegaDatasetBuildStatus, executeVegaQuery, vegaSQLQuery, listAllVegaResources, } from "../api/vega.js";
|
|
4
4
|
import { formatCallOutput } from "./call.js";
|
|
5
5
|
import { resolveBusinessDomain } from "../config/store.js";
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
@@ -35,7 +35,9 @@ Subcommands:
|
|
|
35
35
|
dataset delete-docs-query <resource-id> -d <filter-json>
|
|
36
36
|
dataset build <resource-id> [--mode full|incremental|realtime]
|
|
37
37
|
dataset build-status <resource-id> <task-id>
|
|
38
|
-
query execute -d <json>
|
|
38
|
+
query execute -d <json> Structured query (tables, joins, filters)
|
|
39
|
+
sql --resource-type <t> --query <sql> Direct SQL / DSL; use {{<resource_id>}} in SQL (quoted)
|
|
40
|
+
sql -d <json> Same API with full JSON body (advanced)
|
|
39
41
|
connector-type list List connector types
|
|
40
42
|
connector-type get <type> Get connector type details
|
|
41
43
|
connector-type register -d <json> Register a new connector type
|
|
@@ -103,6 +105,8 @@ export async function runVegaCommand(args) {
|
|
|
103
105
|
return runVegaDatasetCommand(rest);
|
|
104
106
|
if (subcommand === "query")
|
|
105
107
|
return runVegaQueryCommand(rest);
|
|
108
|
+
if (subcommand === "sql")
|
|
109
|
+
return runVegaSql(rest);
|
|
106
110
|
if (subcommand === "connector-type")
|
|
107
111
|
return runVegaConnectorTypeCommand(rest);
|
|
108
112
|
return Promise.resolve(-1);
|
|
@@ -1321,6 +1325,101 @@ Options:
|
|
|
1321
1325
|
return 0;
|
|
1322
1326
|
}
|
|
1323
1327
|
// ---------------------------------------------------------------------------
|
|
1328
|
+
// sql (POST /resources/query)
|
|
1329
|
+
// ---------------------------------------------------------------------------
|
|
1330
|
+
async function runVegaSql(args) {
|
|
1331
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
1332
|
+
console.log(`kweaver vega sql --resource-type <type> --query "<sql-or-dsl>"
|
|
1333
|
+
kweaver vega sql -d <json>
|
|
1334
|
+
|
|
1335
|
+
POST /api/vega-backend/v1/resources/query — execute SQL (MySQL/MariaDB/PostgreSQL) or OpenSearch DSL.
|
|
1336
|
+
|
|
1337
|
+
Simple mode (no JSON escaping for query + type):
|
|
1338
|
+
--resource-type <t> Required with --query unless using -d
|
|
1339
|
+
--query <string> One shell argument: the full SQL (or DSL string). Always quote it.
|
|
1340
|
+
|
|
1341
|
+
Advanced mode (full request body, optional fields):
|
|
1342
|
+
-d, --data <json> Raw JSON body. When present, this mode is used and any --query / --resource-type are ignored.
|
|
1343
|
+
|
|
1344
|
+
Resource placeholders (how to reference Vega tables in SQL):
|
|
1345
|
+
{{<resource_id>}} Required token form: double braces around the Vega resource id (from vega resource list / get).
|
|
1346
|
+
{{.<resource_id>}} Alternate form with a dot after {{ ; same replacement and routing.
|
|
1347
|
+
|
|
1348
|
+
The backend swaps each placeholder for that resource's physical SourceIdentifier and picks the catalog connector.
|
|
1349
|
+
Without at least one placeholder, queries often fail (e.g. connector config is incomplete) unless a default connector exists.
|
|
1350
|
+
|
|
1351
|
+
Shell (simple mode) — wrap the whole SQL so braces are not interpreted by the shell:
|
|
1352
|
+
kweaver vega sql --resource-type mysql --query "SELECT * FROM {{abc123xyz}} LIMIT 5"
|
|
1353
|
+
|
|
1354
|
+
Shell (-d mode) — placeholders live inside the JSON string value; use single quotes around the JSON so inner double quotes work:
|
|
1355
|
+
kweaver vega sql -d '{"resource_type":"mysql","query":"SELECT * FROM {{abc123xyz}} LIMIT 5"}'
|
|
1356
|
+
|
|
1357
|
+
Body fields (JSON / simple mode mapping):
|
|
1358
|
+
query (required) SQL string or OpenSearch DSL object
|
|
1359
|
+
resource_type (required) e.g. mysql, mariadb, postgresql, opensearch (see vega connector-type list)
|
|
1360
|
+
stream_size optional batch size for streaming (100–10000, default 10000)
|
|
1361
|
+
query_timeout optional seconds (1–3600, default 60)
|
|
1362
|
+
query_id optional cursor session id
|
|
1363
|
+
|
|
1364
|
+
Do not use --type; use --resource-type.
|
|
1365
|
+
|
|
1366
|
+
Common flags:
|
|
1367
|
+
-bd, --biz-domain <s> Business domain (default: bd_public)
|
|
1368
|
+
--pretty Pretty-print JSON (default)`);
|
|
1369
|
+
return 0;
|
|
1370
|
+
}
|
|
1371
|
+
let data;
|
|
1372
|
+
let query;
|
|
1373
|
+
let resourceType;
|
|
1374
|
+
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
1375
|
+
for (let i = 0; i < remaining.length; i += 1) {
|
|
1376
|
+
const arg = remaining[i];
|
|
1377
|
+
if (arg === "--type") {
|
|
1378
|
+
console.error("Use --resource-type instead of --type (e.g. --resource-type mysql).");
|
|
1379
|
+
return 1;
|
|
1380
|
+
}
|
|
1381
|
+
if ((arg === "-d" || arg === "--data") && remaining[i + 1]) {
|
|
1382
|
+
data = remaining[++i];
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
if (arg === "--query" && remaining[i + 1]) {
|
|
1386
|
+
query = remaining[++i];
|
|
1387
|
+
continue;
|
|
1388
|
+
}
|
|
1389
|
+
if (arg === "--resource-type" && remaining[i + 1]) {
|
|
1390
|
+
resourceType = remaining[++i];
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
let requestBody;
|
|
1395
|
+
if (data !== undefined) {
|
|
1396
|
+
try {
|
|
1397
|
+
JSON.parse(data);
|
|
1398
|
+
}
|
|
1399
|
+
catch {
|
|
1400
|
+
console.error(`Invalid JSON: ${data}`);
|
|
1401
|
+
return 1;
|
|
1402
|
+
}
|
|
1403
|
+
requestBody = data;
|
|
1404
|
+
}
|
|
1405
|
+
else {
|
|
1406
|
+
if (!query || !resourceType) {
|
|
1407
|
+
console.error("Usage: kweaver vega sql --resource-type <type> --query \"<sql-or-dsl>\"\n kweaver vega sql -d <json>");
|
|
1408
|
+
return 1;
|
|
1409
|
+
}
|
|
1410
|
+
requestBody = JSON.stringify({ query, resource_type: resourceType });
|
|
1411
|
+
}
|
|
1412
|
+
const token = await ensureValidToken();
|
|
1413
|
+
const body = await vegaSQLQuery({
|
|
1414
|
+
baseUrl: token.baseUrl,
|
|
1415
|
+
accessToken: token.accessToken,
|
|
1416
|
+
body: requestBody,
|
|
1417
|
+
businessDomain,
|
|
1418
|
+
});
|
|
1419
|
+
console.log(formatCallOutput(body, pretty));
|
|
1420
|
+
return 0;
|
|
1421
|
+
}
|
|
1422
|
+
// ---------------------------------------------------------------------------
|
|
1324
1423
|
// Connector-type router
|
|
1325
1424
|
// ---------------------------------------------------------------------------
|
|
1326
1425
|
async function runVegaConnectorTypeCommand(args) {
|
package/dist/resources/vega.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export declare class VegaResource {
|
|
|
47
47
|
buildDataset(id: string, mode?: string): Promise<unknown>;
|
|
48
48
|
getDatasetBuildStatus(id: string, taskId: string): Promise<unknown>;
|
|
49
49
|
executeQuery(body: string): Promise<unknown>;
|
|
50
|
+
/** POST /resources/query — direct SQL or OpenSearch DSL (see kweaver vega sql --help). */
|
|
51
|
+
sqlQuery(body: string): Promise<unknown>;
|
|
50
52
|
listAllResources(opts?: {
|
|
51
53
|
limit?: number;
|
|
52
54
|
offset?: number;
|
package/dist/resources/vega.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { vegaHealth, listVegaCatalogs, getVegaCatalog, createVegaCatalog, updateVegaCatalog, deleteVegaCatalogs, vegaCatalogHealthStatus, testVegaCatalogConnection, discoverVegaCatalog, listVegaCatalogResources, listVegaResources, getVegaResource, queryVegaResourceData, createVegaResource, updateVegaResource, deleteVegaResources, createVegaDatasetDocs, updateVegaDatasetDocs, deleteVegaDatasetDocs, deleteVegaDatasetDocsQuery, buildVegaDataset, getVegaDatasetBuildStatus, executeVegaQuery, listAllVegaResources, listVegaConnectorTypes, getVegaConnectorType, registerVegaConnectorType, updateVegaConnectorType, deleteVegaConnectorType, setVegaConnectorTypeEnabled, } from "../api/vega.js";
|
|
1
|
+
import { vegaHealth, listVegaCatalogs, getVegaCatalog, createVegaCatalog, updateVegaCatalog, deleteVegaCatalogs, vegaCatalogHealthStatus, testVegaCatalogConnection, discoverVegaCatalog, listVegaCatalogResources, listVegaResources, getVegaResource, queryVegaResourceData, createVegaResource, updateVegaResource, deleteVegaResources, createVegaDatasetDocs, updateVegaDatasetDocs, deleteVegaDatasetDocs, deleteVegaDatasetDocsQuery, buildVegaDataset, getVegaDatasetBuildStatus, executeVegaQuery, vegaSQLQuery, listAllVegaResources, listVegaConnectorTypes, getVegaConnectorType, registerVegaConnectorType, updateVegaConnectorType, deleteVegaConnectorType, setVegaConnectorTypeEnabled, } from "../api/vega.js";
|
|
2
2
|
function unwrapArray(raw) {
|
|
3
3
|
const parsed = JSON.parse(raw);
|
|
4
4
|
if (Array.isArray(parsed))
|
|
@@ -114,6 +114,11 @@ export class VegaResource {
|
|
|
114
114
|
const raw = await executeVegaQuery({ ...this.ctx.base(), body });
|
|
115
115
|
return JSON.parse(raw);
|
|
116
116
|
}
|
|
117
|
+
/** POST /resources/query — direct SQL or OpenSearch DSL (see kweaver vega sql --help). */
|
|
118
|
+
async sqlQuery(body) {
|
|
119
|
+
const raw = await vegaSQLQuery({ ...this.ctx.base(), body });
|
|
120
|
+
return JSON.parse(raw);
|
|
121
|
+
}
|
|
117
122
|
// ── Resource List All ──────────────────────────────────────────────────────
|
|
118
123
|
async listAllResources(opts = {}) {
|
|
119
124
|
const raw = await listAllVegaResources({ ...this.ctx.base(), ...opts });
|
package/package.json
CHANGED