@xano/cli 0.0.95-beta.23 → 0.0.95-beta.24
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/dist/commands/release/pull/index.d.ts +1 -3
- package/dist/commands/release/pull/index.js +18 -15
- package/dist/commands/release/push/index.d.ts +1 -3
- package/dist/commands/release/push/index.js +18 -19
- package/dist/commands/sandbox/pull/index.d.ts +1 -3
- package/dist/commands/sandbox/pull/index.js +15 -12
- package/dist/commands/sandbox/push/index.d.ts +11 -6
- package/dist/commands/sandbox/push/index.js +147 -136
- package/dist/commands/tenant/pull/index.d.ts +1 -3
- package/dist/commands/tenant/pull/index.js +19 -18
- package/dist/commands/workspace/git/pull/index.d.ts +1 -3
- package/dist/commands/workspace/git/pull/index.js +18 -17
- package/dist/commands/workspace/pull/index.d.ts +1 -3
- package/dist/commands/workspace/pull/index.js +20 -21
- package/dist/commands/workspace/push/index.d.ts +6 -18
- package/dist/commands/workspace/push/index.js +83 -747
- package/dist/utils/multidoc-push.d.ts +59 -0
- package/dist/utils/multidoc-push.js +664 -0
- package/oclif.manifest.json +2675 -2569
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
@@ -6,29 +6,30 @@ import snakeCase from 'lodash.snakecase';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
import { buildApiGroupFolderResolver, parseDocument } from '../../../utils/document-parser.js';
|
|
8
8
|
export default class Pull extends BaseCommand {
|
|
9
|
-
static args = {
|
|
10
|
-
directory: Args.string({
|
|
11
|
-
description: 'Output directory for pulled documents',
|
|
12
|
-
required: true,
|
|
13
|
-
}),
|
|
14
|
-
};
|
|
15
9
|
static description = 'Pull a tenant multidoc from the Xano Metadata API and split into individual files';
|
|
16
10
|
static examples = [
|
|
17
|
-
`$ xano tenant pull
|
|
11
|
+
`$ xano tenant pull -t my-tenant
|
|
12
|
+
Pulled 42 documents from tenant my-tenant to current directory
|
|
13
|
+
`,
|
|
14
|
+
`$ xano tenant pull -d ./my-tenant -t my-tenant
|
|
18
15
|
Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
19
16
|
`,
|
|
20
|
-
`$ xano tenant pull ./output -t my-tenant -w 40
|
|
17
|
+
`$ xano tenant pull -d ./output -t my-tenant -w 40
|
|
21
18
|
Pulled 15 documents from tenant my-tenant to ./output
|
|
22
19
|
`,
|
|
23
|
-
`$ xano tenant pull
|
|
24
|
-
Pulled 58 documents from tenant my-tenant
|
|
25
|
-
`,
|
|
26
|
-
`$ xano tenant pull ./my-tenant -t my-tenant --draft
|
|
27
|
-
Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
20
|
+
`$ xano tenant pull -t my-tenant --profile production --env --records
|
|
21
|
+
Pulled 58 documents from tenant my-tenant
|
|
28
22
|
`,
|
|
23
|
+
`$ xano tenant pull -t my-tenant --draft`,
|
|
29
24
|
];
|
|
30
25
|
static flags = {
|
|
31
26
|
...BaseCommand.baseFlags,
|
|
27
|
+
directory: Flags.string({
|
|
28
|
+
char: 'd',
|
|
29
|
+
default: '.',
|
|
30
|
+
description: 'Output directory for pulled documents (defaults to current directory)',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
32
33
|
draft: Flags.boolean({
|
|
33
34
|
default: false,
|
|
34
35
|
description: 'Include draft versions',
|
|
@@ -56,7 +57,7 @@ Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
|
56
57
|
}),
|
|
57
58
|
};
|
|
58
59
|
async run() {
|
|
59
|
-
const {
|
|
60
|
+
const { flags } = await this.parse(Pull);
|
|
60
61
|
// Get profile name (default or from flag/env)
|
|
61
62
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
62
63
|
// Load credentials
|
|
@@ -84,7 +85,7 @@ Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
|
84
85
|
}
|
|
85
86
|
else {
|
|
86
87
|
this.error(`Workspace ID is required. Either:\n` +
|
|
87
|
-
` 1. Provide it as a flag: xano tenant pull
|
|
88
|
+
` 1. Provide it as a flag: xano tenant pull -t <tenant_name> -w <workspace_id>\n` +
|
|
88
89
|
` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
|
|
89
90
|
}
|
|
90
91
|
const tenantName = flags.tenant;
|
|
@@ -140,7 +141,7 @@ Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
142
143
|
// Resolve the output directory
|
|
143
|
-
const outputDir = path.resolve(
|
|
144
|
+
const outputDir = path.resolve(flags.directory);
|
|
144
145
|
// Create the output directory if it doesn't exist
|
|
145
146
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
146
147
|
// Resolve api_group names to unique folder names, disambiguating collisions
|
|
@@ -246,7 +247,7 @@ Pulled 42 documents from tenant my-tenant to ./my-tenant
|
|
|
246
247
|
fs.writeFileSync(filePath, doc.content, 'utf8');
|
|
247
248
|
writtenCount++;
|
|
248
249
|
}
|
|
249
|
-
this.log(`Pulled ${writtenCount} documents from tenant ${tenantName} to ${
|
|
250
|
+
this.log(`Pulled ${writtenCount} documents from tenant ${tenantName} to ${flags.directory}`);
|
|
250
251
|
}
|
|
251
252
|
loadCredentials() {
|
|
252
253
|
const credentialsPath = this.getCredentialsPath();
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../../base-command.js';
|
|
2
2
|
export default class GitPull extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
9
6
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
8
|
path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
9
|
repo: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
10
|
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import { execSync } from 'node:child_process';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as os from 'node:os';
|
|
@@ -7,21 +7,16 @@ import snakeCase from 'lodash.snakecase';
|
|
|
7
7
|
import BaseCommand, { buildUserAgent } from '../../../../base-command.js';
|
|
8
8
|
import { buildApiGroupFolderResolver, parseDocument } from '../../../../utils/document-parser.js';
|
|
9
9
|
export default class GitPull extends BaseCommand {
|
|
10
|
-
static args = {
|
|
11
|
-
directory: Args.string({
|
|
12
|
-
description: 'Output directory for imported files',
|
|
13
|
-
required: true,
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
10
|
static description = 'Pull XanoScript files from a git repository into a local directory';
|
|
17
11
|
static examples = [
|
|
18
|
-
`$ xano workspace git pull
|
|
19
|
-
`$ xano workspace git pull ./output -r https://github.com/owner/repo
|
|
20
|
-
`$ xano workspace git pull
|
|
21
|
-
`$ xano workspace git pull
|
|
22
|
-
`$ xano workspace git pull
|
|
23
|
-
`$ xano workspace git pull
|
|
24
|
-
`$ xano workspace git pull
|
|
12
|
+
`$ xano workspace git pull -r https://github.com/owner/repo`,
|
|
13
|
+
`$ xano workspace git pull -d ./output -r https://github.com/owner/repo`,
|
|
14
|
+
`$ xano workspace git pull -r https://github.com/owner/repo/tree/main/path/to/dir`,
|
|
15
|
+
`$ xano workspace git pull -r https://github.com/owner/repo/blob/main/path/to/file.xs`,
|
|
16
|
+
`$ xano workspace git pull -r git@github.com:owner/repo.git`,
|
|
17
|
+
`$ xano workspace git pull -r https://github.com/owner/private-repo -t ghp_xxx`,
|
|
18
|
+
`$ xano workspace git pull -r https://gitlab.com/owner/repo/-/tree/master/path`,
|
|
19
|
+
`$ xano workspace git pull -r https://gitlab.com/owner/repo -b main`,
|
|
25
20
|
];
|
|
26
21
|
static flags = {
|
|
27
22
|
...BaseCommand.baseFlags,
|
|
@@ -30,6 +25,12 @@ export default class GitPull extends BaseCommand {
|
|
|
30
25
|
description: 'Branch, tag, or ref to fetch (defaults to repository default branch)',
|
|
31
26
|
required: false,
|
|
32
27
|
}),
|
|
28
|
+
directory: Flags.string({
|
|
29
|
+
char: 'd',
|
|
30
|
+
default: '.',
|
|
31
|
+
description: 'Output directory for imported files (defaults to current directory)',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
33
34
|
path: Flags.string({
|
|
34
35
|
description: 'Subdirectory within the repo to import from',
|
|
35
36
|
required: false,
|
|
@@ -47,9 +48,9 @@ export default class GitPull extends BaseCommand {
|
|
|
47
48
|
}),
|
|
48
49
|
};
|
|
49
50
|
async run() {
|
|
50
|
-
const {
|
|
51
|
+
const { flags } = await this.parse(GitPull);
|
|
51
52
|
const token = flags.token || '';
|
|
52
|
-
const outputDir = path.resolve(
|
|
53
|
+
const outputDir = path.resolve(flags.directory);
|
|
53
54
|
// Normalize the URL to extract owner/repo/ref/path from various formats
|
|
54
55
|
const repoInfo = this.parseRepoUrl(flags.repo);
|
|
55
56
|
// CLI flags override values extracted from the URL
|
|
@@ -115,7 +116,7 @@ export default class GitPull extends BaseCommand {
|
|
|
115
116
|
writtenCount++;
|
|
116
117
|
}
|
|
117
118
|
const source = subPath ? `${flags.repo} (${subPath})` : flags.repo;
|
|
118
|
-
this.log(`Pulled ${writtenCount} documents from ${source} to ${
|
|
119
|
+
this.log(`Pulled ${writtenCount} documents from ${source} to ${flags.directory}`);
|
|
119
120
|
}
|
|
120
121
|
finally {
|
|
121
122
|
// Clean up temp directory
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class Pull extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
9
6
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
8
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
9
|
draft: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
10
|
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
2
|
import * as yaml from 'js-yaml';
|
|
3
3
|
import * as fs from 'node:fs';
|
|
4
4
|
import * as path from 'node:path';
|
|
@@ -6,29 +6,22 @@ import snakeCase from 'lodash.snakecase';
|
|
|
6
6
|
import BaseCommand from '../../../base-command.js';
|
|
7
7
|
import { buildApiGroupFolderResolver, parseDocument } from '../../../utils/document-parser.js';
|
|
8
8
|
export default class Pull extends BaseCommand {
|
|
9
|
-
static args = {
|
|
10
|
-
directory: Args.string({
|
|
11
|
-
description: 'Output directory for pulled documents',
|
|
12
|
-
required: true,
|
|
13
|
-
}),
|
|
14
|
-
};
|
|
15
9
|
static description = 'Pull a workspace multidoc from the Xano Metadata API and split into individual files';
|
|
16
10
|
static examples = [
|
|
17
|
-
`$ xano workspace pull
|
|
11
|
+
`$ xano workspace pull
|
|
12
|
+
Pulled 42 documents to current directory
|
|
13
|
+
`,
|
|
14
|
+
`$ xano workspace pull -d ./my-workspace
|
|
18
15
|
Pulled 42 documents to ./my-workspace
|
|
19
16
|
`,
|
|
20
|
-
`$ xano workspace pull ./output -w 40
|
|
17
|
+
`$ xano workspace pull -d ./output -w 40
|
|
21
18
|
Pulled 15 documents to ./output
|
|
22
19
|
`,
|
|
23
|
-
`$ xano workspace pull
|
|
24
|
-
Pulled 58 documents
|
|
25
|
-
`,
|
|
26
|
-
`$ xano workspace pull ./my-workspace --draft
|
|
27
|
-
Pulled 42 documents to ./my-workspace
|
|
28
|
-
`,
|
|
29
|
-
`$ xano workspace pull ./my-workspace -b dev
|
|
30
|
-
Pulled 42 documents to ./my-workspace
|
|
20
|
+
`$ xano workspace pull --profile production --env --records
|
|
21
|
+
Pulled 58 documents
|
|
31
22
|
`,
|
|
23
|
+
`$ xano workspace pull --draft`,
|
|
24
|
+
`$ xano workspace pull -b dev`,
|
|
32
25
|
];
|
|
33
26
|
static flags = {
|
|
34
27
|
...BaseCommand.baseFlags,
|
|
@@ -37,6 +30,12 @@ Pulled 42 documents to ./my-workspace
|
|
|
37
30
|
description: 'Branch name (optional if set in profile, defaults to live)',
|
|
38
31
|
required: false,
|
|
39
32
|
}),
|
|
33
|
+
directory: Flags.string({
|
|
34
|
+
char: 'd',
|
|
35
|
+
default: '.',
|
|
36
|
+
description: 'Output directory for pulled documents (defaults to current directory)',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
40
39
|
env: Flags.boolean({
|
|
41
40
|
default: false,
|
|
42
41
|
description: 'Include environment variables',
|
|
@@ -59,7 +58,7 @@ Pulled 42 documents to ./my-workspace
|
|
|
59
58
|
}),
|
|
60
59
|
};
|
|
61
60
|
async run() {
|
|
62
|
-
const {
|
|
61
|
+
const { flags } = await this.parse(Pull);
|
|
63
62
|
// Get profile name (default or from flag/env)
|
|
64
63
|
const profileName = flags.profile || this.getDefaultProfile();
|
|
65
64
|
// Load credentials
|
|
@@ -87,7 +86,7 @@ Pulled 42 documents to ./my-workspace
|
|
|
87
86
|
}
|
|
88
87
|
else {
|
|
89
88
|
this.error(`Workspace ID is required. Either:\n` +
|
|
90
|
-
` 1. Provide it as a flag: xano workspace pull
|
|
89
|
+
` 1. Provide it as a flag: xano workspace pull -w <workspace_id>\n` +
|
|
91
90
|
` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
|
|
92
91
|
}
|
|
93
92
|
// Determine branch from flag or profile
|
|
@@ -145,7 +144,7 @@ Pulled 42 documents to ./my-workspace
|
|
|
145
144
|
return;
|
|
146
145
|
}
|
|
147
146
|
// Resolve the output directory
|
|
148
|
-
const outputDir = path.resolve(
|
|
147
|
+
const outputDir = path.resolve(flags.directory);
|
|
149
148
|
// Create the output directory if it doesn't exist
|
|
150
149
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
151
150
|
// Resolve api_group names to unique folder names, disambiguating collisions
|
|
@@ -252,7 +251,7 @@ Pulled 42 documents to ./my-workspace
|
|
|
252
251
|
fs.writeFileSync(filePath, doc.content, 'utf8');
|
|
253
252
|
writtenCount++;
|
|
254
253
|
}
|
|
255
|
-
this.log(`Pulled ${writtenCount} documents to ${
|
|
254
|
+
this.log(`Pulled ${writtenCount} documents to ${flags.directory}`);
|
|
256
255
|
}
|
|
257
256
|
loadCredentials() {
|
|
258
257
|
const credentialsPath = this.getCredentialsPath();
|
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
import BaseCommand from '../../../base-command.js';
|
|
2
2
|
export default class Push extends BaseCommand {
|
|
3
|
-
static args: {
|
|
4
|
-
directory: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
-
};
|
|
6
3
|
static description: string;
|
|
7
4
|
static examples: string[];
|
|
8
5
|
static flags: {
|
|
9
6
|
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
directory: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
8
|
delete: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
9
|
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
10
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
13
|
guids: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
|
+
include: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
sync: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
17
|
transaction: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
18
|
truncate: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
19
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
-
exclude: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
-
include: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
-
force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
22
20
|
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
21
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
22
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
25
23
|
};
|
|
26
24
|
run(): Promise<void>;
|
|
27
|
-
private confirm;
|
|
28
|
-
private renderPreview;
|
|
29
|
-
/**
|
|
30
|
-
* Recursively collect all .xs files from a directory, sorted by
|
|
31
|
-
* type subdirectory name then filename for deterministic ordering.
|
|
32
|
-
*/
|
|
33
|
-
private collectFiles;
|
|
34
|
-
private renderBadIndexes;
|
|
35
|
-
private renderBadReferences;
|
|
36
|
-
private loadCredentials;
|
|
37
25
|
}
|