@xano/cli 0.0.95-beta.2 → 0.0.95-beta.20
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/README.md +22 -12
- package/dist/base-command.d.ts +30 -0
- package/dist/base-command.js +61 -0
- package/dist/commands/auth/index.js +1 -1
- package/dist/commands/branch/create/index.d.ts +3 -1
- package/dist/commands/branch/create/index.js +21 -17
- package/dist/commands/profile/create/index.js +2 -2
- package/dist/commands/profile/edit/index.js +2 -2
- package/dist/commands/profile/me/index.js +21 -2
- package/dist/commands/profile/wizard/index.js +3 -3
- package/dist/commands/profile/workspace/set/index.js +1 -1
- package/dist/commands/{ephemeral → sandbox}/delete/index.d.ts +1 -5
- package/dist/commands/sandbox/delete/index.js +71 -0
- package/dist/commands/{ephemeral → sandbox}/env/delete/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/delete/index.js +20 -36
- package/dist/commands/{ephemeral → sandbox}/env/get/index.d.ts +1 -4
- package/dist/commands/sandbox/env/get/index.js +65 -0
- package/dist/commands/{ephemeral → sandbox}/env/get_all/index.d.ts +1 -4
- package/dist/commands/sandbox/env/get_all/index.js +78 -0
- package/dist/commands/{ephemeral → sandbox}/env/list/index.d.ts +1 -4
- package/dist/commands/sandbox/env/list/index.js +67 -0
- package/dist/commands/{ephemeral → sandbox}/env/set/index.d.ts +1 -4
- package/dist/commands/sandbox/env/set/index.js +74 -0
- package/dist/commands/{ephemeral → sandbox}/env/set_all/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/set_all/index.js +19 -35
- package/dist/commands/{ephemeral → sandbox}/get/index.d.ts +1 -4
- package/dist/commands/sandbox/get/index.js +63 -0
- package/dist/commands/sandbox/impersonate/index.d.ts +5 -0
- package/dist/commands/sandbox/impersonate/index.js +5 -0
- package/dist/commands/{ephemeral → sandbox}/license/get/index.d.ts +1 -4
- package/dist/commands/sandbox/license/get/index.js +78 -0
- package/dist/commands/{ephemeral → sandbox}/license/set/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/license/set/index.js +20 -36
- package/dist/commands/{ephemeral → sandbox}/pull/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/pull/index.js +13 -28
- package/dist/commands/{ephemeral → sandbox}/push/index.d.ts +3 -2
- package/dist/commands/{ephemeral → sandbox}/push/index.js +56 -31
- package/dist/commands/sandbox/reset/index.d.ts +12 -0
- package/dist/commands/sandbox/reset/index.js +71 -0
- package/dist/commands/{ephemeral/impersonate → sandbox/review}/index.d.ts +1 -4
- package/dist/commands/{ephemeral/impersonate → sandbox/review}/index.js +17 -33
- package/dist/commands/{ephemeral/unit_test/run_all → sandbox/unit_test/list}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/unit_test/list/index.js +12 -26
- package/dist/commands/{ephemeral → sandbox}/unit_test/run/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/unit_test/run/index.js +11 -25
- package/dist/commands/{ephemeral/unit_test/list → sandbox/unit_test/run_all}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/unit_test/run_all/index.js +11 -23
- package/dist/commands/{ephemeral/workflow_test/run_all → sandbox/workflow_test/list}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/list/index.js +13 -27
- package/dist/commands/{ephemeral/workflow_test/get → sandbox/workflow_test/run}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/run/index.js +11 -25
- package/dist/commands/{ephemeral/workflow_test/list → sandbox/workflow_test/run_all}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/run_all/index.js +11 -23
- package/dist/commands/tenant/create/index.d.ts +2 -1
- package/dist/commands/tenant/create/index.js +23 -6
- package/dist/commands/tenant/deploy_release/index.d.ts +1 -0
- package/dist/commands/tenant/deploy_release/index.js +9 -1
- package/dist/commands/tenant/get/index.js +2 -2
- package/dist/commands/tenant/list/index.js +2 -2
- package/dist/commands/tenant/push/index.js +0 -34
- package/dist/commands/tenant/unit_test/list/index.js +2 -27
- package/dist/commands/tenant/unit_test/run/index.js +2 -27
- package/dist/commands/tenant/unit_test/run_all/index.js +2 -27
- package/dist/commands/tenant/workflow_test/list/index.js +2 -27
- package/dist/commands/tenant/workflow_test/run/index.js +2 -27
- package/dist/commands/tenant/workflow_test/run_all/index.js +2 -27
- package/dist/commands/workspace/edit/index.d.ts +1 -0
- package/dist/commands/workspace/edit/index.js +16 -6
- package/dist/commands/workspace/get/index.js +9 -7
- package/dist/commands/workspace/list/index.d.ts +1 -0
- package/dist/commands/workspace/list/index.js +14 -7
- package/dist/commands/workspace/push/index.d.ts +2 -0
- package/dist/commands/workspace/push/index.js +81 -6
- package/dist/utils/reference-checker.d.ts +57 -0
- package/dist/utils/reference-checker.js +232 -0
- package/oclif.manifest.json +1745 -2451
- package/package.json +8 -8
- package/dist/commands/ephemeral/access/index.d.ts +0 -15
- package/dist/commands/ephemeral/access/index.js +0 -78
- package/dist/commands/ephemeral/create/index.d.ts +0 -17
- package/dist/commands/ephemeral/create/index.js +0 -102
- package/dist/commands/ephemeral/delete/index.js +0 -99
- package/dist/commands/ephemeral/env/get/index.js +0 -81
- package/dist/commands/ephemeral/env/get_all/index.js +0 -94
- package/dist/commands/ephemeral/env/list/index.js +0 -83
- package/dist/commands/ephemeral/env/set/index.js +0 -90
- package/dist/commands/ephemeral/get/index.js +0 -102
- package/dist/commands/ephemeral/license/get/index.js +0 -94
- package/dist/commands/ephemeral/list/index.d.ts +0 -15
- package/dist/commands/ephemeral/list/index.js +0 -109
- package/dist/commands/ephemeral/shared/index.d.ts +0 -15
- package/dist/commands/ephemeral/shared/index.js +0 -108
- package/dist/commands/ephemeral/workflow_test/delete/index.d.ts +0 -18
- package/dist/commands/ephemeral/workflow_test/delete/index.js +0 -75
- package/dist/commands/ephemeral/workflow_test/get/index.js +0 -77
- package/dist/commands/ephemeral/workflow_test/run/index.d.ts +0 -18
- package/dist/commands/tenant/workflow_test/delete/index.d.ts +0 -19
- package/dist/commands/tenant/workflow_test/delete/index.js +0 -110
- package/dist/commands/tenant/workflow_test/get/index.d.ts +0 -19
- package/dist/commands/tenant/workflow_test/get/index.js +0 -112
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
4
|
-
static description = 'List all unit tests for
|
|
3
|
+
export default class SandboxUnitTestList extends BaseCommand {
|
|
4
|
+
static description = 'List all unit tests for a sandbox environment';
|
|
5
5
|
static examples = [
|
|
6
|
-
`$ xano
|
|
6
|
+
`$ xano sandbox unit-test list
|
|
7
7
|
Unit tests:
|
|
8
8
|
- my-test (ID: abc-123) [function: math]
|
|
9
9
|
`,
|
|
10
|
-
`$ xano
|
|
10
|
+
`$ xano sandbox unit-test list -o json`,
|
|
11
11
|
];
|
|
12
12
|
static flags = {
|
|
13
13
|
...BaseCommand.baseFlags,
|
|
@@ -28,33 +28,17 @@ Unit tests:
|
|
|
28
28
|
options: ['summary', 'json'],
|
|
29
29
|
required: false,
|
|
30
30
|
}),
|
|
31
|
-
tenant: Flags.string({
|
|
32
|
-
char: 't',
|
|
33
|
-
description: 'Ephemeral tenant name',
|
|
34
|
-
required: true,
|
|
35
|
-
}),
|
|
36
31
|
};
|
|
37
32
|
async run() {
|
|
38
|
-
const { flags } = await this.parse(
|
|
39
|
-
const
|
|
40
|
-
const credentials = this.loadCredentialsFile();
|
|
41
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
42
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
43
|
-
}
|
|
44
|
-
const profile = credentials.profiles[profileName];
|
|
45
|
-
if (!profile.instance_origin) {
|
|
46
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
47
|
-
}
|
|
48
|
-
if (!profile.access_token) {
|
|
49
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
50
|
-
}
|
|
33
|
+
const { flags } = await this.parse(SandboxUnitTestList);
|
|
34
|
+
const { profile } = this.resolveProfile(flags);
|
|
51
35
|
const params = new URLSearchParams();
|
|
52
36
|
params.set('per_page', '10000');
|
|
53
37
|
if (flags.branch)
|
|
54
38
|
params.set('branch', flags.branch);
|
|
55
39
|
if (flags['obj-type'])
|
|
56
40
|
params.set('obj_type', flags['obj-type']);
|
|
57
|
-
const apiUrl = `${profile.instance_origin}/api:meta/
|
|
41
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/unit_test?${params}`;
|
|
58
42
|
try {
|
|
59
43
|
const response = await this.verboseFetch(apiUrl, {
|
|
60
44
|
headers: {
|
|
@@ -64,8 +48,8 @@ Unit tests:
|
|
|
64
48
|
method: 'GET',
|
|
65
49
|
}, flags.verbose, profile.access_token);
|
|
66
50
|
if (!response.ok) {
|
|
67
|
-
const
|
|
68
|
-
this.error(
|
|
51
|
+
const message = await this.parseApiError(response, 'API request failed');
|
|
52
|
+
this.error(message);
|
|
69
53
|
}
|
|
70
54
|
const data = (await response.json());
|
|
71
55
|
let tests;
|
|
@@ -86,7 +70,7 @@ Unit tests:
|
|
|
86
70
|
this.log('No unit tests found');
|
|
87
71
|
}
|
|
88
72
|
else {
|
|
89
|
-
this.log(`Unit tests for
|
|
73
|
+
this.log(`Unit tests for sandbox environment:`);
|
|
90
74
|
for (const test of tests) {
|
|
91
75
|
this.log(` - ${test.name} (ID: ${test.id}) [${test.obj_type}: ${test.obj_name}]`);
|
|
92
76
|
}
|
|
@@ -94,6 +78,8 @@ Unit tests:
|
|
|
94
78
|
}
|
|
95
79
|
}
|
|
96
80
|
catch (error) {
|
|
81
|
+
if (error instanceof Error && 'oclif' in error)
|
|
82
|
+
throw error;
|
|
97
83
|
if (error instanceof Error) {
|
|
98
84
|
this.error(`Failed to list unit tests: ${error.message}`);
|
|
99
85
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxUnitTestRun extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
4
|
unit_test_id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
@@ -7,7 +7,6 @@ export default class EphemeralUnitTestRun extends BaseCommand {
|
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
10
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
12
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
3
|
+
export default class SandboxUnitTestRun extends BaseCommand {
|
|
4
4
|
static args = {
|
|
5
5
|
unit_test_id: Args.string({
|
|
6
6
|
description: 'ID of the unit test to run',
|
|
7
7
|
required: true,
|
|
8
8
|
}),
|
|
9
9
|
};
|
|
10
|
-
static description = 'Run a unit test for
|
|
10
|
+
static description = 'Run a unit test for a sandbox environment';
|
|
11
11
|
static examples = [
|
|
12
|
-
`$ xano
|
|
12
|
+
`$ xano sandbox unit-test run abc-123
|
|
13
13
|
Running unit test abc-123...
|
|
14
14
|
Result: PASS
|
|
15
15
|
`,
|
|
16
|
-
`$ xano
|
|
16
|
+
`$ xano sandbox unit-test run abc-123 -o json`,
|
|
17
17
|
];
|
|
18
18
|
static flags = {
|
|
19
19
|
...BaseCommand.baseFlags,
|
|
@@ -24,27 +24,11 @@ Result: PASS
|
|
|
24
24
|
options: ['summary', 'json'],
|
|
25
25
|
required: false,
|
|
26
26
|
}),
|
|
27
|
-
tenant: Flags.string({
|
|
28
|
-
char: 't',
|
|
29
|
-
description: 'Ephemeral tenant name',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
27
|
};
|
|
33
28
|
async run() {
|
|
34
|
-
const { args, flags } = await this.parse(
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
38
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
39
|
-
}
|
|
40
|
-
const profile = credentials.profiles[profileName];
|
|
41
|
-
if (!profile.instance_origin) {
|
|
42
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
43
|
-
}
|
|
44
|
-
if (!profile.access_token) {
|
|
45
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
46
|
-
}
|
|
47
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
|
|
29
|
+
const { args, flags } = await this.parse(SandboxUnitTestRun);
|
|
30
|
+
const { profile } = this.resolveProfile(flags);
|
|
31
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
|
|
48
32
|
try {
|
|
49
33
|
if (flags.output === 'summary') {
|
|
50
34
|
this.log(`Running unit test ${args.unit_test_id}...`);
|
|
@@ -58,8 +42,8 @@ Result: PASS
|
|
|
58
42
|
method: 'POST',
|
|
59
43
|
}, flags.verbose, profile.access_token);
|
|
60
44
|
if (!response.ok) {
|
|
61
|
-
const
|
|
62
|
-
this.error(
|
|
45
|
+
const message = await this.parseApiError(response, 'API request failed');
|
|
46
|
+
this.error(message);
|
|
63
47
|
}
|
|
64
48
|
const result = (await response.json());
|
|
65
49
|
if (flags.output === 'json') {
|
|
@@ -82,6 +66,8 @@ Result: PASS
|
|
|
82
66
|
}
|
|
83
67
|
}
|
|
84
68
|
catch (error) {
|
|
69
|
+
if (error instanceof Error && 'oclif' in error)
|
|
70
|
+
throw error;
|
|
85
71
|
if (error instanceof Error) {
|
|
86
72
|
this.error(`Failed to run unit test: ${error.message}`);
|
|
87
73
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxUnitTestRunAll extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
'obj-type': 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
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
10
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
4
|
-
static description = 'Run all unit tests for
|
|
3
|
+
export default class SandboxUnitTestRunAll extends BaseCommand {
|
|
4
|
+
static description = 'Run all unit tests for a sandbox environment';
|
|
5
5
|
static examples = [
|
|
6
|
-
`$ xano
|
|
6
|
+
`$ xano sandbox unit-test run-all
|
|
7
7
|
Running 5 unit tests...
|
|
8
8
|
|
|
9
9
|
PASS my-test [function: math]
|
|
@@ -12,7 +12,7 @@ FAIL data-validation [function: validate]
|
|
|
12
12
|
|
|
13
13
|
Results: 4 passed, 1 failed
|
|
14
14
|
`,
|
|
15
|
-
`$ xano
|
|
15
|
+
`$ xano sandbox unit-test run-all -o json`,
|
|
16
16
|
];
|
|
17
17
|
static flags = {
|
|
18
18
|
...BaseCommand.baseFlags,
|
|
@@ -33,27 +33,11 @@ Results: 4 passed, 1 failed
|
|
|
33
33
|
options: ['summary', 'json'],
|
|
34
34
|
required: false,
|
|
35
35
|
}),
|
|
36
|
-
tenant: Flags.string({
|
|
37
|
-
char: 't',
|
|
38
|
-
description: 'Ephemeral tenant name',
|
|
39
|
-
required: true,
|
|
40
|
-
}),
|
|
41
36
|
};
|
|
42
37
|
async run() {
|
|
43
|
-
const { flags } = await this.parse(
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
47
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
48
|
-
}
|
|
49
|
-
const profile = credentials.profiles[profileName];
|
|
50
|
-
if (!profile.instance_origin) {
|
|
51
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
52
|
-
}
|
|
53
|
-
if (!profile.access_token) {
|
|
54
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
55
|
-
}
|
|
56
|
-
const baseUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/unit_test`;
|
|
38
|
+
const { flags } = await this.parse(SandboxUnitTestRunAll);
|
|
39
|
+
const { profile } = this.resolveProfile(flags);
|
|
40
|
+
const baseUrl = `${profile.instance_origin}/api:meta/sandbox/unit_test`;
|
|
57
41
|
try {
|
|
58
42
|
// Step 1: List all unit tests
|
|
59
43
|
const listParams = new URLSearchParams();
|
|
@@ -144,6 +128,8 @@ Results: 4 passed, 1 failed
|
|
|
144
128
|
}
|
|
145
129
|
}
|
|
146
130
|
catch (error) {
|
|
131
|
+
if (error instanceof Error && 'oclif' in error)
|
|
132
|
+
throw error;
|
|
147
133
|
const message = error instanceof Error ? error.message : String(error);
|
|
148
134
|
results.push({
|
|
149
135
|
message,
|
|
@@ -172,6 +158,8 @@ Results: 4 passed, 1 failed
|
|
|
172
158
|
}
|
|
173
159
|
}
|
|
174
160
|
catch (error) {
|
|
161
|
+
if (error instanceof Error && 'oclif' in error)
|
|
162
|
+
throw error;
|
|
175
163
|
if (error instanceof Error) {
|
|
176
164
|
this.error(`Failed to run unit tests: ${error.message}`);
|
|
177
165
|
}
|
package/dist/commands/{ephemeral/workflow_test/run_all → sandbox/workflow_test/list}/index.d.ts
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxWorkflowTestList extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
branch: 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
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
8
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
10
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
4
|
-
static description = 'List workflow tests for
|
|
3
|
+
export default class SandboxWorkflowTestList extends BaseCommand {
|
|
4
|
+
static description = 'List workflow tests for a sandbox environment';
|
|
5
5
|
static examples = [
|
|
6
|
-
`$ xano
|
|
7
|
-
Workflow tests
|
|
6
|
+
`$ xano sandbox workflow-test list
|
|
7
|
+
Workflow tests:
|
|
8
8
|
- my-test (ID: 1)
|
|
9
9
|
`,
|
|
10
|
-
`$ xano
|
|
10
|
+
`$ xano sandbox workflow-test list -o json`,
|
|
11
11
|
];
|
|
12
12
|
static flags = {
|
|
13
13
|
...BaseCommand.baseFlags,
|
|
@@ -23,31 +23,15 @@ Workflow tests for tenant e1a2-b3c4-x5y6:
|
|
|
23
23
|
options: ['summary', 'json'],
|
|
24
24
|
required: false,
|
|
25
25
|
}),
|
|
26
|
-
tenant: Flags.string({
|
|
27
|
-
char: 't',
|
|
28
|
-
description: 'Ephemeral tenant name',
|
|
29
|
-
required: true,
|
|
30
|
-
}),
|
|
31
26
|
};
|
|
32
27
|
async run() {
|
|
33
|
-
const { flags } = await this.parse(
|
|
34
|
-
const
|
|
35
|
-
const credentials = this.loadCredentialsFile();
|
|
36
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
37
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
38
|
-
}
|
|
39
|
-
const profile = credentials.profiles[profileName];
|
|
40
|
-
if (!profile.instance_origin) {
|
|
41
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
42
|
-
}
|
|
43
|
-
if (!profile.access_token) {
|
|
44
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
45
|
-
}
|
|
28
|
+
const { flags } = await this.parse(SandboxWorkflowTestList);
|
|
29
|
+
const { profile } = this.resolveProfile(flags);
|
|
46
30
|
const params = new URLSearchParams();
|
|
47
31
|
params.set('per_page', '10000');
|
|
48
32
|
if (flags.branch)
|
|
49
33
|
params.set('branch', flags.branch);
|
|
50
|
-
const apiUrl = `${profile.instance_origin}/api:meta/
|
|
34
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/workflow_test?${params}`;
|
|
51
35
|
try {
|
|
52
36
|
const response = await this.verboseFetch(apiUrl, {
|
|
53
37
|
headers: {
|
|
@@ -57,8 +41,8 @@ Workflow tests for tenant e1a2-b3c4-x5y6:
|
|
|
57
41
|
method: 'GET',
|
|
58
42
|
}, flags.verbose, profile.access_token);
|
|
59
43
|
if (!response.ok) {
|
|
60
|
-
const
|
|
61
|
-
this.error(
|
|
44
|
+
const message = await this.parseApiError(response, 'API request failed');
|
|
45
|
+
this.error(message);
|
|
62
46
|
}
|
|
63
47
|
const data = (await response.json());
|
|
64
48
|
let tests;
|
|
@@ -79,7 +63,7 @@ Workflow tests for tenant e1a2-b3c4-x5y6:
|
|
|
79
63
|
this.log('No workflow tests found');
|
|
80
64
|
}
|
|
81
65
|
else {
|
|
82
|
-
this.log(`Workflow tests for
|
|
66
|
+
this.log(`Workflow tests for sandbox environment:`);
|
|
83
67
|
for (const test of tests) {
|
|
84
68
|
this.log(` - ${test.name} (ID: ${test.id})`);
|
|
85
69
|
}
|
|
@@ -87,6 +71,8 @@ Workflow tests for tenant e1a2-b3c4-x5y6:
|
|
|
87
71
|
}
|
|
88
72
|
}
|
|
89
73
|
catch (error) {
|
|
74
|
+
if (error instanceof Error && 'oclif' in error)
|
|
75
|
+
throw error;
|
|
90
76
|
if (error instanceof Error) {
|
|
91
77
|
this.error(`Failed to list workflow tests: ${error.message}`);
|
|
92
78
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxWorkflowTestRun extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
4
|
workflow_test_id: import("@oclif/core/interfaces").Arg<number, {
|
|
5
5
|
max?: number;
|
|
@@ -10,7 +10,6 @@ export default class EphemeralWorkflowTestGet extends BaseCommand {
|
|
|
10
10
|
static examples: string[];
|
|
11
11
|
static flags: {
|
|
12
12
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
13
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
14
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
15
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
3
|
+
export default class SandboxWorkflowTestRun extends BaseCommand {
|
|
4
4
|
static args = {
|
|
5
5
|
workflow_test_id: Args.integer({
|
|
6
6
|
description: 'ID of the workflow test to run',
|
|
7
7
|
required: true,
|
|
8
8
|
}),
|
|
9
9
|
};
|
|
10
|
-
static description = 'Run a workflow test for
|
|
10
|
+
static description = 'Run a workflow test for a sandbox environment';
|
|
11
11
|
static examples = [
|
|
12
|
-
`$ xano
|
|
12
|
+
`$ xano sandbox workflow-test run 42
|
|
13
13
|
Running workflow test 42...
|
|
14
14
|
Result: PASS (0.25s)
|
|
15
15
|
`,
|
|
16
|
-
`$ xano
|
|
16
|
+
`$ xano sandbox workflow-test run 42 -o json`,
|
|
17
17
|
];
|
|
18
18
|
static flags = {
|
|
19
19
|
...BaseCommand.baseFlags,
|
|
@@ -24,27 +24,11 @@ Result: PASS (0.25s)
|
|
|
24
24
|
options: ['summary', 'json'],
|
|
25
25
|
required: false,
|
|
26
26
|
}),
|
|
27
|
-
tenant: Flags.string({
|
|
28
|
-
char: 't',
|
|
29
|
-
description: 'Ephemeral tenant name',
|
|
30
|
-
required: true,
|
|
31
|
-
}),
|
|
32
27
|
};
|
|
33
28
|
async run() {
|
|
34
|
-
const { args, flags } = await this.parse(
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
38
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
39
|
-
}
|
|
40
|
-
const profile = credentials.profiles[profileName];
|
|
41
|
-
if (!profile.instance_origin) {
|
|
42
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
43
|
-
}
|
|
44
|
-
if (!profile.access_token) {
|
|
45
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
46
|
-
}
|
|
47
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/workflow_test/${args.workflow_test_id}/run`;
|
|
29
|
+
const { args, flags } = await this.parse(SandboxWorkflowTestRun);
|
|
30
|
+
const { profile } = this.resolveProfile(flags);
|
|
31
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/workflow_test/${args.workflow_test_id}/run`;
|
|
48
32
|
try {
|
|
49
33
|
if (flags.output === 'summary') {
|
|
50
34
|
this.log(`Running workflow test ${args.workflow_test_id}...`);
|
|
@@ -58,8 +42,8 @@ Result: PASS (0.25s)
|
|
|
58
42
|
method: 'POST',
|
|
59
43
|
}, flags.verbose, profile.access_token);
|
|
60
44
|
if (!response.ok) {
|
|
61
|
-
const
|
|
62
|
-
this.error(
|
|
45
|
+
const message = await this.parseApiError(response, 'API request failed');
|
|
46
|
+
this.error(message);
|
|
63
47
|
}
|
|
64
48
|
const result = (await response.json());
|
|
65
49
|
if (flags.output === 'json') {
|
|
@@ -80,6 +64,8 @@ Result: PASS (0.25s)
|
|
|
80
64
|
}
|
|
81
65
|
}
|
|
82
66
|
catch (error) {
|
|
67
|
+
if (error instanceof Error && 'oclif' in error)
|
|
68
|
+
throw error;
|
|
83
69
|
if (error instanceof Error) {
|
|
84
70
|
this.error(`Failed to run workflow test: ${error.message}`);
|
|
85
71
|
}
|
package/dist/commands/{ephemeral/workflow_test/list → sandbox/workflow_test/run_all}/index.d.ts
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxWorkflowTestRunAll extends BaseCommand {
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
6
|
branch: 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
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
8
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
10
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
4
|
-
static description = 'Run all workflow tests for
|
|
3
|
+
export default class SandboxWorkflowTestRunAll extends BaseCommand {
|
|
4
|
+
static description = 'Run all workflow tests for a sandbox environment';
|
|
5
5
|
static examples = [
|
|
6
|
-
`$ xano
|
|
6
|
+
`$ xano sandbox workflow-test run-all
|
|
7
7
|
Running 3 workflow tests...
|
|
8
8
|
|
|
9
9
|
PASS my-test (0.25s)
|
|
@@ -12,7 +12,7 @@ FAIL data-check (0.10s)
|
|
|
12
12
|
|
|
13
13
|
Results: 2 passed, 1 failed
|
|
14
14
|
`,
|
|
15
|
-
`$ xano
|
|
15
|
+
`$ xano sandbox workflow-test run-all -o json`,
|
|
16
16
|
];
|
|
17
17
|
static flags = {
|
|
18
18
|
...BaseCommand.baseFlags,
|
|
@@ -28,27 +28,11 @@ Results: 2 passed, 1 failed
|
|
|
28
28
|
options: ['summary', 'json'],
|
|
29
29
|
required: false,
|
|
30
30
|
}),
|
|
31
|
-
tenant: Flags.string({
|
|
32
|
-
char: 't',
|
|
33
|
-
description: 'Ephemeral tenant name',
|
|
34
|
-
required: true,
|
|
35
|
-
}),
|
|
36
31
|
};
|
|
37
32
|
async run() {
|
|
38
|
-
const { flags } = await this.parse(
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
42
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
43
|
-
}
|
|
44
|
-
const profile = credentials.profiles[profileName];
|
|
45
|
-
if (!profile.instance_origin) {
|
|
46
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
47
|
-
}
|
|
48
|
-
if (!profile.access_token) {
|
|
49
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
50
|
-
}
|
|
51
|
-
const baseUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/workflow_test`;
|
|
33
|
+
const { flags } = await this.parse(SandboxWorkflowTestRunAll);
|
|
34
|
+
const { profile } = this.resolveProfile(flags);
|
|
35
|
+
const baseUrl = `${profile.instance_origin}/api:meta/sandbox/workflow_test`;
|
|
52
36
|
try {
|
|
53
37
|
// Step 1: List all workflow tests
|
|
54
38
|
const listParams = new URLSearchParams();
|
|
@@ -132,6 +116,8 @@ Results: 2 passed, 1 failed
|
|
|
132
116
|
}
|
|
133
117
|
}
|
|
134
118
|
catch (error) {
|
|
119
|
+
if (error instanceof Error && 'oclif' in error)
|
|
120
|
+
throw error;
|
|
135
121
|
const message = error instanceof Error ? error.message : String(error);
|
|
136
122
|
results.push({
|
|
137
123
|
message,
|
|
@@ -158,6 +144,8 @@ Results: 2 passed, 1 failed
|
|
|
158
144
|
}
|
|
159
145
|
}
|
|
160
146
|
catch (error) {
|
|
147
|
+
if (error instanceof Error && 'oclif' in error)
|
|
148
|
+
throw error;
|
|
161
149
|
if (error instanceof Error) {
|
|
162
150
|
this.error(`Failed to run workflow tests: ${error.message}`);
|
|
163
151
|
}
|
|
@@ -10,9 +10,10 @@ export default class TenantCreate extends BaseCommand {
|
|
|
10
10
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
11
|
domain: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
12
|
ingress: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
license: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
license: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
14
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
platform_id: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
type: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
17
|
tasks: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
18
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
19
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -16,7 +16,8 @@ export default class TenantCreate extends BaseCommand {
|
|
|
16
16
|
`$ xano tenant create "Production"
|
|
17
17
|
Created tenant: Production (production) - ID: 42
|
|
18
18
|
`,
|
|
19
|
-
`$ xano tenant create "Staging" --description "Staging env" --cluster_id 1 --platform_id 1 --
|
|
19
|
+
`$ xano tenant create "Staging" --description "Staging env" --cluster_id 1 --platform_id 1 --type tier2 -o json`,
|
|
20
|
+
`$ xano tenant create "Staging" --type tier2 --cluster_id 1 --license ./license.yaml`,
|
|
20
21
|
];
|
|
21
22
|
static flags = {
|
|
22
23
|
...BaseCommand.baseFlags,
|
|
@@ -39,9 +40,8 @@ Created tenant: Production (production) - ID: 42
|
|
|
39
40
|
description: 'Enable ingress',
|
|
40
41
|
}),
|
|
41
42
|
license: Flags.string({
|
|
42
|
-
|
|
43
|
-
description: '
|
|
44
|
-
options: ['tier1', 'tier2', 'tier3'],
|
|
43
|
+
char: 'l',
|
|
44
|
+
description: 'Path to a license override file to apply during creation',
|
|
45
45
|
required: false,
|
|
46
46
|
}),
|
|
47
47
|
output: Flags.string({
|
|
@@ -55,6 +55,12 @@ Created tenant: Production (production) - ID: 42
|
|
|
55
55
|
description: 'Platform ID to use',
|
|
56
56
|
required: false,
|
|
57
57
|
}),
|
|
58
|
+
type: Flags.string({
|
|
59
|
+
default: 'tier1',
|
|
60
|
+
description: 'Tenant type',
|
|
61
|
+
options: ['tier1', 'tier2', 'tier3'],
|
|
62
|
+
required: false,
|
|
63
|
+
}),
|
|
58
64
|
tasks: Flags.boolean({
|
|
59
65
|
allowNo: true,
|
|
60
66
|
default: true,
|
|
@@ -88,7 +94,7 @@ Created tenant: Production (production) - ID: 42
|
|
|
88
94
|
const body = {
|
|
89
95
|
display: args.display,
|
|
90
96
|
ingress: flags.ingress,
|
|
91
|
-
license: flags.
|
|
97
|
+
license: flags.type,
|
|
92
98
|
tag: [],
|
|
93
99
|
tasks: flags.tasks,
|
|
94
100
|
};
|
|
@@ -102,7 +108,16 @@ Created tenant: Production (production) - ID: 42
|
|
|
102
108
|
body.platform_id = flags.platform_id;
|
|
103
109
|
if (flags.domain)
|
|
104
110
|
body.domain = flags.domain;
|
|
105
|
-
if (flags.license
|
|
111
|
+
if (flags.license) {
|
|
112
|
+
const licensePath = path.resolve(flags.license);
|
|
113
|
+
if (!fs.existsSync(licensePath)) {
|
|
114
|
+
this.error(`License file not found: ${licensePath}`);
|
|
115
|
+
}
|
|
116
|
+
const licenseContent = fs.readFileSync(licensePath, 'utf8');
|
|
117
|
+
body.license_overrides = yaml.load(licenseContent);
|
|
118
|
+
}
|
|
119
|
+
const effectiveType = flags.cluster_id ? 'tier3' : flags.type;
|
|
120
|
+
if (effectiveType === 'tier2' || effectiveType === 'tier3') {
|
|
106
121
|
this.warn('This may take a few minutes. Please be patient.');
|
|
107
122
|
}
|
|
108
123
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant`;
|
|
@@ -129,6 +144,8 @@ Created tenant: Production (production) - ID: 42
|
|
|
129
144
|
if (tenant.state) {
|
|
130
145
|
this.log(` State: ${tenant.state}`);
|
|
131
146
|
}
|
|
147
|
+
if (flags.license)
|
|
148
|
+
this.log(` License: applied`);
|
|
132
149
|
}
|
|
133
150
|
}
|
|
134
151
|
catch (error) {
|
|
@@ -8,6 +8,7 @@ export default class TenantDeployRelease extends BaseCommand {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
release: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
12
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
13
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|