arcadible 1.0.35 → 1.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.
- package/README.md +1 -1
- package/dist/action/function/logs.js +238 -0
- package/dist/action/function/tool.js +40 -16
- package/dist/action/pack/limits.js +28 -4
- package/dist/action/pack/tool.js +2 -1
- package/dist/action/value/tool.js +2 -2
- package/dist/action/wire/tool.js +1 -1
- package/dist/api.js +30 -5
- package/dist/cli/command.js +12 -2
- package/dist/command/function/index.js +7 -7
- package/dist/command/function/logs.js +154 -0
- 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/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 +26 -9
- package/dist/command/{delete.js → game/delete.js} +14 -13
- package/dist/command/game/index.js +12 -0
- package/dist/command/server/index.js +3 -4
- package/dist/command/server/key/create.js +1 -1
- package/dist/command/server/key/index.js +1 -1
- package/dist/command/server/key/revoke.js +1 -1
- package/dist/command/server/key/run.js +1 -1
- package/dist/command/unstable/index.js +23 -0
- package/dist/command/value/get.js +1 -1
- package/dist/command/value/index.js +6 -6
- package/dist/command/value/list.js +1 -1
- package/dist/command/value/remove.js +2 -2
- package/dist/command/value/set.js +1 -1
- package/dist/command/value/usage.js +16 -6
- package/dist/command/wire/index.js +4 -5
- package/dist/commands.js +3 -29
- package/dist/config/code.js +7 -3
- package/dist/config/limit.js +4 -0
- package/dist/phrase/deploy.js +1 -1
- package/dist/phrase/function.js +71 -17
- package/dist/phrase/game.js +1 -1
- package/dist/phrase/index.js +1 -0
- package/dist/phrase/pack.js +9 -0
- package/dist/phrase/server.js +4 -4
- package/dist/phrase/unstable.js +6 -0
- package/dist/phrase/value.js +4 -4
- package/dist/runner/entry.js +59 -3
- package/dist/schema/check/workflow.js +0 -21
- package/dist/schema/workflow.js +6 -28
- package/dist/serve/runner.js +9 -2
- package/dist/util/zip.js +5 -0
- package/npm-shrinkwrap.json +33 -33
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
// arc unstable function logs: what the game's function said, as Arcadible keeps it,
|
|
2
|
+
// for its owner (plan/FUNCTION-LOGS.md, Reading them): the newest 100
|
|
3
|
+
// requests, oldest first, as `tail` prints, or those and then each as it
|
|
4
|
+
// comes, with `--follow`. With `--json`, an entry a line, as the logs
|
|
5
|
+
// Worker answers it, so a follow can be read as it goes (OUTPUT.md,
|
|
6
|
+
// Streams).
|
|
7
|
+
// [import]
|
|
8
|
+
import { resolve as resolvePath } from "node:path";
|
|
9
|
+
// [import]
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
// [import]
|
|
12
|
+
import { ended } from "../../account.js";
|
|
13
|
+
import { defineCommand } from "../../cli/command.js";
|
|
14
|
+
import { of } from "../../cli/channel.js";
|
|
15
|
+
import { CHANNEL_SHOWS, CWD, JSON_OUTPUT } from "../../cli/options.js";
|
|
16
|
+
import { cpuTime, functionLogsNone } from "../../phrase/index.js";
|
|
17
|
+
import { p } from "../../util/log.js";
|
|
18
|
+
import { deepSort } from "../../util/objs.js";
|
|
19
|
+
import { SpinnerWheel } from "../../util/spinner.js";
|
|
20
|
+
import { follow, logs, } from "../../action/function/logs.js";
|
|
21
|
+
import { whoami } from "../../action/whoami/tool.js";
|
|
22
|
+
// [function]
|
|
23
|
+
// a time as the logs show it, in UTC: to the millisecond, with its day
|
|
24
|
+
// when it isn't today's.
|
|
25
|
+
function timeOf(at, now = Date.now()) {
|
|
26
|
+
const iso = new Date(at).toISOString();
|
|
27
|
+
const day = iso.slice(0, 10);
|
|
28
|
+
const time = iso.slice(11, 23);
|
|
29
|
+
return day === new Date(now).toISOString().slice(0, 10)
|
|
30
|
+
? time
|
|
31
|
+
: `${day} ${time}`;
|
|
32
|
+
}
|
|
33
|
+
// [function]
|
|
34
|
+
// text under an entry's first line, indented, each of its lines.
|
|
35
|
+
function under(text, indent) {
|
|
36
|
+
return text
|
|
37
|
+
.split("\n")
|
|
38
|
+
.map((line) => `${indent}${line}`)
|
|
39
|
+
.join("\n");
|
|
40
|
+
}
|
|
41
|
+
// [function]
|
|
42
|
+
// an exception: its name and message, then its stack, which Cloudflare
|
|
43
|
+
// gives as its frames alone, and V8 with the name and message first.
|
|
44
|
+
function exceptionText({ message, name, stack, }) {
|
|
45
|
+
const head = `${name ?? "Error"}: ${message ?? ""}`;
|
|
46
|
+
if (!stack)
|
|
47
|
+
return head;
|
|
48
|
+
return stack.startsWith(head) ? stack : `${head}\n${stack}`;
|
|
49
|
+
}
|
|
50
|
+
// [function]
|
|
51
|
+
// an entry as it's read: its time, channel, build, request, answer, and CPU
|
|
52
|
+
// time on a line, then its lines and exceptions under it, those that are
|
|
53
|
+
// errors in yellow (OUTPUT.md keeps red for headings).
|
|
54
|
+
export function entryText(entry) {
|
|
55
|
+
const outcome = entry.outcome ?? "unknown";
|
|
56
|
+
const answer = entry.status == null
|
|
57
|
+
? outcome
|
|
58
|
+
: outcome === "ok"
|
|
59
|
+
? String(entry.status)
|
|
60
|
+
: `${entry.status} ${outcome}`;
|
|
61
|
+
const head = [
|
|
62
|
+
timeOf(entry.at),
|
|
63
|
+
entry.channel,
|
|
64
|
+
entry.version,
|
|
65
|
+
entry.method ?? "-",
|
|
66
|
+
entry.path ?? "-",
|
|
67
|
+
answer,
|
|
68
|
+
`${cpuTime(entry.cpu_ms ?? 0)} CPU`,
|
|
69
|
+
].join(" ");
|
|
70
|
+
const body = [
|
|
71
|
+
...(entry.lines ?? []).map((line) => {
|
|
72
|
+
const level = line.level ?? "log";
|
|
73
|
+
// a message's later lines under its first
|
|
74
|
+
const text = ` ${level.padEnd(5)} ${under(line.message ?? "", " ".repeat(8)).trimStart()}`;
|
|
75
|
+
return level === "error" ? chalk.yellow(text) : text;
|
|
76
|
+
}),
|
|
77
|
+
...(entry.exceptions ?? []).map((each) => chalk.yellow(under(exceptionText(each), " "))),
|
|
78
|
+
...(entry.truncated ? [" … more than was kept"] : []),
|
|
79
|
+
];
|
|
80
|
+
return [head, ...body].join("\n");
|
|
81
|
+
}
|
|
82
|
+
// [function]
|
|
83
|
+
// an entry, as JSON on a line of its own, or as it's read.
|
|
84
|
+
function show(entry, json) {
|
|
85
|
+
if (json) {
|
|
86
|
+
process.stdout.write(`${JSON.stringify(deepSort(entry))}\n`);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
p(entryText(entry));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// [export]
|
|
93
|
+
export default defineCommand({
|
|
94
|
+
name: "logs",
|
|
95
|
+
options: {
|
|
96
|
+
...CHANNEL_SHOWS,
|
|
97
|
+
// a build, by its version: `--version` is arc's own, as in arc play
|
|
98
|
+
release: {
|
|
99
|
+
alias: "r",
|
|
100
|
+
describe: "Only this release's, by its version",
|
|
101
|
+
type: "string",
|
|
102
|
+
},
|
|
103
|
+
since: {
|
|
104
|
+
describe: "From a time: 10m, 2h, 1d, or an ISO time",
|
|
105
|
+
type: "string",
|
|
106
|
+
},
|
|
107
|
+
errors: {
|
|
108
|
+
describe: "Only the requests that failed",
|
|
109
|
+
type: "boolean",
|
|
110
|
+
},
|
|
111
|
+
follow: {
|
|
112
|
+
alias: "f",
|
|
113
|
+
describe: "Keep printing each request as it comes",
|
|
114
|
+
type: "boolean",
|
|
115
|
+
},
|
|
116
|
+
json: JSON_OUTPUT,
|
|
117
|
+
cwd: CWD,
|
|
118
|
+
},
|
|
119
|
+
async run(argv, aborting) {
|
|
120
|
+
const json = argv.json;
|
|
121
|
+
const sw = new SpinnerWheel("Checking… %s");
|
|
122
|
+
aborting.sw = sw;
|
|
123
|
+
const where = of(argv);
|
|
124
|
+
const current = await whoami({}, {
|
|
125
|
+
onAccountRefresh(refresh) {
|
|
126
|
+
sw.start(json);
|
|
127
|
+
return refresh();
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
sw.stop(true);
|
|
131
|
+
const conf = {
|
|
132
|
+
channel: where,
|
|
133
|
+
errors: argv.errors,
|
|
134
|
+
root: resolvePath(process.cwd(), argv.cwd),
|
|
135
|
+
since: argv.since,
|
|
136
|
+
version: argv.release,
|
|
137
|
+
};
|
|
138
|
+
if (argv.follow) {
|
|
139
|
+
await follow(current, conf, (entry) => {
|
|
140
|
+
show(entry, json);
|
|
141
|
+
}).catch(ended(current));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const entries = await logs(current, conf).catch(ended(current));
|
|
145
|
+
for (const entry of entries.reverse())
|
|
146
|
+
show(entry, json);
|
|
147
|
+
if (!entries.length && !json) {
|
|
148
|
+
p(functionLogsNone({
|
|
149
|
+
filtered: Boolean(where || argv.release || argv.since || argv.errors),
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
summary: "Show what the game's function logged, and its failures",
|
|
154
|
+
});
|
|
@@ -12,7 +12,7 @@ export default defineCommand({
|
|
|
12
12
|
run(argv, aborting) {
|
|
13
13
|
return run(argv, aborting, pause, (paused) => {
|
|
14
14
|
p(functionPaused(paused));
|
|
15
|
-
}, "arc function pause");
|
|
15
|
+
}, "arc unstable function pause");
|
|
16
16
|
},
|
|
17
17
|
summary: "Pause the game's function on a channel",
|
|
18
18
|
});
|
|
@@ -12,7 +12,7 @@ export default defineCommand({
|
|
|
12
12
|
run(argv, aborting) {
|
|
13
13
|
return run(argv, aborting, resume, (resumed) => {
|
|
14
14
|
p(functionResumed(resumed));
|
|
15
|
-
}, "arc function resume");
|
|
15
|
+
}, "arc unstable function resume");
|
|
16
16
|
},
|
|
17
17
|
summary: "Resume the game's function on a channel",
|
|
18
18
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// arc function secret: a function's secrets, the values a game's function
|
|
1
|
+
// arc unstable function secret: a function's secrets, the values a game's function
|
|
2
2
|
// needs and its repository mustn't hold. `set` takes the value from standard
|
|
3
3
|
// input, or asks for it at a terminal, so it's never an argument, in a
|
|
4
4
|
// shell's history or a process list.
|
|
@@ -14,12 +14,12 @@ export default defineCommand({
|
|
|
14
14
|
run(argv, aborting) {
|
|
15
15
|
return run(argv, aborting, (current, conf) => remove(current, { ...conf, name: argv.name }), (gone) => {
|
|
16
16
|
p(secretRemoved(gone));
|
|
17
|
-
}, `arc function secret remove ${argv.name}`, (where) => ({
|
|
17
|
+
}, `arc unstable function secret remove ${argv.name}`, (where) => ({
|
|
18
18
|
question: secretRemoveQuestion({
|
|
19
19
|
channel: String(where),
|
|
20
20
|
name: argv.name,
|
|
21
21
|
}),
|
|
22
|
-
usage: `arc function secret remove ${argv.name} --${where}`,
|
|
22
|
+
usage: `arc unstable function secret remove ${argv.name} --${where}`,
|
|
23
23
|
}));
|
|
24
24
|
},
|
|
25
25
|
summary: "Remove a secret",
|
|
@@ -42,7 +42,7 @@ export default defineCommand({
|
|
|
42
42
|
value: () => valueOf(argv.name, argv.json),
|
|
43
43
|
}), (kept) => {
|
|
44
44
|
p(secretSet(kept));
|
|
45
|
-
}, `arc function secret set ${argv.name}`);
|
|
45
|
+
}, `arc unstable function secret set ${argv.name}`);
|
|
46
46
|
},
|
|
47
47
|
summary: "Set a secret, its value from standard input",
|
|
48
48
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// [import]
|
|
2
2
|
import { defineCommand } from "../../cli/command.js";
|
|
3
|
-
import {
|
|
3
|
+
import { cpuTime, functionState, functionUsage } from "../../phrase/index.js";
|
|
4
4
|
import { p } from "../../util/log.js";
|
|
5
5
|
import { CHANNEL_SHOWS, CWD, JSON_OUTPUT, QUIET } from "../../cli/options.js";
|
|
6
6
|
import { run } from "./run.js";
|
|
@@ -12,14 +12,16 @@ function count(value) {
|
|
|
12
12
|
return value.toLocaleString("en-US");
|
|
13
13
|
}
|
|
14
14
|
// [function]
|
|
15
|
-
// each channel's function as a table, a row each
|
|
15
|
+
// each channel's function as a table, a row each: its requests and CPU
|
|
16
|
+
// time this month.
|
|
16
17
|
function rows(channels) {
|
|
17
18
|
return table([
|
|
18
|
-
["CHANNEL", "STATUS", "REQUESTS"],
|
|
19
|
+
["CHANNEL", "STATUS", "REQUESTS", "CPU"],
|
|
19
20
|
...channels.map((each) => [
|
|
20
21
|
each.channel,
|
|
21
22
|
functionState(each),
|
|
22
23
|
count(each.requests),
|
|
24
|
+
cpuTime(each.cpu_ms),
|
|
23
25
|
]),
|
|
24
26
|
]);
|
|
25
27
|
}
|
|
@@ -28,13 +30,28 @@ export default defineCommand({
|
|
|
28
30
|
name: "status",
|
|
29
31
|
options: { ...CHANNEL_SHOWS, json: JSON_OUTPUT, quiet: QUIET, cwd: CWD },
|
|
30
32
|
run(argv, aborting) {
|
|
31
|
-
return run(argv, aborting, status, ({ channels, month }) => {
|
|
33
|
+
return run(argv, aborting, status, ({ channels, day, month, pool }) => {
|
|
32
34
|
p(rows(channels));
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
// nothing to say of its limits when its usage couldn't be read
|
|
36
|
+
if (day && month && pool) {
|
|
37
|
+
const limit = (value) => value === null ? null : count(value);
|
|
38
|
+
p(functionUsage({
|
|
39
|
+
day: {
|
|
40
|
+
allowance: limit(day.allowance),
|
|
41
|
+
requests: count(day.requests),
|
|
42
|
+
},
|
|
43
|
+
month: {
|
|
44
|
+
cpu: cpuTime(month.cpu_ms),
|
|
45
|
+
requests: count(month.requests),
|
|
46
|
+
},
|
|
47
|
+
pool: {
|
|
48
|
+
allowance: limit(pool.allowance),
|
|
49
|
+
cpu: cpuTime(pool.cpu_ms),
|
|
50
|
+
requests: count(pool.requests),
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
37
54
|
});
|
|
38
55
|
},
|
|
39
|
-
summary: "Show whether the game's function is running, and its usage
|
|
56
|
+
summary: "Show whether the game's function is running, and its usage against its limits",
|
|
40
57
|
});
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
// arc delete: deletes the project's game on Arcadible, for its
|
|
1
|
+
// arc unstable game delete: deletes the project's game on Arcadible, for its
|
|
2
|
+
// owner. It
|
|
2
3
|
// can't be undone, so it asks first (src/cli/confirm.ts), naming the game.
|
|
3
4
|
// The project's files are left as they are.
|
|
4
5
|
// [import]
|
|
5
6
|
import { resolve } from "node:path";
|
|
6
7
|
// [import]
|
|
7
|
-
import { ended } from "
|
|
8
|
-
import { defineCommand } from "
|
|
9
|
-
import { askable, sure } from "
|
|
10
|
-
import { headersOf } from "
|
|
11
|
-
import { confirmDeclined, gameDeleted, gameDeletedProject, gameDeleteQuestion, } from "
|
|
12
|
-
import { p, result } from "
|
|
13
|
-
import { CWD, JSON_OUTPUT, QUIET, YES } from "
|
|
14
|
-
import { print } from "
|
|
15
|
-
import { SpinnerWheel } from "
|
|
16
|
-
import { deleteTool, named } from "
|
|
17
|
-
import { whoami } from "
|
|
8
|
+
import { ended } from "../../account.js";
|
|
9
|
+
import { defineCommand } from "../../cli/command.js";
|
|
10
|
+
import { askable, sure } from "../../cli/confirm.js";
|
|
11
|
+
import { headersOf } from "../../action/game.js";
|
|
12
|
+
import { confirmDeclined, gameDeleted, gameDeletedProject, gameDeleteQuestion, } from "../../phrase/index.js";
|
|
13
|
+
import { p, result } from "../../util/log.js";
|
|
14
|
+
import { CWD, JSON_OUTPUT, QUIET, YES } from "../../cli/options.js";
|
|
15
|
+
import { print } from "../../util/output.js";
|
|
16
|
+
import { SpinnerWheel } from "../../util/spinner.js";
|
|
17
|
+
import { deleteTool, named } from "../../action/delete/tool.js";
|
|
18
|
+
import { whoami } from "../../action/whoami/tool.js";
|
|
18
19
|
// [declare]
|
|
19
20
|
const COMMAND = "delete";
|
|
20
21
|
// the command as it's typed, shown with `--yes` when there's no one to ask.
|
|
21
|
-
const USAGE = "arc delete";
|
|
22
|
+
const USAGE = "arc unstable game delete";
|
|
22
23
|
// [export]
|
|
23
24
|
export default defineCommand({
|
|
24
25
|
name: COMMAND,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// arc unstable game: the project's game on Arcadible, where a top-level
|
|
2
|
+
// command is the project's own life (`init` to `deploy`). Deleting it, for
|
|
3
|
+
// now. Under `arc unstable` until it's settled, then `arc game`.
|
|
4
|
+
// [import]
|
|
5
|
+
import { defineCommand } from "../../cli/command.js";
|
|
6
|
+
import del from "./delete.js";
|
|
7
|
+
// [export]
|
|
8
|
+
export default defineCommand({
|
|
9
|
+
commands: [del],
|
|
10
|
+
name: "game",
|
|
11
|
+
summary: "Delete the project's game on Arcadible",
|
|
12
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// arc server: a game's own server, the one its developer runs: the
|
|
2
|
-
// proves itself to Arcadible with (./key/index.ts).
|
|
3
|
-
// `arc
|
|
1
|
+
// arc unstable server: a game's own server, the one its developer runs: the
|
|
2
|
+
// keys it proves itself to Arcadible with (./key/index.ts). Under
|
|
3
|
+
// `arc unstable` until keys ship, with the docs. Not `arc serve`, which runs
|
|
4
4
|
// the game on this machine: its help says so, since the two are a letter
|
|
5
5
|
// apart.
|
|
6
6
|
// [import]
|
|
@@ -11,7 +11,6 @@ import { serverNotServe } from "../../phrase/index.js";
|
|
|
11
11
|
export default defineCommand({
|
|
12
12
|
commands: [key],
|
|
13
13
|
epilogue: serverNotServe(),
|
|
14
|
-
hidden: true,
|
|
15
14
|
name: "server",
|
|
16
15
|
summary: "Make, list, and revoke your server's keys",
|
|
17
16
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// arc server key: a game's keys, which its own server proves itself with
|
|
1
|
+
// arc unstable server key: a game's keys, which its own server proves itself with
|
|
2
2
|
// to Arcadible. `create` prints the new key alone on stdout, since it's
|
|
3
3
|
// shown once and is what a script wants; everything else it says goes to
|
|
4
4
|
// stderr.
|
|
@@ -17,7 +17,7 @@ export default defineCommand({
|
|
|
17
17
|
p(keyRevoked(gone.id));
|
|
18
18
|
}, null, () => ({
|
|
19
19
|
question: keyRevokeQuestion(),
|
|
20
|
-
usage: `arc server key revoke ${argv.id}`,
|
|
20
|
+
usage: `arc unstable server key revoke ${argv.id}`,
|
|
21
21
|
}));
|
|
22
22
|
},
|
|
23
23
|
summary: "Revoke a key, by the id `list` shows",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// arc unstable: the commands that aren't settled yet: the game on
|
|
2
|
+
// Arcadible, and what isn't released, a game's function, its server's
|
|
3
|
+
// keys, its values, and its wires. Each may change or go in any release,
|
|
4
|
+
// and is promoted out of it, to a name of its own, once it's settled or
|
|
5
|
+
// released. Its commands are outside the `--json` contract (OUTPUT.md,
|
|
6
|
+
// Unstable commands), and each reads its own section of `.arcrc`, as a
|
|
7
|
+
// top-level command does.
|
|
8
|
+
// [import]
|
|
9
|
+
import { defineCommand } from "../../cli/command.js";
|
|
10
|
+
import { unstableEpilogue } from "../../phrase/index.js";
|
|
11
|
+
import fn from "../function/index.js";
|
|
12
|
+
import game from "../game/index.js";
|
|
13
|
+
import server from "../server/index.js";
|
|
14
|
+
import value from "../value/index.js";
|
|
15
|
+
import wire from "../wire/index.js";
|
|
16
|
+
// [export]
|
|
17
|
+
export default defineCommand({
|
|
18
|
+
commands: [game, fn, server, value, wire],
|
|
19
|
+
epilogue: unstableEpilogue(),
|
|
20
|
+
name: "unstable",
|
|
21
|
+
namespace: true,
|
|
22
|
+
summary: "Use commands that aren't stable yet",
|
|
23
|
+
});
|
|
@@ -15,7 +15,7 @@ export default defineCommand({
|
|
|
15
15
|
// the value alone, as JSON, so it pipes to a file as it was set
|
|
16
16
|
(got) => {
|
|
17
17
|
p(JSON.stringify(got.value, null, 2));
|
|
18
|
-
}, `arc value get ${argv.key}`);
|
|
18
|
+
}, `arc unstable value get ${argv.key}`);
|
|
19
19
|
},
|
|
20
20
|
summary: "Show a value",
|
|
21
21
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
// arc value: a game's developer's values (plan/VALUES.md), the JSON
|
|
2
|
-
// owner publishes on a channel for the game and its server to read:
|
|
3
|
-
// puzzle, an event's switch, a table of levels. Set, read, listed,
|
|
4
|
-
// removed, a channel named each time, since nothing is copied between
|
|
5
|
-
//
|
|
1
|
+
// arc unstable value: a game's developer's values (plan/VALUES.md), the JSON
|
|
2
|
+
// a game's owner publishes on a channel for the game and its server to read:
|
|
3
|
+
// a daily puzzle, an event's switch, a table of levels. Set, read, listed,
|
|
4
|
+
// and removed, a channel named each time, since nothing is copied between
|
|
5
|
+
// them.
|
|
6
|
+
// Under `arc unstable` until values ship, with the docs.
|
|
6
7
|
// [import]
|
|
7
8
|
import { defineCommand } from "../../cli/command.js";
|
|
8
9
|
import get from "./get.js";
|
|
@@ -13,7 +14,6 @@ import usage from "./usage.js";
|
|
|
13
14
|
// [export]
|
|
14
15
|
export default defineCommand({
|
|
15
16
|
commands: [set, get, list, remove, usage],
|
|
16
|
-
hidden: true,
|
|
17
17
|
name: "value",
|
|
18
18
|
summary: "Set, get, list, and remove the values you publish for the game",
|
|
19
19
|
});
|
|
@@ -35,7 +35,7 @@ export default defineCommand({
|
|
|
35
35
|
run(argv, aborting) {
|
|
36
36
|
return run(argv, aborting, (current, conf) => list(current, { ...conf, prefix: argv.prefix }), (entries) => {
|
|
37
37
|
p(entries.length ? rows(entries) : valueNone());
|
|
38
|
-
}, "arc value list");
|
|
38
|
+
}, "arc unstable value list");
|
|
39
39
|
},
|
|
40
40
|
summary: "List the values' keys, with their sizes",
|
|
41
41
|
});
|
|
@@ -14,12 +14,12 @@ export default defineCommand({
|
|
|
14
14
|
run(argv, aborting) {
|
|
15
15
|
return run(argv, aborting, (current, conf) => remove(current, { ...conf, key: argv.key }), (gone) => {
|
|
16
16
|
p(valueRemoved({ channel: gone.channel, key: argv.key }));
|
|
17
|
-
}, `arc value remove ${argv.key}`, (where) => ({
|
|
17
|
+
}, `arc unstable value remove ${argv.key}`, (where) => ({
|
|
18
18
|
question: valueRemoveQuestion({
|
|
19
19
|
channel: String(where),
|
|
20
20
|
key: argv.key,
|
|
21
21
|
}),
|
|
22
|
-
usage: `arc value remove ${argv.key} --${where}`,
|
|
22
|
+
usage: `arc unstable value remove ${argv.key} --${where}`,
|
|
23
23
|
}));
|
|
24
24
|
},
|
|
25
25
|
summary: "Remove a value",
|
|
@@ -32,7 +32,9 @@ function rows(scopes) {
|
|
|
32
32
|
["SCOPE", "KEYS", "SIZE", "MAY HOLD"],
|
|
33
33
|
...scopes.map((each) => {
|
|
34
34
|
const players = each.scope === "player";
|
|
35
|
-
const limit =
|
|
35
|
+
const limit = each.keys_limit === null && each.bytes_limit === null
|
|
36
|
+
? "no limit"
|
|
37
|
+
: `${each.keys_limit === null ? "any number of" : each.keys_limit.toLocaleString("en-US")} keys, ${each.bytes_limit === null ? "any size" : size(each.bytes_limit)}`;
|
|
36
38
|
return [
|
|
37
39
|
NAMES[each.scope] ?? each.scope,
|
|
38
40
|
players
|
|
@@ -41,17 +43,25 @@ function rows(scopes) {
|
|
|
41
43
|
players
|
|
42
44
|
? `${size(each.bytes)} (${size(each.bytes_most)} at most)`
|
|
43
45
|
: size(each.bytes),
|
|
44
|
-
players ? `${limit} each` : limit,
|
|
46
|
+
players && limit !== "no limit" ? `${limit} each` : limit,
|
|
45
47
|
];
|
|
46
48
|
}),
|
|
47
49
|
]);
|
|
48
50
|
}
|
|
49
51
|
// [function]
|
|
50
|
-
// the game's clients' calls
|
|
51
|
-
// its
|
|
52
|
+
// the game's clients' calls: this channel's today, and the game's against
|
|
53
|
+
// its own limit for a day, which both channels share and the day (UTC)
|
|
54
|
+
// renews; then its month, and its account's, every game's together,
|
|
55
|
+
// against its plan's. Each number is the API's; null is no limit.
|
|
52
56
|
function called(calls) {
|
|
53
57
|
const n = (count) => count.toLocaleString("en-US");
|
|
54
|
-
|
|
58
|
+
const today = calls.allowance === null
|
|
59
|
+
? `${n(calls.used)} for the day, with no limit.`
|
|
60
|
+
: `${n(calls.used)} of ${n(calls.allowance)} for the day, both channels together.`;
|
|
61
|
+
const account = calls.pool_allowance === null
|
|
62
|
+
? `Your account's games together: ${n(calls.pool_used)}, with no limit.`
|
|
63
|
+
: `Your account's games together: ${n(calls.pool_used)} of ${n(calls.pool_allowance)}.`;
|
|
64
|
+
return `Calls from the game today: ${n(calls.reads)} reads, ${n(calls.writes)} writes on ${calls.channel}. ${today}\n${n(calls.month_used)} calls this month. ${account}`;
|
|
55
65
|
}
|
|
56
66
|
// [export]
|
|
57
67
|
export default defineCommand({
|
|
@@ -63,7 +73,7 @@ export default defineCommand({
|
|
|
63
73
|
if (calls) {
|
|
64
74
|
p(`\n${called(calls)}`);
|
|
65
75
|
}
|
|
66
|
-
}, "arc value usage");
|
|
76
|
+
}, "arc unstable value usage");
|
|
67
77
|
},
|
|
68
78
|
summary: "Show how much the game's values hold, by scope",
|
|
69
79
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
// arc wire: a game's wires (plan/SDKWIRES.md), live messages
|
|
2
|
-
// players, relayed and never kept. A game makes and joins them
|
|
3
|
-
// what's here is what they came to: their usage, by channel.
|
|
4
|
-
// `arc
|
|
1
|
+
// arc unstable wire: a game's wires (plan/SDKWIRES.md), live messages
|
|
2
|
+
// between its players, relayed and never kept. A game makes and joins them
|
|
3
|
+
// itself, so what's here is what they came to: their usage, by channel.
|
|
4
|
+
// Under `arc unstable` until wires ship, with the docs.
|
|
5
5
|
// [import]
|
|
6
6
|
import { defineCommand } from "../../cli/command.js";
|
|
7
7
|
import usage from "./usage.js";
|
|
8
8
|
// [export]
|
|
9
9
|
export default defineCommand({
|
|
10
10
|
commands: [usage],
|
|
11
|
-
hidden: true,
|
|
12
11
|
name: "wire",
|
|
13
12
|
summary: "Show what the game's wires carried",
|
|
14
13
|
});
|
package/dist/commands.js
CHANGED
|
@@ -57,11 +57,6 @@ export const COMMANDS = [
|
|
|
57
57
|
name: "play",
|
|
58
58
|
summary: "Play a game",
|
|
59
59
|
},
|
|
60
|
-
{
|
|
61
|
-
load: () => import("./command/delete.js"),
|
|
62
|
-
name: "delete",
|
|
63
|
-
summary: "Delete the game",
|
|
64
|
-
},
|
|
65
60
|
{
|
|
66
61
|
load: () => import("./command/login.js"),
|
|
67
62
|
name: "login",
|
|
@@ -77,30 +72,9 @@ export const COMMANDS = [
|
|
|
77
72
|
name: "logout",
|
|
78
73
|
summary: `Log out of ${title}`,
|
|
79
74
|
},
|
|
80
|
-
// left out of `arc --help` until functions, keys, values, and wires ship, with the
|
|
81
|
-
// docs.
|
|
82
|
-
{
|
|
83
|
-
hidden: true,
|
|
84
|
-
load: () => import("./command/function/index.js"),
|
|
85
|
-
name: "function",
|
|
86
|
-
summary: "Pause, resume, and show the game's function, and its secrets",
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
hidden: true,
|
|
90
|
-
load: () => import("./command/server/index.js"),
|
|
91
|
-
name: "server",
|
|
92
|
-
summary: "Make, list, and revoke your server's keys",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
hidden: true,
|
|
96
|
-
load: () => import("./command/value/index.js"),
|
|
97
|
-
name: "value",
|
|
98
|
-
summary: "Set, get, list, and remove the values you publish for the game",
|
|
99
|
-
},
|
|
100
75
|
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
summary: "Show what the game's wires carried",
|
|
76
|
+
load: () => import("./command/unstable/index.js"),
|
|
77
|
+
name: "unstable",
|
|
78
|
+
summary: "Use commands that aren't stable yet",
|
|
105
79
|
},
|
|
106
80
|
];
|
package/dist/config/code.js
CHANGED
|
@@ -56,8 +56,8 @@ const CLI = {
|
|
|
56
56
|
// a release's reasons, from the pipeline (the API's
|
|
57
57
|
// db/type/release_reason.sql). The CLI shares them, so a name means the same
|
|
58
58
|
// thing wherever it appears: FUNCTION_TOO_LARGE, GAME_HANDLE_CHANGED,
|
|
59
|
-
// GAME_UNAVAILABLE, INTERNAL, as well as
|
|
60
|
-
// VERSION_EXISTS, are the CLI's too.
|
|
59
|
+
// GAME_UNAVAILABLE, INTERNAL, PACKAGE_PATH_INVALID, as well as
|
|
60
|
+
// REPO_NOT_CONNECTED and VERSION_EXISTS, are the CLI's too.
|
|
61
61
|
export const RELEASE = {
|
|
62
62
|
BUILD_RATE_LIMITED: "build_rate_limited",
|
|
63
63
|
FUNCTION_INVALID: "function_invalid",
|
|
@@ -69,6 +69,7 @@ export const RELEASE = {
|
|
|
69
69
|
GITHUB_APP_NOT_INSTALLED: "github_app_not_installed",
|
|
70
70
|
INTERNAL: "internal",
|
|
71
71
|
MANIFEST_INVALID: "manifest_invalid",
|
|
72
|
+
PACKAGE_PATH_INVALID: "package_path_invalid",
|
|
72
73
|
RELEASE_EXPIRED: "release_expired",
|
|
73
74
|
REPO_NOT_CONNECTED: "repo_not_connected",
|
|
74
75
|
VERSION_EXISTS: "version_exists",
|
|
@@ -92,6 +93,9 @@ export const ISSUE = {
|
|
|
92
93
|
DESCRIPTION_RULES_MISSING: "description_rules_missing",
|
|
93
94
|
DUPLICATE: "duplicate",
|
|
94
95
|
EMPTY: "empty",
|
|
96
|
+
// no longer used: arc validate checked deploy_dir for an index.html before
|
|
97
|
+
// 1.0.37, which packing checks now (package_index_missing). Kept, as
|
|
98
|
+
// every code is.
|
|
95
99
|
INDEX_MISSING: "index_missing",
|
|
96
100
|
INVALID: "invalid",
|
|
97
101
|
MARKDOWN_INVALID: "markdown_invalid",
|
|
@@ -137,5 +141,5 @@ export const WARNINGS = new Set(Object.values(WARNING));
|
|
|
137
141
|
// [declare]
|
|
138
142
|
// each error code by its own name too: `cfgcode.NOT_LOGGED_IN`.
|
|
139
143
|
export const { API_REFUSED, API_UNREACHABLE, ARGUMENT_INVALID, BUILD_FAILED, DEPLOY_DIR_MISSING, DEPLOY_RATE_LIMITED, FUNCTION_PAUSE_RESERVED, 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, LOCKFILE_MISSING, LOGIN_CODE_EXPIRED, LOGIN_FAILED, MANIFEST_MISSING, NOT_LOGGED_IN, PACKAGE_FILE_TOO_LARGE, PACKAGE_INDEX_MISSING, PACKAGE_PATH_RESERVED, PACKAGE_TOO_LARGE, PACKAGE_TOO_MANY_FILES, PACKAGE_UNCOMPRESSED_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;
|
|
140
|
-
export const { 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, RELEASE_EXPIRED, REPO_NOT_CONNECTED, VERSION_EXISTS, VERSION_MISMATCH, ZIP_INVALID, ZIP_MISSING, ZIP_TOO_LARGE, } = RELEASE;
|
|
144
|
+
export const { 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_PATH_INVALID, RELEASE_EXPIRED, REPO_NOT_CONNECTED, VERSION_EXISTS, VERSION_MISMATCH, ZIP_INVALID, ZIP_MISSING, ZIP_TOO_LARGE, } = RELEASE;
|
|
141
145
|
export const { GIT_TAG_INVALID, WORKFLOW_MISSING } = GITHUB;
|