@xano/cli 0.0.25 → 0.0.26

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 (110) hide show
  1. package/dist/base-command.d.ts +1 -3
  2. package/dist/base-command.js +5 -12
  3. package/dist/commands/function/create/index.d.ts +6 -7
  4. package/dist/commands/function/create/index.js +55 -55
  5. package/dist/commands/function/edit/index.d.ts +10 -11
  6. package/dist/commands/function/edit/index.js +162 -155
  7. package/dist/commands/function/get/index.d.ts +5 -6
  8. package/dist/commands/function/get/index.js +60 -55
  9. package/dist/commands/function/list/index.d.ts +5 -6
  10. package/dist/commands/function/list/index.js +52 -52
  11. package/dist/commands/profile/create/index.d.ts +6 -6
  12. package/dist/commands/profile/create/index.js +37 -37
  13. package/dist/commands/profile/delete/index.d.ts +2 -2
  14. package/dist/commands/profile/delete/index.js +9 -9
  15. package/dist/commands/profile/edit/index.d.ts +7 -8
  16. package/dist/commands/profile/edit/index.js +48 -48
  17. package/dist/commands/profile/get-default/index.js +1 -1
  18. package/dist/commands/profile/list/index.d.ts +2 -2
  19. package/dist/commands/profile/list/index.js +9 -9
  20. package/dist/commands/profile/me/index.d.ts +3 -4
  21. package/dist/commands/profile/me/index.js +21 -21
  22. package/dist/commands/profile/project/index.js +1 -1
  23. package/dist/commands/profile/set-default/index.js +1 -1
  24. package/dist/commands/profile/token/index.js +1 -1
  25. package/dist/commands/profile/wizard/index.d.ts +4 -5
  26. package/dist/commands/profile/wizard/index.js +108 -142
  27. package/dist/commands/run/env/delete/index.d.ts +2 -3
  28. package/dist/commands/run/env/delete/index.js +10 -10
  29. package/dist/commands/run/env/get/index.d.ts +2 -3
  30. package/dist/commands/run/env/get/index.js +11 -11
  31. package/dist/commands/run/env/list/index.d.ts +2 -3
  32. package/dist/commands/run/env/list/index.js +19 -17
  33. package/dist/commands/run/env/set/index.d.ts +2 -3
  34. package/dist/commands/run/env/set/index.js +5 -5
  35. package/dist/commands/run/exec/index.d.ts +8 -19
  36. package/dist/commands/run/exec/index.js +108 -186
  37. package/dist/commands/run/info/index.d.ts +4 -5
  38. package/dist/commands/run/info/index.js +27 -27
  39. package/dist/commands/run/projects/create/index.d.ts +3 -4
  40. package/dist/commands/run/projects/create/index.js +23 -23
  41. package/dist/commands/run/projects/delete/index.d.ts +2 -3
  42. package/dist/commands/run/projects/delete/index.js +10 -10
  43. package/dist/commands/run/projects/list/index.d.ts +2 -3
  44. package/dist/commands/run/projects/list/index.js +12 -12
  45. package/dist/commands/run/projects/update/index.d.ts +3 -4
  46. package/dist/commands/run/projects/update/index.js +21 -21
  47. package/dist/commands/run/secrets/delete/index.d.ts +2 -3
  48. package/dist/commands/run/secrets/delete/index.js +10 -10
  49. package/dist/commands/run/secrets/get/index.d.ts +2 -3
  50. package/dist/commands/run/secrets/get/index.js +11 -11
  51. package/dist/commands/run/secrets/list/index.d.ts +2 -3
  52. package/dist/commands/run/secrets/list/index.js +24 -22
  53. package/dist/commands/run/secrets/set/index.d.ts +3 -4
  54. package/dist/commands/run/secrets/set/index.js +16 -16
  55. package/dist/commands/run/sessions/delete/index.d.ts +2 -3
  56. package/dist/commands/run/sessions/delete/index.js +10 -10
  57. package/dist/commands/run/sessions/get/index.d.ts +2 -3
  58. package/dist/commands/run/sessions/get/index.js +11 -11
  59. package/dist/commands/run/sessions/list/index.d.ts +2 -3
  60. package/dist/commands/run/sessions/list/index.js +11 -11
  61. package/dist/commands/run/sessions/start/index.d.ts +2 -3
  62. package/dist/commands/run/sessions/start/index.js +11 -11
  63. package/dist/commands/run/sessions/stop/index.d.ts +2 -3
  64. package/dist/commands/run/sessions/stop/index.js +11 -11
  65. package/dist/commands/run/sink/get/index.d.ts +2 -3
  66. package/dist/commands/run/sink/get/index.js +11 -11
  67. package/dist/commands/static_host/build/create/index.d.ts +4 -5
  68. package/dist/commands/static_host/build/create/index.js +33 -33
  69. package/dist/commands/static_host/build/get/index.d.ts +4 -5
  70. package/dist/commands/static_host/build/get/index.js +20 -20
  71. package/dist/commands/static_host/build/list/index.d.ts +3 -4
  72. package/dist/commands/static_host/build/list/index.js +31 -31
  73. package/dist/commands/static_host/list/index.d.ts +3 -4
  74. package/dist/commands/static_host/list/index.js +31 -31
  75. package/dist/commands/workspace/list/index.d.ts +2 -3
  76. package/dist/commands/workspace/list/index.js +15 -15
  77. package/dist/commands/workspace/pull/index.d.ts +4 -5
  78. package/dist/commands/workspace/pull/index.js +52 -47
  79. package/dist/commands/workspace/push/index.d.ts +0 -1
  80. package/dist/commands/workspace/push/index.js +4 -4
  81. package/dist/help.d.ts +1 -1
  82. package/dist/lib/base-run-command.d.ts +6 -6
  83. package/dist/lib/base-run-command.js +6 -8
  84. package/dist/lib/run-http-client.d.ts +18 -24
  85. package/dist/lib/run-http-client.js +61 -96
  86. package/dist/lib/run-types.d.ts +80 -80
  87. package/oclif.manifest.json +849 -2027
  88. package/package.json +3 -1
  89. package/dist/commands/auth/index.d.ts +0 -21
  90. package/dist/commands/auth/index.js +0 -533
  91. package/dist/commands/branch/create/index.d.ts +0 -17
  92. package/dist/commands/branch/create/index.js +0 -164
  93. package/dist/commands/branch/delete/index.d.ts +0 -18
  94. package/dist/commands/branch/delete/index.js +0 -156
  95. package/dist/commands/branch/edit/index.d.ts +0 -19
  96. package/dist/commands/branch/edit/index.js +0 -166
  97. package/dist/commands/branch/get/index.d.ts +0 -16
  98. package/dist/commands/branch/get/index.js +0 -135
  99. package/dist/commands/branch/list/index.d.ts +0 -18
  100. package/dist/commands/branch/list/index.js +0 -138
  101. package/dist/commands/branch/set-live/index.d.ts +0 -18
  102. package/dist/commands/branch/set-live/index.js +0 -155
  103. package/dist/commands/workspace/create/index.d.ts +0 -14
  104. package/dist/commands/workspace/create/index.js +0 -131
  105. package/dist/commands/workspace/delete/index.d.ts +0 -20
  106. package/dist/commands/workspace/delete/index.js +0 -141
  107. package/dist/commands/workspace/edit/index.d.ts +0 -22
  108. package/dist/commands/workspace/edit/index.js +0 -176
  109. package/dist/commands/workspace/get/index.d.ts +0 -18
  110. package/dist/commands/workspace/get/index.js +0 -136
@@ -2,27 +2,27 @@
2
2
  * HTTP client for Xano Run API
3
3
  * Based on @xano/run-sdk HttpClient
4
4
  */
5
- export const DEFAULT_RUN_BASE_URL = 'https://app.dev.xano.com/';
5
+ export const DEFAULT_RUN_BASE_URL = 'https://app.xano.com/';
6
6
  export class RunHttpClient {
7
7
  config;
8
8
  constructor(config) {
9
9
  this.config = config;
10
10
  }
11
11
  /**
12
- * Build a URL scoped to the current project
12
+ * Get the project ID
13
13
  */
14
- buildProjectUrl(path, queryParams) {
15
- const { projectId } = this.config;
16
- if (!projectId) {
17
- throw new Error('Project ID is required. Set it in your profile.');
18
- }
19
- return this.buildUrl(`/project/${projectId}${path}`, queryParams);
14
+ getProjectId() {
15
+ return this.config.projectId;
20
16
  }
21
17
  /**
22
- * Build a URL scoped to a specific session
18
+ * Build headers for a request
23
19
  */
24
- buildSessionUrl(sessionId, path = '', queryParams) {
25
- return this.buildUrl(`/session/${sessionId}${path}`, queryParams);
20
+ getHeaders(contentType = 'application/json') {
21
+ const headers = {
22
+ 'Content-Type': contentType,
23
+ 'Authorization': `Bearer ${this.config.authToken}`,
24
+ };
25
+ return headers;
26
26
  }
27
27
  /**
28
28
  * Build a URL with optional query parameters
@@ -47,48 +47,50 @@ export class RunHttpClient {
47
47
  return url.toString();
48
48
  }
49
49
  /**
50
- * Make a DELETE request
51
- */
52
- async delete(url, body) {
53
- return this.request(url, {
54
- body: body ? JSON.stringify(body) : undefined,
55
- headers: this.getHeaders(),
56
- method: 'DELETE',
57
- });
58
- }
59
- /**
60
- * Make a GET request
50
+ * Build a URL scoped to the current project
61
51
  */
62
- async get(url) {
63
- return this.request(url, {
64
- headers: this.getHeaders(),
65
- method: 'GET',
66
- });
52
+ buildProjectUrl(path, queryParams) {
53
+ const projectId = this.config.projectId;
54
+ if (!projectId) {
55
+ throw new Error('Project ID is required. Set it in your profile.');
56
+ }
57
+ return this.buildUrl(`/project/${projectId}${path}`, queryParams);
67
58
  }
68
59
  /**
69
- * Build headers for a request
60
+ * Build a URL scoped to a specific session
70
61
  */
71
- getHeaders(contentType = 'application/json') {
72
- const headers = {
73
- 'Authorization': `Bearer ${this.config.authToken}`,
74
- 'Content-Type': contentType,
75
- };
76
- return headers;
62
+ buildSessionUrl(sessionId, path = '', queryParams) {
63
+ return this.buildUrl(`/session/${sessionId}${path}`, queryParams);
77
64
  }
78
65
  /**
79
- * Get the project ID
66
+ * Make an HTTP request
80
67
  */
81
- getProjectId() {
82
- return this.config.projectId;
68
+ async request(url, options) {
69
+ const response = await fetch(url, options);
70
+ if (!response.ok) {
71
+ const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
72
+ error.status = response.status;
73
+ try {
74
+ error.response = await response.json();
75
+ }
76
+ catch {
77
+ error.response = await response.text();
78
+ }
79
+ throw error;
80
+ }
81
+ const text = await response.text();
82
+ if (!text) {
83
+ return undefined;
84
+ }
85
+ return JSON.parse(text);
83
86
  }
84
87
  /**
85
- * Make a PATCH request
88
+ * Make a GET request
86
89
  */
87
- async patch(url, body) {
90
+ async get(url) {
88
91
  return this.request(url, {
89
- body: JSON.stringify(body),
92
+ method: 'GET',
90
93
  headers: this.getHeaders(),
91
- method: 'PATCH',
92
94
  });
93
95
  }
94
96
  /**
@@ -96,9 +98,9 @@ export class RunHttpClient {
96
98
  */
97
99
  async post(url, body) {
98
100
  return this.request(url, {
99
- body: body ? JSON.stringify(body) : undefined,
100
- headers: this.getHeaders(),
101
101
  method: 'POST',
102
+ headers: this.getHeaders(),
103
+ body: body ? JSON.stringify(body) : undefined,
102
104
  });
103
105
  }
104
106
  /**
@@ -106,66 +108,29 @@ export class RunHttpClient {
106
108
  */
107
109
  async postXanoScript(url, code) {
108
110
  return this.request(url, {
109
- body: code,
110
- headers: this.getHeaders('text/x-xanoscript'),
111
111
  method: 'POST',
112
+ headers: this.getHeaders('text/x-xanoscript'),
113
+ body: code,
112
114
  });
113
115
  }
114
116
  /**
115
- * Make an HTTP request
117
+ * Make a PATCH request
116
118
  */
117
- async request(url, options) {
118
- const method = options.method || 'GET';
119
- const contentType = options.headers?.['Content-Type'] || 'application/json';
120
- // Log request details
121
- this.log(`\n${'─'.repeat(60)}`);
122
- this.log(`→ ${method} ${url}`);
123
- this.log(` Content-Type: ${contentType}`);
124
- if (options.body) {
125
- const bodyPreview = typeof options.body === 'string'
126
- ? options.body.length > 500 ? options.body.slice(0, 500) + '...' : options.body
127
- : JSON.stringify(options.body);
128
- this.log(` Body: ${bodyPreview}`);
129
- }
130
- const startTime = Date.now();
131
- const response = await fetch(url, options);
132
- const elapsed = Date.now() - startTime;
133
- // Log response details
134
- this.log(`← ${response.status} ${response.statusText} (${elapsed}ms)`);
135
- if (!response.ok) {
136
- const error = new Error(`HTTP ${response.status}: ${response.statusText}`);
137
- error.status = response.status;
138
- try {
139
- error.response = await response.json();
140
- this.log(` Response: ${JSON.stringify(error.response, null, 2)}`);
141
- }
142
- catch {
143
- error.response = await response.text();
144
- this.log(` Response: ${error.response}`);
145
- }
146
- this.log(`${'─'.repeat(60)}\n`);
147
- throw error;
148
- }
149
- const text = await response.text();
150
- if (!text) {
151
- this.log(` Response: (empty)`);
152
- this.log(`${'─'.repeat(60)}\n`);
153
- return undefined;
154
- }
155
- const parsed = JSON.parse(text);
156
- if (this.config.verbose) {
157
- const responsePreview = text.length > 1000 ? text.slice(0, 1000) + '...' : text;
158
- this.log(` Response: ${responsePreview}`);
159
- }
160
- this.log(`${'─'.repeat(60)}\n`);
161
- return parsed;
119
+ async patch(url, body) {
120
+ return this.request(url, {
121
+ method: 'PATCH',
122
+ headers: this.getHeaders(),
123
+ body: JSON.stringify(body),
124
+ });
162
125
  }
163
126
  /**
164
- * Log a message if verbose mode is enabled
127
+ * Make a DELETE request
165
128
  */
166
- log(message) {
167
- if (this.config.verbose && this.config.logger) {
168
- this.config.logger(message);
169
- }
129
+ async delete(url, body) {
130
+ return this.request(url, {
131
+ method: 'DELETE',
132
+ headers: this.getHeaders(),
133
+ body: body ? JSON.stringify(body) : undefined,
134
+ });
170
135
  }
171
136
  }
@@ -3,35 +3,35 @@
3
3
  * Based on @xano/run-sdk types
4
4
  */
5
5
  export interface PaginatedResponse<T> {
6
- curPage?: number;
7
6
  items: T[];
8
7
  itemsReceived?: number;
9
- itemsTotal?: number;
10
- nextPage?: null | number;
8
+ curPage?: number;
9
+ nextPage?: number | null;
10
+ prevPage?: number | null;
11
11
  offset?: number;
12
- pageTotal?: number;
13
12
  perPage?: number;
14
- prevPage?: null | number;
13
+ itemsTotal?: number;
14
+ pageTotal?: number;
15
15
  }
16
16
  export interface XanoRunError extends Error {
17
- response?: unknown;
18
17
  status?: number;
18
+ response?: unknown;
19
19
  }
20
20
  export interface Project {
21
- access: 'private' | 'public';
22
- created_at: string;
23
- description: string;
24
21
  id: string;
22
+ created_at: string;
25
23
  name: string;
24
+ description: string;
26
25
  user_id: number;
26
+ access: 'private' | 'public';
27
27
  }
28
28
  export interface CreateProjectInput {
29
- description: string;
30
29
  name: string;
30
+ description: string;
31
31
  }
32
32
  export interface UpdateProjectInput {
33
- description?: string;
34
33
  name?: string;
34
+ description?: string;
35
35
  }
36
36
  export interface EnvKeysResponse {
37
37
  env: string[];
@@ -41,34 +41,34 @@ export interface EnvValueResponse {
41
41
  value: string;
42
42
  }
43
43
  export interface UpdateEnvInput {
44
+ name: string;
44
45
  env: {
45
46
  name: string;
46
47
  value: string;
47
48
  };
48
- name: string;
49
49
  }
50
50
  export type SecretType = 'kubernetes.io/dockerconfigjson' | 'kubernetes.io/service-account-token';
51
51
  export interface SecretMetadata {
52
52
  name: string;
53
- repo?: string;
54
53
  type: SecretType;
54
+ repo?: string;
55
55
  }
56
56
  export interface SecretKeysResponse {
57
57
  secrets: SecretMetadata[];
58
58
  }
59
59
  export interface SecretValueResponse {
60
60
  name: string;
61
- repo?: string;
62
61
  type: SecretType;
62
+ repo?: string;
63
63
  value: string;
64
64
  }
65
65
  export interface UpdateSecretInput {
66
66
  name: string;
67
67
  secret: {
68
68
  name: string;
69
- repo?: string;
70
69
  type: SecretType;
71
70
  value: string;
71
+ repo?: string;
72
72
  };
73
73
  }
74
74
  export type RunType = 'job' | 'service';
@@ -81,83 +81,70 @@ export interface RunBackup {
81
81
  size: number;
82
82
  }
83
83
  export interface RunDefinition {
84
- args: Record<string, unknown> | unknown[];
85
- created_at: string;
86
- doc: string;
87
84
  id: string;
85
+ created_at: string;
86
+ updated_at: string;
88
87
  name: string;
88
+ user_id: number;
89
89
  project_id: string;
90
90
  sig: string;
91
91
  type: RunType;
92
- updated_at: string;
93
- user_id: number;
92
+ args: unknown[] | Record<string, unknown>;
93
+ doc: string;
94
94
  }
95
95
  export interface SessionExecution {
96
- _run: RunDefinition;
97
- access: string;
98
- backup: RunBackup;
99
- batch_id: null | string;
100
- boot_time: number;
96
+ id: string;
101
97
  created_at: string;
98
+ updated_at: string;
99
+ run_id: string;
100
+ batch_id: string | null;
101
+ state: 'complete' | 'error' | string;
102
102
  error_msg: string;
103
- id: string;
103
+ response: unknown;
104
104
  label: string;
105
+ boot_time: number;
106
+ pre_time: number;
105
107
  main_time: number;
106
108
  post_time: number;
107
- pre_time: number;
108
- response: unknown;
109
- run_id: string;
110
- state: 'complete' | 'error' | string;
111
- tenant_id: number;
112
109
  total_time: number;
113
- updated_at: string;
110
+ tenant_id: number;
111
+ access: string;
112
+ backup: RunBackup;
113
+ _run: RunDefinition;
114
114
  }
115
115
  export interface EndpointInput {
116
- default: string;
116
+ source: string;
117
117
  name: string;
118
+ type: string;
118
119
  nullable: boolean;
120
+ default: string;
119
121
  required: boolean;
120
- source: string;
121
- type: string;
122
122
  }
123
123
  export interface Endpoint {
124
- input: EndpointInput[];
125
124
  url: string;
126
125
  verb: string;
126
+ input: EndpointInput[];
127
127
  }
128
128
  export interface MetadataApi {
129
129
  url: string;
130
130
  }
131
131
  export interface RunResult {
132
- logs?: unknown[];
133
- result?: {
134
- boot_time?: number;
135
- endpoints?: Endpoint[];
136
- main_time?: number;
137
- metadata_api?: MetadataApi;
138
- post_time?: number;
139
- pre_result?: unknown;
140
- pre_time?: number;
141
- response?: unknown;
142
- state?: 'complete';
143
- total_time?: number;
144
- };
145
132
  run?: {
146
- debug?: string[];
147
- id?: number | string;
148
- problems?: Array<{
149
- message?: string;
150
- severity?: string;
151
- }>;
133
+ id?: string | number;
134
+ session?: SessionExecution;
152
135
  result?: {
136
+ response?: unknown;
153
137
  boot_time?: number;
154
138
  main_time?: number;
155
- post_time?: number;
156
139
  pre_time?: number;
157
- response?: unknown;
140
+ post_time?: number;
158
141
  total_time?: number;
159
142
  };
160
- session?: SessionExecution;
143
+ debug?: string[];
144
+ problems?: Array<{
145
+ message?: string;
146
+ severity?: string;
147
+ }>;
161
148
  };
162
149
  service?: {
163
150
  id: number;
@@ -165,62 +152,75 @@ export interface RunResult {
165
152
  id: number;
166
153
  };
167
154
  };
155
+ logs?: unknown[];
156
+ result?: {
157
+ state?: 'complete';
158
+ response?: unknown;
159
+ boot_time?: number;
160
+ pre_time?: number;
161
+ main_time?: number;
162
+ post_time?: number;
163
+ total_time?: number;
164
+ pre_result?: unknown;
165
+ endpoints?: Endpoint[];
166
+ metadata_api?: MetadataApi;
167
+ };
168
168
  }
169
169
  export interface DocInfoResult {
170
- env?: string[];
171
- input?: Record<string, unknown>;
172
170
  type: RunType;
171
+ input?: Record<string, unknown>;
172
+ env?: string[];
173
173
  }
174
- export type SessionStatus = 'error' | 'running' | 'stopped';
174
+ export type SessionStatus = 'running' | 'stopped' | 'error';
175
175
  export interface Session {
176
- created_at: string;
177
176
  id: string;
177
+ created_at: string;
178
+ updated_at: string;
178
179
  project_id: string;
179
180
  state: string;
180
- updated_at: string;
181
181
  }
182
182
  export interface SessionDetail {
183
- access: 'private' | 'public';
184
- backupResource: null | string;
185
- createdAt: string;
186
- doc: string;
187
183
  id: string;
188
184
  name: string;
189
- projectId: null | string;
190
185
  status: SessionStatus;
191
- uptime: null | number;
186
+ uptime: number | null;
192
187
  url?: string;
188
+ doc: string;
189
+ createdAt: string;
190
+ access: 'private' | 'public';
191
+ projectId: string | null;
192
+ backupResource: string | null;
193
193
  }
194
194
  export interface UpdateSessionInput {
195
- access?: 'private' | 'public';
196
195
  name?: string;
196
+ access?: 'private' | 'public';
197
197
  }
198
198
  export interface TableColumn {
199
- description?: string;
200
- isPrimaryKey: boolean;
201
199
  name: string;
202
200
  type: string;
201
+ description?: string;
202
+ isPrimaryKey: boolean;
203
203
  }
204
204
  export interface RunLogEntry {
205
+ id: number;
205
206
  created_at: string;
207
+ log_type: string;
206
208
  duration: number;
207
- error_msg: string;
208
209
  function_name?: string;
209
- id: number;
210
- input?: unknown[];
210
+ error_msg: string;
211
211
  log_object: object;
212
- log_type: string;
213
- output?: Record<string, unknown> | string;
212
+ output?: string | Record<string, unknown>;
213
+ input?: unknown[];
214
214
  stack?: unknown[];
215
215
  value_store?: Record<string, unknown>;
216
216
  }
217
217
  export interface SinkTable {
218
- columns: TableColumn[];
219
- content: Record<string, unknown>[];
220
218
  guid: string;
221
219
  name: string;
220
+ columns: TableColumn[];
221
+ content: Record<string, unknown>[];
222
222
  }
223
223
  export interface SinkData {
224
- logs: RunLogEntry[];
225
224
  tables: SinkTable[];
225
+ logs: RunLogEntry[];
226
226
  }