@xano/cli 0.0.20 → 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.
- package/dist/base-command.d.ts +1 -1
- package/dist/base-command.js +6 -6
- package/dist/commands/branch/create/index.d.ts +17 -0
- package/dist/commands/branch/create/index.js +164 -0
- package/dist/commands/branch/delete/index.d.ts +18 -0
- package/dist/commands/branch/delete/index.js +156 -0
- package/dist/commands/branch/edit/index.d.ts +19 -0
- package/dist/commands/branch/edit/index.js +166 -0
- package/dist/commands/branch/get/index.d.ts +16 -0
- package/dist/commands/branch/get/index.js +135 -0
- package/dist/commands/branch/list/index.d.ts +18 -0
- package/dist/commands/branch/list/index.js +138 -0
- package/dist/commands/branch/set-live/index.d.ts +18 -0
- package/dist/commands/branch/set-live/index.js +155 -0
- package/dist/commands/function/create/index.d.ts +6 -6
- package/dist/commands/function/create/index.js +55 -55
- package/dist/commands/function/edit/index.d.ts +10 -10
- package/dist/commands/function/edit/index.js +155 -162
- package/dist/commands/function/get/index.d.ts +5 -5
- package/dist/commands/function/get/index.js +55 -60
- package/dist/commands/function/list/index.d.ts +5 -5
- package/dist/commands/function/list/index.js +52 -52
- package/dist/commands/profile/create/index.d.ts +6 -6
- package/dist/commands/profile/create/index.js +37 -37
- package/dist/commands/profile/delete/index.d.ts +2 -2
- package/dist/commands/profile/delete/index.js +9 -9
- package/dist/commands/profile/edit/index.d.ts +7 -7
- package/dist/commands/profile/edit/index.js +47 -47
- package/dist/commands/profile/get-default/index.js +1 -1
- package/dist/commands/profile/list/index.d.ts +2 -2
- package/dist/commands/profile/list/index.js +9 -9
- package/dist/commands/profile/me/index.d.ts +3 -3
- package/dist/commands/profile/me/index.js +21 -21
- package/dist/commands/profile/project/index.js +1 -1
- package/dist/commands/profile/set-default/index.js +1 -1
- package/dist/commands/profile/token/index.js +1 -1
- package/dist/commands/profile/wizard/index.d.ts +4 -4
- package/dist/commands/profile/wizard/index.js +118 -122
- package/dist/commands/run/env/delete/index.d.ts +2 -2
- package/dist/commands/run/env/delete/index.js +9 -9
- package/dist/commands/run/env/get/index.d.ts +2 -2
- package/dist/commands/run/env/get/index.js +10 -10
- package/dist/commands/run/env/list/index.d.ts +2 -2
- package/dist/commands/run/env/list/index.js +16 -18
- package/dist/commands/run/env/set/index.d.ts +2 -2
- package/dist/commands/run/env/set/index.js +4 -4
- package/dist/commands/run/exec/index.d.ts +11 -11
- package/dist/commands/run/exec/index.js +109 -109
- package/dist/commands/run/info/index.d.ts +4 -4
- package/dist/commands/run/info/index.js +26 -26
- package/dist/commands/run/projects/create/index.d.ts +3 -3
- package/dist/commands/run/projects/create/index.js +22 -22
- package/dist/commands/run/projects/delete/index.d.ts +2 -2
- package/dist/commands/run/projects/delete/index.js +9 -9
- package/dist/commands/run/projects/list/index.d.ts +2 -2
- package/dist/commands/run/projects/list/index.js +11 -11
- package/dist/commands/run/projects/update/index.d.ts +3 -3
- package/dist/commands/run/projects/update/index.js +20 -20
- package/dist/commands/run/secrets/delete/index.d.ts +2 -2
- package/dist/commands/run/secrets/delete/index.js +9 -9
- package/dist/commands/run/secrets/get/index.d.ts +2 -2
- package/dist/commands/run/secrets/get/index.js +10 -10
- package/dist/commands/run/secrets/list/index.d.ts +2 -2
- package/dist/commands/run/secrets/list/index.js +21 -23
- package/dist/commands/run/secrets/set/index.d.ts +3 -3
- package/dist/commands/run/secrets/set/index.js +15 -15
- package/dist/commands/run/sessions/delete/index.d.ts +2 -2
- package/dist/commands/run/sessions/delete/index.js +9 -9
- package/dist/commands/run/sessions/get/index.d.ts +2 -2
- package/dist/commands/run/sessions/get/index.js +10 -10
- package/dist/commands/run/sessions/list/index.d.ts +2 -2
- package/dist/commands/run/sessions/list/index.js +10 -10
- package/dist/commands/run/sessions/start/index.d.ts +2 -2
- package/dist/commands/run/sessions/start/index.js +10 -10
- package/dist/commands/run/sessions/stop/index.d.ts +2 -2
- package/dist/commands/run/sessions/stop/index.js +10 -10
- package/dist/commands/run/sink/get/index.d.ts +2 -2
- package/dist/commands/run/sink/get/index.js +10 -10
- package/dist/commands/static_host/build/create/index.d.ts +4 -4
- package/dist/commands/static_host/build/create/index.js +33 -33
- package/dist/commands/static_host/build/get/index.d.ts +4 -4
- package/dist/commands/static_host/build/get/index.js +20 -20
- package/dist/commands/static_host/build/list/index.d.ts +3 -3
- package/dist/commands/static_host/build/list/index.js +31 -31
- package/dist/commands/static_host/list/index.d.ts +3 -3
- package/dist/commands/static_host/list/index.js +31 -31
- package/dist/commands/workspace/create/index.d.ts +14 -0
- package/dist/commands/workspace/create/index.js +131 -0
- package/dist/commands/workspace/delete/index.d.ts +20 -0
- package/dist/commands/workspace/delete/index.js +141 -0
- package/dist/commands/workspace/edit/index.d.ts +22 -0
- package/dist/commands/workspace/edit/index.js +176 -0
- package/dist/commands/workspace/get/index.d.ts +18 -0
- package/dist/commands/workspace/get/index.js +136 -0
- package/dist/commands/workspace/list/index.d.ts +2 -2
- package/dist/commands/workspace/list/index.js +15 -15
- package/dist/commands/workspace/pull/index.d.ts +4 -4
- package/dist/commands/workspace/pull/index.js +46 -51
- package/dist/commands/workspace/push/index.js +3 -3
- package/dist/help.d.ts +1 -1
- package/dist/lib/base-run-command.d.ts +4 -4
- package/dist/lib/base-run-command.js +3 -3
- package/dist/lib/run-http-client.d.ts +21 -21
- package/dist/lib/run-http-client.js +72 -72
- package/dist/lib/run-types.d.ts +80 -80
- package/oclif.manifest.json +1633 -791
- package/package.json +1 -1
|
@@ -3,17 +3,17 @@ export default class StaticHostBuildCreate extends BaseCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
static_host: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
6
8
|
static flags: {
|
|
7
|
-
|
|
9
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
file: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
12
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
15
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
16
|
};
|
|
15
|
-
static description: string;
|
|
16
|
-
static examples: string[];
|
|
17
17
|
run(): Promise<void>;
|
|
18
18
|
private loadCredentials;
|
|
19
19
|
}
|
|
@@ -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 StaticHostBuildCreate extends BaseCommand {
|
|
8
8
|
static args = {
|
|
@@ -11,36 +11,6 @@ export default class StaticHostBuildCreate 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
|
-
file: Flags.string({
|
|
22
|
-
char: 'f',
|
|
23
|
-
description: 'Path to zip file to upload',
|
|
24
|
-
required: true,
|
|
25
|
-
}),
|
|
26
|
-
name: Flags.string({
|
|
27
|
-
char: 'n',
|
|
28
|
-
description: 'Build name',
|
|
29
|
-
required: true,
|
|
30
|
-
}),
|
|
31
|
-
description: Flags.string({
|
|
32
|
-
char: 'd',
|
|
33
|
-
description: 'Build description',
|
|
34
|
-
required: false,
|
|
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 = 'Create a new build for a static host';
|
|
45
15
|
static examples = [
|
|
46
16
|
`$ xano static_host:build:create default -f ./build.zip -n "v1.0.0"
|
|
@@ -63,6 +33,36 @@ Description: Production build
|
|
|
63
33
|
}
|
|
64
34
|
`,
|
|
65
35
|
];
|
|
36
|
+
static flags = {
|
|
37
|
+
...BaseCommand.baseFlags,
|
|
38
|
+
description: Flags.string({
|
|
39
|
+
char: 'd',
|
|
40
|
+
description: 'Build description',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
43
|
+
file: Flags.string({
|
|
44
|
+
char: 'f',
|
|
45
|
+
description: 'Path to zip file to upload',
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
name: Flags.string({
|
|
49
|
+
char: 'n',
|
|
50
|
+
description: 'Build name',
|
|
51
|
+
required: true,
|
|
52
|
+
}),
|
|
53
|
+
output: Flags.string({
|
|
54
|
+
char: 'o',
|
|
55
|
+
default: 'summary',
|
|
56
|
+
description: 'Output format',
|
|
57
|
+
options: ['summary', 'json'],
|
|
58
|
+
required: false,
|
|
59
|
+
}),
|
|
60
|
+
workspace: Flags.string({
|
|
61
|
+
char: 'w',
|
|
62
|
+
description: 'Workspace ID (optional if set in profile)',
|
|
63
|
+
required: false,
|
|
64
|
+
}),
|
|
65
|
+
};
|
|
66
66
|
async run() {
|
|
67
67
|
const { args, flags } = await this.parse(StaticHostBuildCreate);
|
|
68
68
|
// Get profile name (default or from flag/env)
|
|
@@ -128,12 +128,12 @@ Description: Production build
|
|
|
128
128
|
// Create build via API
|
|
129
129
|
try {
|
|
130
130
|
const response = await fetch(apiUrl, {
|
|
131
|
-
|
|
131
|
+
body: formData,
|
|
132
132
|
headers: {
|
|
133
133
|
'accept': 'application/json',
|
|
134
134
|
'Authorization': `Bearer ${profile.access_token}`,
|
|
135
135
|
},
|
|
136
|
-
|
|
136
|
+
method: 'POST',
|
|
137
137
|
});
|
|
138
138
|
if (!response.ok) {
|
|
139
139
|
const errorText = await response.text();
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class StaticHostBuildGet extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
|
-
static_host: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
4
|
build_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
static_host: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
6
|
};
|
|
7
|
+
static description: string;
|
|
8
|
+
static examples: string[];
|
|
7
9
|
static flags: {
|
|
8
|
-
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
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
16
|
private loadCredentials;
|
|
17
17
|
}
|
|
@@ -1,33 +1,18 @@
|
|
|
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 StaticHostBuildGet extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
|
-
static_host: Args.string({
|
|
10
|
-
description: 'Static Host name',
|
|
11
|
-
required: true,
|
|
12
|
-
}),
|
|
13
9
|
build_id: Args.string({
|
|
14
10
|
description: 'Build ID',
|
|
15
11
|
required: true,
|
|
16
12
|
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
workspace: Flags.string({
|
|
21
|
-
char: 'w',
|
|
22
|
-
description: 'Workspace ID (optional if set in profile)',
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
output: Flags.string({
|
|
26
|
-
char: 'o',
|
|
27
|
-
description: 'Output format',
|
|
28
|
-
required: false,
|
|
29
|
-
default: 'summary',
|
|
30
|
-
options: ['summary', 'json'],
|
|
13
|
+
static_host: Args.string({
|
|
14
|
+
description: 'Static Host name',
|
|
15
|
+
required: true,
|
|
31
16
|
}),
|
|
32
17
|
};
|
|
33
18
|
static description = 'Get details of a specific build for a static host';
|
|
@@ -57,6 +42,21 @@ Name: production-build
|
|
|
57
42
|
}
|
|
58
43
|
`,
|
|
59
44
|
];
|
|
45
|
+
static flags = {
|
|
46
|
+
...BaseCommand.baseFlags,
|
|
47
|
+
output: Flags.string({
|
|
48
|
+
char: 'o',
|
|
49
|
+
default: 'summary',
|
|
50
|
+
description: 'Output format',
|
|
51
|
+
options: ['summary', 'json'],
|
|
52
|
+
required: false,
|
|
53
|
+
}),
|
|
54
|
+
workspace: Flags.string({
|
|
55
|
+
char: 'w',
|
|
56
|
+
description: 'Workspace ID (optional if set in profile)',
|
|
57
|
+
required: false,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
60
|
async run() {
|
|
61
61
|
const { args, flags } = await this.parse(StaticHostBuildGet);
|
|
62
62
|
// Get profile name (default or from flag/env)
|
|
@@ -94,11 +94,11 @@ Name: production-build
|
|
|
94
94
|
// Fetch build from the API
|
|
95
95
|
try {
|
|
96
96
|
const response = await fetch(apiUrl, {
|
|
97
|
-
method: 'GET',
|
|
98
97
|
headers: {
|
|
99
98
|
'accept': 'application/json',
|
|
100
99
|
'Authorization': `Bearer ${profile.access_token}`,
|
|
101
100
|
},
|
|
101
|
+
method: 'GET',
|
|
102
102
|
});
|
|
103
103
|
if (!response.ok) {
|
|
104
104
|
const errorText = await response.text();
|
|
@@ -3,16 +3,16 @@ export default class StaticHostBuildList extends BaseCommand {
|
|
|
3
3
|
static args: {
|
|
4
4
|
static_host: 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
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
11
|
per_page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, 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 StaticHostBuildList extends BaseCommand {
|
|
8
8
|
static args = {
|
|
@@ -11,31 +11,6 @@ export default class StaticHostBuildList 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
|
-
output: Flags.string({
|
|
22
|
-
char: 'o',
|
|
23
|
-
description: 'Output format',
|
|
24
|
-
required: false,
|
|
25
|
-
default: 'summary',
|
|
26
|
-
options: ['summary', 'json'],
|
|
27
|
-
}),
|
|
28
|
-
page: Flags.integer({
|
|
29
|
-
description: 'Page number for pagination',
|
|
30
|
-
required: false,
|
|
31
|
-
default: 1,
|
|
32
|
-
}),
|
|
33
|
-
per_page: Flags.integer({
|
|
34
|
-
description: 'Number of results per page',
|
|
35
|
-
required: false,
|
|
36
|
-
default: 50,
|
|
37
|
-
}),
|
|
38
|
-
};
|
|
39
14
|
static description = 'List all builds for a static host';
|
|
40
15
|
static examples = [
|
|
41
16
|
`$ xano static_host:build:list default -w 40
|
|
@@ -66,6 +41,31 @@ Available builds:
|
|
|
66
41
|
]
|
|
67
42
|
`,
|
|
68
43
|
];
|
|
44
|
+
static flags = {
|
|
45
|
+
...BaseCommand.baseFlags,
|
|
46
|
+
output: Flags.string({
|
|
47
|
+
char: 'o',
|
|
48
|
+
default: 'summary',
|
|
49
|
+
description: 'Output format',
|
|
50
|
+
options: ['summary', 'json'],
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
53
|
+
page: Flags.integer({
|
|
54
|
+
default: 1,
|
|
55
|
+
description: 'Page number for pagination',
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
per_page: Flags.integer({
|
|
59
|
+
default: 50,
|
|
60
|
+
description: 'Number of results per page',
|
|
61
|
+
required: false,
|
|
62
|
+
}),
|
|
63
|
+
workspace: Flags.string({
|
|
64
|
+
char: 'w',
|
|
65
|
+
description: 'Workspace ID (optional if set in profile)',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
69
|
async run() {
|
|
70
70
|
const { args, flags } = await this.parse(StaticHostBuildList);
|
|
71
71
|
// Get profile name (default or from flag/env)
|
|
@@ -111,11 +111,11 @@ Available builds:
|
|
|
111
111
|
// Fetch builds from the API
|
|
112
112
|
try {
|
|
113
113
|
const response = await fetch(apiUrl, {
|
|
114
|
-
method: 'GET',
|
|
115
114
|
headers: {
|
|
116
115
|
'accept': 'application/json',
|
|
117
116
|
'Authorization': `Bearer ${profile.access_token}`,
|
|
118
117
|
},
|
|
118
|
+
method: 'GET',
|
|
119
119
|
});
|
|
120
120
|
if (!response.ok) {
|
|
121
121
|
const errorText = await response.text();
|
|
@@ -148,12 +148,12 @@ Available builds:
|
|
|
148
148
|
else {
|
|
149
149
|
this.log('Available builds:');
|
|
150
150
|
for (const build of builds) {
|
|
151
|
-
if (build.id
|
|
152
|
-
|
|
153
|
-
this.log(` - ${build.name} (ID: ${build.id})${statusInfo}`);
|
|
151
|
+
if (build.id === undefined) {
|
|
152
|
+
this.log(` - ${build.name}`);
|
|
154
153
|
}
|
|
155
154
|
else {
|
|
156
|
-
|
|
155
|
+
const statusInfo = build.status ? ` - Status: ${build.status}` : '';
|
|
156
|
+
this.log(` - ${build.name} (ID: ${build.id})${statusInfo}`);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class StaticHostList extends BaseCommand {
|
|
3
3
|
static args: {};
|
|
4
|
+
static description: string;
|
|
5
|
+
static examples: string[];
|
|
4
6
|
static flags: {
|
|
5
|
-
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
per_page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
11
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
13
|
};
|
|
12
|
-
static description: string;
|
|
13
|
-
static examples: string[];
|
|
14
14
|
run(): Promise<void>;
|
|
15
15
|
private loadCredentials;
|
|
16
16
|
}
|
|
@@ -1,36 +1,11 @@
|
|
|
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 StaticHostList extends BaseCommand {
|
|
8
8
|
static args = {};
|
|
9
|
-
static flags = {
|
|
10
|
-
...BaseCommand.baseFlags,
|
|
11
|
-
workspace: Flags.string({
|
|
12
|
-
char: 'w',
|
|
13
|
-
description: 'Workspace ID (optional if set in profile)',
|
|
14
|
-
required: false,
|
|
15
|
-
}),
|
|
16
|
-
output: Flags.string({
|
|
17
|
-
char: 'o',
|
|
18
|
-
description: 'Output format',
|
|
19
|
-
required: false,
|
|
20
|
-
default: 'summary',
|
|
21
|
-
options: ['summary', 'json'],
|
|
22
|
-
}),
|
|
23
|
-
page: Flags.integer({
|
|
24
|
-
description: 'Page number for pagination',
|
|
25
|
-
required: false,
|
|
26
|
-
default: 1,
|
|
27
|
-
}),
|
|
28
|
-
per_page: Flags.integer({
|
|
29
|
-
description: 'Number of results per page',
|
|
30
|
-
required: false,
|
|
31
|
-
default: 50,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
9
|
static description = 'List all static hosts in a workspace from the Xano Metadata API';
|
|
35
10
|
static examples = [
|
|
36
11
|
`$ xano static_host:list -w 40
|
|
@@ -61,6 +36,31 @@ Available static hosts:
|
|
|
61
36
|
]
|
|
62
37
|
`,
|
|
63
38
|
];
|
|
39
|
+
static flags = {
|
|
40
|
+
...BaseCommand.baseFlags,
|
|
41
|
+
output: Flags.string({
|
|
42
|
+
char: 'o',
|
|
43
|
+
default: 'summary',
|
|
44
|
+
description: 'Output format',
|
|
45
|
+
options: ['summary', 'json'],
|
|
46
|
+
required: false,
|
|
47
|
+
}),
|
|
48
|
+
page: Flags.integer({
|
|
49
|
+
default: 1,
|
|
50
|
+
description: 'Page number for pagination',
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
53
|
+
per_page: Flags.integer({
|
|
54
|
+
default: 50,
|
|
55
|
+
description: 'Number of results per page',
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
workspace: Flags.string({
|
|
59
|
+
char: 'w',
|
|
60
|
+
description: 'Workspace ID (optional if set in profile)',
|
|
61
|
+
required: false,
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
64
|
async run() {
|
|
65
65
|
const { flags } = await this.parse(StaticHostList);
|
|
66
66
|
// Get profile name (default or from flag/env)
|
|
@@ -106,11 +106,11 @@ Available static hosts:
|
|
|
106
106
|
// Fetch static hosts from the API
|
|
107
107
|
try {
|
|
108
108
|
const response = await fetch(apiUrl, {
|
|
109
|
-
method: 'GET',
|
|
110
109
|
headers: {
|
|
111
110
|
'accept': 'application/json',
|
|
112
111
|
'Authorization': `Bearer ${profile.access_token}`,
|
|
113
112
|
},
|
|
113
|
+
method: 'GET',
|
|
114
114
|
});
|
|
115
115
|
if (!response.ok) {
|
|
116
116
|
const errorText = await response.text();
|
|
@@ -143,12 +143,12 @@ Available static hosts:
|
|
|
143
143
|
else {
|
|
144
144
|
this.log('Available static hosts:');
|
|
145
145
|
for (const host of staticHosts) {
|
|
146
|
-
if (host.id
|
|
147
|
-
|
|
148
|
-
this.log(` - ${host.name} (ID: ${host.id})${domainInfo}`);
|
|
146
|
+
if (host.id === undefined) {
|
|
147
|
+
this.log(` - ${host.name}`);
|
|
149
148
|
}
|
|
150
149
|
else {
|
|
151
|
-
|
|
150
|
+
const domainInfo = host.domain ? ` - ${host.domain}` : '';
|
|
151
|
+
this.log(` - ${host.name} (ID: ${host.id})${domainInfo}`);
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BaseCommand from '../../../base-command.js';
|
|
2
|
+
export default class WorkspaceCreate extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
private loadCredentials;
|
|
14
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import * as yaml from 'js-yaml';
|
|
3
|
+
import * as fs from 'node:fs';
|
|
4
|
+
import * as os from 'node:os';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import BaseCommand from '../../../base-command.js';
|
|
7
|
+
export default class WorkspaceCreate extends BaseCommand {
|
|
8
|
+
static description = 'Create a new workspace via the Xano Metadata API';
|
|
9
|
+
static examples = [
|
|
10
|
+
`$ xano workspace create --name "my-workspace"
|
|
11
|
+
Created workspace: my-workspace (ID: 123)
|
|
12
|
+
`,
|
|
13
|
+
`$ xano workspace create --name "my-app" --description "My application workspace"
|
|
14
|
+
Created workspace: my-app (ID: 456)
|
|
15
|
+
Description: My application workspace
|
|
16
|
+
`,
|
|
17
|
+
`$ xano workspace create -n "new-project" -d "New project workspace" -o json
|
|
18
|
+
{
|
|
19
|
+
"id": 789,
|
|
20
|
+
"name": "new-project",
|
|
21
|
+
"description": "New project workspace"
|
|
22
|
+
}
|
|
23
|
+
`,
|
|
24
|
+
];
|
|
25
|
+
static flags = {
|
|
26
|
+
...BaseCommand.baseFlags,
|
|
27
|
+
description: Flags.string({
|
|
28
|
+
char: 'd',
|
|
29
|
+
description: 'Description for the workspace',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
name: Flags.string({
|
|
33
|
+
char: 'n',
|
|
34
|
+
description: 'Name of the workspace',
|
|
35
|
+
required: true,
|
|
36
|
+
}),
|
|
37
|
+
output: Flags.string({
|
|
38
|
+
char: 'o',
|
|
39
|
+
default: 'summary',
|
|
40
|
+
description: 'Output format',
|
|
41
|
+
options: ['summary', 'json'],
|
|
42
|
+
required: false,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
async run() {
|
|
46
|
+
const { flags } = await this.parse(WorkspaceCreate);
|
|
47
|
+
// Get profile name (default or from flag/env)
|
|
48
|
+
const profileName = flags.profile || this.getDefaultProfile();
|
|
49
|
+
// Load credentials
|
|
50
|
+
const credentials = this.loadCredentials();
|
|
51
|
+
// Get the profile configuration
|
|
52
|
+
if (!(profileName in credentials.profiles)) {
|
|
53
|
+
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
54
|
+
`Create a profile using 'xano profile create'`);
|
|
55
|
+
}
|
|
56
|
+
const profile = credentials.profiles[profileName];
|
|
57
|
+
// Validate required fields
|
|
58
|
+
if (!profile.instance_origin) {
|
|
59
|
+
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
60
|
+
}
|
|
61
|
+
if (!profile.access_token) {
|
|
62
|
+
this.error(`Profile '${profileName}' is missing access_token`);
|
|
63
|
+
}
|
|
64
|
+
// Construct the API URL
|
|
65
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace`;
|
|
66
|
+
// Build request body
|
|
67
|
+
const body = {
|
|
68
|
+
name: flags.name,
|
|
69
|
+
};
|
|
70
|
+
if (flags.description) {
|
|
71
|
+
body.description = flags.description;
|
|
72
|
+
}
|
|
73
|
+
// Create workspace via the API
|
|
74
|
+
try {
|
|
75
|
+
const response = await fetch(apiUrl, {
|
|
76
|
+
body: JSON.stringify(body),
|
|
77
|
+
headers: {
|
|
78
|
+
'accept': 'application/json',
|
|
79
|
+
'Authorization': `Bearer ${profile.access_token}`,
|
|
80
|
+
'content-type': 'application/json',
|
|
81
|
+
},
|
|
82
|
+
method: 'POST',
|
|
83
|
+
});
|
|
84
|
+
if (!response.ok) {
|
|
85
|
+
const errorText = await response.text();
|
|
86
|
+
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
87
|
+
}
|
|
88
|
+
const workspace = await response.json();
|
|
89
|
+
// Output results
|
|
90
|
+
if (flags.output === 'json') {
|
|
91
|
+
this.log(JSON.stringify(workspace, null, 2));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// summary format
|
|
95
|
+
this.log(`Created workspace: ${workspace.name} (ID: ${workspace.id})`);
|
|
96
|
+
if (workspace.description) {
|
|
97
|
+
this.log(` Description: ${workspace.description}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (error instanceof Error) {
|
|
103
|
+
this.error(`Failed to create workspace: ${error.message}`);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
this.error(`Failed to create workspace: ${String(error)}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
loadCredentials() {
|
|
111
|
+
const configDir = path.join(os.homedir(), '.xano');
|
|
112
|
+
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
113
|
+
// Check if credentials file exists
|
|
114
|
+
if (!fs.existsSync(credentialsPath)) {
|
|
115
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
116
|
+
`Create a profile using 'xano profile create'`);
|
|
117
|
+
}
|
|
118
|
+
// Read credentials file
|
|
119
|
+
try {
|
|
120
|
+
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
121
|
+
const parsed = yaml.load(fileContent);
|
|
122
|
+
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
123
|
+
this.error('Credentials file has invalid format.');
|
|
124
|
+
}
|
|
125
|
+
return parsed;
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
this.error(`Failed to parse credentials file: ${error}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BaseCommand from '../../../base-command.js';
|
|
2
|
+
export default class WorkspaceDelete extends BaseCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
workspace_id: import("@oclif/core/interfaces").Arg<number, {
|
|
5
|
+
max?: number;
|
|
6
|
+
min?: number;
|
|
7
|
+
}>;
|
|
8
|
+
};
|
|
9
|
+
static description: string;
|
|
10
|
+
static examples: string[];
|
|
11
|
+
static flags: {
|
|
12
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
};
|
|
17
|
+
run(): Promise<void>;
|
|
18
|
+
private confirm;
|
|
19
|
+
private loadCredentials;
|
|
20
|
+
}
|