makefx 1.6.8 → 1.6.9

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/makefx.mjs +21 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -61,4 +61,4 @@ IDs, or runs. Retired commands and aliases are not redirected.
61
61
 
62
62
  Run `makefx --help` or `makefx <noun> --help` for current options.
63
63
 
64
- Version: 1.6.8
64
+ Version: 1.6.9
package/makefx.mjs CHANGED
@@ -198,6 +198,24 @@ function loginCommandForEnvironment(environment) {
198
198
  if (environment === "local") return "makefx login --local";
199
199
  return `makefx login --env ${environment}`;
200
200
  }
201
+ //#endregion
202
+ //#region src/cli/lib/http-response.ts
203
+ var MAX_ERROR_BODY_LENGTH = 500;
204
+ function boundedBody(body) {
205
+ const trimmed = body.trim();
206
+ if (trimmed.length <= MAX_ERROR_BODY_LENGTH) return trimmed;
207
+ return `${trimmed.slice(0, MAX_ERROR_BODY_LENGTH)}…`;
208
+ }
209
+ async function readJsonResponse(response, description) {
210
+ const contentType = response.headers.get("content-type") ?? "unknown";
211
+ const body = await response.text();
212
+ try {
213
+ return JSON.parse(body);
214
+ } catch {
215
+ const detail = boundedBody(body);
216
+ throw new Error(`${description} returned non-JSON (HTTP ${response.status}; content-type: ${contentType})${detail ? `: ${detail}` : ""}`);
217
+ }
218
+ }
201
219
  var EXT_TO_MEDIA_TYPE = {
202
220
  ".aac": {
203
221
  mediaKind: "audio",
@@ -301,7 +319,7 @@ async function uploadLocalMediaAsReference(input) {
301
319
  headers: { "Authorization": `Bearer ${input.accessToken}` },
302
320
  body: formData
303
321
  });
304
- const data = await response.json();
322
+ const data = await readJsonResponse(response, "Reference upload request");
305
323
  if (!response.ok || !data.success || !data.variant) throw new Error(`Failed to upload reference "${input.filePath}": ${data.error || response.statusText}`);
306
324
  return {
307
325
  asset: data.asset,
@@ -4442,7 +4460,7 @@ require_websocket_server();
4442
4460
  var wrapper_default = import_websocket.default;
4443
4461
  //#endregion
4444
4462
  //#region src/cli/version.ts
4445
- var CLI_VERSION = "1.6.8+06570e7d00c2";
4463
+ var CLI_VERSION = "1.6.9+4949b061ecf5";
4446
4464
  var CLI_VERSION_HEADER = "X-MakeFX-CLI-Version";
4447
4465
  function cliVersionHeaders() {
4448
4466
  return {
@@ -11839,7 +11857,7 @@ async function executeUpload(parsed, deps = defaultDeps$2) {
11839
11857
  headers: { "Authorization": `Bearer ${accessToken}` },
11840
11858
  body: formData
11841
11859
  });
11842
- const data = await response.json();
11860
+ const data = await readJsonResponse(response, "Upload request");
11843
11861
  if (!response.ok) throw new Error(`Upload failed: ${"error" in data ? data.error : response.statusText}`);
11844
11862
  const upload = data;
11845
11863
  const result = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makefx",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "description": "Command-line interface for AI-assisted game asset production with Make Effects.",
5
5
  "license": "MIT",
6
6
  "type": "module",