@acomo/cli 1.0.3 → 1.0.5
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 +4 -7
- package/dist/index.js +21 -23
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,17 +92,14 @@ echo '{"modelId":"wf_xxx"}' | acomo getWorkflowModel
|
|
|
92
92
|
acomo createWorkflowModel < model-data.json
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
###
|
|
95
|
+
### 出力形式
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
|
-
#
|
|
98
|
+
# テキスト形式(デフォルト)
|
|
99
99
|
acomo listWorkflowModels
|
|
100
100
|
|
|
101
|
-
#
|
|
102
|
-
acomo listWorkflowModels --format
|
|
103
|
-
|
|
104
|
-
# jq と組み合わせる
|
|
105
|
-
acomo listWorkflowModels --format compact | jq '.[0].id'
|
|
101
|
+
# JSON 形式
|
|
102
|
+
acomo listWorkflowModels --format json
|
|
106
103
|
```
|
|
107
104
|
|
|
108
105
|
### 設定管理
|
package/dist/index.js
CHANGED
|
@@ -12180,17 +12180,20 @@ function clearConfig() {
|
|
|
12180
12180
|
}
|
|
12181
12181
|
|
|
12182
12182
|
// src/lib/api-client.ts
|
|
12183
|
-
function createConfiguration() {
|
|
12183
|
+
function createConfiguration(options) {
|
|
12184
12184
|
const config = resolveConfig();
|
|
12185
12185
|
if (!config) {
|
|
12186
12186
|
throw new Error("\u8A8D\u8A3C\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002`acomo login` \u3092\u5B9F\u884C\u3059\u308B\u304B\u3001\u74B0\u5883\u5909\u6570 (ACOMO_ACCESS_TOKEN, ACOMO_TENANT_ID) \u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
12187
12187
|
}
|
|
12188
|
-
|
|
12188
|
+
const params = {
|
|
12189
12189
|
basePath: config.baseUrl,
|
|
12190
12190
|
accessToken: config.accessToken,
|
|
12191
12191
|
apiKey: config.tenantId
|
|
12192
|
-
|
|
12193
|
-
|
|
12192
|
+
};
|
|
12193
|
+
if (options?.accept === "text/plain") {
|
|
12194
|
+
params.headers = { Accept: "text/plain" };
|
|
12195
|
+
}
|
|
12196
|
+
return new Configuration(params);
|
|
12194
12197
|
}
|
|
12195
12198
|
function extractApiClasses() {
|
|
12196
12199
|
const apiClasses = {};
|
|
@@ -12217,14 +12220,6 @@ function buildOperationRegistry(config) {
|
|
|
12217
12220
|
return registry;
|
|
12218
12221
|
}
|
|
12219
12222
|
|
|
12220
|
-
// src/lib/formatter.ts
|
|
12221
|
-
function formatOutput(data, format3 = "json") {
|
|
12222
|
-
if (format3 === "compact") {
|
|
12223
|
-
return JSON.stringify(data) + "\n";
|
|
12224
|
-
}
|
|
12225
|
-
return JSON.stringify(data, null, 2) + "\n";
|
|
12226
|
-
}
|
|
12227
|
-
|
|
12228
12223
|
// src/commands/login.ts
|
|
12229
12224
|
var readline = __toESM(require("readline"));
|
|
12230
12225
|
function command2() {
|
|
@@ -12594,11 +12589,9 @@ function handleError(error) {
|
|
|
12594
12589
|
if (error.name === "ResponseError") {
|
|
12595
12590
|
console.error(`API \u30A8\u30E9\u30FC (${error.response?.status || "unknown"})`);
|
|
12596
12591
|
if (error.response) {
|
|
12597
|
-
error.response.
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
console.error(error.message);
|
|
12601
|
-
}).finally(() => {
|
|
12592
|
+
const contentType = error.response.headers?.get?.("content-type") ?? "";
|
|
12593
|
+
const bodyPromise = contentType.includes("text/plain") ? error.response.text() : error.response.json().then((body) => JSON.stringify(body, null, 2));
|
|
12594
|
+
bodyPromise.then((body) => console.error(body)).catch(() => console.error(error.message)).finally(() => {
|
|
12602
12595
|
if (error.response?.status === 401) {
|
|
12603
12596
|
console.error("\n`acomo login` \u3092\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
|
|
12604
12597
|
}
|
|
@@ -12621,9 +12614,9 @@ async function main() {
|
|
|
12621
12614
|
const argv = yargs_default(hideBin(process.argv)).scriptName("acomo").usage("Usage: $0 <command> [options]").option("format", {
|
|
12622
12615
|
alias: "f",
|
|
12623
12616
|
type: "string",
|
|
12624
|
-
description: "\u51FA\u529B\
|
|
12625
|
-
choices: ["
|
|
12626
|
-
default: "
|
|
12617
|
+
description: "\u51FA\u529B\u5F62\u5F0F\uFF08API \u306E Accept \u30D8\u30C3\u30C0\u30FC\uFF09",
|
|
12618
|
+
choices: ["text", "json"],
|
|
12619
|
+
default: "text"
|
|
12627
12620
|
}).help().alias("h", "help").version(pkg.version).alias("v", "version");
|
|
12628
12621
|
argv.command(
|
|
12629
12622
|
command2(),
|
|
@@ -12660,9 +12653,14 @@ async function main() {
|
|
|
12660
12653
|
try {
|
|
12661
12654
|
const params = await resolveParams(cmdArgv.params);
|
|
12662
12655
|
const entry = registry.get(operationId);
|
|
12663
|
-
const
|
|
12664
|
-
const
|
|
12665
|
-
|
|
12656
|
+
const format3 = cmdArgv.format ?? "text";
|
|
12657
|
+
const apiConfig = createConfiguration(
|
|
12658
|
+
format3 === "text" ? { accept: "text/plain" } : void 0
|
|
12659
|
+
);
|
|
12660
|
+
const instance = new entry.instance.constructor(apiConfig);
|
|
12661
|
+
const rawResponse = await instance[entry.method + "Raw"](params ?? {});
|
|
12662
|
+
const text = await rawResponse.raw.text();
|
|
12663
|
+
process.stdout.write(text + "\n");
|
|
12666
12664
|
} catch (error) {
|
|
12667
12665
|
handleError(error);
|
|
12668
12666
|
}
|