@xano/cli 0.0.35 → 0.0.37
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.
|
@@ -76,8 +76,8 @@ Results: 2 passed, 1 failed
|
|
|
76
76
|
}
|
|
77
77
|
const listResponse = await this.verboseFetch(`${baseUrl}?${listParams}`, {
|
|
78
78
|
headers: {
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
accept: 'application/json',
|
|
80
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
81
81
|
},
|
|
82
82
|
method: 'GET',
|
|
83
83
|
}, flags.verbose, profile.access_token);
|
|
@@ -85,7 +85,7 @@ Results: 2 passed, 1 failed
|
|
|
85
85
|
const errorText = await listResponse.text();
|
|
86
86
|
this.error(`Failed to list unit tests: ${listResponse.status}: ${listResponse.statusText}\n${errorText}`);
|
|
87
87
|
}
|
|
88
|
-
const data = await listResponse.json();
|
|
88
|
+
const data = (await listResponse.json());
|
|
89
89
|
let tests;
|
|
90
90
|
if (Array.isArray(data)) {
|
|
91
91
|
tests = data;
|
|
@@ -110,8 +110,8 @@ Results: 2 passed, 1 failed
|
|
|
110
110
|
try {
|
|
111
111
|
const runResponse = await this.verboseFetch(runUrl, {
|
|
112
112
|
headers: {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
accept: 'application/json',
|
|
114
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
115
115
|
'Content-Type': 'application/json',
|
|
116
116
|
},
|
|
117
117
|
method: 'POST',
|
|
@@ -132,9 +132,9 @@ Results: 2 passed, 1 failed
|
|
|
132
132
|
}
|
|
133
133
|
continue;
|
|
134
134
|
}
|
|
135
|
-
const runResult = await runResponse.json();
|
|
135
|
+
const runResult = (await runResponse.json());
|
|
136
136
|
const passed = runResult.status === 'ok';
|
|
137
|
-
const failedExpects = runResult.results?.filter(r => r.status === 'fail') ?? [];
|
|
137
|
+
const failedExpects = runResult.results?.filter((r) => r.status === 'fail') ?? [];
|
|
138
138
|
const result = {
|
|
139
139
|
message: failedExpects[0]?.message,
|
|
140
140
|
name: test.name,
|
|
@@ -173,8 +173,8 @@ Results: 2 passed, 1 failed
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
// Step 3: Summary
|
|
176
|
-
const passed = results.filter(r => r.status === 'pass').length;
|
|
177
|
-
const failed = results.filter(r => r.status === 'fail').length;
|
|
176
|
+
const passed = results.filter((r) => r.status === 'pass').length;
|
|
177
|
+
const failed = results.filter((r) => r.status === 'fail').length;
|
|
178
178
|
if (flags.output === 'json') {
|
|
179
179
|
this.log(JSON.stringify({ passed, failed, results }, null, 2));
|
|
180
180
|
}
|
|
@@ -182,7 +182,7 @@ Results: 2 passed, 1 failed
|
|
|
182
182
|
this.log(`\nResults: ${passed} passed, ${failed} failed`);
|
|
183
183
|
}
|
|
184
184
|
if (failed > 0) {
|
|
185
|
-
|
|
185
|
+
process.exitCode = 1;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
catch (error) {
|
|
@@ -198,8 +198,7 @@ Results: 2 passed, 1 failed
|
|
|
198
198
|
const configDir = path.join(os.homedir(), '.xano');
|
|
199
199
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
200
200
|
if (!fs.existsSync(credentialsPath)) {
|
|
201
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
202
|
-
`Create a profile using 'xano profile create'`);
|
|
201
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
203
202
|
}
|
|
204
203
|
try {
|
|
205
204
|
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
@@ -67,8 +67,8 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
67
67
|
}
|
|
68
68
|
const listResponse = await this.verboseFetch(`${baseUrl}?${listParams}`, {
|
|
69
69
|
headers: {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
accept: 'application/json',
|
|
71
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
72
72
|
},
|
|
73
73
|
method: 'GET',
|
|
74
74
|
}, flags.verbose, profile.access_token);
|
|
@@ -76,7 +76,7 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
76
76
|
const errorText = await listResponse.text();
|
|
77
77
|
this.error(`Failed to list workflow tests: ${listResponse.status}: ${listResponse.statusText}\n${errorText}`);
|
|
78
78
|
}
|
|
79
|
-
const data = await listResponse.json();
|
|
79
|
+
const data = (await listResponse.json());
|
|
80
80
|
let tests;
|
|
81
81
|
if (Array.isArray(data)) {
|
|
82
82
|
tests = data;
|
|
@@ -102,8 +102,8 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
102
102
|
try {
|
|
103
103
|
const runResponse = await this.verboseFetch(runUrl, {
|
|
104
104
|
headers: {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
accept: 'application/json',
|
|
106
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
107
107
|
'Content-Type': 'application/json',
|
|
108
108
|
},
|
|
109
109
|
method: 'POST',
|
|
@@ -123,7 +123,7 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
123
123
|
}
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
|
-
const runResult = await runResponse.json();
|
|
126
|
+
const runResult = (await runResponse.json());
|
|
127
127
|
const passed = runResult.status === 'ok';
|
|
128
128
|
const result = {
|
|
129
129
|
message: runResult.message,
|
|
@@ -161,8 +161,8 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
// Step 3: Summary
|
|
164
|
-
const passed = results.filter(r => r.status === 'pass').length;
|
|
165
|
-
const failed = results.filter(r => r.status === 'fail').length;
|
|
164
|
+
const passed = results.filter((r) => r.status === 'pass').length;
|
|
165
|
+
const failed = results.filter((r) => r.status === 'fail').length;
|
|
166
166
|
if (flags.output === 'json') {
|
|
167
167
|
this.log(JSON.stringify({ passed, failed, total_timing: totalTiming, results }, null, 2));
|
|
168
168
|
}
|
|
@@ -170,7 +170,7 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
170
170
|
this.log(`\nResults: ${passed} passed, ${failed} failed (${totalTiming.toFixed(3)}s total)`);
|
|
171
171
|
}
|
|
172
172
|
if (failed > 0) {
|
|
173
|
-
|
|
173
|
+
process.exitCode = 1;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
catch (error) {
|
|
@@ -186,8 +186,7 @@ Results: 2 passed, 1 failed (2.691s total)
|
|
|
186
186
|
const configDir = path.join(os.homedir(), '.xano');
|
|
187
187
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
188
188
|
if (!fs.existsSync(credentialsPath)) {
|
|
189
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
190
|
-
`Create a profile using 'xano profile create'`);
|
|
189
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile create'`);
|
|
191
190
|
}
|
|
192
191
|
try {
|
|
193
192
|
const fileContent = fs.readFileSync(credentialsPath, 'utf8');
|
|
@@ -131,12 +131,17 @@ Push schema only, skip records and environment variables
|
|
|
131
131
|
// Determine branch from flag or profile
|
|
132
132
|
const branch = flags.branch || profile.branch || '';
|
|
133
133
|
// Construct the API URL
|
|
134
|
-
const queryParams = new URLSearchParams({
|
|
134
|
+
const queryParams = new URLSearchParams({
|
|
135
|
+
branch,
|
|
136
|
+
env: flags.env.toString(),
|
|
137
|
+
records: flags.records.toString(),
|
|
138
|
+
truncate: flags.truncate.toString(),
|
|
139
|
+
});
|
|
135
140
|
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/multidoc?${queryParams.toString()}`;
|
|
136
141
|
// POST the multidoc to the API
|
|
137
142
|
const requestHeaders = {
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
accept: 'application/json',
|
|
144
|
+
Authorization: `Bearer ${profile.access_token}`,
|
|
140
145
|
'Content-Type': 'text/x-xanoscript',
|
|
141
146
|
};
|
|
142
147
|
try {
|
|
@@ -147,7 +152,18 @@ Push schema only, skip records and environment variables
|
|
|
147
152
|
}, flags.verbose, profile.access_token);
|
|
148
153
|
if (!response.ok) {
|
|
149
154
|
const errorText = await response.text();
|
|
150
|
-
|
|
155
|
+
let errorMessage = `Push failed (${response.status})`;
|
|
156
|
+
try {
|
|
157
|
+
const errorJson = JSON.parse(errorText);
|
|
158
|
+
errorMessage += `: ${errorJson.message}`;
|
|
159
|
+
if (errorJson.payload?.param) {
|
|
160
|
+
errorMessage += `\n Parameter: ${errorJson.payload.param}`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
errorMessage += `\n${errorText}`;
|
|
165
|
+
}
|
|
166
|
+
this.error(errorMessage);
|
|
151
167
|
}
|
|
152
168
|
// Log the response if any
|
|
153
169
|
const responseText = await response.text();
|
|
@@ -188,8 +204,7 @@ Push schema only, skip records and environment variables
|
|
|
188
204
|
const credentialsPath = path.join(configDir, 'credentials.yaml');
|
|
189
205
|
// Check if credentials file exists
|
|
190
206
|
if (!fs.existsSync(credentialsPath)) {
|
|
191
|
-
this.error(`Credentials file not found at ${credentialsPath}\n` +
|
|
192
|
-
`Create a profile using 'xano profile:create'`);
|
|
207
|
+
this.error(`Credentials file not found at ${credentialsPath}\n` + `Create a profile using 'xano profile:create'`);
|
|
193
208
|
}
|
|
194
209
|
// Read credentials file
|
|
195
210
|
try {
|