@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 StaticHostBuildGet extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -57,23 +55,7 @@ Name: production-build
|
|
|
57
55
|
};
|
|
58
56
|
async run() {
|
|
59
57
|
const { args, flags } = await this.parse(StaticHostBuildGet);
|
|
60
|
-
|
|
61
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
62
|
-
// Load credentials
|
|
63
|
-
const credentials = this.loadCredentials();
|
|
64
|
-
// Get the profile configuration
|
|
65
|
-
if (!(profileName in credentials.profiles)) {
|
|
66
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
67
|
-
`Create a profile using 'xano profile:create'`);
|
|
68
|
-
}
|
|
69
|
-
const profile = credentials.profiles[profileName];
|
|
70
|
-
// Validate required fields
|
|
71
|
-
if (!profile.instance_origin) {
|
|
72
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
73
|
-
}
|
|
74
|
-
if (!profile.access_token) {
|
|
75
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
76
|
-
}
|
|
58
|
+
const { profile, profileName } = this.resolveProfile(flags);
|
|
77
59
|
// Determine workspace_id from flag or profile
|
|
78
60
|
let workspaceId;
|
|
79
61
|
if (flags.workspace) {
|
|
@@ -139,24 +121,4 @@ Name: production-build
|
|
|
139
121
|
}
|
|
140
122
|
}
|
|
141
123
|
}
|
|
142
|
-
loadCredentials() {
|
|
143
|
-
const credentialsPath = this.getCredentialsPath();
|
|
144
|
-
// Check if credentials file exists
|
|
145
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
146
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
147
|
-
`Create a profile using 'xano profile:create'`);
|
|
148
|
-
}
|
|
149
|
-
// Read credentials file
|
|
150
|
-
try {
|
|
151
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
152
|
-
const parsed = yaml.load(fileContent);
|
|
153
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
154
|
-
this.error('Credentials file has invalid format.');
|
|
155
|
-
}
|
|
156
|
-
return parsed;
|
|
157
|
-
}
|
|
158
|
-
catch (error) {
|
|
159
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
124
|
}
|
|
@@ -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 StaticHostBuildList extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -66,23 +64,7 @@ Available builds:
|
|
|
66
64
|
};
|
|
67
65
|
async run() {
|
|
68
66
|
const { args, flags } = await this.parse(StaticHostBuildList);
|
|
69
|
-
|
|
70
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
71
|
-
// Load credentials
|
|
72
|
-
const credentials = this.loadCredentials();
|
|
73
|
-
// Get the profile configuration
|
|
74
|
-
if (!(profileName in credentials.profiles)) {
|
|
75
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
76
|
-
`Create a profile using 'xano profile:create'`);
|
|
77
|
-
}
|
|
78
|
-
const profile = credentials.profiles[profileName];
|
|
79
|
-
// Validate required fields
|
|
80
|
-
if (!profile.instance_origin) {
|
|
81
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
82
|
-
}
|
|
83
|
-
if (!profile.access_token) {
|
|
84
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
85
|
-
}
|
|
67
|
+
const { profile, profileName } = this.resolveProfile(flags);
|
|
86
68
|
// Determine workspace_id from flag or profile
|
|
87
69
|
let workspaceId;
|
|
88
70
|
if (flags.workspace) {
|
|
@@ -166,24 +148,4 @@ Available builds:
|
|
|
166
148
|
}
|
|
167
149
|
}
|
|
168
150
|
}
|
|
169
|
-
loadCredentials() {
|
|
170
|
-
const credentialsPath = this.getCredentialsPath();
|
|
171
|
-
// Check if credentials file exists
|
|
172
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
173
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
174
|
-
`Create a profile using 'xano profile:create'`);
|
|
175
|
-
}
|
|
176
|
-
// Read credentials file
|
|
177
|
-
try {
|
|
178
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
179
|
-
const parsed = yaml.load(fileContent);
|
|
180
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
181
|
-
this.error('Credentials file has invalid format.');
|
|
182
|
-
}
|
|
183
|
-
return parsed;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
151
|
}
|
|
@@ -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 StaticHostList extends BaseCommand {
|
|
6
4
|
static args = {};
|
|
@@ -61,23 +59,7 @@ Available static hosts:
|
|
|
61
59
|
};
|
|
62
60
|
async run() {
|
|
63
61
|
const { flags } = await this.parse(StaticHostList);
|
|
64
|
-
|
|
65
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
66
|
-
// Load credentials
|
|
67
|
-
const credentials = this.loadCredentials();
|
|
68
|
-
// Get the profile configuration
|
|
69
|
-
if (!(profileName in credentials.profiles)) {
|
|
70
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
71
|
-
`Create a profile using 'xano profile:create'`);
|
|
72
|
-
}
|
|
73
|
-
const profile = credentials.profiles[profileName];
|
|
74
|
-
// Validate required fields
|
|
75
|
-
if (!profile.instance_origin) {
|
|
76
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
77
|
-
}
|
|
78
|
-
if (!profile.access_token) {
|
|
79
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
80
|
-
}
|
|
62
|
+
const { profile, profileName } = this.resolveProfile(flags);
|
|
81
63
|
// Determine workspace_id from flag or profile
|
|
82
64
|
let workspaceId;
|
|
83
65
|
if (flags.workspace) {
|
|
@@ -161,24 +143,4 @@ Available static hosts:
|
|
|
161
143
|
}
|
|
162
144
|
}
|
|
163
145
|
}
|
|
164
|
-
loadCredentials() {
|
|
165
|
-
const credentialsPath = this.getCredentialsPath();
|
|
166
|
-
// Check if credentials file exists
|
|
167
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
168
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
169
|
-
`Create a profile using 'xano profile:create'`);
|
|
170
|
-
}
|
|
171
|
-
// Read credentials file
|
|
172
|
-
try {
|
|
173
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
174
|
-
const parsed = yaml.load(fileContent);
|
|
175
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
176
|
-
this.error('Credentials file has invalid format.');
|
|
177
|
-
}
|
|
178
|
-
return parsed;
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
146
|
}
|
|
@@ -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 TenantBackupCreate extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -39,19 +37,7 @@ Created backup #15 for tenant t1234-abcd-xyz1
|
|
|
39
37
|
};
|
|
40
38
|
async run() {
|
|
41
39
|
const { args, flags } = await this.parse(TenantBackupCreate);
|
|
42
|
-
const
|
|
43
|
-
const credentials = this.loadCredentials();
|
|
44
|
-
if (!(profileName in credentials.profiles)) {
|
|
45
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
46
|
-
`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
|
-
}
|
|
40
|
+
const { profile } = this.resolveProfile(flags);
|
|
55
41
|
const workspaceId = flags.workspace || profile.workspace;
|
|
56
42
|
if (!workspaceId) {
|
|
57
43
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -89,22 +75,4 @@ Created backup #15 for tenant t1234-abcd-xyz1
|
|
|
89
75
|
}
|
|
90
76
|
}
|
|
91
77
|
}
|
|
92
|
-
loadCredentials() {
|
|
93
|
-
const credentialsPath = this.getCredentialsPath();
|
|
94
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
95
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
96
|
-
`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
78
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as fs from 'node:fs';
|
|
3
2
|
import * as readline from 'node:readline';
|
|
4
|
-
import * as yaml from 'js-yaml';
|
|
5
3
|
import BaseCommand from '../../../../base-command.js';
|
|
6
4
|
export default class TenantBackupDelete extends BaseCommand {
|
|
7
5
|
static args = {
|
|
@@ -46,19 +44,7 @@ Deleted backup #10
|
|
|
46
44
|
};
|
|
47
45
|
async run() {
|
|
48
46
|
const { args, flags } = await this.parse(TenantBackupDelete);
|
|
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
|
-
}
|
|
47
|
+
const { profile } = this.resolveProfile(flags);
|
|
62
48
|
const workspaceId = flags.workspace || profile.workspace;
|
|
63
49
|
if (!workspaceId) {
|
|
64
50
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -113,21 +99,4 @@ Deleted backup #10
|
|
|
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
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
-
import * as yaml from 'js-yaml';
|
|
5
4
|
import BaseCommand, { buildUserAgent } from '../../../../base-command.js';
|
|
6
5
|
export default class TenantBackupExport extends BaseCommand {
|
|
7
6
|
static args = {
|
|
@@ -43,19 +42,7 @@ Downloaded backup #10 to ./tenant-t1234-abcd-xyz1-backup-10.tar.gz
|
|
|
43
42
|
};
|
|
44
43
|
async run() {
|
|
45
44
|
const { args, flags } = await this.parse(TenantBackupExport);
|
|
46
|
-
const
|
|
47
|
-
const credentials = this.loadCredentials();
|
|
48
|
-
if (!(profileName in credentials.profiles)) {
|
|
49
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
50
|
-
`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
|
-
}
|
|
45
|
+
const { profile } = this.resolveProfile(flags);
|
|
59
46
|
const workspaceId = flags.workspace || profile.workspace;
|
|
60
47
|
if (!workspaceId) {
|
|
61
48
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -126,21 +113,4 @@ Downloaded backup #10 to ./tenant-t1234-abcd-xyz1-backup-10.tar.gz
|
|
|
126
113
|
}
|
|
127
114
|
}
|
|
128
115
|
}
|
|
129
|
-
loadCredentials() {
|
|
130
|
-
const credentialsPath = this.getCredentialsPath();
|
|
131
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
132
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
133
|
-
}
|
|
134
|
-
try {
|
|
135
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
136
|
-
const parsed = yaml.load(fileContent);
|
|
137
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
138
|
-
this.error('Credentials file has invalid format.');
|
|
139
|
-
}
|
|
140
|
-
return parsed;
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
116
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
|
-
import * as yaml from 'js-yaml';
|
|
5
4
|
import BaseCommand from '../../../../base-command.js';
|
|
6
5
|
export default class TenantBackupImport extends BaseCommand {
|
|
7
6
|
static args = {
|
|
@@ -45,19 +44,7 @@ Imported backup as #15 for tenant t1234-abcd-xyz1
|
|
|
45
44
|
};
|
|
46
45
|
async run() {
|
|
47
46
|
const { args, flags } = await this.parse(TenantBackupImport);
|
|
48
|
-
const
|
|
49
|
-
const credentials = this.loadCredentials();
|
|
50
|
-
if (!(profileName in credentials.profiles)) {
|
|
51
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
52
|
-
`Create a profile using 'xano profile create'`);
|
|
53
|
-
}
|
|
54
|
-
const profile = credentials.profiles[profileName];
|
|
55
|
-
if (!profile.instance_origin) {
|
|
56
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
57
|
-
}
|
|
58
|
-
if (!profile.access_token) {
|
|
59
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
60
|
-
}
|
|
47
|
+
const { profile } = this.resolveProfile(flags);
|
|
61
48
|
const workspaceId = flags.workspace || profile.workspace;
|
|
62
49
|
if (!workspaceId) {
|
|
63
50
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -104,22 +91,4 @@ Imported backup as #15 for tenant t1234-abcd-xyz1
|
|
|
104
91
|
}
|
|
105
92
|
}
|
|
106
93
|
}
|
|
107
|
-
loadCredentials() {
|
|
108
|
-
const credentialsPath = this.getCredentialsPath();
|
|
109
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
110
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
111
|
-
`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
94
|
}
|
|
@@ -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 TenantBackupList extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -40,19 +38,7 @@ Backups for tenant t1234-abcd-xyz1:
|
|
|
40
38
|
};
|
|
41
39
|
async run() {
|
|
42
40
|
const { args, flags } = await this.parse(TenantBackupList);
|
|
43
|
-
const
|
|
44
|
-
const credentials = this.loadCredentials();
|
|
45
|
-
if (!(profileName in credentials.profiles)) {
|
|
46
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
47
|
-
`Create 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
|
-
}
|
|
41
|
+
const { profile } = this.resolveProfile(flags);
|
|
56
42
|
const workspaceId = flags.workspace || profile.workspace;
|
|
57
43
|
if (!workspaceId) {
|
|
58
44
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -113,22 +99,4 @@ Backups for tenant t1234-abcd-xyz1:
|
|
|
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` +
|
|
120
|
-
`Create a profile using 'xano profile create'`);
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
124
|
-
const parsed = yaml.load(fileContent);
|
|
125
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
126
|
-
this.error('Credentials file has invalid format.');
|
|
127
|
-
}
|
|
128
|
-
return parsed;
|
|
129
|
-
}
|
|
130
|
-
catch (error) {
|
|
131
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
102
|
}
|
|
@@ -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 TenantRestore extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -44,19 +42,7 @@ Restored tenant t1234-abcd-xyz1 from backup #10
|
|
|
44
42
|
};
|
|
45
43
|
async run() {
|
|
46
44
|
const { args, flags } = await this.parse(TenantRestore);
|
|
47
|
-
const
|
|
48
|
-
const credentials = this.loadCredentials();
|
|
49
|
-
if (!(profileName in credentials.profiles)) {
|
|
50
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
51
|
-
`Create a profile using 'xano profile create'`);
|
|
52
|
-
}
|
|
53
|
-
const profile = credentials.profiles[profileName];
|
|
54
|
-
if (!profile.instance_origin) {
|
|
55
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
56
|
-
}
|
|
57
|
-
if (!profile.access_token) {
|
|
58
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
59
|
-
}
|
|
45
|
+
const { profile } = this.resolveProfile(flags);
|
|
60
46
|
const workspaceId = flags.workspace || profile.workspace;
|
|
61
47
|
if (!workspaceId) {
|
|
62
48
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -117,21 +103,4 @@ Restored tenant t1234-abcd-xyz1 from backup #10
|
|
|
117
103
|
});
|
|
118
104
|
});
|
|
119
105
|
}
|
|
120
|
-
loadCredentials() {
|
|
121
|
-
const credentialsPath = this.getCredentialsPath();
|
|
122
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
123
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
124
|
-
}
|
|
125
|
-
try {
|
|
126
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
127
|
-
const parsed = yaml.load(fileContent);
|
|
128
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
129
|
-
this.error('Credentials file has invalid format.');
|
|
130
|
-
}
|
|
131
|
-
return parsed;
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
106
|
}
|
|
@@ -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 BaseCommand from '../../../../base-command.js';
|
|
@@ -53,19 +52,7 @@ Created tenant cluster: us-east-1 (standard) - ID: 3
|
|
|
53
52
|
};
|
|
54
53
|
async run() {
|
|
55
54
|
const { flags } = await this.parse(TenantClusterCreate);
|
|
56
|
-
const
|
|
57
|
-
const credentials = this.loadCredentials();
|
|
58
|
-
if (!(profileName in credentials.profiles)) {
|
|
59
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
60
|
-
`Create a profile using 'xano profile create'`);
|
|
61
|
-
}
|
|
62
|
-
const profile = credentials.profiles[profileName];
|
|
63
|
-
if (!profile.instance_origin) {
|
|
64
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
65
|
-
}
|
|
66
|
-
if (!profile.access_token) {
|
|
67
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
68
|
-
}
|
|
55
|
+
const { profile } = this.resolveProfile(flags);
|
|
69
56
|
// Resolve credentials from flag or file
|
|
70
57
|
let credentialsValue;
|
|
71
58
|
if (flags.credentials) {
|
|
@@ -127,21 +114,4 @@ Created tenant cluster: us-east-1 (standard) - ID: 3
|
|
|
127
114
|
}
|
|
128
115
|
}
|
|
129
116
|
}
|
|
130
|
-
loadCredentials() {
|
|
131
|
-
const credentialsPath = this.getCredentialsPath();
|
|
132
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
133
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
134
|
-
}
|
|
135
|
-
try {
|
|
136
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
137
|
-
const parsed = yaml.load(fileContent);
|
|
138
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
139
|
-
this.error('Credentials file has invalid format.');
|
|
140
|
-
}
|
|
141
|
-
return parsed;
|
|
142
|
-
}
|
|
143
|
-
catch (error) {
|
|
144
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
117
|
}
|
|
@@ -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 TenantClusterDelete extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -38,19 +36,7 @@ Tenant cluster 3 deleted successfully
|
|
|
38
36
|
};
|
|
39
37
|
async run() {
|
|
40
38
|
const { args, flags } = await this.parse(TenantClusterDelete);
|
|
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 clusterId = args.cluster_id;
|
|
55
41
|
if (!flags.force) {
|
|
56
42
|
const confirmed = await this.confirm(`Are you sure you want to delete tenant cluster ${clusterId}? This action cannot be undone.`);
|
|
@@ -101,22 +87,4 @@ Tenant cluster 3 deleted successfully
|
|
|
101
87
|
});
|
|
102
88
|
});
|
|
103
89
|
}
|
|
104
|
-
loadCredentials() {
|
|
105
|
-
const credentialsPath = this.getCredentialsPath();
|
|
106
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
107
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
108
|
-
`Create a profile using 'xano profile create'`);
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
112
|
-
const parsed = yaml.load(fileContent);
|
|
113
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
114
|
-
this.error('Credentials file has invalid format.');
|
|
115
|
-
}
|
|
116
|
-
return parsed;
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
90
|
}
|