@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 ReleaseCreate extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -52,19 +50,7 @@ Created release: v1.0 - ID: 10
|
|
|
52
50
|
};
|
|
53
51
|
async run() {
|
|
54
52
|
const { args, flags } = await this.parse(ReleaseCreate);
|
|
55
|
-
const
|
|
56
|
-
const credentials = this.loadCredentials();
|
|
57
|
-
if (!(profileName in credentials.profiles)) {
|
|
58
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
59
|
-
`Create a profile using 'xano profile create'`);
|
|
60
|
-
}
|
|
61
|
-
const profile = credentials.profiles[profileName];
|
|
62
|
-
if (!profile.instance_origin) {
|
|
63
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
64
|
-
}
|
|
65
|
-
if (!profile.access_token) {
|
|
66
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
67
|
-
}
|
|
53
|
+
const { profile } = this.resolveProfile(flags);
|
|
68
54
|
const workspaceId = flags.workspace || profile.workspace;
|
|
69
55
|
if (!workspaceId) {
|
|
70
56
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -115,22 +101,4 @@ Created release: v1.0 - ID: 10
|
|
|
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` +
|
|
122
|
-
`Create a profile using 'xano profile create'`);
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
126
|
-
const parsed = yaml.load(fileContent);
|
|
127
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
128
|
-
this.error('Credentials file has invalid format.');
|
|
129
|
-
}
|
|
130
|
-
return parsed;
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
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 BaseCommand from '../../../base-command.js';
|
|
5
3
|
export default class ReleaseDelete extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -43,19 +41,7 @@ Deleted release 'v1.0'
|
|
|
43
41
|
};
|
|
44
42
|
async run() {
|
|
45
43
|
const { args, flags } = await this.parse(ReleaseDelete);
|
|
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
|
-
}
|
|
44
|
+
const { profile } = this.resolveProfile(flags);
|
|
59
45
|
const workspaceId = flags.workspace || profile.workspace;
|
|
60
46
|
if (!workspaceId) {
|
|
61
47
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -111,24 +97,6 @@ Deleted release 'v1.0'
|
|
|
111
97
|
});
|
|
112
98
|
});
|
|
113
99
|
}
|
|
114
|
-
loadCredentials() {
|
|
115
|
-
const credentialsPath = this.getCredentialsPath();
|
|
116
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
117
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
118
|
-
`Create a profile using 'xano profile create'`);
|
|
119
|
-
}
|
|
120
|
-
try {
|
|
121
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
122
|
-
const parsed = yaml.load(fileContent);
|
|
123
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
124
|
-
this.error('Credentials file has invalid format.');
|
|
125
|
-
}
|
|
126
|
-
return parsed;
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
100
|
async resolveReleaseName(profile, workspaceId, releaseName, verbose) {
|
|
133
101
|
const listUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release`;
|
|
134
102
|
const response = await this.verboseFetch(listUrl, {
|
|
@@ -52,18 +52,7 @@ Deployed release "v1.0" to workspace 40 (branch: v1.0)
|
|
|
52
52
|
};
|
|
53
53
|
async run() {
|
|
54
54
|
const { args, flags } = await this.parse(ReleaseDeploy);
|
|
55
|
-
const
|
|
56
|
-
const credentials = this.loadCredentialsFile();
|
|
57
|
-
if (!credentials || !(profileName in credentials.profiles)) {
|
|
58
|
-
this.error(`Profile '${profileName}' not found.\n` + `Create a profile using 'xano profile create'`);
|
|
59
|
-
}
|
|
60
|
-
const profile = credentials.profiles[profileName];
|
|
61
|
-
if (!profile.instance_origin) {
|
|
62
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
63
|
-
}
|
|
64
|
-
if (!profile.access_token) {
|
|
65
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
66
|
-
}
|
|
55
|
+
const { profile } = this.resolveProfile(flags);
|
|
67
56
|
const workspaceId = flags.workspace || profile.workspace;
|
|
68
57
|
if (!workspaceId) {
|
|
69
58
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -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 ReleaseEdit extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -43,19 +41,7 @@ Updated release: v1.0-final - ID: 10
|
|
|
43
41
|
};
|
|
44
42
|
async run() {
|
|
45
43
|
const { args, flags } = await this.parse(ReleaseEdit);
|
|
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
|
-
}
|
|
44
|
+
const { profile } = this.resolveProfile(flags);
|
|
59
45
|
const workspaceId = flags.workspace || profile.workspace;
|
|
60
46
|
if (!workspaceId) {
|
|
61
47
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -113,24 +99,6 @@ Updated release: v1.0-final - ID: 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` +
|
|
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
|
async resolveReleaseName(profile, workspaceId, releaseName, verbose) {
|
|
135
103
|
const listUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release`;
|
|
136
104
|
const response = await this.verboseFetch(listUrl, {
|
|
@@ -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 ReleaseExport extends BaseCommand {
|
|
7
6
|
static args = {
|
|
@@ -39,19 +38,7 @@ Downloaded release 'v1.0' to ./release-v1.0.tar.gz
|
|
|
39
38
|
};
|
|
40
39
|
async run() {
|
|
41
40
|
const { args, flags } = await this.parse(ReleaseExport);
|
|
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
|
-
}
|
|
41
|
+
const { profile } = this.resolveProfile(flags);
|
|
55
42
|
const workspaceId = flags.workspace || profile.workspace;
|
|
56
43
|
if (!workspaceId) {
|
|
57
44
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -123,23 +110,6 @@ Downloaded release 'v1.0' to ./release-v1.0.tar.gz
|
|
|
123
110
|
}
|
|
124
111
|
}
|
|
125
112
|
}
|
|
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 profile create'`);
|
|
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
113
|
async resolveReleaseName(profile, workspaceId, releaseName, verbose) {
|
|
144
114
|
const listUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release`;
|
|
145
115
|
const response = await this.verboseFetch(listUrl, {
|
|
@@ -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 ReleaseGet extends BaseCommand {
|
|
6
4
|
static args = {
|
|
@@ -36,19 +34,7 @@ Release: v1.0 - ID: 10
|
|
|
36
34
|
};
|
|
37
35
|
async run() {
|
|
38
36
|
const { args, flags } = await this.parse(ReleaseGet);
|
|
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.');
|
|
@@ -99,24 +85,6 @@ Release: v1.0 - ID: 10
|
|
|
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` +
|
|
106
|
-
`Create a profile using 'xano profile create'`);
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
110
|
-
const parsed = yaml.load(fileContent);
|
|
111
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
112
|
-
this.error('Credentials file has invalid format.');
|
|
113
|
-
}
|
|
114
|
-
return parsed;
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
88
|
async resolveReleaseName(profile, workspaceId, releaseName, verbose) {
|
|
121
89
|
const listUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release`;
|
|
122
90
|
const response = await this.verboseFetch(listUrl, {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { 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 ReleaseImport extends BaseCommand {
|
|
7
6
|
static args = {};
|
|
@@ -34,19 +33,7 @@ Imported release as #15
|
|
|
34
33
|
};
|
|
35
34
|
async run() {
|
|
36
35
|
const { flags } = await this.parse(ReleaseImport);
|
|
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
|
-
}
|
|
36
|
+
const { profile } = this.resolveProfile(flags);
|
|
50
37
|
const workspaceId = flags.workspace || profile.workspace;
|
|
51
38
|
if (!workspaceId) {
|
|
52
39
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -91,22 +78,4 @@ Imported release as #15
|
|
|
91
78
|
}
|
|
92
79
|
}
|
|
93
80
|
}
|
|
94
|
-
loadCredentials() {
|
|
95
|
-
const credentialsPath = this.getCredentialsPath();
|
|
96
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
97
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
98
|
-
`Create a profile using 'xano profile create'`);
|
|
99
|
-
}
|
|
100
|
-
try {
|
|
101
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
102
|
-
const parsed = yaml.load(fileContent);
|
|
103
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
104
|
-
this.error('Credentials file has invalid format.');
|
|
105
|
-
}
|
|
106
|
-
return parsed;
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
81
|
}
|
|
@@ -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 ReleaseList extends BaseCommand {
|
|
6
4
|
static description = 'List all releases in a workspace';
|
|
@@ -29,19 +27,7 @@ Releases in workspace 5:
|
|
|
29
27
|
};
|
|
30
28
|
async run() {
|
|
31
29
|
const { flags } = await this.parse(ReleaseList);
|
|
32
|
-
const
|
|
33
|
-
const credentials = this.loadCredentials();
|
|
34
|
-
if (!(profileName in credentials.profiles)) {
|
|
35
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
36
|
-
`Create a profile using 'xano profile create'`);
|
|
37
|
-
}
|
|
38
|
-
const profile = credentials.profiles[profileName];
|
|
39
|
-
if (!profile.instance_origin) {
|
|
40
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
41
|
-
}
|
|
42
|
-
if (!profile.access_token) {
|
|
43
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
44
|
-
}
|
|
30
|
+
const { profile } = this.resolveProfile(flags);
|
|
45
31
|
const workspaceId = flags.workspace || profile.workspace;
|
|
46
32
|
if (!workspaceId) {
|
|
47
33
|
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
@@ -99,21 +85,4 @@ Releases in workspace 5:
|
|
|
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
|
}
|
|
@@ -13,7 +13,6 @@ export default class ReleasePull extends BaseCommand {
|
|
|
13
13
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
14
|
};
|
|
15
15
|
run(): Promise<void>;
|
|
16
|
-
private loadCredentials;
|
|
17
16
|
private resolveReleaseName;
|
|
18
17
|
/**
|
|
19
18
|
* Sanitize a document name for use as a filename.
|
|
@@ -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';
|
|
@@ -52,23 +51,7 @@ Pulled 58 documents from release 'v1.0'
|
|
|
52
51
|
};
|
|
53
52
|
async run() {
|
|
54
53
|
const { flags } = await this.parse(ReleasePull);
|
|
55
|
-
|
|
56
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
57
|
-
// Load credentials
|
|
58
|
-
const credentials = this.loadCredentials();
|
|
59
|
-
// Get the profile configuration
|
|
60
|
-
if (!(profileName in credentials.profiles)) {
|
|
61
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
62
|
-
`Create a profile using 'xano profile:create'`);
|
|
63
|
-
}
|
|
64
|
-
const profile = credentials.profiles[profileName];
|
|
65
|
-
// Validate required fields
|
|
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
|
-
}
|
|
54
|
+
const { profile } = this.resolveProfile(flags);
|
|
72
55
|
// Determine workspace_id from flag or profile
|
|
73
56
|
let workspaceId;
|
|
74
57
|
if (flags.workspace) {
|
|
@@ -80,7 +63,7 @@ Pulled 58 documents from release 'v1.0'
|
|
|
80
63
|
else {
|
|
81
64
|
this.error(`Workspace ID is required. Either:\n` +
|
|
82
65
|
` 1. Provide it as a flag: xano release pull -r <release_name> -w <workspace_id>\n` +
|
|
83
|
-
` 2. Set it in your profile using: xano profile:edit
|
|
66
|
+
` 2. Set it in your profile using: xano profile:edit --workspace <workspace_id>`);
|
|
84
67
|
}
|
|
85
68
|
const releaseName = flags.release;
|
|
86
69
|
const releaseId = await this.resolveReleaseName(profile, workspaceId, releaseName, flags.verbose);
|
|
@@ -248,25 +231,6 @@ Pulled 58 documents from release 'v1.0'
|
|
|
248
231
|
}
|
|
249
232
|
this.log(`Pulled ${writtenCount} documents from release '${releaseName}' to ${flags.directory}`);
|
|
250
233
|
}
|
|
251
|
-
loadCredentials() {
|
|
252
|
-
const credentialsPath = this.getCredentialsPath();
|
|
253
|
-
// Check if credentials file exists
|
|
254
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
255
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
|
|
256
|
-
}
|
|
257
|
-
// Read credentials file
|
|
258
|
-
try {
|
|
259
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
260
|
-
const parsed = yaml.load(fileContent);
|
|
261
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
262
|
-
this.error('Credentials file has invalid format.');
|
|
263
|
-
}
|
|
264
|
-
return parsed;
|
|
265
|
-
}
|
|
266
|
-
catch (error) {
|
|
267
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
234
|
async resolveReleaseName(profile, workspaceId, releaseName, verbose) {
|
|
271
235
|
const listUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/release`;
|
|
272
236
|
const response = await this.verboseFetch(listUrl, {
|
|
@@ -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';
|
|
@@ -73,23 +72,7 @@ Output release details as JSON
|
|
|
73
72
|
};
|
|
74
73
|
async run() {
|
|
75
74
|
const { flags } = await this.parse(ReleasePush);
|
|
76
|
-
|
|
77
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
78
|
-
// Load credentials
|
|
79
|
-
const credentials = this.loadCredentials();
|
|
80
|
-
// Get the profile configuration
|
|
81
|
-
if (!(profileName in credentials.profiles)) {
|
|
82
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
83
|
-
`Create a profile using 'xano profile:create'`);
|
|
84
|
-
}
|
|
85
|
-
const profile = credentials.profiles[profileName];
|
|
86
|
-
// Validate required fields
|
|
87
|
-
if (!profile.instance_origin) {
|
|
88
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
89
|
-
}
|
|
90
|
-
if (!profile.access_token) {
|
|
91
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
92
|
-
}
|
|
75
|
+
const { profileName, profile } = this.resolveProfile(flags);
|
|
93
76
|
// Determine workspace_id from flag or profile
|
|
94
77
|
let workspaceId;
|
|
95
78
|
if (flags.workspace) {
|
|
@@ -218,23 +201,4 @@ Output release details as JSON
|
|
|
218
201
|
}
|
|
219
202
|
return files.sort();
|
|
220
203
|
}
|
|
221
|
-
loadCredentials() {
|
|
222
|
-
const credentialsPath = this.getCredentialsPath();
|
|
223
|
-
// Check if credentials file exists
|
|
224
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
225
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
|
|
226
|
-
}
|
|
227
|
-
// Read credentials file
|
|
228
|
-
try {
|
|
229
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
230
|
-
const parsed = yaml.load(fileContent);
|
|
231
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
232
|
-
this.error('Credentials file has invalid format.');
|
|
233
|
-
}
|
|
234
|
-
return parsed;
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
204
|
}
|
|
@@ -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';
|
|
@@ -64,23 +63,7 @@ Description: Production build
|
|
|
64
63
|
};
|
|
65
64
|
async run() {
|
|
66
65
|
const { args, flags } = await this.parse(StaticHostBuildCreate);
|
|
67
|
-
|
|
68
|
-
const profileName = flags.profile || this.getDefaultProfile();
|
|
69
|
-
// Load credentials
|
|
70
|
-
const credentials = this.loadCredentials();
|
|
71
|
-
// Get the profile configuration
|
|
72
|
-
if (!(profileName in credentials.profiles)) {
|
|
73
|
-
this.error(`Profile '${profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
74
|
-
`Create a profile using 'xano profile:create'`);
|
|
75
|
-
}
|
|
76
|
-
const profile = credentials.profiles[profileName];
|
|
77
|
-
// Validate required fields
|
|
78
|
-
if (!profile.instance_origin) {
|
|
79
|
-
this.error(`Profile '${profileName}' is missing instance_origin`);
|
|
80
|
-
}
|
|
81
|
-
if (!profile.access_token) {
|
|
82
|
-
this.error(`Profile '${profileName}' is missing access_token`);
|
|
83
|
-
}
|
|
66
|
+
const { profile, profileName } = this.resolveProfile(flags);
|
|
84
67
|
// Determine workspace_id from flag or profile
|
|
85
68
|
let workspaceId;
|
|
86
69
|
if (flags.workspace) {
|
|
@@ -114,7 +97,6 @@ Description: Production build
|
|
|
114
97
|
// Construct the API URL
|
|
115
98
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/static_host/${args.static_host}/build`;
|
|
116
99
|
// Create FormData
|
|
117
|
-
const FormData = (await import('node:buffer')).Blob;
|
|
118
100
|
const formData = new globalThis.FormData();
|
|
119
101
|
// Read file and create blob
|
|
120
102
|
const fileBuffer = fs.readFileSync(filePath);
|
|
@@ -169,24 +151,4 @@ Description: Production build
|
|
|
169
151
|
}
|
|
170
152
|
}
|
|
171
153
|
}
|
|
172
|
-
loadCredentials() {
|
|
173
|
-
const credentialsPath = this.getCredentialsPath();
|
|
174
|
-
// Check if credentials file exists
|
|
175
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
176
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
177
|
-
`Create a profile using 'xano profile:create'`);
|
|
178
|
-
}
|
|
179
|
-
// Read credentials file
|
|
180
|
-
try {
|
|
181
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
182
|
-
const parsed = yaml.load(fileContent);
|
|
183
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
184
|
-
this.error('Credentials file has invalid format.');
|
|
185
|
-
}
|
|
186
|
-
return parsed;
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
154
|
}
|