@xano/cli 0.0.27 → 0.0.29
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.
|
@@ -6,11 +6,12 @@ export default class Pull extends BaseCommand {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
env: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
records: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
13
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
14
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
14
15
|
};
|
|
15
16
|
run(): Promise<void>;
|
|
16
17
|
private loadCredentials;
|
|
@@ -22,10 +22,18 @@ Pulled 15 documents to ./output
|
|
|
22
22
|
`,
|
|
23
23
|
`$ xano workspace pull ./backup --profile production --env --records
|
|
24
24
|
Pulled 58 documents to ./backup
|
|
25
|
+
`,
|
|
26
|
+
`$ xano workspace pull ./my-workspace -b dev
|
|
27
|
+
Pulled 42 documents to ./my-workspace
|
|
25
28
|
`,
|
|
26
29
|
];
|
|
27
30
|
static flags = {
|
|
28
31
|
...BaseCommand.baseFlags,
|
|
32
|
+
branch: Flags.string({
|
|
33
|
+
char: 'b',
|
|
34
|
+
description: 'Branch name (optional if set in profile, defaults to live)',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
29
37
|
env: Flags.boolean({
|
|
30
38
|
default: false,
|
|
31
39
|
description: 'Include environment variables',
|
|
@@ -36,6 +44,12 @@ Pulled 58 documents to ./backup
|
|
|
36
44
|
description: 'Include records',
|
|
37
45
|
required: false,
|
|
38
46
|
}),
|
|
47
|
+
verbose: Flags.boolean({
|
|
48
|
+
char: 'v',
|
|
49
|
+
default: false,
|
|
50
|
+
description: 'Show request details',
|
|
51
|
+
required: false,
|
|
52
|
+
}),
|
|
39
53
|
workspace: Flags.string({
|
|
40
54
|
char: 'w',
|
|
41
55
|
description: 'Workspace ID (optional if set in profile)',
|
|
@@ -74,8 +88,11 @@ Pulled 58 documents to ./backup
|
|
|
74
88
|
` 1. Provide it as a flag: xano workspace pull <directory> -w <workspace_id>\n` +
|
|
75
89
|
` 2. Set it in your profile using: xano profile:edit ${profileName} -w <workspace_id>`);
|
|
76
90
|
}
|
|
91
|
+
// Determine branch from flag or profile
|
|
92
|
+
const branch = flags.branch || profile.branch || '';
|
|
77
93
|
// Build query parameters
|
|
78
94
|
const queryParams = new URLSearchParams({
|
|
95
|
+
branch,
|
|
79
96
|
env: flags.env.toString(),
|
|
80
97
|
records: flags.records.toString(),
|
|
81
98
|
});
|
|
@@ -83,12 +100,21 @@ Pulled 58 documents to ./backup
|
|
|
83
100
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
|
|
84
101
|
// Fetch multidoc from the API
|
|
85
102
|
let responseText;
|
|
103
|
+
const requestHeaders = {
|
|
104
|
+
'accept': 'application/json',
|
|
105
|
+
'Authorization': `Bearer ${profile.access_token}`,
|
|
106
|
+
};
|
|
107
|
+
if (flags.verbose) {
|
|
108
|
+
this.log('Request details:');
|
|
109
|
+
this.log(` Method: GET`);
|
|
110
|
+
this.log(` URL: ${apiUrl}`);
|
|
111
|
+
this.log(` Headers:`);
|
|
112
|
+
this.log(` accept: application/json`);
|
|
113
|
+
this.log(` Authorization: Bearer ${profile.access_token.slice(0, 8)}...${profile.access_token.slice(-4)}`);
|
|
114
|
+
}
|
|
86
115
|
try {
|
|
87
116
|
const response = await fetch(apiUrl, {
|
|
88
|
-
headers:
|
|
89
|
-
'accept': 'application/json',
|
|
90
|
-
'Authorization': `Bearer ${profile.access_token}`,
|
|
91
|
-
},
|
|
117
|
+
headers: requestHeaders,
|
|
92
118
|
method: 'GET',
|
|
93
119
|
});
|
|
94
120
|
if (!response.ok) {
|
|
@@ -6,9 +6,10 @@ export default class Push extends BaseCommand {
|
|
|
6
6
|
static description: string;
|
|
7
7
|
static examples: string[];
|
|
8
8
|
static flags: {
|
|
9
|
+
branch: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
11
|
workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
12
|
profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
13
|
};
|
|
13
14
|
run(): Promise<void>;
|
|
14
15
|
/**
|
|
@@ -21,10 +21,24 @@ Pushed 15 documents from ./output
|
|
|
21
21
|
`,
|
|
22
22
|
`$ xano workspace push ./backup --profile production
|
|
23
23
|
Pushed 58 documents from ./backup
|
|
24
|
+
`,
|
|
25
|
+
`$ xano workspace push ./my-workspace -b dev
|
|
26
|
+
Pushed 42 documents from ./my-workspace
|
|
24
27
|
`,
|
|
25
28
|
];
|
|
26
29
|
static flags = {
|
|
27
30
|
...BaseCommand.baseFlags,
|
|
31
|
+
branch: Flags.string({
|
|
32
|
+
char: 'b',
|
|
33
|
+
description: 'Branch name (optional if set in profile, defaults to live)',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
verbose: Flags.boolean({
|
|
37
|
+
char: 'v',
|
|
38
|
+
default: false,
|
|
39
|
+
description: 'Show request details',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
28
42
|
workspace: Flags.string({
|
|
29
43
|
char: 'w',
|
|
30
44
|
description: 'Workspace ID (optional if set in profile)',
|
|
@@ -88,17 +102,31 @@ Pushed 58 documents from ./backup
|
|
|
88
102
|
this.error(`All .xs files in ${args.directory} are empty`);
|
|
89
103
|
}
|
|
90
104
|
const multidoc = documents.join('\n---\n');
|
|
105
|
+
// Determine branch from flag or profile
|
|
106
|
+
const branch = flags.branch || profile.branch || '';
|
|
91
107
|
// Construct the API URL
|
|
92
|
-
const
|
|
108
|
+
const queryParams = new URLSearchParams({ branch });
|
|
109
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
|
|
93
110
|
// POST the multidoc to the API
|
|
111
|
+
const requestHeaders = {
|
|
112
|
+
'accept': 'application/json',
|
|
113
|
+
'Authorization': `Bearer ${profile.access_token}`,
|
|
114
|
+
'Content-Type': 'text/x-xanoscript',
|
|
115
|
+
};
|
|
116
|
+
if (flags.verbose) {
|
|
117
|
+
this.log('Request details:');
|
|
118
|
+
this.log(` Method: POST`);
|
|
119
|
+
this.log(` URL: ${apiUrl}`);
|
|
120
|
+
this.log(` Headers:`);
|
|
121
|
+
this.log(` accept: application/json`);
|
|
122
|
+
this.log(` Authorization: Bearer ${profile.access_token.slice(0, 8)}...${profile.access_token.slice(-4)}`);
|
|
123
|
+
this.log(` Content-Type: text/x-xanoscript`);
|
|
124
|
+
this.log(` Body: ${multidoc.length} bytes (${documents.length} documents)`);
|
|
125
|
+
}
|
|
94
126
|
try {
|
|
95
127
|
const response = await fetch(apiUrl, {
|
|
96
128
|
body: multidoc,
|
|
97
|
-
headers:
|
|
98
|
-
'accept': 'application/json',
|
|
99
|
-
'Authorization': `Bearer ${profile.access_token}`,
|
|
100
|
-
'Content-Type': 'text/x-xanoscript',
|
|
101
|
-
},
|
|
129
|
+
headers: requestHeaders,
|
|
102
130
|
method: 'POST',
|
|
103
131
|
});
|
|
104
132
|
if (!response.ok) {
|