@zhoujinandrew/te-cli 1.0.0 → 1.0.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.
@@ -0,0 +1,16 @@
1
+ import {
2
+ httpGet,
3
+ httpPost,
4
+ queryReportData,
5
+ querySql,
6
+ wsQuery
7
+ } from "./chunk-O6AQSK3A.js";
8
+ import "./chunk-P7NQZGSZ.js";
9
+ import "./chunk-CFCHSAMQ.js";
10
+ export {
11
+ httpGet,
12
+ httpPost,
13
+ queryReportData,
14
+ querySql,
15
+ wsQuery
16
+ };
package/dist/index.js CHANGED
@@ -60,7 +60,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
60
60
  let _clientModule = null;
61
61
  async function getClient() {
62
62
  if (!_clientModule) {
63
- _clientModule = await import("./client-EZSKQFIH.js");
63
+ _clientModule = await import("./client-6TVMBUGP.js");
64
64
  }
65
65
  return _clientModule;
66
66
  }
@@ -191,7 +191,7 @@ async function loadCommands() {
191
191
  } catch {
192
192
  }
193
193
  try {
194
- const analysis = await import("./analysis-SFPXKD3E.js");
194
+ const analysis = await import("./analysis-M54YNGTJ.js");
195
195
  commands.push(...analysis.default);
196
196
  } catch {
197
197
  }
@@ -223,7 +223,7 @@ async function registerConfigCommands() {
223
223
  }
224
224
  async function registerApiCommand() {
225
225
  try {
226
- const { registerApi } = await import("./raw-YVFTDHSI.js");
226
+ const { registerApi } = await import("./raw-M3K7FAJ4.js");
227
227
  registerApi(program);
228
228
  } catch {
229
229
  }
@@ -0,0 +1,59 @@
1
+ import {
2
+ httpGet,
3
+ httpPost
4
+ } from "./chunk-4OJI46I5.js";
5
+ import {
6
+ printError,
7
+ printOutput
8
+ } from "./chunk-KM57HI5B.js";
9
+ import {
10
+ resolveHost
11
+ } from "./chunk-P7NQZGSZ.js";
12
+ import "./chunk-CFCHSAMQ.js";
13
+
14
+ // src/api/raw.ts
15
+ function registerApi(program) {
16
+ program.command("api").description("Raw API call: te-cli api <METHOD> <PATH> [options]").argument("<method>", "HTTP method (GET, POST)").argument("<path>", "API path (e.g., /v1/ta/event/catalog/listEvent)").option("--params <json>", "URL parameters as JSON").option("--data <json>", "Request body as JSON").action(async (method, apiPath, opts) => {
17
+ const globalOpts = program.opts();
18
+ const host = resolveHost(globalOpts.host);
19
+ const format = globalOpts.format || "json";
20
+ const jq = globalOpts.jq;
21
+ if (!host) {
22
+ printError("config", "No TE host configured.", "Run: te-cli config set-host");
23
+ process.exit(1);
24
+ }
25
+ try {
26
+ let params = {};
27
+ let body = void 0;
28
+ if (opts.params) {
29
+ try {
30
+ params = JSON.parse(opts.params);
31
+ } catch {
32
+ printError("validation", `Invalid JSON for --params: ${opts.params}`);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ if (opts.data) {
37
+ try {
38
+ body = JSON.parse(opts.data);
39
+ } catch {
40
+ printError("validation", `Invalid JSON for --data: ${opts.data}`);
41
+ process.exit(1);
42
+ }
43
+ }
44
+ let result;
45
+ if (method.toUpperCase() === "GET") {
46
+ result = await httpGet(apiPath, params, host);
47
+ } else {
48
+ result = await httpPost(apiPath, params, body, host);
49
+ }
50
+ printOutput(result, format, jq);
51
+ } catch (err) {
52
+ printError("api", err.message);
53
+ process.exit(1);
54
+ }
55
+ });
56
+ }
57
+ export {
58
+ registerApi
59
+ };
@@ -0,0 +1,59 @@
1
+ import {
2
+ httpGet,
3
+ httpPost
4
+ } from "./chunk-GZG7YDWV.js";
5
+ import {
6
+ printError,
7
+ printOutput
8
+ } from "./chunk-KM57HI5B.js";
9
+ import {
10
+ resolveHost
11
+ } from "./chunk-P7NQZGSZ.js";
12
+ import "./chunk-CFCHSAMQ.js";
13
+
14
+ // src/api/raw.ts
15
+ function registerApi(program) {
16
+ program.command("api").description("Raw API call: te-cli api <METHOD> <PATH> [options]").argument("<method>", "HTTP method (GET, POST)").argument("<path>", "API path (e.g., /v1/ta/event/catalog/listEvent)").option("--params <json>", "URL parameters as JSON").option("--data <json>", "Request body as JSON").action(async (method, apiPath, opts) => {
17
+ const globalOpts = program.opts();
18
+ const host = resolveHost(globalOpts.host);
19
+ const format = globalOpts.format || "json";
20
+ const jq = globalOpts.jq;
21
+ if (!host) {
22
+ printError("config", "No TE host configured.", "Run: te-cli config set-host");
23
+ process.exit(1);
24
+ }
25
+ try {
26
+ let params = {};
27
+ let body = void 0;
28
+ if (opts.params) {
29
+ try {
30
+ params = JSON.parse(opts.params);
31
+ } catch {
32
+ printError("validation", `Invalid JSON for --params: ${opts.params}`);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ if (opts.data) {
37
+ try {
38
+ body = JSON.parse(opts.data);
39
+ } catch {
40
+ printError("validation", `Invalid JSON for --data: ${opts.data}`);
41
+ process.exit(1);
42
+ }
43
+ }
44
+ let result;
45
+ if (method.toUpperCase() === "GET") {
46
+ result = await httpGet(apiPath, params, host);
47
+ } else {
48
+ result = await httpPost(apiPath, params, body, host);
49
+ }
50
+ printOutput(result, format, jq);
51
+ } catch (err) {
52
+ printError("api", err.message);
53
+ process.exit(1);
54
+ }
55
+ });
56
+ }
57
+ export {
58
+ registerApi
59
+ };
@@ -0,0 +1,59 @@
1
+ import {
2
+ httpGet,
3
+ httpPost
4
+ } from "./chunk-O6AQSK3A.js";
5
+ import {
6
+ printError,
7
+ printOutput
8
+ } from "./chunk-KM57HI5B.js";
9
+ import {
10
+ resolveHost
11
+ } from "./chunk-P7NQZGSZ.js";
12
+ import "./chunk-CFCHSAMQ.js";
13
+
14
+ // src/api/raw.ts
15
+ function registerApi(program) {
16
+ program.command("api").description("Raw API call: te-cli api <METHOD> <PATH> [options]").argument("<method>", "HTTP method (GET, POST)").argument("<path>", "API path (e.g., /v1/ta/event/catalog/listEvent)").option("--params <json>", "URL parameters as JSON").option("--data <json>", "Request body as JSON").action(async (method, apiPath, opts) => {
17
+ const globalOpts = program.opts();
18
+ const host = resolveHost(globalOpts.host);
19
+ const format = globalOpts.format || "json";
20
+ const jq = globalOpts.jq;
21
+ if (!host) {
22
+ printError("config", "No TE host configured.", "Run: te-cli config set-host");
23
+ process.exit(1);
24
+ }
25
+ try {
26
+ let params = {};
27
+ let body = void 0;
28
+ if (opts.params) {
29
+ try {
30
+ params = JSON.parse(opts.params);
31
+ } catch {
32
+ printError("validation", `Invalid JSON for --params: ${opts.params}`);
33
+ process.exit(1);
34
+ }
35
+ }
36
+ if (opts.data) {
37
+ try {
38
+ body = JSON.parse(opts.data);
39
+ } catch {
40
+ printError("validation", `Invalid JSON for --data: ${opts.data}`);
41
+ process.exit(1);
42
+ }
43
+ }
44
+ let result;
45
+ if (method.toUpperCase() === "GET") {
46
+ result = await httpGet(apiPath, params, host);
47
+ } else {
48
+ result = await httpPost(apiPath, params, body, host);
49
+ }
50
+ printOutput(result, format, jq);
51
+ } catch (err) {
52
+ printError("api", err.message);
53
+ process.exit(1);
54
+ }
55
+ });
56
+ }
57
+ export {
58
+ registerApi
59
+ };
package/package.json CHANGED
@@ -1,13 +1,18 @@
1
1
  {
2
2
  "name": "@zhoujinandrew/te-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool for ThinkingEngine (TE) analytics platform",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "te-cli": "bin/te-cli.js"
8
8
  },
9
9
  "main": "dist/index.js",
10
- "files": ["bin/", "dist/", "skills/", "README.md"],
10
+ "files": [
11
+ "bin/",
12
+ "dist/",
13
+ "skills/",
14
+ "README.md"
15
+ ],
11
16
  "scripts": {
12
17
  "dev": "tsx src/index.ts",
13
18
  "build": "tsup src/index.ts --format esm --outDir dist",
@@ -19,7 +24,11 @@
19
24
  "type": "git",
20
25
  "url": "git+https://github.com/zjandrew/te-cli.git"
21
26
  },
22
- "keywords": ["thinkingengine", "analytics", "cli"],
27
+ "keywords": [
28
+ "thinkingengine",
29
+ "analytics",
30
+ "cli"
31
+ ],
23
32
  "author": "zjandrew",
24
33
  "license": "MIT",
25
34
  "engines": {