@xano/cli 1.0.6-beta.9 → 1.2.0

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.
Files changed (70) hide show
  1. package/README.md +46 -62
  2. package/dist/base-command.d.ts +0 -2
  3. package/dist/base-command.js +4 -10
  4. package/dist/commands/release/pull/index.d.ts +6 -0
  5. package/dist/commands/release/pull/index.js +95 -10
  6. package/dist/commands/sandbox/pull/index.d.ts +1 -0
  7. package/dist/commands/sandbox/pull/index.js +77 -10
  8. package/dist/commands/sandbox/unit_test/run/index.js +17 -11
  9. package/dist/commands/sandbox/unit_test/run_all/index.js +9 -1
  10. package/dist/commands/sandbox/workflow_test/run/index.js +12 -9
  11. package/dist/commands/sandbox/workflow_test/run_all/index.js +9 -1
  12. package/dist/commands/tenant/pull/index.d.ts +6 -0
  13. package/dist/commands/tenant/pull/index.js +95 -10
  14. package/dist/commands/tenant/unit_test/run/index.js +19 -11
  15. package/dist/commands/tenant/unit_test/run_all/index.js +13 -1
  16. package/dist/commands/tenant/workflow_test/run/index.js +14 -9
  17. package/dist/commands/tenant/workflow_test/run_all/index.js +13 -1
  18. package/dist/commands/unit_test/run/index.js +19 -11
  19. package/dist/commands/unit_test/run_all/index.js +13 -1
  20. package/dist/commands/workflow_test/run/index.js +15 -10
  21. package/dist/commands/workflow_test/run_all/index.js +15 -3
  22. package/dist/commands/workspace/git/pull/index.js +3 -53
  23. package/dist/commands/workspace/pull/index.d.ts +6 -0
  24. package/dist/commands/workspace/pull/index.js +95 -10
  25. package/dist/utils/document-parser.d.ts +0 -85
  26. package/dist/utils/document-parser.js +1 -214
  27. package/dist/utils/knowledge-sync.d.ts +0 -1
  28. package/dist/utils/knowledge-sync.js +5 -11
  29. package/dist/utils/paging.d.ts +1 -2
  30. package/dist/utils/reference-checker.js +0 -13
  31. package/oclif.manifest.json +2796 -4820
  32. package/package.json +1 -10
  33. package/dist/commands/ephemeral/create/index.d.ts +0 -18
  34. package/dist/commands/ephemeral/create/index.js +0 -103
  35. package/dist/commands/ephemeral/delete/index.d.ts +0 -18
  36. package/dist/commands/ephemeral/delete/index.js +0 -99
  37. package/dist/commands/ephemeral/edit/index.d.ts +0 -18
  38. package/dist/commands/ephemeral/edit/index.js +0 -109
  39. package/dist/commands/ephemeral/get/index.d.ts +0 -21
  40. package/dist/commands/ephemeral/get/index.js +0 -125
  41. package/dist/commands/ephemeral/impersonate/index.d.ts +0 -20
  42. package/dist/commands/ephemeral/impersonate/index.js +0 -120
  43. package/dist/commands/ephemeral/list/index.d.ts +0 -19
  44. package/dist/commands/ephemeral/list/index.js +0 -123
  45. package/dist/commands/ephemeral/pull/index.d.ts +0 -19
  46. package/dist/commands/ephemeral/pull/index.js +0 -164
  47. package/dist/commands/ephemeral/push/index.d.ts +0 -35
  48. package/dist/commands/ephemeral/push/index.js +0 -221
  49. package/dist/commands/ephemeral/static_host/build/delete/index.d.ts +0 -20
  50. package/dist/commands/ephemeral/static_host/build/delete/index.js +0 -121
  51. package/dist/commands/ephemeral/static_host/build/get/index.d.ts +0 -18
  52. package/dist/commands/ephemeral/static_host/build/get/index.js +0 -137
  53. package/dist/commands/ephemeral/static_host/build/list/index.d.ts +0 -18
  54. package/dist/commands/ephemeral/static_host/build/list/index.js +0 -137
  55. package/dist/commands/ephemeral/static_host/build/pull/index.d.ts +0 -53
  56. package/dist/commands/ephemeral/static_host/build/pull/index.js +0 -308
  57. package/dist/commands/ephemeral/static_host/build/push/index.d.ts +0 -24
  58. package/dist/commands/ephemeral/static_host/build/push/index.js +0 -250
  59. package/dist/commands/ephemeral/static_host/create/index.d.ts +0 -18
  60. package/dist/commands/ephemeral/static_host/create/index.js +0 -92
  61. package/dist/commands/ephemeral/static_host/deploy/index.d.ts +0 -19
  62. package/dist/commands/ephemeral/static_host/deploy/index.js +0 -112
  63. package/dist/commands/ephemeral/static_host/edit/index.d.ts +0 -24
  64. package/dist/commands/ephemeral/static_host/edit/index.js +0 -158
  65. package/dist/commands/ephemeral/static_host/get/index.d.ts +0 -19
  66. package/dist/commands/ephemeral/static_host/get/index.js +0 -101
  67. package/dist/commands/ephemeral/static_host/list/index.d.ts +0 -17
  68. package/dist/commands/ephemeral/static_host/list/index.js +0 -132
  69. package/dist/utils/microservice-wait.d.ts +0 -53
  70. package/dist/utils/microservice-wait.js +0 -83
@@ -1,92 +0,0 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import BaseCommand from '../../../../base-command.js';
3
- export default class EphemeralStaticHostCreate extends BaseCommand {
4
- static args = {
5
- tenant_name: Args.string({
6
- description: 'Ephemeral tenant name',
7
- required: true,
8
- }),
9
- };
10
- static description = 'Create a new static host for an ephemeral tenant';
11
- static examples = [
12
- `$ xano ephemeral static_host create e4f2-9ab1-xyz1 --name marketing
13
- Created static host 'marketing' (ID: 7)
14
- `,
15
- `$ xano ephemeral static_host create e4f2-9ab1-xyz1 -n marketing --description "Marketing site" -w 40
16
- Created static host 'marketing' (ID: 7)
17
- `,
18
- `$ xano ephemeral static_host create e4f2-9ab1-xyz1 -n marketing -o json`,
19
- ];
20
- static flags = {
21
- ...BaseCommand.baseFlags,
22
- description: Flags.string({
23
- description: 'Description for the static host',
24
- required: false,
25
- }),
26
- name: Flags.string({
27
- char: 'n',
28
- description: 'Name for the new static host',
29
- required: true,
30
- }),
31
- output: Flags.string({
32
- char: 'o',
33
- default: 'summary',
34
- description: 'Output format',
35
- options: ['summary', 'json'],
36
- required: false,
37
- }),
38
- workspace: Flags.string({
39
- char: 'w',
40
- description: 'Workspace ID (optional if set in profile)',
41
- required: false,
42
- }),
43
- };
44
- async run() {
45
- const { args, flags } = await this.parse(EphemeralStaticHostCreate);
46
- const { profile, profileName } = this.resolveProfile(flags);
47
- const tenantName = args.tenant_name;
48
- let workspaceId;
49
- if (flags.workspace) {
50
- workspaceId = flags.workspace;
51
- }
52
- else if (profile.workspace) {
53
- workspaceId = profile.workspace;
54
- }
55
- else {
56
- this.error(`Workspace ID is required. Either:\n` +
57
- ` 1. Provide it as a flag: xano ephemeral static_host create <tenant_name> --name <name> -w <workspace_id>\n` +
58
- ` 2. Set it in your profile using: xano profile edit ${profileName} -w <workspace_id>`);
59
- }
60
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/static_host`;
61
- try {
62
- const response = await this.verboseFetch(apiUrl, {
63
- body: JSON.stringify({ description: flags.description ?? '', name: flags.name }),
64
- headers: {
65
- accept: 'application/json',
66
- Authorization: `Bearer ${profile.access_token}`,
67
- 'Content-Type': 'application/json',
68
- },
69
- method: 'POST',
70
- }, flags.verbose, profile.access_token);
71
- if (!response.ok) {
72
- const message = await this.parseApiError(response, `Failed to create static host '${flags.name}'`);
73
- this.error(message);
74
- }
75
- const host = (await response.json());
76
- if (flags.output === 'json') {
77
- this.log(JSON.stringify(host, null, 2));
78
- }
79
- else {
80
- this.log(`Created static host '${host.name}' (ID: ${host.id})`);
81
- }
82
- }
83
- catch (error) {
84
- if (error instanceof Error) {
85
- this.error(`Failed to create static host: ${error.message}`);
86
- }
87
- else {
88
- this.error(`Failed to create static host: ${String(error)}`);
89
- }
90
- }
91
- }
92
- }
@@ -1,19 +0,0 @@
1
- import BaseCommand from '../../../../base-command.js';
2
- export default class EphemeralStaticHostDeploy extends BaseCommand {
3
- static args: {
4
- tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
- static description: string;
7
- static examples: string[];
8
- static flags: {
9
- build_id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
- env: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
- output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
- 'static-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
- workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
- profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
- verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
- };
18
- run(): Promise<void>;
19
- }
@@ -1,112 +0,0 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import BaseCommand from '../../../../base-command.js';
3
- export default class EphemeralStaticHostDeploy extends BaseCommand {
4
- static args = {
5
- tenant_name: Args.string({
6
- description: 'Ephemeral tenant name',
7
- required: true,
8
- }),
9
- };
10
- static description = 'Deploy a static host build to an environment for an ephemeral tenant';
11
- static examples = [
12
- `$ xano ephemeral static_host deploy e4f2-9ab1-xyz1 --static-host default --build_id 52 --env dev
13
- Deployed build 52 to dev
14
- URL: https://x1234-abcd.static.xano.io
15
- `,
16
- `$ xano ephemeral static_host deploy e4f2-9ab1-xyz1 -H default --build_id 52 --env prod
17
- Deployed build 52 to prod
18
- URL: https://x1234-abcd.static.xano.io
19
- `,
20
- `$ xano ephemeral static_host deploy e4f2-9ab1-xyz1 -H myhost --build_id 123 --env dev -w 40
21
- Deployed build 123 to dev
22
- `,
23
- `$ xano ephemeral static_host deploy e4f2-9ab1-xyz1 -H default --build_id 52 --env prod -o json`,
24
- ];
25
- static flags = {
26
- ...BaseCommand.baseFlags,
27
- build_id: Flags.string({
28
- description: 'Build ID to deploy',
29
- required: true,
30
- }),
31
- env: Flags.string({
32
- description: 'Target environment',
33
- options: ['dev', 'prod'],
34
- required: true,
35
- }),
36
- output: Flags.string({
37
- char: 'o',
38
- default: 'summary',
39
- description: 'Output format',
40
- options: ['summary', 'json'],
41
- required: false,
42
- }),
43
- 'static-host': Flags.string({
44
- char: 'H',
45
- description: 'Static host name',
46
- required: true,
47
- }),
48
- workspace: Flags.string({
49
- char: 'w',
50
- description: 'Workspace ID (optional if set in profile)',
51
- required: false,
52
- }),
53
- };
54
- async run() {
55
- const { args, flags } = await this.parse(EphemeralStaticHostDeploy);
56
- const { profile, profileName } = this.resolveProfile(flags);
57
- const tenantName = args.tenant_name;
58
- const staticHost = flags['static-host'];
59
- let workspaceId;
60
- if (flags.workspace) {
61
- workspaceId = flags.workspace;
62
- }
63
- else if (profile.workspace) {
64
- workspaceId = profile.workspace;
65
- }
66
- else {
67
- this.error(`Workspace ID is required. Either:\n` +
68
- ` 1. Provide it as a flag: xano ephemeral static_host deploy <tenant_name> --static-host <static_host> --build_id <id> --env <env> -w <workspace_id>\n` +
69
- ` 2. Set it in your profile using: xano profile edit ${profileName} -w <workspace_id>`);
70
- }
71
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/static_host/${staticHost}/build/${flags.build_id}/env`;
72
- try {
73
- const response = await this.verboseFetch(apiUrl, {
74
- body: JSON.stringify({ env: flags.env }),
75
- headers: {
76
- 'accept': 'application/json',
77
- 'Authorization': `Bearer ${profile.access_token}`,
78
- 'Content-Type': 'application/json',
79
- },
80
- method: 'POST',
81
- }, flags.verbose, profile.access_token);
82
- if (!response.ok) {
83
- const errorText = await response.text();
84
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
85
- }
86
- const result = await response.json();
87
- if (!result || typeof result !== 'object') {
88
- this.error('Unexpected API response format');
89
- }
90
- if (flags.output === 'json') {
91
- this.log(JSON.stringify(result, null, 2));
92
- }
93
- else {
94
- this.log(`Deployed build ${flags.build_id} to ${flags.env}`);
95
- if (result.default_url) {
96
- this.log(`URL: ${result.default_url}`);
97
- }
98
- if (result.custom_url) {
99
- this.log(`Custom URL: ${result.custom_url}`);
100
- }
101
- }
102
- }
103
- catch (error) {
104
- if (error instanceof Error) {
105
- this.error(`Failed to deploy build: ${error.message}`);
106
- }
107
- else {
108
- this.error(`Failed to deploy build: ${String(error)}`);
109
- }
110
- }
111
- }
112
- }
@@ -1,24 +0,0 @@
1
- import BaseCommand from '../../../../base-command.js';
2
- export default class EphemeralStaticHostEdit extends BaseCommand {
3
- static args: {
4
- tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
- static description: string;
7
- static examples: string[];
8
- static flags: {
9
- description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
- 'git-private-key-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
- 'git-public-key': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
- 'git-repo': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
- name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
- 'static-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
- workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
- config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
- profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
- verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
20
- };
21
- run(): Promise<void>;
22
- /** Fetch the current host record so unspecified fields are preserved on edit. */
23
- private fetchHost;
24
- }
@@ -1,158 +0,0 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import BaseCommand from '../../../../base-command.js';
5
- export default class EphemeralStaticHostEdit extends BaseCommand {
6
- static args = {
7
- tenant_name: Args.string({
8
- description: 'Ephemeral tenant name',
9
- required: true,
10
- }),
11
- };
12
- static description = 'Update a static host\'s name, description, or git configuration for an ephemeral tenant';
13
- static examples = [
14
- `$ xano ephemeral static_host edit e4f2-9ab1-xyz1 --static-host newsite --description "Marketing site"
15
- Updated static host 'newsite'
16
- `,
17
- `$ xano ephemeral static_host edit e4f2-9ab1-xyz1 -H newsite --name newsite-v2
18
- Updated static host 'newsite' (renamed to 'newsite-v2')
19
- `,
20
- `$ xano ephemeral static_host edit e4f2-9ab1-xyz1 -H newsite --git-repo git@github.com:me/site.git --git-private-key-file ./deploy_key
21
- Updated static host 'newsite'
22
- `,
23
- ];
24
- static flags = {
25
- ...BaseCommand.baseFlags,
26
- description: Flags.string({
27
- description: 'New description for the static host',
28
- required: false,
29
- }),
30
- 'git-private-key-file': Flags.string({
31
- description: 'Path to a file containing the git SSH private key (read from disk; never passed on the command line)',
32
- required: false,
33
- }),
34
- 'git-public-key': Flags.string({
35
- description: 'Git SSH public key',
36
- required: false,
37
- }),
38
- 'git-repo': Flags.string({
39
- description: 'Git repository URL (e.g. git@github.com:org/repo.git)',
40
- required: false,
41
- }),
42
- name: Flags.string({
43
- description: 'New name for the static host (renaming changes the deployed hostname)',
44
- required: false,
45
- }),
46
- output: Flags.string({
47
- char: 'o',
48
- default: 'summary',
49
- description: 'Output format',
50
- options: ['summary', 'json'],
51
- required: false,
52
- }),
53
- 'static-host': Flags.string({
54
- char: 'H',
55
- description: 'Static host name to edit',
56
- required: true,
57
- }),
58
- workspace: Flags.string({
59
- char: 'w',
60
- description: 'Workspace ID (optional if set in profile)',
61
- required: false,
62
- }),
63
- };
64
- async run() {
65
- const { args, flags } = await this.parse(EphemeralStaticHostEdit);
66
- const hasGitFlag = Boolean(flags['git-repo'] || flags['git-private-key-file'] || flags['git-public-key']);
67
- if (!flags.name && flags.description === undefined && !hasGitFlag) {
68
- this.error('Nothing to update. Provide at least one of --name, --description, or a --git-* flag.');
69
- }
70
- const { profile, profileName } = this.resolveProfile(flags);
71
- const tenantName = args.tenant_name;
72
- const staticHost = flags['static-host'];
73
- let workspaceId;
74
- if (flags.workspace) {
75
- workspaceId = flags.workspace;
76
- }
77
- else if (profile.workspace) {
78
- workspaceId = profile.workspace;
79
- }
80
- else {
81
- this.error(`Workspace ID is required. Either:\n` +
82
- ` 1. Provide it as a flag: xano ephemeral static_host edit <tenant_name> --static-host <static_host> --name <name> -w <workspace_id>\n` +
83
- ` 2. Set it in your profile using: xano profile edit ${profileName} -w <workspace_id>`);
84
- }
85
- // The edit endpoint requires `name`, and merges git as a whole object —
86
- // so fetch the current record first and only override the fields the user set.
87
- const current = await this.fetchHost(profile, workspaceId, tenantName, staticHost, flags.verbose);
88
- const git = { ...current.git };
89
- if (flags['git-repo'] !== undefined)
90
- git.repo = flags['git-repo'];
91
- if (flags['git-public-key'] !== undefined)
92
- git.public_key = flags['git-public-key'];
93
- if (flags['git-private-key-file'] !== undefined) {
94
- const keyPath = path.resolve(flags['git-private-key-file']);
95
- if (!fs.existsSync(keyPath)) {
96
- this.error(`Private key file not found: ${keyPath}`);
97
- }
98
- git.private_key = fs.readFileSync(keyPath, 'utf8').trim();
99
- }
100
- const body = {
101
- description: flags.description ?? current.description ?? '',
102
- git: {
103
- private_key: git.private_key ?? '',
104
- public_key: git.public_key ?? '',
105
- repo: git.repo ?? '',
106
- },
107
- name: flags.name ?? current.name,
108
- };
109
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/static_host/${staticHost}/edit`;
110
- try {
111
- const response = await this.verboseFetch(apiUrl, {
112
- body: JSON.stringify(body),
113
- headers: {
114
- accept: 'application/json',
115
- Authorization: `Bearer ${profile.access_token}`,
116
- 'Content-Type': 'application/json',
117
- },
118
- method: 'POST',
119
- }, flags.verbose, profile.access_token);
120
- if (!response.ok) {
121
- const message = await this.parseApiError(response, `Failed to update static host '${staticHost}'`);
122
- this.error(message);
123
- }
124
- const updated = (await response.json());
125
- if (flags.output === 'json') {
126
- this.log(JSON.stringify(updated, null, 2));
127
- }
128
- else {
129
- const renamed = flags.name && flags.name !== staticHost ? ` (renamed to '${flags.name}')` : '';
130
- this.log(`Updated static host '${staticHost}'${renamed}`);
131
- }
132
- }
133
- catch (error) {
134
- if (error instanceof Error) {
135
- this.error(`Failed to update static host: ${error.message}`);
136
- }
137
- else {
138
- this.error(`Failed to update static host: ${String(error)}`);
139
- }
140
- }
141
- }
142
- /** Fetch the current host record so unspecified fields are preserved on edit. */
143
- async fetchHost(profile, workspaceId, tenantName, staticHost, verbose) {
144
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/static_host/${staticHost}`;
145
- const response = await this.verboseFetch(apiUrl, {
146
- headers: {
147
- accept: 'application/json',
148
- Authorization: `Bearer ${profile.access_token}`,
149
- },
150
- method: 'GET',
151
- }, verbose, profile.access_token);
152
- if (!response.ok) {
153
- const message = await this.parseApiError(response, `Static host '${staticHost}' not found`);
154
- this.error(message);
155
- }
156
- return (await response.json());
157
- }
158
- }
@@ -1,19 +0,0 @@
1
- import BaseCommand from '../../../../base-command.js';
2
- export default class EphemeralStaticHostGet extends BaseCommand {
3
- static args: {
4
- tenant_name: 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
- 'static-host': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
- workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
- config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
- profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
- };
16
- run(): Promise<void>;
17
- /** Print a one-line summary for a dev/prod env if it has been deployed. */
18
- private logEnv;
19
- }
@@ -1,101 +0,0 @@
1
- import { Args, Flags } from '@oclif/core';
2
- import BaseCommand from '../../../../base-command.js';
3
- export default class EphemeralStaticHostGet extends BaseCommand {
4
- static args = {
5
- tenant_name: Args.string({
6
- description: 'Ephemeral tenant name',
7
- required: true,
8
- }),
9
- };
10
- static description = 'Get a single static host\'s details (name, git config, dev/prod environments) for an ephemeral tenant';
11
- static examples = [
12
- `$ xano ephemeral static_host get e4f2-9ab1-xyz1 --static-host newsite
13
- Static Host: newsite
14
- ID: 5
15
- Dev: https://newsite-dev-....dev.xano.io (v2)
16
- `,
17
- `$ xano ephemeral static_host get e4f2-9ab1-xyz1 -H newsite -w 40 -o json`,
18
- ];
19
- static flags = {
20
- ...BaseCommand.baseFlags,
21
- output: Flags.string({
22
- char: 'o',
23
- default: 'summary',
24
- description: 'Output format',
25
- options: ['summary', 'json'],
26
- required: false,
27
- }),
28
- 'static-host': Flags.string({
29
- char: 'H',
30
- description: 'Static host name',
31
- required: true,
32
- }),
33
- workspace: Flags.string({
34
- char: 'w',
35
- description: 'Workspace ID (optional if set in profile)',
36
- required: false,
37
- }),
38
- };
39
- async run() {
40
- const { args, flags } = await this.parse(EphemeralStaticHostGet);
41
- const { profile, profileName } = this.resolveProfile(flags);
42
- const tenantName = args.tenant_name;
43
- let workspaceId;
44
- if (flags.workspace) {
45
- workspaceId = flags.workspace;
46
- }
47
- else if (profile.workspace) {
48
- workspaceId = profile.workspace;
49
- }
50
- else {
51
- this.error(`Workspace ID is required. Either:\n` +
52
- ` 1. Provide it as a flag: xano ephemeral static_host get <tenant_name> --static-host <static_host> -w <workspace_id>\n` +
53
- ` 2. Set it in your profile using: xano profile edit ${profileName} -w <workspace_id>`);
54
- }
55
- const staticHost = flags['static-host'];
56
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/static_host/${staticHost}`;
57
- try {
58
- const response = await this.verboseFetch(apiUrl, {
59
- headers: {
60
- accept: 'application/json',
61
- Authorization: `Bearer ${profile.access_token}`,
62
- },
63
- method: 'GET',
64
- }, flags.verbose, profile.access_token);
65
- if (!response.ok) {
66
- const message = await this.parseApiError(response, `Failed to get static host '${staticHost}'`);
67
- this.error(message);
68
- }
69
- const host = (await response.json());
70
- if (flags.output === 'json') {
71
- this.log(JSON.stringify(host, null, 2));
72
- }
73
- else {
74
- this.log(`Static Host: ${host.name}`);
75
- this.log(`ID: ${host.id}`);
76
- if (host.description)
77
- this.log(`Description: ${host.description}`);
78
- if (host.git?.repo)
79
- this.log(`Git: ${host.git.repo}`);
80
- this.logEnv('Dev', host.dev);
81
- this.logEnv('Prod', host.prod);
82
- }
83
- }
84
- catch (error) {
85
- if (error instanceof Error) {
86
- this.error(`Failed to get static host: ${error.message}`);
87
- }
88
- else {
89
- this.error(`Failed to get static host: ${String(error)}`);
90
- }
91
- }
92
- }
93
- /** Print a one-line summary for a dev/prod env if it has been deployed. */
94
- logEnv(label, env) {
95
- if (!env?.default_url)
96
- return;
97
- const modeInfo = env.mode ? ` (${env.mode})` : '';
98
- const custom = env.custom_url ? ` [custom: ${env.custom_url}]` : '';
99
- this.log(`${label}: ${env.default_url}${modeInfo}${custom}`);
100
- }
101
- }
@@ -1,17 +0,0 @@
1
- import BaseCommand from '../../../../base-command.js';
2
- export default class EphemeralStaticHostList extends BaseCommand {
3
- static args: {
4
- tenant_name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
- };
6
- static description: string;
7
- static examples: string[];
8
- static flags: {
9
- workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
- page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
- output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
- config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
- profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
- verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
- };
16
- run(): Promise<void>;
17
- }