@xano/cli 0.0.31 → 0.0.32

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 (72) hide show
  1. package/dist/base-command.d.ts +5 -0
  2. package/dist/base-command.js +32 -1
  3. package/dist/commands/branch/create/index.js +3 -3
  4. package/dist/commands/branch/delete/index.js +2 -2
  5. package/dist/commands/branch/edit/index.js +3 -3
  6. package/dist/commands/branch/get/index.js +2 -2
  7. package/dist/commands/branch/list/index.js +2 -2
  8. package/dist/commands/branch/set-live/index.js +2 -2
  9. package/dist/commands/function/create/index.js +2 -2
  10. package/dist/commands/function/edit/index.js +2 -2
  11. package/dist/commands/function/get/index.js +2 -2
  12. package/dist/commands/function/list/index.js +2 -2
  13. package/dist/commands/platform/get/index.d.ts +18 -0
  14. package/dist/commands/platform/get/index.js +126 -0
  15. package/dist/commands/platform/list/index.d.ts +12 -0
  16. package/dist/commands/platform/list/index.js +113 -0
  17. package/dist/commands/profile/me/index.js +2 -2
  18. package/dist/commands/release/create/index.d.ts +18 -0
  19. package/dist/commands/release/create/index.js +138 -0
  20. package/dist/commands/release/delete/index.d.ts +21 -0
  21. package/dist/commands/release/delete/index.js +134 -0
  22. package/dist/commands/release/edit/index.d.ts +21 -0
  23. package/dist/commands/release/edit/index.js +137 -0
  24. package/dist/commands/release/export/index.d.ts +20 -0
  25. package/dist/commands/release/export/index.js +142 -0
  26. package/dist/commands/release/get/index.d.ts +19 -0
  27. package/dist/commands/release/get/index.js +123 -0
  28. package/dist/commands/release/import/index.d.ts +15 -0
  29. package/dist/commands/release/import/index.js +114 -0
  30. package/dist/commands/release/list/index.d.ts +13 -0
  31. package/dist/commands/release/list/index.js +120 -0
  32. package/dist/commands/static_host/build/create/index.js +2 -2
  33. package/dist/commands/static_host/build/get/index.js +2 -2
  34. package/dist/commands/static_host/build/list/index.js +2 -2
  35. package/dist/commands/static_host/list/index.js +2 -2
  36. package/dist/commands/tenant/backup/create/index.d.ts +20 -0
  37. package/dist/commands/tenant/backup/create/index.js +113 -0
  38. package/dist/commands/tenant/backup/delete/index.d.ts +22 -0
  39. package/dist/commands/tenant/backup/delete/index.js +137 -0
  40. package/dist/commands/tenant/backup/export/index.d.ts +21 -0
  41. package/dist/commands/tenant/backup/export/index.js +147 -0
  42. package/dist/commands/tenant/backup/import/index.d.ts +21 -0
  43. package/dist/commands/tenant/backup/import/index.js +127 -0
  44. package/dist/commands/tenant/backup/list/index.d.ts +20 -0
  45. package/dist/commands/tenant/backup/list/index.js +137 -0
  46. package/dist/commands/tenant/backup/restore/index.d.ts +22 -0
  47. package/dist/commands/tenant/backup/restore/index.js +141 -0
  48. package/dist/commands/tenant/create/index.d.ts +21 -0
  49. package/dist/commands/tenant/create/index.js +155 -0
  50. package/dist/commands/tenant/delete/index.d.ts +21 -0
  51. package/dist/commands/tenant/delete/index.js +134 -0
  52. package/dist/commands/tenant/deploy-platform/index.d.ts +20 -0
  53. package/dist/commands/tenant/deploy-platform/index.js +116 -0
  54. package/dist/commands/tenant/deploy-release/index.d.ts +20 -0
  55. package/dist/commands/tenant/deploy-release/index.js +116 -0
  56. package/dist/commands/tenant/edit/index.d.ts +26 -0
  57. package/dist/commands/tenant/edit/index.js +167 -0
  58. package/dist/commands/tenant/get/index.d.ts +19 -0
  59. package/dist/commands/tenant/get/index.js +135 -0
  60. package/dist/commands/tenant/list/index.d.ts +13 -0
  61. package/dist/commands/tenant/list/index.js +123 -0
  62. package/dist/commands/workspace/create/index.js +3 -3
  63. package/dist/commands/workspace/delete/index.js +2 -2
  64. package/dist/commands/workspace/edit/index.js +3 -3
  65. package/dist/commands/workspace/get/index.js +2 -2
  66. package/dist/commands/workspace/list/index.js +2 -2
  67. package/dist/commands/workspace/pull/index.d.ts +1 -0
  68. package/dist/commands/workspace/pull/index.js +45 -10
  69. package/dist/commands/workspace/push/index.d.ts +3 -0
  70. package/dist/commands/workspace/push/index.js +41 -8
  71. package/oclif.manifest.json +3213 -1256
  72. package/package.json +10 -1
@@ -71,13 +71,13 @@ Workspace: my-workspace (ID: 123)
71
71
  const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}`;
72
72
  // Fetch workspace from the API
73
73
  try {
74
- const response = await fetch(apiUrl, {
74
+ const response = await this.verboseFetch(apiUrl, {
75
75
  headers: {
76
76
  'accept': 'application/json',
77
77
  'Authorization': `Bearer ${profile.access_token}`,
78
78
  },
79
79
  method: 'GET',
80
- });
80
+ }, flags.verbose, profile.access_token);
81
81
  if (!response.ok) {
82
82
  const errorText = await response.text();
83
83
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
@@ -76,13 +76,13 @@ Available workspaces:
76
76
  const apiUrl = `${profile.instance_origin}/api:meta/workspace`;
77
77
  // Fetch workspaces from the API
78
78
  try {
79
- const response = await fetch(apiUrl, {
79
+ const response = await this.verboseFetch(apiUrl, {
80
80
  headers: {
81
81
  'accept': 'application/json',
82
82
  'Authorization': `Bearer ${profile.access_token}`,
83
83
  },
84
84
  method: 'GET',
85
- });
85
+ }, flags.verbose, profile.access_token);
86
86
  if (!response.ok) {
87
87
  const errorText = await response.text();
88
88
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
@@ -8,6 +8,7 @@ export default class Pull extends BaseCommand {
8
8
  static flags: {
9
9
  branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
10
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ draft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
14
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -22,6 +22,9 @@ Pulled 15 documents to ./output
22
22
  `,
23
23
  `$ xano workspace pull ./backup --profile production --env --records
24
24
  Pulled 58 documents to ./backup
25
+ `,
26
+ `$ xano workspace pull ./my-workspace --draft
27
+ Pulled 42 documents to ./my-workspace
25
28
  `,
26
29
  `$ xano workspace pull ./my-workspace -b dev
27
30
  Pulled 42 documents to ./my-workspace
@@ -39,6 +42,11 @@ Pulled 42 documents to ./my-workspace
39
42
  description: 'Include environment variables',
40
43
  required: false,
41
44
  }),
45
+ draft: Flags.boolean({
46
+ default: false,
47
+ description: 'Include draft versions',
48
+ required: false,
49
+ }),
42
50
  records: Flags.boolean({
43
51
  default: false,
44
52
  description: 'Include records',
@@ -88,20 +96,22 @@ Pulled 42 documents to ./my-workspace
88
96
  const queryParams = new URLSearchParams({
89
97
  branch,
90
98
  env: flags.env.toString(),
99
+ include_draft: flags.draft.toString(),
91
100
  records: flags.records.toString(),
92
101
  });
93
102
  // Construct the API URL
94
103
  const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
95
104
  // Fetch multidoc from the API
96
105
  let responseText;
106
+ const requestHeaders = {
107
+ 'accept': 'application/json',
108
+ 'Authorization': `Bearer ${profile.access_token}`,
109
+ };
97
110
  try {
98
- const response = await fetch(apiUrl, {
99
- headers: {
100
- 'accept': 'application/json',
101
- 'Authorization': `Bearer ${profile.access_token}`,
102
- },
111
+ const response = await this.verboseFetch(apiUrl, {
112
+ headers: requestHeaders,
103
113
  method: 'GET',
104
- });
114
+ }, flags.verbose, profile.access_token);
105
115
  if (!response.ok) {
106
116
  const errorText = await response.text();
107
117
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
@@ -154,14 +164,29 @@ Pulled 42 documents to ./my-workspace
154
164
  typeDir = path.join(outputDir, 'workspace', 'trigger');
155
165
  baseName = this.sanitizeFilename(doc.name);
156
166
  }
167
+ else if (doc.type === 'agent') {
168
+ // agent → ai/agent/{name}.xs
169
+ typeDir = path.join(outputDir, 'ai', 'agent');
170
+ baseName = this.sanitizeFilename(doc.name);
171
+ }
172
+ else if (doc.type === 'mcp_server') {
173
+ // mcp_server → ai/mcp_server/{name}.xs
174
+ typeDir = path.join(outputDir, 'ai', 'mcp_server');
175
+ baseName = this.sanitizeFilename(doc.name);
176
+ }
177
+ else if (doc.type === 'tool') {
178
+ // tool → ai/tool/{name}.xs
179
+ typeDir = path.join(outputDir, 'ai', 'tool');
180
+ baseName = this.sanitizeFilename(doc.name);
181
+ }
157
182
  else if (doc.type === 'agent_trigger') {
158
- // agent_trigger → agent/trigger/{name}.xs
159
- typeDir = path.join(outputDir, 'agent', 'trigger');
183
+ // agent_trigger → ai/agent/trigger/{name}.xs
184
+ typeDir = path.join(outputDir, 'ai', 'agent', 'trigger');
160
185
  baseName = this.sanitizeFilename(doc.name);
161
186
  }
162
187
  else if (doc.type === 'mcp_server_trigger') {
163
- // mcp_server_trigger → mcp_server/trigger/{name}.xs
164
- typeDir = path.join(outputDir, 'mcp_server', 'trigger');
188
+ // mcp_server_trigger → ai/mcp_server/trigger/{name}.xs
189
+ typeDir = path.join(outputDir, 'ai', 'mcp_server', 'trigger');
165
190
  baseName = this.sanitizeFilename(doc.name);
166
191
  }
167
192
  else if (doc.type === 'table_trigger') {
@@ -169,6 +194,16 @@ Pulled 42 documents to ./my-workspace
169
194
  typeDir = path.join(outputDir, 'table', 'trigger');
170
195
  baseName = this.sanitizeFilename(doc.name);
171
196
  }
197
+ else if (doc.type === 'realtime_channel') {
198
+ // realtime_channel → realtime/channel/{name}.xs
199
+ typeDir = path.join(outputDir, 'realtime', 'channel');
200
+ baseName = this.sanitizeFilename(doc.name);
201
+ }
202
+ else if (doc.type === 'realtime_trigger') {
203
+ // realtime_trigger → realtime/trigger/{name}.xs
204
+ typeDir = path.join(outputDir, 'realtime', 'trigger');
205
+ baseName = this.sanitizeFilename(doc.name);
206
+ }
172
207
  else if (doc.type === 'api_group') {
173
208
  // api_group "test" → api/test/api_group.xs
174
209
  const groupFolder = snakeCase(doc.name);
@@ -7,6 +7,9 @@ export default class Push extends BaseCommand {
7
7
  static examples: string[];
8
8
  static flags: {
9
9
  branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
13
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
14
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
15
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
@@ -24,6 +24,21 @@ Pushed 58 documents from ./backup
24
24
  `,
25
25
  `$ xano workspace push ./my-workspace -b dev
26
26
  Pushed 42 documents from ./my-workspace
27
+ `,
28
+ `$ xano workspace push ./my-workspace --no-records
29
+ Push schema only, skip importing table records
30
+ `,
31
+ `$ xano workspace push ./my-workspace --no-env
32
+ Push without overwriting environment variables
33
+ `,
34
+ `$ xano workspace push ./my-workspace --truncate
35
+ Truncate all table records before importing
36
+ `,
37
+ `$ xano workspace push ./my-workspace --truncate --no-records
38
+ Truncate all table records without importing new ones
39
+ `,
40
+ `$ xano workspace push ./my-workspace --no-records --no-env
41
+ Push schema only, skip records and environment variables
27
42
  `,
28
43
  ];
29
44
  static flags = {
@@ -33,6 +48,23 @@ Pushed 42 documents from ./my-workspace
33
48
  description: 'Branch name (optional if set in profile, defaults to live)',
34
49
  required: false,
35
50
  }),
51
+ env: Flags.boolean({
52
+ allowNo: true,
53
+ default: true,
54
+ description: 'Include environment variables in import (default: true, use --no-env to exclude)',
55
+ required: false,
56
+ }),
57
+ records: Flags.boolean({
58
+ allowNo: true,
59
+ default: true,
60
+ description: 'Include records in import (default: true, use --no-records to exclude)',
61
+ required: false,
62
+ }),
63
+ truncate: Flags.boolean({
64
+ default: false,
65
+ description: 'Truncate all table records before importing',
66
+ required: false,
67
+ }),
36
68
  workspace: Flags.string({
37
69
  char: 'w',
38
70
  description: 'Workspace ID (optional if set in profile)',
@@ -99,19 +131,20 @@ Pushed 42 documents from ./my-workspace
99
131
  // Determine branch from flag or profile
100
132
  const branch = flags.branch || profile.branch || '';
101
133
  // Construct the API URL
102
- const queryParams = new URLSearchParams({ branch });
134
+ const queryParams = new URLSearchParams({ branch, env: flags.env.toString(), records: flags.records.toString(), truncate: flags.truncate.toString() });
103
135
  const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
104
136
  // POST the multidoc to the API
137
+ const requestHeaders = {
138
+ 'accept': 'application/json',
139
+ 'Authorization': `Bearer ${profile.access_token}`,
140
+ 'Content-Type': 'text/x-xanoscript',
141
+ };
105
142
  try {
106
- const response = await fetch(apiUrl, {
143
+ const response = await this.verboseFetch(apiUrl, {
107
144
  body: multidoc,
108
- headers: {
109
- 'accept': 'application/json',
110
- 'Authorization': `Bearer ${profile.access_token}`,
111
- 'Content-Type': 'text/x-xanoscript',
112
- },
145
+ headers: requestHeaders,
113
146
  method: 'POST',
114
- });
147
+ }, flags.verbose, profile.access_token);
115
148
  if (!response.ok) {
116
149
  const errorText = await response.text();
117
150
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);