arcadible 1.0.43 → 1.0.44

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.
@@ -286,13 +286,15 @@ export async function follow(current, { channel, ...conf }, shown) {
286
286
  for (let failed = 0;;) {
287
287
  const closed = await followOnce(await tokenOf(id, headers), query, once);
288
288
  const { code, status } = closed;
289
- if (code === "full" || status === 507) {
289
+ // read by the Worker's code alone, as a page is (`pageOf`): a bare 401
290
+ // is refused as any other 4xx, and a bare 507 tried again as a 5xx
291
+ if (code === "full") {
290
292
  throw new ArcError(FUNCTION_LOGS_FOLLOWS_FULL, functionLogsFull(), {
291
293
  cause: httpErrorOf(status ?? 507, closed),
292
294
  status: status ?? 507,
293
295
  });
294
296
  }
295
- const expired = status === 401 && (code === null || code === "expired");
297
+ const expired = status === 401 && code === "expired";
296
298
  if (status && status < 500 && !expired) {
297
299
  throw refused(status, closed);
298
300
  }
@@ -3,7 +3,7 @@
3
3
  // command names, the session's headers, and telling the API's refusals
4
4
  // apart.
5
5
  import { auth, gameWireUsages } from "../api.js";
6
- import { ALL, ARGUMENT_INVALID, GAME_ID_MISSING, GAME_NOT_FOUND, NOT_LOGGED_IN, } from "../config/code.js";
6
+ import { ARGUMENT_INVALID, GAME_ID_MISSING, GAME_NOT_FOUND, NOT_LOGGED_IN, } from "../config/code.js";
7
7
  import { ArcError } from "../util/error.js";
8
8
  import { given } from "../parser/given.js";
9
9
  import { HttpError } from "../util/http.js";
@@ -74,12 +74,14 @@ export function isStatus(err, status) {
74
74
  }
75
75
  // [function]
76
76
  // whether a failure is the API's refusal with this code, which the
77
- // database names (ERRORS.md): read first, and, from an API that doesn't say
78
- // one, its status.
77
+ // database names (ERRORS.md): the code alone when the answer says one, and
78
+ // its status only when it says none (a proxy's page, which names nothing).
79
+ // Another code with the same status is another refusal: a 429 `busy` on an
80
+ // upload is never `deploy_rate_limited`.
79
81
  export function isRefused(err, code, status) {
80
82
  if (!(err instanceof HttpError))
81
83
  return false;
82
- if (err.code === code)
83
- return true;
84
- return (err.status === status && (err.code === undefined || !ALL.has(err.code)));
84
+ if (err.code !== undefined)
85
+ return err.code === code;
86
+ return err.status === status;
85
87
  }
@@ -108,7 +108,6 @@ export const ISSUE = {
108
108
  MARKDOWN_INVALID: "markdown_invalid",
109
109
  MEDIA_INVALID: "media_invalid",
110
110
  OPTION_INVALID: "option_invalid",
111
- OUT_OF_RANGE: "out_of_range",
112
111
  PATH_INVALID: "path_invalid",
113
112
  REQUIRED: "required",
114
113
  SCREENSHOT_NUMBER_DUPLICATE: "screenshot_number_duplicate",
@@ -45,14 +45,16 @@ export function issueCodeOf(issue) {
45
45
  return typeRefused(issue) ? ISSUE.TYPE_INVALID : ISSUE.INVALID;
46
46
  case "invalid_value":
47
47
  return ISSUE.OPTION_INVALID;
48
+ // a number's range: no field has one, so it has no code of its own
49
+ // until one does
48
50
  case "too_big":
49
51
  if (NUMBERS.has(issue.origin)) {
50
- return ISSUE.OUT_OF_RANGE;
52
+ return ISSUE.INVALID;
51
53
  }
52
54
  return issue.origin === "string" ? ISSUE.TOO_LONG : ISSUE.TOO_MANY;
53
55
  case "too_small":
54
56
  if (NUMBERS.has(issue.origin)) {
55
- return ISSUE.OUT_OF_RANGE;
57
+ return ISSUE.INVALID;
56
58
  }
57
59
  return issue.minimum > 1 ? ISSUE.TOO_SHORT : ISSUE.EMPTY;
58
60
  default:
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "license": "Apache-2.0",
44
44
  "name": "arcadible",
45
- "version": "1.0.43"
45
+ "version": "1.0.44"
46
46
  },
47
47
  "node_modules/@cacheable/memory": {
48
48
  "dependencies": {
@@ -2433,5 +2433,5 @@
2433
2433
  }
2434
2434
  },
2435
2435
  "requires": true,
2436
- "version": "1.0.43"
2436
+ "version": "1.0.44"
2437
2437
  }
package/package.json CHANGED
@@ -66,5 +66,5 @@
66
66
  "test": "tsc && npm run lint && node --test \"test/**/*.test.js\" \"test/**/*.test.mjs\""
67
67
  },
68
68
  "type": "module",
69
- "version": "1.0.43"
69
+ "version": "1.0.44"
70
70
  }