@xano/cli 0.0.19 → 0.0.20
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 +14 -0
- package/dist/base-command.d.ts +2 -0
- package/dist/base-command.js +7 -0
- package/dist/commands/function/create/index.d.ts +1 -0
- package/dist/commands/function/edit/index.d.ts +1 -0
- package/dist/commands/function/get/index.d.ts +1 -0
- package/dist/commands/function/list/index.d.ts +1 -0
- package/dist/commands/profile/edit/index.d.ts +1 -0
- package/dist/commands/profile/me/index.d.ts +1 -0
- package/dist/commands/run/env/delete/index.d.ts +1 -0
- package/dist/commands/run/env/delete/index.js +1 -1
- package/dist/commands/run/env/get/index.d.ts +1 -0
- package/dist/commands/run/env/get/index.js +1 -1
- package/dist/commands/run/env/list/index.d.ts +1 -0
- package/dist/commands/run/env/list/index.js +1 -1
- package/dist/commands/run/env/set/index.d.ts +1 -0
- package/dist/commands/run/env/set/index.js +1 -1
- package/dist/commands/run/exec/index.d.ts +1 -0
- package/dist/commands/run/exec/index.js +11 -2
- package/dist/commands/run/info/index.d.ts +1 -0
- package/dist/commands/run/info/index.js +1 -1
- package/dist/commands/run/projects/create/index.d.ts +1 -0
- package/dist/commands/run/projects/create/index.js +1 -1
- package/dist/commands/run/projects/delete/index.d.ts +1 -0
- package/dist/commands/run/projects/delete/index.js +1 -1
- package/dist/commands/run/projects/list/index.d.ts +1 -0
- package/dist/commands/run/projects/list/index.js +1 -1
- package/dist/commands/run/projects/update/index.d.ts +1 -0
- package/dist/commands/run/projects/update/index.js +1 -1
- package/dist/commands/run/secrets/delete/index.d.ts +1 -0
- package/dist/commands/run/secrets/delete/index.js +1 -1
- package/dist/commands/run/secrets/get/index.d.ts +1 -0
- package/dist/commands/run/secrets/get/index.js +1 -1
- package/dist/commands/run/secrets/list/index.d.ts +1 -0
- package/dist/commands/run/secrets/list/index.js +1 -1
- package/dist/commands/run/secrets/set/index.d.ts +1 -0
- package/dist/commands/run/secrets/set/index.js +1 -1
- package/dist/commands/run/sessions/delete/index.d.ts +1 -0
- package/dist/commands/run/sessions/delete/index.js +1 -1
- package/dist/commands/run/sessions/get/index.d.ts +1 -0
- package/dist/commands/run/sessions/get/index.js +1 -1
- package/dist/commands/run/sessions/list/index.d.ts +1 -0
- package/dist/commands/run/sessions/list/index.js +1 -1
- package/dist/commands/run/sessions/start/index.d.ts +1 -0
- package/dist/commands/run/sessions/start/index.js +1 -1
- package/dist/commands/run/sessions/stop/index.d.ts +1 -0
- package/dist/commands/run/sessions/stop/index.js +1 -1
- package/dist/commands/run/sink/get/index.d.ts +1 -0
- package/dist/commands/run/sink/get/index.js +1 -1
- package/dist/commands/static_host/build/create/index.d.ts +1 -0
- package/dist/commands/static_host/build/get/index.d.ts +1 -0
- package/dist/commands/static_host/build/list/index.d.ts +1 -0
- package/dist/commands/static_host/list/index.d.ts +1 -0
- package/dist/commands/workspace/list/index.d.ts +1 -0
- package/dist/commands/workspace/pull/index.d.ts +1 -0
- package/dist/commands/workspace/push/index.d.ts +1 -0
- package/dist/lib/base-run-command.d.ts +2 -2
- package/dist/lib/base-run-command.js +5 -3
- package/dist/lib/run-http-client.d.ts +6 -0
- package/dist/lib/run-http-client.js +36 -1
- package/oclif.manifest.json +877 -580
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export default class BaseRunCommand extends BaseCommand {
|
|
|
14
14
|
/**
|
|
15
15
|
* Initialize the run command with profile and HTTP client
|
|
16
16
|
*/
|
|
17
|
-
async initRunCommand(profileFlag) {
|
|
17
|
+
async initRunCommand(profileFlag, verbose) {
|
|
18
18
|
this.profileName = profileFlag || this.getDefaultProfile();
|
|
19
19
|
const credentials = this.loadCredentials();
|
|
20
20
|
if (!(this.profileName in credentials.profiles)) {
|
|
@@ -30,13 +30,15 @@ export default class BaseRunCommand extends BaseCommand {
|
|
|
30
30
|
baseUrl,
|
|
31
31
|
authToken: this.profile.access_token,
|
|
32
32
|
projectId: this.profile.project,
|
|
33
|
+
verbose,
|
|
34
|
+
logger: (msg) => this.log(msg),
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Initialize with project required
|
|
37
39
|
*/
|
|
38
|
-
async initRunCommandWithProject(profileFlag) {
|
|
39
|
-
await this.initRunCommand(profileFlag);
|
|
40
|
+
async initRunCommandWithProject(profileFlag, verbose) {
|
|
41
|
+
await this.initRunCommand(profileFlag, verbose);
|
|
40
42
|
if (!this.profile.project) {
|
|
41
43
|
this.error(`Profile '${this.profileName}' is missing project. ` +
|
|
42
44
|
`Run 'xano profile:wizard' to set up your profile or use 'xano profile:edit --project <project-id>'`);
|
|
@@ -7,6 +7,8 @@ export interface RunHttpClientConfig {
|
|
|
7
7
|
baseUrl: string;
|
|
8
8
|
authToken: string;
|
|
9
9
|
projectId?: string;
|
|
10
|
+
verbose?: boolean;
|
|
11
|
+
logger?: (message: string) => void;
|
|
10
12
|
}
|
|
11
13
|
export declare class RunHttpClient {
|
|
12
14
|
private readonly config;
|
|
@@ -31,6 +33,10 @@ export declare class RunHttpClient {
|
|
|
31
33
|
* Build a URL scoped to a specific session
|
|
32
34
|
*/
|
|
33
35
|
buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
|
|
36
|
+
/**
|
|
37
|
+
* Log a message if verbose mode is enabled
|
|
38
|
+
*/
|
|
39
|
+
private log;
|
|
34
40
|
/**
|
|
35
41
|
* Make an HTTP request
|
|
36
42
|
*/
|
|
@@ -62,27 +62,62 @@ export class RunHttpClient {
|
|
|
62
62
|
buildSessionUrl(sessionId, path = '', queryParams) {
|
|
63
63
|
return this.buildUrl(`/session/${sessionId}${path}`, queryParams);
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Log a message if verbose mode is enabled
|
|
67
|
+
*/
|
|
68
|
+
log(message) {
|
|
69
|
+
if (this.config.verbose && this.config.logger) {
|
|
70
|
+
this.config.logger(message);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
65
73
|
/**
|
|
66
74
|
* Make an HTTP request
|
|
67
75
|
*/
|
|
68
76
|
async request(url, options) {
|
|
77
|
+
const method = options.method || 'GET';
|
|
78
|
+
const contentType = options.headers?.['Content-Type'] || 'application/json';
|
|
79
|
+
// Log request details
|
|
80
|
+
this.log(`\n${'─'.repeat(60)}`);
|
|
81
|
+
this.log(`→ ${method} ${url}`);
|
|
82
|
+
this.log(` Content-Type: ${contentType}`);
|
|
83
|
+
if (options.body) {
|
|
84
|
+
const bodyPreview = typeof options.body === 'string'
|
|
85
|
+
? options.body.length > 500 ? options.body.slice(0, 500) + '...' : options.body
|
|
86
|
+
: JSON.stringify(options.body);
|
|
87
|
+
this.log(` Body: ${bodyPreview}`);
|
|
88
|
+
}
|
|
89
|
+
const startTime = Date.now();
|
|
69
90
|
const response = await fetch(url, options);
|
|
91
|
+
const elapsed = Date.now() - startTime;
|
|
92
|
+
// Log response details
|
|
93
|
+
this.log(`← ${response.status} ${response.statusText} (${elapsed}ms)`);
|
|
70
94
|
if (!response.ok) {
|
|
71
95
|
const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
72
96
|
error.status = response.status;
|
|
73
97
|
try {
|
|
74
98
|
error.response = await response.json();
|
|
99
|
+
this.log(` Response: ${JSON.stringify(error.response, null, 2)}`);
|
|
75
100
|
}
|
|
76
101
|
catch {
|
|
77
102
|
error.response = await response.text();
|
|
103
|
+
this.log(` Response: ${error.response}`);
|
|
78
104
|
}
|
|
105
|
+
this.log(`${'─'.repeat(60)}\n`);
|
|
79
106
|
throw error;
|
|
80
107
|
}
|
|
81
108
|
const text = await response.text();
|
|
82
109
|
if (!text) {
|
|
110
|
+
this.log(` Response: (empty)`);
|
|
111
|
+
this.log(`${'─'.repeat(60)}\n`);
|
|
83
112
|
return undefined;
|
|
84
113
|
}
|
|
85
|
-
|
|
114
|
+
const parsed = JSON.parse(text);
|
|
115
|
+
if (this.config.verbose) {
|
|
116
|
+
const responsePreview = text.length > 1000 ? text.slice(0, 1000) + '...' : text;
|
|
117
|
+
this.log(` Response: ${responsePreview}`);
|
|
118
|
+
}
|
|
119
|
+
this.log(`${'─'.repeat(60)}\n`);
|
|
120
|
+
return parsed;
|
|
86
121
|
}
|
|
87
122
|
/**
|
|
88
123
|
* Make a GET request
|