@xano/cli 0.0.95-beta.1 → 0.0.95-beta.3
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 +20 -8
- package/dist/base-command.d.ts +24 -0
- package/dist/base-command.js +37 -0
- package/dist/commands/release/deploy/index.d.ts +17 -0
- package/dist/commands/release/deploy/index.js +107 -0
- package/dist/commands/{ephemeral → sandbox}/env/delete/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/delete/index.js +17 -33
- package/dist/commands/{ephemeral → sandbox}/env/get/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/get/index.js +13 -29
- package/dist/commands/{ephemeral → sandbox}/env/get_all/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/get_all/index.js +16 -32
- 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/{ephemeral → sandbox}/env/set/index.js +14 -30
- package/dist/commands/{ephemeral → sandbox}/env/set_all/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/env/set_all/index.js +16 -32
- package/dist/commands/{ephemeral → sandbox}/get/index.d.ts +1 -4
- package/dist/commands/sandbox/get/index.js +48 -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/{ephemeral → sandbox}/license/get/index.js +16 -32
- package/dist/commands/{ephemeral → sandbox}/license/set/index.d.ts +1 -4
- package/dist/commands/{ephemeral → sandbox}/license/set/index.js +17 -33
- package/dist/commands/{ephemeral → sandbox}/pull/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/pull/index.js +11 -26
- package/dist/commands/{ephemeral → sandbox}/push/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/push/index.js +13 -28
- package/dist/commands/{ephemeral/delete → sandbox/reset}/index.d.ts +1 -5
- 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 +15 -31
- 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 +10 -24
- package/dist/commands/{ephemeral → sandbox}/unit_test/run/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/unit_test/run/index.js +9 -23
- 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 +9 -23
- package/dist/commands/{ephemeral/workflow_test/get → sandbox/workflow_test/delete}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/delete/index.js +9 -23
- package/dist/commands/{ephemeral/workflow_test/run → sandbox/workflow_test/get}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/get/index.js +8 -25
- 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 +11 -25
- package/dist/commands/{ephemeral/workflow_test/delete → sandbox/workflow_test/run}/index.d.ts +1 -2
- package/dist/commands/{ephemeral → sandbox}/workflow_test/run/index.js +9 -23
- 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 +9 -23
- 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/workspace/push/index.js +26 -0
- package/oclif.manifest.json +2266 -2658
- package/package.json +7 -7
- 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/list/index.js +0 -83
- package/dist/commands/ephemeral/get/index.js +0 -102
- 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
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import BaseCommand from '../../../../base-command.js';
|
|
3
|
-
export default class
|
|
4
|
-
static
|
|
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';
|
|
3
|
+
export default class SandboxEnvSet extends BaseCommand {
|
|
4
|
+
static description = 'Set (create or update) an environment variable for a sandbox environment';
|
|
11
5
|
static examples = [
|
|
12
|
-
`$ xano
|
|
13
|
-
Environment variable 'DATABASE_URL' set
|
|
6
|
+
`$ xano sandbox env set --name DATABASE_URL --value postgres://localhost:5432/mydb
|
|
7
|
+
Environment variable 'DATABASE_URL' set
|
|
14
8
|
`,
|
|
15
|
-
`$ xano
|
|
9
|
+
`$ xano sandbox env set --name DATABASE_URL --value postgres://localhost:5432/mydb -o json`,
|
|
16
10
|
];
|
|
17
11
|
static flags = {
|
|
18
12
|
...BaseCommand.baseFlags,
|
|
@@ -34,22 +28,12 @@ Environment variable 'DATABASE_URL' set for ephemeral tenant my-tenant
|
|
|
34
28
|
}),
|
|
35
29
|
};
|
|
36
30
|
async run() {
|
|
37
|
-
const {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
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;
|
|
31
|
+
const { flags } = await this.parse(SandboxEnvSet);
|
|
32
|
+
const { profile } = this.resolveProfile(flags);
|
|
33
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
34
|
+
const tenantName = tenant.name;
|
|
51
35
|
const envName = flags.name;
|
|
52
|
-
const apiUrl = `${profile.instance_origin}/api:meta/
|
|
36
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/env/${envName}`;
|
|
53
37
|
const body = {
|
|
54
38
|
env: {
|
|
55
39
|
name: envName,
|
|
@@ -75,15 +59,15 @@ Environment variable 'DATABASE_URL' set for ephemeral tenant my-tenant
|
|
|
75
59
|
this.log(JSON.stringify(result, null, 2));
|
|
76
60
|
}
|
|
77
61
|
else {
|
|
78
|
-
this.log(`Environment variable '${envName}' set for
|
|
62
|
+
this.log(`Environment variable '${envName}' set for sandbox environment ${tenantName}`);
|
|
79
63
|
}
|
|
80
64
|
}
|
|
81
65
|
catch (error) {
|
|
82
66
|
if (error instanceof Error) {
|
|
83
|
-
this.error(`Failed to set
|
|
67
|
+
this.error(`Failed to set sandbox environment variable: ${error.message}`);
|
|
84
68
|
}
|
|
85
69
|
else {
|
|
86
|
-
this.error(`Failed to set
|
|
70
|
+
this.error(`Failed to set sandbox environment variable: ${String(error)}`);
|
|
87
71
|
}
|
|
88
72
|
}
|
|
89
73
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
3
|
-
static args: {
|
|
4
|
-
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
2
|
+
export default class SandboxEnvSetAll extends BaseCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
5
5
|
import BaseCommand from '../../../../base-command.js';
|
|
6
|
-
export default class
|
|
7
|
-
static
|
|
8
|
-
tenant_name: Args.string({
|
|
9
|
-
description: 'Ephemeral tenant name',
|
|
10
|
-
required: true,
|
|
11
|
-
}),
|
|
12
|
-
};
|
|
13
|
-
static description = 'Set all environment variables for an ephemeral tenant from a YAML file (replaces all existing)';
|
|
6
|
+
export default class SandboxEnvSetAll extends BaseCommand {
|
|
7
|
+
static description = 'Set all environment variables for a sandbox environment from a YAML file (replaces all existing)';
|
|
14
8
|
static examples = [
|
|
15
|
-
`$ xano
|
|
16
|
-
Reads from
|
|
9
|
+
`$ xano sandbox env set_all
|
|
10
|
+
Reads from env_<tenant>.yaml
|
|
17
11
|
`,
|
|
18
|
-
`$ xano
|
|
19
|
-
`$ xano
|
|
12
|
+
`$ xano sandbox env set_all --file ./my-env.yaml`,
|
|
13
|
+
`$ xano sandbox env set_all -o json`,
|
|
20
14
|
];
|
|
21
15
|
static flags = {
|
|
22
16
|
...BaseCommand.baseFlags,
|
|
@@ -27,7 +21,7 @@ Reads from env_my-tenant.yaml
|
|
|
27
21
|
}),
|
|
28
22
|
file: Flags.string({
|
|
29
23
|
char: 'f',
|
|
30
|
-
description: 'Path to env file (default: env_<
|
|
24
|
+
description: 'Path to env file (default: env_<sandbox_name>.yaml)',
|
|
31
25
|
required: false,
|
|
32
26
|
}),
|
|
33
27
|
output: Flags.string({
|
|
@@ -39,8 +33,10 @@ Reads from env_my-tenant.yaml
|
|
|
39
33
|
}),
|
|
40
34
|
};
|
|
41
35
|
async run() {
|
|
42
|
-
const {
|
|
43
|
-
const
|
|
36
|
+
const { flags } = await this.parse(SandboxEnvSetAll);
|
|
37
|
+
const { profile } = this.resolveProfile(flags);
|
|
38
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
39
|
+
const tenantName = tenant.name;
|
|
44
40
|
const sourceFilePath = path.resolve(flags.file || `env_${tenantName}.yaml`);
|
|
45
41
|
if (!fs.existsSync(sourceFilePath)) {
|
|
46
42
|
this.error(`File not found: ${sourceFilePath}`);
|
|
@@ -51,19 +47,7 @@ Reads from env_my-tenant.yaml
|
|
|
51
47
|
this.error('Invalid env file format. Expected a YAML map of key: value pairs.');
|
|
52
48
|
}
|
|
53
49
|
const envs = Object.entries(envMap).map(([name, value]) => ({ name, value: String(value) }));
|
|
54
|
-
const
|
|
55
|
-
const credentials = this.loadCredentialsFile();
|
|
56
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
57
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
58
|
-
}
|
|
59
|
-
const profile = credentials.profiles[profileName];
|
|
60
|
-
if (!profile.instance_origin) {
|
|
61
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
62
|
-
}
|
|
63
|
-
if (!profile.access_token) {
|
|
64
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
65
|
-
}
|
|
66
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${tenantName}/env_all`;
|
|
50
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/env_all`;
|
|
67
51
|
try {
|
|
68
52
|
const response = await this.verboseFetch(apiUrl, {
|
|
69
53
|
body: JSON.stringify({ envs }),
|
|
@@ -83,7 +67,7 @@ Reads from env_my-tenant.yaml
|
|
|
83
67
|
this.log(JSON.stringify(result, null, 2));
|
|
84
68
|
}
|
|
85
69
|
else {
|
|
86
|
-
this.log(`All environment variables updated for
|
|
70
|
+
this.log(`All environment variables updated for sandbox environment ${tenantName} (${envs.length} variables)`);
|
|
87
71
|
}
|
|
88
72
|
if (flags.clean && fs.existsSync(sourceFilePath)) {
|
|
89
73
|
fs.unlinkSync(sourceFilePath);
|
|
@@ -92,10 +76,10 @@ Reads from env_my-tenant.yaml
|
|
|
92
76
|
}
|
|
93
77
|
catch (error) {
|
|
94
78
|
if (error instanceof Error) {
|
|
95
|
-
this.error(`Failed to set
|
|
79
|
+
this.error(`Failed to set sandbox environment variables: ${error.message}`);
|
|
96
80
|
}
|
|
97
81
|
else {
|
|
98
|
-
this.error(`Failed to set
|
|
82
|
+
this.error(`Failed to set sandbox environment variables: ${String(error)}`);
|
|
99
83
|
}
|
|
100
84
|
}
|
|
101
85
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class
|
|
3
|
-
static args: {
|
|
4
|
-
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
2
|
+
export default class SandboxGet extends BaseCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import BaseCommand from '../../../base-command.js';
|
|
3
|
+
export default class SandboxGet extends BaseCommand {
|
|
4
|
+
static description = 'Get your sandbox environment (creates one if it does not exist)';
|
|
5
|
+
static examples = [
|
|
6
|
+
`$ xano sandbox get
|
|
7
|
+
Sandbox Environment: (tc24-abcd-x1y2)
|
|
8
|
+
State: ok
|
|
9
|
+
License: tier1
|
|
10
|
+
`,
|
|
11
|
+
`$ xano sandbox get -o json`,
|
|
12
|
+
];
|
|
13
|
+
static flags = {
|
|
14
|
+
...BaseCommand.baseFlags,
|
|
15
|
+
output: Flags.string({
|
|
16
|
+
char: 'o',
|
|
17
|
+
default: 'summary',
|
|
18
|
+
description: 'Output format',
|
|
19
|
+
options: ['summary', 'json'],
|
|
20
|
+
required: false,
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
async run() {
|
|
24
|
+
const { flags } = await this.parse(SandboxGet);
|
|
25
|
+
const { profile } = this.resolveProfile(flags);
|
|
26
|
+
try {
|
|
27
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
28
|
+
if (flags.output === 'json') {
|
|
29
|
+
this.log(JSON.stringify(tenant, null, 2));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
this.log(`Sandbox Environment: ${tenant.display || tenant.name} (${tenant.name})`);
|
|
33
|
+
if (tenant.state)
|
|
34
|
+
this.log(` State: ${tenant.state}`);
|
|
35
|
+
if (tenant.xano_domain)
|
|
36
|
+
this.log(` Domain: ${tenant.xano_domain}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof Error) {
|
|
41
|
+
this.error(`Failed to get sandbox environment: ${error.message}`);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
this.error(`Failed to get sandbox environment: ${String(error)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
3
|
-
static args: {
|
|
4
|
-
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
2
|
+
export default class SandboxLicenseGet extends BaseCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import BaseCommand from '../../../../base-command.js';
|
|
5
|
-
export default class
|
|
6
|
-
static
|
|
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';
|
|
5
|
+
export default class SandboxLicenseGet extends BaseCommand {
|
|
6
|
+
static description = 'Get the license for a sandbox environment';
|
|
13
7
|
static examples = [
|
|
14
|
-
`$ xano
|
|
15
|
-
License saved to
|
|
8
|
+
`$ xano sandbox license get
|
|
9
|
+
License saved to license_<tenant>.yaml
|
|
16
10
|
`,
|
|
17
|
-
`$ xano
|
|
18
|
-
`$ xano
|
|
19
|
-
`$ xano
|
|
11
|
+
`$ xano sandbox license get --file ./my-license.yaml`,
|
|
12
|
+
`$ xano sandbox license get --view`,
|
|
13
|
+
`$ xano sandbox license get -o json`,
|
|
20
14
|
];
|
|
21
15
|
static flags = {
|
|
22
16
|
...BaseCommand.baseFlags,
|
|
23
17
|
file: Flags.string({
|
|
24
18
|
char: 'f',
|
|
25
|
-
description: 'Output file path (default: license_<
|
|
19
|
+
description: 'Output file path (default: license_<sandbox_name>.yaml)',
|
|
26
20
|
required: false,
|
|
27
21
|
}),
|
|
28
22
|
output: Flags.string({
|
|
@@ -39,21 +33,11 @@ License saved to license_my-tenant.yaml
|
|
|
39
33
|
}),
|
|
40
34
|
};
|
|
41
35
|
async run() {
|
|
42
|
-
const {
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
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`;
|
|
36
|
+
const { flags } = await this.parse(SandboxLicenseGet);
|
|
37
|
+
const { profile } = this.resolveProfile(flags);
|
|
38
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
39
|
+
const tenantName = tenant.name;
|
|
40
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/license`;
|
|
57
41
|
try {
|
|
58
42
|
const response = await this.verboseFetch(apiUrl, {
|
|
59
43
|
headers: {
|
|
@@ -84,10 +68,10 @@ License saved to license_my-tenant.yaml
|
|
|
84
68
|
}
|
|
85
69
|
catch (error) {
|
|
86
70
|
if (error instanceof Error) {
|
|
87
|
-
this.error(`Failed to get
|
|
71
|
+
this.error(`Failed to get sandbox environment license: ${error.message}`);
|
|
88
72
|
}
|
|
89
73
|
else {
|
|
90
|
-
this.error(`Failed to get
|
|
74
|
+
this.error(`Failed to get sandbox environment license: ${String(error)}`);
|
|
91
75
|
}
|
|
92
76
|
}
|
|
93
77
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class
|
|
3
|
-
static args: {
|
|
4
|
-
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
2
|
+
export default class SandboxLicenseSet extends BaseCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import BaseCommand from '../../../../base-command.js';
|
|
5
|
-
export default class
|
|
6
|
-
static
|
|
7
|
-
tenant_name: Args.string({
|
|
8
|
-
description: 'Ephemeral tenant name',
|
|
9
|
-
required: true,
|
|
10
|
-
}),
|
|
11
|
-
};
|
|
12
|
-
static description = 'Set/update the license for an ephemeral tenant';
|
|
5
|
+
export default class SandboxLicenseSet extends BaseCommand {
|
|
6
|
+
static description = 'Set/update the license for a sandbox environment';
|
|
13
7
|
static examples = [
|
|
14
|
-
`$ xano
|
|
15
|
-
Reads from
|
|
8
|
+
`$ xano sandbox license set
|
|
9
|
+
Reads from license_<tenant>.yaml
|
|
16
10
|
`,
|
|
17
|
-
`$ xano
|
|
18
|
-
`$ xano
|
|
19
|
-
`$ xano
|
|
11
|
+
`$ xano sandbox license set --file ./license.yaml`,
|
|
12
|
+
`$ xano sandbox license set --value 'key: value'`,
|
|
13
|
+
`$ xano sandbox license set -o json`,
|
|
20
14
|
];
|
|
21
15
|
static flags = {
|
|
22
16
|
...BaseCommand.baseFlags,
|
|
@@ -28,7 +22,7 @@ Reads from license_my-tenant.yaml
|
|
|
28
22
|
}),
|
|
29
23
|
file: Flags.string({
|
|
30
24
|
char: 'f',
|
|
31
|
-
description: 'Path to license file (default: license_<
|
|
25
|
+
description: 'Path to license file (default: license_<sandbox_name>.yaml)',
|
|
32
26
|
exclusive: ['value'],
|
|
33
27
|
required: false,
|
|
34
28
|
}),
|
|
@@ -46,8 +40,10 @@ Reads from license_my-tenant.yaml
|
|
|
46
40
|
}),
|
|
47
41
|
};
|
|
48
42
|
async run() {
|
|
49
|
-
const {
|
|
50
|
-
const
|
|
43
|
+
const { flags } = await this.parse(SandboxLicenseSet);
|
|
44
|
+
const { profile } = this.resolveProfile(flags);
|
|
45
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
46
|
+
const tenantName = tenant.name;
|
|
51
47
|
let licenseValue;
|
|
52
48
|
let sourceFilePath;
|
|
53
49
|
if (flags.value) {
|
|
@@ -60,19 +56,7 @@ Reads from license_my-tenant.yaml
|
|
|
60
56
|
}
|
|
61
57
|
licenseValue = fs.readFileSync(sourceFilePath, 'utf8');
|
|
62
58
|
}
|
|
63
|
-
const
|
|
64
|
-
const credentials = this.loadCredentialsFile();
|
|
65
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
66
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
67
|
-
}
|
|
68
|
-
const profile = credentials.profiles[profileName];
|
|
69
|
-
if (!profile.instance_origin) {
|
|
70
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
71
|
-
}
|
|
72
|
-
if (!profile.access_token) {
|
|
73
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
74
|
-
}
|
|
75
|
-
const apiUrl = `${profile.instance_origin}/api:meta/ephemeral/tenant/${tenantName}/license`;
|
|
59
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/license`;
|
|
76
60
|
try {
|
|
77
61
|
const response = await this.verboseFetch(apiUrl, {
|
|
78
62
|
body: JSON.stringify({ value: licenseValue }),
|
|
@@ -92,7 +76,7 @@ Reads from license_my-tenant.yaml
|
|
|
92
76
|
this.log(JSON.stringify(result, null, 2));
|
|
93
77
|
}
|
|
94
78
|
else {
|
|
95
|
-
this.log(`
|
|
79
|
+
this.log(`Sandbox environment license updated successfully for ${tenantName}`);
|
|
96
80
|
}
|
|
97
81
|
if (flags.clean && sourceFilePath && fs.existsSync(sourceFilePath)) {
|
|
98
82
|
fs.unlinkSync(sourceFilePath);
|
|
@@ -101,10 +85,10 @@ Reads from license_my-tenant.yaml
|
|
|
101
85
|
}
|
|
102
86
|
catch (error) {
|
|
103
87
|
if (error instanceof Error) {
|
|
104
|
-
this.error(`Failed to set
|
|
88
|
+
this.error(`Failed to set sandbox environment license: ${error.message}`);
|
|
105
89
|
}
|
|
106
90
|
else {
|
|
107
|
-
this.error(`Failed to set
|
|
91
|
+
this.error(`Failed to set sandbox environment license: ${String(error)}`);
|
|
108
92
|
}
|
|
109
93
|
}
|
|
110
94
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxPull extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
4
|
directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
@@ -9,7 +9,6 @@ export default class EphemeralPull extends BaseCommand {
|
|
|
9
9
|
draft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
12
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
13
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
14
|
};
|
|
@@ -4,19 +4,19 @@ import BaseCommand from '../../../base-command.js';
|
|
|
4
4
|
import { buildApiGroupFolderResolver, parseDocument } from '../../../utils/document-parser.js';
|
|
5
5
|
import * as fs from 'node:fs';
|
|
6
6
|
import * as path from 'node:path';
|
|
7
|
-
export default class
|
|
7
|
+
export default class SandboxPull extends BaseCommand {
|
|
8
8
|
static args = {
|
|
9
9
|
directory: Args.string({
|
|
10
10
|
description: 'Output directory for pulled documents',
|
|
11
11
|
required: true,
|
|
12
12
|
}),
|
|
13
13
|
};
|
|
14
|
-
static description = 'Pull
|
|
14
|
+
static description = 'Pull documents from your sandbox environment and split into individual files';
|
|
15
15
|
static examples = [
|
|
16
|
-
`$ xano
|
|
17
|
-
Pulled 42 documents from
|
|
16
|
+
`$ xano sandbox pull ./my-sandbox
|
|
17
|
+
Pulled 42 documents from sandbox environment tc24-abcd-x1y2 to ./my-sandbox
|
|
18
18
|
`,
|
|
19
|
-
`$ xano
|
|
19
|
+
`$ xano sandbox pull ./backup --env --records`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -35,33 +35,18 @@ Pulled 42 documents from ephemeral tenant my-tenant to ./my-tenant
|
|
|
35
35
|
description: 'Include records',
|
|
36
36
|
required: false,
|
|
37
37
|
}),
|
|
38
|
-
tenant: Flags.string({
|
|
39
|
-
char: 't',
|
|
40
|
-
description: 'Ephemeral tenant name to pull from',
|
|
41
|
-
required: true,
|
|
42
|
-
}),
|
|
43
38
|
};
|
|
44
39
|
async run() {
|
|
45
|
-
const { args, flags } = await this.parse(
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
50
|
-
}
|
|
51
|
-
const profile = credentials.profiles[profileName];
|
|
52
|
-
if (!profile.instance_origin) {
|
|
53
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
54
|
-
}
|
|
55
|
-
if (!profile.access_token) {
|
|
56
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
57
|
-
}
|
|
58
|
-
const tenantName = flags.tenant;
|
|
40
|
+
const { args, flags } = await this.parse(SandboxPull);
|
|
41
|
+
const { profile } = this.resolveProfile(flags);
|
|
42
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
43
|
+
const tenantName = tenant.name;
|
|
59
44
|
const queryParams = new URLSearchParams({
|
|
60
45
|
env: flags.env.toString(),
|
|
61
46
|
include_draft: flags.draft.toString(),
|
|
62
47
|
records: flags.records.toString(),
|
|
63
48
|
});
|
|
64
|
-
const apiUrl = `${profile.instance_origin}/api:meta/
|
|
49
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/multidoc?${queryParams.toString()}`;
|
|
65
50
|
let responseText;
|
|
66
51
|
try {
|
|
67
52
|
const response = await this.verboseFetch(apiUrl, {
|
|
@@ -189,7 +174,7 @@ Pulled 42 documents from ephemeral tenant my-tenant to ./my-tenant
|
|
|
189
174
|
fs.writeFileSync(filePath, doc.content, 'utf8');
|
|
190
175
|
writtenCount++;
|
|
191
176
|
}
|
|
192
|
-
this.log(`Pulled ${writtenCount} documents from
|
|
177
|
+
this.log(`Pulled ${writtenCount} documents from sandbox environment ${tenantName} to ${args.directory}`);
|
|
193
178
|
}
|
|
194
179
|
sanitizeFilename(name) {
|
|
195
180
|
return snakeCase(name.replaceAll('"', ''));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class
|
|
2
|
+
export default class SandboxPush extends BaseCommand {
|
|
3
3
|
static args: {
|
|
4
4
|
directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
5
|
};
|
|
@@ -8,7 +8,6 @@ export default class EphemeralPush extends BaseCommand {
|
|
|
8
8
|
static flags: {
|
|
9
9
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
10
|
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
tenant: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
11
|
transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
12
|
truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
13
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -3,20 +3,20 @@ import BaseCommand from '../../../base-command.js';
|
|
|
3
3
|
import { findFilesWithGuid } from '../../../utils/document-parser.js';
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import * as path from 'node:path';
|
|
6
|
-
export default class
|
|
6
|
+
export default class SandboxPush extends BaseCommand {
|
|
7
7
|
static args = {
|
|
8
8
|
directory: Args.string({
|
|
9
|
-
description: 'Directory containing documents to push (as produced by
|
|
9
|
+
description: 'Directory containing documents to push (as produced by sandbox pull or workspace pull)',
|
|
10
10
|
required: true,
|
|
11
11
|
}),
|
|
12
12
|
};
|
|
13
|
-
static description = 'Push local documents to
|
|
13
|
+
static description = 'Push local documents to your sandbox environment via multidoc import';
|
|
14
14
|
static examples = [
|
|
15
|
-
`$ xano
|
|
16
|
-
Pushed 42 documents to
|
|
15
|
+
`$ xano sandbox push ./my-workspace
|
|
16
|
+
Pushed 42 documents to sandbox environment tc24-abcd-x1y2 from ./my-workspace
|
|
17
17
|
`,
|
|
18
|
-
`$ xano
|
|
19
|
-
`$ xano
|
|
18
|
+
`$ xano sandbox push ./backup --records --env`,
|
|
19
|
+
`$ xano sandbox push ./my-workspace --truncate`,
|
|
20
20
|
];
|
|
21
21
|
static flags = {
|
|
22
22
|
...BaseCommand.baseFlags,
|
|
@@ -30,11 +30,6 @@ Pushed 42 documents to ephemeral tenant my-tenant from ./my-workspace
|
|
|
30
30
|
description: 'Include records in import',
|
|
31
31
|
required: false,
|
|
32
32
|
}),
|
|
33
|
-
tenant: Flags.string({
|
|
34
|
-
char: 't',
|
|
35
|
-
description: 'Ephemeral tenant name to push to',
|
|
36
|
-
required: true,
|
|
37
|
-
}),
|
|
38
33
|
transaction: Flags.boolean({
|
|
39
34
|
allowNo: true,
|
|
40
35
|
default: true,
|
|
@@ -48,20 +43,10 @@ Pushed 42 documents to ephemeral tenant my-tenant from ./my-workspace
|
|
|
48
43
|
}),
|
|
49
44
|
};
|
|
50
45
|
async run() {
|
|
51
|
-
const { args, flags } = await this.parse(
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
56
|
-
}
|
|
57
|
-
const profile = credentials.profiles[profileName];
|
|
58
|
-
if (!profile.instance_origin) {
|
|
59
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
60
|
-
}
|
|
61
|
-
if (!profile.access_token) {
|
|
62
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
63
|
-
}
|
|
64
|
-
const tenantName = flags.tenant;
|
|
46
|
+
const { args, flags } = await this.parse(SandboxPush);
|
|
47
|
+
const { profile } = this.resolveProfile(flags);
|
|
48
|
+
const tenant = await this.getOrCreateSandbox(profile, flags.verbose);
|
|
49
|
+
const tenantName = tenant.name;
|
|
65
50
|
const inputDir = path.resolve(args.directory);
|
|
66
51
|
if (!fs.existsSync(inputDir)) {
|
|
67
52
|
this.error(`Directory not found: ${inputDir}`);
|
|
@@ -90,7 +75,7 @@ Pushed 42 documents to ephemeral tenant my-tenant from ./my-workspace
|
|
|
90
75
|
transaction: flags.transaction.toString(),
|
|
91
76
|
truncate: flags.truncate.toString(),
|
|
92
77
|
});
|
|
93
|
-
const apiUrl = `${profile.instance_origin}/api:meta/
|
|
78
|
+
const apiUrl = `${profile.instance_origin}/api:meta/sandbox/tenant/${tenantName}/multidoc?${queryParams.toString()}`;
|
|
94
79
|
const startTime = Date.now();
|
|
95
80
|
try {
|
|
96
81
|
const response = await this.verboseFetch(apiUrl, {
|
|
@@ -139,7 +124,7 @@ Pushed 42 documents to ephemeral tenant my-tenant from ./my-workspace
|
|
|
139
124
|
}
|
|
140
125
|
}
|
|
141
126
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
142
|
-
this.log(`Pushed ${documentEntries.length} documents to
|
|
127
|
+
this.log(`Pushed ${documentEntries.length} documents to sandbox environment ${tenantName} from ${args.directory} in ${elapsed}s`);
|
|
143
128
|
}
|
|
144
129
|
collectFiles(dir) {
|
|
145
130
|
const files = [];
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
|
-
export default class
|
|
3
|
-
static args: {
|
|
4
|
-
tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
2
|
+
export default class SandboxReset extends BaseCommand {
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
9
6
|
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
7
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
8
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
9
|
};
|