@xano/cli 0.0.37 → 0.0.39
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 +325 -102
- package/dist/commands/auth/index.d.ts +0 -2
- package/dist/commands/auth/index.js +2 -55
- package/dist/commands/profile/create/index.d.ts +0 -2
- package/dist/commands/profile/create/index.js +0 -15
- package/dist/commands/profile/edit/index.d.ts +0 -4
- package/dist/commands/profile/edit/index.js +7 -38
- package/dist/commands/profile/wizard/index.d.ts +0 -2
- package/dist/commands/profile/wizard/index.js +0 -106
- package/dist/commands/profile/{project → workspace}/index.d.ts +1 -1
- package/dist/commands/profile/{project → workspace}/index.js +10 -10
- package/dist/commands/release/delete/index.d.ts +2 -4
- package/dist/commands/release/delete/index.js +39 -12
- package/dist/commands/release/edit/index.d.ts +2 -4
- package/dist/commands/release/edit/index.js +31 -5
- package/dist/commands/release/export/index.d.ts +2 -4
- package/dist/commands/release/export/index.js +39 -11
- package/dist/commands/release/get/index.d.ts +2 -4
- package/dist/commands/release/get/index.js +31 -5
- package/dist/commands/release/pull/index.d.ts +31 -0
- package/dist/commands/release/pull/index.js +345 -0
- package/dist/commands/release/push/index.d.ts +26 -0
- package/dist/commands/release/push/index.js +230 -0
- package/dist/commands/tenant/backup/delete/index.d.ts +1 -1
- package/dist/commands/tenant/backup/delete/index.js +8 -9
- package/dist/commands/tenant/backup/export/index.d.ts +1 -1
- package/dist/commands/tenant/backup/export/index.js +9 -10
- package/dist/commands/tenant/backup/restore/index.d.ts +1 -1
- package/dist/commands/tenant/backup/restore/index.js +8 -9
- package/dist/commands/tenant/cluster/create/index.d.ts +18 -0
- package/dist/commands/tenant/cluster/create/index.js +149 -0
- package/dist/commands/{run/sessions/start → tenant/cluster/delete}/index.d.ts +9 -3
- package/dist/commands/tenant/cluster/delete/index.js +125 -0
- package/dist/commands/tenant/cluster/edit/index.d.ts +22 -0
- package/dist/commands/tenant/cluster/edit/index.js +128 -0
- package/dist/commands/{run/sessions → tenant/cluster}/get/index.d.ts +7 -3
- package/dist/commands/tenant/cluster/get/index.js +114 -0
- package/dist/commands/{run/info → tenant/cluster/license/get}/index.d.ts +10 -7
- package/dist/commands/tenant/cluster/license/get/index.js +118 -0
- package/dist/commands/tenant/cluster/license/set/index.d.ts +21 -0
- package/dist/commands/tenant/cluster/license/set/index.js +132 -0
- package/dist/commands/{run/env → tenant/cluster}/list/index.d.ts +3 -3
- package/dist/commands/tenant/cluster/list/index.js +109 -0
- package/dist/commands/tenant/create/index.d.ts +6 -3
- package/dist/commands/tenant/create/index.js +28 -20
- package/dist/commands/tenant/deploy_platform/index.d.ts +1 -1
- package/dist/commands/tenant/deploy_platform/index.js +8 -9
- package/dist/commands/tenant/deploy_release/index.d.ts +1 -1
- package/dist/commands/tenant/deploy_release/index.js +8 -9
- package/dist/commands/tenant/env/delete/index.d.ts +19 -0
- package/dist/commands/tenant/env/delete/index.js +139 -0
- package/dist/commands/{run/projects/create → tenant/env/get}/index.d.ts +7 -4
- package/dist/commands/tenant/env/get/index.js +113 -0
- package/dist/commands/{run/projects/update → tenant/env/get_all}/index.d.ts +7 -5
- package/dist/commands/tenant/env/get_all/index.js +123 -0
- package/dist/commands/{run/secrets/get → tenant/env/list}/index.d.ts +5 -3
- package/dist/commands/tenant/env/list/index.js +116 -0
- package/dist/commands/tenant/env/set/index.d.ts +18 -0
- package/dist/commands/tenant/env/set/index.js +122 -0
- package/dist/commands/tenant/env/set_all/index.d.ts +18 -0
- package/dist/commands/tenant/env/set_all/index.js +131 -0
- package/dist/commands/tenant/get/index.js +6 -5
- package/dist/commands/tenant/impersonate/index.d.ts +19 -0
- package/dist/commands/tenant/impersonate/index.js +146 -0
- package/dist/commands/tenant/license/get/index.d.ts +18 -0
- package/dist/commands/tenant/license/get/index.js +127 -0
- package/dist/commands/tenant/license/set/index.d.ts +19 -0
- package/dist/commands/tenant/license/set/index.js +141 -0
- package/dist/commands/tenant/list/index.js +6 -6
- package/dist/commands/tenant/pull/index.d.ts +31 -0
- package/dist/commands/tenant/pull/index.js +327 -0
- package/dist/commands/tenant/push/index.d.ts +24 -0
- package/dist/commands/tenant/push/index.js +245 -0
- package/oclif.manifest.json +2218 -1813
- package/package.json +1 -19
- package/dist/commands/run/env/delete/index.d.ts +0 -14
- package/dist/commands/run/env/delete/index.js +0 -65
- package/dist/commands/run/env/get/index.d.ts +0 -14
- package/dist/commands/run/env/get/index.js +0 -52
- package/dist/commands/run/env/list/index.js +0 -56
- package/dist/commands/run/env/set/index.d.ts +0 -14
- package/dist/commands/run/env/set/index.js +0 -51
- package/dist/commands/run/exec/index.d.ts +0 -31
- package/dist/commands/run/exec/index.js +0 -431
- package/dist/commands/run/info/index.js +0 -160
- package/dist/commands/run/projects/create/index.js +0 -75
- package/dist/commands/run/projects/delete/index.d.ts +0 -14
- package/dist/commands/run/projects/delete/index.js +0 -65
- package/dist/commands/run/projects/list/index.d.ts +0 -13
- package/dist/commands/run/projects/list/index.js +0 -66
- package/dist/commands/run/projects/update/index.js +0 -86
- package/dist/commands/run/secrets/delete/index.d.ts +0 -14
- package/dist/commands/run/secrets/delete/index.js +0 -65
- package/dist/commands/run/secrets/get/index.js +0 -52
- package/dist/commands/run/secrets/list/index.d.ts +0 -12
- package/dist/commands/run/secrets/list/index.js +0 -60
- package/dist/commands/run/secrets/set/index.d.ts +0 -16
- package/dist/commands/run/secrets/set/index.js +0 -74
- package/dist/commands/run/sessions/delete/index.d.ts +0 -14
- package/dist/commands/run/sessions/delete/index.js +0 -65
- package/dist/commands/run/sessions/get/index.js +0 -72
- package/dist/commands/run/sessions/list/index.d.ts +0 -13
- package/dist/commands/run/sessions/list/index.js +0 -64
- package/dist/commands/run/sessions/start/index.js +0 -56
- package/dist/commands/run/sessions/stop/index.d.ts +0 -14
- package/dist/commands/run/sessions/stop/index.js +0 -56
- package/dist/commands/run/sink/get/index.d.ts +0 -14
- package/dist/commands/run/sink/get/index.js +0 -63
- package/dist/lib/base-run-command.d.ts +0 -41
- package/dist/lib/base-run-command.js +0 -75
- package/dist/lib/run-http-client.d.ts +0 -64
- package/dist/lib/run-http-client.js +0 -171
- package/dist/lib/run-types.d.ts +0 -226
- package/dist/lib/run-types.js +0 -5
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
|
-
export default class RunSessionsGet extends BaseRunCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
sessionId: Args.string({
|
|
6
|
-
description: 'Session ID',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Get session details';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano run sessions get abc123-def456
|
|
13
|
-
Session Details:
|
|
14
|
-
ID: abc123-def456
|
|
15
|
-
Name: My Session
|
|
16
|
-
Status: running
|
|
17
|
-
Access: private
|
|
18
|
-
URL: https://session.xano.io/abc123
|
|
19
|
-
Uptime: 3600s
|
|
20
|
-
`,
|
|
21
|
-
`$ xano run sessions get abc123-def456 -o json
|
|
22
|
-
{ "id": "abc123-def456", "name": "My Session", "status": "running", ... }
|
|
23
|
-
`,
|
|
24
|
-
];
|
|
25
|
-
static flags = {
|
|
26
|
-
...BaseRunCommand.baseFlags,
|
|
27
|
-
output: Flags.string({
|
|
28
|
-
char: 'o',
|
|
29
|
-
default: 'summary',
|
|
30
|
-
description: 'Output format',
|
|
31
|
-
options: ['summary', 'json'],
|
|
32
|
-
required: false,
|
|
33
|
-
}),
|
|
34
|
-
};
|
|
35
|
-
async run() {
|
|
36
|
-
const { args, flags } = await this.parse(RunSessionsGet);
|
|
37
|
-
// Initialize (no project required for session details)
|
|
38
|
-
await this.initRunCommand(flags.profile, flags.verbose);
|
|
39
|
-
try {
|
|
40
|
-
const url = this.httpClient.buildSessionUrl(args.sessionId);
|
|
41
|
-
const session = await this.httpClient.get(url);
|
|
42
|
-
if (flags.output === 'json') {
|
|
43
|
-
this.outputJson(session);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.log('Session Details:');
|
|
47
|
-
this.log(` ID: ${session.id}`);
|
|
48
|
-
this.log(` Name: ${session.name}`);
|
|
49
|
-
this.log(` Status: ${session.status}`);
|
|
50
|
-
this.log(` Access: ${session.access}`);
|
|
51
|
-
if (session.url) {
|
|
52
|
-
this.log(` URL: ${session.url}`);
|
|
53
|
-
}
|
|
54
|
-
if (session.uptime !== null) {
|
|
55
|
-
this.log(` Uptime: ${session.uptime}s`);
|
|
56
|
-
}
|
|
57
|
-
this.log(` Created: ${session.createdAt}`);
|
|
58
|
-
if (session.projectId) {
|
|
59
|
-
this.log(` Project: ${session.projectId}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
if (error instanceof Error) {
|
|
65
|
-
this.error(`Failed to get session: ${error.message}`);
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
this.error(`Failed to get session: ${String(error)}`);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
2
|
-
export default class RunSessionsList extends BaseRunCommand {
|
|
3
|
-
static args: {};
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static flags: {
|
|
7
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
private outputTable;
|
|
13
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
|
-
export default class RunSessionsList extends BaseRunCommand {
|
|
4
|
-
static args = {};
|
|
5
|
-
static description = 'List all sessions for the project';
|
|
6
|
-
static examples = [
|
|
7
|
-
`$ xano run sessions list
|
|
8
|
-
ID STATE CREATED
|
|
9
|
-
abc123-def456-ghi789 running 2024-01-15T10:30:00Z
|
|
10
|
-
xyz789-uvw456-rst123 stopped 2024-01-14T09:00:00Z
|
|
11
|
-
`,
|
|
12
|
-
`$ xano run sessions list -o json
|
|
13
|
-
{ "items": [{ "id": "abc123-def456-ghi789", "state": "running", ... }] }
|
|
14
|
-
`,
|
|
15
|
-
];
|
|
16
|
-
static flags = {
|
|
17
|
-
...BaseRunCommand.baseFlags,
|
|
18
|
-
output: Flags.string({
|
|
19
|
-
char: 'o',
|
|
20
|
-
default: 'table',
|
|
21
|
-
description: 'Output format',
|
|
22
|
-
options: ['table', 'json'],
|
|
23
|
-
required: false,
|
|
24
|
-
}),
|
|
25
|
-
};
|
|
26
|
-
async run() {
|
|
27
|
-
const { flags } = await this.parse(RunSessionsList);
|
|
28
|
-
// Initialize with project required
|
|
29
|
-
await this.initRunCommandWithProject(flags.profile, flags.verbose);
|
|
30
|
-
try {
|
|
31
|
-
const url = this.httpClient.buildProjectUrl('/run/session');
|
|
32
|
-
const result = await this.httpClient.get(url);
|
|
33
|
-
if (flags.output === 'json') {
|
|
34
|
-
this.outputJson(result);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
this.outputTable(result.items);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (error instanceof Error) {
|
|
42
|
-
this.error(`Failed to list sessions: ${error.message}`);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
this.error(`Failed to list sessions: ${String(error)}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
outputTable(sessions) {
|
|
50
|
-
if (sessions.length === 0) {
|
|
51
|
-
this.log('No sessions found.');
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
// Print header
|
|
55
|
-
this.log('ID STATE CREATED');
|
|
56
|
-
this.log('-'.repeat(75));
|
|
57
|
-
for (const session of sessions) {
|
|
58
|
-
const id = session.id.padEnd(36);
|
|
59
|
-
const state = session.state.slice(0, 10).padEnd(10);
|
|
60
|
-
const created = session.created_at;
|
|
61
|
-
this.log(`${id} ${state} ${created}`);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
|
-
export default class RunSessionsStart extends BaseRunCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
sessionId: Args.string({
|
|
6
|
-
description: 'Session ID',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Start a session';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano run sessions start abc123-def456
|
|
13
|
-
Session started successfully!
|
|
14
|
-
ID: abc123-def456
|
|
15
|
-
State: running
|
|
16
|
-
`,
|
|
17
|
-
`$ xano run sessions start abc123-def456 -o json
|
|
18
|
-
{ "id": "abc123-def456", "state": "running", ... }
|
|
19
|
-
`,
|
|
20
|
-
];
|
|
21
|
-
static flags = {
|
|
22
|
-
...BaseRunCommand.baseFlags,
|
|
23
|
-
output: Flags.string({
|
|
24
|
-
char: 'o',
|
|
25
|
-
default: 'summary',
|
|
26
|
-
description: 'Output format',
|
|
27
|
-
options: ['summary', 'json'],
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
async run() {
|
|
32
|
-
const { args, flags } = await this.parse(RunSessionsStart);
|
|
33
|
-
// Initialize with project required
|
|
34
|
-
await this.initRunCommandWithProject(flags.profile, flags.verbose);
|
|
35
|
-
try {
|
|
36
|
-
const url = this.httpClient.buildProjectUrl(`/run/session/${args.sessionId}/start`);
|
|
37
|
-
const session = await this.httpClient.post(url, {});
|
|
38
|
-
if (flags.output === 'json') {
|
|
39
|
-
this.outputJson(session);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.log('Session started successfully!');
|
|
43
|
-
this.log(` ID: ${session.id}`);
|
|
44
|
-
this.log(` State: ${session.state}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
if (error instanceof Error) {
|
|
49
|
-
this.error(`Failed to start session: ${error.message}`);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.error(`Failed to start session: ${String(error)}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
2
|
-
export default class RunSessionsStop extends BaseRunCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
sessionId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
|
-
export default class RunSessionsStop extends BaseRunCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
sessionId: Args.string({
|
|
6
|
-
description: 'Session ID',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Stop a session';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano run sessions stop abc123-def456
|
|
13
|
-
Session stopped successfully!
|
|
14
|
-
ID: abc123-def456
|
|
15
|
-
State: stopped
|
|
16
|
-
`,
|
|
17
|
-
`$ xano run sessions stop abc123-def456 -o json
|
|
18
|
-
{ "id": "abc123-def456", "state": "stopped", ... }
|
|
19
|
-
`,
|
|
20
|
-
];
|
|
21
|
-
static flags = {
|
|
22
|
-
...BaseRunCommand.baseFlags,
|
|
23
|
-
output: Flags.string({
|
|
24
|
-
char: 'o',
|
|
25
|
-
default: 'summary',
|
|
26
|
-
description: 'Output format',
|
|
27
|
-
options: ['summary', 'json'],
|
|
28
|
-
required: false,
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
async run() {
|
|
32
|
-
const { args, flags } = await this.parse(RunSessionsStop);
|
|
33
|
-
// Initialize with project required
|
|
34
|
-
await this.initRunCommandWithProject(flags.profile, flags.verbose);
|
|
35
|
-
try {
|
|
36
|
-
const url = this.httpClient.buildProjectUrl(`/run/session/${args.sessionId}/stop`);
|
|
37
|
-
const session = await this.httpClient.post(url, {});
|
|
38
|
-
if (flags.output === 'json') {
|
|
39
|
-
this.outputJson(session);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
this.log('Session stopped successfully!');
|
|
43
|
-
this.log(` ID: ${session.id}`);
|
|
44
|
-
this.log(` State: ${session.state}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
if (error instanceof Error) {
|
|
49
|
-
this.error(`Failed to stop session: ${error.message}`);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
this.error(`Failed to stop session: ${String(error)}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
2
|
-
export default class RunSinkGet extends BaseRunCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
sessionId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
|
-
static description: string;
|
|
7
|
-
static examples: string[];
|
|
8
|
-
static flags: {
|
|
9
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
-
};
|
|
13
|
-
run(): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import BaseRunCommand from '../../../../lib/base-run-command.js';
|
|
3
|
-
export default class RunSinkGet extends BaseRunCommand {
|
|
4
|
-
static args = {
|
|
5
|
-
sessionId: Args.string({
|
|
6
|
-
description: 'Session ID',
|
|
7
|
-
required: true,
|
|
8
|
-
}),
|
|
9
|
-
};
|
|
10
|
-
static description = 'Get sink data for a completed session';
|
|
11
|
-
static examples = [
|
|
12
|
-
`$ xano run sink get abc123-def456
|
|
13
|
-
Sink Data:
|
|
14
|
-
Tables: 3
|
|
15
|
-
- users (5 rows)
|
|
16
|
-
- orders (12 rows)
|
|
17
|
-
- products (8 rows)
|
|
18
|
-
Logs: 15 entries
|
|
19
|
-
`,
|
|
20
|
-
`$ xano run sink get abc123-def456 -o json
|
|
21
|
-
{ "tables": [...], "logs": [...] }
|
|
22
|
-
`,
|
|
23
|
-
];
|
|
24
|
-
static flags = {
|
|
25
|
-
...BaseRunCommand.baseFlags,
|
|
26
|
-
output: Flags.string({
|
|
27
|
-
char: 'o',
|
|
28
|
-
default: 'summary',
|
|
29
|
-
description: 'Output format',
|
|
30
|
-
options: ['summary', 'json'],
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
};
|
|
34
|
-
async run() {
|
|
35
|
-
const { args, flags } = await this.parse(RunSinkGet);
|
|
36
|
-
// Initialize (no project required for sink data)
|
|
37
|
-
await this.initRunCommand(flags.profile, flags.verbose);
|
|
38
|
-
try {
|
|
39
|
-
const url = this.httpClient.buildSessionUrl(args.sessionId, '/sink');
|
|
40
|
-
const sinkData = await this.httpClient.get(url);
|
|
41
|
-
if (flags.output === 'json') {
|
|
42
|
-
this.outputJson(sinkData);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
this.log('Sink Data:');
|
|
46
|
-
this.log(` Tables: ${sinkData.tables.length}`);
|
|
47
|
-
for (const table of sinkData.tables) {
|
|
48
|
-
const rowCount = table.content?.length || 0;
|
|
49
|
-
this.log(` - ${table.name} (${rowCount} rows)`);
|
|
50
|
-
}
|
|
51
|
-
this.log(` Logs: ${sinkData.logs.length} entries`);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
if (error instanceof Error) {
|
|
56
|
-
this.error(`Failed to get sink data: ${error.message}`);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
this.error(`Failed to get sink data: ${String(error)}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base command for all run commands
|
|
3
|
-
*/
|
|
4
|
-
import BaseCommand from '../base-command.js';
|
|
5
|
-
import { RunHttpClient } from './run-http-client.js';
|
|
6
|
-
export interface ProfileConfig {
|
|
7
|
-
access_token: string;
|
|
8
|
-
account_origin?: string;
|
|
9
|
-
branch?: string;
|
|
10
|
-
instance_origin: string;
|
|
11
|
-
project?: string;
|
|
12
|
-
run_base_url?: string;
|
|
13
|
-
workspace?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface CredentialsFile {
|
|
16
|
-
default?: string;
|
|
17
|
-
profiles: {
|
|
18
|
-
[key: string]: ProfileConfig;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
export default abstract class BaseRunCommand extends BaseCommand {
|
|
22
|
-
protected httpClient: RunHttpClient;
|
|
23
|
-
protected profile: ProfileConfig;
|
|
24
|
-
protected profileName: string;
|
|
25
|
-
/**
|
|
26
|
-
* Initialize the run command with profile and HTTP client
|
|
27
|
-
*/
|
|
28
|
-
protected initRunCommand(profileFlag?: string, verbose?: boolean): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Initialize with project required
|
|
31
|
-
*/
|
|
32
|
-
protected initRunCommandWithProject(profileFlag?: string, verbose?: boolean): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Load credentials from file
|
|
35
|
-
*/
|
|
36
|
-
protected loadCredentials(): CredentialsFile;
|
|
37
|
-
/**
|
|
38
|
-
* Format a response for JSON output
|
|
39
|
-
*/
|
|
40
|
-
protected outputJson(data: unknown): void;
|
|
41
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base command for all run commands
|
|
3
|
-
*/
|
|
4
|
-
import * as yaml from 'js-yaml';
|
|
5
|
-
import * as fs from 'node:fs';
|
|
6
|
-
import * as os from 'node:os';
|
|
7
|
-
import * as path from 'node:path';
|
|
8
|
-
import BaseCommand from '../base-command.js';
|
|
9
|
-
import { DEFAULT_RUN_BASE_URL, RunHttpClient } from './run-http-client.js';
|
|
10
|
-
export default class BaseRunCommand extends BaseCommand {
|
|
11
|
-
httpClient;
|
|
12
|
-
profile;
|
|
13
|
-
profileName;
|
|
14
|
-
/**
|
|
15
|
-
* Initialize the run command with profile and HTTP client
|
|
16
|
-
*/
|
|
17
|
-
async initRunCommand(profileFlag, verbose) {
|
|
18
|
-
this.profileName = profileFlag || this.getDefaultProfile();
|
|
19
|
-
const credentials = this.loadCredentials();
|
|
20
|
-
if (!(this.profileName in credentials.profiles)) {
|
|
21
|
-
this.error(`Profile '${this.profileName}' not found. Available profiles: ${Object.keys(credentials.profiles).join(', ')}\n` +
|
|
22
|
-
`Create a profile using 'xano profile:create'`);
|
|
23
|
-
}
|
|
24
|
-
this.profile = credentials.profiles[this.profileName];
|
|
25
|
-
if (!this.profile.access_token) {
|
|
26
|
-
this.error(`Profile '${this.profileName}' is missing access_token`);
|
|
27
|
-
}
|
|
28
|
-
const baseUrl = this.profile.run_base_url || DEFAULT_RUN_BASE_URL;
|
|
29
|
-
this.httpClient = new RunHttpClient({
|
|
30
|
-
authToken: this.profile.access_token,
|
|
31
|
-
baseUrl,
|
|
32
|
-
logger: (msg) => this.log(msg),
|
|
33
|
-
projectId: this.profile.project,
|
|
34
|
-
verbose,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Initialize with project required
|
|
39
|
-
*/
|
|
40
|
-
async initRunCommandWithProject(profileFlag, verbose) {
|
|
41
|
-
await this.initRunCommand(profileFlag, verbose);
|
|
42
|
-
if (!this.profile.project) {
|
|
43
|
-
this.error(`Profile '${this.profileName}' is missing project. ` +
|
|
44
|
-
`Run 'xano profile:wizard' to set up your profile or use 'xano profile:edit --project <project-id>'`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Load credentials from file
|
|
49
|
-
*/
|
|
50
|
-
loadCredentials() {
|
|
51
|
-
const configDir = path.join(os.homedir(), '.xano');
|
|
52
|
-
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
53
|
-
if (!fs.existsSync(credentialsPath)) {
|
|
54
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
55
|
-
`Create a profile using 'xano profile:create'`);
|
|
56
|
-
}
|
|
57
|
-
try {
|
|
58
|
-
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
59
|
-
const parsed = yaml.load(fileContent);
|
|
60
|
-
if (!parsed || typeof parsed !== 'object' || !('profiles' in parsed)) {
|
|
61
|
-
this.error('Credentials file has invalid format.');
|
|
62
|
-
}
|
|
63
|
-
return parsed;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
this.error(`Failed to parse credentials file: ${error}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Format a response for JSON output
|
|
71
|
-
*/
|
|
72
|
-
outputJson(data) {
|
|
73
|
-
this.log(JSON.stringify(data, null, 2));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HTTP client for Xano Run API
|
|
3
|
-
* Based on @xano/run-sdk HttpClient
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_RUN_BASE_URL = "https://app.dev.xano.com/";
|
|
6
|
-
export interface RunHttpClientConfig {
|
|
7
|
-
authToken: string;
|
|
8
|
-
baseUrl: string;
|
|
9
|
-
logger?: (message: string) => void;
|
|
10
|
-
projectId?: string;
|
|
11
|
-
verbose?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class RunHttpClient {
|
|
14
|
-
private readonly config;
|
|
15
|
-
constructor(config: RunHttpClientConfig);
|
|
16
|
-
/**
|
|
17
|
-
* Build a URL scoped to the current project
|
|
18
|
-
*/
|
|
19
|
-
buildProjectUrl(path: string, queryParams?: Record<string, unknown>): string;
|
|
20
|
-
/**
|
|
21
|
-
* Build a URL scoped to a specific session
|
|
22
|
-
*/
|
|
23
|
-
buildSessionUrl(sessionId: string, path?: string, queryParams?: Record<string, unknown>): string;
|
|
24
|
-
/**
|
|
25
|
-
* Build a URL with optional query parameters
|
|
26
|
-
*/
|
|
27
|
-
buildUrl(path: string, queryParams?: Record<string, unknown>): string;
|
|
28
|
-
/**
|
|
29
|
-
* Make a DELETE request
|
|
30
|
-
*/
|
|
31
|
-
delete<T>(url: string, body?: unknown): Promise<T>;
|
|
32
|
-
/**
|
|
33
|
-
* Make a GET request
|
|
34
|
-
*/
|
|
35
|
-
get<T>(url: string): Promise<T>;
|
|
36
|
-
/**
|
|
37
|
-
* Build headers for a request
|
|
38
|
-
*/
|
|
39
|
-
getHeaders(contentType?: string): HeadersInit;
|
|
40
|
-
/**
|
|
41
|
-
* Get the project ID
|
|
42
|
-
*/
|
|
43
|
-
getProjectId(): string | undefined;
|
|
44
|
-
/**
|
|
45
|
-
* Make a PATCH request
|
|
46
|
-
*/
|
|
47
|
-
patch<T>(url: string, body: unknown): Promise<T>;
|
|
48
|
-
/**
|
|
49
|
-
* Make a POST request with JSON body
|
|
50
|
-
*/
|
|
51
|
-
post<T>(url: string, body?: unknown): Promise<T>;
|
|
52
|
-
/**
|
|
53
|
-
* Make a POST request with XanoScript body
|
|
54
|
-
*/
|
|
55
|
-
postXanoScript<T>(url: string, code: string): Promise<T>;
|
|
56
|
-
/**
|
|
57
|
-
* Make an HTTP request
|
|
58
|
-
*/
|
|
59
|
-
request<T>(url: string, options: RequestInit): Promise<T>;
|
|
60
|
-
/**
|
|
61
|
-
* Log a message if verbose mode is enabled
|
|
62
|
-
*/
|
|
63
|
-
private log;
|
|
64
|
-
}
|