@xano/cli 0.0.95-beta.9 → 1.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.
Files changed (240) hide show
  1. package/README.md +111 -70
  2. package/dist/base-command.d.ts +16 -1
  3. package/dist/base-command.js +57 -5
  4. package/dist/commands/auth/index.d.ts +1 -0
  5. package/dist/commands/auth/index.js +15 -10
  6. package/dist/commands/branch/create/index.d.ts +4 -1
  7. package/dist/commands/branch/create/index.js +22 -21
  8. package/dist/commands/branch/delete/index.d.ts +1 -0
  9. package/dist/commands/branch/delete/index.js +1 -4
  10. package/dist/commands/branch/edit/index.d.ts +1 -0
  11. package/dist/commands/branch/edit/index.js +1 -4
  12. package/dist/commands/branch/get/index.d.ts +1 -0
  13. package/dist/commands/branch/get/index.js +1 -4
  14. package/dist/commands/branch/list/index.d.ts +2 -6
  15. package/dist/commands/branch/list/index.js +13 -17
  16. package/dist/commands/branch/set_live/index.d.ts +1 -0
  17. package/dist/commands/branch/set_live/index.js +1 -4
  18. package/dist/commands/function/create/index.d.ts +1 -0
  19. package/dist/commands/function/create/index.js +1 -2
  20. package/dist/commands/function/edit/index.d.ts +1 -0
  21. package/dist/commands/function/edit/index.js +1 -2
  22. package/dist/commands/function/get/index.d.ts +1 -0
  23. package/dist/commands/function/get/index.js +1 -4
  24. package/dist/commands/function/list/index.d.ts +1 -0
  25. package/dist/commands/function/list/index.js +1 -4
  26. package/dist/commands/platform/get/index.d.ts +1 -0
  27. package/dist/commands/platform/get/index.js +1 -4
  28. package/dist/commands/platform/list/index.d.ts +1 -0
  29. package/dist/commands/platform/list/index.js +1 -4
  30. package/dist/commands/profile/create/index.d.ts +1 -0
  31. package/dist/commands/profile/create/index.js +10 -4
  32. package/dist/commands/profile/delete/index.d.ts +1 -0
  33. package/dist/commands/profile/delete/index.js +8 -4
  34. package/dist/commands/profile/edit/index.d.ts +1 -0
  35. package/dist/commands/profile/edit/index.js +1 -4
  36. package/dist/commands/profile/get/index.d.ts +3 -0
  37. package/dist/commands/profile/get/index.js +12 -5
  38. package/dist/commands/profile/list/index.d.ts +1 -0
  39. package/dist/commands/profile/list/index.js +8 -4
  40. package/dist/commands/profile/me/index.d.ts +1 -0
  41. package/dist/commands/profile/me/index.js +1 -4
  42. package/dist/commands/profile/set/index.d.ts +3 -0
  43. package/dist/commands/profile/set/index.js +12 -6
  44. package/dist/commands/profile/token/index.d.ts +3 -0
  45. package/dist/commands/profile/token/index.js +12 -5
  46. package/dist/commands/profile/wizard/index.d.ts +1 -0
  47. package/dist/commands/profile/wizard/index.js +13 -9
  48. package/dist/commands/profile/workspace/index.d.ts +3 -0
  49. package/dist/commands/profile/workspace/index.js +12 -5
  50. package/dist/commands/profile/workspace/set/index.d.ts +1 -0
  51. package/dist/commands/profile/workspace/set/index.js +1 -3
  52. package/dist/commands/release/create/index.d.ts +4 -1
  53. package/dist/commands/release/create/index.js +12 -14
  54. package/dist/commands/release/delete/index.d.ts +1 -0
  55. package/dist/commands/release/delete/index.js +1 -4
  56. package/dist/commands/release/deploy/index.d.ts +3 -0
  57. package/dist/commands/release/deploy/index.js +31 -1
  58. package/dist/commands/release/edit/index.d.ts +1 -0
  59. package/dist/commands/release/edit/index.js +1 -4
  60. package/dist/commands/release/export/index.d.ts +1 -0
  61. package/dist/commands/release/export/index.js +1 -3
  62. package/dist/commands/release/get/index.d.ts +1 -0
  63. package/dist/commands/release/get/index.js +1 -4
  64. package/dist/commands/release/import/index.d.ts +1 -0
  65. package/dist/commands/release/import/index.js +1 -3
  66. package/dist/commands/release/list/index.d.ts +1 -0
  67. package/dist/commands/release/list/index.js +1 -4
  68. package/dist/commands/release/pull/index.d.ts +2 -3
  69. package/dist/commands/release/pull/index.js +19 -18
  70. package/dist/commands/release/push/index.d.ts +2 -3
  71. package/dist/commands/release/push/index.js +19 -22
  72. package/dist/commands/sandbox/delete/index.d.ts +13 -0
  73. package/dist/commands/sandbox/delete/index.js +71 -0
  74. package/dist/commands/sandbox/env/delete/index.d.ts +1 -0
  75. package/dist/commands/sandbox/env/delete/index.js +4 -2
  76. package/dist/commands/sandbox/env/get/index.d.ts +1 -0
  77. package/dist/commands/sandbox/env/get/index.js +4 -2
  78. package/dist/commands/sandbox/env/get_all/index.d.ts +1 -0
  79. package/dist/commands/sandbox/env/get_all/index.js +4 -2
  80. package/dist/commands/sandbox/env/list/index.d.ts +1 -0
  81. package/dist/commands/sandbox/env/list/index.js +4 -2
  82. package/dist/commands/sandbox/env/set/index.d.ts +1 -0
  83. package/dist/commands/sandbox/env/set/index.js +4 -2
  84. package/dist/commands/sandbox/env/set_all/index.d.ts +1 -0
  85. package/dist/commands/sandbox/env/set_all/index.js +4 -2
  86. package/dist/commands/sandbox/get/index.d.ts +1 -0
  87. package/dist/commands/sandbox/get/index.js +2 -0
  88. package/dist/commands/sandbox/license/get/index.d.ts +1 -0
  89. package/dist/commands/sandbox/license/get/index.js +4 -2
  90. package/dist/commands/sandbox/license/set/index.d.ts +1 -0
  91. package/dist/commands/sandbox/license/set/index.js +4 -2
  92. package/dist/commands/sandbox/pull/index.d.ts +2 -3
  93. package/dist/commands/sandbox/pull/index.js +19 -14
  94. package/dist/commands/sandbox/push/index.d.ts +12 -4
  95. package/dist/commands/sandbox/push/index.js +150 -95
  96. package/dist/commands/sandbox/reset/index.d.ts +1 -0
  97. package/dist/commands/sandbox/reset/index.js +4 -2
  98. package/dist/commands/sandbox/review/index.d.ts +1 -0
  99. package/dist/commands/sandbox/review/index.js +4 -2
  100. package/dist/commands/sandbox/unit_test/list/index.d.ts +1 -0
  101. package/dist/commands/sandbox/unit_test/list/index.js +4 -2
  102. package/dist/commands/sandbox/unit_test/run/index.d.ts +1 -0
  103. package/dist/commands/sandbox/unit_test/run/index.js +4 -2
  104. package/dist/commands/sandbox/unit_test/run_all/index.d.ts +1 -0
  105. package/dist/commands/sandbox/unit_test/run_all/index.js +4 -0
  106. package/dist/commands/sandbox/workflow_test/list/index.d.ts +1 -0
  107. package/dist/commands/sandbox/workflow_test/list/index.js +4 -2
  108. package/dist/commands/sandbox/workflow_test/run/index.d.ts +1 -0
  109. package/dist/commands/sandbox/workflow_test/run/index.js +4 -2
  110. package/dist/commands/sandbox/workflow_test/run_all/index.d.ts +1 -0
  111. package/dist/commands/sandbox/workflow_test/run_all/index.js +4 -0
  112. package/dist/commands/static_host/build/create/index.d.ts +1 -0
  113. package/dist/commands/static_host/build/create/index.js +1 -3
  114. package/dist/commands/static_host/build/get/index.d.ts +1 -0
  115. package/dist/commands/static_host/build/get/index.js +1 -4
  116. package/dist/commands/static_host/build/list/index.d.ts +1 -0
  117. package/dist/commands/static_host/build/list/index.js +1 -4
  118. package/dist/commands/static_host/list/index.d.ts +1 -0
  119. package/dist/commands/static_host/list/index.js +1 -4
  120. package/dist/commands/tenant/backup/create/index.d.ts +1 -0
  121. package/dist/commands/tenant/backup/create/index.js +1 -4
  122. package/dist/commands/tenant/backup/delete/index.d.ts +1 -0
  123. package/dist/commands/tenant/backup/delete/index.js +1 -4
  124. package/dist/commands/tenant/backup/export/index.d.ts +1 -0
  125. package/dist/commands/tenant/backup/export/index.js +1 -3
  126. package/dist/commands/tenant/backup/import/index.d.ts +1 -0
  127. package/dist/commands/tenant/backup/import/index.js +1 -3
  128. package/dist/commands/tenant/backup/list/index.d.ts +1 -0
  129. package/dist/commands/tenant/backup/list/index.js +1 -4
  130. package/dist/commands/tenant/backup/restore/index.d.ts +1 -0
  131. package/dist/commands/tenant/backup/restore/index.js +1 -4
  132. package/dist/commands/tenant/cluster/create/index.d.ts +1 -0
  133. package/dist/commands/tenant/cluster/create/index.js +1 -3
  134. package/dist/commands/tenant/cluster/delete/index.d.ts +1 -0
  135. package/dist/commands/tenant/cluster/delete/index.js +1 -4
  136. package/dist/commands/tenant/cluster/edit/index.d.ts +1 -0
  137. package/dist/commands/tenant/cluster/edit/index.js +1 -4
  138. package/dist/commands/tenant/cluster/get/index.d.ts +1 -0
  139. package/dist/commands/tenant/cluster/get/index.js +1 -4
  140. package/dist/commands/tenant/cluster/license/get/index.d.ts +1 -0
  141. package/dist/commands/tenant/cluster/license/get/index.js +1 -3
  142. package/dist/commands/tenant/cluster/license/set/index.d.ts +1 -0
  143. package/dist/commands/tenant/cluster/license/set/index.js +1 -3
  144. package/dist/commands/tenant/cluster/list/index.d.ts +1 -0
  145. package/dist/commands/tenant/cluster/list/index.js +1 -4
  146. package/dist/commands/tenant/create/index.d.ts +1 -0
  147. package/dist/commands/tenant/create/index.js +1 -3
  148. package/dist/commands/tenant/delete/index.d.ts +1 -0
  149. package/dist/commands/tenant/delete/index.js +1 -4
  150. package/dist/commands/tenant/deploy_platform/index.d.ts +1 -0
  151. package/dist/commands/tenant/deploy_platform/index.js +1 -3
  152. package/dist/commands/tenant/deploy_release/index.d.ts +1 -0
  153. package/dist/commands/tenant/deploy_release/index.js +1 -4
  154. package/dist/commands/tenant/edit/index.d.ts +1 -0
  155. package/dist/commands/tenant/edit/index.js +1 -4
  156. package/dist/commands/tenant/env/delete/index.d.ts +1 -0
  157. package/dist/commands/tenant/env/delete/index.js +1 -4
  158. package/dist/commands/tenant/env/get/index.d.ts +1 -0
  159. package/dist/commands/tenant/env/get/index.js +1 -4
  160. package/dist/commands/tenant/env/get_all/index.d.ts +1 -0
  161. package/dist/commands/tenant/env/get_all/index.js +1 -3
  162. package/dist/commands/tenant/env/list/index.d.ts +1 -0
  163. package/dist/commands/tenant/env/list/index.js +1 -4
  164. package/dist/commands/tenant/env/set/index.d.ts +1 -0
  165. package/dist/commands/tenant/env/set/index.js +1 -4
  166. package/dist/commands/tenant/env/set_all/index.d.ts +1 -0
  167. package/dist/commands/tenant/env/set_all/index.js +1 -3
  168. package/dist/commands/tenant/get/index.d.ts +1 -0
  169. package/dist/commands/tenant/get/index.js +1 -4
  170. package/dist/commands/tenant/impersonate/index.d.ts +1 -0
  171. package/dist/commands/tenant/impersonate/index.js +1 -4
  172. package/dist/commands/tenant/license/get/index.d.ts +1 -0
  173. package/dist/commands/tenant/license/get/index.js +1 -3
  174. package/dist/commands/tenant/license/set/index.d.ts +1 -0
  175. package/dist/commands/tenant/license/set/index.js +1 -3
  176. package/dist/commands/tenant/list/index.d.ts +1 -0
  177. package/dist/commands/tenant/list/index.js +1 -4
  178. package/dist/commands/tenant/pull/index.d.ts +2 -3
  179. package/dist/commands/tenant/pull/index.js +20 -21
  180. package/dist/commands/tenant/push/index.d.ts +2 -22
  181. package/dist/commands/tenant/push/index.js +7 -225
  182. package/dist/commands/tenant/unit_test/list/index.d.ts +1 -0
  183. package/dist/commands/tenant/unit_test/list/index.js +2 -27
  184. package/dist/commands/tenant/unit_test/run/index.d.ts +1 -0
  185. package/dist/commands/tenant/unit_test/run/index.js +2 -27
  186. package/dist/commands/tenant/unit_test/run_all/index.d.ts +1 -0
  187. package/dist/commands/tenant/unit_test/run_all/index.js +2 -27
  188. package/dist/commands/tenant/workflow_test/list/index.d.ts +1 -0
  189. package/dist/commands/tenant/workflow_test/list/index.js +2 -27
  190. package/dist/commands/tenant/workflow_test/run/index.d.ts +1 -0
  191. package/dist/commands/tenant/workflow_test/run/index.js +2 -27
  192. package/dist/commands/tenant/workflow_test/run_all/index.d.ts +1 -0
  193. package/dist/commands/tenant/workflow_test/run_all/index.js +2 -27
  194. package/dist/commands/unit_test/list/index.d.ts +1 -0
  195. package/dist/commands/unit_test/list/index.js +1 -4
  196. package/dist/commands/unit_test/run/index.d.ts +1 -0
  197. package/dist/commands/unit_test/run/index.js +1 -4
  198. package/dist/commands/unit_test/run_all/index.d.ts +1 -0
  199. package/dist/commands/unit_test/run_all/index.js +1 -4
  200. package/dist/commands/update/index.d.ts +1 -0
  201. package/dist/commands/workflow_test/delete/index.d.ts +1 -0
  202. package/dist/commands/workflow_test/delete/index.js +1 -4
  203. package/dist/commands/workflow_test/get/index.d.ts +1 -0
  204. package/dist/commands/workflow_test/get/index.js +1 -4
  205. package/dist/commands/workflow_test/list/index.d.ts +1 -0
  206. package/dist/commands/workflow_test/list/index.js +1 -4
  207. package/dist/commands/workflow_test/run/index.d.ts +1 -0
  208. package/dist/commands/workflow_test/run/index.js +1 -4
  209. package/dist/commands/workflow_test/run_all/index.d.ts +1 -0
  210. package/dist/commands/workflow_test/run_all/index.js +1 -4
  211. package/dist/commands/workspace/create/index.d.ts +1 -0
  212. package/dist/commands/workspace/create/index.js +1 -4
  213. package/dist/commands/workspace/delete/index.d.ts +2 -6
  214. package/dist/commands/workspace/delete/index.js +17 -16
  215. package/dist/commands/workspace/edit/index.d.ts +2 -6
  216. package/dist/commands/workspace/edit/index.js +16 -20
  217. package/dist/commands/workspace/get/index.d.ts +2 -6
  218. package/dist/commands/workspace/get/index.js +14 -18
  219. package/dist/commands/workspace/git/pull/index.d.ts +2 -3
  220. package/dist/commands/workspace/git/pull/index.js +18 -17
  221. package/dist/commands/workspace/list/index.d.ts +1 -0
  222. package/dist/commands/workspace/list/index.js +1 -4
  223. package/dist/commands/workspace/pull/index.d.ts +2 -3
  224. package/dist/commands/workspace/pull/index.js +21 -24
  225. package/dist/commands/workspace/push/index.d.ts +7 -16
  226. package/dist/commands/workspace/push/index.js +85 -700
  227. package/dist/utils/multidoc-push.d.ts +63 -0
  228. package/dist/utils/multidoc-push.js +690 -0
  229. package/dist/utils/reference-checker.d.ts +57 -0
  230. package/dist/utils/reference-checker.js +232 -0
  231. package/oclif.manifest.json +3562 -2647
  232. package/package.json +1 -1
  233. package/dist/commands/sandbox/workflow_test/delete/index.d.ts +0 -17
  234. package/dist/commands/sandbox/workflow_test/delete/index.js +0 -59
  235. package/dist/commands/sandbox/workflow_test/get/index.d.ts +0 -17
  236. package/dist/commands/sandbox/workflow_test/get/index.js +0 -58
  237. package/dist/commands/tenant/workflow_test/delete/index.d.ts +0 -19
  238. package/dist/commands/tenant/workflow_test/delete/index.js +0 -110
  239. package/dist/commands/tenant/workflow_test/get/index.d.ts +0 -19
  240. package/dist/commands/tenant/workflow_test/get/index.js +0 -112
@@ -1,43 +1,41 @@
1
- import { Args, Flags } from '@oclif/core';
1
+ import { Flags } from '@oclif/core';
2
2
  import * as yaml from 'js-yaml';
3
3
  import * as fs from 'node:fs';
4
- import * as os from 'node:os';
5
4
  import * as path from 'node:path';
6
5
  import BaseCommand from '../../../base-command.js';
7
6
  import { findFilesWithGuid } from '../../../utils/document-parser.js';
8
7
  export default class ReleasePush extends BaseCommand {
9
- static args = {
10
- directory: Args.string({
11
- description: 'Directory containing .xs documents to create the release from',
12
- required: true,
13
- }),
14
- };
15
8
  static description = 'Create a new release from local XanoScript files via the multidoc endpoint';
16
9
  static examples = [
17
- `$ xano release push ./my-release -n "v1.0"
18
- Created release: v1.0 - ID: 10
10
+ `$ xano release push -n "v1.0"
11
+ Created release: v1.0 - ID: 10 (from current directory)
19
12
  `,
20
- `$ xano release push ./output -n "v2.0" -w 40 -d "Major update"
13
+ `$ xano release push -d ./output -n "v2.0" -w 40 --description "Major update"
21
14
  Created release: v2.0 - ID: 15
22
15
  `,
23
- `$ xano release push ./backup -n "v1.1-hotfix" --hotfix --profile production
16
+ `$ xano release push -d ./backup -n "v1.1-hotfix" --hotfix --profile production
24
17
  Created release: v1.1-hotfix - ID: 20
25
18
  `,
26
- `$ xano release push ./my-release -n "v1.0" --no-records --no-env
19
+ `$ xano release push -n "v1.0" --no-records --no-env
27
20
  Create release from schema only, skip records and environment variables
28
21
  `,
29
- `$ xano release push ./my-release -n "v1.0" -o json
22
+ `$ xano release push -n "v1.0" -o json
30
23
  Output release details as JSON
31
24
  `,
32
25
  ];
33
26
  static flags = {
34
27
  ...BaseCommand.baseFlags,
35
28
  description: Flags.string({
36
- char: 'd',
37
29
  default: '',
38
30
  description: 'Release description',
39
31
  required: false,
40
32
  }),
33
+ directory: Flags.string({
34
+ char: 'd',
35
+ default: '.',
36
+ description: 'Directory containing .xs documents to create the release from (defaults to current directory)',
37
+ required: false,
38
+ }),
41
39
  env: Flags.boolean({
42
40
  allowNo: true,
43
41
  default: true,
@@ -74,7 +72,7 @@ Output release details as JSON
74
72
  }),
75
73
  };
76
74
  async run() {
77
- const { args, flags } = await this.parse(ReleasePush);
75
+ const { flags } = await this.parse(ReleasePush);
78
76
  // Get profile name (default or from flag/env)
79
77
  const profileName = flags.profile || this.getDefaultProfile();
80
78
  // Load credentials
@@ -102,11 +100,11 @@ Output release details as JSON
102
100
  }
103
101
  else {
104
102
  this.error(`Workspace ID is required. Either:\n` +
105
- ` 1. Provide it as a flag: xano release push <directory> -n <name> -w <workspace_id>\n` +
103
+ ` 1. Provide it as a flag: xano release push -n <name> -w <workspace_id>\n` +
106
104
  ` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
107
105
  }
108
106
  // Resolve the input directory
109
- const inputDir = path.resolve(args.directory);
107
+ const inputDir = path.resolve(flags.directory);
110
108
  if (!fs.existsSync(inputDir)) {
111
109
  this.error(`Directory not found: ${inputDir}`);
112
110
  }
@@ -116,7 +114,7 @@ Output release details as JSON
116
114
  // Collect all .xs files from the directory tree
117
115
  const files = this.collectFiles(inputDir);
118
116
  if (files.length === 0) {
119
- this.error(`No .xs files found in ${args.directory}`);
117
+ this.error(`No .xs files found in ${flags.directory}`);
120
118
  }
121
119
  // Read each file and track file path alongside content
122
120
  const documentEntries = [];
@@ -127,7 +125,7 @@ Output release details as JSON
127
125
  }
128
126
  }
129
127
  if (documentEntries.length === 0) {
130
- this.error(`All .xs files in ${args.directory} are empty`);
128
+ this.error(`All .xs files in ${flags.directory} are empty`);
131
129
  }
132
130
  const multidoc = documentEntries.map((d) => d.content).join('\n---\n');
133
131
  // Construct the API URL with query params
@@ -221,8 +219,7 @@ Output release details as JSON
221
219
  return files.sort();
222
220
  }
223
221
  loadCredentials() {
224
- const configDir = path.join(os.homedir(), '.xano');
225
- const credentialsPath = path.join(configDir, 'credentials.yaml');
222
+ const credentialsPath = this.getCredentialsPath();
226
223
  // Check if credentials file exists
227
224
  if (!fs.existsSync(credentialsPath)) {
228
225
  this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
@@ -0,0 +1,13 @@
1
+ import BaseCommand from '../../../base-command.js';
2
+ export default class SandboxDelete extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {
6
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ run(): Promise<void>;
12
+ private confirm;
13
+ }
@@ -0,0 +1,71 @@
1
+ import { Flags } from '@oclif/core';
2
+ import BaseCommand from '../../../base-command.js';
3
+ export default class SandboxDelete extends BaseCommand {
4
+ static description = 'Delete your sandbox environment completely (debugging only — it will be re-created on next access)';
5
+ static examples = [
6
+ `$ xano sandbox delete
7
+ Are you sure you want to DELETE your sandbox environment? This destroys all data. (y/N) y
8
+ Sandbox environment deleted.
9
+ `,
10
+ `$ xano sandbox delete --force`,
11
+ ];
12
+ static flags = {
13
+ ...BaseCommand.baseFlags,
14
+ force: Flags.boolean({
15
+ char: 'f',
16
+ default: false,
17
+ description: 'Skip confirmation prompt',
18
+ required: false,
19
+ }),
20
+ };
21
+ async run() {
22
+ const { flags } = await this.parse(SandboxDelete);
23
+ const { profile } = this.resolveProfile(flags);
24
+ if (!flags.force) {
25
+ const confirmed = await this.confirm(`Are you sure you want to DELETE your sandbox environment? This destroys all data and the tenant will be re-created on next access.`);
26
+ if (!confirmed) {
27
+ this.log('Delete cancelled.');
28
+ return;
29
+ }
30
+ }
31
+ const apiUrl = `${profile.instance_origin}/api:meta/sandbox/me`;
32
+ try {
33
+ const response = await this.verboseFetch(apiUrl, {
34
+ headers: {
35
+ accept: 'application/json',
36
+ Authorization: `Bearer ${profile.access_token}`,
37
+ 'Content-Type': 'application/json',
38
+ },
39
+ method: 'DELETE',
40
+ }, flags.verbose, profile.access_token);
41
+ if (!response.ok) {
42
+ const message = await this.parseApiError(response, 'Failed to delete sandbox environment');
43
+ this.error(message);
44
+ }
45
+ this.log('Sandbox environment deleted.');
46
+ }
47
+ catch (error) {
48
+ if (error instanceof Error && 'oclif' in error)
49
+ throw error;
50
+ if (error instanceof Error) {
51
+ this.error(`Failed to delete sandbox environment: ${error.message}`);
52
+ }
53
+ else {
54
+ this.error(`Failed to delete sandbox environment: ${String(error)}`);
55
+ }
56
+ }
57
+ }
58
+ async confirm(message) {
59
+ const readline = await import('node:readline');
60
+ const rl = readline.createInterface({
61
+ input: process.stdin,
62
+ output: process.stdout,
63
+ });
64
+ return new Promise((resolve) => {
65
+ rl.question(`${message} (y/N) `, (answer) => {
66
+ rl.close();
67
+ resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
68
+ });
69
+ });
70
+ }
71
+ }
@@ -6,6 +6,7 @@ export default class SandboxEnvDelete extends BaseCommand {
6
6
  force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
8
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
@@ -52,8 +52,8 @@ Environment variable 'DATABASE_URL' deleted
52
52
  method: 'DELETE',
53
53
  }, flags.verbose, profile.access_token);
54
54
  if (!response.ok) {
55
- const errorText = await response.text();
56
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
55
+ const message = await this.parseApiError(response, 'API request failed');
56
+ this.error(message);
57
57
  }
58
58
  if (flags.output === 'json') {
59
59
  this.log(JSON.stringify({ deleted: true, env_name: envName }, null, 2));
@@ -63,6 +63,8 @@ Environment variable 'DATABASE_URL' deleted
63
63
  }
64
64
  }
65
65
  catch (error) {
66
+ if (error instanceof Error && 'oclif' in error)
67
+ throw error;
66
68
  if (error instanceof Error) {
67
69
  this.error(`Failed to delete sandbox environment variable: ${error.message}`);
68
70
  }
@@ -5,6 +5,7 @@ export default class SandboxEnvGet extends BaseCommand {
5
5
  static flags: {
6
6
  name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
7
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
11
  };
@@ -37,8 +37,8 @@ postgres://localhost:5432/mydb
37
37
  method: 'GET',
38
38
  }, flags.verbose, profile.access_token);
39
39
  if (!response.ok) {
40
- const errorText = await response.text();
41
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
40
+ const message = await this.parseApiError(response, 'API request failed');
41
+ this.error(message);
42
42
  }
43
43
  const envVar = (await response.json());
44
44
  if (flags.output === 'json') {
@@ -52,6 +52,8 @@ postgres://localhost:5432/mydb
52
52
  }
53
53
  }
54
54
  catch (error) {
55
+ if (error instanceof Error && 'oclif' in error)
56
+ throw error;
55
57
  if (error instanceof Error) {
56
58
  this.error(`Failed to get sandbox environment variable: ${error.message}`);
57
59
  }
@@ -6,6 +6,7 @@ export default class SandboxEnvGetAll extends BaseCommand {
6
6
  file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
7
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
8
  view: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
@@ -46,8 +46,8 @@ Environment variables saved to env_<tenant>.yaml
46
46
  method: 'GET',
47
47
  }, flags.verbose, profile.access_token);
48
48
  if (!response.ok) {
49
- const errorText = await response.text();
50
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
49
+ const message = await this.parseApiError(response, 'API request failed');
50
+ this.error(message);
51
51
  }
52
52
  const envMap = (await response.json());
53
53
  if (flags.output === 'json') {
@@ -65,6 +65,8 @@ Environment variables saved to env_<tenant>.yaml
65
65
  }
66
66
  }
67
67
  catch (error) {
68
+ if (error instanceof Error && 'oclif' in error)
69
+ throw error;
68
70
  if (error instanceof Error) {
69
71
  this.error(`Failed to get sandbox environment variables: ${error.message}`);
70
72
  }
@@ -4,6 +4,7 @@ export default class SandboxEnvList extends BaseCommand {
4
4
  static examples: string[];
5
5
  static flags: {
6
6
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  };
@@ -33,8 +33,8 @@ Environment variables for sandbox environment:
33
33
  method: 'GET',
34
34
  }, flags.verbose, profile.access_token);
35
35
  if (!response.ok) {
36
- const errorText = await response.text();
37
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
36
+ const message = await this.parseApiError(response, 'API request failed');
37
+ this.error(message);
38
38
  }
39
39
  const data = (await response.json());
40
40
  if (flags.output === 'json') {
@@ -54,6 +54,8 @@ Environment variables for sandbox environment:
54
54
  }
55
55
  }
56
56
  catch (error) {
57
+ if (error instanceof Error && 'oclif' in error)
58
+ throw error;
57
59
  if (error instanceof Error) {
58
60
  this.error(`Failed to list sandbox environment variables: ${error.message}`);
59
61
  }
@@ -6,6 +6,7 @@ export default class SandboxEnvSet extends BaseCommand {
6
6
  name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
7
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
8
  value: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
@@ -49,8 +49,8 @@ Environment variable 'DATABASE_URL' set
49
49
  method: 'PATCH',
50
50
  }, flags.verbose, profile.access_token);
51
51
  if (!response.ok) {
52
- const errorText = await response.text();
53
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
52
+ const message = await this.parseApiError(response, 'API request failed');
53
+ this.error(message);
54
54
  }
55
55
  if (flags.output === 'json') {
56
56
  const result = await response.json();
@@ -61,6 +61,8 @@ Environment variable 'DATABASE_URL' set
61
61
  }
62
62
  }
63
63
  catch (error) {
64
+ if (error instanceof Error && 'oclif' in error)
65
+ throw error;
64
66
  if (error instanceof Error) {
65
67
  this.error(`Failed to set sandbox environment variable: ${error.message}`);
66
68
  }
@@ -6,6 +6,7 @@ export default class SandboxEnvSetAll extends BaseCommand {
6
6
  clean: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
7
  file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
@@ -57,8 +57,8 @@ Reads from env_<tenant>.yaml
57
57
  method: 'PUT',
58
58
  }, flags.verbose, profile.access_token);
59
59
  if (!response.ok) {
60
- const errorText = await response.text();
61
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
60
+ const message = await this.parseApiError(response, 'API request failed');
61
+ this.error(message);
62
62
  }
63
63
  if (flags.output === 'json') {
64
64
  const result = await response.json();
@@ -73,6 +73,8 @@ Reads from env_<tenant>.yaml
73
73
  }
74
74
  }
75
75
  catch (error) {
76
+ if (error instanceof Error && 'oclif' in error)
77
+ throw error;
76
78
  if (error instanceof Error) {
77
79
  this.error(`Failed to set sandbox environment variables: ${error.message}`);
78
80
  }
@@ -4,6 +4,7 @@ export default class SandboxGet extends BaseCommand {
4
4
  static examples: string[];
5
5
  static flags: {
6
6
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  };
@@ -50,6 +50,8 @@ Sandbox Environment: (tc24-abcd-x1y2)
50
50
  }
51
51
  }
52
52
  catch (error) {
53
+ if (error instanceof Error && 'oclif' in error)
54
+ throw error;
53
55
  if (error instanceof Error) {
54
56
  this.error(`Failed to get sandbox environment: ${error.message}`);
55
57
  }
@@ -6,6 +6,7 @@ export default class SandboxLicenseGet extends BaseCommand {
6
6
  file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
7
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
8
  view: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
12
  };
@@ -45,8 +45,8 @@ License saved to license_<tenant>.yaml
45
45
  method: 'GET',
46
46
  }, flags.verbose, profile.access_token);
47
47
  if (!response.ok) {
48
- const errorText = await response.text();
49
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
48
+ const message = await this.parseApiError(response, 'API request failed');
49
+ this.error(message);
50
50
  }
51
51
  const license = await response.json();
52
52
  const licenseContent = typeof license === 'string' ? license : JSON.stringify(license, null, 2);
@@ -65,6 +65,8 @@ License saved to license_<tenant>.yaml
65
65
  }
66
66
  }
67
67
  catch (error) {
68
+ if (error instanceof Error && 'oclif' in error)
69
+ throw error;
68
70
  if (error instanceof Error) {
69
71
  this.error(`Failed to get sandbox environment license: ${error.message}`);
70
72
  }
@@ -7,6 +7,7 @@ export default class SandboxLicenseSet extends BaseCommand {
7
7
  file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
8
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
9
  value: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
11
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
12
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
13
  };
@@ -66,8 +66,8 @@ Reads from license_<tenant>.yaml
66
66
  method: 'POST',
67
67
  }, flags.verbose, profile.access_token);
68
68
  if (!response.ok) {
69
- const errorText = await response.text();
70
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
69
+ const message = await this.parseApiError(response, 'API request failed');
70
+ this.error(message);
71
71
  }
72
72
  const result = await response.json();
73
73
  if (flags.output === 'json') {
@@ -82,6 +82,8 @@ Reads from license_<tenant>.yaml
82
82
  }
83
83
  }
84
84
  catch (error) {
85
+ if (error instanceof Error && 'oclif' in error)
86
+ throw error;
85
87
  if (error instanceof Error) {
86
88
  this.error(`Failed to set sandbox environment license: ${error.message}`);
87
89
  }
@@ -1,14 +1,13 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
2
  export default class SandboxPull extends BaseCommand {
3
- static args: {
4
- directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
3
  static description: string;
7
4
  static examples: string[];
8
5
  static flags: {
6
+ directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
7
  draft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
8
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
9
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
11
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
12
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
13
  };
@@ -1,25 +1,28 @@
1
- import { Args, Flags } from '@oclif/core';
1
+ import { Flags } from '@oclif/core';
2
2
  import snakeCase from 'lodash.snakecase';
3
3
  import BaseCommand from '../../../base-command.js';
4
4
  import { buildApiGroupFolderResolver, parseDocument } from '../../../utils/document-parser.js';
5
5
  import * as fs from 'node:fs';
6
6
  import * as path from 'node:path';
7
7
  export default class SandboxPull extends BaseCommand {
8
- static args = {
9
- directory: Args.string({
10
- description: 'Output directory for pulled documents',
11
- required: true,
12
- }),
13
- };
14
8
  static description = 'Pull documents from your sandbox environment and split into individual files';
15
9
  static examples = [
16
- `$ xano sandbox pull ./my-sandbox
10
+ `$ xano sandbox pull
11
+ Pulled 42 documents from sandbox environment to current directory
12
+ `,
13
+ `$ xano sandbox pull -d ./my-sandbox
17
14
  Pulled 42 documents from sandbox environment to ./my-sandbox
18
15
  `,
19
- `$ xano sandbox pull ./backup --env --records`,
16
+ `$ xano sandbox pull --env --records`,
20
17
  ];
21
18
  static flags = {
22
19
  ...BaseCommand.baseFlags,
20
+ directory: Flags.string({
21
+ char: 'd',
22
+ default: '.',
23
+ description: 'Output directory for pulled documents (defaults to current directory)',
24
+ required: false,
25
+ }),
23
26
  draft: Flags.boolean({
24
27
  default: false,
25
28
  description: 'Include draft versions',
@@ -37,7 +40,7 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
37
40
  }),
38
41
  };
39
42
  async run() {
40
- const { args, flags } = await this.parse(SandboxPull);
43
+ const { flags } = await this.parse(SandboxPull);
41
44
  const { profile } = this.resolveProfile(flags);
42
45
  const queryParams = new URLSearchParams({
43
46
  env: flags.env.toString(),
@@ -55,12 +58,14 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
55
58
  method: 'GET',
56
59
  }, flags.verbose, profile.access_token);
57
60
  if (!response.ok) {
58
- const errorText = await response.text();
59
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
61
+ const message = await this.parseApiError(response, 'API request failed');
62
+ this.error(message);
60
63
  }
61
64
  responseText = await response.text();
62
65
  }
63
66
  catch (error) {
67
+ if (error instanceof Error && 'oclif' in error)
68
+ throw error;
64
69
  if (error instanceof Error) {
65
70
  this.error(`Failed to fetch multidoc: ${error.message}`);
66
71
  }
@@ -84,7 +89,7 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
84
89
  this.log('No documents found in response');
85
90
  return;
86
91
  }
87
- const outputDir = path.resolve(args.directory);
92
+ const outputDir = path.resolve(flags.directory);
88
93
  fs.mkdirSync(outputDir, { recursive: true });
89
94
  const getApiGroupFolder = buildApiGroupFolderResolver(documents, snakeCase);
90
95
  const filenameCounters = new Map();
@@ -172,7 +177,7 @@ Pulled 42 documents from sandbox environment to ./my-sandbox
172
177
  fs.writeFileSync(filePath, doc.content, 'utf8');
173
178
  writtenCount++;
174
179
  }
175
- this.log(`Pulled ${writtenCount} documents from sandbox environment to ${args.directory}`);
180
+ this.log(`Pulled ${writtenCount} documents from sandbox environment to ${flags.directory}`);
176
181
  }
177
182
  sanitizeFilename(name) {
178
183
  return snakeCase(name.replaceAll('"', ''));
@@ -1,18 +1,26 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
2
  export default class SandboxPush extends BaseCommand {
3
- static args: {
4
- directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
3
  static description: string;
7
4
  static examples: string[];
8
5
  static flags: {
6
+ directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ 'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
9
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ guids: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ include: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
14
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ review: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ sync: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
17
  transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
18
  truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
+ config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
20
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
21
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
22
  };
16
23
  run(): Promise<void>;
17
- private collectFiles;
24
+ private openReview;
25
+ private getFrontendUrl;
18
26
  }