flowengine-mcp-app 2.0.1 → 3.0.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/build/cli/api.d.ts +19 -0
- package/build/cli/api.d.ts.map +1 -0
- package/build/cli/api.js +62 -0
- package/build/cli/api.js.map +1 -0
- package/build/cli/commands/delete.d.ts +4 -0
- package/build/cli/commands/delete.d.ts.map +1 -0
- package/build/cli/commands/delete.js +16 -0
- package/build/cli/commands/delete.js.map +1 -0
- package/build/cli/commands/deploy.d.ts +24 -0
- package/build/cli/commands/deploy.d.ts.map +1 -0
- package/build/cli/commands/deploy.js +103 -0
- package/build/cli/commands/deploy.js.map +1 -0
- package/build/cli/commands/domain.d.ts +9 -0
- package/build/cli/commands/domain.d.ts.map +1 -0
- package/build/cli/commands/domain.js +27 -0
- package/build/cli/commands/domain.js.map +1 -0
- package/build/cli/commands/env.d.ts +13 -0
- package/build/cli/commands/env.d.ts.map +1 -0
- package/build/cli/commands/env.js +53 -0
- package/build/cli/commands/env.js.map +1 -0
- package/build/cli/commands/list.d.ts +4 -0
- package/build/cli/commands/list.d.ts.map +1 -0
- package/build/cli/commands/list.js +25 -0
- package/build/cli/commands/list.js.map +1 -0
- package/build/cli/commands/login.d.ts +4 -0
- package/build/cli/commands/login.d.ts.map +1 -0
- package/build/cli/commands/login.js +37 -0
- package/build/cli/commands/login.js.map +1 -0
- package/build/cli/commands/logout.d.ts +2 -0
- package/build/cli/commands/logout.d.ts.map +1 -0
- package/build/cli/commands/logout.js +8 -0
- package/build/cli/commands/logout.js.map +1 -0
- package/build/cli/commands/logs.d.ts +4 -0
- package/build/cli/commands/logs.d.ts.map +1 -0
- package/build/cli/commands/logs.js +40 -0
- package/build/cli/commands/logs.js.map +1 -0
- package/build/cli/commands/show.d.ts +4 -0
- package/build/cli/commands/show.d.ts.map +1 -0
- package/build/cli/commands/show.js +13 -0
- package/build/cli/commands/show.js.map +1 -0
- package/build/cli/commands/usage.d.ts +7 -0
- package/build/cli/commands/usage.d.ts.map +1 -0
- package/build/cli/commands/usage.js +16 -0
- package/build/cli/commands/usage.js.map +1 -0
- package/build/cli/config.d.ts +17 -0
- package/build/cli/config.d.ts.map +1 -0
- package/build/cli/config.js +42 -0
- package/build/cli/config.js.map +1 -0
- package/build/cli/pack.d.ts +25 -0
- package/build/cli/pack.d.ts.map +1 -0
- package/build/cli/pack.js +111 -0
- package/build/cli/pack.js.map +1 -0
- package/build/cli/ui.d.ts +23 -0
- package/build/cli/ui.d.ts.map +1 -0
- package/build/cli/ui.js +105 -0
- package/build/cli/ui.js.map +1 -0
- package/build/cli.d.ts +10 -0
- package/build/cli.d.ts.map +1 -0
- package/build/cli.js +251 -0
- package/build/cli.js.map +1 -0
- package/build/client.d.ts +38 -0
- package/build/client.d.ts.map +1 -1
- package/build/client.js +124 -1
- package/build/client.js.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +918 -287
- package/build/index.js.map +1 -1
- package/build/tools/functions.d.ts +14 -0
- package/build/tools/functions.d.ts.map +1 -0
- package/build/tools/functions.js +241 -0
- package/build/tools/functions.js.map +1 -0
- package/build/types.d.ts +155 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/ui/component-viewer.d.ts +2 -2
- package/build/ui/component-viewer.js +4 -4
- package/build/ui/component-viewer.js.map +1 -1
- package/build/ui/dashboard.js +1 -1
- package/build/ui/ui/components.html +312 -0
- package/build/ui/ui/n8n.html +124 -0
- package/build/ui/ui/portals.html +211 -0
- package/build/ui/widgets.js +1 -1
- package/build/ui/widgets.js.map +1 -1
- package/package.json +23 -11
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal fetch wrapper for the CLI. Uses Node 18+ native fetch / FormData.
|
|
3
|
+
*
|
|
4
|
+
* Separate from `src/client.ts` (which is the MCP server's class-based client)
|
|
5
|
+
* because the CLI surface is just /api/v1/functions/* and we want crisp error
|
|
6
|
+
* messages tuned for the terminal.
|
|
7
|
+
*/
|
|
8
|
+
export interface ApiContext {
|
|
9
|
+
apiKey: string;
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getApiContext(): Promise<ApiContext>;
|
|
13
|
+
export declare class ApiError extends Error {
|
|
14
|
+
status: number;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
constructor(message: string, status: number, body?: unknown);
|
|
17
|
+
}
|
|
18
|
+
export declare function apiRequest<T>(ctx: ApiContext, path: string, init?: RequestInit): Promise<T>;
|
|
19
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/cli/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAUzD;AAED,qBAAa,QAAS,SAAQ,KAAK;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;gBACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO;CAK5D;AAmBD,wBAAsB,UAAU,CAAC,CAAC,EAChC,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,WAAgB,GACrB,OAAO,CAAC,CAAC,CAAC,CAgBZ"}
|
package/build/cli/api.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal fetch wrapper for the CLI. Uses Node 18+ native fetch / FormData.
|
|
3
|
+
*
|
|
4
|
+
* Separate from `src/client.ts` (which is the MCP server's class-based client)
|
|
5
|
+
* because the CLI surface is just /api/v1/functions/* and we want crisp error
|
|
6
|
+
* messages tuned for the terminal.
|
|
7
|
+
*/
|
|
8
|
+
import { loadConfig, resolveApiKey, resolveBaseUrl } from './config.js';
|
|
9
|
+
export async function getApiContext() {
|
|
10
|
+
const stored = await loadConfig();
|
|
11
|
+
const apiKey = resolveApiKey(stored);
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new ApiError('Not logged in. Run `fe login` first, or set FLOWENGINE_API_KEY.', 401);
|
|
14
|
+
}
|
|
15
|
+
return { apiKey, baseUrl: resolveBaseUrl(stored) };
|
|
16
|
+
}
|
|
17
|
+
export class ApiError extends Error {
|
|
18
|
+
status;
|
|
19
|
+
body;
|
|
20
|
+
constructor(message, status, body) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.status = status;
|
|
23
|
+
this.body = body;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function parseError(res) {
|
|
27
|
+
const ct = res.headers.get('content-type') || '';
|
|
28
|
+
if (ct.includes('application/json')) {
|
|
29
|
+
try {
|
|
30
|
+
const j = (await res.json());
|
|
31
|
+
return j.error || j.message || `HTTP ${res.status}`;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return `HTTP ${res.status}`;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const text = await res.text();
|
|
38
|
+
if (text.includes('<!DOCTYPE') || text.includes('<html')) {
|
|
39
|
+
return `HTTP ${res.status} (server returned HTML)`;
|
|
40
|
+
}
|
|
41
|
+
return text.length > 300 ? `${text.slice(0, 300)}...` : text || `HTTP ${res.status}`;
|
|
42
|
+
}
|
|
43
|
+
export async function apiRequest(ctx, path, init = {}) {
|
|
44
|
+
const url = `${ctx.baseUrl}${path}`;
|
|
45
|
+
const headers = new Headers(init.headers);
|
|
46
|
+
headers.set('Authorization', `Bearer ${ctx.apiKey}`);
|
|
47
|
+
if (init.body && !(init.body instanceof FormData) && !headers.has('Content-Type')) {
|
|
48
|
+
headers.set('Content-Type', 'application/json');
|
|
49
|
+
}
|
|
50
|
+
const res = await fetch(url, { ...init, headers });
|
|
51
|
+
if (!res.ok) {
|
|
52
|
+
const msg = await parseError(res);
|
|
53
|
+
throw new ApiError(msg, res.status);
|
|
54
|
+
}
|
|
55
|
+
if (res.status === 204)
|
|
56
|
+
return undefined;
|
|
57
|
+
const ct = res.headers.get('content-type') || '';
|
|
58
|
+
if (ct.includes('application/json'))
|
|
59
|
+
return (await res.json());
|
|
60
|
+
return (await res.text());
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/cli/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOxE,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,QAAQ,CAChB,iEAAiE,EACjE,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,MAAM,CAAS;IACf,IAAI,CAAW;IACf,YAAY,OAAe,EAAE,MAAc,EAAE,IAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,KAAK,UAAU,UAAU,CAAC,GAAa;IACrC,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,EAAE,CAAC,QAAQ,CAAC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Ac,EAAE,kBAAkB,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,SAAc,CAAC;IAC9C,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;QAAE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;IACpE,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAiB,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/delete.ts"],"names":[],"mappings":"AAGA,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAYpF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
import { ok, prompt, info } from '../ui.js';
|
|
3
|
+
export async function cmdDelete(id, opts) {
|
|
4
|
+
if (!opts.yes) {
|
|
5
|
+
const answer = (await prompt(` Delete function ${id}? Type "yes" to confirm: `)).trim();
|
|
6
|
+
if (answer !== 'yes') {
|
|
7
|
+
info('Cancelled.');
|
|
8
|
+
return 1;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const ctx = await getApiContext();
|
|
12
|
+
await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
13
|
+
ok(`Deleted ${id}`);
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/cli/commands/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAU,EAAE,IAAuB;IACjE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACzF,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,YAAY,CAAC,CAAC;YACnB,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,UAAU,CAAC,GAAG,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC3F,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACpB,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe deploy [path] [options]
|
|
3
|
+
*
|
|
4
|
+
* Walks the target folder, packs each file into a multipart form using the
|
|
5
|
+
* file's relative path as the field name, and POSTs to
|
|
6
|
+
* /api/v1/functions/upload. The server builds the tarball + runs the deploy.
|
|
7
|
+
*
|
|
8
|
+
* If --name matches an existing function, the server treats it as a new
|
|
9
|
+
* revision of that function; otherwise it creates one.
|
|
10
|
+
*/
|
|
11
|
+
export interface DeployOptions {
|
|
12
|
+
name?: string;
|
|
13
|
+
runtime?: string;
|
|
14
|
+
memory?: string;
|
|
15
|
+
cpu?: string;
|
|
16
|
+
maxInstances?: string;
|
|
17
|
+
minInstances?: string;
|
|
18
|
+
timeout?: string;
|
|
19
|
+
region?: string;
|
|
20
|
+
concurrency?: string;
|
|
21
|
+
cpuThrottling?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function cmdDeploy(path: string | undefined, opts: DeployOptions): Promise<number>;
|
|
24
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmBH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAgF9F"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe deploy [path] [options]
|
|
3
|
+
*
|
|
4
|
+
* Walks the target folder, packs each file into a multipart form using the
|
|
5
|
+
* file's relative path as the field name, and POSTs to
|
|
6
|
+
* /api/v1/functions/upload. The server builds the tarball + runs the deploy.
|
|
7
|
+
*
|
|
8
|
+
* If --name matches an existing function, the server treats it as a new
|
|
9
|
+
* revision of that function; otherwise it creates one.
|
|
10
|
+
*/
|
|
11
|
+
import { resolve } from 'node:path';
|
|
12
|
+
import { apiRequest, getApiContext, ApiError } from '../api.js';
|
|
13
|
+
import { packFolder, buildUploadForm } from '../pack.js';
|
|
14
|
+
import { c, info, ok, err, bytes, warn } from '../ui.js';
|
|
15
|
+
const MAX_TOTAL_BYTES = 100 * 1024 * 1024;
|
|
16
|
+
const MAX_FILE_BYTES = 25 * 1024 * 1024;
|
|
17
|
+
export async function cmdDeploy(path, opts) {
|
|
18
|
+
const root = resolve(path || '.');
|
|
19
|
+
info(`Packing ${c.bold(root)}`);
|
|
20
|
+
const packed = await packFolder(root);
|
|
21
|
+
if (packed.files.length === 0) {
|
|
22
|
+
err('No files found in folder (after .feignore + skip rules).');
|
|
23
|
+
return 1;
|
|
24
|
+
}
|
|
25
|
+
if (packed.totalBytes > MAX_TOTAL_BYTES) {
|
|
26
|
+
err(`Folder is ${bytes(packed.totalBytes)} - exceeds 100 MB upload cap.`);
|
|
27
|
+
err('Add patterns to .feignore (e.g. data/, *.zip) and retry.');
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
for (const f of packed.files) {
|
|
31
|
+
if (f.size > MAX_FILE_BYTES) {
|
|
32
|
+
err(`File ${f.path} is ${bytes(f.size)} - exceeds 25 MB per-file cap.`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
info(`${packed.files.length} files, ${bytes(packed.totalBytes)} total`);
|
|
37
|
+
if (packed.files.length <= 8) {
|
|
38
|
+
for (const f of packed.files) {
|
|
39
|
+
console.log(` ${c.dim(f.path.padEnd(40))} ${c.dim(bytes(f.size))}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const compute = {};
|
|
43
|
+
if (opts.memory)
|
|
44
|
+
compute.memory = opts.memory;
|
|
45
|
+
if (opts.cpu)
|
|
46
|
+
compute.cpu = Number(opts.cpu);
|
|
47
|
+
if (opts.maxInstances)
|
|
48
|
+
compute.max_instances = Number(opts.maxInstances);
|
|
49
|
+
if (opts.minInstances)
|
|
50
|
+
compute.min_instances = Number(opts.minInstances);
|
|
51
|
+
if (opts.timeout)
|
|
52
|
+
compute.timeout_seconds = Number(opts.timeout);
|
|
53
|
+
if (opts.region)
|
|
54
|
+
compute.region = opts.region;
|
|
55
|
+
if (opts.concurrency)
|
|
56
|
+
compute.concurrency = Number(opts.concurrency);
|
|
57
|
+
if (opts.cpuThrottling !== undefined)
|
|
58
|
+
compute.cpu_throttling = opts.cpuThrottling;
|
|
59
|
+
const form = buildUploadForm(packed, {
|
|
60
|
+
name: opts.name,
|
|
61
|
+
runtime: opts.runtime,
|
|
62
|
+
compute,
|
|
63
|
+
});
|
|
64
|
+
info(`Uploading to FlowEngine...`);
|
|
65
|
+
const ctx = await getApiContext();
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = await apiRequest(ctx, '/api/v1/functions/upload', {
|
|
69
|
+
method: 'POST',
|
|
70
|
+
body: form,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
if (e instanceof ApiError) {
|
|
75
|
+
err(`Deploy failed (${e.status}): ${e.message}`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
err(`Deploy failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
79
|
+
}
|
|
80
|
+
return 1;
|
|
81
|
+
}
|
|
82
|
+
if (!result.success) {
|
|
83
|
+
err(`Deploy rejected: ${result.error || 'unknown reason'}`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
ok(`Deployed function ${c.bold(result.id || '')}`);
|
|
87
|
+
if (result.revision)
|
|
88
|
+
info(`Revision: ${result.revision}`);
|
|
89
|
+
// deploy field can be either an object or a string ("already deploying", etc)
|
|
90
|
+
if (typeof result.deploy === 'object' && result.deploy) {
|
|
91
|
+
if (result.deploy.url)
|
|
92
|
+
info(`URL: ${c.cyan(result.deploy.url)}`);
|
|
93
|
+
if (result.deploy.status)
|
|
94
|
+
info(`Status: ${result.deploy.status}`);
|
|
95
|
+
}
|
|
96
|
+
else if (typeof result.deploy === 'string') {
|
|
97
|
+
info(result.deploy);
|
|
98
|
+
}
|
|
99
|
+
if (result.reason)
|
|
100
|
+
warn(result.reason);
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEzD,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;AAC1C,MAAM,cAAc,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAwBxC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,IAAwB,EAAE,IAAmB;IAC3E,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;IAEtC,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|
2
|
+
* fe domain add <id> <domain>
|
|
3
|
+
* fe domain status <id>
|
|
4
|
+
* fe domain rm <id>
|
|
5
|
+
*/
|
|
6
|
+
export declare function cmdDomainAdd(id: string, domain: string): Promise<number>;
|
|
7
|
+
export declare function cmdDomainStatus(id: string): Promise<number>;
|
|
8
|
+
export declare function cmdDomainRm(id: string): Promise<number>;
|
|
9
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAU9E;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQjE;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK7D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fe domain add <id> <domain>
|
|
3
|
+
* fe domain status <id>
|
|
4
|
+
* fe domain rm <id>
|
|
5
|
+
*/
|
|
6
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
7
|
+
import { ok } from '../ui.js';
|
|
8
|
+
export async function cmdDomainAdd(id, domain) {
|
|
9
|
+
const ctx = await getApiContext();
|
|
10
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`, { method: 'POST', body: JSON.stringify({ domain }) });
|
|
11
|
+
ok(`Mapping requested for ${domain}`);
|
|
12
|
+
console.log(JSON.stringify(data, null, 2));
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
export async function cmdDomainStatus(id) {
|
|
16
|
+
const ctx = await getApiContext();
|
|
17
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`);
|
|
18
|
+
console.log(JSON.stringify(data, null, 2));
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
export async function cmdDomainRm(id) {
|
|
22
|
+
const ctx = await getApiContext();
|
|
23
|
+
await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/domain`, { method: 'DELETE' });
|
|
24
|
+
ok(`Domain mapping removed from ${id}`);
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../src/cli/commands/domain.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EAAU,EAAE,MAAc;IAC3D,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACpD,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CACrD,CAAC;IACF,EAAE,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,EAAU;IAC9C,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,CACrD,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAU;IAC1C,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,UAAU,CAAC,GAAG,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClG,EAAE,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-scoped env vars (a.k.a. secret bindings).
|
|
3
|
+
*
|
|
4
|
+
* fe env list <id>
|
|
5
|
+
* fe env set <id> KEY=VALUE
|
|
6
|
+
* fe env unset <id> KEY
|
|
7
|
+
*/
|
|
8
|
+
export declare function cmdEnvList(id: string, opts: {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}): Promise<number>;
|
|
11
|
+
export declare function cmdEnvSet(id: string, kv: string): Promise<number>;
|
|
12
|
+
export declare function cmdEnvUnset(id: string, name: string): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,wBAAsB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBtF;AAED,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBvE;AAED,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM3E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-scoped env vars (a.k.a. secret bindings).
|
|
3
|
+
*
|
|
4
|
+
* fe env list <id>
|
|
5
|
+
* fe env set <id> KEY=VALUE
|
|
6
|
+
* fe env unset <id> KEY
|
|
7
|
+
*/
|
|
8
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
9
|
+
import { c, fmtTable, info, ok, err } from '../ui.js';
|
|
10
|
+
export async function cmdEnvList(id, opts) {
|
|
11
|
+
const ctx = await getApiContext();
|
|
12
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/secrets`);
|
|
13
|
+
if (opts.json) {
|
|
14
|
+
console.log(JSON.stringify(data, null, 2));
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
const list = data.secrets || data.bindings || [];
|
|
18
|
+
if (list.length === 0) {
|
|
19
|
+
info('No env vars set.');
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
const rows = list.map((s) => ({ NAME: s.name, SOURCE: s.source || c.dim('inline') }));
|
|
23
|
+
console.log(fmtTable(rows));
|
|
24
|
+
return 0;
|
|
25
|
+
}
|
|
26
|
+
export async function cmdEnvSet(id, kv) {
|
|
27
|
+
const eq = kv.indexOf('=');
|
|
28
|
+
if (eq === -1) {
|
|
29
|
+
err('Expected KEY=VALUE');
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
const name = kv.slice(0, eq);
|
|
33
|
+
const value = kv.slice(eq + 1);
|
|
34
|
+
if (!/^[A-Z][A-Z0-9_]{0,62}$/.test(name)) {
|
|
35
|
+
err('Key must be UPPER_SNAKE_CASE, start with a letter, max 63 chars.');
|
|
36
|
+
return 1;
|
|
37
|
+
}
|
|
38
|
+
const ctx = await getApiContext();
|
|
39
|
+
await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/secrets`, {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: JSON.stringify({ name, value }),
|
|
42
|
+
});
|
|
43
|
+
ok(`Set ${name} on ${id}`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
export async function cmdEnvUnset(id, name) {
|
|
47
|
+
const ctx = await getApiContext();
|
|
48
|
+
const path = `/api/v1/functions/${encodeURIComponent(id)}/secrets?name=${encodeURIComponent(name)}`;
|
|
49
|
+
await apiRequest(ctx, path, { method: 'DELETE' });
|
|
50
|
+
ok(`Unset ${name} on ${id}`);
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/cli/commands/env.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAYtD,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,EAAU,EAAE,IAAwB;IACnE,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,UAAU,CACtD,CAAC;IACF,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,IA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AAK,EAAE,CAAC;KACtC,CAAC,CAAC;IACH,EAAE,CAAC,OAAO,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;IAC3B,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAAU,EAAE,IAAY;IACxD,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;IACpG,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,EAAE,CAAC,SAAS,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC;IAC7B,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAaA,wBAAsB,OAAO,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2BvE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
import { c, fmtTable, info } from '../ui.js';
|
|
3
|
+
export async function cmdList(opts) {
|
|
4
|
+
const ctx = await getApiContext();
|
|
5
|
+
const data = await apiRequest(ctx, '/api/v1/functions');
|
|
6
|
+
const list = Array.isArray(data) ? data : data.functions || [];
|
|
7
|
+
if (opts.json) {
|
|
8
|
+
console.log(JSON.stringify(list, null, 2));
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
if (list.length === 0) {
|
|
12
|
+
info('No functions yet. Run `fe deploy <folder>` to create one.');
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
const rows = list.map((f) => ({
|
|
16
|
+
ID: f.id,
|
|
17
|
+
NAME: f.name,
|
|
18
|
+
STATUS: f.status,
|
|
19
|
+
RUNTIME: f.runtime,
|
|
20
|
+
URL: f.url || c.dim('-'),
|
|
21
|
+
}));
|
|
22
|
+
console.log(fmtTable(rows));
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/cli/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAY7C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAwB;IACpD,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,mBAAmB,CACpB,CAAC;IACF,MAAM,IAAI,GAAkB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC;IAE9E,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,2DAA2D,CAAC,CAAC;QAClE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;KACzB,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/login.ts"],"names":[],"mappings":"AAIA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmC1E"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { apiRequest, ApiError } from '../api.js';
|
|
2
|
+
import { loadConfig, saveConfig, resolveBaseUrl, DEFAULT_BASE_URL } from '../config.js';
|
|
3
|
+
import { c, info, ok, prompt, err } from '../ui.js';
|
|
4
|
+
export async function cmdLogin(opts) {
|
|
5
|
+
const stored = await loadConfig();
|
|
6
|
+
const baseUrl = opts.baseUrl || resolveBaseUrl(stored);
|
|
7
|
+
console.log(`\n ${c.bold('FlowEngine login')}`);
|
|
8
|
+
console.log(` Get an API key: ${c.cyan(`${baseUrl}/portal/settings/api-keys`)}\n`);
|
|
9
|
+
const apiKey = (await prompt(' Paste API key: ', { secret: true })).trim();
|
|
10
|
+
if (!apiKey) {
|
|
11
|
+
err('No key provided.');
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
if (!apiKey.startsWith('fe_')) {
|
|
15
|
+
err('Key must start with "fe_". Generate one in the portal.');
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
info('Verifying...');
|
|
19
|
+
try {
|
|
20
|
+
await apiRequest({ apiKey, baseUrl }, '/api/v1/functions');
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
if (e instanceof ApiError && e.status === 401) {
|
|
24
|
+
err('Key rejected (401). Check that you copied it correctly.');
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
err(e instanceof Error ? e.message : String(e));
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
await saveConfig({
|
|
31
|
+
apiKey,
|
|
32
|
+
baseUrl: baseUrl === DEFAULT_BASE_URL ? undefined : baseUrl,
|
|
33
|
+
});
|
|
34
|
+
ok(`Logged in. Config written to ~/.flowengine/config.json`);
|
|
35
|
+
return 0;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/cli/commands/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAA0B;IACvD,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;IAEvD,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC;IAEpF,MAAM,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,mBAAmB,EAAE,EAAE,MA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.js","sourceRoot":"","sources":["../../../src/cli/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,WAAW,EAAE,CAAC;IACpB,EAAE,CAAC,gDAAgD,CAAC,CAAC;IACrD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/logs.ts"],"names":[],"mappings":"AAiCA,wBAAsB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyBnF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
import { c } from '../ui.js';
|
|
3
|
+
function severityColor(sev) {
|
|
4
|
+
switch ((sev || '').toUpperCase()) {
|
|
5
|
+
case 'ERROR':
|
|
6
|
+
case 'CRITICAL':
|
|
7
|
+
case 'ALERT':
|
|
8
|
+
case 'EMERGENCY':
|
|
9
|
+
return c.red;
|
|
10
|
+
case 'WARNING':
|
|
11
|
+
case 'WARN':
|
|
12
|
+
return c.yellow;
|
|
13
|
+
case 'INFO':
|
|
14
|
+
case 'NOTICE':
|
|
15
|
+
return c.cyan;
|
|
16
|
+
default:
|
|
17
|
+
return c.dim;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function cmdLogs(id, opts) {
|
|
21
|
+
const ctx = await getApiContext();
|
|
22
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}/logs`);
|
|
23
|
+
if (opts.json) {
|
|
24
|
+
console.log(JSON.stringify(data, null, 2));
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
const entries = data.logs || data.entries || [];
|
|
28
|
+
if (entries.length === 0) {
|
|
29
|
+
console.log(c.dim('(no log entries)'));
|
|
30
|
+
return 0;
|
|
31
|
+
}
|
|
32
|
+
for (const e of entries) {
|
|
33
|
+
const ts = e.timestamp ? c.dim(e.timestamp) : '';
|
|
34
|
+
const sev = e.severity ? severityColor(e.severity)(`[${e.severity}]`) : '';
|
|
35
|
+
const msg = e.message || e.text || '';
|
|
36
|
+
console.log(`${ts} ${sev} ${msg}`.trim());
|
|
37
|
+
}
|
|
38
|
+
return 0;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../../src/cli/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAc7B,SAAS,aAAa,CAAC,GAAuB;IAC5C,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAClC,KAAK,OAAO,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW;YACd,OAAO,CAAC,CAAC,GAAG,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,MAAM;YACT,OAAO,CAAC,CAAC,MAAM,CAAC;QAClB,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,IAAI,CAAC;QAChB;YACE,OAAO,CAAC,CAAC,GAAG,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,EAAU,EAAE,IAAwB;IAChE,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAC3B,GAAG,EACH,qBAA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AAI,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CASnF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
export async function cmdShow(id, opts) {
|
|
3
|
+
const ctx = await getApiContext();
|
|
4
|
+
const data = await apiRequest(ctx, `/api/v1/functions/${encodeURIComponent(id)}`);
|
|
5
|
+
if (opts.json) {
|
|
6
|
+
console.log(JSON.stringify(data, null, 2));
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
console.log(JSON.stringify(data, null, 2));
|
|
10
|
+
}
|
|
11
|
+
return 0;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"show.js","sourceRoot":"","sources":["../../../src/cli/commands/show.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,EAAU,EAAE,IAAwB;IAChE,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,UAAU,CAAU,GAAG,EAAE,qBAAqB,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC3F,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AAEA,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAUlB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { apiRequest, getApiContext } from '../api.js';
|
|
2
|
+
export async function cmdUsage(opts) {
|
|
3
|
+
const ctx = await getApiContext();
|
|
4
|
+
const qs = new URLSearchParams();
|
|
5
|
+
if (opts.functionId)
|
|
6
|
+
qs.set('function_id', opts.functionId);
|
|
7
|
+
if (opts.from)
|
|
8
|
+
qs.set('from', opts.from);
|
|
9
|
+
if (opts.to)
|
|
10
|
+
qs.set('to', opts.to);
|
|
11
|
+
const suffix = qs.toString() ? `?${qs.toString()}` : '';
|
|
12
|
+
const data = await apiRequest(ctx, `/api/v1/functions/usage${suffix}`);
|
|
13
|
+
console.log(JSON.stringify(data, null, 2));
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../../src/cli/commands/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAK9B;IACC,MAAM,GAAG,GAAG,MAAM,aAAa,EAAE,CAAC;IAClC,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,IAAI,IAAI,CAAC,UAAU;QAAE,EAAE,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC5D,IAAI,IAAI,CAAC,IAAI;QAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,IAAI,CAAC,EAAE;QAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,UAAU,CAAU,GAAG,EAAE,0BAA0B,MAAM,EAAE,CAAC,CAAC;IAChF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC"}
|