@xano/cli 0.0.36 → 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.
@@ -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({ branch, env: flags.env.toString(), records: flags.records.toString(), truncate: flags.truncate.toString() });
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
- 'accept': 'application/json',
139
- 'Authorization': `Bearer ${profile.access_token}`,
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
- this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
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 {