@yz-xingtu/ops-cli 0.1.1 → 0.2.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.js +5 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52,6 +52,7 @@ var RESOURCES = {
|
|
|
52
52
|
SALES: "sales",
|
|
53
53
|
INVENTORY: "inventory",
|
|
54
54
|
STORAGE_FEE: "storage_fee",
|
|
55
|
+
SETTLEMENT: "settlement",
|
|
55
56
|
PROFIT: "profit",
|
|
56
57
|
JOB: "job",
|
|
57
58
|
JOB_RUN: "job_run",
|
|
@@ -1072,15 +1073,16 @@ async function call(client, method, path3, payload) {
|
|
|
1072
1073
|
}
|
|
1073
1074
|
}
|
|
1074
1075
|
var program = new Command();
|
|
1075
|
-
program.name("duoduo-ops").description("\u591A\u591A\u8FD0\u8425\u540E\u53F0 CLI\uFF1A\u67E5\u8BE2\u9500\u552E/\u5E93\u5B58/\u5229\u6DA6/\u4ED3\u50A8\u8D39\uFF0C\u7BA1\u7406\u4E3B\u6570\u636E").version("0.1.0").option("--api <url>", "\u4E91\u7AEF API \u5730\u5740", process.env.INGEST_API_BASE ?? "http://localhost:3000").option("--token <jwt>", "Ops JWT\uFF08\u4F18\u5148\u7EA7\uFF1A--token > OPS_JWT \u73AF\u5883\u53D8\u91CF\uFF09", process.env.OPS_JWT).option("--pretty", "\u7F8E\u5316 JSON \u8F93\u51FA", false);
|
|
1076
|
+
program.name("duoduo-ops").description("\u591A\u591A\u8FD0\u8425\u540E\u53F0 CLI\uFF1A\u67E5\u8BE2\u9500\u552E/\u5E93\u5B58/\u5229\u6DA6/\u4ED3\u50A8\u8D39\uFF0C\u7BA1\u7406\u4E3B\u6570\u636E").version("0.1.0").option("--api <url>", "\u4E91\u7AEF API \u5730\u5740", process.env.INGEST_API_BASE ?? "http://localhost:3000").option("--token <jwt>", "Ops JWT\uFF08\u4F18\u5148\u7EA7\uFF1A--token > OPS_JWT \u73AF\u5883\u53D8\u91CF\uFF09", process.env.OPS_JWT).option("--key <apiKey>", "API Key\uFF08\u66FF\u4EE3 --token\uFF0Cenv: COLLECTOR_API_KEY\uFF09", process.env.COLLECTOR_API_KEY).option("--pretty", "\u7F8E\u5316 JSON \u8F93\u51FA", false);
|
|
1076
1077
|
function globalOpts(cmd) {
|
|
1077
1078
|
const root = cmd.parent ?? cmd;
|
|
1078
1079
|
return root.opts();
|
|
1079
1080
|
}
|
|
1080
1081
|
function requireToken(cmd) {
|
|
1081
1082
|
const g = globalOpts(cmd);
|
|
1082
|
-
|
|
1083
|
-
|
|
1083
|
+
const token = g.key ?? g.token;
|
|
1084
|
+
if (!token) die("\u7F3A\u5C11\u9274\u6743\u51ED\u636E\uFF0C\u8BF7\u901A\u8FC7 --key\uFF08\u63A8\u8350\uFF09\u6216 --token / OPS_JWT \u73AF\u5883\u53D8\u91CF\u63D0\u4F9B");
|
|
1085
|
+
return { api: g.api, token, pretty: g.pretty };
|
|
1084
1086
|
}
|
|
1085
1087
|
program.command("gen-token").description("\u751F\u6210 Ops JWT\uFF08\u9700\u8981 WORKER_JWT_SECRET \u548C\u79DF\u6237 slug\uFF09").requiredOption("--tenant-slug <slug>", "\u79DF\u6237 slug\uFF08\u53EF\u5728\u540E\u53F0\u300C\u8BBE\u7F6E\u300D\u9875\u6216\u6CE8\u518C\u90AE\u4EF6\u4E2D\u67E5\u770B\uFF09").option("--tenant-id <uuid>", "\u79DF\u6237 UUID\uFF08\u53EF\u9009\uFF0C\u9ED8\u8BA4\u81EA\u52A8\u4F7F\u7528 slug\uFF09").option("--ttl <days>", "\u6709\u6548\u671F\uFF08\u5929\uFF09", "30").action(async (opts, cmd) => {
|
|
1086
1088
|
const g = globalOpts(cmd);
|
package/package.json
CHANGED