arcadible 1.0.48 → 1.0.50
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.
- package/README.md +5 -1
- package/dist/action/deploy/result.js +3 -3
- package/dist/action/deploy/tool-git.js +1 -1
- package/dist/action/deploy/tool.js +1 -1
- package/dist/action/deploy/wait.js +1 -1
- package/dist/action/function/logs.js +6 -4
- package/dist/action/function/tool.js +11 -10
- package/dist/action/key/tool.js +10 -4
- package/dist/action/secret/tool.js +2 -1
- package/dist/action/validate/unknown.js +1 -1
- package/dist/action/value/local.js +78 -0
- package/dist/action/value/tool.js +65 -27
- package/dist/action/wire/tool.js +1 -1
- package/dist/cli/command.js +13 -1
- package/dist/cli/options.js +7 -0
- package/dist/cli/prompt.js +1 -1
- package/dist/command/deploy/report.js +5 -5
- package/dist/command/function/index.js +2 -3
- package/dist/command/function/logs.js +4 -4
- package/dist/command/function/pause.js +1 -1
- package/dist/command/function/resume.js +1 -1
- package/dist/command/function/run.js +1 -1
- package/dist/command/function/secret/index.js +1 -1
- package/dist/command/function/secret/list.js +2 -1
- package/dist/command/function/secret/remove.js +2 -2
- package/dist/command/function/secret/run.js +1 -1
- package/dist/command/function/secret/set.js +1 -1
- package/dist/command/function/status.js +11 -11
- package/dist/command/game/delete.js +2 -2
- package/dist/command/game/index.js +2 -2
- package/dist/command/open.js +1 -1
- package/dist/command/play.js +1 -1
- package/dist/command/server/index.js +3 -3
- package/dist/command/server/key/create.js +4 -4
- package/dist/command/server/key/index.js +1 -1
- package/dist/command/server/key/list.js +3 -2
- package/dist/command/server/key/revoke.js +1 -1
- package/dist/command/server/key/run.js +1 -1
- package/dist/command/unstable/index.js +8 -13
- package/dist/command/value/get.js +12 -8
- package/dist/command/value/index.js +4 -4
- package/dist/command/value/list.js +14 -6
- package/dist/command/value/remove.js +22 -11
- package/dist/command/value/run.js +40 -0
- package/dist/command/value/set.js +27 -22
- package/dist/command/value/usage.js +34 -30
- package/dist/command/wire/index.js +1 -2
- package/dist/commands.js +28 -0
- package/dist/config/code.js +4 -2
- package/dist/config/limit.js +5 -5
- package/dist/config/retry.js +2 -0
- package/dist/parser/project.js +2 -1
- package/dist/phrase/common.js +12 -6
- package/dist/phrase/deploy.js +4 -3
- package/dist/phrase/function.js +27 -21
- package/dist/phrase/game.js +3 -3
- package/dist/phrase/pack.js +4 -1
- package/dist/phrase/serve.js +2 -2
- package/dist/phrase/server.js +10 -5
- package/dist/phrase/value.js +50 -16
- package/dist/schema/client.js +11 -6
- package/dist/serve/values.js +2 -2
- package/dist/util/output.js +11 -4
- package/dist/util/request.js +17 -7
- package/dist/util/s3.js +10 -2
- package/dist/util/schema.js +5 -3
- package/dist/util/time.js +5 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
package/dist/commands.js
CHANGED
|
@@ -73,6 +73,34 @@ export const COMMANDS = [
|
|
|
73
73
|
summary: `Log out of ${title}`,
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
+
load: () => import("./command/game/index.js"),
|
|
77
|
+
name: "game",
|
|
78
|
+
summary: "Delete the project's game on Arcadible",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
load: () => import("./command/function/index.js"),
|
|
82
|
+
name: "function",
|
|
83
|
+
summary: "Pause, resume, and show the game's function, its logs, and its secrets",
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
load: () => import("./command/server/index.js"),
|
|
87
|
+
name: "server",
|
|
88
|
+
summary: "Make, list, and revoke your server's keys",
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
load: () => import("./command/value/index.js"),
|
|
92
|
+
name: "value",
|
|
93
|
+
summary: "Set, get, list, and remove the values you publish for the game",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
load: () => import("./command/wire/index.js"),
|
|
97
|
+
name: "wire",
|
|
98
|
+
summary: "Show what the game's wires carried",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
// kept, hidden and empty, for the next command that isn't settled
|
|
102
|
+
// (OUTPUT.md, Unstable commands)
|
|
103
|
+
hidden: true,
|
|
76
104
|
load: () => import("./command/unstable/index.js"),
|
|
77
105
|
name: "unstable",
|
|
78
106
|
summary: "Use commands that aren't stable yet",
|
package/dist/config/code.js
CHANGED
|
@@ -25,6 +25,7 @@ const CLI = {
|
|
|
25
25
|
GIT_TAG_EXISTS: "git_tag_exists",
|
|
26
26
|
GIT_TAG_PUSH_FAILED: "git_tag_push_failed",
|
|
27
27
|
GIT_UNCOMMITTED: "git_uncommitted",
|
|
28
|
+
KEY_CREATE_RATE_LIMITED: "key_create_rate_limited",
|
|
28
29
|
KEY_NOT_FOUND: "key_not_found",
|
|
29
30
|
KEY_QUOTA_FULL: "key_quota_full",
|
|
30
31
|
LIMIT_REACHED: "limit_reached",
|
|
@@ -65,6 +66,7 @@ export const RELEASE = {
|
|
|
65
66
|
BUILD_RATE_LIMITED: "build_rate_limited",
|
|
66
67
|
FUNCTION_INVALID: "function_invalid",
|
|
67
68
|
FUNCTION_TOO_LARGE: "function_too_large",
|
|
69
|
+
GAME_CREATE_RATE_LIMITED: "game_create_rate_limited",
|
|
68
70
|
GAME_HANDLE_CHANGED: "game_handle_changed",
|
|
69
71
|
GAME_MISMATCH: "game_mismatch",
|
|
70
72
|
GAME_NOT_FOUND: "game_not_found",
|
|
@@ -149,6 +151,6 @@ export const ISSUES = new Set(Object.values(ISSUE));
|
|
|
149
151
|
export const WARNINGS = new Set(Object.values(WARNING));
|
|
150
152
|
// [declare]
|
|
151
153
|
// each error code by its own name too: `cfgcode.NOT_LOGGED_IN`.
|
|
152
|
-
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;
|
|
153
|
-
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;
|
|
154
|
+
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_CREATE_RATE_LIMITED, 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;
|
|
155
|
+
export const { ACCOUNT_NOT_FOUND, BUILD_NOT_PUBLISHED, BUILD_RATE_LIMITED, FUNCTION_INVALID, FUNCTION_TOO_LARGE, GAME_CREATE_RATE_LIMITED, 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;
|
|
154
156
|
export const { GIT_TAG_INVALID, GITHUB_APP_NOT_CONNECTED, WORKFLOW_MISSING } = GITHUB;
|
package/dist/config/limit.js
CHANGED
|
@@ -18,11 +18,11 @@ export const TOTAL_SIZE = 256 * MB;
|
|
|
18
18
|
export const ZIP_SIZE = 64 * MB;
|
|
19
19
|
// a function's bundle, as Arcadible runs it (the subscriber's RUNNER_MAX).
|
|
20
20
|
export const FUNCTION_SIZE = 1 * MB;
|
|
21
|
-
// a secret's name, as the API, the database
|
|
22
|
-
// and the subscriber hold it:
|
|
23
|
-
// with a letter, 64 at most;
|
|
24
|
-
// manifest's [function] secrets
|
|
25
|
-
// this one.
|
|
21
|
+
// a secret's name, as the API, the database
|
|
22
|
+
// (chk_game_function_secret_name_is_valid), and the subscriber hold it:
|
|
23
|
+
// capitals, digits, and underscores, starting with a letter, 64 at most;
|
|
24
|
+
// ARCADIBLE_ is kept for Arcadible's own. The manifest's [function] secrets
|
|
25
|
+
// and `arc function secret` both take this one.
|
|
26
26
|
export const SECRET_NAME = /^(?!ARCADIBLE_)[A-Z][A-Z0-9_]{0,63}$/u;
|
|
27
27
|
// the most secrets a game's channel holds (api_put_game_function_secret), so
|
|
28
28
|
// the most a function may declare.
|
package/dist/config/retry.js
CHANGED
|
@@ -32,6 +32,7 @@ export const RETRY = {
|
|
|
32
32
|
[code.GIT_TAG_EXISTS]: "no",
|
|
33
33
|
[code.GIT_TAG_PUSH_FAILED]: "no",
|
|
34
34
|
[code.GIT_UNCOMMITTED]: "no",
|
|
35
|
+
[code.KEY_CREATE_RATE_LIMITED]: "later",
|
|
35
36
|
[code.KEY_NOT_FOUND]: "no",
|
|
36
37
|
[code.KEY_QUOTA_FULL]: "later",
|
|
37
38
|
[code.LIMIT_REACHED]: "later",
|
|
@@ -66,6 +67,7 @@ export const RETRY = {
|
|
|
66
67
|
[code.BUILD_RATE_LIMITED]: "later",
|
|
67
68
|
[code.FUNCTION_INVALID]: "no",
|
|
68
69
|
[code.FUNCTION_TOO_LARGE]: "no",
|
|
70
|
+
[code.GAME_CREATE_RATE_LIMITED]: "later",
|
|
69
71
|
[code.GAME_HANDLE_CHANGED]: "no",
|
|
70
72
|
[code.GAME_MISMATCH]: "no",
|
|
71
73
|
[code.GAME_QUOTA_FULL]: "later",
|
package/dist/parser/project.js
CHANGED
|
@@ -72,7 +72,8 @@ function nearestAbove(dir) {
|
|
|
72
72
|
// fails when `root` has no manifest. A game's id is only ever in it, so a
|
|
73
73
|
// project without one can't be deployed, and the likeliest cause is running
|
|
74
74
|
// arc from inside a project: the hint names the project above, if any.
|
|
75
|
-
|
|
75
|
+
// `arc value`'s commands ask it too, on the project's own values.
|
|
76
|
+
export function ensureManifest(root) {
|
|
76
77
|
return pathExists(join(root, MANIFEST))
|
|
77
78
|
.then((exists) => exists ? false : nearestAbove(root))
|
|
78
79
|
.then((found) => {
|
package/dist/phrase/common.js
CHANGED
|
@@ -72,13 +72,22 @@ export function pressEnterToOpen() {
|
|
|
72
72
|
return "Press Enter to open the link.";
|
|
73
73
|
}
|
|
74
74
|
// [function]
|
|
75
|
+
// a game that isn't there to its caller, as every command says it: one
|
|
76
|
+
// never deployed, one deleted, and another account's are the same to anyone
|
|
77
|
+
// but its owner (OUTPUT.md). A command adds what to do in its details.
|
|
75
78
|
export function gameNotFound(idOrHandle) {
|
|
76
|
-
return `Game not found: ${idOrHandle}
|
|
79
|
+
return `Game not found: ${idOrHandle}\nIt was never deployed, was deleted, or belongs to another account.`;
|
|
77
80
|
}
|
|
78
81
|
// [function]
|
|
79
82
|
export function httpError(name, status, detail) {
|
|
80
83
|
const head = `${name} (${status})`;
|
|
81
|
-
|
|
84
|
+
if (!detail) {
|
|
85
|
+
return `${head}.`;
|
|
86
|
+
}
|
|
87
|
+
// the API's message, a sentence a line: what happened under the status,
|
|
88
|
+
// then what to do, after a blank line (OUTPUT.md)
|
|
89
|
+
const [said = "", ...next] = detail.trim().split(/(?<=[.!?])\s+(?=[A-Z`])/u);
|
|
90
|
+
return next.length ? blocks(`${head}\n${said}`, next) : `${head}\n${said}`;
|
|
82
91
|
}
|
|
83
92
|
// [function]
|
|
84
93
|
// no game: a command that takes one (`arc play`, `arc open`) says to pass
|
|
@@ -135,8 +144,5 @@ export function unableToReach() {
|
|
|
135
144
|
// an answer of the API's that isn't what this version reads: a newer
|
|
136
145
|
// Arcadible than this arc, most likely.
|
|
137
146
|
export function answerUnread(what) {
|
|
138
|
-
return
|
|
139
|
-
`Unable to read ${TITLE}'s answer for ${what}.`,
|
|
140
|
-
"This arc may be out of date. Update it with `npm install -g arcadible`.",
|
|
141
|
-
].join("\n");
|
|
147
|
+
return blocks(`Unable to read ${TITLE}'s answer for ${what}.\nThis arc may be out of date.`, "Update it with `npm install -g arcadible`.");
|
|
142
148
|
}
|
package/dist/phrase/deploy.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// a release.
|
|
3
3
|
// [import]
|
|
4
4
|
import { MANIFEST } from "../config/file.js";
|
|
5
|
+
import { gameNotFound } from "./common.js";
|
|
5
6
|
import { blocks, cmdDeploy, cmdDeployGit, tail, waited } from "./internal.js";
|
|
6
7
|
import { title } from "../config/product.js";
|
|
7
8
|
// [declare]
|
|
@@ -63,7 +64,7 @@ export function repoNotConnected(game, repo, url) {
|
|
|
63
64
|
}
|
|
64
65
|
// [function]
|
|
65
66
|
export function gameDeletedOrNotOwned(id) {
|
|
66
|
-
return blocks(
|
|
67
|
+
return blocks(gameNotFound(id), "Give game.id a new UUID to deploy it as a new game.");
|
|
67
68
|
}
|
|
68
69
|
// [function]
|
|
69
70
|
export function gitUncommitted() {
|
|
@@ -132,8 +133,8 @@ export function releasePublished(version, channel, built) {
|
|
|
132
133
|
export function releaseTimedOut(version, seconds, { actions, found, git, studio, }) {
|
|
133
134
|
const head = `Waited ${waited(seconds)} for v${version}.`;
|
|
134
135
|
if (found || !git) {
|
|
135
|
-
return blocks(head
|
|
136
|
-
`
|
|
136
|
+
return blocks(`${head}\nIt may still finish.`, [
|
|
137
|
+
`See it in ${TITLE} Studio:`,
|
|
137
138
|
studio,
|
|
138
139
|
]);
|
|
139
140
|
}
|
package/dist/phrase/function.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// a game's function: `arc
|
|
1
|
+
// a game's function: `arc function`, its secrets, and the function as arc
|
|
2
2
|
// build and arc serve run it.
|
|
3
3
|
// [import]
|
|
4
4
|
import { blocks } from "./internal.js";
|
|
@@ -17,9 +17,9 @@ export function secretRemoveQuestion({ channel, name, }) {
|
|
|
17
17
|
// a paused function, or a pause on a channel with no function to stop.
|
|
18
18
|
export function functionPaused({ channel, function: has, }) {
|
|
19
19
|
if (has === false) {
|
|
20
|
-
return blocks(`Paused ${channel}, which has no function yet.`, `A release with one stays stopped until \`arc
|
|
20
|
+
return blocks(`Paused ${channel}, which has no function yet.`, `A release with one stays stopped until \`arc function resume --${channel}\`.`);
|
|
21
21
|
}
|
|
22
|
-
return `Paused the game's function on ${channel}
|
|
22
|
+
return `Paused the game's function on ${channel}.\nIt stops answering within a minute.`;
|
|
23
23
|
}
|
|
24
24
|
// [function]
|
|
25
25
|
// why a function is paused, as a status says it. A limit's pause ends by
|
|
@@ -55,7 +55,7 @@ export function functionResumed({ channel, lifted, paused, }) {
|
|
|
55
55
|
if (paused) {
|
|
56
56
|
return blocks(`Lifted your pause on ${channel}.`, `The game's function stays paused: ${functionPause(paused)}.`);
|
|
57
57
|
}
|
|
58
|
-
return `Resumed the game's function on ${channel}
|
|
58
|
+
return `Resumed the game's function on ${channel}.\nIt answers again within a minute.`;
|
|
59
59
|
}
|
|
60
60
|
// [function]
|
|
61
61
|
// what holds a game's function, as a status says it under its channels:
|
|
@@ -63,17 +63,20 @@ export function functionResumed({ channel, lifted, paused, }) {
|
|
|
63
63
|
// month and its account's, every game's together, against its plan's, then
|
|
64
64
|
// the CPU time of both, which no limit holds. Each number is the API's;
|
|
65
65
|
// null is no limit.
|
|
66
|
-
export function functionUsage({
|
|
67
|
-
const
|
|
68
|
-
? `${
|
|
69
|
-
: `${
|
|
70
|
-
const
|
|
71
|
-
? `Your account's games together: ${
|
|
72
|
-
: `Your account's games together: ${
|
|
73
|
-
const cpu = month.cpu &&
|
|
74
|
-
?
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
export function functionUsage({ account, month, today, }) {
|
|
67
|
+
const day = today.allowance === null
|
|
68
|
+
? `${today.requests} requests today, with no limit for a day`
|
|
69
|
+
: `${today.requests} of ${today.allowance} requests today, both channels together`;
|
|
70
|
+
const all = account.allowance === null
|
|
71
|
+
? ` Your account's games together: ${account.requests}, with no limit`
|
|
72
|
+
: ` Your account's games together: ${account.requests} of ${account.allowance}`;
|
|
73
|
+
const cpu = month.cpu && account.cpu
|
|
74
|
+
? [
|
|
75
|
+
`CPU time this month: ${month.cpu}`,
|
|
76
|
+
` Your account's games together: ${account.cpu}`,
|
|
77
|
+
]
|
|
78
|
+
: [];
|
|
79
|
+
return [day, `${month.requests} requests this month`, all, ...cpu].join("\n");
|
|
77
80
|
}
|
|
78
81
|
// [function]
|
|
79
82
|
// a function's CPU time, given in milliseconds, as it's read: "640 ms",
|
|
@@ -99,19 +102,22 @@ export function functionPauseNotOwned({ channel, paused, }) {
|
|
|
99
102
|
return blocks(`The game's function is paused by Arcadible on ${channel}.`, "Only Arcadible can resume it.");
|
|
100
103
|
}
|
|
101
104
|
if (paused === "limit") {
|
|
102
|
-
return blocks(`The game's function is at a limit on ${channel}.`,
|
|
105
|
+
return blocks(`The game's function is at a limit on ${channel}.`, [
|
|
106
|
+
"It resumes by itself as the day or the month turns (UTC).",
|
|
107
|
+
"`arc function status` says when.",
|
|
108
|
+
]);
|
|
103
109
|
}
|
|
104
110
|
return `The game's function is paused on ${channel}, and not by you.`;
|
|
105
111
|
}
|
|
106
112
|
// [function]
|
|
107
113
|
export function secretSet({ channel, name, }) {
|
|
108
|
-
return `Set ${name} for ${channel}
|
|
114
|
+
return `Set ${name} for ${channel}.\nThe game's function has it within a minute.`;
|
|
109
115
|
}
|
|
110
116
|
// [function]
|
|
111
117
|
// a secret a build declares that has no value on the channel it goes to,
|
|
112
118
|
// which `arc deploy` warns of (action/predeploy/secrets.ts).
|
|
113
119
|
export function secretUnset({ channel, name, }) {
|
|
114
|
-
return `Secret ${name} has no value on ${channel}.\nSet it with \`arc
|
|
120
|
+
return `Secret ${name} has no value on ${channel}.\nSet it with \`arc function secret set ${name} --${channel}\`.`;
|
|
115
121
|
}
|
|
116
122
|
// [function]
|
|
117
123
|
export function secretRemoved({ channel, name, }) {
|
|
@@ -124,11 +130,11 @@ export function secretNone() {
|
|
|
124
130
|
// [function]
|
|
125
131
|
// the most secrets a game has for a channel, when one more is asked for.
|
|
126
132
|
export function secretQuotaFull(channel) {
|
|
127
|
-
return blocks(`Sixteen secrets already for ${channel}.`, "Remove one with `arc
|
|
133
|
+
return blocks(`Sixteen secrets already for ${channel}.`, "Remove one with `arc function secret remove <name>`, then try again.");
|
|
128
134
|
}
|
|
129
135
|
// [function]
|
|
130
136
|
export function secretNotFound({ channel, name, }) {
|
|
131
|
-
return blocks(`Secret not found: ${name}`, `It isn't set for ${channel}.\n\`arc
|
|
137
|
+
return blocks(`Secret not found: ${name}`, `It isn't set for ${channel}.\n\`arc function secret list\` shows the game's secrets.`);
|
|
132
138
|
}
|
|
133
139
|
// [function]
|
|
134
140
|
export function secretNameInvalid() {
|
|
@@ -144,7 +150,7 @@ export function secretTooLarge() {
|
|
|
144
150
|
}
|
|
145
151
|
// [function]
|
|
146
152
|
export function secretValueInvalid() {
|
|
147
|
-
return blocks("A secret's value is 1 to 4096 bytes, on standard input.", 'Such as: printf %s "$EXAMPLE_KEY" | arc
|
|
153
|
+
return blocks("A secret's value is 1 to 4096 bytes, on standard input.", 'Such as: printf %s "$EXAMPLE_KEY" | arc function secret set EXAMPLE_KEY');
|
|
148
154
|
}
|
|
149
155
|
// [function]
|
|
150
156
|
// what's asked when a secret's value is typed.
|
package/dist/phrase/game.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// a game on Arcadible: arc
|
|
1
|
+
// a game on Arcadible: arc game delete.
|
|
2
2
|
// [import]
|
|
3
|
-
import { cmdInit } from "./common.js";
|
|
3
|
+
import { cmdInit, gameNotFound } from "./common.js";
|
|
4
4
|
import { blocks, cmdWhoami } from "./internal.js";
|
|
5
5
|
// [function]
|
|
6
6
|
// what's asked before a game is deleted, as Studio's Delete game asks it.
|
|
@@ -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(
|
|
28
|
+
return blocks(gameNotFound(id), `${cmdWhoami()} shows the account you're logged in to.`);
|
|
29
29
|
}
|
package/dist/phrase/pack.js
CHANGED
|
@@ -33,7 +33,10 @@ export function buildFailed({ code, signal, stderr, stdout, }) {
|
|
|
33
33
|
// `manager`, the one its lockfile names.
|
|
34
34
|
export function packagesUninstalled(message, manager) {
|
|
35
35
|
const [reason = "", ...rest] = message.split("\n\n");
|
|
36
|
-
return blocks(reason,
|
|
36
|
+
return blocks(reason, [
|
|
37
|
+
"The project's packages aren't installed.",
|
|
38
|
+
`Run \`${manager} install\` first.`,
|
|
39
|
+
], ...rest);
|
|
37
40
|
}
|
|
38
41
|
// [function]
|
|
39
42
|
export function buildOutputMissing(dir) {
|
package/dist/phrase/serve.js
CHANGED
|
@@ -65,7 +65,7 @@ export function playerInvalid() {
|
|
|
65
65
|
}
|
|
66
66
|
// [function]
|
|
67
67
|
export function serveNext(dir) {
|
|
68
|
-
return `Reloads when ${dir}/ changes
|
|
68
|
+
return blocks(`Reloads when ${dir}/ changes.`, "Press Ctrl+C to stop.");
|
|
69
69
|
}
|
|
70
70
|
// [function]
|
|
71
71
|
export function served({ built, url, version, }) {
|
|
@@ -79,7 +79,7 @@ export function served({ built, url, version, }) {
|
|
|
79
79
|
}
|
|
80
80
|
// [function]
|
|
81
81
|
export function serveNextUrl() {
|
|
82
|
-
return "Your server reloads the game. Press Ctrl+C to stop.";
|
|
82
|
+
return blocks("Your server reloads the game.", "Press Ctrl+C to stop.");
|
|
83
83
|
}
|
|
84
84
|
// [function]
|
|
85
85
|
export function urlInvalid() {
|
package/dist/phrase/server.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// `arc
|
|
1
|
+
// `arc server`: a game's own servers, and their keys.
|
|
2
2
|
// [import]
|
|
3
3
|
import { blocks } from "./internal.js";
|
|
4
4
|
// [function]
|
|
5
5
|
// a key that was made: said on stderr, so stdout holds the key alone.
|
|
6
6
|
export function keyCreated({ channel, id, name, }) {
|
|
7
|
-
return blocks(`Made "${name}" for ${channel} (${id}).`, "Keep it somewhere safe.
|
|
7
|
+
return blocks(`Made "${name}" for ${channel} (${id}).\nIt won't be shown again.`, "Keep it somewhere safe.");
|
|
8
8
|
}
|
|
9
9
|
// [function]
|
|
10
10
|
export function keyRevoked(id) {
|
|
@@ -15,13 +15,18 @@ export function keyNone() {
|
|
|
15
15
|
return "No keys.";
|
|
16
16
|
}
|
|
17
17
|
// [function]
|
|
18
|
+
// the most keys an account makes in an hour, when one more is asked for.
|
|
19
|
+
export function keyCreateRateLimited() {
|
|
20
|
+
return blocks("This account made 20 keys in the last hour.", "Wait up to an hour, then try again.");
|
|
21
|
+
}
|
|
22
|
+
// [function]
|
|
18
23
|
// the most keys a game has for a channel, when one more is asked for.
|
|
19
24
|
export function keyQuotaFull(channel) {
|
|
20
|
-
return blocks(`Five keys already for ${channel}.`, "Revoke one with `arc
|
|
25
|
+
return blocks(`Five keys already for ${channel}.`, "Revoke one with `arc server key revoke <id>`, then try again.");
|
|
21
26
|
}
|
|
22
27
|
// [function]
|
|
23
28
|
export function keyNotFound(id) {
|
|
24
|
-
return blocks(`Key not found: ${id}`, "It was revoked already, or isn't this game's.\n`arc
|
|
29
|
+
return blocks(`Key not found: ${id}`, "It was revoked already, or isn't this game's.\n`arc server key list` shows the game's keys.");
|
|
25
30
|
}
|
|
26
31
|
// [function]
|
|
27
32
|
export function keyNameInvalid() {
|
|
@@ -32,7 +37,7 @@ export function keyRevokeQuestion() {
|
|
|
32
37
|
return "Revoke this key? Servers using it stop working at once, and it can't be undone.";
|
|
33
38
|
}
|
|
34
39
|
// [function]
|
|
35
|
-
// under `arc
|
|
40
|
+
// under `arc server`'s help: what it isn't, a letter away.
|
|
36
41
|
export function serverNotServe() {
|
|
37
42
|
return "To run your game on this machine, use `arc serve`.";
|
|
38
43
|
}
|
package/dist/phrase/value.js
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
1
|
// [import]
|
|
2
2
|
import { blocks } from "./internal.js";
|
|
3
|
+
// [declare]
|
|
4
|
+
// the project's own values, the local channel `arc serve` reads, where
|
|
5
|
+
// `arc value` works with no channel.
|
|
6
|
+
const VALUES_DIR = ".arcadible-data/values/";
|
|
7
|
+
// [function]
|
|
8
|
+
// where a channel's values are: the project's folder for `local`, else the
|
|
9
|
+
// channel on Arcadible.
|
|
10
|
+
function placeOf(channel) {
|
|
11
|
+
return channel === "local" ? `in ${VALUES_DIR}` : `on ${channel}`;
|
|
12
|
+
}
|
|
13
|
+
// [function]
|
|
14
|
+
// the command that lists a channel's values.
|
|
15
|
+
function listOf(channel) {
|
|
16
|
+
return channel === "local"
|
|
17
|
+
? "`arc value list`"
|
|
18
|
+
: `\`arc value list --${channel}\``;
|
|
19
|
+
}
|
|
3
20
|
// [function]
|
|
4
21
|
export function valueKeyInvalid(key) {
|
|
5
22
|
return blocks(`Not a key: ${key}`, "A key is 1 to 128 letters, digits, -, _, ., and /.");
|
|
6
23
|
}
|
|
7
24
|
// [function]
|
|
8
|
-
// `arc
|
|
25
|
+
// `arc value set` given no key: on the project's own values, which have
|
|
26
|
+
// nowhere to send it, or with a value and no key to set it under.
|
|
9
27
|
export function valueSetWhat() {
|
|
10
|
-
return blocks("Name a key
|
|
28
|
+
return blocks("Name a key.", [
|
|
29
|
+
`\`arc value set <key> '{"on": true}'\` sets one value, in ${VALUES_DIR}.`,
|
|
30
|
+
`\`arc value set --production\` sends every value in ${VALUES_DIR}.`,
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
// [function]
|
|
34
|
+
// `arc value set` given a value twice: on the command line, and in a file.
|
|
35
|
+
export function valueSetTwice() {
|
|
36
|
+
return blocks("Two values given.", "Give the value on the command line, or with `--file`, or on standard input.");
|
|
11
37
|
}
|
|
12
38
|
// [function]
|
|
13
39
|
// a value that isn't JSON: `source` is its file, or standard input.
|
|
@@ -19,8 +45,12 @@ export function valueFileUnread(path) {
|
|
|
19
45
|
return `Can't read ${path}.`;
|
|
20
46
|
}
|
|
21
47
|
// [function]
|
|
22
|
-
|
|
23
|
-
|
|
48
|
+
// `arc value set` on a channel with no key, and no values to send.
|
|
49
|
+
export function valueDirEmpty() {
|
|
50
|
+
return blocks(`No values in ${VALUES_DIR}`, [
|
|
51
|
+
"Each .json file there is a value, and its path its key: daily/2026-11-12.json is daily/2026-11-12.",
|
|
52
|
+
"`arc value set <key> <value>` sets one there.",
|
|
53
|
+
]);
|
|
24
54
|
}
|
|
25
55
|
// [function]
|
|
26
56
|
export function valueTooLarge(key) {
|
|
@@ -38,9 +68,9 @@ export function valueSize(bytes) {
|
|
|
38
68
|
return `${(bytes / (1024 * 1024)).toFixed(1).replace(/\.0$/u, "")} MB`;
|
|
39
69
|
}
|
|
40
70
|
// [function]
|
|
41
|
-
// what a scope may hold, as the API states it (null is no
|
|
42
|
-
// keys, 64 MB", or "no limit".
|
|
43
|
-
export function valueHolds({
|
|
71
|
+
// what each owner of a scope may hold, as the API states it (null is no
|
|
72
|
+
// limit): "10,000 keys, 64 MB", or "no limit".
|
|
73
|
+
export function valueHolds({ bytes, keys, }) {
|
|
44
74
|
if (keys === null && bytes === null) {
|
|
45
75
|
return "no limit";
|
|
46
76
|
}
|
|
@@ -50,35 +80,39 @@ export function valueHolds({ bytes_limit: bytes, keys_limit: keys, }) {
|
|
|
50
80
|
// the game's calls to its values spent: its own for the day, or its
|
|
51
81
|
// account's for the month, as the API doesn't say which.
|
|
52
82
|
export function valueCallsSpent() {
|
|
53
|
-
return blocks("The game's calls
|
|
83
|
+
return blocks("The game's value calls are spent for today, or its account's for the month.", [
|
|
84
|
+
"Writes and removes go on when the day or the month turns (UTC).",
|
|
85
|
+
"Reads still work.",
|
|
86
|
+
]);
|
|
54
87
|
}
|
|
55
88
|
// [function]
|
|
56
89
|
// the developer's values on `channel` full, with what they may hold, the
|
|
57
90
|
// account's plan's, when the API could say.
|
|
58
91
|
export function valueFull(channel, holds) {
|
|
59
|
-
const remove = "Remove some with `arc
|
|
92
|
+
const remove = "Remove some with `arc value remove <key>`, then try again.";
|
|
60
93
|
return blocks(`The developer's values on ${channel} are full.`, holds === null
|
|
61
|
-
? `${remove}\n\`arc
|
|
62
|
-
: `They may hold ${holds}
|
|
94
|
+
? `${remove}\n\`arc value usage\` shows what they hold.`
|
|
95
|
+
: `They may hold ${holds}.\n${remove}`);
|
|
63
96
|
}
|
|
64
97
|
// [function]
|
|
65
98
|
export function valueSet({ channel, keys, }) {
|
|
66
99
|
const [only] = keys;
|
|
67
100
|
return keys.length === 1 && only !== undefined
|
|
68
|
-
? `Set ${only}
|
|
69
|
-
: `Set ${keys.length} values
|
|
101
|
+
? `Set ${only} ${placeOf(channel)}.`
|
|
102
|
+
: `Set ${keys.length} values ${placeOf(channel)}.`;
|
|
70
103
|
}
|
|
71
104
|
// [function]
|
|
72
105
|
export function valueNotFound({ channel, key, }) {
|
|
73
|
-
return blocks(`Value not found: ${key}`, `It isn't set
|
|
106
|
+
return blocks(`Value not found: ${key}`, `It isn't set ${placeOf(channel)}.\n${listOf(channel)} shows what is.`);
|
|
74
107
|
}
|
|
75
108
|
// [function]
|
|
76
109
|
export function valueRemoveQuestion({ channel, key, }) {
|
|
77
|
-
|
|
110
|
+
const from = channel === "local" ? VALUES_DIR : channel;
|
|
111
|
+
return `Remove ${key} from ${from}? Games read nothing for it from then on.`;
|
|
78
112
|
}
|
|
79
113
|
// [function]
|
|
80
114
|
export function valueRemoved({ channel, key, }) {
|
|
81
|
-
return `Removed ${key} from ${channel}.`;
|
|
115
|
+
return `Removed ${key} from ${channel === "local" ? VALUES_DIR : channel}.`;
|
|
82
116
|
}
|
|
83
117
|
// [function]
|
|
84
118
|
export function valueNone() {
|
package/dist/schema/client.js
CHANGED
|
@@ -36,25 +36,30 @@ function isLocal(value) {
|
|
|
36
36
|
}
|
|
37
37
|
// [function]
|
|
38
38
|
// what to do about an address that isn't one: that a local one is left out,
|
|
39
|
-
// that the port goes, or the origin it almost is.
|
|
39
|
+
// that the port goes, or the origin it almost is: a line each.
|
|
40
40
|
function hint(value) {
|
|
41
41
|
if (isLocal(value)) {
|
|
42
|
-
return "Leave your own machine out: arc serve reaches any server on it.";
|
|
42
|
+
return ["Leave your own machine out: arc serve reaches any server on it."];
|
|
43
43
|
}
|
|
44
44
|
try {
|
|
45
45
|
const url = new URL(value);
|
|
46
46
|
const plain = url.username === "" && url.password === "";
|
|
47
47
|
if (url.protocol === "https:" && plain && url.port !== "") {
|
|
48
|
-
return
|
|
48
|
+
return [
|
|
49
|
+
"A server is reached on port 443, the default: leave the port out.",
|
|
50
|
+
];
|
|
49
51
|
}
|
|
50
52
|
if (url.protocol === "https:" && plain && url.origin !== value) {
|
|
51
|
-
return `Did you mean ${url.origin}
|
|
53
|
+
return [`Did you mean ${url.origin}?`];
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
catch {
|
|
55
57
|
// not an address at all
|
|
56
58
|
}
|
|
57
|
-
return
|
|
59
|
+
return [
|
|
60
|
+
"A scheme and a host, with no path.",
|
|
61
|
+
"A ticket is for the whole server.",
|
|
62
|
+
];
|
|
58
63
|
}
|
|
59
64
|
// [function]
|
|
60
65
|
// one of the developer's own servers: an https origin on the default port.
|
|
@@ -67,7 +72,7 @@ function zOrigin() {
|
|
|
67
72
|
code: "custom",
|
|
68
73
|
...message(field, [
|
|
69
74
|
"Must be an https origin, such as https://api.example.com.",
|
|
70
|
-
hint(value),
|
|
75
|
+
...hint(value),
|
|
71
76
|
], ISSUE.URL_INVALID),
|
|
72
77
|
});
|
|
73
78
|
return;
|
package/dist/serve/values.js
CHANGED
|
@@ -97,8 +97,8 @@ function itemsOf(given, fields, needsValue) {
|
|
|
97
97
|
// [function]
|
|
98
98
|
// the developer's values, from the project's folder: each `.json` file a
|
|
99
99
|
// value, its path its key. A file that isn't JSON, or whose path isn't a
|
|
100
|
-
// key, is no value.
|
|
101
|
-
function developerRows(dir) {
|
|
100
|
+
// key, is no value. `arc value` reads them so too, with no channel.
|
|
101
|
+
export function developerRows(dir) {
|
|
102
102
|
const rows = new Map();
|
|
103
103
|
const walk = function (at) {
|
|
104
104
|
let names;
|
package/dist/util/output.js
CHANGED
|
@@ -100,7 +100,7 @@ export function errorOf(ex, code, retry) {
|
|
|
100
100
|
}
|
|
101
101
|
: {}),
|
|
102
102
|
code: shown,
|
|
103
|
-
|
|
103
|
+
docs_url: `${ERRORS}#${shown}`,
|
|
104
104
|
message: ex.message,
|
|
105
105
|
retry: isRetry(said) ? said : retryOf(shown),
|
|
106
106
|
...(ex.status ? { status: ex.status } : {}),
|
|
@@ -111,14 +111,21 @@ export function errorOf(ex, code, retry) {
|
|
|
111
111
|
// aborted.") and the reason on stderr, then its code and the link to it on
|
|
112
112
|
// the Errors page, once the spinner and progress bar are cleared. Then exits
|
|
113
113
|
// 1. `data`, and the error's own, go beside the error in JSON, such as the
|
|
114
|
-
// release that failed. `nl` puts a blank line before the heading, after
|
|
114
|
+
// release that failed, and `warnings` when there are any. `nl` puts a blank line before the heading, after
|
|
115
115
|
// output the command has already printed, such as arc login's link.
|
|
116
116
|
// `code` is a failed release's reason, which the API may add to, so it isn't
|
|
117
117
|
// checked, and `retry` the API's own word beside it.
|
|
118
118
|
export function abort(heading, ex, { code, data, json = false, nl = false, pb, retry, sw } = {}) {
|
|
119
119
|
const shown = code ?? codeOf(ex);
|
|
120
120
|
if (json) {
|
|
121
|
-
|
|
121
|
+
// `warnings` beside an error only when there are any (OUTPUT.md)
|
|
122
|
+
const { warnings, ...beside } = { ...ex.data, ...data };
|
|
123
|
+
const listed = Array.isArray(warnings) && warnings.length > 0;
|
|
124
|
+
print({
|
|
125
|
+
...beside,
|
|
126
|
+
...(listed ? { warnings } : {}),
|
|
127
|
+
error: errorOf(ex, code, retry),
|
|
128
|
+
});
|
|
122
129
|
}
|
|
123
130
|
else {
|
|
124
131
|
if (pb) {
|
|
@@ -168,7 +175,7 @@ export function warning(code, message, path = null) {
|
|
|
168
175
|
return {
|
|
169
176
|
code,
|
|
170
177
|
details: [],
|
|
171
|
-
|
|
178
|
+
docs_url: `${ERRORS}#${code}`,
|
|
172
179
|
message,
|
|
173
180
|
path,
|
|
174
181
|
};
|
package/dist/util/request.js
CHANGED
|
@@ -10,6 +10,12 @@ import { client, id } from "../config/product.js";
|
|
|
10
10
|
const CLIENT = client;
|
|
11
11
|
const ID = id;
|
|
12
12
|
const VERSION = version;
|
|
13
|
+
// how long a request waits on the API, its answer's body included, before
|
|
14
|
+
// it's api_unreachable: the API gives up on the database at 10 seconds, so
|
|
15
|
+
// one that hasn't answered in 30 isn't going to (LIMITS.md, How long things
|
|
16
|
+
// last), and a connection that hangs would otherwise hold the command for
|
|
17
|
+
// minutes.
|
|
18
|
+
export const TIMEOUT = 30_000;
|
|
13
19
|
// [function]
|
|
14
20
|
// the body as JSON, or null when it isn't JSON, such as a proxy's error page.
|
|
15
21
|
function json(resp) {
|
|
@@ -59,8 +65,8 @@ function parse(resp) {
|
|
|
59
65
|
// [function]
|
|
60
66
|
// sends a request to a full URL. `headers` are added to the client's own, and
|
|
61
67
|
// a form is sent as JSON, its fields as text; `{ json }` is sent as the JSON
|
|
62
|
-
// it is. A request that gets no response, such as when offline,
|
|
63
|
-
// api_unreachable.
|
|
68
|
+
// it is. A request that gets no response, such as when offline, or none in
|
|
69
|
+
// TIMEOUT, rejects as api_unreachable.
|
|
64
70
|
function send(method, url, form, headers = {}) {
|
|
65
71
|
const all = {
|
|
66
72
|
[`X-${CLIENT}-Client-Id`]: ID,
|
|
@@ -73,15 +79,19 @@ function send(method, url, form, headers = {}) {
|
|
|
73
79
|
: form instanceof FormData
|
|
74
80
|
? JSON.stringify(Object.fromEntries(form))
|
|
75
81
|
: JSON.stringify(form.json);
|
|
82
|
+
const unreachable = (ex) => {
|
|
83
|
+
throw new ArcError(API_UNREACHABLE, unableToReach(), {
|
|
84
|
+
cause: ex,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
76
87
|
return fetch(url, {
|
|
77
88
|
body,
|
|
78
89
|
headers: all,
|
|
79
90
|
method,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
});
|
|
91
|
+
signal: AbortSignal.timeout(TIMEOUT),
|
|
92
|
+
}).then(
|
|
93
|
+
// a body cut off by the clock is unreachable too; a refusal is the API's
|
|
94
|
+
(resp) => parse(resp).catch((ex) => ex instanceof HttpError ? Promise.reject(ex) : unreachable(ex)), unreachable);
|
|
85
95
|
}
|
|
86
96
|
// [function]
|
|
87
97
|
export function get(url, headers) {
|