@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,77 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class EphemeralWorkflowTestGet extends BaseCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
workflow_test_id: Args.integer({
|
|
6
|
-
description: 'ID of the workflow test',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Get a workflow test for an ephemeral tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano ephemeral workflow-test get 42 -t e1a2-b3c4-x5y6`,
|
|
13
|
-
`$ xano ephemeral workflow-test get 42 -t e1a2-b3c4-x5y6 -o json`,
|
|
14
|
-
];
|
|
15
|
-
static flags = {
|
|
16
|
-
...BaseCommand.baseFlags,
|
|
17
|
-
output: Flags.string({
|
|
18
|
-
char: 'o',
|
|
19
|
-
default: 'summary',
|
|
20
|
-
description: 'Output format',
|
|
21
|
-
options: ['summary', 'json'],
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
tenant: Flags.string({
|
|
25
|
-
char: 't',
|
|
26
|
-
description: 'Ephemeral tenant name',
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
async run() {
|
|
31
|
-
const { args, flags } = await this.parse(EphemeralWorkflowTestGet);
|
|
32
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
33
|
-
const credentials = this.loadCredentialsFile();
|
|
34
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
35
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
36
|
-
}
|
|
37
|
-
const profile = credentials.profiles[profileName];
|
|
38
|
-
if (!profile.instance_origin) {
|
|
39
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
40
|
-
}
|
|
41
|
-
if (!profile.access_token) {
|
|
42
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
43
|
-
}
|
|
44
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/workflow_test/${args.workflow_test_id}`;
|
|
45
|
-
try {
|
|
46
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
47
|
-
headers: {
|
|
48
|
-
accept: 'application/json',
|
|
49
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
50
|
-
},
|
|
51
|
-
method: 'GET',
|
|
52
|
-
}, flags.verbose, profile.access_token);
|
|
53
|
-
if (!response.ok) {
|
|
54
|
-
const errorText = await response.text();
|
|
55
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
56
|
-
}
|
|
57
|
-
const test = await response.json();
|
|
58
|
-
if (flags.output === 'json') {
|
|
59
|
-
this.log(JSON.stringify(test, null, 2));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
const t = test;
|
|
63
|
-
this.log(`Workflow Test: ${t.name} (ID: ${t.id})`);
|
|
64
|
-
if (t.description)
|
|
65
|
-
this.log(` Description: ${t.description}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
if (error instanceof Error) {
|
|
70
|
-
this.error(`Failed to get workflow test: ${error.message}`);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
this.error(`Failed to get workflow test: ${String(error)}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class EphemeralWorkflowTestRun extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workflow_test_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
|
-
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
|
-
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
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class TenantWorkflowTestDelete extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workflow_test_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
|
-
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
|
-
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
};
|
|
18
|
-
run(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class TenantWorkflowTestDelete extends BaseCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
workflow_test_id: Args.integer({
|
|
6
|
-
description: 'ID of the workflow test to delete',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Delete a workflow test for a tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano tenant workflow-test delete 42 -t my-tenant
|
|
13
|
-
Deleted workflow test 42
|
|
14
|
-
`,
|
|
15
|
-
`$ xano tenant workflow-test delete 42 -t my-tenant -o json`,
|
|
16
|
-
];
|
|
17
|
-
static flags = {
|
|
18
|
-
...BaseCommand.baseFlags,
|
|
19
|
-
output: Flags.string({
|
|
20
|
-
char: 'o',
|
|
21
|
-
default: 'summary',
|
|
22
|
-
description: 'Output format',
|
|
23
|
-
options: ['summary', 'json'],
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
tenant: Flags.string({
|
|
27
|
-
char: 't',
|
|
28
|
-
description: 'Tenant name',
|
|
29
|
-
required: true,
|
|
30
|
-
}),
|
|
31
|
-
workspace: Flags.string({
|
|
32
|
-
char: 'w',
|
|
33
|
-
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
34
|
-
required: false,
|
|
35
|
-
}),
|
|
36
|
-
};
|
|
37
|
-
async run() {
|
|
38
|
-
const { args, flags } = await this.parse(TenantWorkflowTestDelete);
|
|
39
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
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
|
-
}
|
|
51
|
-
const workspaceId = flags.workspace || profile.workspace;
|
|
52
|
-
if (!workspaceId) {
|
|
53
|
-
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
54
|
-
}
|
|
55
|
-
// Resolve tenant to get its workspace
|
|
56
|
-
const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
|
|
57
|
-
let tenantWorkspaceId;
|
|
58
|
-
try {
|
|
59
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
60
|
-
headers: {
|
|
61
|
-
accept: 'application/json',
|
|
62
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
63
|
-
},
|
|
64
|
-
method: 'GET',
|
|
65
|
-
}, flags.verbose, profile.access_token);
|
|
66
|
-
if (!tenantResponse.ok) {
|
|
67
|
-
const errorText = await tenantResponse.text();
|
|
68
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
69
|
-
}
|
|
70
|
-
const tenant = (await tenantResponse.json());
|
|
71
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
if (error instanceof Error) {
|
|
75
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test/${args.workflow_test_id}`;
|
|
82
|
-
try {
|
|
83
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
84
|
-
headers: {
|
|
85
|
-
accept: 'application/json',
|
|
86
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
87
|
-
},
|
|
88
|
-
method: 'DELETE',
|
|
89
|
-
}, flags.verbose, profile.access_token);
|
|
90
|
-
if (!response.ok) {
|
|
91
|
-
const errorText = await response.text();
|
|
92
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
93
|
-
}
|
|
94
|
-
if (flags.output === 'json') {
|
|
95
|
-
this.log(JSON.stringify({ deleted: true, workflow_test_id: args.workflow_test_id }, null, 2));
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this.log(`Deleted workflow test ${args.workflow_test_id}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
if (error instanceof Error) {
|
|
103
|
-
this.error(`Failed to delete workflow test: ${error.message}`);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.error(`Failed to delete workflow test: ${String(error)}`);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class TenantWorkflowTestGet extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
workflow_test_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
|
-
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
|
-
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
};
|
|
18
|
-
run(): Promise<void>;
|
|
19
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class TenantWorkflowTestGet extends BaseCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
workflow_test_id: Args.integer({
|
|
6
|
-
description: 'ID of the workflow test',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Get a workflow test for a tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano tenant workflow-test get 42 -t my-tenant`,
|
|
13
|
-
`$ xano tenant workflow-test get 42 -t my-tenant -o json`,
|
|
14
|
-
];
|
|
15
|
-
static flags = {
|
|
16
|
-
...BaseCommand.baseFlags,
|
|
17
|
-
output: Flags.string({
|
|
18
|
-
char: 'o',
|
|
19
|
-
default: 'summary',
|
|
20
|
-
description: 'Output format',
|
|
21
|
-
options: ['summary', 'json'],
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
tenant: Flags.string({
|
|
25
|
-
char: 't',
|
|
26
|
-
description: 'Tenant name',
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
workspace: Flags.string({
|
|
30
|
-
char: 'w',
|
|
31
|
-
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
32
|
-
required: false,
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
async run() {
|
|
36
|
-
const { args, flags } = await this.parse(TenantWorkflowTestGet);
|
|
37
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
38
|
-
const credentials = this.loadCredentialsFile();
|
|
39
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
40
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
41
|
-
}
|
|
42
|
-
const profile = credentials.profiles[profileName];
|
|
43
|
-
if (!profile.instance_origin) {
|
|
44
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
45
|
-
}
|
|
46
|
-
if (!profile.access_token) {
|
|
47
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
48
|
-
}
|
|
49
|
-
const workspaceId = flags.workspace || profile.workspace;
|
|
50
|
-
if (!workspaceId) {
|
|
51
|
-
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
52
|
-
}
|
|
53
|
-
// Resolve tenant to get its workspace
|
|
54
|
-
const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
|
|
55
|
-
let tenantWorkspaceId;
|
|
56
|
-
try {
|
|
57
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
58
|
-
headers: {
|
|
59
|
-
accept: 'application/json',
|
|
60
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
61
|
-
},
|
|
62
|
-
method: 'GET',
|
|
63
|
-
}, flags.verbose, profile.access_token);
|
|
64
|
-
if (!tenantResponse.ok) {
|
|
65
|
-
const errorText = await tenantResponse.text();
|
|
66
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
67
|
-
}
|
|
68
|
-
const tenant = (await tenantResponse.json());
|
|
69
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
if (error instanceof Error) {
|
|
73
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test/${args.workflow_test_id}`;
|
|
80
|
-
try {
|
|
81
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
82
|
-
headers: {
|
|
83
|
-
accept: 'application/json',
|
|
84
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
85
|
-
},
|
|
86
|
-
method: 'GET',
|
|
87
|
-
}, flags.verbose, profile.access_token);
|
|
88
|
-
if (!response.ok) {
|
|
89
|
-
const errorText = await response.text();
|
|
90
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
91
|
-
}
|
|
92
|
-
const test = await response.json();
|
|
93
|
-
if (flags.output === 'json') {
|
|
94
|
-
this.log(JSON.stringify(test, null, 2));
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
const t = test;
|
|
98
|
-
this.log(`Workflow Test: ${t.name} (ID: ${t.id})`);
|
|
99
|
-
if (t.description)
|
|
100
|
-
this.log(` Description: ${t.description}`);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
catch (error) {
|
|
104
|
-
if (error instanceof Error) {
|
|
105
|
-
this.error(`Failed to get workflow test: ${error.message}`);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
this.error(`Failed to get workflow test: ${String(error)}`);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|