@runflow-ai/cli 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLI-DOCS.md +428 -0
- package/README.md +127 -0
- package/dist/commands/agents/agents.command.d.ts +13 -0
- package/dist/commands/agents/agents.command.js +508 -0
- package/dist/commands/agents/agents.command.js.map +1 -0
- package/dist/commands/connectors/connectors.command.d.ts +11 -0
- package/dist/commands/connectors/connectors.command.js +72 -0
- package/dist/commands/connectors/connectors.command.js.map +1 -0
- package/dist/commands/credentials/credentials.command.d.ts +11 -0
- package/dist/commands/credentials/credentials.command.js +118 -0
- package/dist/commands/credentials/credentials.command.js.map +1 -0
- package/dist/commands/datasources/datasources.command.d.ts +11 -0
- package/dist/commands/datasources/datasources.command.js +72 -0
- package/dist/commands/datasources/datasources.command.js.map +1 -0
- package/dist/commands/executions/executions.command.d.ts +11 -0
- package/dist/commands/executions/executions.command.js +72 -0
- package/dist/commands/executions/executions.command.js.map +1 -0
- package/dist/commands/health/health.command.d.ts +11 -0
- package/dist/commands/health/health.command.js +66 -0
- package/dist/commands/health/health.command.js.map +1 -0
- package/dist/commands/login/login.command.d.ts +12 -0
- package/dist/commands/login/login.command.js +127 -0
- package/dist/commands/login/login.command.js.map +1 -0
- package/dist/commands/prompts/prompts.command.d.ts +11 -0
- package/dist/commands/prompts/prompts.command.js +102 -0
- package/dist/commands/prompts/prompts.command.js.map +1 -0
- package/dist/commands/search-tools/search-tools.command.d.ts +11 -0
- package/dist/commands/search-tools/search-tools.command.js +89 -0
- package/dist/commands/search-tools/search-tools.command.js.map +1 -0
- package/dist/commands/secret/secret.command.d.ts +4 -0
- package/dist/commands/secret/secret.command.js +22 -0
- package/dist/commands/secret/secret.command.js.map +1 -0
- package/dist/commands/sessions/sessions.command.d.ts +11 -0
- package/dist/commands/sessions/sessions.command.js +97 -0
- package/dist/commands/sessions/sessions.command.js.map +1 -0
- package/dist/commands/traces/traces.command.d.ts +11 -0
- package/dist/commands/traces/traces.command.js +73 -0
- package/dist/commands/traces/traces.command.js.map +1 -0
- package/dist/commands/triggers/triggers.command.d.ts +11 -0
- package/dist/commands/triggers/triggers.command.js +72 -0
- package/dist/commands/triggers/triggers.command.js.map +1 -0
- package/dist/commands/users/users.command.d.ts +12 -0
- package/dist/commands/users/users.command.js +138 -0
- package/dist/commands/users/users.command.js.map +1 -0
- package/dist/common/api-client.d.ts +25 -0
- package/dist/common/api-client.js +97 -0
- package/dist/common/api-client.js.map +1 -0
- package/dist/common/banner.d.ts +1 -0
- package/dist/common/banner.js +9 -0
- package/dist/common/banner.js.map +1 -0
- package/dist/common/config.d.ts +27 -0
- package/dist/common/config.js +63 -0
- package/dist/common/config.js.map +1 -0
- package/dist/common/help.d.ts +2 -0
- package/dist/common/help.js +34 -0
- package/dist/common/help.js.map +1 -0
- package/dist/common/logger.d.ts +9 -0
- package/dist/common/logger.js +84 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/ui.d.ts +7 -0
- package/dist/common/ui.js +20 -0
- package/dist/common/ui.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CredentialsCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const config_1 = require("../../common/config");
|
|
15
|
+
const ui_1 = require("../../common/ui");
|
|
16
|
+
const logger_1 = require("../../common/logger");
|
|
17
|
+
const api_client_1 = require("../../common/api-client");
|
|
18
|
+
function formatCredentialOutput(credential) {
|
|
19
|
+
(0, logger_1.log)(`\n📋 Credential Details:`);
|
|
20
|
+
(0, logger_1.log)(` Name: ${credential.name}`);
|
|
21
|
+
(0, logger_1.log)(` Type: ${credential.type}`);
|
|
22
|
+
(0, logger_1.log)(` Description: ${credential.description || 'No description'}`);
|
|
23
|
+
(0, logger_1.log)(` Last Updated: ${new Date(credential.lastUpdated).toLocaleDateString()}`);
|
|
24
|
+
if (credential._count) {
|
|
25
|
+
(0, logger_1.log)(` Used by: ${credential._count.dataSources || 0} data source(s)`);
|
|
26
|
+
}
|
|
27
|
+
if (credential.scopes && credential.scopes.length > 0) {
|
|
28
|
+
(0, logger_1.log)(` Scopes: ${credential.scopes.join(', ')}`);
|
|
29
|
+
}
|
|
30
|
+
(0, logger_1.log)('');
|
|
31
|
+
}
|
|
32
|
+
let CredentialsCommand = class CredentialsCommand extends nest_commander_1.CommandRunner {
|
|
33
|
+
async run(inputs, options) {
|
|
34
|
+
const [action, name] = inputs;
|
|
35
|
+
const actions = ['list', 'get'];
|
|
36
|
+
if (!action) {
|
|
37
|
+
(0, logger_1.log)('\nUsage: rf credentials <action> [name]\n');
|
|
38
|
+
(0, logger_1.log)('Actions:');
|
|
39
|
+
(0, logger_1.log)(' list List credentials');
|
|
40
|
+
(0, logger_1.log)(' get <name> Get specific credential\n');
|
|
41
|
+
(0, logger_1.log)('Options:');
|
|
42
|
+
(0, logger_1.log)(' --api-key <key> API key override');
|
|
43
|
+
(0, logger_1.log)(' --api <url> API URL override');
|
|
44
|
+
(0, logger_1.log)(' --help, -h Show this help\n');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!actions.includes(action)) {
|
|
48
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.INVALID_ACTION(action, actions));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const apiClient = (0, api_client_1.createApiClient)(options.api);
|
|
53
|
+
switch (action) {
|
|
54
|
+
case 'list': {
|
|
55
|
+
(0, logger_1.logVerbose)('Fetching credentials...');
|
|
56
|
+
const res = await apiClient.get('/credentials');
|
|
57
|
+
const creds = res.data.data ?? res.data;
|
|
58
|
+
const selected = await (0, ui_1.selectItem)(creds.map((c) => ({
|
|
59
|
+
id: c.name ?? c.id,
|
|
60
|
+
...c,
|
|
61
|
+
})), 'Select a credential:');
|
|
62
|
+
formatCredentialOutput(selected);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case 'get': {
|
|
66
|
+
if (!name) {
|
|
67
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.NAME_REQUIRED);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
(0, logger_1.logVerbose)(`Fetching credential ${name}...`);
|
|
71
|
+
const res = await apiClient.get(`/credentials/${name}`);
|
|
72
|
+
formatCredentialOutput(res.data);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
(0, logger_1.logError)(error.message || config_1.ERROR_MESSAGES.REQUEST_FAILED(error.toString()));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
parseApiKey(val) {
|
|
82
|
+
return val;
|
|
83
|
+
}
|
|
84
|
+
parseApi(val) {
|
|
85
|
+
return val;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
exports.CredentialsCommand = CredentialsCommand;
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, nest_commander_1.Option)({
|
|
91
|
+
flags: '--api-key <key>',
|
|
92
|
+
description: 'API key override (uses saved config if not provided)',
|
|
93
|
+
}),
|
|
94
|
+
__metadata("design:type", Function),
|
|
95
|
+
__metadata("design:paramtypes", [String]),
|
|
96
|
+
__metadata("design:returntype", String)
|
|
97
|
+
], CredentialsCommand.prototype, "parseApiKey", null);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, nest_commander_1.Option)({
|
|
100
|
+
flags: '--api <url>',
|
|
101
|
+
description: `API URL override (default: ${config_1.DEFAULT_API_URL})`,
|
|
102
|
+
}),
|
|
103
|
+
__metadata("design:type", Function),
|
|
104
|
+
__metadata("design:paramtypes", [String]),
|
|
105
|
+
__metadata("design:returntype", String)
|
|
106
|
+
], CredentialsCommand.prototype, "parseApi", null);
|
|
107
|
+
exports.CredentialsCommand = CredentialsCommand = __decorate([
|
|
108
|
+
(0, nest_commander_1.Command)({
|
|
109
|
+
name: 'credentials',
|
|
110
|
+
aliases: ['credential'],
|
|
111
|
+
arguments: '<action> [name]',
|
|
112
|
+
description: 'Manage credentials.\n' +
|
|
113
|
+
'Actions:\n' +
|
|
114
|
+
' list List credentials\n' +
|
|
115
|
+
' get <name> Get specific credential',
|
|
116
|
+
})
|
|
117
|
+
], CredentialsCommand);
|
|
118
|
+
//# sourceMappingURL=credentials.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.command.js","sourceRoot":"","sources":["../../../src/commands/credentials/credentials.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAAgE;AAChE,gDAAsE;AACtE,wCAA6C;AAC7C,gDAAyE;AACzE,wDAA0D;AAE1D,SAAS,sBAAsB,CAAC,UAAe;IAC7C,IAAA,YAAG,EAAC,0BAA0B,CAAC,CAAC;IAChC,IAAA,YAAG,EAAC,YAAY,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,IAAA,YAAG,EAAC,YAAY,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,I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AC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAA,iBAAQ,EAAC,KAAK,CAAC,OAAO,IAAI,uBAAc,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAMD,WAAW,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;IAMD,QAAQ,CAAC,GAAW;QAClB,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAzEY,gDAAkB;AA8D7B;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,sDAAsD;KACpE,CAAC;;;;qDAGD;AAMD;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,8BAA8B,wBAAe,GAAG;KAC9D,CAAC;;;;kDAGD;6BAxEU,kBAAkB;IAV9B,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,CAAC,YAAY,CAAC;QACvB,SAAS,EAAE,iBAAiB;QAC5B,WAAW,EACT,uBAAuB;YACvB,YAAY;YACZ,2CAA2C;YAC3C,gDAAgD;KACnD,CAAC;GACW,kBAAkB,CAyE9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
interface DatasourcesOptions {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class DatasourcesCommand extends CommandRunner {
|
|
7
|
+
run(inputs: string[], options: DatasourcesOptions): Promise<void>;
|
|
8
|
+
parseApiKey(val: string): string;
|
|
9
|
+
parseApi(val: string): string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DatasourcesCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const config_1 = require("../../common/config");
|
|
15
|
+
const ui_1 = require("../../common/ui");
|
|
16
|
+
const logger_1 = require("../../common/logger");
|
|
17
|
+
const api_client_1 = require("../../common/api-client");
|
|
18
|
+
let DatasourcesCommand = class DatasourcesCommand extends nest_commander_1.CommandRunner {
|
|
19
|
+
async run(inputs, options) {
|
|
20
|
+
const [action] = inputs;
|
|
21
|
+
if (action !== 'list') {
|
|
22
|
+
(0, logger_1.logError)('Action required: list');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const apiClient = (0, api_client_1.createApiClient)(options.api);
|
|
27
|
+
(0, logger_1.logVerbose)('Fetching data sources...');
|
|
28
|
+
const res = await apiClient.get('/datasources');
|
|
29
|
+
const ds = res.data.data ?? res.data;
|
|
30
|
+
const selected = await (0, ui_1.selectItem)(ds, 'Select a data source:');
|
|
31
|
+
(0, logger_1.logJson)([selected]);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
(0, logger_1.logError)(error.message || config_1.ERROR_MESSAGES.REQUEST_FAILED(error.toString()));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
parseApiKey(val) {
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
40
|
+
parseApi(val) {
|
|
41
|
+
return val;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.DatasourcesCommand = DatasourcesCommand;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, nest_commander_1.Option)({
|
|
47
|
+
flags: '--api-key <key>',
|
|
48
|
+
description: 'API key override (uses saved config if not provided)',
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Function),
|
|
51
|
+
__metadata("design:paramtypes", [String]),
|
|
52
|
+
__metadata("design:returntype", String)
|
|
53
|
+
], DatasourcesCommand.prototype, "parseApiKey", null);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, nest_commander_1.Option)({
|
|
56
|
+
flags: '--api <url>',
|
|
57
|
+
description: `API URL override (default: ${config_1.DEFAULT_API_URL})`,
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", Function),
|
|
60
|
+
__metadata("design:paramtypes", [String]),
|
|
61
|
+
__metadata("design:returntype", String)
|
|
62
|
+
], DatasourcesCommand.prototype, "parseApi", null);
|
|
63
|
+
exports.DatasourcesCommand = DatasourcesCommand = __decorate([
|
|
64
|
+
(0, nest_commander_1.Command)({
|
|
65
|
+
name: 'datasources',
|
|
66
|
+
arguments: '<action>',
|
|
67
|
+
description: 'Manage data sources.\n' +
|
|
68
|
+
'Actions:\n' +
|
|
69
|
+
' list List data sources',
|
|
70
|
+
})
|
|
71
|
+
], DatasourcesCommand);
|
|
72
|
+
//# sourceMappingURL=datasources.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasources.command.js","sourceRoot":"","sources":["../../../src/commands/datasources/datasources.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAAgE;AAChE,gDAAsE;AACtE,wCAA6C;AAC7C,gDAAyE;AACzE,wDAA0D;AAenD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,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9B,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,UAAU;QACrB,WAAW,EACT,wBAAwB;YACxB,YAAY;YACZ,0CAA0C;KAC7C,CAAC;GACW,kBAAkB,CAqC9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
interface ExecutionsOptions {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ExecutionsCommand extends CommandRunner {
|
|
7
|
+
run(inputs: string[], options: ExecutionsOptions): Promise<void>;
|
|
8
|
+
parseApiKey(val: string): string;
|
|
9
|
+
parseApi(val: string): string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ExecutionsCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const config_1 = require("../../common/config");
|
|
15
|
+
const ui_1 = require("../../common/ui");
|
|
16
|
+
const logger_1 = require("../../common/logger");
|
|
17
|
+
const api_client_1 = require("../../common/api-client");
|
|
18
|
+
let ExecutionsCommand = class ExecutionsCommand extends nest_commander_1.CommandRunner {
|
|
19
|
+
async run(inputs, options) {
|
|
20
|
+
const [action] = inputs;
|
|
21
|
+
if (action !== 'list') {
|
|
22
|
+
(0, logger_1.logError)('Action required: list');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const apiClient = (0, api_client_1.createApiClient)(options.api);
|
|
27
|
+
(0, logger_1.logVerbose)('Fetching executions...');
|
|
28
|
+
const res = await apiClient.get('/executions');
|
|
29
|
+
const execs = res.data.data ?? res.data;
|
|
30
|
+
const selected = await (0, ui_1.selectItem)(execs, 'Select an execution:');
|
|
31
|
+
(0, logger_1.logJson)([selected]);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
(0, logger_1.logError)(error.message || config_1.ERROR_MESSAGES.REQUEST_FAILED(error.toString()));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
parseApiKey(val) {
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
40
|
+
parseApi(val) {
|
|
41
|
+
return val;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.ExecutionsCommand = ExecutionsCommand;
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, nest_commander_1.Option)({
|
|
47
|
+
flags: '--api-key <key>',
|
|
48
|
+
description: 'API key override (uses saved config if not provided)',
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Function),
|
|
51
|
+
__metadata("design:paramtypes", [String]),
|
|
52
|
+
__metadata("design:returntype", String)
|
|
53
|
+
], ExecutionsCommand.prototype, "parseApiKey", null);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, nest_commander_1.Option)({
|
|
56
|
+
flags: '--api <url>',
|
|
57
|
+
description: `API URL override (default: ${config_1.DEFAULT_API_URL})`,
|
|
58
|
+
}),
|
|
59
|
+
__metadata("design:type", Function),
|
|
60
|
+
__metadata("design:paramtypes", [String]),
|
|
61
|
+
__metadata("design:returntype", String)
|
|
62
|
+
], ExecutionsCommand.prototype, "parseApi", null);
|
|
63
|
+
exports.ExecutionsCommand = ExecutionsCommand = __decorate([
|
|
64
|
+
(0, nest_commander_1.Command)({
|
|
65
|
+
name: 'executions',
|
|
66
|
+
arguments: '<action>',
|
|
67
|
+
description: 'Manage executions.\n' +
|
|
68
|
+
'Actions:\n' +
|
|
69
|
+
' list List executions',
|
|
70
|
+
})
|
|
71
|
+
], ExecutionsCommand);
|
|
72
|
+
//# sourceMappingURL=executions.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executions.command.js","sourceRoot":"","sources":["../../../src/commands/executions/executions.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mDAAgE;AAChE,gDAAsE;AACtE,wCAA6C;AAC7C,gDAAyE;AACzE,wDAA0D;AAenD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,8BAAa;IAClD,KAAK,CAAC,GAAG,CAAC,MAAgB,EAAE,OAA0B;QACpD,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;QAExB,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,IAAA,iBAAQ,EAAC,uBAAuB,CAAC,CAAC;YAClC,OAAO;QACT,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAA,4BAAe,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAE/C,IAAA,mBAAU,EAAC,wBAAwB,CAAC,CAAC;YACrC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC;YACxC,MAAM,QAAQ,GAAG,MAAM,IAAA,eAAU,EAAC,KAAK,EAAE,sBAAsB,CAAC,CAAC;YACjE,IAAA,gBAAO,EAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACtB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAA,iBAAQ,EAAC,KAAK,CAAC,OAAO,IAAI,uBAAc,CAAC,cAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAMD,WAAW,CAAC,GAAW;QACrB,OAAO,GAAG,CAAC;IACb,CAAC;IAMD,QAAQ,CAAC,GAAW;QAClB,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AArCY,8CAAiB;AA0B5B;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,sDAAsD;KACpE,CAAC;;;;oDAGD;AAMD;IAJC,IAAA,uBAAM,EAAC;QACN,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,8BAA8B,wBAAe,GAAG;KAC9D,CAAC;;;;iDAGD;4BApCU,iBAAiB;IAR7B,IAAA,wBAAO,EAAC;QACP,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE,UAAU;QACrB,WAAW,EACT,sBAAsB;YACtB,YAAY;YACZ,wCAAwC;KAC3C,CAAC;GACW,iBAAiB,CAqC7B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
interface HealthOptions {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class HealthCommand extends CommandRunner {
|
|
7
|
+
run(inputs: string[], options: HealthOptions): Promise<void>;
|
|
8
|
+
parseApiKey(val: string): string;
|
|
9
|
+
parseApi(val: string): string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.HealthCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const config_1 = require("../../common/config");
|
|
15
|
+
const logger_1 = require("../../common/logger");
|
|
16
|
+
const api_client_1 = require("../../common/api-client");
|
|
17
|
+
let HealthCommand = class HealthCommand extends nest_commander_1.CommandRunner {
|
|
18
|
+
async run(inputs, options) {
|
|
19
|
+
(0, logger_1.logDebug)(`Health command started with inputs: ${JSON.stringify(inputs)}`);
|
|
20
|
+
(0, logger_1.logDebug)(`Health command options: ${JSON.stringify(options)}`);
|
|
21
|
+
try {
|
|
22
|
+
const apiClient = (0, api_client_1.createApiClient)(options.api);
|
|
23
|
+
const path = '/sdk/health';
|
|
24
|
+
const res = await apiClient.get(path, { skipTenantHeader: true });
|
|
25
|
+
(0, logger_1.logDebug)(`Response status: ${res.status}`);
|
|
26
|
+
(0, logger_1.logDebug)(`Response data: ${JSON.stringify(res.data)}`);
|
|
27
|
+
console.log(res.data);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
(0, logger_1.logError)(error.message || config_1.ERROR_MESSAGES.REQUEST_FAILED(error.toString()));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
parseApiKey(val) {
|
|
34
|
+
return val;
|
|
35
|
+
}
|
|
36
|
+
parseApi(val) {
|
|
37
|
+
return val;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.HealthCommand = HealthCommand;
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, nest_commander_1.Option)({
|
|
43
|
+
flags: '--api-key <key>',
|
|
44
|
+
description: 'API key override (uses saved config if not provided)',
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", Function),
|
|
47
|
+
__metadata("design:paramtypes", [String]),
|
|
48
|
+
__metadata("design:returntype", String)
|
|
49
|
+
], HealthCommand.prototype, "parseApiKey", null);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, nest_commander_1.Option)({
|
|
52
|
+
flags: '--api <url>',
|
|
53
|
+
description: `API URL override (default: ${config_1.DEFAULT_API_URL})`,
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", Function),
|
|
56
|
+
__metadata("design:paramtypes", [String]),
|
|
57
|
+
__metadata("design:returntype", String)
|
|
58
|
+
], HealthCommand.prototype, "parseApi", null);
|
|
59
|
+
exports.HealthCommand = HealthCommand = __decorate([
|
|
60
|
+
(0, nest_commander_1.Command)({
|
|
61
|
+
name: 'health',
|
|
62
|
+
arguments: '[detail]',
|
|
63
|
+
description: 'Verifica saúde da API Portal',
|
|
64
|
+
})
|
|
65
|
+
], HealthCommand);
|
|
66
|
+
//# sourceMappingURL=health.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.command.js","sourceRoot":"","sources":["../../../src/commands/health/health.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgE;AAChE,gDAAsE;AACtE,gDAAyD;AACzD,wDAA0D;AAYnD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,8BAAa;IAC9C,KAAK,CAAC,GAAG,CAAC,MAAgB,EAAE,OAAsB;QAChD,IAAA,iBAAQ,EAAC,uCAAuC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAC1E,IAAA,iBAAQ,EAAC,2BAA2B,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
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
export interface LoginOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
tenantId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class LoginCommand extends CommandRunner {
|
|
8
|
+
run(inputs: string[], options: LoginOptions): Promise<void>;
|
|
9
|
+
parseApiKey(val: string): string;
|
|
10
|
+
parseApi(val: string): string;
|
|
11
|
+
parseTenantId(val: string): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LoginCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const axios_1 = require("axios");
|
|
15
|
+
const config_1 = require("../../common/config");
|
|
16
|
+
const logger_1 = require("../../common/logger");
|
|
17
|
+
const banner_1 = require("../../common/banner");
|
|
18
|
+
let LoginCommand = class LoginCommand extends nest_commander_1.CommandRunner {
|
|
19
|
+
async run(inputs, options) {
|
|
20
|
+
(0, logger_1.logDebug)(`Login command started with inputs: ${JSON.stringify(inputs)}`);
|
|
21
|
+
(0, logger_1.logDebug)(`Login command options received: ${JSON.stringify(options)}`);
|
|
22
|
+
const { apiKey, api, tenantId } = options;
|
|
23
|
+
if (!apiKey) {
|
|
24
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.API_KEY_REQUIRED);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const apiUrl = (0, config_1.getApiUrl)(null, api);
|
|
28
|
+
(0, logger_1.logDebug)(`Using API URL: ${apiUrl} (default: ${config_1.DEFAULT_API_URL})`);
|
|
29
|
+
(0, logger_1.logDebug)(`API Key: ${apiKey ? '[PRESENT]' : '[MISSING]'}, Tenant ID: ${tenantId || '[NOT PROVIDED]'}`);
|
|
30
|
+
try {
|
|
31
|
+
(0, logger_1.logDebug)(`Making auth discovery request to: ${apiUrl}/auth/discover`);
|
|
32
|
+
const response = await axios_1.default.post(`${apiUrl}/auth/discover`, {
|
|
33
|
+
apiKey: apiKey,
|
|
34
|
+
}, {
|
|
35
|
+
headers: {
|
|
36
|
+
'Content-Type': 'application/json',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const authData = response.data;
|
|
40
|
+
(0, logger_1.logDebug)(`Auth discovery response: ${JSON.stringify(authData)}`);
|
|
41
|
+
if (!authData.tenantId) {
|
|
42
|
+
(0, logger_1.logError)('Invalid API key - no tenant information returned');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!authData.isActive) {
|
|
46
|
+
(0, logger_1.logError)('API key is not active');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const configToSave = {
|
|
50
|
+
apiKey,
|
|
51
|
+
tenantId: authData.tenantId
|
|
52
|
+
};
|
|
53
|
+
if (api && api !== config_1.DEFAULT_API_URL) {
|
|
54
|
+
configToSave.api = api;
|
|
55
|
+
}
|
|
56
|
+
if (tenantId && tenantId !== authData.tenantId) {
|
|
57
|
+
(0, logger_1.logError)(`Warning: Provided tenant ID (${tenantId}) differs from discovered tenant ID (${authData.tenantId}). Using discovered tenant.`);
|
|
58
|
+
}
|
|
59
|
+
(0, config_1.saveConfig)(configToSave);
|
|
60
|
+
(0, banner_1.showBanner)();
|
|
61
|
+
(0, logger_1.logSuccess)('Authentication successful!');
|
|
62
|
+
(0, logger_1.log)(`Tenant: ${authData.tenantName} (${authData.tenantDomain})`);
|
|
63
|
+
(0, logger_1.log)(`Tenant ID: ${authData.tenantId}`);
|
|
64
|
+
(0, logger_1.log)(`API Key: ${authData.apiKeyName}`);
|
|
65
|
+
(0, logger_1.log)(`Scopes: ${authData.scopes.join(', ')}`);
|
|
66
|
+
if (authData.expiresAt) {
|
|
67
|
+
(0, logger_1.log)(`Expires: ${new Date(authData.expiresAt).toLocaleDateString()}`);
|
|
68
|
+
}
|
|
69
|
+
(0, logger_1.logDebug)(`Usage count: ${authData.usage.usageCount}`);
|
|
70
|
+
if (authData.usage.lastUsedAt) {
|
|
71
|
+
(0, logger_1.logDebug)(`Last used: ${new Date(authData.usage.lastUsedAt).toLocaleString()}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (error.response?.status === 401) {
|
|
76
|
+
(0, logger_1.logError)('Invalid API key');
|
|
77
|
+
}
|
|
78
|
+
else if (error.response?.status === 403) {
|
|
79
|
+
(0, logger_1.logError)('API key does not have required permissions');
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.REQUEST_FAILED(error.response?.data?.message || error.message));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
parseApiKey(val) {
|
|
87
|
+
return val;
|
|
88
|
+
}
|
|
89
|
+
parseApi(val) {
|
|
90
|
+
return val;
|
|
91
|
+
}
|
|
92
|
+
parseTenantId(val) {
|
|
93
|
+
return val;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.LoginCommand = LoginCommand;
|
|
97
|
+
__decorate([
|
|
98
|
+
(0, nest_commander_1.Option)({
|
|
99
|
+
flags: '--api-key <key>',
|
|
100
|
+
description: 'API key generated in the web interface',
|
|
101
|
+
}),
|
|
102
|
+
__metadata("design:type", Function),
|
|
103
|
+
__metadata("design:paramtypes", [String]),
|
|
104
|
+
__metadata("design:returntype", String)
|
|
105
|
+
], LoginCommand.prototype, "parseApiKey", null);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, nest_commander_1.Option)({
|
|
108
|
+
flags: '--api <url>',
|
|
109
|
+
description: `API base URL (default: ${config_1.DEFAULT_API_URL})`,
|
|
110
|
+
}),
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [String]),
|
|
113
|
+
__metadata("design:returntype", String)
|
|
114
|
+
], LoginCommand.prototype, "parseApi", null);
|
|
115
|
+
__decorate([
|
|
116
|
+
(0, nest_commander_1.Option)({
|
|
117
|
+
flags: '--tenant-id <id>',
|
|
118
|
+
description: 'Tenant identifier',
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [String]),
|
|
122
|
+
__metadata("design:returntype", String)
|
|
123
|
+
], LoginCommand.prototype, "parseTenantId", null);
|
|
124
|
+
exports.LoginCommand = LoginCommand = __decorate([
|
|
125
|
+
(0, nest_commander_1.Command)({ name: 'login', description: 'Authenticate with RunFlow API and discover tenant information' })
|
|
126
|
+
], LoginCommand);
|
|
127
|
+
//# sourceMappingURL=login.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.command.js","sourceRoot":"","sources":["../../../src/commands/login/login.command.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAgE;AAChE,iCAA0B;AAC1B,gDAA6F;AAC7F,gDAA0E;AAC1E,gDAAiD;AAS1C,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,8BAAa;IAC7C,KAAK,CAAC,GAAG,CAAC,MAAgB,EAAE,OAAqB;QAC/C,IAAA,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,YAAY,CAiHxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommandRunner } from 'nest-commander';
|
|
2
|
+
interface PromptsOptions {
|
|
3
|
+
apiKey?: string;
|
|
4
|
+
api?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class PromptsCommand extends CommandRunner {
|
|
7
|
+
run(inputs: string[], options: PromptsOptions): Promise<void>;
|
|
8
|
+
parseApiKey(val: string): string;
|
|
9
|
+
parseApi(val: string): string;
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PromptsCommand = void 0;
|
|
13
|
+
const nest_commander_1 = require("nest-commander");
|
|
14
|
+
const config_1 = require("../../common/config");
|
|
15
|
+
const logger_1 = require("../../common/logger");
|
|
16
|
+
const api_client_1 = require("../../common/api-client");
|
|
17
|
+
let PromptsCommand = class PromptsCommand extends nest_commander_1.CommandRunner {
|
|
18
|
+
async run(inputs, options) {
|
|
19
|
+
const [action, name, data] = inputs;
|
|
20
|
+
const actions = ['get', 'render'];
|
|
21
|
+
if (!action) {
|
|
22
|
+
(0, logger_1.log)('\nUsage: rf prompts <action> <name> [data]\n');
|
|
23
|
+
(0, logger_1.log)('Actions:');
|
|
24
|
+
(0, logger_1.log)(' get <name> Get prompt');
|
|
25
|
+
(0, logger_1.log)(' render <name> <json> Render prompt with variables\n');
|
|
26
|
+
(0, logger_1.log)('Options:');
|
|
27
|
+
(0, logger_1.log)(' --api-key <key> API key override');
|
|
28
|
+
(0, logger_1.log)(' --api <url> API URL override');
|
|
29
|
+
(0, logger_1.log)(' --help, -h Show this help\n');
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!actions.includes(action)) {
|
|
33
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.INVALID_ACTION(action, actions));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!name) {
|
|
37
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.NAME_REQUIRED);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const apiClient = (0, api_client_1.createApiClient)(options.api);
|
|
42
|
+
switch (action) {
|
|
43
|
+
case 'get': {
|
|
44
|
+
(0, logger_1.logVerbose)(`Fetching prompt ${name}...`);
|
|
45
|
+
const res = await apiClient.get(`/prompts/${name}`);
|
|
46
|
+
(0, logger_1.logJson)([res.data]);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
case 'render': {
|
|
50
|
+
if (!data) {
|
|
51
|
+
(0, logger_1.logError)(config_1.ERROR_MESSAGES.DATA_REQUIRED);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
(0, logger_1.logVerbose)(`Rendering prompt ${name}...`);
|
|
55
|
+
const res = await apiClient.post(`/prompts/${name}`, JSON.parse(data));
|
|
56
|
+
(0, logger_1.logJson)([res.data]);
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
(0, logger_1.logError)(error.message || config_1.ERROR_MESSAGES.REQUEST_FAILED(error.toString()));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
parseApiKey(val) {
|
|
66
|
+
return val;
|
|
67
|
+
}
|
|
68
|
+
parseApi(val) {
|
|
69
|
+
return val;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
exports.PromptsCommand = PromptsCommand;
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, nest_commander_1.Option)({
|
|
75
|
+
flags: '--api-key <key>',
|
|
76
|
+
description: 'API key override (uses saved config if not provided)',
|
|
77
|
+
}),
|
|
78
|
+
__metadata("design:type", Function),
|
|
79
|
+
__metadata("design:paramtypes", [String]),
|
|
80
|
+
__metadata("design:returntype", String)
|
|
81
|
+
], PromptsCommand.prototype, "parseApiKey", null);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, nest_commander_1.Option)({
|
|
84
|
+
flags: '--api <url>',
|
|
85
|
+
description: `API URL override (default: ${config_1.DEFAULT_API_URL})`,
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:type", Function),
|
|
88
|
+
__metadata("design:paramtypes", [String]),
|
|
89
|
+
__metadata("design:returntype", String)
|
|
90
|
+
], PromptsCommand.prototype, "parseApi", null);
|
|
91
|
+
exports.PromptsCommand = PromptsCommand = __decorate([
|
|
92
|
+
(0, nest_commander_1.Command)({
|
|
93
|
+
name: 'prompts',
|
|
94
|
+
aliases: ['prompt'],
|
|
95
|
+
arguments: '<action> <name> [data]',
|
|
96
|
+
description: 'Manage prompts.\n' +
|
|
97
|
+
'Actions:\n' +
|
|
98
|
+
' get <name> Get prompt\n' +
|
|
99
|
+
' render <name> <json> Render prompt with variables',
|
|
100
|
+
})
|
|
101
|
+
], PromptsCommand);
|
|
102
|
+
//# sourceMappingURL=prompts.command.js.map
|