@xano/cli 0.0.21 → 0.0.22

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 (107) hide show
  1. package/dist/base-command.d.ts +1 -1
  2. package/dist/base-command.js +6 -6
  3. package/dist/commands/branch/create/index.d.ts +17 -0
  4. package/dist/commands/branch/create/index.js +164 -0
  5. package/dist/commands/branch/delete/index.d.ts +18 -0
  6. package/dist/commands/branch/delete/index.js +156 -0
  7. package/dist/commands/branch/edit/index.d.ts +19 -0
  8. package/dist/commands/branch/edit/index.js +166 -0
  9. package/dist/commands/branch/get/index.d.ts +16 -0
  10. package/dist/commands/branch/get/index.js +135 -0
  11. package/dist/commands/branch/list/index.d.ts +18 -0
  12. package/dist/commands/branch/list/index.js +138 -0
  13. package/dist/commands/branch/set-live/index.d.ts +18 -0
  14. package/dist/commands/branch/set-live/index.js +155 -0
  15. package/dist/commands/function/create/index.d.ts +6 -6
  16. package/dist/commands/function/create/index.js +55 -55
  17. package/dist/commands/function/edit/index.d.ts +10 -10
  18. package/dist/commands/function/edit/index.js +155 -162
  19. package/dist/commands/function/get/index.d.ts +5 -5
  20. package/dist/commands/function/get/index.js +55 -60
  21. package/dist/commands/function/list/index.d.ts +5 -5
  22. package/dist/commands/function/list/index.js +52 -52
  23. package/dist/commands/profile/create/index.d.ts +6 -6
  24. package/dist/commands/profile/create/index.js +37 -37
  25. package/dist/commands/profile/delete/index.d.ts +2 -2
  26. package/dist/commands/profile/delete/index.js +9 -9
  27. package/dist/commands/profile/edit/index.d.ts +7 -7
  28. package/dist/commands/profile/edit/index.js +47 -47
  29. package/dist/commands/profile/get-default/index.js +1 -1
  30. package/dist/commands/profile/list/index.d.ts +2 -2
  31. package/dist/commands/profile/list/index.js +9 -9
  32. package/dist/commands/profile/me/index.d.ts +3 -3
  33. package/dist/commands/profile/me/index.js +21 -21
  34. package/dist/commands/profile/project/index.js +1 -1
  35. package/dist/commands/profile/set-default/index.js +1 -1
  36. package/dist/commands/profile/token/index.js +1 -1
  37. package/dist/commands/profile/wizard/index.d.ts +4 -4
  38. package/dist/commands/profile/wizard/index.js +118 -122
  39. package/dist/commands/run/env/delete/index.d.ts +2 -2
  40. package/dist/commands/run/env/delete/index.js +9 -9
  41. package/dist/commands/run/env/get/index.d.ts +2 -2
  42. package/dist/commands/run/env/get/index.js +10 -10
  43. package/dist/commands/run/env/list/index.d.ts +2 -2
  44. package/dist/commands/run/env/list/index.js +16 -18
  45. package/dist/commands/run/env/set/index.d.ts +2 -2
  46. package/dist/commands/run/env/set/index.js +4 -4
  47. package/dist/commands/run/exec/index.d.ts +11 -11
  48. package/dist/commands/run/exec/index.js +109 -109
  49. package/dist/commands/run/info/index.d.ts +4 -4
  50. package/dist/commands/run/info/index.js +26 -26
  51. package/dist/commands/run/projects/create/index.d.ts +3 -3
  52. package/dist/commands/run/projects/create/index.js +22 -22
  53. package/dist/commands/run/projects/delete/index.d.ts +2 -2
  54. package/dist/commands/run/projects/delete/index.js +9 -9
  55. package/dist/commands/run/projects/list/index.d.ts +2 -2
  56. package/dist/commands/run/projects/list/index.js +11 -11
  57. package/dist/commands/run/projects/update/index.d.ts +3 -3
  58. package/dist/commands/run/projects/update/index.js +20 -20
  59. package/dist/commands/run/secrets/delete/index.d.ts +2 -2
  60. package/dist/commands/run/secrets/delete/index.js +9 -9
  61. package/dist/commands/run/secrets/get/index.d.ts +2 -2
  62. package/dist/commands/run/secrets/get/index.js +10 -10
  63. package/dist/commands/run/secrets/list/index.d.ts +2 -2
  64. package/dist/commands/run/secrets/list/index.js +21 -23
  65. package/dist/commands/run/secrets/set/index.d.ts +3 -3
  66. package/dist/commands/run/secrets/set/index.js +15 -15
  67. package/dist/commands/run/sessions/delete/index.d.ts +2 -2
  68. package/dist/commands/run/sessions/delete/index.js +9 -9
  69. package/dist/commands/run/sessions/get/index.d.ts +2 -2
  70. package/dist/commands/run/sessions/get/index.js +10 -10
  71. package/dist/commands/run/sessions/list/index.d.ts +2 -2
  72. package/dist/commands/run/sessions/list/index.js +10 -10
  73. package/dist/commands/run/sessions/start/index.d.ts +2 -2
  74. package/dist/commands/run/sessions/start/index.js +10 -10
  75. package/dist/commands/run/sessions/stop/index.d.ts +2 -2
  76. package/dist/commands/run/sessions/stop/index.js +10 -10
  77. package/dist/commands/run/sink/get/index.d.ts +2 -2
  78. package/dist/commands/run/sink/get/index.js +10 -10
  79. package/dist/commands/static_host/build/create/index.d.ts +4 -4
  80. package/dist/commands/static_host/build/create/index.js +33 -33
  81. package/dist/commands/static_host/build/get/index.d.ts +4 -4
  82. package/dist/commands/static_host/build/get/index.js +20 -20
  83. package/dist/commands/static_host/build/list/index.d.ts +3 -3
  84. package/dist/commands/static_host/build/list/index.js +31 -31
  85. package/dist/commands/static_host/list/index.d.ts +3 -3
  86. package/dist/commands/static_host/list/index.js +31 -31
  87. package/dist/commands/workspace/create/index.d.ts +3 -3
  88. package/dist/commands/workspace/create/index.js +24 -24
  89. package/dist/commands/workspace/delete/index.d.ts +2 -2
  90. package/dist/commands/workspace/delete/index.js +18 -18
  91. package/dist/commands/workspace/edit/index.d.ts +5 -5
  92. package/dist/commands/workspace/edit/index.js +34 -34
  93. package/dist/commands/workspace/get/index.d.ts +2 -2
  94. package/dist/commands/workspace/get/index.js +12 -12
  95. package/dist/commands/workspace/list/index.d.ts +2 -2
  96. package/dist/commands/workspace/list/index.js +15 -15
  97. package/dist/commands/workspace/pull/index.d.ts +4 -4
  98. package/dist/commands/workspace/pull/index.js +46 -51
  99. package/dist/commands/workspace/push/index.js +3 -3
  100. package/dist/help.d.ts +1 -1
  101. package/dist/lib/base-run-command.d.ts +4 -4
  102. package/dist/lib/base-run-command.js +3 -3
  103. package/dist/lib/run-http-client.d.ts +20 -20
  104. package/dist/lib/run-http-client.js +71 -71
  105. package/dist/lib/run-types.d.ts +80 -80
  106. package/oclif.manifest.json +1336 -815
  107. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class WorkspaceEdit extends BaseCommand {
8
8
  static args = {
@@ -11,36 +11,6 @@ export default class WorkspaceEdit extends BaseCommand {
11
11
  required: false,
12
12
  }),
13
13
  };
14
- static flags = {
15
- ...BaseCommand.baseFlags,
16
- name: Flags.string({
17
- char: 'n',
18
- description: 'New name for the workspace',
19
- required: false,
20
- }),
21
- description: Flags.string({
22
- char: 'd',
23
- description: 'New description for the workspace',
24
- required: false,
25
- }),
26
- swagger: Flags.boolean({
27
- description: 'Enable or disable swagger documentation',
28
- required: false,
29
- allowNo: true,
30
- }),
31
- 'require-token': Flags.boolean({
32
- description: 'Whether to require a token for documentation access',
33
- required: false,
34
- allowNo: true,
35
- }),
36
- output: Flags.string({
37
- char: 'o',
38
- description: 'Output format',
39
- required: false,
40
- default: 'summary',
41
- options: ['summary', 'json'],
42
- }),
43
- };
44
14
  static description = 'Edit an existing workspace via the Xano Metadata API';
45
15
  static examples = [
46
16
  `$ xano workspace edit 123 --name "new-name"
@@ -63,6 +33,36 @@ Updated workspace: my-workspace (ID: 123)
63
33
  }
64
34
  `,
65
35
  ];
36
+ static flags = {
37
+ ...BaseCommand.baseFlags,
38
+ description: Flags.string({
39
+ char: 'd',
40
+ description: 'New description for the workspace',
41
+ required: false,
42
+ }),
43
+ name: Flags.string({
44
+ char: 'n',
45
+ description: 'New name for the workspace',
46
+ required: false,
47
+ }),
48
+ output: Flags.string({
49
+ char: 'o',
50
+ default: 'summary',
51
+ description: 'Output format',
52
+ options: ['summary', 'json'],
53
+ required: false,
54
+ }),
55
+ 'require-token': Flags.boolean({
56
+ allowNo: true,
57
+ description: 'Whether to require a token for documentation access',
58
+ required: false,
59
+ }),
60
+ swagger: Flags.boolean({
61
+ allowNo: true,
62
+ description: 'Enable or disable swagger documentation',
63
+ required: false,
64
+ }),
65
+ };
66
66
  async run() {
67
67
  const { args, flags } = await this.parse(WorkspaceEdit);
68
68
  // Get profile name (default or from flag/env)
@@ -112,13 +112,13 @@ Updated workspace: my-workspace (ID: 123)
112
112
  // Update workspace via the API
113
113
  try {
114
114
  const response = await fetch(apiUrl, {
115
- method: 'PUT',
115
+ body: JSON.stringify(body),
116
116
  headers: {
117
117
  'accept': 'application/json',
118
- 'content-type': 'application/json',
119
118
  'Authorization': `Bearer ${profile.access_token}`,
119
+ 'content-type': 'application/json',
120
120
  },
121
- body: JSON.stringify(body),
121
+ method: 'PUT',
122
122
  });
123
123
  if (!response.ok) {
124
124
  const errorText = await response.text();
@@ -6,13 +6,13 @@ export default class WorkspaceGet extends BaseCommand {
6
6
  min?: number;
7
7
  }>;
8
8
  };
9
+ static description: string;
10
+ static examples: string[];
9
11
  static flags: {
10
12
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
13
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
14
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
15
  };
14
- static description: string;
15
- static examples: string[];
16
16
  run(): Promise<void>;
17
17
  private loadCredentials;
18
18
  }
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class WorkspaceGet extends BaseCommand {
8
8
  static args = {
@@ -11,16 +11,6 @@ export default class WorkspaceGet extends BaseCommand {
11
11
  required: false,
12
12
  }),
13
13
  };
14
- static flags = {
15
- ...BaseCommand.baseFlags,
16
- output: Flags.string({
17
- char: 'o',
18
- description: 'Output format',
19
- required: false,
20
- default: 'summary',
21
- options: ['summary', 'json'],
22
- }),
23
- };
24
14
  static description = 'Get details of a specific workspace from the Xano Metadata API';
25
15
  static examples = [
26
16
  `$ xano workspace get 123
@@ -42,6 +32,16 @@ Workspace: my-workspace (ID: 123)
42
32
  }
43
33
  `,
44
34
  ];
35
+ static flags = {
36
+ ...BaseCommand.baseFlags,
37
+ output: Flags.string({
38
+ char: 'o',
39
+ default: 'summary',
40
+ description: 'Output format',
41
+ options: ['summary', 'json'],
42
+ required: false,
43
+ }),
44
+ };
45
45
  async run() {
46
46
  const { args, flags } = await this.parse(WorkspaceGet);
47
47
  // Get profile name (default or from flag/env)
@@ -72,11 +72,11 @@ Workspace: my-workspace (ID: 123)
72
72
  // Fetch workspace from the API
73
73
  try {
74
74
  const response = await fetch(apiUrl, {
75
- method: 'GET',
76
75
  headers: {
77
76
  'accept': 'application/json',
78
77
  'Authorization': `Bearer ${profile.access_token}`,
79
78
  },
79
+ method: 'GET',
80
80
  });
81
81
  if (!response.ok) {
82
82
  const errorText = await response.text();
@@ -1,12 +1,12 @@
1
1
  import BaseCommand from '../../../base-command.js';
2
2
  export default class WorkspaceList extends BaseCommand {
3
+ static description: string;
4
+ static examples: string[];
3
5
  static flags: {
4
6
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
5
7
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
8
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
9
  };
8
- static description: string;
9
- static examples: string[];
10
10
  run(): Promise<void>;
11
11
  private loadCredentials;
12
12
  }
@@ -1,20 +1,10 @@
1
1
  import { Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class WorkspaceList extends BaseCommand {
8
- static flags = {
9
- ...BaseCommand.baseFlags,
10
- output: Flags.string({
11
- char: 'o',
12
- description: 'Output format',
13
- required: false,
14
- default: 'summary',
15
- options: ['summary', 'json'],
16
- }),
17
- };
18
8
  static description = 'List all workspaces from the Xano Metadata API';
19
9
  static examples = [
20
10
  `$ xano workspace:list
@@ -53,6 +43,16 @@ Available workspaces:
53
43
  }
54
44
  `,
55
45
  ];
46
+ static flags = {
47
+ ...BaseCommand.baseFlags,
48
+ output: Flags.string({
49
+ char: 'o',
50
+ default: 'summary',
51
+ description: 'Output format',
52
+ options: ['summary', 'json'],
53
+ required: false,
54
+ }),
55
+ };
56
56
  async run() {
57
57
  const { flags } = await this.parse(WorkspaceList);
58
58
  // Get profile name (default or from flag/env)
@@ -77,11 +77,11 @@ Available workspaces:
77
77
  // Fetch workspaces from the API
78
78
  try {
79
79
  const response = await fetch(apiUrl, {
80
- method: 'GET',
81
80
  headers: {
82
81
  'accept': 'application/json',
83
82
  'Authorization': `Bearer ${profile.access_token}`,
84
83
  },
84
+ method: 'GET',
85
85
  });
86
86
  if (!response.ok) {
87
87
  const errorText = await response.text();
@@ -111,11 +111,11 @@ Available workspaces:
111
111
  else {
112
112
  this.log('Available workspaces:');
113
113
  for (const workspace of workspaces) {
114
- if (workspace.id !== undefined) {
115
- this.log(` - ${workspace.name} (ID: ${workspace.id})`);
114
+ if (workspace.id === undefined) {
115
+ this.log(` - ${workspace.name}`);
116
116
  }
117
117
  else {
118
- this.log(` - ${workspace.name}`);
118
+ this.log(` - ${workspace.name} (ID: ${workspace.id})`);
119
119
  }
120
120
  }
121
121
  }
@@ -3,16 +3,17 @@ export default class Pull extends BaseCommand {
3
3
  static args: {
4
4
  directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
5
  };
6
+ static description: string;
7
+ static examples: string[];
6
8
  static flags: {
7
- workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
9
  env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
12
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
13
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
14
  };
13
- static description: string;
14
- static examples: string[];
15
15
  run(): Promise<void>;
16
+ private loadCredentials;
16
17
  /**
17
18
  * Parse a single document to extract its type, name, and optional verb.
18
19
  * Skips leading comment lines (starting with //) to find the first
@@ -25,5 +26,4 @@ export default class Pull extends BaseCommand {
25
26
  * characters that are unsafe in filenames.
26
27
  */
27
28
  private sanitizeFilename;
28
- private loadCredentials;
29
29
  }
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class Pull extends BaseCommand {
8
8
  static args = {
@@ -11,24 +11,6 @@ export default class Pull extends BaseCommand {
11
11
  required: true,
12
12
  }),
13
13
  };
14
- static flags = {
15
- ...BaseCommand.baseFlags,
16
- workspace: Flags.string({
17
- char: 'w',
18
- description: 'Workspace ID (optional if set in profile)',
19
- required: false,
20
- }),
21
- env: Flags.boolean({
22
- description: 'Include environment variables',
23
- required: false,
24
- default: false,
25
- }),
26
- records: Flags.boolean({
27
- description: 'Include records',
28
- required: false,
29
- default: false,
30
- }),
31
- };
32
14
  static description = 'Pull a workspace multidoc from the Xano Metadata API and split into individual files';
33
15
  static examples = [
34
16
  `$ xano workspace pull ./my-workspace
@@ -41,6 +23,24 @@ Pulled 15 documents to ./output
41
23
  Pulled 58 documents to ./backup
42
24
  `,
43
25
  ];
26
+ static flags = {
27
+ ...BaseCommand.baseFlags,
28
+ env: Flags.boolean({
29
+ default: false,
30
+ description: 'Include environment variables',
31
+ required: false,
32
+ }),
33
+ records: Flags.boolean({
34
+ default: false,
35
+ description: 'Include records',
36
+ required: false,
37
+ }),
38
+ workspace: Flags.string({
39
+ char: 'w',
40
+ description: 'Workspace ID (optional if set in profile)',
41
+ required: false,
42
+ }),
43
+ };
44
44
  async run() {
45
45
  const { args, flags } = await this.parse(Pull);
46
46
  // Get profile name (default or from flag/env)
@@ -84,11 +84,11 @@ Pulled 58 documents to ./backup
84
84
  let responseText;
85
85
  try {
86
86
  const response = await fetch(apiUrl, {
87
- method: 'GET',
88
87
  headers: {
89
88
  'accept': 'application/json',
90
89
  'Authorization': `Bearer ${profile.access_token}`,
91
90
  },
91
+ method: 'GET',
92
92
  });
93
93
  if (!response.ok) {
94
94
  const errorText = await response.text();
@@ -147,18 +147,34 @@ Pulled 58 documents to ./backup
147
147
  typeCounters.set(baseName, count + 1);
148
148
  // Append numeric suffix for duplicates
149
149
  let filename;
150
- if (count === 0) {
151
- filename = `${baseName}.xs`;
152
- }
153
- else {
154
- filename = `${baseName}_${count + 1}.xs`;
155
- }
150
+ filename = count === 0 ? `${baseName}.xs` : `${baseName}_${count + 1}.xs`;
156
151
  const filePath = path.join(typeDir, filename);
157
152
  fs.writeFileSync(filePath, doc.content, 'utf8');
158
153
  writtenCount++;
159
154
  }
160
155
  this.log(`Pulled ${writtenCount} documents to ${args.directory}`);
161
156
  }
157
+ loadCredentials() {
158
+ const configDir = path.join(os.homedir(), '.xano');
159
+ const credentialsPath = path.join(configDir, 'credentials.yaml');
160
+ // Check if credentials file exists
161
+ if (!fs.existsSync(credentialsPath)) {
162
+ this.error(`Credentials file not found at ${credentialsPath}\n` +
163
+ `Create a profile using 'xano profile:create'`);
164
+ }
165
+ // Read credentials file
166
+ try {
167
+ const fileContent = fs.readFileSync(credentialsPath, 'utf8');
168
+ const parsed = yaml.load(fileContent);
169
+ if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
170
+ this.error('Credentials file has invalid format.');
171
+ }
172
+ return parsed;
173
+ }
174
+ catch (error) {
175
+ this.error(`Failed to parse credentials file: ${error}`);
176
+ }
177
+ }
162
178
  /**
163
179
  * Parse a single document to extract its type, name, and optional verb.
164
180
  * Skips leading comment lines (starting with //) to find the first
@@ -201,7 +217,7 @@ Pulled 58 documents to ./backup
201
217
  if (verbMatch) {
202
218
  verb = verbMatch[1];
203
219
  }
204
- return { type, name, verb, content };
220
+ return { content, name, type, verb };
205
221
  }
206
222
  /**
207
223
  * Sanitize a document name for use as a filename.
@@ -210,29 +226,8 @@ Pulled 58 documents to ./backup
210
226
  */
211
227
  sanitizeFilename(name) {
212
228
  return name
213
- .replace(/"/g, '')
214
- .replace(/\s+/g, '_')
215
- .replace(/[<>:"/\\|?*]/g, '_');
216
- }
217
- loadCredentials() {
218
- const configDir = path.join(os.homedir(), '.xano');
219
- const credentialsPath = path.join(configDir, 'credentials.yaml');
220
- // Check if credentials file exists
221
- if (!fs.existsSync(credentialsPath)) {
222
- this.error(`Credentials file not found at ${credentialsPath}\n` +
223
- `Create a profile using 'xano profile:create'`);
224
- }
225
- // Read credentials file
226
- try {
227
- const fileContent = fs.readFileSync(credentialsPath, 'utf8');
228
- const parsed = yaml.load(fileContent);
229
- if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
230
- this.error('Credentials file has invalid format.');
231
- }
232
- return parsed;
233
- }
234
- catch (error) {
235
- this.error(`Failed to parse credentials file: ${error}`);
236
- }
229
+ .replaceAll('"', '')
230
+ .replaceAll(/\s+/g, '_')
231
+ .replaceAll(/[<>:"/\\|?*]/g, '_');
237
232
  }
238
233
  }
@@ -1,8 +1,8 @@
1
1
  import { Args, Flags } from '@oclif/core';
2
+ import * as yaml from 'js-yaml';
2
3
  import * as fs from 'node:fs';
3
4
  import * as os from 'node:os';
4
5
  import * as path from 'node:path';
5
- import * as yaml from 'js-yaml';
6
6
  import BaseCommand from '../../../base-command.js';
7
7
  export default class Push extends BaseCommand {
8
8
  static args = {
@@ -93,13 +93,13 @@ Pushed 58 documents from ./backup
93
93
  // POST the multidoc to the API
94
94
  try {
95
95
  const response = await fetch(apiUrl, {
96
- method: 'POST',
96
+ body: multidoc,
97
97
  headers: {
98
98
  'accept': 'application/json',
99
99
  'Authorization': `Bearer ${profile.access_token}`,
100
100
  'Content-Type': 'text/x-xanoscript',
101
101
  },
102
- body: multidoc,
102
+ method: 'POST',
103
103
  });
104
104
  if (!response.ok) {
105
105
  const errorText = await response.text();
package/dist/help.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Command, Help as BaseHelp } from '@oclif/core';
1
+ import { Help as BaseHelp, Command } from '@oclif/core';
2
2
  import { CommandHelp as BaseCommandHelp } from '@oclif/core/help';
3
3
  /**
4
4
  * Custom CommandHelp class that extends the default to display environment variables
@@ -4,19 +4,19 @@
4
4
  import BaseCommand from '../base-command.js';
5
5
  import { RunHttpClient } from './run-http-client.js';
6
6
  export interface ProfileConfig {
7
- account_origin?: string;
8
- instance_origin: string;
9
7
  access_token: string;
10
- workspace?: string;
8
+ account_origin?: string;
11
9
  branch?: string;
10
+ instance_origin: string;
12
11
  project?: string;
13
12
  run_base_url?: string;
13
+ workspace?: string;
14
14
  }
15
15
  export interface CredentialsFile {
16
+ default?: string;
16
17
  profiles: {
17
18
  [key: string]: ProfileConfig;
18
19
  };
19
- default?: string;
20
20
  }
21
21
  export default abstract class BaseRunCommand extends BaseCommand {
22
22
  protected httpClient: RunHttpClient;
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Base command for all run commands
3
3
  */
4
+ import * as yaml from 'js-yaml';
4
5
  import * as fs from 'node:fs';
5
6
  import * as os from 'node:os';
6
7
  import * as path from 'node:path';
7
- import * as yaml from 'js-yaml';
8
8
  import BaseCommand from '../base-command.js';
9
9
  import { DEFAULT_RUN_BASE_URL, RunHttpClient } from './run-http-client.js';
10
10
  export default class BaseRunCommand extends BaseCommand {
@@ -27,11 +27,11 @@ export default class BaseRunCommand extends BaseCommand {
27
27
  }
28
28
  const baseUrl = this.profile.run_base_url || DEFAULT_RUN_BASE_URL;
29
29
  this.httpClient = new RunHttpClient({
30
- baseUrl,
31
30
  authToken: this.profile.access_token,
31
+ baseUrl,
32
+ logger: (msg) => this.log(msg),
32
33
  projectId: this.profile.project,
33
34
  verbose,
34
- logger: (msg) => this.log(msg),
35
35
  });
36
36
  }
37
37
  /**
@@ -4,47 +4,47 @@
4
4
  */
5
5
  export declare const DEFAULT_RUN_BASE_URL = "https://app.dev.xano.com/";
6
6
  export interface RunHttpClientConfig {
7
- baseUrl: string;
8
7
  authToken: string;
8
+ baseUrl: string;
9
+ logger?: (message: string) => void;
9
10
  projectId?: string;
10
11
  verbose?: boolean;
11
- logger?: (message: string) => void;
12
12
  }
13
13
  export declare class RunHttpClient {
14
14
  private readonly config;
15
15
  constructor(config: RunHttpClientConfig);
16
16
  /**
17
- * Get the project ID
17
+ * Build a URL scoped to the current project
18
18
  */
19
- getProjectId(): string | undefined;
19
+ buildProjectUrl(path: string, queryParams?: Record<string, unknown>): string;
20
20
  /**
21
- * Build headers for a request
21
+ * Build a URL scoped to a specific session
22
22
  */
23
- getHeaders(contentType?: string): HeadersInit;
23
+ buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
24
24
  /**
25
25
  * Build a URL with optional query parameters
26
26
  */
27
27
  buildUrl(path: string, queryParams?: Record<string, unknown>): string;
28
28
  /**
29
- * Build a URL scoped to the current project
29
+ * Make a DELETE request
30
30
  */
31
- buildProjectUrl(path: string, queryParams?: Record<string, unknown>): string;
31
+ delete<T>(url: string, body?: unknown): Promise<T>;
32
32
  /**
33
- * Build a URL scoped to a specific session
33
+ * Make a GET request
34
34
  */
35
- buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
35
+ get<T>(url: string): Promise<T>;
36
36
  /**
37
- * Log a message if verbose mode is enabled
37
+ * Build headers for a request
38
38
  */
39
- private log;
39
+ getHeaders(contentType?: string): HeadersInit;
40
40
  /**
41
- * Make an HTTP request
41
+ * Get the project ID
42
42
  */
43
- request<T>(url: string, options: RequestInit): Promise<T>;
43
+ getProjectId(): string | undefined;
44
44
  /**
45
- * Make a GET request
45
+ * Make a PATCH request
46
46
  */
47
- get<T>(url: string): Promise<T>;
47
+ patch<T>(url: string, body: unknown): Promise<T>;
48
48
  /**
49
49
  * Make a POST request with JSON body
50
50
  */
@@ -54,11 +54,11 @@ export declare class RunHttpClient {
54
54
  */
55
55
  postXanoScript<T>(url: string, code: string): Promise<T>;
56
56
  /**
57
- * Make a PATCH request
57
+ * Make an HTTP request
58
58
  */
59
- patch<T>(url: string, body: unknown): Promise<T>;
59
+ request<T>(url: string, options: RequestInit): Promise<T>;
60
60
  /**
61
- * Make a DELETE request
61
+ * Log a message if verbose mode is enabled
62
62
  */
63
- delete<T>(url: string, body?: unknown): Promise<T>;
63
+ private log;
64
64
  }