@kweaver-ai/kweaver-sdk 0.8.2 → 0.8.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/README.md +26 -52
- package/README.zh.md +27 -46
- package/dist/api/resources.d.ts +94 -0
- package/dist/api/resources.js +166 -0
- package/dist/cli.js +102 -10
- package/dist/client.d.ts +3 -3
- package/dist/client.js +5 -5
- package/dist/commands/agent-members.js +27 -11
- package/dist/commands/agent.js +383 -272
- package/dist/commands/auth.js +184 -71
- package/dist/commands/bkn-metric.js +37 -16
- package/dist/commands/bkn-ops.js +164 -86
- package/dist/commands/bkn-query.js +99 -31
- package/dist/commands/bkn-schema.d.ts +3 -3
- package/dist/commands/bkn-schema.js +127 -86
- package/dist/commands/bkn.js +153 -114
- package/dist/commands/call.js +23 -13
- package/dist/commands/config.js +22 -12
- package/dist/commands/context-loader.js +98 -92
- package/dist/commands/dataflow.js +14 -6
- package/dist/commands/ds.js +52 -30
- package/dist/commands/explore.js +18 -15
- package/dist/commands/model.js +53 -42
- package/dist/commands/resource.d.ts +1 -0
- package/dist/commands/{dataview.js → resource.js} +62 -84
- package/dist/commands/skill.js +201 -65
- package/dist/commands/token.js +11 -0
- package/dist/commands/tool.js +46 -29
- package/dist/commands/toolbox.js +31 -15
- package/dist/commands/vega.js +466 -250
- package/dist/help/format.d.ts +65 -0
- package/dist/help/format.js +141 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/resources/{dataviews.d.ts → resources.d.ts} +10 -11
- package/dist/resources/{dataviews.js → resources.js} +12 -13
- package/package.json +1 -1
- package/dist/api/dataviews.d.ts +0 -117
- package/dist/api/dataviews.js +0 -265
- package/dist/commands/dataview.d.ts +0 -8
package/dist/commands/vega.js
CHANGED
|
@@ -3,50 +3,51 @@ import { ensureValidToken, formatHttpError, with401RefreshRetry } from "../auth/
|
|
|
3
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
|
+
import { renderHelp } from "../help/format.js";
|
|
6
7
|
// ---------------------------------------------------------------------------
|
|
7
8
|
// Help
|
|
8
9
|
// ---------------------------------------------------------------------------
|
|
10
|
+
const VEGA_HELP = renderHelp({
|
|
11
|
+
tagline: "Vega observability — catalogs, resources, datasets, queries, connector types",
|
|
12
|
+
usage: "kweaver vega <subcommand> [<action>] [flags]",
|
|
13
|
+
sections: [
|
|
14
|
+
{
|
|
15
|
+
title: "SERVICE",
|
|
16
|
+
items: [
|
|
17
|
+
{ name: "health", desc: "Check Vega service health" },
|
|
18
|
+
{ name: "stats", desc: "Show catalog statistics" },
|
|
19
|
+
{ name: "inspect", desc: "Health + catalog summary + running tasks" },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "RESOURCES",
|
|
24
|
+
items: [
|
|
25
|
+
{ name: "catalog", desc: "list / get / health / test-connection / discover / resources / create / update / delete" },
|
|
26
|
+
{ name: "resource", desc: "list / get / query / create / update / delete / list-all" },
|
|
27
|
+
{ name: "dataset", desc: "create-docs / update-docs / delete-docs / delete-docs-query / build / build-status" },
|
|
28
|
+
{ name: "query", desc: "execute — structured query (tables, joins, filters)" },
|
|
29
|
+
{ name: "sql", desc: "Direct SQL / DSL; use {{<resource_id>}} in SQL (quoted)" },
|
|
30
|
+
{ name: "connector-type", desc: "list / get / register / update / delete / enable" },
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
flags: [
|
|
35
|
+
{ name: "-bd, --biz-domain <s>", desc: "Business domain (default: bd_public)" },
|
|
36
|
+
{ name: "--pretty", desc: "Pretty-print JSON (default)" },
|
|
37
|
+
],
|
|
38
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
39
|
+
examples: [
|
|
40
|
+
"kweaver vega health",
|
|
41
|
+
"kweaver vega catalog list --status active",
|
|
42
|
+
"kweaver vega sql --resource-type elasticsearch --query 'SELECT * FROM {{r-123}} LIMIT 10'",
|
|
43
|
+
],
|
|
44
|
+
learnMore: [
|
|
45
|
+
"Use `kweaver help all` for full per-action signatures",
|
|
46
|
+
"Use `kweaver vega <subcommand> --help` for action-level details (where supported)",
|
|
47
|
+
],
|
|
48
|
+
});
|
|
9
49
|
function printVegaHelp() {
|
|
10
|
-
console.log(
|
|
11
|
-
|
|
12
|
-
Subcommands:
|
|
13
|
-
health Check Vega service health
|
|
14
|
-
stats Show catalog statistics
|
|
15
|
-
inspect Health + catalog summary + running tasks
|
|
16
|
-
catalog list [--status X] [--limit N] [--offset N]
|
|
17
|
-
catalog get <id>
|
|
18
|
-
catalog health <ids...> | --all Health-check catalogs
|
|
19
|
-
catalog test-connection <id> Test catalog connectivity
|
|
20
|
-
catalog discover <id> [--wait] Trigger discovery
|
|
21
|
-
catalog resources <id> [--category X] [--limit N]
|
|
22
|
-
catalog create --name <n> --connector-type <t> --connector-config <json>
|
|
23
|
-
catalog update <id> [--name X] [--connector-type X] [--tags X] [--description X]
|
|
24
|
-
catalog delete <ids...> [-y]
|
|
25
|
-
resource list [--catalog-id X] [--category X] [--status X] [--limit N] [--offset N]
|
|
26
|
-
resource get <id>
|
|
27
|
-
resource query <id> -d <json-body> Query resource data
|
|
28
|
-
resource create --catalog-id <cid> --name <n> --category <cat>
|
|
29
|
-
resource update <id> [--name X] [--status X] [--tags X] [-d json]
|
|
30
|
-
resource delete <ids...> [-y]
|
|
31
|
-
resource list-all [--limit N] [--offset N]
|
|
32
|
-
dataset create-docs <resource-id> -d <json-array>
|
|
33
|
-
dataset update-docs <resource-id> -d <json-array>
|
|
34
|
-
dataset delete-docs <resource-id> <doc-ids...>
|
|
35
|
-
dataset delete-docs-query <resource-id> -d <filter-json>
|
|
36
|
-
dataset build <resource-id> [--mode full|incremental|realtime]
|
|
37
|
-
dataset build-status <resource-id> <task-id>
|
|
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)
|
|
41
|
-
connector-type list List connector types
|
|
42
|
-
connector-type get <type> Get connector type details
|
|
43
|
-
connector-type register -d <json> Register a new connector type
|
|
44
|
-
connector-type update <type> -d <json> Update connector type
|
|
45
|
-
connector-type delete <type> [-y] Delete connector type
|
|
46
|
-
connector-type enable <type> --enabled <bool> Enable/disable connector type
|
|
47
|
-
Common flags:
|
|
48
|
-
-bd, --biz-domain <s> Business domain (default: bd_public)
|
|
49
|
-
--pretty Pretty-print JSON (default)`);
|
|
50
|
+
console.log(VEGA_HELP);
|
|
50
51
|
}
|
|
51
52
|
// ---------------------------------------------------------------------------
|
|
52
53
|
// Common flag parser
|
|
@@ -131,7 +132,10 @@ export async function runVegaCommand(args) {
|
|
|
131
132
|
// ---------------------------------------------------------------------------
|
|
132
133
|
async function runVegaHealthCommand(args) {
|
|
133
134
|
if (args.includes("--help") || args.includes("-h")) {
|
|
134
|
-
console.log(
|
|
135
|
+
console.log(renderHelp({
|
|
136
|
+
tagline: "Check Vega service health.",
|
|
137
|
+
usage: "kweaver vega health [flags]",
|
|
138
|
+
}));
|
|
135
139
|
return 0;
|
|
136
140
|
}
|
|
137
141
|
const { businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -149,7 +153,10 @@ async function runVegaHealthCommand(args) {
|
|
|
149
153
|
// ---------------------------------------------------------------------------
|
|
150
154
|
async function runVegaStatsCommand(args) {
|
|
151
155
|
if (args.includes("--help") || args.includes("-h")) {
|
|
152
|
-
console.log(
|
|
156
|
+
console.log(renderHelp({
|
|
157
|
+
tagline: "Show catalog statistics.",
|
|
158
|
+
usage: "kweaver vega stats [flags]",
|
|
159
|
+
}));
|
|
153
160
|
return 0;
|
|
154
161
|
}
|
|
155
162
|
const { businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -178,7 +185,10 @@ async function runVegaStatsCommand(args) {
|
|
|
178
185
|
// ---------------------------------------------------------------------------
|
|
179
186
|
async function runVegaInspectCommand(args) {
|
|
180
187
|
if (args.includes("--help") || args.includes("-h")) {
|
|
181
|
-
console.log(
|
|
188
|
+
console.log(renderHelp({
|
|
189
|
+
tagline: "Health + catalog summary.",
|
|
190
|
+
usage: "kweaver vega inspect [flags]",
|
|
191
|
+
}));
|
|
182
192
|
return 0;
|
|
183
193
|
}
|
|
184
194
|
const { businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -214,18 +224,26 @@ async function runVegaInspectCommand(args) {
|
|
|
214
224
|
async function runVegaCatalogCommand(args) {
|
|
215
225
|
const [sub, ...rest] = args;
|
|
216
226
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
217
|
-
console.log(
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
console.log(renderHelp({
|
|
228
|
+
tagline: "Manage Vega catalogs.",
|
|
229
|
+
usage: "kweaver vega catalog <subcommand> [flags]",
|
|
230
|
+
sections: [
|
|
231
|
+
{
|
|
232
|
+
title: "AVAILABLE COMMANDS",
|
|
233
|
+
items: [
|
|
234
|
+
{ name: "list", desc: "List catalogs (filter by status, paginate)" },
|
|
235
|
+
{ name: "get", desc: "Get catalog by id" },
|
|
236
|
+
{ name: "health", desc: "Health-check one or more catalogs (or --all)" },
|
|
237
|
+
{ name: "test-connection", desc: "Test catalog connectivity" },
|
|
238
|
+
{ name: "discover", desc: "Trigger discovery for a catalog" },
|
|
239
|
+
{ name: "resources", desc: "List resources within a catalog" },
|
|
240
|
+
{ name: "create", desc: "Create a catalog (name + connector-type + config)" },
|
|
241
|
+
{ name: "update", desc: "Update catalog fields" },
|
|
242
|
+
{ name: "delete", desc: "Delete one or more catalogs (-y to skip confirm)" },
|
|
243
|
+
],
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
}));
|
|
229
247
|
return 0;
|
|
230
248
|
}
|
|
231
249
|
if (sub === "list")
|
|
@@ -254,14 +272,17 @@ Subcommands:
|
|
|
254
272
|
// ---------------------------------------------------------------------------
|
|
255
273
|
async function runCatalogList(args) {
|
|
256
274
|
if (args.includes("--help") || args.includes("-h")) {
|
|
257
|
-
console.log(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
275
|
+
console.log(renderHelp({
|
|
276
|
+
tagline: "List Vega catalogs.",
|
|
277
|
+
usage: "kweaver vega catalog list [flags]",
|
|
278
|
+
flags: [
|
|
279
|
+
{ name: "--status <s>", desc: "Filter by status" },
|
|
280
|
+
{ name: "--limit <n>", desc: "Max results (default: 30)" },
|
|
281
|
+
{ name: "--offset <n>", desc: "Offset" },
|
|
282
|
+
{ name: "-bd, --biz-domain", desc: "Business domain (default: bd_public)" },
|
|
283
|
+
{ name: "--pretty", desc: "Pretty-print JSON (default)" },
|
|
284
|
+
],
|
|
285
|
+
}));
|
|
265
286
|
return 0;
|
|
266
287
|
}
|
|
267
288
|
let status;
|
|
@@ -300,7 +321,10 @@ Options:
|
|
|
300
321
|
// ---------------------------------------------------------------------------
|
|
301
322
|
async function runCatalogGet(args) {
|
|
302
323
|
if (args.includes("--help") || args.includes("-h")) {
|
|
303
|
-
console.log(
|
|
324
|
+
console.log(renderHelp({
|
|
325
|
+
tagline: "Get a Vega catalog by ID.",
|
|
326
|
+
usage: "kweaver vega catalog get <id> [flags]",
|
|
327
|
+
}));
|
|
304
328
|
return 0;
|
|
305
329
|
}
|
|
306
330
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -324,10 +348,18 @@ async function runCatalogGet(args) {
|
|
|
324
348
|
// ---------------------------------------------------------------------------
|
|
325
349
|
async function runCatalogHealth(args) {
|
|
326
350
|
if (args.includes("--help") || args.includes("-h")) {
|
|
327
|
-
console.log(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
351
|
+
console.log(renderHelp({
|
|
352
|
+
tagline: "Check health of one or more Vega catalogs.",
|
|
353
|
+
usage: "kweaver vega catalog health <ids...> | --all",
|
|
354
|
+
flags: [
|
|
355
|
+
{ name: "--all", desc: "Check health of all catalogs" },
|
|
356
|
+
],
|
|
357
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
358
|
+
examples: [
|
|
359
|
+
"kweaver vega catalog health c-123 c-456",
|
|
360
|
+
"kweaver vega catalog health --all",
|
|
361
|
+
],
|
|
362
|
+
}));
|
|
331
363
|
return 0;
|
|
332
364
|
}
|
|
333
365
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -365,7 +397,12 @@ Options:
|
|
|
365
397
|
// ---------------------------------------------------------------------------
|
|
366
398
|
async function runCatalogTestConnection(args) {
|
|
367
399
|
if (args.includes("--help") || args.includes("-h")) {
|
|
368
|
-
console.log(
|
|
400
|
+
console.log(renderHelp({
|
|
401
|
+
tagline: "Test catalog connector connectivity.",
|
|
402
|
+
usage: "kweaver vega catalog test-connection <id>",
|
|
403
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
404
|
+
examples: ["kweaver vega catalog test-connection c-123"],
|
|
405
|
+
}));
|
|
369
406
|
return 0;
|
|
370
407
|
}
|
|
371
408
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -389,10 +426,18 @@ async function runCatalogTestConnection(args) {
|
|
|
389
426
|
// ---------------------------------------------------------------------------
|
|
390
427
|
async function runCatalogDiscover(args) {
|
|
391
428
|
if (args.includes("--help") || args.includes("-h")) {
|
|
392
|
-
console.log(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
429
|
+
console.log(renderHelp({
|
|
430
|
+
tagline: "Trigger catalog resource discovery.",
|
|
431
|
+
usage: "kweaver vega catalog discover <id> [--wait]",
|
|
432
|
+
flags: [
|
|
433
|
+
{ name: "--wait", desc: "Wait for discovery to complete" },
|
|
434
|
+
],
|
|
435
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
436
|
+
examples: [
|
|
437
|
+
"kweaver vega catalog discover c-123",
|
|
438
|
+
"kweaver vega catalog discover c-123 --wait",
|
|
439
|
+
],
|
|
440
|
+
}));
|
|
396
441
|
return 0;
|
|
397
442
|
}
|
|
398
443
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -418,11 +463,19 @@ Options:
|
|
|
418
463
|
// ---------------------------------------------------------------------------
|
|
419
464
|
async function runCatalogResources(args) {
|
|
420
465
|
if (args.includes("--help") || args.includes("-h")) {
|
|
421
|
-
console.log(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
466
|
+
console.log(renderHelp({
|
|
467
|
+
tagline: "List resources for a catalog.",
|
|
468
|
+
usage: "kweaver vega catalog resources <id> [flags]",
|
|
469
|
+
flags: [
|
|
470
|
+
{ name: "--category <s>", desc: "Filter by category" },
|
|
471
|
+
{ name: "--limit <n>", desc: "Max results (default: 30)" },
|
|
472
|
+
],
|
|
473
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
474
|
+
examples: [
|
|
475
|
+
"kweaver vega catalog resources c-123",
|
|
476
|
+
"kweaver vega catalog resources c-123 --category table --limit 50",
|
|
477
|
+
],
|
|
478
|
+
}));
|
|
426
479
|
return 0;
|
|
427
480
|
}
|
|
428
481
|
let category;
|
|
@@ -465,14 +518,21 @@ Options:
|
|
|
465
518
|
// ---------------------------------------------------------------------------
|
|
466
519
|
async function runCatalogCreate(args) {
|
|
467
520
|
if (args.includes("--help") || args.includes("-h")) {
|
|
468
|
-
console.log(
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
521
|
+
console.log(renderHelp({
|
|
522
|
+
tagline: "Create a Vega catalog.",
|
|
523
|
+
usage: "kweaver vega catalog create [flags]",
|
|
524
|
+
flags: [
|
|
525
|
+
{ name: "--name <s>", desc: "Catalog name (required)" },
|
|
526
|
+
{ name: "--connector-type <s>", desc: "Connector type (required)" },
|
|
527
|
+
{ name: "--connector-config <j>", desc: "Connector config JSON (required)" },
|
|
528
|
+
{ name: "--tags <t1,t2>", desc: "Comma-separated tags" },
|
|
529
|
+
{ name: "--description <s>", desc: "Description" },
|
|
530
|
+
],
|
|
531
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
532
|
+
examples: [
|
|
533
|
+
"kweaver vega catalog create --name my-cat --connector-type mysql --connector-config '{\"host\":\"...\"}'",
|
|
534
|
+
],
|
|
535
|
+
}));
|
|
476
536
|
return 0;
|
|
477
537
|
}
|
|
478
538
|
let name;
|
|
@@ -532,14 +592,22 @@ Options:
|
|
|
532
592
|
// ---------------------------------------------------------------------------
|
|
533
593
|
async function runCatalogUpdate(args) {
|
|
534
594
|
if (args.includes("--help") || args.includes("-h")) {
|
|
535
|
-
console.log(
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
595
|
+
console.log(renderHelp({
|
|
596
|
+
tagline: "Update a Vega catalog.",
|
|
597
|
+
usage: "kweaver vega catalog update <id> [flags]",
|
|
598
|
+
flags: [
|
|
599
|
+
{ name: "--name <s>", desc: "New name" },
|
|
600
|
+
{ name: "--connector-type <t>", desc: "Connector type (e.g. mysql, opensearch)" },
|
|
601
|
+
{ name: "--tags <t1,t2>", desc: "Comma-separated tags" },
|
|
602
|
+
{ name: "--description <s>", desc: "Description" },
|
|
603
|
+
{ name: "--connector-config <j>", desc: "Connector config JSON" },
|
|
604
|
+
],
|
|
605
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
606
|
+
examples: [
|
|
607
|
+
"kweaver vega catalog update c-123 --name new-name",
|
|
608
|
+
"kweaver vega catalog update c-123 --tags prod,critical",
|
|
609
|
+
],
|
|
610
|
+
}));
|
|
543
611
|
return 0;
|
|
544
612
|
}
|
|
545
613
|
let name;
|
|
@@ -607,10 +675,18 @@ Options:
|
|
|
607
675
|
// ---------------------------------------------------------------------------
|
|
608
676
|
async function runCatalogDelete(args) {
|
|
609
677
|
if (args.includes("--help") || args.includes("-h")) {
|
|
610
|
-
console.log(
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
678
|
+
console.log(renderHelp({
|
|
679
|
+
tagline: "Delete one or more Vega catalogs.",
|
|
680
|
+
usage: "kweaver vega catalog delete <ids...> [-y]",
|
|
681
|
+
flags: [
|
|
682
|
+
{ name: "-y, --yes", desc: "Skip confirmation" },
|
|
683
|
+
],
|
|
684
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
685
|
+
examples: [
|
|
686
|
+
"kweaver vega catalog delete c-123",
|
|
687
|
+
"kweaver vega catalog delete c-123 c-456 -y",
|
|
688
|
+
],
|
|
689
|
+
}));
|
|
614
690
|
return 0;
|
|
615
691
|
}
|
|
616
692
|
let skipConfirm = false;
|
|
@@ -654,16 +730,25 @@ Options:
|
|
|
654
730
|
async function runVegaResourceCommand(args) {
|
|
655
731
|
const [sub, ...rest] = args;
|
|
656
732
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
657
|
-
console.log(
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
733
|
+
console.log(renderHelp({
|
|
734
|
+
tagline: "Manage Vega resources.",
|
|
735
|
+
usage: "kweaver vega resource <subcommand> [flags]",
|
|
736
|
+
sections: [
|
|
737
|
+
{
|
|
738
|
+
title: "AVAILABLE COMMANDS",
|
|
739
|
+
items: [
|
|
740
|
+
{ name: "list", desc: "List resources (filter by catalog / category / status)" },
|
|
741
|
+
{ name: "list-all", desc: "List all resources across catalogs" },
|
|
742
|
+
{ name: "get", desc: "Get resource by id" },
|
|
743
|
+
{ name: "query", desc: "Query resource data (JSON body)" },
|
|
744
|
+
{ name: "create", desc: "Create a resource (--catalog-id --name --category)" },
|
|
745
|
+
{ name: "update", desc: "Update resource fields" },
|
|
746
|
+
{ name: "delete", desc: "Delete one or more resources (-y to skip confirm)" },
|
|
747
|
+
],
|
|
748
|
+
},
|
|
749
|
+
],
|
|
750
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
751
|
+
}));
|
|
667
752
|
return 0;
|
|
668
753
|
}
|
|
669
754
|
if (sub === "list")
|
|
@@ -688,16 +773,20 @@ Subcommands:
|
|
|
688
773
|
// ---------------------------------------------------------------------------
|
|
689
774
|
async function runResourceList(args) {
|
|
690
775
|
if (args.includes("--help") || args.includes("-h")) {
|
|
691
|
-
console.log(
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
776
|
+
console.log(renderHelp({
|
|
777
|
+
tagline: "List Vega resources.",
|
|
778
|
+
usage: "kweaver vega resource list [flags]",
|
|
779
|
+
flags: [
|
|
780
|
+
{ name: "--catalog-id <s>", desc: "Filter by catalog" },
|
|
781
|
+
{ name: "--category <s>", desc: "Filter by category" },
|
|
782
|
+
{ name: "--status <s>", desc: "Filter by status" },
|
|
783
|
+
{ name: "--limit <n>", desc: "Max results (default: 30)" },
|
|
784
|
+
{ name: "--offset <n>", desc: "Offset" },
|
|
785
|
+
{ name: "-bd, --biz-domain", desc: "Business domain (default: bd_public)" },
|
|
786
|
+
{ name: "--pretty", desc: "Pretty-print JSON (default)" },
|
|
787
|
+
],
|
|
788
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
789
|
+
}));
|
|
701
790
|
return 0;
|
|
702
791
|
}
|
|
703
792
|
let catalogId;
|
|
@@ -748,13 +837,17 @@ Options:
|
|
|
748
837
|
// ---------------------------------------------------------------------------
|
|
749
838
|
async function runResourceListAll(args) {
|
|
750
839
|
if (args.includes("--help") || args.includes("-h")) {
|
|
751
|
-
console.log(
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
840
|
+
console.log(renderHelp({
|
|
841
|
+
tagline: "List all Vega resources.",
|
|
842
|
+
usage: "kweaver vega resource list-all [flags]",
|
|
843
|
+
flags: [
|
|
844
|
+
{ name: "--limit <n>", desc: "Max results (default: 30)" },
|
|
845
|
+
{ name: "--offset <n>", desc: "Offset" },
|
|
846
|
+
{ name: "-bd, --biz-domain", desc: "Business domain (default: bd_public)" },
|
|
847
|
+
{ name: "--pretty", desc: "Pretty-print JSON (default)" },
|
|
848
|
+
],
|
|
849
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
850
|
+
}));
|
|
758
851
|
return 0;
|
|
759
852
|
}
|
|
760
853
|
let limit = 30;
|
|
@@ -787,7 +880,11 @@ Options:
|
|
|
787
880
|
// ---------------------------------------------------------------------------
|
|
788
881
|
async function runResourceGet(args) {
|
|
789
882
|
if (args.includes("--help") || args.includes("-h")) {
|
|
790
|
-
console.log(
|
|
883
|
+
console.log(renderHelp({
|
|
884
|
+
tagline: "Get a Vega resource by id.",
|
|
885
|
+
usage: "kweaver vega resource get <id> [flags]",
|
|
886
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
887
|
+
}));
|
|
791
888
|
return 0;
|
|
792
889
|
}
|
|
793
890
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -811,10 +908,14 @@ async function runResourceGet(args) {
|
|
|
811
908
|
// ---------------------------------------------------------------------------
|
|
812
909
|
async function runResourceQuery(args) {
|
|
813
910
|
if (args.includes("--help") || args.includes("-h")) {
|
|
814
|
-
console.log(
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
911
|
+
console.log(renderHelp({
|
|
912
|
+
tagline: "Query a Vega resource.",
|
|
913
|
+
usage: "kweaver vega resource query <id> -d <json-body> [flags]",
|
|
914
|
+
flags: [
|
|
915
|
+
{ name: "-d, --data <json>", desc: "Request body (JSON string)" },
|
|
916
|
+
],
|
|
917
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
918
|
+
}));
|
|
818
919
|
return 0;
|
|
819
920
|
}
|
|
820
921
|
let data;
|
|
@@ -851,15 +952,19 @@ Options:
|
|
|
851
952
|
// ---------------------------------------------------------------------------
|
|
852
953
|
async function runResourceCreate(args) {
|
|
853
954
|
if (args.includes("--help") || args.includes("-h")) {
|
|
854
|
-
console.log(
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
955
|
+
console.log(renderHelp({
|
|
956
|
+
tagline: "Create a Vega resource.",
|
|
957
|
+
usage: "kweaver vega resource create [flags]",
|
|
958
|
+
flags: [
|
|
959
|
+
{ name: "--catalog-id <cid>", desc: "Catalog ID (required)" },
|
|
960
|
+
{ name: "--name <name>", desc: "Resource name (required)" },
|
|
961
|
+
{ name: "--category <cat>", desc: "Category (required)" },
|
|
962
|
+
{ name: "--source-identifier <si>", desc: "Source identifier" },
|
|
963
|
+
{ name: "--database <db>", desc: "Database name" },
|
|
964
|
+
{ name: "-d, --data <json>", desc: "Additional fields as JSON" },
|
|
965
|
+
],
|
|
966
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
967
|
+
}));
|
|
863
968
|
return 0;
|
|
864
969
|
}
|
|
865
970
|
let catalogId;
|
|
@@ -922,13 +1027,17 @@ Options:
|
|
|
922
1027
|
// ---------------------------------------------------------------------------
|
|
923
1028
|
async function runResourceUpdate(args) {
|
|
924
1029
|
if (args.includes("--help") || args.includes("-h")) {
|
|
925
|
-
console.log(
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
1030
|
+
console.log(renderHelp({
|
|
1031
|
+
tagline: "Update a Vega resource.",
|
|
1032
|
+
usage: "kweaver vega resource update <id> [flags]",
|
|
1033
|
+
flags: [
|
|
1034
|
+
{ name: "--name <name>", desc: "Resource name" },
|
|
1035
|
+
{ name: "--status <s>", desc: "Status" },
|
|
1036
|
+
{ name: "--tags <t1,t2>", desc: "Comma-separated tags" },
|
|
1037
|
+
{ name: "-d, --data <json>", desc: "Additional fields as JSON" },
|
|
1038
|
+
],
|
|
1039
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1040
|
+
}));
|
|
932
1041
|
return 0;
|
|
933
1042
|
}
|
|
934
1043
|
let name;
|
|
@@ -988,10 +1097,14 @@ Options:
|
|
|
988
1097
|
// ---------------------------------------------------------------------------
|
|
989
1098
|
async function runResourceDelete(args) {
|
|
990
1099
|
if (args.includes("--help") || args.includes("-h")) {
|
|
991
|
-
console.log(
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1100
|
+
console.log(renderHelp({
|
|
1101
|
+
tagline: "Delete Vega resources.",
|
|
1102
|
+
usage: "kweaver vega resource delete <ids...> [flags]",
|
|
1103
|
+
flags: [
|
|
1104
|
+
{ name: "-y, --yes", desc: "Skip confirmation prompt" },
|
|
1105
|
+
],
|
|
1106
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1107
|
+
}));
|
|
995
1108
|
return 0;
|
|
996
1109
|
}
|
|
997
1110
|
let yes = false;
|
|
@@ -1033,15 +1146,24 @@ Options:
|
|
|
1033
1146
|
async function runVegaDatasetCommand(args) {
|
|
1034
1147
|
const [sub, ...rest] = args;
|
|
1035
1148
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
1036
|
-
console.log(
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1149
|
+
console.log(renderHelp({
|
|
1150
|
+
tagline: "Manage Vega dataset documents and builds.",
|
|
1151
|
+
usage: "kweaver vega dataset <subcommand> [flags]",
|
|
1152
|
+
sections: [
|
|
1153
|
+
{
|
|
1154
|
+
title: "AVAILABLE COMMANDS",
|
|
1155
|
+
items: [
|
|
1156
|
+
{ name: "create-docs", desc: "Create documents in a dataset resource" },
|
|
1157
|
+
{ name: "update-docs", desc: "Update documents (by id) in a dataset resource" },
|
|
1158
|
+
{ name: "delete-docs", desc: "Delete documents by id" },
|
|
1159
|
+
{ name: "delete-docs-query", desc: "Delete documents by filter query" },
|
|
1160
|
+
{ name: "build", desc: "Build a dataset (full / incremental / realtime)" },
|
|
1161
|
+
{ name: "build-status", desc: "Get build task status" },
|
|
1162
|
+
],
|
|
1163
|
+
},
|
|
1164
|
+
],
|
|
1165
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1166
|
+
}));
|
|
1045
1167
|
return 0;
|
|
1046
1168
|
}
|
|
1047
1169
|
if (sub === "create-docs")
|
|
@@ -1064,10 +1186,14 @@ Subcommands:
|
|
|
1064
1186
|
// ---------------------------------------------------------------------------
|
|
1065
1187
|
async function runDatasetCreateDocs(args) {
|
|
1066
1188
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1067
|
-
console.log(
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1189
|
+
console.log(renderHelp({
|
|
1190
|
+
tagline: "Create dataset documents.",
|
|
1191
|
+
usage: "kweaver vega dataset create-docs <resource-id> -d <json-array>",
|
|
1192
|
+
flags: [
|
|
1193
|
+
{ name: "-d, --data <json>", desc: "Array of documents (JSON string)" },
|
|
1194
|
+
],
|
|
1195
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1196
|
+
}));
|
|
1071
1197
|
return 0;
|
|
1072
1198
|
}
|
|
1073
1199
|
let data;
|
|
@@ -1103,10 +1229,14 @@ Options:
|
|
|
1103
1229
|
// ---------------------------------------------------------------------------
|
|
1104
1230
|
async function runDatasetUpdateDocs(args) {
|
|
1105
1231
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1106
|
-
console.log(
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1232
|
+
console.log(renderHelp({
|
|
1233
|
+
tagline: "Update dataset documents.",
|
|
1234
|
+
usage: "kweaver vega dataset update-docs <resource-id> -d <json-array>",
|
|
1235
|
+
flags: [
|
|
1236
|
+
{ name: "-d, --data <json>", desc: "Array of documents with ids (JSON string)" },
|
|
1237
|
+
],
|
|
1238
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1239
|
+
}));
|
|
1110
1240
|
return 0;
|
|
1111
1241
|
}
|
|
1112
1242
|
let data;
|
|
@@ -1142,11 +1272,20 @@ Options:
|
|
|
1142
1272
|
// ---------------------------------------------------------------------------
|
|
1143
1273
|
async function runDatasetDeleteDocs(args) {
|
|
1144
1274
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1145
|
-
console.log(
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1275
|
+
console.log(renderHelp({
|
|
1276
|
+
tagline: "Delete dataset documents by id.",
|
|
1277
|
+
usage: "kweaver vega dataset delete-docs <resource-id> <doc-ids...>",
|
|
1278
|
+
sections: [
|
|
1279
|
+
{
|
|
1280
|
+
title: "Positional args",
|
|
1281
|
+
items: [
|
|
1282
|
+
{ name: "resource-id", desc: "The dataset resource ID" },
|
|
1283
|
+
{ name: "doc-ids", desc: "One or more document IDs (comma-joined)" },
|
|
1284
|
+
],
|
|
1285
|
+
},
|
|
1286
|
+
],
|
|
1287
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1288
|
+
}));
|
|
1150
1289
|
return 0;
|
|
1151
1290
|
}
|
|
1152
1291
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -1173,10 +1312,14 @@ Positional args:
|
|
|
1173
1312
|
// ---------------------------------------------------------------------------
|
|
1174
1313
|
async function runDatasetDeleteDocsQuery(args) {
|
|
1175
1314
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1176
|
-
console.log(
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1315
|
+
console.log(renderHelp({
|
|
1316
|
+
tagline: "Delete dataset documents matching a filter.",
|
|
1317
|
+
usage: "kweaver vega dataset delete-docs-query <resource-id> -d <filter-json>",
|
|
1318
|
+
flags: [
|
|
1319
|
+
{ name: "-d, --data <json>", desc: "Filter condition (JSON string)" },
|
|
1320
|
+
],
|
|
1321
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1322
|
+
}));
|
|
1180
1323
|
return 0;
|
|
1181
1324
|
}
|
|
1182
1325
|
let data;
|
|
@@ -1212,10 +1355,14 @@ Options:
|
|
|
1212
1355
|
// ---------------------------------------------------------------------------
|
|
1213
1356
|
async function runDatasetBuild(args) {
|
|
1214
1357
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1215
|
-
console.log(
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1358
|
+
console.log(renderHelp({
|
|
1359
|
+
tagline: "Build a Vega dataset.",
|
|
1360
|
+
usage: "kweaver vega dataset build <resource-id> [options]",
|
|
1361
|
+
flags: [
|
|
1362
|
+
{ name: "--mode <mode>", desc: "Build mode: full, incremental, realtime (default: full)" },
|
|
1363
|
+
],
|
|
1364
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1365
|
+
}));
|
|
1219
1366
|
return 0;
|
|
1220
1367
|
}
|
|
1221
1368
|
let mode = "full";
|
|
@@ -1251,7 +1398,11 @@ Options:
|
|
|
1251
1398
|
// ---------------------------------------------------------------------------
|
|
1252
1399
|
async function runDatasetBuildStatus(args) {
|
|
1253
1400
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1254
|
-
console.log(
|
|
1401
|
+
console.log(renderHelp({
|
|
1402
|
+
tagline: "Get dataset build status.",
|
|
1403
|
+
usage: "kweaver vega dataset build-status <resource-id> <task-id>",
|
|
1404
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1405
|
+
}));
|
|
1255
1406
|
return 0;
|
|
1256
1407
|
}
|
|
1257
1408
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -1279,10 +1430,19 @@ async function runDatasetBuildStatus(args) {
|
|
|
1279
1430
|
async function runVegaQueryCommand(args) {
|
|
1280
1431
|
const [sub, ...rest] = args;
|
|
1281
1432
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
1282
|
-
console.log(
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1433
|
+
console.log(renderHelp({
|
|
1434
|
+
tagline: "Execute structured Vega queries.",
|
|
1435
|
+
usage: "kweaver vega query <subcommand> [flags]",
|
|
1436
|
+
sections: [
|
|
1437
|
+
{
|
|
1438
|
+
title: "AVAILABLE COMMANDS",
|
|
1439
|
+
items: [
|
|
1440
|
+
{ name: "execute", desc: "Execute a structured query (-d <json>)" },
|
|
1441
|
+
],
|
|
1442
|
+
},
|
|
1443
|
+
],
|
|
1444
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1445
|
+
}));
|
|
1286
1446
|
return 0;
|
|
1287
1447
|
}
|
|
1288
1448
|
if (sub === "execute")
|
|
@@ -1295,10 +1455,14 @@ Subcommands:
|
|
|
1295
1455
|
// ---------------------------------------------------------------------------
|
|
1296
1456
|
async function runQueryExecute(args) {
|
|
1297
1457
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1298
|
-
console.log(
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1458
|
+
console.log(renderHelp({
|
|
1459
|
+
tagline: "Execute a Vega query.",
|
|
1460
|
+
usage: "kweaver vega query execute -d <json>",
|
|
1461
|
+
flags: [
|
|
1462
|
+
{ name: "-d, --data <json>", desc: "Query body (tables, joins, output_fields, filter_condition, sort, limit, ...)" },
|
|
1463
|
+
],
|
|
1464
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1465
|
+
}));
|
|
1302
1466
|
return 0;
|
|
1303
1467
|
}
|
|
1304
1468
|
let data;
|
|
@@ -1329,43 +1493,59 @@ Options:
|
|
|
1329
1493
|
// ---------------------------------------------------------------------------
|
|
1330
1494
|
async function runVegaSql(args) {
|
|
1331
1495
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1332
|
-
console.log(
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1496
|
+
console.log(renderHelp({
|
|
1497
|
+
tagline: "POST /api/vega-backend/v1/resources/query — execute SQL (MySQL/MariaDB/PostgreSQL) or OpenSearch DSL.",
|
|
1498
|
+
usage: [
|
|
1499
|
+
"kweaver vega sql --resource-type <type> --query \"<sql-or-dsl>\"",
|
|
1500
|
+
"kweaver vega sql -d <json>",
|
|
1501
|
+
].join("\n"),
|
|
1502
|
+
sections: [
|
|
1503
|
+
{
|
|
1504
|
+
title: "Simple mode (no JSON escaping for query + type)",
|
|
1505
|
+
items: [
|
|
1506
|
+
{ name: "--resource-type <t>", desc: "Required with --query unless using -d" },
|
|
1507
|
+
{ name: "--query <string>", desc: "One shell argument: the full SQL (or DSL string). Always quote it." },
|
|
1508
|
+
],
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
title: "Advanced mode (full request body, optional fields)",
|
|
1512
|
+
items: [
|
|
1513
|
+
{ name: "-d, --data <json>", desc: "Raw JSON body. When present, this mode is used and any --query / --resource-type are ignored." },
|
|
1514
|
+
],
|
|
1515
|
+
},
|
|
1516
|
+
{
|
|
1517
|
+
title: "Resource placeholders (how to reference Vega tables in SQL)",
|
|
1518
|
+
items: [
|
|
1519
|
+
{ name: "{{<resource_id>}}", desc: "Required token form: double braces around the Vega resource id (from vega resource list / get)." },
|
|
1520
|
+
{ name: "{{.<resource_id>}}", desc: "Alternate form with a dot after {{ ; same replacement and routing." },
|
|
1521
|
+
],
|
|
1522
|
+
},
|
|
1523
|
+
{
|
|
1524
|
+
title: "Body fields (JSON / simple mode mapping)",
|
|
1525
|
+
items: [
|
|
1526
|
+
{ name: "query", desc: "(required) SQL string or OpenSearch DSL object" },
|
|
1527
|
+
{ name: "resource_type", desc: "(required) e.g. mysql, mariadb, postgresql, opensearch (see vega connector-type list)" },
|
|
1528
|
+
{ name: "stream_size", desc: "optional batch size for streaming (100–10000, default 10000)" },
|
|
1529
|
+
{ name: "query_timeout", desc: "optional seconds (1–3600, default 60)" },
|
|
1530
|
+
{ name: "query_id", desc: "optional cursor session id" },
|
|
1531
|
+
],
|
|
1532
|
+
},
|
|
1533
|
+
],
|
|
1534
|
+
flags: [
|
|
1535
|
+
{ name: "-bd, --biz-domain <s>", desc: "Business domain (default: bd_public)" },
|
|
1536
|
+
{ name: "--pretty", desc: "Pretty-print JSON (default)" },
|
|
1537
|
+
],
|
|
1538
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1539
|
+
examples: [
|
|
1540
|
+
"kweaver vega sql --resource-type mysql --query \"SELECT * FROM {{abc123xyz}} LIMIT 5\"",
|
|
1541
|
+
"kweaver vega sql -d '{\"resource_type\":\"mysql\",\"query\":\"SELECT * FROM {{abc123xyz}} LIMIT 5\"}'",
|
|
1542
|
+
],
|
|
1543
|
+
learnMore: [
|
|
1544
|
+
"The backend swaps each placeholder for that resource's physical SourceIdentifier and picks the catalog connector.",
|
|
1545
|
+
"Without at least one placeholder, queries often fail (e.g. connector config is incomplete) unless a default connector exists.",
|
|
1546
|
+
"Do not use --type; use --resource-type.",
|
|
1547
|
+
],
|
|
1548
|
+
}));
|
|
1369
1549
|
return 0;
|
|
1370
1550
|
}
|
|
1371
1551
|
let data;
|
|
@@ -1425,15 +1605,24 @@ Common flags:
|
|
|
1425
1605
|
async function runVegaConnectorTypeCommand(args) {
|
|
1426
1606
|
const [sub, ...rest] = args;
|
|
1427
1607
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
1428
|
-
console.log(
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1608
|
+
console.log(renderHelp({
|
|
1609
|
+
tagline: "Manage Vega connector types.",
|
|
1610
|
+
usage: "kweaver vega connector-type <subcommand> [flags]",
|
|
1611
|
+
sections: [
|
|
1612
|
+
{
|
|
1613
|
+
title: "AVAILABLE COMMANDS",
|
|
1614
|
+
items: [
|
|
1615
|
+
{ name: "list", desc: "List connector types" },
|
|
1616
|
+
{ name: "get", desc: "Get connector type details" },
|
|
1617
|
+
{ name: "register", desc: "Register a new connector type" },
|
|
1618
|
+
{ name: "update", desc: "Update connector type" },
|
|
1619
|
+
{ name: "delete", desc: "Delete connector type" },
|
|
1620
|
+
{ name: "enable", desc: "Enable/disable connector type" },
|
|
1621
|
+
],
|
|
1622
|
+
},
|
|
1623
|
+
],
|
|
1624
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1625
|
+
}));
|
|
1437
1626
|
return 0;
|
|
1438
1627
|
}
|
|
1439
1628
|
if (sub === "list")
|
|
@@ -1456,7 +1645,11 @@ Subcommands:
|
|
|
1456
1645
|
// ---------------------------------------------------------------------------
|
|
1457
1646
|
async function runConnectorTypeList(args) {
|
|
1458
1647
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1459
|
-
console.log(
|
|
1648
|
+
console.log(renderHelp({
|
|
1649
|
+
tagline: "List Vega connector types.",
|
|
1650
|
+
usage: "kweaver vega connector-type list",
|
|
1651
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1652
|
+
}));
|
|
1460
1653
|
return 0;
|
|
1461
1654
|
}
|
|
1462
1655
|
const { businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -1474,7 +1667,11 @@ async function runConnectorTypeList(args) {
|
|
|
1474
1667
|
// ---------------------------------------------------------------------------
|
|
1475
1668
|
async function runConnectorTypeGet(args) {
|
|
1476
1669
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1477
|
-
console.log(
|
|
1670
|
+
console.log(renderHelp({
|
|
1671
|
+
tagline: "Get connector type details.",
|
|
1672
|
+
usage: "kweaver vega connector-type get <type>",
|
|
1673
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1674
|
+
}));
|
|
1478
1675
|
return 0;
|
|
1479
1676
|
}
|
|
1480
1677
|
const { remaining, businessDomain, pretty } = parseCommonFlags(args);
|
|
@@ -1498,10 +1695,14 @@ async function runConnectorTypeGet(args) {
|
|
|
1498
1695
|
// ---------------------------------------------------------------------------
|
|
1499
1696
|
async function runConnectorTypeRegister(args) {
|
|
1500
1697
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1501
|
-
console.log(
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1698
|
+
console.log(renderHelp({
|
|
1699
|
+
tagline: "Register a new connector type.",
|
|
1700
|
+
usage: "kweaver vega connector-type register -d <json>",
|
|
1701
|
+
flags: [
|
|
1702
|
+
{ name: "-d, --data <json>", desc: "Connector type definition (JSON string)" },
|
|
1703
|
+
],
|
|
1704
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1705
|
+
}));
|
|
1505
1706
|
return 0;
|
|
1506
1707
|
}
|
|
1507
1708
|
let data;
|
|
@@ -1532,10 +1733,14 @@ Options:
|
|
|
1532
1733
|
// ---------------------------------------------------------------------------
|
|
1533
1734
|
async function runConnectorTypeUpdate(args) {
|
|
1534
1735
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1535
|
-
console.log(
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1736
|
+
console.log(renderHelp({
|
|
1737
|
+
tagline: "Update a connector type.",
|
|
1738
|
+
usage: "kweaver vega connector-type update <type> -d <json>",
|
|
1739
|
+
flags: [
|
|
1740
|
+
{ name: "-d, --data <json>", desc: "Updated fields (JSON string)" },
|
|
1741
|
+
],
|
|
1742
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1743
|
+
}));
|
|
1539
1744
|
return 0;
|
|
1540
1745
|
}
|
|
1541
1746
|
let data;
|
|
@@ -1571,10 +1776,14 @@ Options:
|
|
|
1571
1776
|
// ---------------------------------------------------------------------------
|
|
1572
1777
|
async function runConnectorTypeDelete(args) {
|
|
1573
1778
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1574
|
-
console.log(
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1779
|
+
console.log(renderHelp({
|
|
1780
|
+
tagline: "Delete a connector type.",
|
|
1781
|
+
usage: "kweaver vega connector-type delete <type> [-y]",
|
|
1782
|
+
flags: [
|
|
1783
|
+
{ name: "-y, --yes", desc: "Skip confirmation prompt" },
|
|
1784
|
+
],
|
|
1785
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1786
|
+
}));
|
|
1578
1787
|
return 0;
|
|
1579
1788
|
}
|
|
1580
1789
|
let yes = false;
|
|
@@ -1615,7 +1824,14 @@ Options:
|
|
|
1615
1824
|
// ---------------------------------------------------------------------------
|
|
1616
1825
|
async function runConnectorTypeEnable(args) {
|
|
1617
1826
|
if (args.includes("--help") || args.includes("-h")) {
|
|
1618
|
-
console.log(
|
|
1827
|
+
console.log(renderHelp({
|
|
1828
|
+
tagline: "Enable or disable a connector type.",
|
|
1829
|
+
usage: "kweaver vega connector-type enable <type> --enabled <true|false>",
|
|
1830
|
+
flags: [
|
|
1831
|
+
{ name: "--enabled <true|false>", desc: "Whether to enable the connector type" },
|
|
1832
|
+
],
|
|
1833
|
+
inheritedFlags: "--base-url, --token, --user, --help",
|
|
1834
|
+
}));
|
|
1619
1835
|
return 0;
|
|
1620
1836
|
}
|
|
1621
1837
|
let enabled;
|