arcadible 1.0.42 → 1.0.43

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.
@@ -11,11 +11,13 @@ const CLI = {
11
11
  BUILD_FAILED: "build_failed",
12
12
  DEPLOY_DIR_MISSING: "deploy_dir_missing",
13
13
  DEPLOY_RATE_LIMITED: "deploy_rate_limited",
14
+ FUNCTION_LOGS_FOLLOWS_FULL: "function_logs_follows_full",
15
+ FUNCTION_MAIN_MISSING: "function_main_missing",
16
+ FUNCTION_NOT_BUILT: "function_not_built",
14
17
  FUNCTION_PAUSE_NOT_OWNED: "function_pause_not_owned",
15
18
  GAME_HANDLE_TAKEN: "game_handle_taken",
16
19
  GAME_ID_MISSING: "game_id_missing",
17
20
  GAME_NOT_DEPLOYED: "game_not_deployed",
18
- GAME_NOT_FOUND: "game_not_found",
19
21
  GIT_REMOTE_MISSING: "git_remote_missing",
20
22
  GIT_REMOTE_UNREACHABLE: "git_remote_unreachable",
21
23
  GIT_REPO_MISSING: "git_repo_missing",
@@ -23,8 +25,8 @@ const CLI = {
23
25
  GIT_TAG_EXISTS: "git_tag_exists",
24
26
  GIT_TAG_PUSH_FAILED: "git_tag_push_failed",
25
27
  GIT_UNCOMMITTED: "git_uncommitted",
26
- KEY_LIMIT_REACHED: "key_limit_reached",
27
28
  KEY_NOT_FOUND: "key_not_found",
29
+ KEY_QUOTA_FULL: "key_quota_full",
28
30
  LIMIT_REACHED: "limit_reached",
29
31
  LOCKFILE_MISSING: "lockfile_missing",
30
32
  LOGIN_CODE_EXPIRED: "login_code_expired",
@@ -38,42 +40,46 @@ const CLI = {
38
40
  PATH_NOT_FOUND: "path_not_found",
39
41
  PORT_IN_USE: "port_in_use",
40
42
  PROJECT_NOT_REPO_ROOT: "project_not_repo_root",
41
- SECRET_LIMIT_REACHED: "secret_limit_reached",
42
43
  SECRET_NOT_FOUND: "secret_not_found",
44
+ SECRET_QUOTA_FULL: "secret_quota_full",
45
+ SECRET_TOO_LARGE: "secret_too_large",
43
46
  SESSION_EXPIRED: "session_expired",
44
- TEMPLATE_MISSING: "template_missing",
45
- TEMPLATE_UNAVAILABLE: "template_unavailable",
47
+ TEMPLATE_NOT_FOUND: "template_not_found",
48
+ UNAVAILABLE: "unavailable",
46
49
  UNEXPECTED: "unexpected",
47
50
  UPLOAD_FAILED: "upload_failed",
48
51
  VALIDATION_FAILED: "validation_failed",
49
52
  VALUE_NOT_FOUND: "value_not_found",
50
- VALUE_STORAGE_FULL: "value_storage_full",
53
+ VALUE_STORAGE_QUOTA_FULL: "value_storage_quota_full",
51
54
  VALUE_TOO_LARGE: "value_too_large",
52
55
  WAIT_TIMED_OUT: "wait_timed_out",
53
56
  };
54
57
  // a release's reasons, from the pipeline (the API's
55
58
  // db/type/release_reason.sql). The CLI shares them, so a name means the same
56
59
  // thing wherever it appears: FUNCTION_TOO_LARGE, GAME_HANDLE_CHANGED,
57
- // GAME_UNAVAILABLE, INTERNAL, the PACKAGE_ codes here, as well as
60
+ // GAME_NOT_FOUND, INTERNAL, the PACKAGE_ codes here, as well as
58
61
  // REPO_NOT_CONNECTED and VERSION_EXISTS, are the CLI's too.
59
62
  export const RELEASE = {
63
+ ACCOUNT_NOT_FOUND: "account_not_found",
60
64
  BUILD_NOT_PUBLISHED: "build_not_published",
61
65
  BUILD_RATE_LIMITED: "build_rate_limited",
62
66
  FUNCTION_INVALID: "function_invalid",
63
67
  FUNCTION_TOO_LARGE: "function_too_large",
64
68
  GAME_HANDLE_CHANGED: "game_handle_changed",
65
- GAME_LIMIT_REACHED: "game_limit_reached",
66
69
  GAME_MISMATCH: "game_mismatch",
67
- GAME_UNAVAILABLE: "game_unavailable",
70
+ GAME_NOT_FOUND: "game_not_found",
71
+ GAME_QUOTA_FULL: "game_quota_full",
72
+ GIT_RELEASE_NOT_FOUND: "git_release_not_found",
68
73
  GITHUB_APP_NOT_INSTALLED: "github_app_not_installed",
69
74
  INTERNAL: "internal",
70
75
  MANIFEST_INVALID: "manifest_invalid",
76
+ MANIFEST_TOO_LARGE: "manifest_too_large",
71
77
  PACKAGE_FILE_TOO_LARGE: "package_file_too_large",
72
78
  PACKAGE_PATH_INVALID: "package_path_invalid",
73
79
  PACKAGE_PATH_RESERVED: "package_path_reserved",
74
80
  PACKAGE_TOO_MANY_FILES: "package_too_many_files",
75
81
  PACKAGE_UNCOMPRESSED_TOO_LARGE: "package_uncompressed_too_large",
76
- RELEASE_EXPIRED: "release_expired",
82
+ RELEASE_TIMED_OUT: "release_timed_out",
77
83
  REPO_NOT_CONNECTED: "repo_not_connected",
78
84
  SERVERS_CHANGED: "servers_changed",
79
85
  VERSION_EXISTS: "version_exists",
@@ -87,6 +93,7 @@ export const RELEASE = {
87
93
  // checks for workflow_missing before it pushes.
88
94
  export const GITHUB = {
89
95
  GIT_TAG_INVALID: "git_tag_invalid",
96
+ GITHUB_APP_NOT_CONNECTED: "github_app_not_connected",
90
97
  WORKFLOW_MISSING: "workflow_missing",
91
98
  };
92
99
  // an `arc validate` issue's codes, named for the rule it breaks; the field
@@ -97,10 +104,6 @@ export const ISSUE = {
97
104
  DESCRIPTION_RULES_MISSING: "description_rules_missing",
98
105
  DUPLICATE: "duplicate",
99
106
  EMPTY: "empty",
100
- // no longer used: arc validate checked deploy_dir for an index.html before
101
- // 1.0.37, which packing checks now (package_index_missing). Kept, as
102
- // every code is.
103
- INDEX_MISSING: "index_missing",
104
107
  INVALID: "invalid",
105
108
  MARKDOWN_INVALID: "markdown_invalid",
106
109
  MEDIA_INVALID: "media_invalid",
@@ -108,7 +111,7 @@ export const ISSUE = {
108
111
  OUT_OF_RANGE: "out_of_range",
109
112
  PATH_INVALID: "path_invalid",
110
113
  REQUIRED: "required",
111
- SCREENSHOT_NUMBER_REPEATED: "screenshot_number_repeated",
114
+ SCREENSHOT_NUMBER_DUPLICATE: "screenshot_number_duplicate",
112
115
  TOO_LONG: "too_long",
113
116
  TOO_MANY: "too_many",
114
117
  TOO_SHORT: "too_short",
@@ -127,7 +130,7 @@ export const WARNING = {
127
130
  FIELD_UNSET: "field_unset",
128
131
  FUNCTION_IMPORT_WRONG: "function_import_wrong",
129
132
  GAME_HANDLE_LAPSED: "game_handle_lapsed",
130
- GAME_HANDLE_LIMIT_REACHED: "game_handle_limit_reached",
133
+ GAME_HANDLE_QUOTA_FULL: "game_handle_quota_full",
131
134
  PACKAGE_FILE_DEV: "package_file_dev",
132
135
  PACKAGE_FILE_PRIVATE: "package_file_private",
133
136
  SCREENSHOT_NAME_INVALID: "screenshot_name_invalid",
@@ -147,6 +150,6 @@ export const ISSUES = new Set(Object.values(ISSUE));
147
150
  export const WARNINGS = new Set(Object.values(WARNING));
148
151
  // [declare]
149
152
  // each error code by its own name too: `cfgcode.NOT_LOGGED_IN`.
150
- export const { API_REFUSED, API_UNREACHABLE, ARGUMENT_INVALID, BUILD_FAILED, DEPLOY_DIR_MISSING, DEPLOY_RATE_LIMITED, FUNCTION_PAUSE_NOT_OWNED, GAME_HANDLE_TAKEN, GAME_ID_MISSING, GAME_NOT_DEPLOYED, GAME_NOT_FOUND, GIT_REMOTE_MISSING, GIT_REMOTE_UNREACHABLE, GIT_REPO_MISSING, GIT_TAG_CREATE_FAILED, GIT_TAG_EXISTS, GIT_TAG_PUSH_FAILED, GIT_UNCOMMITTED, KEY_LIMIT_REACHED, KEY_NOT_FOUND, LIMIT_REACHED, LOCKFILE_MISSING, LOGIN_CODE_EXPIRED, LOGIN_FAILED, MANIFEST_MISSING, NOT_LOGGED_IN, PACKAGE_INDEX_MISSING, PACKAGE_LINK_INVALID, PACKAGE_TOO_LARGE, PARSE_FAILED, PATH_NOT_FOUND, PORT_IN_USE, PROJECT_NOT_REPO_ROOT, SECRET_LIMIT_REACHED, SECRET_NOT_FOUND, SESSION_EXPIRED, TEMPLATE_MISSING, TEMPLATE_UNAVAILABLE, UNEXPECTED, UPLOAD_FAILED, VALIDATION_FAILED, VALUE_NOT_FOUND, VALUE_STORAGE_FULL, VALUE_TOO_LARGE, WAIT_TIMED_OUT, } = CLI;
151
- export const { BUILD_NOT_PUBLISHED, BUILD_RATE_LIMITED, FUNCTION_INVALID, FUNCTION_TOO_LARGE, GAME_HANDLE_CHANGED, GAME_LIMIT_REACHED, GAME_MISMATCH, GAME_UNAVAILABLE, GITHUB_APP_NOT_INSTALLED, INTERNAL, MANIFEST_INVALID, PACKAGE_FILE_TOO_LARGE, PACKAGE_PATH_INVALID, PACKAGE_PATH_RESERVED, PACKAGE_TOO_MANY_FILES, PACKAGE_UNCOMPRESSED_TOO_LARGE, RELEASE_EXPIRED, REPO_NOT_CONNECTED, VERSION_EXISTS, VERSION_MISMATCH, ZIP_INVALID, ZIP_MISSING, ZIP_TOO_LARGE, } = RELEASE;
152
- export const { GIT_TAG_INVALID, WORKFLOW_MISSING } = GITHUB;
153
+ export const { API_REFUSED, API_UNREACHABLE, ARGUMENT_INVALID, BUILD_FAILED, DEPLOY_DIR_MISSING, DEPLOY_RATE_LIMITED, FUNCTION_LOGS_FOLLOWS_FULL, FUNCTION_MAIN_MISSING, FUNCTION_NOT_BUILT, FUNCTION_PAUSE_NOT_OWNED, GAME_HANDLE_TAKEN, GAME_ID_MISSING, GAME_NOT_DEPLOYED, GIT_REMOTE_MISSING, GIT_REMOTE_UNREACHABLE, GIT_REPO_MISSING, GIT_TAG_CREATE_FAILED, GIT_TAG_EXISTS, GIT_TAG_PUSH_FAILED, GIT_UNCOMMITTED, KEY_NOT_FOUND, KEY_QUOTA_FULL, LIMIT_REACHED, LOCKFILE_MISSING, LOGIN_CODE_EXPIRED, LOGIN_FAILED, MANIFEST_MISSING, NOT_LOGGED_IN, PACKAGE_INDEX_MISSING, PACKAGE_LINK_INVALID, PACKAGE_TOO_LARGE, PARSE_FAILED, PATH_NOT_FOUND, PORT_IN_USE, PROJECT_NOT_REPO_ROOT, SECRET_NOT_FOUND, SECRET_QUOTA_FULL, SECRET_TOO_LARGE, SESSION_EXPIRED, TEMPLATE_NOT_FOUND, UNAVAILABLE, UNEXPECTED, UPLOAD_FAILED, VALIDATION_FAILED, VALUE_NOT_FOUND, VALUE_STORAGE_QUOTA_FULL, VALUE_TOO_LARGE, WAIT_TIMED_OUT, } = CLI;
154
+ export const { ACCOUNT_NOT_FOUND, BUILD_NOT_PUBLISHED, BUILD_RATE_LIMITED, FUNCTION_INVALID, FUNCTION_TOO_LARGE, GAME_HANDLE_CHANGED, GAME_MISMATCH, GAME_NOT_FOUND, GAME_QUOTA_FULL, GIT_RELEASE_NOT_FOUND, GITHUB_APP_NOT_INSTALLED, INTERNAL, MANIFEST_INVALID, MANIFEST_TOO_LARGE, PACKAGE_FILE_TOO_LARGE, PACKAGE_PATH_INVALID, PACKAGE_PATH_RESERVED, PACKAGE_TOO_MANY_FILES, PACKAGE_UNCOMPRESSED_TOO_LARGE, RELEASE_TIMED_OUT, REPO_NOT_CONNECTED, VERSION_EXISTS, VERSION_MISMATCH, ZIP_INVALID, ZIP_MISSING, ZIP_TOO_LARGE, } = RELEASE;
155
+ export const { GIT_TAG_INVALID, GITHUB_APP_NOT_CONNECTED, WORKFLOW_MISSING } = GITHUB;
@@ -0,0 +1,105 @@
1
+ // whether to try again, for each code a failure can have (ERRORS.md,
2
+ // Rules): `yes`, the same command after a moment; `later`, the same
3
+ // command once something outside it changes (a window renews, one is
4
+ // freed, you log in, a repository is connected); `no`, not as it is: the
5
+ // command, or the project it reads, has to change. It's `error.retry` with
6
+ // `--json`, so a script or an agent has its next step without knowing the
7
+ // code. A release's reasons are ERRORS.md's, held to its table
8
+ // (test/docs/retry.test.js).
9
+ // [import]
10
+ import * as code from "./code.js";
11
+ // [declare]
12
+ export const RETRY = {
13
+ // the CLI's own
14
+ [code.API_REFUSED]: "no",
15
+ [code.API_UNREACHABLE]: "yes",
16
+ [code.ARGUMENT_INVALID]: "no",
17
+ [code.BUILD_FAILED]: "no",
18
+ [code.DEPLOY_DIR_MISSING]: "no",
19
+ [code.DEPLOY_RATE_LIMITED]: "later",
20
+ [code.FUNCTION_LOGS_FOLLOWS_FULL]: "later",
21
+ [code.FUNCTION_MAIN_MISSING]: "no",
22
+ [code.FUNCTION_NOT_BUILT]: "no",
23
+ [code.FUNCTION_PAUSE_NOT_OWNED]: "no",
24
+ [code.GAME_HANDLE_TAKEN]: "no",
25
+ [code.GAME_ID_MISSING]: "no",
26
+ [code.GAME_NOT_DEPLOYED]: "later",
27
+ [code.GAME_NOT_FOUND]: "no",
28
+ [code.GIT_REMOTE_MISSING]: "no",
29
+ [code.GIT_REMOTE_UNREACHABLE]: "yes",
30
+ [code.GIT_REPO_MISSING]: "no",
31
+ [code.GIT_TAG_CREATE_FAILED]: "no",
32
+ [code.GIT_TAG_EXISTS]: "no",
33
+ [code.GIT_TAG_PUSH_FAILED]: "no",
34
+ [code.GIT_UNCOMMITTED]: "no",
35
+ [code.KEY_NOT_FOUND]: "no",
36
+ [code.KEY_QUOTA_FULL]: "later",
37
+ [code.LIMIT_REACHED]: "later",
38
+ [code.LOCKFILE_MISSING]: "no",
39
+ [code.LOGIN_CODE_EXPIRED]: "later",
40
+ [code.LOGIN_FAILED]: "yes",
41
+ [code.MANIFEST_MISSING]: "no",
42
+ [code.NOT_LOGGED_IN]: "later",
43
+ [code.PACKAGE_INDEX_MISSING]: "no",
44
+ [code.PACKAGE_LINK_INVALID]: "no",
45
+ [code.PACKAGE_TOO_LARGE]: "no",
46
+ [code.PARSE_FAILED]: "no",
47
+ [code.PATH_NOT_FOUND]: "no",
48
+ [code.PORT_IN_USE]: "later",
49
+ [code.PROJECT_NOT_REPO_ROOT]: "no",
50
+ [code.SECRET_NOT_FOUND]: "no",
51
+ [code.SECRET_QUOTA_FULL]: "later",
52
+ [code.SECRET_TOO_LARGE]: "no",
53
+ [code.SESSION_EXPIRED]: "later",
54
+ [code.TEMPLATE_NOT_FOUND]: "no",
55
+ [code.UNAVAILABLE]: "yes",
56
+ [code.UNEXPECTED]: "no",
57
+ [code.UPLOAD_FAILED]: "later",
58
+ [code.VALIDATION_FAILED]: "no",
59
+ [code.VALUE_NOT_FOUND]: "no",
60
+ [code.VALUE_STORAGE_QUOTA_FULL]: "later",
61
+ [code.VALUE_TOO_LARGE]: "no",
62
+ [code.WAIT_TIMED_OUT]: "later",
63
+ // a release's reasons
64
+ [code.ACCOUNT_NOT_FOUND]: "no",
65
+ [code.BUILD_NOT_PUBLISHED]: "no",
66
+ [code.BUILD_RATE_LIMITED]: "later",
67
+ [code.FUNCTION_INVALID]: "no",
68
+ [code.FUNCTION_TOO_LARGE]: "no",
69
+ [code.GAME_HANDLE_CHANGED]: "no",
70
+ [code.GAME_MISMATCH]: "no",
71
+ [code.GAME_QUOTA_FULL]: "later",
72
+ [code.GIT_RELEASE_NOT_FOUND]: "no",
73
+ [code.GITHUB_APP_NOT_INSTALLED]: "later",
74
+ [code.INTERNAL]: "yes",
75
+ [code.MANIFEST_INVALID]: "no",
76
+ [code.MANIFEST_TOO_LARGE]: "no",
77
+ [code.PACKAGE_FILE_TOO_LARGE]: "no",
78
+ [code.PACKAGE_PATH_INVALID]: "no",
79
+ [code.PACKAGE_PATH_RESERVED]: "no",
80
+ [code.PACKAGE_TOO_MANY_FILES]: "no",
81
+ [code.PACKAGE_UNCOMPRESSED_TOO_LARGE]: "no",
82
+ [code.RELEASE_TIMED_OUT]: "yes",
83
+ [code.REPO_NOT_CONNECTED]: "later",
84
+ [code.RELEASE.SERVERS_CHANGED]: "no",
85
+ [code.VERSION_EXISTS]: "no",
86
+ [code.VERSION_MISMATCH]: "no",
87
+ [code.ZIP_INVALID]: "no",
88
+ [code.ZIP_MISSING]: "no",
89
+ [code.ZIP_TOO_LARGE]: "no",
90
+ // the GitHub check's own
91
+ [code.GIT_TAG_INVALID]: "no",
92
+ [code.GITHUB_APP_NOT_CONNECTED]: "later",
93
+ [code.WORKFLOW_MISSING]: "no",
94
+ };
95
+ // [function]
96
+ // whether a word is one of the three.
97
+ export function isRetry(said) {
98
+ return said === "yes" || said === "later" || said === "no";
99
+ }
100
+ // [function]
101
+ // a code's retry: its own, or `no` for one this CLI doesn't know (a
102
+ // release's reason the API added since), which is a failure as it stands.
103
+ export function retryOf(shown) {
104
+ return RETRY[shown] ?? "no";
105
+ }
@@ -62,8 +62,8 @@ export function repoNotConnected(game, repo, url) {
62
62
  return blocks(`${repo} isn't ${game}'s repository on ${TITLE}.`, [`Connect it on the game's Repository tab in ${TITLE} Studio:`, url], "If it was renamed on GitHub, connect it again.");
63
63
  }
64
64
  // [function]
65
- export function gameUnavailable(id) {
66
- return blocks(`Game unavailable: ${id}\nIt was deleted, or belongs to another account.`, "Give game.id a new UUID to deploy it as a new game.");
65
+ export function gameDeletedOrNotOwned(id) {
66
+ return blocks(`Game not found: ${id}\nIt was deleted, or belongs to another account.`, "Give game.id a new UUID to deploy it as a new game.");
67
67
  }
68
68
  // [function]
69
69
  export function gitUncommitted() {
@@ -123,7 +123,7 @@ export function secretNone() {
123
123
  }
124
124
  // [function]
125
125
  // the most secrets a game has for a channel, when one more is asked for.
126
- export function secretLimitReached(channel) {
126
+ export function secretQuotaFull(channel) {
127
127
  return blocks(`Sixteen secrets already for ${channel}.`, "Remove one with `arc unstable function secret remove <name>`, then try again.");
128
128
  }
129
129
  // [function]
@@ -199,7 +199,7 @@ export function functionLogsVersionInvalid(text) {
199
199
  }
200
200
  // [function]
201
201
  // a sixth follow of a game's logs, while five are open.
202
- export function functionLogsBusy() {
202
+ export function functionLogsFull() {
203
203
  return blocks("The game's logs are followed five times already.", "Stop one of them, then try again.");
204
204
  }
205
205
  // [function]
@@ -25,5 +25,5 @@ export function gameDeletedProject() {
25
25
  // that isn't on Arcadible, one that's deleted already, and another account's
26
26
  // are the same.
27
27
  export function gameNotOwned(id) {
28
- return blocks(`Game unavailable: ${id}\nIt was never deployed, was deleted, or belongs to another account.`, `${cmdWhoami()} shows the account you're logged in to.`);
28
+ return blocks(`Game not found: ${id}\nIt was never deployed, was deleted, or belongs to another account.`, `${cmdWhoami()} shows the account you're logged in to.`);
29
29
  }
@@ -45,8 +45,14 @@ export function starterThreeJs() {
45
45
  return "Three.js starter.";
46
46
  }
47
47
  // [function]
48
+ // a template's download that got no response: offline, or GitHub not
49
+ // reached.
50
+ export function templateUnreachable(template) {
51
+ return blocks(`Unable to reach GitHub to download template ${template}.`, "Check your internet connection, and try again.");
52
+ }
53
+ // [function]
48
54
  // `starter` is the starter its name suggests.
49
- export function templateUnavailable(template, starter) {
55
+ export function templateNotFound(template, starter) {
50
56
  return blocks(`Unable to download template ${template}.`, starter
51
57
  ? `Did you mean: ${starter}?`
52
58
  : "Check that it's a public GitHub repository, or a folder in one.");
@@ -1,7 +1,7 @@
1
1
  // arc build and arc pack: the build, and the package's limits.
2
2
  // [import]
3
3
  import { MEDIA } from "../config/file.js";
4
- import { blocks, cmdBuild, tail } from "./internal.js";
4
+ import { blocks, cmdBuild, cmdValidate, tail } from "./internal.js";
5
5
  import { handle, title } from "../config/product.js";
6
6
  // [declare]
7
7
  const HANDLE = handle;
@@ -48,6 +48,11 @@ export function deployDirMissing(dir) {
48
48
  return blocks(`Unable to find deploy_dir: ${dir}`, `Run ${cmdBuild()}, or set deploy_dir to the folder your build writes.`);
49
49
  }
50
50
  // [function]
51
+ // arc serve's deploy_dir that isn't text, which it reads without validating.
52
+ export function deployDirNotPath(dir) {
53
+ return blocks(`deploy_dir isn't a folder's path: ${dir}`, `Run ${cmdValidate()} to check arcadible.toml.`);
54
+ }
55
+ // [function]
51
56
  export function packed() {
52
57
  return "Packed.";
53
58
  }
@@ -16,7 +16,7 @@ export function keyNone() {
16
16
  }
17
17
  // [function]
18
18
  // the most keys a game has for a channel, when one more is asked for.
19
- export function keyLimitReached(channel) {
19
+ export function keyQuotaFull(channel) {
20
20
  return blocks(`Five keys already for ${channel}.`, "Revoke one with `arc unstable server key revoke <id>`, then try again.");
21
21
  }
22
22
  // [function]
@@ -11,7 +11,7 @@ import { join, resolve } from "node:path";
11
11
  import { build } from "esbuild";
12
12
  import { pathExists } from "fs-extra";
13
13
  // [import]
14
- import { BUILD_FAILED, FUNCTION_TOO_LARGE } from "../config/code.js";
14
+ import { BUILD_FAILED, FUNCTION_MAIN_MISSING, FUNCTION_TOO_LARGE, } from "../config/code.js";
15
15
  import { FUNCTION_SIZE } from "../config/limit.js";
16
16
  import * as phrase from "../phrase/index.js";
17
17
  import { ArcError } from "../util/error.js";
@@ -44,7 +44,7 @@ export const WRONG = {
44
44
  // changes, wherever it is (a game's rules its function shares).
45
45
  export async function bundle({ main, onInputs, onPackages, outfile, }) {
46
46
  if (!(await pathExists(main))) {
47
- throw new ArcError(BUILD_FAILED, phrase.runnerMissing(main));
47
+ throw new ArcError(FUNCTION_MAIN_MISSING, phrase.runnerMissing(main));
48
48
  }
49
49
  let inputs;
50
50
  try {
@@ -53,6 +53,8 @@ export function refuse(url) {
53
53
  message: arcadible
54
54
  ? `The function may not call ${host} itself. Arcadible is reached through the Function SDK (@arcadible/function-sdk), which needs no host declared.`
55
55
  : `The function may not call ${host}. To allow it, add it to function.outbound_hosts in arcadible.toml, as a name reached over HTTPS.`,
56
+ // not as it is: the build's hosts don't change (ERRORS.md, The shape)
57
+ retry: "no",
56
58
  }, { status: STATUS });
57
59
  }
58
60
  // [function]
@@ -322,7 +322,7 @@ function zGallery(root) {
322
322
  for (const group of repeated(files)) {
323
323
  ctx.addIssue({
324
324
  code: "custom",
325
- ...message(field, screenshotNumberRepeated(group), ISSUE.SCREENSHOT_NUMBER_REPEATED),
325
+ ...message(field, screenshotNumberRepeated(group), ISSUE.SCREENSHOT_NUMBER_DUPLICATE),
326
326
  });
327
327
  }
328
328
  }));
@@ -0,0 +1,79 @@
1
+ // What each of `arc serve`'s refusals says to a person, beside its code and
2
+ // retry, as Arcadible's own part says it (ERRORS.md, The shape): the
3
+ // dispatcher's words for the function's, the wires' Worker's for a wire's,
4
+ // and the API's for the page's own API and the server API, which the play
5
+ // site passes on as they came. Each table has the codes `arc serve`
6
+ // answers with, in its source's words. Never matched on; each is held to
7
+ // its source (test/unit/serve/message.test.mjs).
8
+ // [declare]
9
+ // the dispatcher's (app/src/cloudflare/io-arcadible-runner-dispatch,
10
+ // dispatch.js's MESSAGES).
11
+ const RUNNER = {
12
+ expired: "The ticket's time ran out. Get a new one, and try again.",
13
+ function_failed: "The game's function failed: it threw, or went past what it may use.",
14
+ invalid: "The request's body couldn't be read.",
15
+ no_function: "This build has no function.",
16
+ too_large: "The request's body is over 1 MB.",
17
+ unauthorized: "The request has no ticket Arcadible takes for this build.",
18
+ };
19
+ // the wires' Worker's, to a game (app/src/cloudflare/io-arcadible-wires,
20
+ // wires.js's MESSAGES).
21
+ const WIRES = {
22
+ denied: "A guest Arcadible has given no id can't be on a wire.",
23
+ expired: "The ticket's time ran out. Get a new one, and try again.",
24
+ unauthorized: "The request has no ticket Arcadible takes for this build.",
25
+ };
26
+ // the Worker's words by status, for a code it says more than one way: its
27
+ // `invalid` (its INVALID), the first for a status it has none for.
28
+ const WIRES_BY_STATUS = {
29
+ invalid: {
30
+ 400: "This address takes a connection to a wire.",
31
+ 405: "A wire is opened with a POST.",
32
+ },
33
+ };
34
+ // the API's (app/src/web/arcadible-api/app/result.py's MESSAGES), for the
35
+ // codes `arc serve`'s page and server API answer with; and the ticket
36
+ // check's, for a ticket it doesn't take (app/api/server.py's
37
+ // TICKET_REFUSED).
38
+ const API = {
39
+ conflict: "This was changed since it was read, and nothing was written. Read it again, then write.",
40
+ denied: "This account or game isn't allowed to do this.",
41
+ full: "This holds all it may. Free some space, then try again.",
42
+ invalid: "This request isn't one the API takes. Check it against the API's docs, then send it again.",
43
+ not_found: "Not found: it isn't there, or it isn't this caller's to see.",
44
+ too_large: "This is past its size. Make it smaller, then send it again.",
45
+ too_many: "This names more items than one call takes. Split it into smaller calls.",
46
+ };
47
+ const TICKET_REFUSED = {
48
+ expired: "The ticket's time ran out. The game gets a new one, and sends it again.",
49
+ unauthorized: "The ticket isn't one Arcadible signed for this server, game, and channel.",
50
+ };
51
+ // what any of them says of a code it has no words for, as the Workers do.
52
+ const REFUSED = "Arcadible refused the request.";
53
+ // [function]
54
+ /** What the function's refusal with this code says, as the dispatcher's. */
55
+ export function runnerMessage(code) {
56
+ return RUNNER[code] ?? REFUSED;
57
+ }
58
+ // [function]
59
+ /** What a wire's refusal with this status and code says, as the Worker's. */
60
+ export function wiresMessage(status, code) {
61
+ const byStatus = WIRES_BY_STATUS[code];
62
+ if (byStatus) {
63
+ return byStatus[status] ?? Object.values(byStatus)[0] ?? REFUSED;
64
+ }
65
+ return WIRES[code] ?? REFUSED;
66
+ }
67
+ // [function]
68
+ /** What the page's API, or the server API, says of a code, as the API's. */
69
+ export function apiMessage(code) {
70
+ return API[code] ?? REFUSED;
71
+ }
72
+ // [function]
73
+ /**
74
+ * What the ticket check says of a ticket it doesn't take, as the API's: a
75
+ * code it has no words for is said as one it doesn't take.
76
+ */
77
+ export function ticketMessage(code) {
78
+ return TICKET_REFUSED[code] ?? TICKET_REFUSED.unauthorized ?? REFUSED;
79
+ }