@xano/cli 1.0.4-beta.3 → 1.0.4
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 +4 -51
- package/dist/base-command.d.ts +0 -27
- package/dist/base-command.js +1 -124
- package/dist/commands/auth/index.d.ts +1 -45
- package/dist/commands/auth/index.js +29 -197
- package/dist/commands/{tenant/snapshot/list → knowledge/pull}/index.d.ts +4 -6
- package/dist/commands/knowledge/pull/index.js +86 -0
- package/dist/commands/knowledge/push/index.d.ts +20 -0
- package/dist/commands/knowledge/push/index.js +126 -0
- package/dist/commands/static_host/build/create/index.d.ts +1 -9
- package/dist/commands/static_host/build/create/index.js +4 -54
- package/dist/commands/static_host/build/get/index.d.ts +1 -1
- package/dist/commands/static_host/build/get/index.js +10 -16
- package/dist/utils/knowledge-sync.d.ts +108 -0
- package/dist/utils/knowledge-sync.js +380 -0
- package/dist/utils/multidoc-push.js +17 -21
- package/dist/utils/reference-checker.js +2 -2
- package/oclif.manifest.json +2951 -4086
- package/package.json +1 -3
- package/dist/commands/static_host/build/delete/index.d.ts +0 -19
- package/dist/commands/static_host/build/delete/index.js +0 -114
- package/dist/commands/static_host/build/pull/index.d.ts +0 -52
- package/dist/commands/static_host/build/pull/index.js +0 -300
- package/dist/commands/static_host/build/push/index.d.ts +0 -23
- package/dist/commands/static_host/build/push/index.js +0 -225
- package/dist/commands/static_host/create/index.d.ts +0 -17
- package/dist/commands/static_host/create/index.js +0 -86
- package/dist/commands/static_host/deploy/index.d.ts +0 -18
- package/dist/commands/static_host/deploy/index.js +0 -105
- package/dist/commands/static_host/edit/index.d.ts +0 -23
- package/dist/commands/static_host/edit/index.js +0 -151
- package/dist/commands/static_host/get/index.d.ts +0 -18
- package/dist/commands/static_host/get/index.js +0 -94
- package/dist/commands/static_host/migrate/index.d.ts +0 -44
- package/dist/commands/static_host/migrate/index.js +0 -205
- package/dist/commands/tenant/snapshot/create/index.d.ts +0 -17
- package/dist/commands/tenant/snapshot/create/index.js +0 -78
- package/dist/commands/tenant/snapshot/delete/index.d.ts +0 -19
- package/dist/commands/tenant/snapshot/delete/index.js +0 -102
- package/dist/commands/tenant/snapshot/list/index.js +0 -96
- package/dist/commands/tenant/snapshot/swap/index.d.ts +0 -19
- package/dist/commands/tenant/snapshot/swap/index.js +0 -103
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import BaseCommand from '../../../../base-command.js';
|
|
2
|
-
export default class TenantSnapshotSwap 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
|
-
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
snapshot: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
};
|
|
17
|
-
run(): Promise<void>;
|
|
18
|
-
private confirm;
|
|
19
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import * as readline from 'node:readline';
|
|
3
|
-
import BaseCommand from '../../../../base-command.js';
|
|
4
|
-
export default class TenantSnapshotSwap extends BaseCommand {
|
|
5
|
-
static args = {
|
|
6
|
-
tenant_name: Args.string({
|
|
7
|
-
description: 'Tenant name to swap',
|
|
8
|
-
required: true,
|
|
9
|
-
}),
|
|
10
|
-
};
|
|
11
|
-
static description = "Swap a tenant's live database to a snapshot. This repoints the tenant; the current live database is left untouched, so you can swap back. To roll back, swap to the original database name.";
|
|
12
|
-
static examples = [
|
|
13
|
-
`$ xano tenant snapshot swap t1234-abcd-xyz1 --snapshot t1234-abcd-xyz1_bk_20260603_203614
|
|
14
|
-
Swapped tenant t1234-abcd-xyz1 from t1234-abcd-xyz1 to t1234-abcd-xyz1_bk_20260603_203614
|
|
15
|
-
`,
|
|
16
|
-
`$ xano tenant snapshot swap t1234-abcd-xyz1 --snapshot t1234-abcd-xyz1 --force`,
|
|
17
|
-
];
|
|
18
|
-
static flags = {
|
|
19
|
-
...BaseCommand.baseFlags,
|
|
20
|
-
force: Flags.boolean({
|
|
21
|
-
char: 'f',
|
|
22
|
-
default: false,
|
|
23
|
-
description: 'Skips the confirmation prompt.',
|
|
24
|
-
required: false,
|
|
25
|
-
}),
|
|
26
|
-
output: Flags.string({
|
|
27
|
-
char: 'o',
|
|
28
|
-
default: 'summary',
|
|
29
|
-
description: 'Output format',
|
|
30
|
-
options: ['summary', 'json'],
|
|
31
|
-
required: false,
|
|
32
|
-
}),
|
|
33
|
-
snapshot: Flags.string({
|
|
34
|
-
description: 'Snapshot database name to swap to (use the original tenant name to roll back)',
|
|
35
|
-
required: true,
|
|
36
|
-
}),
|
|
37
|
-
workspace: Flags.string({
|
|
38
|
-
char: 'w',
|
|
39
|
-
description: 'Workspace ID (uses profile workspace if not provided)',
|
|
40
|
-
required: false,
|
|
41
|
-
}),
|
|
42
|
-
};
|
|
43
|
-
async run() {
|
|
44
|
-
const { args, flags } = await this.parse(TenantSnapshotSwap);
|
|
45
|
-
const { profile } = this.resolveProfile(flags);
|
|
46
|
-
const workspaceId = flags.workspace || profile.workspace;
|
|
47
|
-
if (!workspaceId) {
|
|
48
|
-
this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
|
|
49
|
-
}
|
|
50
|
-
const tenantName = args.tenant_name;
|
|
51
|
-
const { snapshot } = flags;
|
|
52
|
-
if (!flags.force) {
|
|
53
|
-
const confirmed = await this.confirm(`Swap tenant ${tenantName} to "${snapshot}"? This repoints the tenant's live database.`);
|
|
54
|
-
if (!confirmed) {
|
|
55
|
-
this.log('Swap cancelled.');
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/snapshot/swap`;
|
|
60
|
-
try {
|
|
61
|
-
const response = await this.verboseFetch(apiUrl, {
|
|
62
|
-
body: JSON.stringify({ snapshot }),
|
|
63
|
-
headers: {
|
|
64
|
-
'accept': 'application/json',
|
|
65
|
-
'Authorization': `Bearer ${profile.access_token}`,
|
|
66
|
-
'Content-Type': 'application/json',
|
|
67
|
-
},
|
|
68
|
-
method: 'POST',
|
|
69
|
-
}, flags.verbose, profile.access_token);
|
|
70
|
-
if (!response.ok) {
|
|
71
|
-
const errorText = await response.text();
|
|
72
|
-
this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
|
|
73
|
-
}
|
|
74
|
-
const result = (await response.json());
|
|
75
|
-
if (flags.output === 'json') {
|
|
76
|
-
this.log(JSON.stringify(result, null, 2));
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
this.log(`Swapped tenant ${tenantName} from ${result.from ?? 'unknown'} to ${result.to ?? snapshot}`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
if (error instanceof Error) {
|
|
84
|
-
this.error(`Failed to swap snapshot: ${error.message}`);
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.error(`Failed to swap snapshot: ${String(error)}`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
async confirm(message) {
|
|
92
|
-
const rl = readline.createInterface({
|
|
93
|
-
input: process.stdin,
|
|
94
|
-
output: process.stdout,
|
|
95
|
-
});
|
|
96
|
-
return new Promise((resolve) => {
|
|
97
|
-
rl.question(`${message} (y/N) `, (answer) => {
|
|
98
|
-
rl.close();
|
|
99
|
-
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|