@xano/cli 0.0.18 → 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.
Files changed (62) hide show
  1. package/README.md +14 -0
  2. package/dist/base-command.d.ts +2 -0
  3. package/dist/base-command.js +7 -0
  4. package/dist/commands/function/create/index.d.ts +1 -0
  5. package/dist/commands/function/edit/index.d.ts +1 -0
  6. package/dist/commands/function/get/index.d.ts +1 -0
  7. package/dist/commands/function/list/index.d.ts +1 -0
  8. package/dist/commands/profile/edit/index.d.ts +1 -0
  9. package/dist/commands/profile/me/index.d.ts +1 -0
  10. package/dist/commands/run/env/delete/index.d.ts +1 -0
  11. package/dist/commands/run/env/delete/index.js +1 -1
  12. package/dist/commands/run/env/get/index.d.ts +1 -0
  13. package/dist/commands/run/env/get/index.js +1 -1
  14. package/dist/commands/run/env/list/index.d.ts +1 -0
  15. package/dist/commands/run/env/list/index.js +1 -1
  16. package/dist/commands/run/env/set/index.d.ts +1 -0
  17. package/dist/commands/run/env/set/index.js +1 -1
  18. package/dist/commands/run/exec/index.d.ts +1 -0
  19. package/dist/commands/run/exec/index.js +26 -6
  20. package/dist/commands/run/info/index.d.ts +1 -0
  21. package/dist/commands/run/info/index.js +1 -1
  22. package/dist/commands/run/projects/create/index.d.ts +1 -0
  23. package/dist/commands/run/projects/create/index.js +1 -1
  24. package/dist/commands/run/projects/delete/index.d.ts +1 -0
  25. package/dist/commands/run/projects/delete/index.js +1 -1
  26. package/dist/commands/run/projects/list/index.d.ts +1 -0
  27. package/dist/commands/run/projects/list/index.js +1 -1
  28. package/dist/commands/run/projects/update/index.d.ts +1 -0
  29. package/dist/commands/run/projects/update/index.js +1 -1
  30. package/dist/commands/run/secrets/delete/index.d.ts +1 -0
  31. package/dist/commands/run/secrets/delete/index.js +1 -1
  32. package/dist/commands/run/secrets/get/index.d.ts +1 -0
  33. package/dist/commands/run/secrets/get/index.js +1 -1
  34. package/dist/commands/run/secrets/list/index.d.ts +1 -0
  35. package/dist/commands/run/secrets/list/index.js +1 -1
  36. package/dist/commands/run/secrets/set/index.d.ts +1 -0
  37. package/dist/commands/run/secrets/set/index.js +1 -1
  38. package/dist/commands/run/sessions/delete/index.d.ts +1 -0
  39. package/dist/commands/run/sessions/delete/index.js +1 -1
  40. package/dist/commands/run/sessions/get/index.d.ts +1 -0
  41. package/dist/commands/run/sessions/get/index.js +1 -1
  42. package/dist/commands/run/sessions/list/index.d.ts +1 -0
  43. package/dist/commands/run/sessions/list/index.js +1 -1
  44. package/dist/commands/run/sessions/start/index.d.ts +1 -0
  45. package/dist/commands/run/sessions/start/index.js +1 -1
  46. package/dist/commands/run/sessions/stop/index.d.ts +1 -0
  47. package/dist/commands/run/sessions/stop/index.js +1 -1
  48. package/dist/commands/run/sink/get/index.d.ts +1 -0
  49. package/dist/commands/run/sink/get/index.js +1 -1
  50. package/dist/commands/static_host/build/create/index.d.ts +1 -0
  51. package/dist/commands/static_host/build/get/index.d.ts +1 -0
  52. package/dist/commands/static_host/build/list/index.d.ts +1 -0
  53. package/dist/commands/static_host/list/index.d.ts +1 -0
  54. package/dist/commands/workspace/list/index.d.ts +1 -0
  55. package/dist/commands/workspace/pull/index.d.ts +1 -0
  56. package/dist/commands/workspace/push/index.d.ts +1 -0
  57. package/dist/lib/base-run-command.d.ts +2 -2
  58. package/dist/lib/base-run-command.js +5 -3
  59. package/dist/lib/run-http-client.d.ts +6 -0
  60. package/dist/lib/run-http-client.js +36 -1
  61. package/oclif.manifest.json +591 -297
  62. package/package.json +1 -1
@@ -25,11 +25,11 @@ export default abstract class BaseRunCommand extends BaseCommand {
25
25
  /**
26
26
  * Initialize the run command with profile and HTTP client
27
27
  */
28
- protected initRunCommand(profileFlag?: string): Promise<void>;
28
+ protected initRunCommand(profileFlag?: string, verbose?: boolean): Promise<void>;
29
29
  /**
30
30
  * Initialize with project required
31
31
  */
32
- protected initRunCommandWithProject(profileFlag?: string): Promise<void>;
32
+ protected initRunCommandWithProject(profileFlag?: string, verbose?: boolean): Promise<void>;
33
33
  /**
34
34
  * Load credentials from file
35
35
  */
@@ -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
- return JSON.parse(text);
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