@xano/cli 0.0.95-beta.2 → 0.0.95-beta.21
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.d.ts +2 -22
- package/dist/commands/tenant/push/index.js +7 -259
- 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 +1934 -2720
- 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,90 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class EphemeralEnvSet extends BaseCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
tenant_name: Args.string({
|
|
6
|
-
description: 'Ephemeral tenant name',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Set (create or update) an environment variable for an ephemeral tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano ephemeral env set my-tenant --name DATABASE_URL --value postgres://localhost:5432/mydb
|
|
13
|
-
Environment variable 'DATABASE_URL' set for ephemeral tenant my-tenant
|
|
14
|
-
`,
|
|
15
|
-
`$ xano ephemeral env set my-tenant --name DATABASE_URL --value postgres://localhost:5432/mydb -o json`,
|
|
16
|
-
];
|
|
17
|
-
static flags = {
|
|
18
|
-
...BaseCommand.baseFlags,
|
|
19
|
-
name: Flags.string({
|
|
20
|
-
char: 'n',
|
|
21
|
-
description: 'Environment variable name',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
output: Flags.string({
|
|
25
|
-
char: 'o',
|
|
26
|
-
default: 'summary',
|
|
27
|
-
description: 'Output format',
|
|
28
|
-
options: ['summary', 'json'],
|
|
29
|
-
required: false,
|
|
30
|
-
}),
|
|
31
|
-
value: Flags.string({
|
|
32
|
-
description: 'Environment variable value',
|
|
33
|
-
required: true,
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
async run() {
|
|
37
|
-
const { args, flags } = await this.parse(EphemeralEnvSet);
|
|
38
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
39
|
-
const credentials = this.loadCredentialsFile();
|
|
40
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
41
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
42
|
-
}
|
|
43
|
-
const profile = credentials.profiles[profileName];
|
|
44
|
-
if (!profile.instance_origin) {
|
|
45
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
46
|
-
}
|
|
47
|
-
if (!profile.access_token) {
|
|
48
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
49
|
-
}
|
|
50
|
-
const tenantName = args.tenant_name;
|
|
51
|
-
const envName = flags.name;
|
|
52
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${tenantName}/env/${envName}`;
|
|
53
|
-
const body = {
|
|
54
|
-
env: {
|
|
55
|
-
name: envName,
|
|
56
|
-
value: flags.value,
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
try {
|
|
60
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
61
|
-
body: JSON.stringify(body),
|
|
62
|
-
headers: {
|
|
63
|
-
accept: 'application/json',
|
|
64
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
65
|
-
'Content-Type': 'application/json',
|
|
66
|
-
},
|
|
67
|
-
method: 'PATCH',
|
|
68
|
-
}, flags.verbose, profile.access_token);
|
|
69
|
-
if (!response.ok) {
|
|
70
|
-
const errorText = await response.text();
|
|
71
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
72
|
-
}
|
|
73
|
-
if (flags.output === 'json') {
|
|
74
|
-
const result = await response.json();
|
|
75
|
-
this.log(JSON.stringify(result, null, 2));
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.log(`Environment variable '${envName}' set for ephemeral tenant ${tenantName}`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (error instanceof Error) {
|
|
83
|
-
this.error(`Failed to set ephemeral tenant environment variable: ${error.message}`);
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
this.error(`Failed to set ephemeral tenant environment variable: ${String(error)}`);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../base-command.js';
|
|
3
|
-
export default class EphemeralGet extends BaseCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
tenant_name: Args.string({
|
|
6
|
-
description: 'Ephemeral tenant name to retrieve',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Get details of an ephemeral tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano ephemeral get t1234-abcd-xyz1
|
|
13
|
-
Ephemeral Tenant: My Tenant (my-tenant)
|
|
14
|
-
State: ok
|
|
15
|
-
License: tier1
|
|
16
|
-
Domain: my-tenant.xano.io
|
|
17
|
-
`,
|
|
18
|
-
`$ xano ephemeral get t1234-abcd-xyz1 -o json`,
|
|
19
|
-
];
|
|
20
|
-
static flags = {
|
|
21
|
-
...BaseCommand.baseFlags,
|
|
22
|
-
output: Flags.string({
|
|
23
|
-
char: 'o',
|
|
24
|
-
default: 'summary',
|
|
25
|
-
description: 'Output format',
|
|
26
|
-
options: ['summary', 'json'],
|
|
27
|
-
required: false,
|
|
28
|
-
}),
|
|
29
|
-
};
|
|
30
|
-
async run() {
|
|
31
|
-
const { args, flags } = await this.parse(EphemeralGet);
|
|
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.\n` + `Create 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 tenantName = args.tenant_name;
|
|
45
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${tenantName}`;
|
|
46
|
-
try {
|
|
47
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
48
|
-
headers: {
|
|
49
|
-
accept: 'application/json',
|
|
50
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
51
|
-
},
|
|
52
|
-
method: 'GET',
|
|
53
|
-
}, flags.verbose, profile.access_token);
|
|
54
|
-
if (!response.ok) {
|
|
55
|
-
const errorText = await response.text();
|
|
56
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
57
|
-
}
|
|
58
|
-
const tenant = (await response.json());
|
|
59
|
-
if (flags.output === 'json') {
|
|
60
|
-
this.log(JSON.stringify(tenant, null, 2));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
this.log(`Ephemeral Tenant: ${tenant.display || tenant.name} (${tenant.name})`);
|
|
64
|
-
if (tenant.state)
|
|
65
|
-
this.log(` State: ${tenant.state}`);
|
|
66
|
-
if (tenant.ephemeral_access)
|
|
67
|
-
this.log(` Access: ${tenant.ephemeral_access}`);
|
|
68
|
-
if (tenant.license)
|
|
69
|
-
this.log(` License: ${tenant.license}`);
|
|
70
|
-
if (tenant.xano_domain)
|
|
71
|
-
this.log(` Domain: ${tenant.xano_domain}`);
|
|
72
|
-
if (tenant.domain)
|
|
73
|
-
this.log(` Custom Domain: ${tenant.domain}`);
|
|
74
|
-
if (tenant.cluster?.name)
|
|
75
|
-
this.log(` Cluster: ${tenant.cluster.name}`);
|
|
76
|
-
const releaseName = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
|
|
77
|
-
const releaseId = typeof tenant.release === 'object' ? tenant.release?.id : undefined;
|
|
78
|
-
if (releaseName)
|
|
79
|
-
this.log(` Release: ${releaseName} (ID: ${releaseId})`);
|
|
80
|
-
if (tenant.platform?.name)
|
|
81
|
-
this.log(` Platform: ${tenant.platform.name}`);
|
|
82
|
-
if (tenant.version !== undefined)
|
|
83
|
-
this.log(` Version: ${tenant.version}`);
|
|
84
|
-
if (tenant.ingress !== undefined)
|
|
85
|
-
this.log(` Ingress: ${tenant.ingress}`);
|
|
86
|
-
if (tenant.deployed_at) {
|
|
87
|
-
const d = new Date(tenant.deployed_at);
|
|
88
|
-
const deployedDate = Number.isNaN(d.getTime()) ? tenant.deployed_at : d.toISOString().split('T')[0];
|
|
89
|
-
this.log(` Deployed: ${deployedDate}`);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
if (error instanceof Error) {
|
|
95
|
-
this.error(`Failed to get ephemeral tenant: ${error.message}`);
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
this.error(`Failed to get ephemeral tenant: ${String(error)}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as fs from 'node:fs';
|
|
3
|
-
import * as path from 'node:path';
|
|
4
|
-
import BaseCommand from '../../../../base-command.js';
|
|
5
|
-
export default class EphemeralLicenseGet extends BaseCommand {
|
|
6
|
-
static args = {
|
|
7
|
-
tenant_name: Args.string({
|
|
8
|
-
description: 'Ephemeral tenant name',
|
|
9
|
-
required: true,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
|
-
static description = 'Get the license for an ephemeral tenant';
|
|
13
|
-
static examples = [
|
|
14
|
-
`$ xano ephemeral license get my-tenant
|
|
15
|
-
License saved to license_my-tenant.yaml
|
|
16
|
-
`,
|
|
17
|
-
`$ xano ephemeral license get my-tenant --file ./my-license.yaml`,
|
|
18
|
-
`$ xano ephemeral license get my-tenant --view`,
|
|
19
|
-
`$ xano ephemeral license get my-tenant -o json`,
|
|
20
|
-
];
|
|
21
|
-
static flags = {
|
|
22
|
-
...BaseCommand.baseFlags,
|
|
23
|
-
file: Flags.string({
|
|
24
|
-
char: 'f',
|
|
25
|
-
description: 'Output file path (default: license_<tenant_name>.yaml)',
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
output: Flags.string({
|
|
29
|
-
char: 'o',
|
|
30
|
-
default: 'summary',
|
|
31
|
-
description: 'Output format',
|
|
32
|
-
options: ['summary', 'json'],
|
|
33
|
-
required: false,
|
|
34
|
-
}),
|
|
35
|
-
view: Flags.boolean({
|
|
36
|
-
default: false,
|
|
37
|
-
description: 'Print license to stdout instead of saving to file',
|
|
38
|
-
required: false,
|
|
39
|
-
}),
|
|
40
|
-
};
|
|
41
|
-
async run() {
|
|
42
|
-
const { args, flags } = await this.parse(EphemeralLicenseGet);
|
|
43
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
44
|
-
const credentials = this.loadCredentialsFile();
|
|
45
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
46
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
47
|
-
}
|
|
48
|
-
const profile = credentials.profiles[profileName];
|
|
49
|
-
if (!profile.instance_origin) {
|
|
50
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
51
|
-
}
|
|
52
|
-
if (!profile.access_token) {
|
|
53
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
54
|
-
}
|
|
55
|
-
const tenantName = args.tenant_name;
|
|
56
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${tenantName}/license`;
|
|
57
|
-
try {
|
|
58
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
59
|
-
headers: {
|
|
60
|
-
accept: 'application/json',
|
|
61
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
62
|
-
},
|
|
63
|
-
method: 'GET',
|
|
64
|
-
}, flags.verbose, profile.access_token);
|
|
65
|
-
if (!response.ok) {
|
|
66
|
-
const errorText = await response.text();
|
|
67
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
68
|
-
}
|
|
69
|
-
const license = await response.json();
|
|
70
|
-
const licenseContent = typeof license === 'string' ? license : JSON.stringify(license, null, 2);
|
|
71
|
-
if (flags.view || flags.output === 'json') {
|
|
72
|
-
if (flags.output === 'json') {
|
|
73
|
-
this.log(JSON.stringify(license, null, 2));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
this.log(licenseContent);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
const filePath = path.resolve(flags.file || `license_${tenantName}.yaml`);
|
|
81
|
-
fs.writeFileSync(filePath, licenseContent, 'utf8');
|
|
82
|
-
this.log(`License saved to ${filePath}`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
if (error instanceof Error) {
|
|
87
|
-
this.error(`Failed to get ephemeral tenant license: ${error.message}`);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
this.error(`Failed to get ephemeral tenant license: ${String(error)}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class EphemeralList extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
order: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
per_page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
sort: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../base-command.js';
|
|
3
|
-
export default class EphemeralList extends BaseCommand {
|
|
4
|
-
static description = 'List ephemeral tenants';
|
|
5
|
-
static examples = [
|
|
6
|
-
`$ xano ephemeral list
|
|
7
|
-
Ephemeral tenants:
|
|
8
|
-
- My Tenant (my-tenant) [ok]
|
|
9
|
-
- CI Tenant (ci-tenant) [ok]
|
|
10
|
-
`,
|
|
11
|
-
`$ xano ephemeral list -o json`,
|
|
12
|
-
];
|
|
13
|
-
static flags = {
|
|
14
|
-
...BaseCommand.baseFlags,
|
|
15
|
-
order: Flags.string({
|
|
16
|
-
default: 'asc',
|
|
17
|
-
description: 'Sort order',
|
|
18
|
-
options: ['asc', 'desc'],
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
output: Flags.string({
|
|
22
|
-
char: 'o',
|
|
23
|
-
default: 'summary',
|
|
24
|
-
description: 'Output format',
|
|
25
|
-
options: ['summary', 'json'],
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
page: Flags.integer({
|
|
29
|
-
default: 1,
|
|
30
|
-
description: 'Page number',
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
per_page: Flags.integer({
|
|
34
|
-
default: 50,
|
|
35
|
-
description: 'Items per page',
|
|
36
|
-
required: false,
|
|
37
|
-
}),
|
|
38
|
-
sort: Flags.string({
|
|
39
|
-
default: 'name',
|
|
40
|
-
description: 'Sort field',
|
|
41
|
-
options: ['name', 'created_at', 'state'],
|
|
42
|
-
required: false,
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
45
|
-
async run() {
|
|
46
|
-
const { flags } = await this.parse(EphemeralList);
|
|
47
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
48
|
-
const credentials = this.loadCredentialsFile();
|
|
49
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
50
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
51
|
-
}
|
|
52
|
-
const profile = credentials.profiles[profileName];
|
|
53
|
-
if (!profile.instance_origin) {
|
|
54
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
55
|
-
}
|
|
56
|
-
if (!profile.access_token) {
|
|
57
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
58
|
-
}
|
|
59
|
-
const params = new URLSearchParams({
|
|
60
|
-
order: flags.order,
|
|
61
|
-
page: String(flags.page),
|
|
62
|
-
per_page: String(flags.per_page),
|
|
63
|
-
sort: flags.sort,
|
|
64
|
-
});
|
|
65
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant?${params}`;
|
|
66
|
-
try {
|
|
67
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
68
|
-
headers: {
|
|
69
|
-
accept: 'application/json',
|
|
70
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
71
|
-
},
|
|
72
|
-
method: 'GET',
|
|
73
|
-
}, flags.verbose, profile.access_token);
|
|
74
|
-
if (!response.ok) {
|
|
75
|
-
const errorText = await response.text();
|
|
76
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
77
|
-
}
|
|
78
|
-
const data = (await response.json());
|
|
79
|
-
const tenants = data.items ?? [];
|
|
80
|
-
if (flags.output === 'json') {
|
|
81
|
-
this.log(JSON.stringify(data, null, 2));
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (tenants.length === 0) {
|
|
85
|
-
this.log('No ephemeral tenants found');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
this.log('Ephemeral tenants:');
|
|
89
|
-
for (const tenant of tenants) {
|
|
90
|
-
const state = tenant.state ? ` [${tenant.state}]` : '';
|
|
91
|
-
const access = tenant.ephemeral_access ? ` [${tenant.ephemeral_access}]` : '';
|
|
92
|
-
this.log(` - ${tenant.display || tenant.name} (${tenant.name})${state}${access}`);
|
|
93
|
-
}
|
|
94
|
-
if (data.nextPage) {
|
|
95
|
-
this.log(`\nPage ${data.curPage} — more results available (use --page ${data.nextPage})`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
if (error instanceof Error) {
|
|
102
|
-
this.error(`Failed to list ephemeral tenants: ${error.message}`);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
this.error(`Failed to list ephemeral tenants: ${String(error)}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class EphemeralShared extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
order: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
per_page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
sort: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
};
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../base-command.js';
|
|
3
|
-
export default class EphemeralShared extends BaseCommand {
|
|
4
|
-
static description = 'List all shared ephemeral tenants on the instance';
|
|
5
|
-
static examples = [
|
|
6
|
-
`$ xano ephemeral shared
|
|
7
|
-
Shared ephemeral tenants:
|
|
8
|
-
- My Tenant (e1a2-b3c4-x5y6) [ok] [shared]
|
|
9
|
-
- CI Tenant (e2b3-c4d5-y6z7) [ok] [shared]
|
|
10
|
-
`,
|
|
11
|
-
`$ xano ephemeral shared -o json`,
|
|
12
|
-
];
|
|
13
|
-
static flags = {
|
|
14
|
-
...BaseCommand.baseFlags,
|
|
15
|
-
order: Flags.string({
|
|
16
|
-
default: 'asc',
|
|
17
|
-
description: 'Sort order',
|
|
18
|
-
options: ['asc', 'desc'],
|
|
19
|
-
required: false,
|
|
20
|
-
}),
|
|
21
|
-
output: Flags.string({
|
|
22
|
-
char: 'o',
|
|
23
|
-
default: 'summary',
|
|
24
|
-
description: 'Output format',
|
|
25
|
-
options: ['summary', 'json'],
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
page: Flags.integer({
|
|
29
|
-
default: 1,
|
|
30
|
-
description: 'Page number',
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
per_page: Flags.integer({
|
|
34
|
-
default: 50,
|
|
35
|
-
description: 'Items per page',
|
|
36
|
-
required: false,
|
|
37
|
-
}),
|
|
38
|
-
sort: Flags.string({
|
|
39
|
-
default: 'name',
|
|
40
|
-
description: 'Sort field',
|
|
41
|
-
options: ['name', 'created_at', 'state'],
|
|
42
|
-
required: false,
|
|
43
|
-
}),
|
|
44
|
-
};
|
|
45
|
-
async run() {
|
|
46
|
-
const { flags } = await this.parse(EphemeralShared);
|
|
47
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
48
|
-
const credentials = this.loadCredentialsFile();
|
|
49
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
50
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
51
|
-
}
|
|
52
|
-
const profile = credentials.profiles[profileName];
|
|
53
|
-
if (!profile.instance_origin) {
|
|
54
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
55
|
-
}
|
|
56
|
-
if (!profile.access_token) {
|
|
57
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
58
|
-
}
|
|
59
|
-
const params = new URLSearchParams({
|
|
60
|
-
order: flags.order,
|
|
61
|
-
page: String(flags.page),
|
|
62
|
-
per_page: String(flags.per_page),
|
|
63
|
-
sort: flags.sort,
|
|
64
|
-
});
|
|
65
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/shared?${params}`;
|
|
66
|
-
try {
|
|
67
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
68
|
-
headers: {
|
|
69
|
-
accept: 'application/json',
|
|
70
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
71
|
-
},
|
|
72
|
-
method: 'GET',
|
|
73
|
-
}, flags.verbose, profile.access_token);
|
|
74
|
-
if (!response.ok) {
|
|
75
|
-
const errorText = await response.text();
|
|
76
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
77
|
-
}
|
|
78
|
-
const data = (await response.json());
|
|
79
|
-
const tenants = data.items ?? [];
|
|
80
|
-
if (flags.output === 'json') {
|
|
81
|
-
this.log(JSON.stringify(data, null, 2));
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
if (tenants.length === 0) {
|
|
85
|
-
this.log('No shared ephemeral tenants found');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
this.log('Shared ephemeral tenants:');
|
|
89
|
-
for (const tenant of tenants) {
|
|
90
|
-
const state = tenant.state ? ` [${tenant.state}]` : '';
|
|
91
|
-
this.log(` - ${tenant.display || tenant.name} (${tenant.name})${state}`);
|
|
92
|
-
}
|
|
93
|
-
if (data.nextPage) {
|
|
94
|
-
this.log(`\nPage ${data.curPage} — more results available (use --page ${data.nextPage})`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
if (error instanceof Error) {
|
|
101
|
-
this.error(`Failed to list shared ephemeral tenants: ${error.message}`);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
this.error(`Failed to list shared ephemeral tenants: ${String(error)}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class EphemeralWorkflowTestDelete 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,75 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class EphemeralWorkflowTestDelete 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 an ephemeral tenant';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano ephemeral workflow-test delete 42 -t e1a2-b3c4-x5y6
|
|
13
|
-
Deleted workflow test 42
|
|
14
|
-
`,
|
|
15
|
-
`$ xano ephemeral workflow-test delete 42 -t e1a2-b3c4-x5y6 -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: 'Ephemeral tenant name',
|
|
29
|
-
required: true,
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
async run() {
|
|
33
|
-
const { args, flags } = await this.parse(EphemeralWorkflowTestDelete);
|
|
34
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
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
|
-
}
|
|
46
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${encodeURIComponent(flags.tenant)}/workflow_test/${args.workflow_test_id}`;
|
|
47
|
-
try {
|
|
48
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
49
|
-
headers: {
|
|
50
|
-
accept: 'application/json',
|
|
51
|
-
Authorization: `Bearer ${profile.access_token}`,
|
|
52
|
-
},
|
|
53
|
-
method: 'DELETE',
|
|
54
|
-
}, flags.verbose, profile.access_token);
|
|
55
|
-
if (!response.ok) {
|
|
56
|
-
const errorText = await response.text();
|
|
57
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
58
|
-
}
|
|
59
|
-
if (flags.output === 'json') {
|
|
60
|
-
this.log(JSON.stringify({ deleted: true, workflow_test_id: args.workflow_test_id }, null, 2));
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
this.log(`Deleted workflow test ${args.workflow_test_id}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
if (error instanceof Error) {
|
|
68
|
-
this.error(`Failed to delete workflow test: ${error.message}`);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this.error(`Failed to delete workflow test: ${String(error)}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|