@tolinax/ayoune-cli 2026.11.1 → 2026.11.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/lib/commands/createAiCommand.js +8 -4
- package/lib/commands/createBatchCommand.js +5 -3
- package/lib/commands/createExportCommand.js +5 -3
- package/lib/commands/createJobsCommand.js +3 -2
- package/lib/commands/createModulesCommand.js +3 -2
- package/lib/commands/createMonitorCommand.js +5 -3
- package/lib/commands/createPermissionsCommand.js +9 -5
- package/lib/commands/createProgram.js +11 -0
- package/lib/commands/createSearchCommand.js +5 -3
- package/lib/commands/createServicesCommand.js +9 -5
- package/lib/commands/createSyncCommand.js +9 -5
- package/lib/commands/createTemplateCommand.js +9 -5
- package/lib/commands/createUsersCommand.js +13 -7
- package/lib/commands/createWebhooksCommand.js +7 -4
- package/lib/commands/deploy/clusters.js +3 -2
- package/lib/commands/deploy/dashboard.js +3 -2
- package/lib/commands/deploy/deployments.js +9 -5
- package/lib/commands/deploy/pipelines.js +3 -2
- package/lib/commands/deploy/plans.js +7 -4
- package/lib/commands/deploy/pods.js +3 -2
- package/lib/commands/deploy/repos.js +3 -2
- package/lib/helpers/handleResponseFormatOptions.js +21 -9
- package/lib/operations/handleAuditOperation.js +5 -4
- package/lib/operations/handleCopySingleOperation.js +8 -6
- package/lib/operations/handleCreateSingleOperation.js +8 -7
- package/lib/operations/handleGetOperation.js +6 -2
- package/lib/operations/handleGetSingleOperation.js +5 -3
- package/lib/operations/handleListOperation.js +10 -4
- package/lib/operations/handleSingleAuditOperation.js +8 -7
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
2
|
import { api } from "../api/apiClient.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
3
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
4
4
|
import { saveFile } from "../helpers/saveFile.js";
|
|
5
5
|
import { secureStorage } from "../helpers/secureStorage.js";
|
|
6
6
|
import { spinner } from "../../index.js";
|
|
@@ -41,9 +41,10 @@ export function createAiCommand(program) {
|
|
|
41
41
|
payload: actions,
|
|
42
42
|
meta: { responseTime: 0, pageInfo: { totalEntries: actions.length, page: 1, totalPages: 1 } },
|
|
43
43
|
};
|
|
44
|
-
handleResponseFormatOptions(opts, formattedRes);
|
|
44
|
+
const _formatted = handleResponseFormatOptions(opts, formattedRes, { noPrint: true });
|
|
45
45
|
spinner.success({ text: `Found ${actions.length} AI actions` });
|
|
46
46
|
spinner.stop();
|
|
47
|
+
printFormattedResponse(opts, _formatted);
|
|
47
48
|
}
|
|
48
49
|
catch (e) {
|
|
49
50
|
cliError(e.message || "Failed to fetch AI actions", EXIT_GENERAL_ERROR);
|
|
@@ -129,9 +130,11 @@ export function createAiCommand(program) {
|
|
|
129
130
|
verbosity: opts.verbosity,
|
|
130
131
|
hideMeta: opts.hideMeta,
|
|
131
132
|
});
|
|
132
|
-
const
|
|
133
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
134
|
+
const { plainResult, result, content } = _formatted2;
|
|
133
135
|
spinner.success({ text: "AI response received" });
|
|
134
136
|
spinner.stop();
|
|
137
|
+
printFormattedResponse(opts, _formatted2);
|
|
135
138
|
if (opts.save)
|
|
136
139
|
await saveFile("ai-ask", opts, res);
|
|
137
140
|
}
|
|
@@ -176,9 +179,10 @@ Examples:
|
|
|
176
179
|
},
|
|
177
180
|
});
|
|
178
181
|
const res = response.data;
|
|
179
|
-
handleResponseFormatOptions(opts, res);
|
|
182
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
180
183
|
spinner.success({ text: `${type} generation complete` });
|
|
181
184
|
spinner.stop();
|
|
185
|
+
printFormattedResponse(opts, _formatted3);
|
|
182
186
|
if (opts.save)
|
|
183
187
|
await saveFile(`ai-generate-${type}`, opts, res);
|
|
184
188
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { getModuleFromCollection } from "../models/getModuleFromCollection.js";
|
|
3
3
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
import { handleDeleteSingleOperation } from "../operations/handleDeleteSingleOperation.js";
|
|
6
6
|
import { saveFile } from "../helpers/saveFile.js";
|
|
7
7
|
import { spinner } from "../../index.js";
|
|
@@ -62,9 +62,10 @@ Examples:
|
|
|
62
62
|
payload: results,
|
|
63
63
|
meta: { pageInfo: { totalEntries: results.length, page: 1, totalPages: 1 } },
|
|
64
64
|
};
|
|
65
|
-
handleResponseFormatOptions(opts, res);
|
|
65
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
66
66
|
spinner.success({ text: `Fetched ${results.length}/${idList.length} entries` });
|
|
67
67
|
spinner.stop();
|
|
68
|
+
printFormattedResponse(opts, _formatted);
|
|
68
69
|
if (opts.save)
|
|
69
70
|
await saveFile("batch-get", opts, res);
|
|
70
71
|
}
|
|
@@ -276,9 +277,10 @@ Examples:
|
|
|
276
277
|
payload: created,
|
|
277
278
|
meta: { pageInfo: { totalEntries: created.length, page: 1, totalPages: 1 } },
|
|
278
279
|
};
|
|
279
|
-
handleResponseFormatOptions(opts, res);
|
|
280
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
280
281
|
spinner.success({ text: `Created ${successCount}/${entries.length} entries in ${collection}` });
|
|
281
282
|
spinner.stop();
|
|
283
|
+
printFormattedResponse(opts, _formatted2);
|
|
282
284
|
if (opts.save)
|
|
283
285
|
await saveFile("batch-create", opts, res);
|
|
284
286
|
if (errorCount > 0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getModuleFromCollection } from "../models/getModuleFromCollection.js";
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
3
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
4
4
|
import { saveFile } from "../helpers/saveFile.js";
|
|
5
5
|
import { spinner } from "../../index.js";
|
|
6
6
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
@@ -90,9 +90,10 @@ Examples:
|
|
|
90
90
|
};
|
|
91
91
|
// Force response format to match export format
|
|
92
92
|
opts.responseFormat = opts.format;
|
|
93
|
-
handleResponseFormatOptions(opts, fullRes);
|
|
93
|
+
const _formatted = handleResponseFormatOptions(opts, fullRes, { noPrint: true });
|
|
94
94
|
spinner.success({ text: `Exported ${allPayload.length} entries from ${collection}` });
|
|
95
95
|
spinner.stop();
|
|
96
|
+
printFormattedResponse(opts, _formatted);
|
|
96
97
|
if (opts.save)
|
|
97
98
|
await saveFile(`export-${collection}`, opts, fullRes);
|
|
98
99
|
}
|
|
@@ -152,9 +153,10 @@ Examples:
|
|
|
152
153
|
responseFormat: opts.responseFormat,
|
|
153
154
|
verbosity: opts.verbosity,
|
|
154
155
|
});
|
|
155
|
-
handleResponseFormatOptions(opts, res);
|
|
156
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
156
157
|
spinner.success({ text: `Export ${id} loaded` });
|
|
157
158
|
spinner.stop();
|
|
159
|
+
printFormattedResponse(opts, _formatted2);
|
|
158
160
|
}
|
|
159
161
|
catch (e) {
|
|
160
162
|
cliError(e.message || "Failed to get export", EXIT_GENERAL_ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
@@ -133,9 +133,10 @@ Examples:
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
const res = await apiCallHandler("automation", `automations/${automationId}/execute`, "post", body, { responseFormat: opts.responseFormat });
|
|
136
|
-
handleResponseFormatOptions(opts, res);
|
|
136
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
137
137
|
spinner.success({ text: `Automation ${automationId} executed` });
|
|
138
138
|
spinner.stop();
|
|
139
|
+
printFormattedResponse(opts, _formatted);
|
|
139
140
|
}
|
|
140
141
|
catch (e) {
|
|
141
142
|
cliError(e.message || "Failed to execute automation", EXIT_GENERAL_ERROR);
|
|
@@ -12,7 +12,7 @@ import { handleDeleteSingleOperation } from "../operations/handleDeleteSingleOpe
|
|
|
12
12
|
import { aYOUneModules } from "../../data/modules.js";
|
|
13
13
|
import { getModelsInModules } from "../models/getModelsInModules.js";
|
|
14
14
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
15
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
15
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
16
16
|
import { isSuperUser } from "../helpers/tokenPayload.js";
|
|
17
17
|
import { spinner } from "../../index.js";
|
|
18
18
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
@@ -104,9 +104,10 @@ Examples:
|
|
|
104
104
|
responseFormat: opts.responseFormat,
|
|
105
105
|
verbosity: opts.verbosity,
|
|
106
106
|
});
|
|
107
|
-
handleResponseFormatOptions(opts, res);
|
|
107
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
108
108
|
spinner.success({ text: `Got ${collection} [${subjectArg}]` });
|
|
109
109
|
spinner.stop();
|
|
110
|
+
printFormattedResponse(opts, _formatted);
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
113
|
if (op === "create") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
@@ -141,9 +141,10 @@ Examples:
|
|
|
141
141
|
const res = await apiCallHandler("devops", `alerts/${id}/acknowledge`, "put", null, {
|
|
142
142
|
responseFormat: opts.responseFormat,
|
|
143
143
|
});
|
|
144
|
-
handleResponseFormatOptions(opts, res);
|
|
144
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
145
145
|
spinner.success({ text: `Alert ${id} acknowledged` });
|
|
146
146
|
spinner.stop();
|
|
147
|
+
printFormattedResponse(opts, _formatted);
|
|
147
148
|
}
|
|
148
149
|
catch (e) {
|
|
149
150
|
cliError(e.message || "Failed to acknowledge alert", EXIT_GENERAL_ERROR);
|
|
@@ -160,9 +161,10 @@ Examples:
|
|
|
160
161
|
const res = await apiCallHandler("devops", `alerts/${id}/resolve`, "put", null, {
|
|
161
162
|
responseFormat: opts.responseFormat,
|
|
162
163
|
});
|
|
163
|
-
handleResponseFormatOptions(opts, res);
|
|
164
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
164
165
|
spinner.success({ text: `Alert ${id} resolved` });
|
|
165
166
|
spinner.stop();
|
|
167
|
+
printFormattedResponse(opts, _formatted2);
|
|
166
168
|
}
|
|
167
169
|
catch (e) {
|
|
168
170
|
cliError(e.message || "Failed to resolve alert", EXIT_GENERAL_ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
@@ -57,9 +57,10 @@ export function createPermissionsCommand(program) {
|
|
|
57
57
|
const opts = { ...program.opts(), ...options };
|
|
58
58
|
spinner.start({ text: `Approving request ${id}...`, color: "magenta" });
|
|
59
59
|
const res = await apiCallHandler("config", "permissionrequests", "put", { _id: id, status: "approved" }, { responseFormat: opts.responseFormat });
|
|
60
|
-
handleResponseFormatOptions(opts, res);
|
|
60
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
61
61
|
spinner.success({ text: `Permission request ${id} approved` });
|
|
62
62
|
spinner.stop();
|
|
63
|
+
printFormattedResponse(opts, _formatted);
|
|
63
64
|
}
|
|
64
65
|
catch (e) {
|
|
65
66
|
cliError(e.message || "Failed to approve request", EXIT_GENERAL_ERROR);
|
|
@@ -78,9 +79,10 @@ export function createPermissionsCommand(program) {
|
|
|
78
79
|
if (opts.reason)
|
|
79
80
|
body.reason = opts.reason;
|
|
80
81
|
const res = await apiCallHandler("config", "permissionrequests", "put", body, { responseFormat: opts.responseFormat });
|
|
81
|
-
handleResponseFormatOptions(opts, res);
|
|
82
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
82
83
|
spinner.success({ text: `Permission request ${id} rejected` });
|
|
83
84
|
spinner.stop();
|
|
85
|
+
printFormattedResponse(opts, _formatted2);
|
|
84
86
|
}
|
|
85
87
|
catch (e) {
|
|
86
88
|
cliError(e.message || "Failed to reject request", EXIT_GENERAL_ERROR);
|
|
@@ -117,9 +119,10 @@ export function createPermissionsCommand(program) {
|
|
|
117
119
|
const res = await apiCallHandler("config", "permissionrequests", "post", body, {
|
|
118
120
|
responseFormat: opts.responseFormat,
|
|
119
121
|
});
|
|
120
|
-
handleResponseFormatOptions(opts, res);
|
|
122
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
121
123
|
spinner.success({ text: "Permission request created" });
|
|
122
124
|
spinner.stop();
|
|
125
|
+
printFormattedResponse(opts, _formatted3);
|
|
123
126
|
}
|
|
124
127
|
catch (e) {
|
|
125
128
|
cliError(e.message || "Failed to create permission request", EXIT_GENERAL_ERROR);
|
|
@@ -174,9 +177,10 @@ export function createPermissionsCommand(program) {
|
|
|
174
177
|
responseFormat: opts.responseFormat,
|
|
175
178
|
verbosity: opts.verbosity,
|
|
176
179
|
});
|
|
177
|
-
handleResponseFormatOptions(opts, res);
|
|
180
|
+
const _formatted4 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
178
181
|
spinner.success({ text: `Right ${id} loaded` });
|
|
179
182
|
spinner.stop();
|
|
183
|
+
printFormattedResponse(opts, _formatted4);
|
|
180
184
|
}
|
|
181
185
|
catch (e) {
|
|
182
186
|
cliError(e.message || "Failed to get user right", EXIT_GENERAL_ERROR);
|
|
@@ -214,6 +214,7 @@ function installPreActionHook(program) {
|
|
|
214
214
|
*/
|
|
215
215
|
function installGlobalOptions(program) {
|
|
216
216
|
program
|
|
217
|
+
.name("ay")
|
|
217
218
|
.version(pkg.version || "0.0.0")
|
|
218
219
|
.addOption(new Option("-r, --responseFormat <format>", "Set the output format")
|
|
219
220
|
.choices(["json", "csv", "yaml", "table"])
|
|
@@ -292,6 +293,16 @@ export async function createProgram(program) {
|
|
|
292
293
|
// Lightweight stubs for every command so the help listing is complete and
|
|
293
294
|
// commander can suggest similar names for typos.
|
|
294
295
|
registerStubsForHelp(program);
|
|
296
|
+
// Bare `ay` (no args) should print help and exit cleanly. Commander's
|
|
297
|
+
// default behaviour is to print help then exit with code 1, treating
|
|
298
|
+
// "no command" as a usage error. For an end-user CLI that's hostile —
|
|
299
|
+
// a user typing `ay` to discover the tool gets a non-zero exit, which
|
|
300
|
+
// breaks shell scripts that gate on `ay && ...`. Force exit 0 here for
|
|
301
|
+
// the bare invocation.
|
|
302
|
+
if (process.argv.length <= 2) {
|
|
303
|
+
program.outputHelp();
|
|
304
|
+
process.exit(0);
|
|
305
|
+
}
|
|
295
306
|
}
|
|
296
307
|
else if (kind === "cmdHelp" || kind === "command") {
|
|
297
308
|
if (spec) {
|
|
@@ -2,7 +2,7 @@ import { resolveCollectionArgs } from "../helpers/resolveCollectionArgs.js";
|
|
|
2
2
|
import { getModuleFromCollection } from "../models/getModuleFromCollection.js";
|
|
3
3
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
4
4
|
import { searchModel, searchOne, searchGlobal } from "../api/searchClient.js";
|
|
5
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
5
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
6
6
|
import { saveFile } from "../helpers/saveFile.js";
|
|
7
7
|
import { localStorage } from "../helpers/localStorage.js";
|
|
8
8
|
import { spinner } from "../../index.js";
|
|
@@ -107,11 +107,12 @@ async function handleGlobalSearch(opts) {
|
|
|
107
107
|
console.log(totalEntries);
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
handleResponseFormatOptions(opts, res);
|
|
110
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
111
111
|
spinner.success({
|
|
112
112
|
text: `Found ${totalEntries} entries across ${results.length} collections`,
|
|
113
113
|
});
|
|
114
114
|
spinner.stop();
|
|
115
|
+
printFormattedResponse(opts, _formatted);
|
|
115
116
|
if (opts.save)
|
|
116
117
|
await saveFile("search-global", opts, res);
|
|
117
118
|
}
|
|
@@ -171,11 +172,12 @@ async function handleFindOneSearch(resolved, searchQuery, opts) {
|
|
|
171
172
|
Object.assign(params, contextParams);
|
|
172
173
|
applyFilters(params, opts.filter);
|
|
173
174
|
const res = await searchOne(collection, params);
|
|
174
|
-
handleResponseFormatOptions(opts, res);
|
|
175
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
175
176
|
spinner.success({
|
|
176
177
|
text: `Found match in ${collection}`,
|
|
177
178
|
});
|
|
178
179
|
spinner.stop();
|
|
180
|
+
printFormattedResponse(opts, _formatted2);
|
|
179
181
|
localStorage.setItem("lastModule", resolved.module);
|
|
180
182
|
localStorage.setItem("lastCollection", resolved.collection);
|
|
181
183
|
if (opts.save)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
@@ -56,9 +56,10 @@ export function createServicesCommand(program) {
|
|
|
56
56
|
payload: services,
|
|
57
57
|
meta: { responseTime: 0, pageInfo: { totalEntries: services.length, page: 1, totalPages: 1 } },
|
|
58
58
|
};
|
|
59
|
-
handleResponseFormatOptions(opts, res);
|
|
59
|
+
const formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
60
60
|
spinner.success({ text: `Found ${services.length} services` });
|
|
61
61
|
spinner.stop();
|
|
62
|
+
printFormattedResponse(opts, formatted);
|
|
62
63
|
if (opts.save)
|
|
63
64
|
await saveFile("services-list", opts, res);
|
|
64
65
|
}
|
|
@@ -104,9 +105,10 @@ Examples:
|
|
|
104
105
|
payload: endpoints,
|
|
105
106
|
meta: { responseTime: 0, pageInfo: { totalEntries: endpoints.length, page: 1, totalPages: 1 } },
|
|
106
107
|
};
|
|
107
|
-
handleResponseFormatOptions(opts, formattedRes);
|
|
108
|
+
const formatted = handleResponseFormatOptions(opts, formattedRes, { noPrint: true });
|
|
108
109
|
spinner.success({ text: `Found ${endpoints.length} endpoints on ${host}` });
|
|
109
110
|
spinner.stop();
|
|
111
|
+
printFormattedResponse(opts, formatted);
|
|
110
112
|
if (opts.save)
|
|
111
113
|
await saveFile("service-endpoints", opts, formattedRes);
|
|
112
114
|
}
|
|
@@ -168,9 +170,10 @@ Examples:
|
|
|
168
170
|
pageInfo: { totalEntries: payload.length, page: 1, totalPages: 1 },
|
|
169
171
|
},
|
|
170
172
|
};
|
|
171
|
-
handleResponseFormatOptions(opts, res);
|
|
173
|
+
const formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
172
174
|
spinner.success({ text: `${healthy}/${uniqueTargets.length} services healthy` });
|
|
173
175
|
spinner.stop();
|
|
176
|
+
printFormattedResponse(opts, formatted);
|
|
174
177
|
if (opts.save)
|
|
175
178
|
await saveFile("services-health", opts, res);
|
|
176
179
|
}
|
|
@@ -216,9 +219,10 @@ Examples:
|
|
|
216
219
|
payload: description,
|
|
217
220
|
meta: { responseTime: 0 },
|
|
218
221
|
};
|
|
219
|
-
handleResponseFormatOptions(opts, formattedRes);
|
|
222
|
+
const formatted = handleResponseFormatOptions(opts, formattedRes, { noPrint: true });
|
|
220
223
|
spinner.success({ text: `Module: ${moduleName} — ${moduleActions.length} endpoints` });
|
|
221
224
|
spinner.stop();
|
|
225
|
+
printFormattedResponse(opts, formatted);
|
|
222
226
|
}
|
|
223
227
|
catch (e) {
|
|
224
228
|
cliError(e.message || "Failed to describe service", EXIT_GENERAL_ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
4
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
5
5
|
import { cliError } from "../helpers/cliError.js";
|
|
@@ -25,9 +25,10 @@ Examples:
|
|
|
25
25
|
if (opts.id) {
|
|
26
26
|
spinner.start({ text: `Syncing repository ${opts.id}...`, color: "magenta" });
|
|
27
27
|
const res = await apiCallHandler("devops", `repositories/${opts.id}/sync`, "post", null, { responseFormat: opts.responseFormat });
|
|
28
|
-
handleResponseFormatOptions(opts, res);
|
|
28
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
29
29
|
spinner.success({ text: `Repository ${opts.id} sync initiated` });
|
|
30
30
|
spinner.stop();
|
|
31
|
+
printFormattedResponse(opts, _formatted);
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
spinner.start({ text: "Syncing repositories...", color: "magenta" });
|
|
@@ -79,9 +80,10 @@ Examples:
|
|
|
79
80
|
if (opts.id) {
|
|
80
81
|
spinner.start({ text: `Syncing cluster ${opts.id}...`, color: "magenta" });
|
|
81
82
|
const res = await apiCallHandler("devops", `clusters/${opts.id}/sync`, "post", null, { responseFormat: opts.responseFormat });
|
|
82
|
-
handleResponseFormatOptions(opts, res);
|
|
83
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
83
84
|
spinner.success({ text: `Cluster ${opts.id} sync initiated` });
|
|
84
85
|
spinner.stop();
|
|
86
|
+
printFormattedResponse(opts, _formatted2);
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
89
|
spinner.start({ text: "Syncing all clusters...", color: "magenta" });
|
|
@@ -126,9 +128,10 @@ Examples:
|
|
|
126
128
|
if (opts.provider)
|
|
127
129
|
params.provider = opts.provider;
|
|
128
130
|
const res = await apiCallHandler("devops", "pipelines/sync", "post", null, params);
|
|
129
|
-
handleResponseFormatOptions(opts, res);
|
|
131
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
130
132
|
spinner.success({ text: "Pipeline sync initiated" });
|
|
131
133
|
spinner.stop();
|
|
134
|
+
printFormattedResponse(opts, _formatted3);
|
|
132
135
|
}
|
|
133
136
|
catch (e) {
|
|
134
137
|
cliError(e.message || "Pipeline sync failed", EXIT_GENERAL_ERROR);
|
|
@@ -164,9 +167,10 @@ Examples:
|
|
|
164
167
|
payload: status,
|
|
165
168
|
meta: { pageInfo: { totalEntries: 1, page: 1, totalPages: 1 } },
|
|
166
169
|
};
|
|
167
|
-
handleResponseFormatOptions(opts, res);
|
|
170
|
+
const _formatted4 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
168
171
|
spinner.success({ text: "Sync status retrieved" });
|
|
169
172
|
spinner.stop();
|
|
173
|
+
printFormattedResponse(opts, _formatted4);
|
|
170
174
|
}
|
|
171
175
|
catch (e) {
|
|
172
176
|
cliError(e.message || "Failed to get sync status", EXIT_GENERAL_ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR } from "../exitCodes.js";
|
|
@@ -66,9 +66,10 @@ Examples:
|
|
|
66
66
|
responseFormat: opts.responseFormat,
|
|
67
67
|
verbosity: opts.verbosity,
|
|
68
68
|
});
|
|
69
|
-
handleResponseFormatOptions(opts, res);
|
|
69
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
70
70
|
spinner.success({ text: `Email template ${id} loaded` });
|
|
71
71
|
spinner.stop();
|
|
72
|
+
printFormattedResponse(opts, _formatted);
|
|
72
73
|
}
|
|
73
74
|
catch (e) {
|
|
74
75
|
cliError(e.message || "Failed to get email template", EXIT_GENERAL_ERROR);
|
|
@@ -120,9 +121,10 @@ Examples:
|
|
|
120
121
|
responseFormat: opts.responseFormat,
|
|
121
122
|
verbosity: opts.verbosity,
|
|
122
123
|
});
|
|
123
|
-
handleResponseFormatOptions(opts, res);
|
|
124
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
124
125
|
spinner.success({ text: `Notification template ${id} loaded` });
|
|
125
126
|
spinner.stop();
|
|
127
|
+
printFormattedResponse(opts, _formatted2);
|
|
126
128
|
}
|
|
127
129
|
catch (e) {
|
|
128
130
|
cliError(e.message || "Failed to get notification template", EXIT_GENERAL_ERROR);
|
|
@@ -211,9 +213,10 @@ Examples:
|
|
|
211
213
|
responseFormat: opts.responseFormat,
|
|
212
214
|
verbosity: opts.verbosity,
|
|
213
215
|
});
|
|
214
|
-
handleResponseFormatOptions(opts, res);
|
|
216
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
215
217
|
spinner.success({ text: `Store template ${id} loaded` });
|
|
216
218
|
spinner.stop();
|
|
219
|
+
printFormattedResponse(opts, _formatted3);
|
|
217
220
|
}
|
|
218
221
|
catch (e) {
|
|
219
222
|
cliError(e.message || "Failed to get store template", EXIT_GENERAL_ERROR);
|
|
@@ -228,9 +231,10 @@ Examples:
|
|
|
228
231
|
const opts = { ...program.opts(), ...options };
|
|
229
232
|
spinner.start({ text: `Installing template ${id}...`, color: "magenta" });
|
|
230
233
|
const res = await apiCallHandler("config", `templategroups/${id}/install`, "post", null, { responseFormat: opts.responseFormat });
|
|
231
|
-
handleResponseFormatOptions(opts, res);
|
|
234
|
+
const _formatted4 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
232
235
|
spinner.success({ text: `Template ${id} installed` });
|
|
233
236
|
spinner.stop();
|
|
237
|
+
printFormattedResponse(opts, _formatted4);
|
|
234
238
|
}
|
|
235
239
|
catch (e) {
|
|
236
240
|
cliError(e.message || "Failed to install template", EXIT_GENERAL_ERROR);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
3
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
4
4
|
import { saveFile } from "../helpers/saveFile.js";
|
|
5
5
|
import { spinner } from "../../index.js";
|
|
6
6
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
@@ -71,9 +71,10 @@ Examples:
|
|
|
71
71
|
responseFormat: opts.responseFormat,
|
|
72
72
|
verbosity: opts.verbosity,
|
|
73
73
|
});
|
|
74
|
-
handleResponseFormatOptions(opts, res);
|
|
74
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
75
75
|
spinner.success({ text: `User ${id} loaded` });
|
|
76
76
|
spinner.stop();
|
|
77
|
+
printFormattedResponse(opts, _formatted);
|
|
77
78
|
}
|
|
78
79
|
catch (e) {
|
|
79
80
|
cliError(e.message || "Failed to get user", EXIT_GENERAL_ERROR);
|
|
@@ -101,9 +102,10 @@ Examples:
|
|
|
101
102
|
const res = await apiCallHandler("su", "users", "post", body, {
|
|
102
103
|
responseFormat: opts.responseFormat,
|
|
103
104
|
});
|
|
104
|
-
handleResponseFormatOptions(opts, res);
|
|
105
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
105
106
|
spinner.success({ text: `Invitation sent to ${opts.email}` });
|
|
106
107
|
spinner.stop();
|
|
108
|
+
printFormattedResponse(opts, _formatted2);
|
|
107
109
|
}
|
|
108
110
|
catch (e) {
|
|
109
111
|
cliError(e.message || "Failed to invite user", EXIT_GENERAL_ERROR);
|
|
@@ -130,9 +132,10 @@ Examples:
|
|
|
130
132
|
const res = await apiCallHandler("su", "users", "put", { _id: id, active: false }, {
|
|
131
133
|
responseFormat: opts.responseFormat,
|
|
132
134
|
});
|
|
133
|
-
handleResponseFormatOptions(opts, res);
|
|
135
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
134
136
|
spinner.success({ text: `User ${id} deactivated` });
|
|
135
137
|
spinner.stop();
|
|
138
|
+
printFormattedResponse(opts, _formatted3);
|
|
136
139
|
}
|
|
137
140
|
catch (e) {
|
|
138
141
|
cliError(e.message || "Failed to deactivate user", EXIT_GENERAL_ERROR);
|
|
@@ -187,9 +190,10 @@ Examples:
|
|
|
187
190
|
responseFormat: opts.responseFormat,
|
|
188
191
|
verbosity: opts.verbosity,
|
|
189
192
|
});
|
|
190
|
-
handleResponseFormatOptions(opts, res);
|
|
193
|
+
const _formatted4 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
191
194
|
spinner.success({ text: `Team ${id} loaded` });
|
|
192
195
|
spinner.stop();
|
|
196
|
+
printFormattedResponse(opts, _formatted4);
|
|
193
197
|
}
|
|
194
198
|
catch (e) {
|
|
195
199
|
cliError(e.message || "Failed to get team", EXIT_GENERAL_ERROR);
|
|
@@ -223,9 +227,10 @@ Examples:
|
|
|
223
227
|
const res = await apiCallHandler("su", "teams", "post", body, {
|
|
224
228
|
responseFormat: opts.responseFormat,
|
|
225
229
|
});
|
|
226
|
-
handleResponseFormatOptions(opts, res);
|
|
230
|
+
const _formatted5 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
227
231
|
spinner.success({ text: "Team created" });
|
|
228
232
|
spinner.stop();
|
|
233
|
+
printFormattedResponse(opts, _formatted5);
|
|
229
234
|
}
|
|
230
235
|
catch (e) {
|
|
231
236
|
cliError(e.message || "Failed to create team", EXIT_GENERAL_ERROR);
|
|
@@ -274,9 +279,10 @@ Examples:
|
|
|
274
279
|
responseFormat: opts.responseFormat,
|
|
275
280
|
verbosity: opts.verbosity,
|
|
276
281
|
});
|
|
277
|
-
handleResponseFormatOptions(opts, res);
|
|
282
|
+
const _formatted6 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
278
283
|
spinner.success({ text: `Role ${id} loaded` });
|
|
279
284
|
spinner.stop();
|
|
285
|
+
printFormattedResponse(opts, _formatted6);
|
|
280
286
|
}
|
|
281
287
|
catch (e) {
|
|
282
288
|
cliError(e.message || "Failed to get role", EXIT_GENERAL_ERROR);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
2
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
2
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../helpers/handleResponseFormatOptions.js";
|
|
3
3
|
import { saveFile } from "../helpers/saveFile.js";
|
|
4
4
|
import { spinner } from "../../index.js";
|
|
5
5
|
import { EXIT_GENERAL_ERROR, EXIT_MISUSE } from "../exitCodes.js";
|
|
@@ -59,9 +59,10 @@ Examples:
|
|
|
59
59
|
responseFormat: opts.responseFormat,
|
|
60
60
|
verbosity: opts.verbosity,
|
|
61
61
|
});
|
|
62
|
-
handleResponseFormatOptions(opts, res);
|
|
62
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
63
63
|
spinner.success({ text: `Webhook ${id} loaded` });
|
|
64
64
|
spinner.stop();
|
|
65
|
+
printFormattedResponse(opts, _formatted);
|
|
65
66
|
}
|
|
66
67
|
catch (e) {
|
|
67
68
|
cliError(e.message || "Failed to get webhook", EXIT_GENERAL_ERROR);
|
|
@@ -101,9 +102,10 @@ Examples:
|
|
|
101
102
|
const res = await apiCallHandler("config", "hooks", "post", body, {
|
|
102
103
|
responseFormat: opts.responseFormat,
|
|
103
104
|
});
|
|
104
|
-
handleResponseFormatOptions(opts, res);
|
|
105
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
105
106
|
spinner.success({ text: `Webhook created` });
|
|
106
107
|
spinner.stop();
|
|
108
|
+
printFormattedResponse(opts, _formatted2);
|
|
107
109
|
}
|
|
108
110
|
catch (e) {
|
|
109
111
|
cliError(e.message || "Failed to create webhook", EXIT_GENERAL_ERROR);
|
|
@@ -121,9 +123,10 @@ Examples:
|
|
|
121
123
|
const res = await apiCallHandler("config", `hooks/${id}`, "delete", null, {
|
|
122
124
|
responseFormat: opts.responseFormat,
|
|
123
125
|
});
|
|
124
|
-
handleResponseFormatOptions(opts, res);
|
|
126
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
125
127
|
spinner.success({ text: `Webhook ${id} deleted` });
|
|
126
128
|
spinner.stop();
|
|
129
|
+
printFormattedResponse(opts, _formatted3);
|
|
127
130
|
}
|
|
128
131
|
catch (e) {
|
|
129
132
|
cliError(e.message || "Failed to delete webhook", EXIT_GENERAL_ERROR);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the customer has connected; `clusters` lists them and `cluster-sync` kicks
|
|
4
4
|
// off a re-scan of resources for one cluster.
|
|
5
5
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
6
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
6
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
7
7
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -52,9 +52,10 @@ Examples:
|
|
|
52
52
|
const res = await apiCallHandler("devops", `clusters/${id}/sync`, "post", null, {
|
|
53
53
|
responseFormat: opts.responseFormat,
|
|
54
54
|
});
|
|
55
|
-
handleResponseFormatOptions(opts, res);
|
|
55
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
56
56
|
spinner.success({ text: `Cluster ${id} sync initiated` });
|
|
57
57
|
spinner.stop();
|
|
58
|
+
printFormattedResponse(opts, _formatted);
|
|
58
59
|
}
|
|
59
60
|
catch (e) {
|
|
60
61
|
cliError(e.message || "Failed to sync cluster", EXIT_GENERAL_ERROR);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// counts, active alerts, recent pipelines). Useful as a one-shot health
|
|
4
4
|
// check during incident response.
|
|
5
5
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
6
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
6
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
7
7
|
import { spinner } from "../../../index.js";
|
|
8
8
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
9
9
|
import { cliError } from "../../helpers/cliError.js";
|
|
@@ -20,9 +20,10 @@ export function addDashboardSubcommands(deploy, rootProgram) {
|
|
|
20
20
|
responseFormat: opts.responseFormat,
|
|
21
21
|
verbosity: opts.verbosity,
|
|
22
22
|
});
|
|
23
|
-
handleResponseFormatOptions(opts, res);
|
|
23
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
24
24
|
spinner.success({ text: "Dashboard loaded" });
|
|
25
25
|
spinner.stop();
|
|
26
|
+
printFormattedResponse(opts, _formatted);
|
|
26
27
|
}
|
|
27
28
|
catch (e) {
|
|
28
29
|
cliError(e.message || "Failed to load dashboard", EXIT_GENERAL_ERROR);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import chalk from "chalk";
|
|
6
6
|
import { getModuleBaseUrl } from "../../api/apiClient.js";
|
|
7
7
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
8
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
8
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
9
9
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
10
10
|
import { spinner } from "../../../index.js";
|
|
11
11
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -68,9 +68,10 @@ export function addDeploymentsSubcommands(deploy, rootProgram) {
|
|
|
68
68
|
responseFormat: opts.responseFormat,
|
|
69
69
|
verbosity: opts.verbosity,
|
|
70
70
|
});
|
|
71
|
-
handleResponseFormatOptions(opts, res);
|
|
71
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
72
72
|
spinner.success({ text: `Deployment ${id} loaded` });
|
|
73
73
|
spinner.stop();
|
|
74
|
+
printFormattedResponse(opts, _formatted);
|
|
74
75
|
}
|
|
75
76
|
catch (e) {
|
|
76
77
|
cliError(e.message || "Failed to get deployment", EXIT_GENERAL_ERROR);
|
|
@@ -163,9 +164,10 @@ Examples:
|
|
|
163
164
|
responseFormat: opts.responseFormat,
|
|
164
165
|
verbosity: opts.verbosity,
|
|
165
166
|
});
|
|
166
|
-
handleResponseFormatOptions(opts, res);
|
|
167
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
167
168
|
spinner.success({ text: `Logs loaded for deployment ${id}` });
|
|
168
169
|
spinner.stop();
|
|
170
|
+
printFormattedResponse(opts, _formatted2);
|
|
169
171
|
if (opts.save)
|
|
170
172
|
await saveFile("deploy-logs", opts, res);
|
|
171
173
|
}
|
|
@@ -189,9 +191,10 @@ Examples:
|
|
|
189
191
|
deployment,
|
|
190
192
|
replicas: parseInt(replicas, 10),
|
|
191
193
|
}, { responseFormat: opts.responseFormat });
|
|
192
|
-
handleResponseFormatOptions(opts, res);
|
|
194
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
193
195
|
spinner.success({ text: `Scaled ${deployment} to ${replicas} replicas` });
|
|
194
196
|
spinner.stop();
|
|
197
|
+
printFormattedResponse(opts, _formatted3);
|
|
195
198
|
}
|
|
196
199
|
catch (e) {
|
|
197
200
|
cliError(e.message || "Failed to scale deployment", EXIT_GENERAL_ERROR);
|
|
@@ -206,9 +209,10 @@ Examples:
|
|
|
206
209
|
const opts = { ...rootProgram.opts(), ...options };
|
|
207
210
|
spinner.start({ text: `Restarting ${deployment}...`, color: "magenta" });
|
|
208
211
|
const res = await apiCallHandler("devops", "deployments/restart", "post", { deployment }, { responseFormat: opts.responseFormat });
|
|
209
|
-
handleResponseFormatOptions(opts, res);
|
|
212
|
+
const _formatted4 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
210
213
|
spinner.success({ text: `Restart initiated for ${deployment}` });
|
|
211
214
|
spinner.stop();
|
|
215
|
+
printFormattedResponse(opts, _formatted4);
|
|
212
216
|
}
|
|
213
217
|
catch (e) {
|
|
214
218
|
cliError(e.message || "Failed to restart deployment", EXIT_GENERAL_ERROR);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// platform deploys from (see CLAUDE.md: master deploys to develop namespace
|
|
6
6
|
// which IS prod).
|
|
7
7
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
8
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
8
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
9
9
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
10
10
|
import { spinner } from "../../../index.js";
|
|
11
11
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -70,11 +70,12 @@ Examples:
|
|
|
70
70
|
const res = await apiCallHandler("devops", "pipelines/trigger", "post", body, {
|
|
71
71
|
responseFormat: opts.responseFormat,
|
|
72
72
|
});
|
|
73
|
-
handleResponseFormatOptions(opts, res);
|
|
73
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
74
74
|
spinner.success({
|
|
75
75
|
text: `Pipeline triggered for ${repo} (branch: ${opts.branch})`,
|
|
76
76
|
});
|
|
77
77
|
spinner.stop();
|
|
78
|
+
printFormattedResponse(opts, _formatted);
|
|
78
79
|
}
|
|
79
80
|
catch (e) {
|
|
80
81
|
cliError(e.message || "Failed to trigger pipeline", EXIT_GENERAL_ERROR);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// each step"). The plans tree forms its own intermediate command so the
|
|
4
4
|
// `ay deploy plans <action>` invocation surface stays grouped.
|
|
5
5
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
6
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
6
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
7
7
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -52,9 +52,10 @@ export function addPlansSubcommands(deploy, rootProgram) {
|
|
|
52
52
|
responseFormat: opts.responseFormat,
|
|
53
53
|
verbosity: opts.verbosity,
|
|
54
54
|
});
|
|
55
|
-
handleResponseFormatOptions(opts, res);
|
|
55
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
56
56
|
spinner.success({ text: `Plan ${id} loaded` });
|
|
57
57
|
spinner.stop();
|
|
58
|
+
printFormattedResponse(opts, _formatted);
|
|
58
59
|
}
|
|
59
60
|
catch (e) {
|
|
60
61
|
cliError(e.message || "Failed to get plan", EXIT_GENERAL_ERROR);
|
|
@@ -117,9 +118,10 @@ export function addPlansSubcommands(deploy, rootProgram) {
|
|
|
117
118
|
const res = await apiCallHandler("devops", `deployment-plans/${id}/execute`, "post", null, {
|
|
118
119
|
responseFormat: opts.responseFormat,
|
|
119
120
|
});
|
|
120
|
-
handleResponseFormatOptions(opts, res);
|
|
121
|
+
const _formatted2 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
121
122
|
spinner.success({ text: `Plan ${id} execution started` });
|
|
122
123
|
spinner.stop();
|
|
124
|
+
printFormattedResponse(opts, _formatted2);
|
|
123
125
|
}
|
|
124
126
|
catch (e) {
|
|
125
127
|
cliError(e.message || "Failed to execute plan", EXIT_GENERAL_ERROR);
|
|
@@ -137,9 +139,10 @@ export function addPlansSubcommands(deploy, rootProgram) {
|
|
|
137
139
|
const res = await apiCallHandler("devops", `deployment-plans/${id}`, "delete", null, {
|
|
138
140
|
responseFormat: opts.responseFormat,
|
|
139
141
|
});
|
|
140
|
-
handleResponseFormatOptions(opts, res);
|
|
142
|
+
const _formatted3 = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
141
143
|
spinner.success({ text: `Plan ${id} deleted` });
|
|
142
144
|
spinner.stop();
|
|
145
|
+
printFormattedResponse(opts, _formatted3);
|
|
143
146
|
}
|
|
144
147
|
catch (e) {
|
|
145
148
|
cliError(e.message || "Failed to delete plan", EXIT_GENERAL_ERROR);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// standard "force restart this one instance" workaround when you don't
|
|
4
4
|
// want to roll the whole deployment.
|
|
5
5
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
6
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
6
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
7
7
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -60,9 +60,10 @@ export function addPodsSubcommands(deploy, rootProgram) {
|
|
|
60
60
|
const res = await apiCallHandler("devops", `pods/${id}`, "delete", null, {
|
|
61
61
|
responseFormat: opts.responseFormat,
|
|
62
62
|
});
|
|
63
|
-
handleResponseFormatOptions(opts, res);
|
|
63
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
64
64
|
spinner.success({ text: `Pod ${id} deleted` });
|
|
65
65
|
spinner.stop();
|
|
66
|
+
printFormattedResponse(opts, _formatted);
|
|
66
67
|
}
|
|
67
68
|
catch (e) {
|
|
68
69
|
cliError(e.message || "Failed to delete pod", EXIT_GENERAL_ERROR);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the metadata for one repo from its provider (Bitbucket / GitHub) which
|
|
4
4
|
// refreshes the branch list and last-commit info that the dashboard uses.
|
|
5
5
|
import { apiCallHandler } from "../../api/apiCallHandler.js";
|
|
6
|
-
import { handleResponseFormatOptions } from "../../helpers/handleResponseFormatOptions.js";
|
|
6
|
+
import { handleResponseFormatOptions, printFormattedResponse } from "../../helpers/handleResponseFormatOptions.js";
|
|
7
7
|
import { saveFile } from "../../helpers/saveFile.js";
|
|
8
8
|
import { spinner } from "../../../index.js";
|
|
9
9
|
import { EXIT_GENERAL_ERROR } from "../../exitCodes.js";
|
|
@@ -53,9 +53,10 @@ export function addReposSubcommands(deploy, rootProgram) {
|
|
|
53
53
|
const opts = { ...rootProgram.opts(), ...options };
|
|
54
54
|
spinner.start({ text: `Syncing repository ${id}...`, color: "magenta" });
|
|
55
55
|
const res = await apiCallHandler("devops", `repositories/${id}/sync`, "post", null, { responseFormat: opts.responseFormat });
|
|
56
|
-
handleResponseFormatOptions(opts, res);
|
|
56
|
+
const _formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
57
57
|
spinner.success({ text: `Repository ${id} sync initiated` });
|
|
58
58
|
spinner.stop();
|
|
59
|
+
printFormattedResponse(opts, _formatted);
|
|
59
60
|
}
|
|
60
61
|
catch (e) {
|
|
61
62
|
cliError(e.message || "Failed to sync repository", EXIT_GENERAL_ERROR);
|
|
@@ -32,7 +32,23 @@ function filterColumns(data, columns) {
|
|
|
32
32
|
}
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Print a previously-computed formatted response to stdout. Mirrors the
|
|
37
|
+
* print branch of `handleResponseFormatOptions` exactly. Call this AFTER
|
|
38
|
+
* `spinner.success(...)` / `spinner.stop()` so the data block appears below
|
|
39
|
+
* the spinner status line, not before it.
|
|
40
|
+
*/
|
|
41
|
+
export function printFormattedResponse(opts, formatted) {
|
|
42
|
+
if (opts.quiet)
|
|
43
|
+
return;
|
|
44
|
+
if (opts.responseFormat === "table") {
|
|
45
|
+
console.table(formatted.result);
|
|
46
|
+
}
|
|
47
|
+
else if (formatted.content !== undefined) {
|
|
48
|
+
console.log(formatted.content);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function handleResponseFormatOptions(opts, res, formatOpts = {}) {
|
|
36
52
|
let plainResult;
|
|
37
53
|
let result;
|
|
38
54
|
let meta = {};
|
|
@@ -122,13 +138,9 @@ export function handleResponseFormatOptions(opts, res) {
|
|
|
122
138
|
else {
|
|
123
139
|
content = JSON.stringify(result, null, 4);
|
|
124
140
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
else if (content !== undefined) {
|
|
130
|
-
console.log(content);
|
|
131
|
-
}
|
|
141
|
+
const formatted = { plainResult, result, meta, content };
|
|
142
|
+
if (!formatOpts.noPrint) {
|
|
143
|
+
printFormattedResponse(opts, formatted);
|
|
132
144
|
}
|
|
133
|
-
return
|
|
145
|
+
return formatted;
|
|
134
146
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { spinner } from "../../index.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
3
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
4
4
|
import { localStorage } from "../helpers/localStorage.js";
|
|
5
5
|
import { auditCallHandler } from "../api/auditCallHandler.js";
|
|
6
6
|
export async function handleAuditOperation(collection, id, opts) {
|
|
@@ -12,11 +12,12 @@ export async function handleAuditOperation(collection, id, opts) {
|
|
|
12
12
|
responseFormat: opts.responseFormat,
|
|
13
13
|
verbosity: opts.verbosity,
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
const formatted = handleResponseFormatOptions({ ...opts }, res, { noPrint: true });
|
|
16
16
|
spinner.success({
|
|
17
17
|
text: `Got Audit ${id} in ${collection}`,
|
|
18
18
|
});
|
|
19
19
|
spinner.stop();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
printFormattedResponse({ ...opts }, formatted);
|
|
21
|
+
localStorage.setItem("lastId", formatted.result._id);
|
|
22
|
+
return { data: formatted.plainResult, content: formatted.content, result: formatted.result, meta: formatted.meta };
|
|
22
23
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
import { localStorage } from "../helpers/localStorage.js";
|
|
6
6
|
export async function handleCopySingleOperation(module, collection, id, opts) {
|
|
7
|
+
var _a, _b;
|
|
7
8
|
spinner.start({
|
|
8
9
|
text: `Copying entry ${id} in [${collection}]`,
|
|
9
10
|
color: "magenta",
|
|
@@ -18,13 +19,14 @@ export async function handleCopySingleOperation(module, collection, id, opts) {
|
|
|
18
19
|
spinner.stop();
|
|
19
20
|
return { data: null, content: null, result: null, meta: {} };
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
const newId = (result === null ||
|
|
22
|
+
const formatted = handleResponseFormatOptions({ ...opts }, res, { noPrint: true });
|
|
23
|
+
const newId = ((_a = formatted.result) === null || _a === void 0 ? void 0 : _a._id) || "unknown";
|
|
23
24
|
spinner.success({
|
|
24
25
|
text: `Copied entry ${id} in ${collection}: New ID [${newId}]`,
|
|
25
26
|
});
|
|
26
27
|
spinner.stop();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
printFormattedResponse({ ...opts }, formatted);
|
|
29
|
+
if ((_b = formatted.result) === null || _b === void 0 ? void 0 : _b._id)
|
|
30
|
+
localStorage.setItem("lastId", formatted.result._id);
|
|
31
|
+
return { data: formatted.plainResult, content: formatted.content, result: formatted.result, meta: formatted.meta };
|
|
30
32
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
import { localStorage } from "../helpers/localStorage.js";
|
|
6
6
|
import { getContextCreateFields } from "../helpers/contextInjector.js";
|
|
7
7
|
export async function handleCreateSingleOperation(module, collection, name, opts) {
|
|
8
|
-
var _a;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
spinner.start({
|
|
10
10
|
text: `Creating entry in [${collection}]`,
|
|
11
11
|
color: "magenta",
|
|
@@ -26,13 +26,14 @@ export async function handleCreateSingleOperation(module, collection, name, opts
|
|
|
26
26
|
spinner.stop();
|
|
27
27
|
return { data: null, content: null, result: null, meta: (_a = res === null || res === void 0 ? void 0 : res.meta) !== null && _a !== void 0 ? _a : {} };
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
const formatted = handleResponseFormatOptions({ ...opts }, res, { noPrint: true });
|
|
30
30
|
spinner.success({
|
|
31
|
-
text: `Created entry [${result === null ||
|
|
31
|
+
text: `Created entry [${(_b = formatted.result) === null || _b === void 0 ? void 0 : _b._id}] in ${collection}`,
|
|
32
32
|
});
|
|
33
33
|
spinner.stop();
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
printFormattedResponse({ ...opts }, formatted);
|
|
35
|
+
if ((_c = formatted.result) === null || _c === void 0 ? void 0 : _c._id) {
|
|
36
|
+
localStorage.setItem("lastId", formatted.result._id);
|
|
36
37
|
}
|
|
37
|
-
return { data: plainResult, content, result, meta };
|
|
38
|
+
return { data: formatted.plainResult, content: formatted.content, result: formatted.result, meta: formatted.meta };
|
|
38
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions, getApiResponseFormat } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse, getApiResponseFormat, } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
import { sanitizeFields } from "../helpers/sanitizeFields.js";
|
|
6
6
|
import { getContextFilterParams } from "../helpers/contextInjector.js";
|
|
7
7
|
export async function handleGetOperation(module, collection, opts) {
|
|
@@ -23,7 +23,10 @@ export async function handleGetOperation(module, collection, opts) {
|
|
|
23
23
|
verbosity: opts.verbosity,
|
|
24
24
|
...contextParams,
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
// Compute formatted result without printing — spinner success line should
|
|
27
|
+
// appear ABOVE the data block, not after it.
|
|
28
|
+
const formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
29
|
+
const { plainResult, result, meta, content } = formatted;
|
|
27
30
|
const totalEntries = (_b = (_a = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _a === void 0 ? void 0 : _a.totalEntries) !== null && _b !== void 0 ? _b : '?';
|
|
28
31
|
const page = (_d = (_c = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _c === void 0 ? void 0 : _c.page) !== null && _d !== void 0 ? _d : 1;
|
|
29
32
|
const totalPages = (_f = (_e = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _e === void 0 ? void 0 : _e.totalPages) !== null && _f !== void 0 ? _f : '?';
|
|
@@ -31,5 +34,6 @@ export async function handleGetOperation(module, collection, opts) {
|
|
|
31
34
|
text: `Got ${opts.limit} entries of ${totalEntries} : Page ${page} of ${totalPages}`,
|
|
32
35
|
});
|
|
33
36
|
spinner.stop();
|
|
37
|
+
printFormattedResponse(opts, formatted);
|
|
34
38
|
return { data: plainResult, content, result, meta };
|
|
35
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
export async function handleGetSingleOperation(module, collection, id, opts) {
|
|
6
6
|
spinner.start({
|
|
7
7
|
text: `Getting entry in [${collection}]`,
|
|
@@ -11,10 +11,12 @@ export async function handleGetSingleOperation(module, collection, id, opts) {
|
|
|
11
11
|
responseFormat: "table",
|
|
12
12
|
verbosity: opts.verbosity,
|
|
13
13
|
});
|
|
14
|
-
|
|
14
|
+
const formattedOpts = { ...opts, responseFormat: "table" };
|
|
15
|
+
const formatted = handleResponseFormatOptions(formattedOpts, res, { noPrint: true });
|
|
15
16
|
spinner.success({
|
|
16
17
|
text: `Got entry in ${collection}`,
|
|
17
18
|
});
|
|
18
19
|
spinner.stop();
|
|
19
|
-
|
|
20
|
+
printFormattedResponse(formattedOpts, formatted);
|
|
21
|
+
return { data: formatted.plainResult, content: formatted.content, result: formatted.result, meta: formatted.meta };
|
|
20
22
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { apiCallHandler } from "../api/apiCallHandler.js";
|
|
3
3
|
import { spinner } from "../../index.js";
|
|
4
|
-
import { handleResponseFormatOptions, getApiResponseFormat } from "../helpers/handleResponseFormatOptions.js";
|
|
4
|
+
import { handleResponseFormatOptions, printFormattedResponse, getApiResponseFormat, } from "../helpers/handleResponseFormatOptions.js";
|
|
5
5
|
import { getContextFilterParams, hasActiveContext } from "../helpers/contextInjector.js";
|
|
6
6
|
async function fetchPage(module, collection, opts) {
|
|
7
7
|
const contextParams = getContextFilterParams(collection);
|
|
@@ -47,14 +47,19 @@ export async function handleListOperation(module, collection, opts) {
|
|
|
47
47
|
payload: allPayload,
|
|
48
48
|
meta: { ...meta, pageInfo: { ...(meta.pageInfo || {}), page: 1, totalPages: 1, totalEntries: allPayload.length } },
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
// Compute formatted result without printing — we want the spinner success
|
|
51
|
+
// line to appear ABOVE the data block, not below it. handleListOperation
|
|
52
|
+
// is the canonical CRUD-display path for `ay list`.
|
|
53
|
+
const formatted = handleResponseFormatOptions(opts, syntheticRes, { noPrint: true });
|
|
51
54
|
spinner.success({ text: `Got all ${allPayload.length} entries from ${totalPages} pages` });
|
|
52
55
|
spinner.stop();
|
|
53
|
-
|
|
56
|
+
printFormattedResponse(opts, formatted);
|
|
57
|
+
return { data: formatted.plainResult, content: formatted.content, result: formatted.result, meta: syntheticRes.meta };
|
|
54
58
|
}
|
|
55
59
|
// Single page fetch
|
|
56
60
|
let res = await fetchPage(module, collection, opts);
|
|
57
|
-
|
|
61
|
+
const formatted = handleResponseFormatOptions(opts, res, { noPrint: true });
|
|
62
|
+
const { plainResult, result, meta, content } = formatted;
|
|
58
63
|
const count = Array.isArray(result) ? result.length : 0;
|
|
59
64
|
const total = (_d = (_c = meta === null || meta === void 0 ? void 0 : meta.pageInfo) === null || _c === void 0 ? void 0 : _c.totalEntries) !== null && _d !== void 0 ? _d : count;
|
|
60
65
|
spinner.success({
|
|
@@ -63,5 +68,6 @@ export async function handleListOperation(module, collection, opts) {
|
|
|
63
68
|
: `No entries found in [${collection}]`,
|
|
64
69
|
});
|
|
65
70
|
spinner.stop();
|
|
71
|
+
printFormattedResponse(opts, formatted);
|
|
66
72
|
return { data: plainResult, content, result, meta };
|
|
67
73
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Operation handling functions
|
|
2
2
|
import { spinner } from "../../index.js";
|
|
3
|
-
import { handleResponseFormatOptions } from "../helpers/handleResponseFormatOptions.js";
|
|
3
|
+
import { handleResponseFormatOptions, printFormattedResponse, } from "../helpers/handleResponseFormatOptions.js";
|
|
4
4
|
import { localStorage } from "../helpers/localStorage.js";
|
|
5
5
|
import { auditCallHandler } from "../api/auditCallHandler.js";
|
|
6
6
|
export async function handleSingleAuditOperation(collection, id, auditId, opts) {
|
|
@@ -12,16 +12,17 @@ export async function handleSingleAuditOperation(collection, id, auditId, opts)
|
|
|
12
12
|
responseFormat: opts.responseFormat,
|
|
13
13
|
verbosity: opts.verbosity,
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
const formatted = handleResponseFormatOptions({ ...opts }, res, { noPrint: true });
|
|
16
16
|
spinner.success({
|
|
17
17
|
text: `Got audit [${auditId}] for [${id}] in [${collection}]`,
|
|
18
18
|
});
|
|
19
19
|
spinner.stop();
|
|
20
|
-
|
|
20
|
+
printFormattedResponse({ ...opts }, formatted);
|
|
21
|
+
localStorage.setItem("lastId", formatted.result._id);
|
|
21
22
|
return {
|
|
22
|
-
singleData: plainResult,
|
|
23
|
-
singleContent: content,
|
|
24
|
-
singleResult: result,
|
|
25
|
-
singleMeta: meta,
|
|
23
|
+
singleData: formatted.plainResult,
|
|
24
|
+
singleContent: formatted.content,
|
|
25
|
+
singleResult: formatted.result,
|
|
26
|
+
singleMeta: formatted.meta,
|
|
26
27
|
};
|
|
27
28
|
}
|