@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
|
@@ -16,6 +16,7 @@ export default class TenantDeployRelease extends BaseCommand {
|
|
|
16
16
|
`$ xano tenant deploy_release t1234-abcd-xyz1 --release v1.0
|
|
17
17
|
Deployed release "v1.0" to tenant: My Tenant (my-tenant)
|
|
18
18
|
`,
|
|
19
|
+
`$ xano tenant deploy_release t1234-abcd-xyz1 --release v1.0 --no-transaction`,
|
|
19
20
|
`$ xano tenant deploy_release t1234-abcd-xyz1 --release v1.0 -o json`,
|
|
20
21
|
];
|
|
21
22
|
static flags = {
|
|
@@ -32,6 +33,12 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
|
|
|
32
33
|
description: 'Release name to deploy',
|
|
33
34
|
required: true,
|
|
34
35
|
}),
|
|
36
|
+
transaction: Flags.boolean({
|
|
37
|
+
allowNo: true,
|
|
38
|
+
default: true,
|
|
39
|
+
description: 'Wrap deployment in a database transaction (use --no-transaction to disable)',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
35
42
|
workspace: Flags.string({
|
|
36
43
|
char: 'w',
|
|
37
44
|
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
@@ -64,7 +71,7 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
|
|
|
64
71
|
const startTime = Date.now();
|
|
65
72
|
try {
|
|
66
73
|
const response = await this.verboseFetch(apiUrl, {
|
|
67
|
-
body: JSON.stringify({ release_name: releaseName }),
|
|
74
|
+
body: JSON.stringify({ release_name: releaseName, transaction: flags.transaction }),
|
|
68
75
|
headers: {
|
|
69
76
|
accept: 'application/json',
|
|
70
77
|
Authorization: `Bearer ${profile.access_token}`,
|
|
@@ -87,6 +94,7 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
|
|
|
87
94
|
this.log(` State: ${tenant.state}`);
|
|
88
95
|
if (tenant.release?.name)
|
|
89
96
|
this.log(` Release: ${tenant.release.name}`);
|
|
97
|
+
this.log(` Transaction: ${flags.transaction ? 'enabled' : 'disabled'}`);
|
|
90
98
|
this.log(` Time: ${elapsed}s`);
|
|
91
99
|
}
|
|
92
100
|
}
|
|
@@ -99,8 +99,8 @@ Tenant: My Tenant (my-tenant)
|
|
|
99
99
|
this.log(` Tasks: ${tenant.tasks}`);
|
|
100
100
|
if (tenant.ingress !== undefined)
|
|
101
101
|
this.log(` Ingress: ${tenant.ingress}`);
|
|
102
|
-
if (tenant.
|
|
103
|
-
this.log(`
|
|
102
|
+
if (tenant.type)
|
|
103
|
+
this.log(` Type: ${tenant.type}`);
|
|
104
104
|
if (tenant.deployed_at) {
|
|
105
105
|
const d = new Date(tenant.deployed_at);
|
|
106
106
|
const deployedDate = Number.isNaN(d.getTime()) ? tenant.deployed_at : d.toISOString().split('T')[0];
|
|
@@ -92,8 +92,8 @@ Tenants in workspace 5:
|
|
|
92
92
|
for (const tenant of tenants) {
|
|
93
93
|
const state = tenant.state ? ` [${tenant.state}]` : '';
|
|
94
94
|
const license = tenant.license ? ` - ${tenant.license}` : '';
|
|
95
|
-
const
|
|
96
|
-
this.log(` - ${tenant.display || tenant.name} (${tenant.name})${state}${license}${
|
|
95
|
+
const typeLabel = tenant.type && tenant.type !== 'standard' ? ` [${tenant.type}]` : '';
|
|
96
|
+
this.log(` - ${tenant.display || tenant.name} (${tenant.name})${state}${license}${typeLabel}`);
|
|
97
97
|
if (tenant.cluster?.name)
|
|
98
98
|
this.log(` Cluster: ${tenant.cluster.name}`);
|
|
99
99
|
const releaseName = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
|
|
@@ -100,40 +100,6 @@ Truncate all table records before importing
|
|
|
100
100
|
` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
|
|
101
101
|
}
|
|
102
102
|
const tenantName = flags.tenant;
|
|
103
|
-
// Fetch tenant details and verify it's ephemeral
|
|
104
|
-
const tenantApiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}`;
|
|
105
|
-
try {
|
|
106
|
-
const tenantResponse = await this.verboseFetch(tenantApiUrl, {
|
|
107
|
-
headers: {
|
|
108
|
-
accept: 'application/json',
|
|
109
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
110
|
-
},
|
|
111
|
-
method: 'GET',
|
|
112
|
-
}, flags.verbose, profile.access_token);
|
|
113
|
-
if (!tenantResponse.ok) {
|
|
114
|
-
const errorText = await tenantResponse.text();
|
|
115
|
-
this.error(`Failed to fetch tenant '${tenantName}' (${tenantResponse.status}): ${errorText}`);
|
|
116
|
-
}
|
|
117
|
-
const tenantData = (await tenantResponse.json());
|
|
118
|
-
if (!tenantData.ephemeral) {
|
|
119
|
-
this.error(`Tenant '${tenantName}' is not ephemeral. Push is only allowed for ephemeral tenants.\n` +
|
|
120
|
-
`Create an ephemeral tenant with: xano ephemeral create "name"`);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
if (error instanceof Error && error.message.includes('is not ephemeral')) {
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
if (error instanceof Error && error.message.includes('Failed to fetch tenant')) {
|
|
128
|
-
throw error;
|
|
129
|
-
}
|
|
130
|
-
if (error instanceof Error) {
|
|
131
|
-
this.error(`Failed to verify tenant: ${error.message}`);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.error(`Failed to verify tenant: ${String(error)}`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
103
|
// Resolve the input directory
|
|
138
104
|
const inputDir = path.resolve(args.directory);
|
|
139
105
|
if (!fs.existsSync(inputDir)) {
|
|
@@ -57,39 +57,14 @@ Unit tests for tenant my-tenant:
|
|
|
57
57
|
if (!workspaceId) {
|
|
58
58
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
|
|
62
|
-
let tenantWorkspaceId;
|
|
63
|
-
try {
|
|
64
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
65
|
-
headers: {
|
|
66
|
-
accept: 'application/json',
|
|
67
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
68
|
-
},
|
|
69
|
-
method: 'GET',
|
|
70
|
-
}, flags.verbose, profile.access_token);
|
|
71
|
-
if (!tenantResponse.ok) {
|
|
72
|
-
const errorText = await tenantResponse.text();
|
|
73
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
74
|
-
}
|
|
75
|
-
const tenant = (await tenantResponse.json());
|
|
76
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (error instanceof Error) {
|
|
80
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
60
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
86
61
|
const params = new URLSearchParams();
|
|
87
62
|
params.set('per_page', '10000');
|
|
88
63
|
if (flags.branch)
|
|
89
64
|
params.set('branch', flags.branch);
|
|
90
65
|
if (flags['obj-type'])
|
|
91
66
|
params.set('obj_type', flags['obj-type']);
|
|
92
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${
|
|
67
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test?${params}`;
|
|
93
68
|
try {
|
|
94
69
|
const response = await this.verboseFetch(apiUrl, {
|
|
95
70
|
headers: {
|
|
@@ -53,33 +53,8 @@ Result: PASS
|
|
|
53
53
|
if (!workspaceId) {
|
|
54
54
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
let tenantWorkspaceId;
|
|
59
|
-
try {
|
|
60
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
61
|
-
headers: {
|
|
62
|
-
accept: 'application/json',
|
|
63
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
64
|
-
},
|
|
65
|
-
method: 'GET',
|
|
66
|
-
}, flags.verbose, profile.access_token);
|
|
67
|
-
if (!tenantResponse.ok) {
|
|
68
|
-
const errorText = await tenantResponse.text();
|
|
69
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
70
|
-
}
|
|
71
|
-
const tenant = (await tenantResponse.json());
|
|
72
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (error instanceof Error) {
|
|
76
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
|
|
56
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
57
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
|
|
83
58
|
try {
|
|
84
59
|
if (flags.output === 'summary') {
|
|
85
60
|
this.log(`Running unit test ${args.unit_test_id}...`);
|
|
@@ -62,33 +62,8 @@ Results: 4 passed, 1 failed
|
|
|
62
62
|
if (!workspaceId) {
|
|
63
63
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let tenantWorkspaceId;
|
|
68
|
-
try {
|
|
69
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
70
|
-
headers: {
|
|
71
|
-
accept: 'application/json',
|
|
72
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
73
|
-
},
|
|
74
|
-
method: 'GET',
|
|
75
|
-
}, flags.verbose, profile.access_token);
|
|
76
|
-
if (!tenantResponse.ok) {
|
|
77
|
-
const errorText = await tenantResponse.text();
|
|
78
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
79
|
-
}
|
|
80
|
-
const tenant = (await tenantResponse.json());
|
|
81
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
if (error instanceof Error) {
|
|
85
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/unit_test`;
|
|
65
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
66
|
+
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test`;
|
|
92
67
|
try {
|
|
93
68
|
const listParams = new URLSearchParams();
|
|
94
69
|
listParams.set('per_page', '10000');
|
|
@@ -52,37 +52,12 @@ Workflow tests for tenant my-tenant:
|
|
|
52
52
|
if (!workspaceId) {
|
|
53
53
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
54
54
|
}
|
|
55
|
-
|
|
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
|
-
}
|
|
55
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
81
56
|
const params = new URLSearchParams();
|
|
82
57
|
params.set('per_page', '10000');
|
|
83
58
|
if (flags.branch)
|
|
84
59
|
params.set('branch', flags.branch);
|
|
85
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${
|
|
60
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test?${params}`;
|
|
86
61
|
try {
|
|
87
62
|
const response = await this.verboseFetch(apiUrl, {
|
|
88
63
|
headers: {
|
|
@@ -53,33 +53,8 @@ Result: PASS (0.25s)
|
|
|
53
53
|
if (!workspaceId) {
|
|
54
54
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
let tenantWorkspaceId;
|
|
59
|
-
try {
|
|
60
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
61
|
-
headers: {
|
|
62
|
-
accept: 'application/json',
|
|
63
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
64
|
-
},
|
|
65
|
-
method: 'GET',
|
|
66
|
-
}, flags.verbose, profile.access_token);
|
|
67
|
-
if (!tenantResponse.ok) {
|
|
68
|
-
const errorText = await tenantResponse.text();
|
|
69
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
70
|
-
}
|
|
71
|
-
const tenant = (await tenantResponse.json());
|
|
72
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
if (error instanceof Error) {
|
|
76
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test/${args.workflow_test_id}/run`;
|
|
56
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
57
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test/${args.workflow_test_id}/run`;
|
|
83
58
|
try {
|
|
84
59
|
if (flags.output === 'summary') {
|
|
85
60
|
this.log(`Running workflow test ${args.workflow_test_id}...`);
|
|
@@ -57,33 +57,8 @@ Results: 2 passed, 1 failed
|
|
|
57
57
|
if (!workspaceId) {
|
|
58
58
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
let tenantWorkspaceId;
|
|
63
|
-
try {
|
|
64
|
-
const tenantResponse = await this.verboseFetch(tenantUrl, {
|
|
65
|
-
headers: {
|
|
66
|
-
accept: 'application/json',
|
|
67
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
68
|
-
},
|
|
69
|
-
method: 'GET',
|
|
70
|
-
}, flags.verbose, profile.access_token);
|
|
71
|
-
if (!tenantResponse.ok) {
|
|
72
|
-
const errorText = await tenantResponse.text();
|
|
73
|
-
this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
|
|
74
|
-
}
|
|
75
|
-
const tenant = (await tenantResponse.json());
|
|
76
|
-
tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (error instanceof Error) {
|
|
80
|
-
this.error(`Failed to resolve tenant: ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this.error(`Failed to resolve tenant: ${String(error)}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test`;
|
|
60
|
+
const tenantName = encodeURIComponent(flags.tenant);
|
|
61
|
+
const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test`;
|
|
87
62
|
try {
|
|
88
63
|
const listParams = new URLSearchParams();
|
|
89
64
|
listParams.set('per_page', '10000');
|
|
@@ -9,6 +9,7 @@ export default class WorkspaceEdit extends BaseCommand {
|
|
|
9
9
|
static description: string;
|
|
10
10
|
static examples: string[];
|
|
11
11
|
static flags: {
|
|
12
|
+
'allow-push': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
15
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -35,6 +35,11 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
35
35
|
];
|
|
36
36
|
static flags = {
|
|
37
37
|
...BaseCommand.baseFlags,
|
|
38
|
+
'allow-push': Flags.boolean({
|
|
39
|
+
allowNo: true,
|
|
40
|
+
description: 'Enable or disable direct CLI push to this workspace (not applicable on Free plan)',
|
|
41
|
+
required: false,
|
|
42
|
+
}),
|
|
38
43
|
description: Flags.string({
|
|
39
44
|
char: 'd',
|
|
40
45
|
description: 'New description for the workspace',
|
|
@@ -102,9 +107,12 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
102
107
|
if (flags['require-token'] !== undefined) {
|
|
103
108
|
body.documentation = { require_token: flags['require-token'] };
|
|
104
109
|
}
|
|
110
|
+
if (flags['allow-push'] !== undefined) {
|
|
111
|
+
body.preferences = { allow_push: flags['allow-push'] };
|
|
112
|
+
}
|
|
105
113
|
// Check if at least one field is being updated
|
|
106
114
|
if (Object.keys(body).length === 0) {
|
|
107
|
-
this.error('No fields specified to update. Use --name, --description, --swagger,
|
|
115
|
+
this.error('No fields specified to update. Use --name, --description, --swagger, --require-token, or --allow-push flags.\n' +
|
|
108
116
|
'Example: xano workspace edit 123 --name "new-name"');
|
|
109
117
|
}
|
|
110
118
|
// Construct the API URL
|
|
@@ -114,8 +122,8 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
114
122
|
const response = await this.verboseFetch(apiUrl, {
|
|
115
123
|
body: JSON.stringify(body),
|
|
116
124
|
headers: {
|
|
117
|
-
|
|
118
|
-
|
|
125
|
+
accept: 'application/json',
|
|
126
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
119
127
|
'Content-Type': 'application/json',
|
|
120
128
|
},
|
|
121
129
|
method: 'PUT',
|
|
@@ -124,7 +132,7 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
124
132
|
const errorText = await response.text();
|
|
125
133
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
126
134
|
}
|
|
127
|
-
const workspace = await response.json();
|
|
135
|
+
const workspace = (await response.json());
|
|
128
136
|
// Output results
|
|
129
137
|
if (flags.output === 'json') {
|
|
130
138
|
this.log(JSON.stringify(workspace, null, 2));
|
|
@@ -141,6 +149,9 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
141
149
|
if (workspace.documentation?.require_token !== undefined) {
|
|
142
150
|
this.log(` Require Token: ${workspace.documentation.require_token}`);
|
|
143
151
|
}
|
|
152
|
+
if (workspace.preferences?.allow_push !== undefined) {
|
|
153
|
+
this.log(` Allow Push: ${workspace.preferences.allow_push}`);
|
|
154
|
+
}
|
|
144
155
|
}
|
|
145
156
|
}
|
|
146
157
|
catch (error) {
|
|
@@ -157,8 +168,7 @@ Updated workspace: my-workspace (ID: 123)
|
|
|
157
168
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
158
169
|
// Check if credentials file exists
|
|
159
170
|
if (!fs.existsSync(credentialsPath)) {
|
|
160
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
161
|
-
`Create a profile using 'xano profile create'`);
|
|
171
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
162
172
|
}
|
|
163
173
|
// Read credentials file
|
|
164
174
|
try {
|
|
@@ -73,8 +73,8 @@ Workspace: my-workspace (ID: 123)
|
|
|
73
73
|
try {
|
|
74
74
|
const response = await this.verboseFetch(apiUrl, {
|
|
75
75
|
headers: {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
accept: 'application/json',
|
|
77
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
78
78
|
},
|
|
79
79
|
method: 'GET',
|
|
80
80
|
}, flags.verbose, profile.access_token);
|
|
@@ -82,7 +82,7 @@ Workspace: my-workspace (ID: 123)
|
|
|
82
82
|
const errorText = await response.text();
|
|
83
83
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
84
84
|
}
|
|
85
|
-
const workspace = await response.json();
|
|
85
|
+
const workspace = (await response.json());
|
|
86
86
|
// Output results
|
|
87
87
|
if (flags.output === 'json') {
|
|
88
88
|
this.log(JSON.stringify(workspace, null, 2));
|
|
@@ -94,13 +94,16 @@ Workspace: my-workspace (ID: 123)
|
|
|
94
94
|
this.log(` Description: ${workspace.description}`);
|
|
95
95
|
}
|
|
96
96
|
if (workspace.created_at) {
|
|
97
|
-
const createdDate = new Date(workspace.created_at
|
|
97
|
+
const createdDate = new Date(workspace.created_at).toISOString().split('T')[0];
|
|
98
98
|
this.log(` Created: ${createdDate}`);
|
|
99
99
|
}
|
|
100
100
|
if (workspace.updated_at) {
|
|
101
|
-
const updatedDate = new Date(workspace.updated_at
|
|
101
|
+
const updatedDate = new Date(workspace.updated_at).toISOString().split('T')[0];
|
|
102
102
|
this.log(` Updated: ${updatedDate}`);
|
|
103
103
|
}
|
|
104
|
+
if (workspace.preferences?.allow_push !== undefined) {
|
|
105
|
+
this.log(` Allow Push: ${workspace.preferences.allow_push}`);
|
|
106
|
+
}
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
catch (error) {
|
|
@@ -117,8 +120,7 @@ Workspace: my-workspace (ID: 123)
|
|
|
117
120
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
118
121
|
// Check if credentials file exists
|
|
119
122
|
if (!fs.existsSync(credentialsPath)) {
|
|
120
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
121
|
-
`Create a profile using 'xano profile create'`);
|
|
123
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
122
124
|
}
|
|
123
125
|
// Read credentials file
|
|
124
126
|
try {
|
|
@@ -3,6 +3,7 @@ export default class WorkspaceList extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
latest: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
7
|
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -45,6 +45,10 @@ Available workspaces:
|
|
|
45
45
|
];
|
|
46
46
|
static flags = {
|
|
47
47
|
...BaseCommand.baseFlags,
|
|
48
|
+
latest: Flags.boolean({
|
|
49
|
+
default: false,
|
|
50
|
+
description: 'Sort by newest first (descending ID)',
|
|
51
|
+
}),
|
|
48
52
|
output: Flags.string({
|
|
49
53
|
char: 'o',
|
|
50
54
|
default: 'summary',
|
|
@@ -78,8 +82,8 @@ Available workspaces:
|
|
|
78
82
|
try {
|
|
79
83
|
const response = await this.verboseFetch(apiUrl, {
|
|
80
84
|
headers: {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
accept: 'application/json',
|
|
86
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
83
87
|
},
|
|
84
88
|
method: 'GET',
|
|
85
89
|
}, flags.verbose, profile.access_token);
|
|
@@ -87,7 +91,7 @@ Available workspaces:
|
|
|
87
91
|
const errorText = await response.text();
|
|
88
92
|
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
89
93
|
}
|
|
90
|
-
const data = await response.json();
|
|
94
|
+
const data = (await response.json());
|
|
91
95
|
// Handle different response formats
|
|
92
96
|
let workspaces;
|
|
93
97
|
if (Array.isArray(data)) {
|
|
@@ -99,6 +103,9 @@ Available workspaces:
|
|
|
99
103
|
else {
|
|
100
104
|
this.error('Unexpected API response format');
|
|
101
105
|
}
|
|
106
|
+
if (flags.latest) {
|
|
107
|
+
workspaces.sort((a, b) => b.id - a.id);
|
|
108
|
+
}
|
|
102
109
|
// Output results
|
|
103
110
|
if (flags.output === 'json') {
|
|
104
111
|
this.log(JSON.stringify(workspaces, null, 2));
|
|
@@ -111,11 +118,12 @@ Available workspaces:
|
|
|
111
118
|
else {
|
|
112
119
|
this.log('Available workspaces:');
|
|
113
120
|
for (const workspace of workspaces) {
|
|
121
|
+
const created = workspace.created_at ? ` (created: ${workspace.created_at.split(' ')[0]})` : '';
|
|
114
122
|
if (workspace.id === undefined) {
|
|
115
|
-
this.log(` - ${workspace.name}`);
|
|
123
|
+
this.log(` - ${workspace.name}${created}`);
|
|
116
124
|
}
|
|
117
125
|
else {
|
|
118
|
-
this.log(` - ${workspace.name} (ID: ${workspace.id})`);
|
|
126
|
+
this.log(` - ${workspace.name} (ID: ${workspace.id})${created}`);
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
}
|
|
@@ -135,8 +143,7 @@ Available workspaces:
|
|
|
135
143
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
136
144
|
// Check if credentials file exists
|
|
137
145
|
if (!fs.existsSync(credentialsPath)) {
|
|
138
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
139
|
-
`Create a profile using 'xano profile:create'`);
|
|
146
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
|
|
140
147
|
}
|
|
141
148
|
// Read credentials file
|
|
142
149
|
try {
|