@observeone/cli 1.1.0 → 1.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/README.md +38 -59
- package/dist/README.md +38 -59
- package/dist/commands/ai-check.d.ts.map +1 -1
- package/dist/commands/ai-check.js +35 -28
- package/dist/commands/ai-check.js.map +1 -1
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +30 -21
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +30 -225
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +3 -3
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/heartbeat.d.ts +1 -1
- package/dist/commands/heartbeat.d.ts.map +1 -1
- package/dist/commands/heartbeat.js +39 -234
- package/dist/commands/heartbeat.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.js +7 -9
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/monitor.d.ts +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +32 -235
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/resource-command.factory.d.ts +31 -0
- package/dist/commands/resource-command.factory.d.ts.map +1 -0
- package/dist/commands/resource-command.factory.js +208 -0
- package/dist/commands/resource-command.factory.js.map +1 -0
- package/dist/commands/signup.d.ts.map +1 -1
- package/dist/commands/signup.js +2 -1
- package/dist/commands/signup.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/api-client.interface.d.ts +6 -6
- package/dist/interfaces/api-client.interface.d.ts.map +1 -1
- package/dist/interfaces/config.interface.d.ts +5 -10
- package/dist/interfaces/config.interface.d.ts.map +1 -1
- package/dist/interfaces/output.interface.d.ts +20 -3
- package/dist/interfaces/output.interface.d.ts.map +1 -1
- package/dist/interfaces/sse-client.interface.d.ts +3 -3
- package/dist/interfaces/sse-client.interface.d.ts.map +1 -1
- package/dist/package.json +1 -1
- package/dist/services/api-client.service.d.ts +4 -4
- package/dist/services/api-client.service.d.ts.map +1 -1
- package/dist/services/api-client.service.js +34 -21
- package/dist/services/api-client.service.js.map +1 -1
- package/dist/services/config.service.d.ts +7 -12
- package/dist/services/config.service.d.ts.map +1 -1
- package/dist/services/config.service.js +47 -18
- package/dist/services/config.service.js.map +1 -1
- package/dist/services/output.service.d.ts +20 -3
- package/dist/services/output.service.d.ts.map +1 -1
- package/dist/services/output.service.js +11 -10
- package/dist/services/output.service.js.map +1 -1
- package/dist/services/sse-client.service.d.ts +1 -1
- package/dist/services/sse-client.service.d.ts.map +1 -1
- package/dist/services/sse-client.service.js +2 -1
- package/dist/services/sse-client.service.js.map +1 -1
- package/dist/services/update.service.d.ts +13 -0
- package/dist/services/update.service.d.ts.map +1 -0
- package/dist/services/update.service.js +57 -0
- package/dist/services/update.service.js.map +1 -0
- package/dist/types/index.d.ts +37 -35
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/deep-equal.d.ts +2 -2
- package/dist/utils/deep-equal.d.ts.map +1 -1
- package/dist/utils/deep-equal.js +6 -4
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/live-progress.d.ts +10 -1
- package/dist/utils/live-progress.d.ts.map +1 -1
- package/dist/utils/live-progress.js +5 -5
- package/dist/utils/live-progress.js.map +1 -1
- package/dist/utils/log-writer.d.ts +15 -2
- package/dist/utils/log-writer.d.ts.map +1 -1
- package/dist/utils/log-writer.js +1 -1
- package/dist/utils/log-writer.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/monitor.js
CHANGED
|
@@ -1,97 +1,29 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import inquirer from 'inquirer';
|
|
2
|
+
import { createResourceCommand } from './resource-command.factory.js';
|
|
3
3
|
/**
|
|
4
|
-
* Factory function to create monitor command
|
|
4
|
+
* Factory function to create monitor command using the generic resource factory
|
|
5
5
|
*/
|
|
6
6
|
export function createMonitorCommand(configService, apiClient, outputService) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
outputService.formatMonitorList(monitors, process.env.OBS_VERBOSE === 'true');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
outputService.error(outputService.formatError(error));
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
// GET
|
|
38
|
-
monitor
|
|
39
|
-
.command('get <id>')
|
|
40
|
-
.description('Get details of a URL monitor')
|
|
41
|
-
.option('-j, --json', 'Output in JSON format')
|
|
42
|
-
.action(async (id, options) => {
|
|
43
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
44
|
-
outputService.enableJsonMode();
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const apiKey = configService.getApiKey();
|
|
48
|
-
if (!apiKey) {
|
|
49
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
const monitorId = parseInt(id);
|
|
53
|
-
if (isNaN(monitorId)) {
|
|
54
|
-
outputService.error('Invalid monitor ID.');
|
|
55
|
-
process.exit(1);
|
|
56
|
-
}
|
|
57
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
58
|
-
outputService.enableJsonMode();
|
|
59
|
-
}
|
|
60
|
-
outputService.progress(`Fetching monitor ${monitorId}...`);
|
|
61
|
-
const monitorData = await apiClient.getUrlMonitor(monitorId);
|
|
62
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
63
|
-
outputService.formatJsonOutput(monitorData);
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
outputService.formatMonitorList([monitorData], true);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
outputService.error(outputService.formatError(error));
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
// CREATE
|
|
75
|
-
monitor
|
|
76
|
-
.command('create')
|
|
77
|
-
.description('Create a new URL monitor')
|
|
78
|
-
.option('-n, --name <name>', 'Monitor name')
|
|
79
|
-
.option('-u, --url <url>', 'URL to monitor')
|
|
80
|
-
.option('-i, --interval <cron>', "Cron expression for interval (e.g. '*/5 * * * *')")
|
|
81
|
-
.option('--no-alerts', 'Disable alerts on failure')
|
|
82
|
-
.option('-j, --json', 'Output in JSON format')
|
|
83
|
-
.action(async (options) => {
|
|
84
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
85
|
-
outputService.enableJsonMode();
|
|
86
|
-
}
|
|
87
|
-
try {
|
|
88
|
-
const apiKey = configService.getApiKey();
|
|
89
|
-
if (!apiKey) {
|
|
90
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
let { name, url, interval, alerts } = options;
|
|
94
|
-
// Interactive prompts if missing critical fields
|
|
7
|
+
return createResourceCommand(configService, apiClient, outputService, {
|
|
8
|
+
resourceName: 'monitor',
|
|
9
|
+
pluralName: 'URL monitors',
|
|
10
|
+
description: 'Manage URL monitors',
|
|
11
|
+
apiMethods: {
|
|
12
|
+
list: () => apiClient.getUrlMonitors(),
|
|
13
|
+
get: (id) => apiClient.getUrlMonitor(id),
|
|
14
|
+
create: (data) => apiClient.createUrlMonitor(data),
|
|
15
|
+
update: (id, data) => apiClient.updateUrlMonitor(id, data),
|
|
16
|
+
delete: (id) => apiClient.deleteUrlMonitor(id),
|
|
17
|
+
toggle: (id) => apiClient.toggleUrlMonitor(id),
|
|
18
|
+
},
|
|
19
|
+
formatters: {
|
|
20
|
+
list: (items, verbose) => outputService.formatMonitorList(items, verbose),
|
|
21
|
+
},
|
|
22
|
+
createPrompts: async (options) => {
|
|
23
|
+
let name = options.name;
|
|
24
|
+
let url = options.url;
|
|
25
|
+
let interval = options.interval;
|
|
26
|
+
const alerts = options.alerts;
|
|
95
27
|
if (!name || !url) {
|
|
96
28
|
const answers = await inquirer.prompt([
|
|
97
29
|
{
|
|
@@ -128,165 +60,30 @@ export function createMonitorCommand(configService, apiClient, outputService) {
|
|
|
128
60
|
url = url || answers.url;
|
|
129
61
|
interval = interval || answers.interval;
|
|
130
62
|
}
|
|
131
|
-
|
|
132
|
-
const newMonitor = await apiClient.createUrlMonitor({
|
|
63
|
+
return {
|
|
133
64
|
name,
|
|
134
65
|
url,
|
|
135
66
|
cron_expression: interval || '*/5 * * * *',
|
|
136
67
|
alert_on_failure: alerts !== false,
|
|
137
68
|
timeout_ms: 30000,
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
outputService.error(outputService.formatError(error));
|
|
148
|
-
process.exit(1);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
// DELETE
|
|
152
|
-
monitor
|
|
153
|
-
.command('delete <id>')
|
|
154
|
-
.description('Delete a URL monitor')
|
|
155
|
-
.option('-y, --yes', 'Skip confirmation prompt')
|
|
156
|
-
.option('-j, --json', 'Output in JSON format')
|
|
157
|
-
.action(async (id, options) => {
|
|
158
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
159
|
-
outputService.enableJsonMode();
|
|
160
|
-
}
|
|
161
|
-
try {
|
|
162
|
-
const apiKey = configService.getApiKey();
|
|
163
|
-
if (!apiKey) {
|
|
164
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
165
|
-
process.exit(1);
|
|
166
|
-
}
|
|
167
|
-
const monitorId = parseInt(id);
|
|
168
|
-
if (isNaN(monitorId)) {
|
|
169
|
-
outputService.error('Invalid monitor ID.');
|
|
170
|
-
process.exit(1);
|
|
171
|
-
}
|
|
172
|
-
if (!options.yes) {
|
|
173
|
-
const { confirm } = await inquirer.prompt([
|
|
174
|
-
{
|
|
175
|
-
type: 'confirm',
|
|
176
|
-
name: 'confirm',
|
|
177
|
-
message: `Are you sure you want to delete monitor ${monitorId}?`,
|
|
178
|
-
default: false,
|
|
179
|
-
},
|
|
180
|
-
]);
|
|
181
|
-
if (!confirm) {
|
|
182
|
-
outputService.info('Deletion cancelled.');
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
outputService.progress(`Deleting monitor ${monitorId}...`);
|
|
187
|
-
await apiClient.deleteUrlMonitor(monitorId);
|
|
188
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
189
|
-
outputService.formatJsonOutput({ success: true, id: monitorId });
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
outputService.success(`Monitor ${monitorId} deleted successfully.`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
outputService.error(outputService.formatError(error));
|
|
197
|
-
process.exit(1);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
// UPDATE
|
|
201
|
-
monitor
|
|
202
|
-
.command('update <id>')
|
|
203
|
-
.description('Update a URL monitor')
|
|
204
|
-
.option('-n, --name <name>', 'New monitor name')
|
|
205
|
-
.option('-u, --url <url>', 'New URL')
|
|
206
|
-
.option('-i, --interval <cron>', 'New cron interval')
|
|
207
|
-
.option('-j, --json', 'Output in JSON format')
|
|
208
|
-
.action(async (id, options) => {
|
|
209
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
210
|
-
outputService.enableJsonMode();
|
|
211
|
-
}
|
|
212
|
-
try {
|
|
213
|
-
const apiKey = configService.getApiKey();
|
|
214
|
-
if (!apiKey) {
|
|
215
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
216
|
-
process.exit(1);
|
|
217
|
-
}
|
|
218
|
-
const monitorId = parseInt(id);
|
|
219
|
-
if (isNaN(monitorId)) {
|
|
220
|
-
outputService.error('Invalid monitor ID.');
|
|
221
|
-
process.exit(1);
|
|
222
|
-
}
|
|
223
|
-
const { name, url, interval } = options;
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
updatePrompts: async (id, options, existing) => {
|
|
72
|
+
const name = options.name;
|
|
73
|
+
const url = options.url;
|
|
74
|
+
const interval = options.interval;
|
|
224
75
|
if (!name && !url && !interval) {
|
|
225
76
|
outputService.error('Please provide at least one field to update (--name, --url, or --interval).');
|
|
226
77
|
process.exit(1);
|
|
227
78
|
}
|
|
228
|
-
|
|
229
|
-
const existing = await apiClient.getUrlMonitor(monitorId);
|
|
230
|
-
const payload = {
|
|
79
|
+
return {
|
|
231
80
|
name: name || existing.name,
|
|
232
81
|
url: url || existing.url,
|
|
233
82
|
timeout_ms: existing.timeout_ms || 30000,
|
|
234
|
-
cron_expression: interval || existing.
|
|
83
|
+
cron_expression: (interval || existing.cron_expression),
|
|
235
84
|
alert_on_failure: existing.alert_on_failure ?? true,
|
|
236
85
|
};
|
|
237
|
-
|
|
238
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
239
|
-
outputService.formatJsonOutput(updatedMonitor);
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
outputService.success(`Monitor ${monitorId} updated successfully.`);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
catch (error) {
|
|
246
|
-
outputService.error(outputService.formatError(error));
|
|
247
|
-
process.exit(1);
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
// TOGGLE
|
|
251
|
-
monitor
|
|
252
|
-
.command('toggle <id>')
|
|
253
|
-
.description('Pause or resume a URL monitor')
|
|
254
|
-
.option('-j, --json', 'Output in JSON format')
|
|
255
|
-
.action(async (id, options) => {
|
|
256
|
-
if (process.env.OBS_JSON_OUTPUT === 'true' || options.json) {
|
|
257
|
-
outputService.enableJsonMode();
|
|
258
|
-
}
|
|
259
|
-
try {
|
|
260
|
-
const apiKey = configService.getApiKey();
|
|
261
|
-
if (!apiKey) {
|
|
262
|
-
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
263
|
-
process.exit(1);
|
|
264
|
-
}
|
|
265
|
-
const monitorId = parseInt(id);
|
|
266
|
-
if (isNaN(monitorId)) {
|
|
267
|
-
outputService.error('Invalid monitor ID.');
|
|
268
|
-
process.exit(1);
|
|
269
|
-
}
|
|
270
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
271
|
-
outputService.enableJsonMode();
|
|
272
|
-
}
|
|
273
|
-
outputService.progress(`Toggling monitor ${monitorId}...`);
|
|
274
|
-
const isActive = await apiClient.toggleUrlMonitor(monitorId);
|
|
275
|
-
if (process.env.OBS_JSON_OUTPUT === 'true') {
|
|
276
|
-
outputService.formatJsonOutput({
|
|
277
|
-
id: monitorId,
|
|
278
|
-
is_active: isActive,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
outputService.success(`Monitor ${monitorId} is now ${isActive ? 'ACTIVE' : 'PAUSED'}.`);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
catch (error) {
|
|
286
|
-
outputService.error(outputService.formatError(error));
|
|
287
|
-
process.exit(1);
|
|
288
|
-
}
|
|
86
|
+
},
|
|
289
87
|
});
|
|
290
|
-
return monitor;
|
|
291
88
|
}
|
|
292
89
|
//# sourceMappingURL=monitor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/commands/monitor.ts"],"names":[],"mappings":"
|
|
1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BAClC,UAAU,EAAE,KAAK;aAClB,CAAC;QACJ,CAAC;QACD,aAAa,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;YAC7C,MAAM,IAAI,GAAG,OAAO,CAAC,IAA0B,CAAC;YAChD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAyB,CAAC;YAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAA8B,CAAC;YAExD,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC/B,aAAa,CAAC,KAAK,CACjB,6EAA6E,CAC9E,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,IAAI,IAAI,QAAQ,CAAC,IAAI;gBAC3B,GAAG,EAAE,GAAG,IAAI,QAAQ,CAAC,GAAG;gBACxB,UAAU,EAAE,QAAQ,CAAC,UAAU,IAAI,KAAK;gBACxC,eAAe,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,eAAe,CAAuB;gBAC7E,gBAAgB,EAAE,QAAQ,CAAC,gBAAgB,IAAI,IAAI;aACpD,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { IConfigService } from '../interfaces/config.interface.js';
|
|
3
|
+
import { IApiClient } from '../interfaces/api-client.interface.js';
|
|
4
|
+
import { IOutputService } from '../interfaces/output.interface.js';
|
|
5
|
+
export interface ResourceFactoryOptions<T> {
|
|
6
|
+
resourceName: string;
|
|
7
|
+
pluralName: string;
|
|
8
|
+
description: string;
|
|
9
|
+
apiMethods: {
|
|
10
|
+
list: () => Promise<T[]>;
|
|
11
|
+
get: (id: number) => Promise<T>;
|
|
12
|
+
create: (data: Partial<T>) => Promise<T>;
|
|
13
|
+
update: (id: number, data: Partial<T>) => Promise<T>;
|
|
14
|
+
delete: (id: number) => Promise<void>;
|
|
15
|
+
toggle?: (id: number) => Promise<boolean>;
|
|
16
|
+
};
|
|
17
|
+
formatters: {
|
|
18
|
+
list: (items: T[], verbose: boolean) => void;
|
|
19
|
+
};
|
|
20
|
+
createPrompts?: (options: Record<string, unknown>) => Promise<Partial<T>>;
|
|
21
|
+
updatePrompts?: (id: number, options: Record<string, unknown>, existing: T) => Promise<Partial<T>>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Factory to generate standardized CRUD subcommands for any resource.
|
|
25
|
+
* This ensures consistent JSON mode detection, error handling, and auth checks.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createResourceCommand<T extends {
|
|
28
|
+
id: number;
|
|
29
|
+
name: string;
|
|
30
|
+
}>(configService: IConfigService, apiClient: IApiClient, outputService: IOutputService, options: ResourceFactoryOptions<T>): Command;
|
|
31
|
+
//# sourceMappingURL=resource-command.factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-command.factory.d.ts","sourceRoot":"","sources":["../../src/commands/resource-command.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QACzB,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAC3C,CAAC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KAC9C,CAAC;IACF,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,aAAa,CAAC,EAAE,CACd,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,EAAE,CAAC,KACR,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAC1E,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,cAAc,EAC7B,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC,GACjC,OAAO,CAyNT"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
/**
|
|
4
|
+
* Factory to generate standardized CRUD subcommands for any resource.
|
|
5
|
+
* This ensures consistent JSON mode detection, error handling, and auth checks.
|
|
6
|
+
*/
|
|
7
|
+
export function createResourceCommand(configService, apiClient, outputService, options) {
|
|
8
|
+
const { resourceName, pluralName, description, apiMethods, formatters } = options;
|
|
9
|
+
const cmd = new Command(resourceName).description(description);
|
|
10
|
+
// Helper for consistent auth and JSON mode setup
|
|
11
|
+
const setupContext = (cmdOptions) => {
|
|
12
|
+
const isJson = process.env.OBS_JSON_OUTPUT === 'true' ||
|
|
13
|
+
cmdOptions.json === true ||
|
|
14
|
+
cmdOptions.format === 'json';
|
|
15
|
+
if (isJson) {
|
|
16
|
+
outputService.enableJsonMode();
|
|
17
|
+
}
|
|
18
|
+
const apiKey = configService.getApiKey();
|
|
19
|
+
if (!apiKey) {
|
|
20
|
+
outputService.error('Not authenticated. Please run "obs login" first.');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
return { isJson, apiKey };
|
|
24
|
+
};
|
|
25
|
+
// LIST
|
|
26
|
+
cmd
|
|
27
|
+
.command('list')
|
|
28
|
+
.description(`List all ${pluralName}`)
|
|
29
|
+
.option('-f, --format <format>', 'Output format (table, json)', 'table')
|
|
30
|
+
.option('-j, --json', 'Output in JSON format')
|
|
31
|
+
.action(async (cmdOptions) => {
|
|
32
|
+
setupContext(cmdOptions);
|
|
33
|
+
try {
|
|
34
|
+
outputService.progress(`Fetching ${pluralName}...`);
|
|
35
|
+
const items = await apiMethods.list();
|
|
36
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' ||
|
|
37
|
+
cmdOptions.format === 'json' ||
|
|
38
|
+
cmdOptions.json === true) {
|
|
39
|
+
outputService.formatJsonOutput(items);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
formatters.list(items, process.env.OBS_VERBOSE === 'true');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
outputService.error(outputService.formatError(error));
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
// GET
|
|
51
|
+
cmd
|
|
52
|
+
.command('get <id>')
|
|
53
|
+
.description(`Get details of a ${resourceName}`)
|
|
54
|
+
.option('-j, --json', 'Output in JSON format')
|
|
55
|
+
.action(async (id, cmdOptions) => {
|
|
56
|
+
setupContext(cmdOptions);
|
|
57
|
+
try {
|
|
58
|
+
const resourceId = parseInt(id);
|
|
59
|
+
if (isNaN(resourceId)) {
|
|
60
|
+
outputService.error(`Invalid ${resourceName} ID.`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
outputService.progress(`Fetching ${resourceName} ${resourceId}...`);
|
|
64
|
+
const item = await apiMethods.get(resourceId);
|
|
65
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' || cmdOptions.json === true) {
|
|
66
|
+
outputService.formatJsonOutput(item);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
formatters.list([item], true);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
outputService.error(outputService.formatError(error));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
// CREATE
|
|
78
|
+
const createCmd = cmd
|
|
79
|
+
.command('create')
|
|
80
|
+
.description(`Create a new ${resourceName}`)
|
|
81
|
+
.option('-j, --json', 'Output in JSON format');
|
|
82
|
+
createCmd.action(async (cmdOptions) => {
|
|
83
|
+
setupContext(cmdOptions);
|
|
84
|
+
try {
|
|
85
|
+
let payload = cmdOptions;
|
|
86
|
+
if (options.createPrompts) {
|
|
87
|
+
payload = await options.createPrompts(cmdOptions);
|
|
88
|
+
}
|
|
89
|
+
outputService.progress(`Creating ${resourceName}...`);
|
|
90
|
+
const newItem = await apiMethods.create(payload);
|
|
91
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' || cmdOptions.json === true) {
|
|
92
|
+
outputService.formatJsonOutput(newItem);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
outputService.success(`${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)} "${newItem.name}" created successfully (ID: ${newItem.id})`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
outputService.error(outputService.formatError(error));
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
// UPDATE
|
|
104
|
+
cmd
|
|
105
|
+
.command('update <id>')
|
|
106
|
+
.description(`Update a ${resourceName}`)
|
|
107
|
+
.option('-j, --json', 'Output in JSON format')
|
|
108
|
+
.action(async (id, cmdOptions) => {
|
|
109
|
+
setupContext(cmdOptions);
|
|
110
|
+
try {
|
|
111
|
+
const resourceId = parseInt(id);
|
|
112
|
+
if (isNaN(resourceId)) {
|
|
113
|
+
outputService.error(`Invalid ${resourceName} ID.`);
|
|
114
|
+
process.exit(1);
|
|
115
|
+
}
|
|
116
|
+
outputService.progress(`Updating ${resourceName} ${resourceId}...`);
|
|
117
|
+
const existing = await apiMethods.get(resourceId);
|
|
118
|
+
let payload = cmdOptions;
|
|
119
|
+
if (options.updatePrompts) {
|
|
120
|
+
payload = await options.updatePrompts(resourceId, cmdOptions, existing);
|
|
121
|
+
}
|
|
122
|
+
const updatedItem = await apiMethods.update(resourceId, payload);
|
|
123
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' || cmdOptions.json === true) {
|
|
124
|
+
outputService.formatJsonOutput(updatedItem);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
outputService.success(`${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)} ${resourceId} updated successfully.`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
outputService.error(outputService.formatError(error));
|
|
132
|
+
process.exit(1);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// DELETE
|
|
136
|
+
cmd
|
|
137
|
+
.command('delete <id>')
|
|
138
|
+
.description(`Delete a ${resourceName}`)
|
|
139
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
140
|
+
.option('-j, --json', 'Output in JSON format')
|
|
141
|
+
.action(async (id, cmdOptions) => {
|
|
142
|
+
setupContext(cmdOptions);
|
|
143
|
+
try {
|
|
144
|
+
const resourceId = parseInt(id);
|
|
145
|
+
if (isNaN(resourceId)) {
|
|
146
|
+
outputService.error(`Invalid ${resourceName} ID.`);
|
|
147
|
+
process.exit(1);
|
|
148
|
+
}
|
|
149
|
+
if (!cmdOptions.yes) {
|
|
150
|
+
const { confirm } = await inquirer.prompt([
|
|
151
|
+
{
|
|
152
|
+
type: 'confirm',
|
|
153
|
+
name: 'confirm',
|
|
154
|
+
message: `Are you sure you want to delete ${resourceName} ${resourceId}?`,
|
|
155
|
+
default: false,
|
|
156
|
+
},
|
|
157
|
+
]);
|
|
158
|
+
if (!confirm) {
|
|
159
|
+
outputService.info('Deletion cancelled.');
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
outputService.progress(`Deleting ${resourceName} ${resourceId}...`);
|
|
164
|
+
await apiMethods.delete(resourceId);
|
|
165
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' || cmdOptions.json === true) {
|
|
166
|
+
outputService.formatJsonOutput({ success: true, id: resourceId });
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
outputService.success(`${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)} ${resourceId} deleted successfully.`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
outputService.error(outputService.formatError(error));
|
|
174
|
+
process.exit(1);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
// TOGGLE (Optional)
|
|
178
|
+
if (apiMethods.toggle) {
|
|
179
|
+
cmd
|
|
180
|
+
.command('toggle <id>')
|
|
181
|
+
.description(`Pause or resume a ${resourceName}`)
|
|
182
|
+
.option('-j, --json', 'Output in JSON format')
|
|
183
|
+
.action(async (id, cmdOptions) => {
|
|
184
|
+
setupContext(cmdOptions);
|
|
185
|
+
try {
|
|
186
|
+
const resourceId = parseInt(id);
|
|
187
|
+
if (isNaN(resourceId)) {
|
|
188
|
+
outputService.error(`Invalid ${resourceName} ID.`);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
outputService.progress(`Toggling ${resourceName} ${resourceId}...`);
|
|
192
|
+
const isActive = await apiMethods.toggle(resourceId);
|
|
193
|
+
if (process.env.OBS_JSON_OUTPUT === 'true' || cmdOptions.json === true) {
|
|
194
|
+
outputService.formatJsonOutput({ id: resourceId, is_active: isActive });
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
outputService.success(`${resourceName.charAt(0).toUpperCase() + resourceName.slice(1)} ${resourceId} is now ${isActive ? 'ACTIVE' : 'PAUSED'}.`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
outputService.error(outputService.formatError(error));
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return cmd;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=resource-command.factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-command.factory.js","sourceRoot":"","sources":["../../src/commands/resource-command.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AA4BhC;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,aAA6B,EAC7B,SAAqB,EACrB,aAA6B,EAC7B,OAAkC;IAElC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAClF,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAE/D,iDAAiD;IACjD,MAAM,YAAY,GAAG,CAAC,UAAmC,EAAE,EAAE;QA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E,cAAc,GAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"signup.d.ts","sourceRoot":"","sources":["../../src/commands/signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,cAAc,GAC5B,OAAO,CAyDT"}
|
package/dist/commands/signup.js
CHANGED
|
@@ -40,7 +40,8 @@ export function createSignupCommand(configService, apiClient, outputService) {
|
|
|
40
40
|
process.exit(0);
|
|
41
41
|
}
|
|
42
42
|
catch (error) {
|
|
43
|
-
|
|
43
|
+
const err = error;
|
|
44
|
+
outputService.error(`Signup failed: ${err.message || 'Unknown error'}`);
|
|
44
45
|
process.exit(1);
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signup.js","sourceRoot":"","sources":["../../src/commands/signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;GAEG;AACH,MAAM,UAAU,mBAAmB,CACjC,aAA6B,EAC7B,SAAqB,EACrB,aAA6B;IAE7B,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,4EAA4E,CAAC;SACzF,MAAM,CAAC,iBAAiB,EAAE,+BAA+B,CAAC;SAC1D,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC;SAC3D,MAAM,CACL,YAAY,EACZ,0EAA0E,CAC3E;SACA,MAAM,CAAC,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"signup.js","sourceRoot":"","sources":["../../src/commands/signup.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BACjE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACjC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAE7B,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,KAAK,MAAM,EAAE,CAAC;oBAC3C,aAAa,CAAC,gBAAgB,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1D,CAAC;qBAAM,CAAC;oBACN,aAAa,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;gBACjF,CAAC;gBACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,MAAM,GAAG,GAAG,KAA6B,CAAC;gBAC1C,aAAa,CAAC,KAAK,CAAC,kBAAkB,GAAG,CAAC,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC;gBACxE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmCpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAqH9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|