@xano/cli 1.0.2-beta.5 → 1.0.2-beta.7
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 +87 -0
- package/dist/base-command.d.ts +21 -1
- package/dist/base-command.js +92 -6
- package/dist/commands/branch/create/index.d.ts +0 -1
- package/dist/commands/branch/create/index.js +1 -38
- package/dist/commands/branch/delete/index.d.ts +0 -1
- package/dist/commands/branch/delete/index.js +1 -39
- package/dist/commands/branch/edit/index.d.ts +0 -1
- package/dist/commands/branch/edit/index.js +1 -39
- package/dist/commands/branch/get/index.d.ts +0 -1
- package/dist/commands/branch/get/index.js +1 -39
- package/dist/commands/branch/list/index.d.ts +0 -1
- package/dist/commands/branch/list/index.js +1 -39
- package/dist/commands/branch/set_live/index.d.ts +0 -1
- package/dist/commands/branch/set_live/index.js +1 -39
- package/dist/commands/function/create/index.d.ts +0 -1
- package/dist/commands/function/create/index.js +1 -38
- package/dist/commands/function/edit/index.d.ts +0 -1
- package/dist/commands/function/edit/index.js +1 -37
- package/dist/commands/function/get/index.d.ts +0 -1
- package/dist/commands/function/get/index.js +1 -38
- package/dist/commands/function/list/index.d.ts +0 -1
- package/dist/commands/function/list/index.js +1 -39
- package/dist/commands/platform/get/index.d.ts +0 -1
- package/dist/commands/platform/get/index.js +1 -33
- package/dist/commands/platform/list/index.d.ts +0 -1
- package/dist/commands/platform/list/index.js +1 -33
- package/dist/commands/profile/use/index.d.ts +33 -0
- package/dist/commands/profile/use/index.js +179 -0
- package/dist/commands/release/create/index.d.ts +0 -1
- package/dist/commands/release/create/index.js +1 -33
- package/dist/commands/release/delete/index.d.ts +0 -1
- package/dist/commands/release/delete/index.js +1 -33
- package/dist/commands/release/deploy/index.js +1 -12
- package/dist/commands/release/edit/index.d.ts +0 -1
- package/dist/commands/release/edit/index.js +1 -33
- package/dist/commands/release/export/index.d.ts +0 -1
- package/dist/commands/release/export/index.js +1 -31
- package/dist/commands/release/get/index.d.ts +0 -1
- package/dist/commands/release/get/index.js +1 -33
- package/dist/commands/release/import/index.d.ts +0 -1
- package/dist/commands/release/import/index.js +1 -32
- package/dist/commands/release/list/index.d.ts +0 -1
- package/dist/commands/release/list/index.js +1 -32
- package/dist/commands/release/pull/index.d.ts +0 -1
- package/dist/commands/release/pull/index.js +2 -38
- package/dist/commands/release/push/index.d.ts +0 -1
- package/dist/commands/release/push/index.js +1 -37
- package/dist/commands/static_host/build/create/index.d.ts +0 -1
- package/dist/commands/static_host/build/create/index.js +1 -39
- package/dist/commands/static_host/build/get/index.d.ts +0 -1
- package/dist/commands/static_host/build/get/index.js +1 -39
- package/dist/commands/static_host/build/list/index.d.ts +0 -1
- package/dist/commands/static_host/build/list/index.js +1 -39
- package/dist/commands/static_host/list/index.d.ts +0 -1
- package/dist/commands/static_host/list/index.js +1 -39
- package/dist/commands/tenant/backup/create/index.d.ts +0 -1
- package/dist/commands/tenant/backup/create/index.js +1 -33
- package/dist/commands/tenant/backup/delete/index.d.ts +0 -1
- package/dist/commands/tenant/backup/delete/index.js +1 -32
- package/dist/commands/tenant/backup/export/index.d.ts +0 -1
- package/dist/commands/tenant/backup/export/index.js +1 -31
- package/dist/commands/tenant/backup/import/index.d.ts +0 -1
- package/dist/commands/tenant/backup/import/index.js +1 -32
- package/dist/commands/tenant/backup/list/index.d.ts +0 -1
- package/dist/commands/tenant/backup/list/index.js +1 -33
- package/dist/commands/tenant/backup/restore/index.d.ts +0 -1
- package/dist/commands/tenant/backup/restore/index.js +1 -32
- package/dist/commands/tenant/cluster/create/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/create/index.js +1 -31
- package/dist/commands/tenant/cluster/delete/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/delete/index.js +1 -33
- package/dist/commands/tenant/cluster/edit/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/edit/index.js +1 -33
- package/dist/commands/tenant/cluster/get/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/get/index.js +1 -32
- package/dist/commands/tenant/cluster/license/get/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/license/get/index.js +1 -31
- package/dist/commands/tenant/cluster/license/set/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/license/set/index.js +1 -31
- package/dist/commands/tenant/cluster/list/index.d.ts +0 -1
- package/dist/commands/tenant/cluster/list/index.js +1 -32
- package/dist/commands/tenant/create/index.d.ts +0 -1
- package/dist/commands/tenant/create/index.js +1 -30
- package/dist/commands/tenant/delete/index.d.ts +0 -1
- package/dist/commands/tenant/delete/index.js +1 -33
- package/dist/commands/tenant/deploy_platform/index.d.ts +0 -1
- package/dist/commands/tenant/deploy_platform/index.js +1 -31
- package/dist/commands/tenant/deploy_release/index.d.ts +0 -1
- package/dist/commands/tenant/deploy_release/index.js +1 -32
- package/dist/commands/tenant/edit/index.d.ts +0 -1
- package/dist/commands/tenant/edit/index.js +1 -33
- package/dist/commands/tenant/env/delete/index.d.ts +0 -1
- package/dist/commands/tenant/env/delete/index.js +1 -32
- package/dist/commands/tenant/env/get/index.d.ts +0 -1
- package/dist/commands/tenant/env/get/index.js +1 -32
- package/dist/commands/tenant/env/get_all/index.d.ts +0 -1
- package/dist/commands/tenant/env/get_all/index.js +1 -30
- package/dist/commands/tenant/env/list/index.d.ts +0 -1
- package/dist/commands/tenant/env/list/index.js +1 -32
- package/dist/commands/tenant/env/set/index.d.ts +0 -1
- package/dist/commands/tenant/env/set/index.js +1 -32
- package/dist/commands/tenant/env/set_all/index.d.ts +0 -1
- package/dist/commands/tenant/env/set_all/index.js +1 -30
- package/dist/commands/tenant/get/index.d.ts +0 -1
- package/dist/commands/tenant/get/index.js +1 -32
- package/dist/commands/tenant/impersonate/index.d.ts +0 -1
- package/dist/commands/tenant/impersonate/index.js +1 -32
- package/dist/commands/tenant/license/get/index.d.ts +0 -1
- package/dist/commands/tenant/license/get/index.js +1 -31
- package/dist/commands/tenant/license/set/index.d.ts +0 -1
- package/dist/commands/tenant/license/set/index.js +1 -31
- package/dist/commands/tenant/list/index.d.ts +0 -1
- package/dist/commands/tenant/list/index.js +1 -32
- package/dist/commands/tenant/pull/index.d.ts +0 -1
- package/dist/commands/tenant/pull/index.js +1 -37
- package/dist/commands/tenant/unit_test/list/index.js +1 -12
- package/dist/commands/tenant/unit_test/run/index.js +1 -12
- package/dist/commands/tenant/unit_test/run_all/index.js +1 -12
- package/dist/commands/tenant/workflow_test/list/index.js +1 -12
- package/dist/commands/tenant/workflow_test/run/index.js +1 -12
- package/dist/commands/tenant/workflow_test/run_all/index.js +1 -12
- package/dist/commands/unit_test/list/index.d.ts +0 -1
- package/dist/commands/unit_test/list/index.js +1 -33
- package/dist/commands/unit_test/run/index.d.ts +0 -1
- package/dist/commands/unit_test/run/index.js +1 -33
- package/dist/commands/unit_test/run_all/index.d.ts +0 -1
- package/dist/commands/unit_test/run_all/index.js +1 -32
- package/dist/commands/workflow_test/delete/index.d.ts +0 -1
- package/dist/commands/workflow_test/delete/index.js +1 -33
- package/dist/commands/workflow_test/get/index.d.ts +0 -1
- package/dist/commands/workflow_test/get/index.js +1 -33
- package/dist/commands/workflow_test/list/index.d.ts +0 -1
- package/dist/commands/workflow_test/list/index.js +1 -33
- package/dist/commands/workflow_test/run/index.d.ts +0 -1
- package/dist/commands/workflow_test/run/index.js +1 -33
- package/dist/commands/workflow_test/run_all/index.d.ts +0 -1
- package/dist/commands/workflow_test/run_all/index.js +1 -32
- package/dist/commands/workspace/create/index.d.ts +0 -1
- package/dist/commands/workspace/create/index.js +1 -39
- package/dist/commands/workspace/delete/index.d.ts +0 -1
- package/dist/commands/workspace/delete/index.js +1 -39
- package/dist/commands/workspace/edit/index.d.ts +0 -1
- package/dist/commands/workspace/edit/index.js +1 -38
- package/dist/commands/workspace/get/index.d.ts +0 -1
- package/dist/commands/workspace/get/index.js +1 -38
- package/dist/commands/workspace/list/index.d.ts +0 -1
- package/dist/commands/workspace/list/index.js +1 -38
- package/dist/commands/workspace/pull/index.d.ts +0 -1
- package/dist/commands/workspace/pull/index.js +1 -37
- package/dist/utils/local-config.d.ts +43 -0
- package/dist/utils/local-config.js +88 -0
- package/dist/utils/multidoc-push.d.ts +25 -0
- package/dist/utils/multidoc-push.js +39 -18
- package/oclif.manifest.json +2490 -2403
- package/package.json +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import BaseCommand from '../../../../base-command.js';
|
|
5
3
|
export default class TenantEnvGet extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -38,19 +36,7 @@ postgres://localhost:5432/mydb
|
|
|
38
36
|
};
|
|
39
37
|
async run() {
|
|
40
38
|
const { args, flags } = await this.parse(TenantEnvGet);
|
|
41
|
-
const
|
|
42
|
-
const credentials = this.loadCredentials();
|
|
43
|
-
if (!(profileName in credentials.profiles)) {
|
|
44
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
45
|
-
`Create a profile using 'xano profile create'`);
|
|
46
|
-
}
|
|
47
|
-
const profile = credentials.profiles[profileName];
|
|
48
|
-
if (!profile.instance_origin) {
|
|
49
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
50
|
-
}
|
|
51
|
-
if (!profile.access_token) {
|
|
52
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
53
|
-
}
|
|
39
|
+
const { profile } = this.resolveProfile(flags);
|
|
54
40
|
const workspaceId = flags.workspace || profile.workspace;
|
|
55
41
|
if (!workspaceId) {
|
|
56
42
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -90,21 +76,4 @@ postgres://localhost:5432/mydb
|
|
|
90
76
|
}
|
|
91
77
|
}
|
|
92
78
|
}
|
|
93
|
-
loadCredentials() {
|
|
94
|
-
const credentialsPath = this.getCredentialsPath();
|
|
95
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
96
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
97
|
-
}
|
|
98
|
-
try {
|
|
99
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
100
|
-
const parsed = yaml.load(fileContent);
|
|
101
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
102
|
-
this.error('Credentials file has invalid format.');
|
|
103
|
-
}
|
|
104
|
-
return parsed;
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
79
|
}
|
|
@@ -46,19 +46,7 @@ Environment variables saved to env_my-tenant.yaml
|
|
|
46
46
|
};
|
|
47
47
|
async run() {
|
|
48
48
|
const { args, flags } = await this.parse(TenantEnvGetAll);
|
|
49
|
-
const
|
|
50
|
-
const credentials = this.loadCredentials();
|
|
51
|
-
if (!(profileName in credentials.profiles)) {
|
|
52
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
53
|
-
`Create a profile using 'xano profile create'`);
|
|
54
|
-
}
|
|
55
|
-
const profile = credentials.profiles[profileName];
|
|
56
|
-
if (!profile.instance_origin) {
|
|
57
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
58
|
-
}
|
|
59
|
-
if (!profile.access_token) {
|
|
60
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
61
|
-
}
|
|
49
|
+
const { profile } = this.resolveProfile(flags);
|
|
62
50
|
const workspaceId = flags.workspace || profile.workspace;
|
|
63
51
|
if (!workspaceId) {
|
|
64
52
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -101,21 +89,4 @@ Environment variables saved to env_my-tenant.yaml
|
|
|
101
89
|
}
|
|
102
90
|
}
|
|
103
91
|
}
|
|
104
|
-
loadCredentials() {
|
|
105
|
-
const credentialsPath = this.getCredentialsPath();
|
|
106
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
107
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
108
|
-
}
|
|
109
|
-
try {
|
|
110
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
111
|
-
const parsed = yaml.load(fileContent);
|
|
112
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
113
|
-
this.error('Credentials file has invalid format.');
|
|
114
|
-
}
|
|
115
|
-
return parsed;
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
92
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import BaseCommand from '../../../../base-command.js';
|
|
5
3
|
export default class TenantEnvList extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -36,19 +34,7 @@ Environment variables for tenant my-tenant:
|
|
|
36
34
|
};
|
|
37
35
|
async run() {
|
|
38
36
|
const { args, flags } = await this.parse(TenantEnvList);
|
|
39
|
-
const
|
|
40
|
-
const credentials = this.loadCredentials();
|
|
41
|
-
if (!(profileName in credentials.profiles)) {
|
|
42
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
43
|
-
`Create a profile using 'xano profile create'`);
|
|
44
|
-
}
|
|
45
|
-
const profile = credentials.profiles[profileName];
|
|
46
|
-
if (!profile.instance_origin) {
|
|
47
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
48
|
-
}
|
|
49
|
-
if (!profile.access_token) {
|
|
50
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
51
|
-
}
|
|
37
|
+
const { profile } = this.resolveProfile(flags);
|
|
52
38
|
const workspaceId = flags.workspace || profile.workspace;
|
|
53
39
|
if (!workspaceId) {
|
|
54
40
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -93,21 +79,4 @@ Environment variables for tenant my-tenant:
|
|
|
93
79
|
}
|
|
94
80
|
}
|
|
95
81
|
}
|
|
96
|
-
loadCredentials() {
|
|
97
|
-
const credentialsPath = this.getCredentialsPath();
|
|
98
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
99
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
103
|
-
const parsed = yaml.load(fileContent);
|
|
104
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
105
|
-
this.error('Credentials file has invalid format.');
|
|
106
|
-
}
|
|
107
|
-
return parsed;
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
82
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import BaseCommand from '../../../../base-command.js';
|
|
5
3
|
export default class TenantEnvSet extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -42,19 +40,7 @@ Environment variable 'DATABASE_URL' set for tenant my-tenant
|
|
|
42
40
|
};
|
|
43
41
|
async run() {
|
|
44
42
|
const { args, flags } = await this.parse(TenantEnvSet);
|
|
45
|
-
const
|
|
46
|
-
const credentials = this.loadCredentials();
|
|
47
|
-
if (!(profileName in credentials.profiles)) {
|
|
48
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
49
|
-
`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
|
-
}
|
|
43
|
+
const { profile } = this.resolveProfile(flags);
|
|
58
44
|
const workspaceId = flags.workspace || profile.workspace;
|
|
59
45
|
if (!workspaceId) {
|
|
60
46
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -99,21 +85,4 @@ Environment variable 'DATABASE_URL' set for tenant my-tenant
|
|
|
99
85
|
}
|
|
100
86
|
}
|
|
101
87
|
}
|
|
102
|
-
loadCredentials() {
|
|
103
|
-
const credentialsPath = this.getCredentialsPath();
|
|
104
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
105
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
106
|
-
}
|
|
107
|
-
try {
|
|
108
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
109
|
-
const parsed = yaml.load(fileContent);
|
|
110
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
111
|
-
this.error('Credentials file has invalid format.');
|
|
112
|
-
}
|
|
113
|
-
return parsed;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
88
|
}
|
|
@@ -56,19 +56,7 @@ Reads from env_my-tenant.yaml
|
|
|
56
56
|
this.error('Invalid env file format. Expected a YAML map of key: value pairs.');
|
|
57
57
|
}
|
|
58
58
|
const envs = Object.entries(envMap).map(([name, value]) => ({ name, value: String(value) }));
|
|
59
|
-
const
|
|
60
|
-
const credentials = this.loadCredentials();
|
|
61
|
-
if (!(profileName in credentials.profiles)) {
|
|
62
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
63
|
-
`Create a profile using 'xano profile create'`);
|
|
64
|
-
}
|
|
65
|
-
const profile = credentials.profiles[profileName];
|
|
66
|
-
if (!profile.instance_origin) {
|
|
67
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
68
|
-
}
|
|
69
|
-
if (!profile.access_token) {
|
|
70
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
71
|
-
}
|
|
59
|
+
const { profile } = this.resolveProfile(flags);
|
|
72
60
|
const workspaceId = flags.workspace || profile.workspace;
|
|
73
61
|
if (!workspaceId) {
|
|
74
62
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -109,21 +97,4 @@ Reads from env_my-tenant.yaml
|
|
|
109
97
|
}
|
|
110
98
|
}
|
|
111
99
|
}
|
|
112
|
-
loadCredentials() {
|
|
113
|
-
const credentialsPath = this.getCredentialsPath();
|
|
114
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
115
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
116
|
-
}
|
|
117
|
-
try {
|
|
118
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
119
|
-
const parsed = yaml.load(fileContent);
|
|
120
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
121
|
-
this.error('Credentials file has invalid format.');
|
|
122
|
-
}
|
|
123
|
-
return parsed;
|
|
124
|
-
}
|
|
125
|
-
catch (error) {
|
|
126
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
100
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import BaseCommand from '../../../base-command.js';
|
|
5
3
|
export default class TenantGet extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -38,19 +36,7 @@ Tenant: My Tenant (my-tenant)
|
|
|
38
36
|
};
|
|
39
37
|
async run() {
|
|
40
38
|
const { args, flags } = await this.parse(TenantGet);
|
|
41
|
-
const
|
|
42
|
-
const credentials = this.loadCredentials();
|
|
43
|
-
if (!(profileName in credentials.profiles)) {
|
|
44
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
45
|
-
`Create a profile using 'xano profile create'`);
|
|
46
|
-
}
|
|
47
|
-
const profile = credentials.profiles[profileName];
|
|
48
|
-
if (!profile.instance_origin) {
|
|
49
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
50
|
-
}
|
|
51
|
-
if (!profile.access_token) {
|
|
52
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
53
|
-
}
|
|
39
|
+
const { profile } = this.resolveProfile(flags);
|
|
54
40
|
const workspaceId = flags.workspace || profile.workspace;
|
|
55
41
|
if (!workspaceId) {
|
|
56
42
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -115,21 +101,4 @@ Tenant: My Tenant (my-tenant)
|
|
|
115
101
|
}
|
|
116
102
|
}
|
|
117
103
|
}
|
|
118
|
-
loadCredentials() {
|
|
119
|
-
const credentialsPath = this.getCredentialsPath();
|
|
120
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
121
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
125
|
-
const parsed = yaml.load(fileContent);
|
|
126
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
127
|
-
this.error('Credentials file has invalid format.');
|
|
128
|
-
}
|
|
129
|
-
return parsed;
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
104
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import open from 'open';
|
|
5
3
|
import BaseCommand from '../../../base-command.js';
|
|
6
4
|
export default class TenantImpersonate extends BaseCommand {
|
|
@@ -41,19 +39,7 @@ Impersonation successful!
|
|
|
41
39
|
};
|
|
42
40
|
async run() {
|
|
43
41
|
const { args, flags } = await this.parse(TenantImpersonate);
|
|
44
|
-
const
|
|
45
|
-
const credentials = this.loadCredentials();
|
|
46
|
-
if (!(profileName in credentials.profiles)) {
|
|
47
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
48
|
-
`Create a profile using 'xano auth'`);
|
|
49
|
-
}
|
|
50
|
-
const profile = credentials.profiles[profileName];
|
|
51
|
-
if (!profile.instance_origin) {
|
|
52
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
53
|
-
}
|
|
54
|
-
if (!profile.access_token) {
|
|
55
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
56
|
-
}
|
|
42
|
+
const { profile } = this.resolveProfile(flags);
|
|
57
43
|
const workspaceId = flags.workspace || profile.workspace;
|
|
58
44
|
if (!workspaceId) {
|
|
59
45
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -123,21 +109,4 @@ Impersonation successful!
|
|
|
123
109
|
}
|
|
124
110
|
return instanceOrigin;
|
|
125
111
|
}
|
|
126
|
-
loadCredentials() {
|
|
127
|
-
const credentialsPath = this.getCredentialsPath();
|
|
128
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
129
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano auth'`);
|
|
130
|
-
}
|
|
131
|
-
try {
|
|
132
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
133
|
-
const parsed = yaml.load(fileContent);
|
|
134
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
135
|
-
this.error('Credentials file has invalid format.');
|
|
136
|
-
}
|
|
137
|
-
return parsed;
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
112
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
2
|
import * as fs from 'node:fs';
|
|
4
3
|
import * as path from 'node:path';
|
|
5
4
|
import BaseCommand from '../../../../base-command.js';
|
|
@@ -48,19 +47,7 @@ License saved to my-license.yaml
|
|
|
48
47
|
};
|
|
49
48
|
async run() {
|
|
50
49
|
const { args, flags } = await this.parse(TenantLicenseGet);
|
|
51
|
-
const
|
|
52
|
-
const credentials = this.loadCredentials();
|
|
53
|
-
if (!(profileName in credentials.profiles)) {
|
|
54
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
55
|
-
`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
|
-
}
|
|
50
|
+
const { profile } = this.resolveProfile(flags);
|
|
64
51
|
const workspaceId = flags.workspace || profile.workspace;
|
|
65
52
|
if (!workspaceId) {
|
|
66
53
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -105,21 +92,4 @@ License saved to my-license.yaml
|
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
94
|
}
|
|
108
|
-
loadCredentials() {
|
|
109
|
-
const credentialsPath = this.getCredentialsPath();
|
|
110
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
111
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
112
|
-
}
|
|
113
|
-
try {
|
|
114
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
115
|
-
const parsed = yaml.load(fileContent);
|
|
116
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
117
|
-
this.error('Credentials file has invalid format.');
|
|
118
|
-
}
|
|
119
|
-
return parsed;
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
95
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
2
|
import * as fs from 'node:fs';
|
|
4
3
|
import * as path from 'node:path';
|
|
5
4
|
import BaseCommand from '../../../../base-command.js';
|
|
@@ -66,19 +65,7 @@ Reads from license_my-tenant.yaml
|
|
|
66
65
|
}
|
|
67
66
|
licenseValue = fs.readFileSync(sourceFilePath, 'utf8');
|
|
68
67
|
}
|
|
69
|
-
const
|
|
70
|
-
const credentials = this.loadCredentials();
|
|
71
|
-
if (!(profileName in credentials.profiles)) {
|
|
72
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
73
|
-
`Create a profile using 'xano profile create'`);
|
|
74
|
-
}
|
|
75
|
-
const profile = credentials.profiles[profileName];
|
|
76
|
-
if (!profile.instance_origin) {
|
|
77
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
78
|
-
}
|
|
79
|
-
if (!profile.access_token) {
|
|
80
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
81
|
-
}
|
|
68
|
+
const { profile } = this.resolveProfile(flags);
|
|
82
69
|
const workspaceId = flags.workspace || profile.workspace;
|
|
83
70
|
if (!workspaceId) {
|
|
84
71
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -119,21 +106,4 @@ Reads from license_my-tenant.yaml
|
|
|
119
106
|
}
|
|
120
107
|
}
|
|
121
108
|
}
|
|
122
|
-
loadCredentials() {
|
|
123
|
-
const credentialsPath = this.getCredentialsPath();
|
|
124
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
125
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
126
|
-
}
|
|
127
|
-
try {
|
|
128
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
129
|
-
const parsed = yaml.load(fileContent);
|
|
130
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
131
|
-
this.error('Credentials file has invalid format.');
|
|
132
|
-
}
|
|
133
|
-
return parsed;
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
109
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
|
-
import * as fs from 'node:fs';
|
|
4
2
|
import BaseCommand from '../../../base-command.js';
|
|
5
3
|
export default class TenantList extends BaseCommand {
|
|
6
4
|
static description = 'List all tenants in a workspace';
|
|
@@ -34,19 +32,7 @@ Tenants in workspace 5:
|
|
|
34
32
|
};
|
|
35
33
|
async run() {
|
|
36
34
|
const { flags } = await this.parse(TenantList);
|
|
37
|
-
const
|
|
38
|
-
const credentials = this.loadCredentials();
|
|
39
|
-
if (!(profileName in credentials.profiles)) {
|
|
40
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
41
|
-
`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
|
-
}
|
|
35
|
+
const { profile } = this.resolveProfile(flags);
|
|
50
36
|
const workspaceId = flags.workspace || profile.workspace;
|
|
51
37
|
if (!workspaceId) {
|
|
52
38
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -113,21 +99,4 @@ Tenants in workspace 5:
|
|
|
113
99
|
}
|
|
114
100
|
}
|
|
115
101
|
}
|
|
116
|
-
loadCredentials() {
|
|
117
|
-
const credentialsPath = this.getCredentialsPath();
|
|
118
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
119
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
120
|
-
}
|
|
121
|
-
try {
|
|
122
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
123
|
-
const parsed = yaml.load(fileContent);
|
|
124
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
125
|
-
this.error('Credentials file has invalid format.');
|
|
126
|
-
}
|
|
127
|
-
return parsed;
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
102
|
}
|
|
@@ -14,7 +14,6 @@ export default class Pull extends BaseCommand {
|
|
|
14
14
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
};
|
|
16
16
|
run(): Promise<void>;
|
|
17
|
-
private loadCredentials;
|
|
18
17
|
/**
|
|
19
18
|
* Sanitize a document name for use as a filename.
|
|
20
19
|
* Strips quotes, replaces spaces with underscores, and removes
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import * as yaml from 'js-yaml';
|
|
3
2
|
import * as fs from 'node:fs';
|
|
4
3
|
import * as path from 'node:path';
|
|
5
4
|
import snakeCase from 'lodash.snakecase';
|
|
@@ -58,23 +57,7 @@ Pulled 58 documents from tenant my-tenant
|
|
|
58
57
|
};
|
|
59
58
|
async run() {
|
|
60
59
|
const { flags } = await this.parse(Pull);
|
|
61
|
-
|
|
62
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
63
|
-
// Load credentials
|
|
64
|
-
const credentials = this.loadCredentials();
|
|
65
|
-
// Get the profile configuration
|
|
66
|
-
if (!(profileName in credentials.profiles)) {
|
|
67
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
68
|
-
`Create a profile using 'xano profile:create'`);
|
|
69
|
-
}
|
|
70
|
-
const profile = credentials.profiles[profileName];
|
|
71
|
-
// Validate required fields
|
|
72
|
-
if (!profile.instance_origin) {
|
|
73
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
74
|
-
}
|
|
75
|
-
if (!profile.access_token) {
|
|
76
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
77
|
-
}
|
|
60
|
+
const { profileName, profile } = this.resolveProfile(flags);
|
|
78
61
|
// Determine workspace_id from flag or profile
|
|
79
62
|
let workspaceId;
|
|
80
63
|
if (flags.workspace) {
|
|
@@ -254,25 +237,6 @@ Pulled 58 documents from tenant my-tenant
|
|
|
254
237
|
}
|
|
255
238
|
this.log(`Pulled ${writtenCount} documents from tenant ${tenantName} to ${flags.directory}`);
|
|
256
239
|
}
|
|
257
|
-
loadCredentials() {
|
|
258
|
-
const credentialsPath = this.getCredentialsPath();
|
|
259
|
-
// Check if credentials file exists
|
|
260
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
261
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
|
|
262
|
-
}
|
|
263
|
-
// Read credentials file
|
|
264
|
-
try {
|
|
265
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
266
|
-
const parsed = yaml.load(fileContent);
|
|
267
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
268
|
-
this.error('Credentials file has invalid format.');
|
|
269
|
-
}
|
|
270
|
-
return parsed;
|
|
271
|
-
}
|
|
272
|
-
catch (error) {
|
|
273
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
240
|
/**
|
|
277
241
|
* Sanitize a document name for use as a filename.
|
|
278
242
|
* Strips quotes, replaces spaces with underscores, and removes
|
|
@@ -41,18 +41,7 @@ Unit tests for tenant my-tenant:
|
|
|
41
41
|
};
|
|
42
42
|
async run() {
|
|
43
43
|
const { flags } = await this.parse(TenantUnitTestList);
|
|
44
|
-
const
|
|
45
|
-
const credentials = this.loadCredentialsFile();
|
|
46
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
47
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
48
|
-
}
|
|
49
|
-
const profile = credentials.profiles[profileName];
|
|
50
|
-
if (!profile.instance_origin) {
|
|
51
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
52
|
-
}
|
|
53
|
-
if (!profile.access_token) {
|
|
54
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
55
|
-
}
|
|
44
|
+
const { profile } = this.resolveProfile(flags);
|
|
56
45
|
const workspaceId = flags.workspace || profile.workspace;
|
|
57
46
|
if (!workspaceId) {
|
|
58
47
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -37,18 +37,7 @@ Result: PASS
|
|
|
37
37
|
};
|
|
38
38
|
async run() {
|
|
39
39
|
const { args, flags } = await this.parse(TenantUnitTestRun);
|
|
40
|
-
const
|
|
41
|
-
const credentials = this.loadCredentialsFile();
|
|
42
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
43
|
-
this.error(`Profile '${profileName}' not found.\nCreate a profile using 'xano profile create'`);
|
|
44
|
-
}
|
|
45
|
-
const profile = credentials.profiles[profileName];
|
|
46
|
-
if (!profile.instance_origin) {
|
|
47
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
48
|
-
}
|
|
49
|
-
if (!profile.access_token) {
|
|
50
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
51
|
-
}
|
|
40
|
+
const { profile } = this.resolveProfile(flags);
|
|
52
41
|
const workspaceId = flags.workspace || profile.workspace;
|
|
53
42
|
if (!workspaceId) {
|
|
54
43
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|