arcadible 1.0.40 → 1.0.42
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/dist/action/build/tool.js +18 -6
- package/dist/action/function/tool.js +9 -7
- package/dist/action/game.js +15 -3
- package/dist/action/key/tool.js +16 -7
- package/dist/action/predeploy/secrets.js +2 -5
- package/dist/action/predeploy/tool.js +20 -1
- package/dist/action/secret/tool.js +2 -1
- package/dist/action/value/tool.js +9 -3
- package/dist/command/build.js +16 -2
- package/dist/command/deploy.js +7 -1
- package/dist/command/open.js +1 -1
- package/dist/command/play.js +1 -1
- package/dist/config/code.js +13 -8
- package/dist/phrase/common.js +5 -2
- package/dist/phrase/function.js +2 -2
- package/dist/phrase/value.js +6 -0
- package/dist/runner/bundle.js +1 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ import { join, resolve as resolvePath } from "node:path";
|
|
|
5
5
|
// [import]
|
|
6
6
|
import { pathExists } from "fs-extra";
|
|
7
7
|
// [import]
|
|
8
|
-
import { BUILT, bundle } from "../../runner/bundle.js";
|
|
9
|
-
import { BUILD_FAILED } from "../../config/code.js";
|
|
8
|
+
import { BUILT, bundle, misimported } from "../../runner/bundle.js";
|
|
9
|
+
import { BUILD_FAILED, WARNING } from "../../config/code.js";
|
|
10
10
|
import { buildCommand } from "../../util/command.js";
|
|
11
11
|
import { ArcError } from "../../util/error.js";
|
|
12
12
|
import { detect } from "../../util/lockfile.js";
|
|
@@ -41,11 +41,22 @@ function build(command, { cwdPath, outputPath }) {
|
|
|
41
41
|
// [function]
|
|
42
42
|
// the game's function, bundled after the project's own build, which may have
|
|
43
43
|
// written the code it's made from: resolves with the bundle's path, or null
|
|
44
|
-
// for a game with none.
|
|
45
|
-
|
|
44
|
+
// for a game with none. `onWarning` hears each package the function imports
|
|
45
|
+
// that's meant for a game or a server of one's own (function_import_wrong).
|
|
46
|
+
function buildRunner(root, main, onWarning) {
|
|
46
47
|
return typeof main === "string"
|
|
47
48
|
? bundle({
|
|
48
49
|
main: resolvePath(root, main),
|
|
50
|
+
onPackages: onWarning
|
|
51
|
+
? (names) => {
|
|
52
|
+
misimported(names).forEach((each) => {
|
|
53
|
+
onWarning({
|
|
54
|
+
code: WARNING.FUNCTION_IMPORT_WRONG,
|
|
55
|
+
message: phrase.functionImportWrong(each),
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
49
60
|
outfile: resolvePath(root, BUILT),
|
|
50
61
|
})
|
|
51
62
|
: Promise.resolve(null);
|
|
@@ -95,13 +106,14 @@ async function explain(ex, root) {
|
|
|
95
106
|
// [function]
|
|
96
107
|
// builds the project: its own build, then its runner, when it has one. The
|
|
97
108
|
// result is the build's, with `function`, the bundle's path, beside it.
|
|
98
|
-
|
|
109
|
+
// `onWarning` gets each of the bundle's warnings (function_import_wrong).
|
|
110
|
+
export async function buildTool({ onWarning, project: { function: runner, workflow }, root, }) {
|
|
99
111
|
try {
|
|
100
112
|
const artifact = await build(buildCommand(workflow.build), {
|
|
101
113
|
cwdPath: root,
|
|
102
114
|
outputPath: resolvePath(root, workflow.deploy_dir),
|
|
103
115
|
});
|
|
104
|
-
const bundled = await buildRunner(root, runner?.main);
|
|
116
|
+
const bundled = await buildRunner(root, runner?.main, onWarning);
|
|
105
117
|
return bundled ? { ...artifact, function: bundled } : artifact;
|
|
106
118
|
}
|
|
107
119
|
catch (ex) {
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// too, and so can its allowance, spent: a pause has a reason, and an owner
|
|
4
4
|
// lifts only their own.
|
|
5
5
|
import { deleteGameFunctionPause, discoverGameBuilds, gameFunctionPauses, gameFunctionUsages, putGameFunctionPause, } from "../../api.js";
|
|
6
|
-
import {
|
|
6
|
+
import { FUNCTION_PAUSE_NOT_OWNED, GAME_UNAVAILABLE, } from "../../config/code.js";
|
|
7
7
|
import { ArcError } from "../../util/error.js";
|
|
8
|
-
import { channelOf, CHANNELS, gameOf, headersOf, isStatus, needOf, } from "../game.js";
|
|
9
|
-
import {
|
|
8
|
+
import { channelOf, CHANNELS, gameOf, headersOf, isStatus, needOf, ownedOf, } from "../game.js";
|
|
9
|
+
import { functionPauseNotOwned, gameNotOwned } from "../../phrase/index.js";
|
|
10
10
|
// [declare]
|
|
11
11
|
// the reasons a function is paused for, the one that holds longest first:
|
|
12
12
|
// what a status says when there's more than one.
|
|
@@ -74,11 +74,12 @@ export async function pause(current, { channel, ...conf }) {
|
|
|
74
74
|
// resolves with `{ channel, lifted, paused }`, `paused` the reason it's
|
|
75
75
|
// still paused for, or null. One that isn't paused stays as it was, as `pause` leaves one
|
|
76
76
|
// that's paused already. A pause of Arcadible's, or a limit's, isn't
|
|
77
|
-
// its owner's to lift:
|
|
77
|
+
// its owner's to lift: function_pause_not_owned, saying who lifts it.
|
|
78
78
|
export async function resume(current, { channel, ...conf }) {
|
|
79
79
|
const where = needOf(channel);
|
|
80
80
|
const id = await gameOf(conf);
|
|
81
81
|
const headers = headersOf(current);
|
|
82
|
+
await ownedOf(id, headers);
|
|
82
83
|
let lifted = true;
|
|
83
84
|
try {
|
|
84
85
|
await deleteGameFunctionPause(id, where, null, headers);
|
|
@@ -91,7 +92,7 @@ export async function resume(current, { channel, ...conf }) {
|
|
|
91
92
|
}
|
|
92
93
|
const paused = pausedOf(await gameFunctionPauses(id, null, headers), where);
|
|
93
94
|
if (!lifted && paused) {
|
|
94
|
-
throw new ArcError(
|
|
95
|
+
throw new ArcError(FUNCTION_PAUSE_NOT_OWNED, functionPauseNotOwned({ channel: where, paused }));
|
|
95
96
|
}
|
|
96
97
|
return { channel: where, lifted, paused };
|
|
97
98
|
}
|
|
@@ -107,13 +108,14 @@ export async function status(current, { channel, ...conf }) {
|
|
|
107
108
|
const where = channelOf(channel);
|
|
108
109
|
const id = await gameOf(conf);
|
|
109
110
|
const headers = headersOf(current);
|
|
111
|
+
await ownedOf(id, headers);
|
|
110
112
|
const [pauses, usages] = await Promise.all([
|
|
111
113
|
gameFunctionPauses(id, null, headers),
|
|
112
114
|
gameFunctionUsages(id, null, headers),
|
|
113
115
|
]);
|
|
114
116
|
const shown = CHANNELS.filter((each) => !where || each === where);
|
|
115
|
-
// asked once the
|
|
116
|
-
// is refused before anything else is asked about it.
|
|
117
|
+
// asked once the game is known to be the caller's, so another account's
|
|
118
|
+
// game is refused before anything else is asked about it.
|
|
117
119
|
const has = await Promise.all(shown.map((each) => hasFunction(id, each)));
|
|
118
120
|
const rows = usages ?? [];
|
|
119
121
|
const [first] = rows;
|
package/dist/action/game.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
// function's secrets, its server's keys): the project's game, the channel a
|
|
3
3
|
// command names, the session's headers, and telling the API's refusals
|
|
4
4
|
// apart.
|
|
5
|
-
import { auth } from "../api.js";
|
|
6
|
-
import { ALL, ARGUMENT_INVALID, GAME_ID_MISSING, NOT_LOGGED_IN, } from "../config/code.js";
|
|
5
|
+
import { auth, gameWireUsages } from "../api.js";
|
|
6
|
+
import { ALL, ARGUMENT_INVALID, GAME_ID_MISSING, GAME_UNAVAILABLE, 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";
|
|
10
|
-
import { channelInvalid, gameIdMissing, notLoggedIn } from "../phrase/index.js";
|
|
10
|
+
import { channelInvalid, gameIdMissing, gameNotOwned, notLoggedIn, } from "../phrase/index.js";
|
|
11
11
|
import { textOf } from "../util/objs.js";
|
|
12
12
|
// [declare]
|
|
13
13
|
export const CHANNELS = ["production", "staging"];
|
|
@@ -56,6 +56,18 @@ export function headersOf(current) {
|
|
|
56
56
|
return auth(current.session.access_token);
|
|
57
57
|
}
|
|
58
58
|
// [function]
|
|
59
|
+
// that the game is the caller's, asked before a read the API answers as
|
|
60
|
+
// none for another account's game (its keys, its function's secrets,
|
|
61
|
+
// pauses, and usage): its owner always reads today's wire usage for each
|
|
62
|
+
// channel, so none at all is a game that isn't theirs, game_unavailable,
|
|
63
|
+
// as `arc unstable wire usage` says.
|
|
64
|
+
export async function ownedOf(id, headers) {
|
|
65
|
+
const rows = await gameWireUsages(id, null, headers);
|
|
66
|
+
if (!rows?.length) {
|
|
67
|
+
throw new ArcError(GAME_UNAVAILABLE, gameNotOwned(id));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// [function]
|
|
59
71
|
// whether a failure is the API's refusal with this status.
|
|
60
72
|
export function isStatus(err, status) {
|
|
61
73
|
return err instanceof HttpError && err.status === status;
|
package/dist/action/key/tool.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { deleteKey, gameKeys, postGameKey, } from "../../api.js";
|
|
5
5
|
import { ARGUMENT_INVALID, GAME_UNAVAILABLE, KEY_LIMIT_REACHED, KEY_NOT_FOUND, } from "../../config/code.js";
|
|
6
6
|
import { ArcError } from "../../util/error.js";
|
|
7
|
-
import { channelOf, gameOf, headersOf, isRefused, isStatus, needOf, } from "../game.js";
|
|
7
|
+
import { channelOf, gameOf, headersOf, isRefused, isStatus, needOf, ownedOf, } from "../game.js";
|
|
8
8
|
import { gameNotOwned, keyLimitReached, keyNameInvalid, keyNotFound, } from "../../phrase/index.js";
|
|
9
9
|
// [declare]
|
|
10
10
|
const NAME_MAX = 64;
|
|
@@ -54,7 +54,9 @@ export async function create(current, { channel, name, ...conf }) {
|
|
|
54
54
|
export async function list(current, { channel, ...conf }) {
|
|
55
55
|
const where = channelOf(channel);
|
|
56
56
|
const id = await gameOf(conf);
|
|
57
|
-
const
|
|
57
|
+
const headers = headersOf(current);
|
|
58
|
+
await ownedOf(id, headers);
|
|
59
|
+
const keys = await gameKeys(id, null, headers);
|
|
58
60
|
return (keys ?? [])
|
|
59
61
|
.filter((key) => !where || key.channel === where)
|
|
60
62
|
.map((key) => ({
|
|
@@ -68,13 +70,20 @@ export async function list(current, { channel, ...conf }) {
|
|
|
68
70
|
}
|
|
69
71
|
// [function]
|
|
70
72
|
// revokes the key with this id, and resolves with `{ id }`. One that's gone
|
|
71
|
-
// already, isn't the
|
|
72
|
-
// owner: not found. A key is addressed by its own id,
|
|
73
|
-
//
|
|
73
|
+
// already, isn't the project's game's, or isn't an id at all is the same to
|
|
74
|
+
// its owner: not found. A key is addressed by its own id, which the API
|
|
75
|
+
// checks is the account's, so it's looked for among the game's live keys
|
|
76
|
+
// first: another of the account's games keeps its own.
|
|
74
77
|
export async function revoke(current, { id, ...conf }) {
|
|
75
|
-
await gameOf(conf);
|
|
78
|
+
const game = await gameOf(conf);
|
|
79
|
+
const headers = headersOf(current);
|
|
80
|
+
await ownedOf(game, headers);
|
|
81
|
+
const keys = await gameKeys(game, null, headers);
|
|
82
|
+
if (!(keys ?? []).some((key) => key.id === id)) {
|
|
83
|
+
throw new ArcError(KEY_NOT_FOUND, keyNotFound(id));
|
|
84
|
+
}
|
|
76
85
|
try {
|
|
77
|
-
const gone = await deleteKey(id, null,
|
|
86
|
+
const gone = await deleteKey(id, null, headers);
|
|
78
87
|
return { id: gone.id };
|
|
79
88
|
}
|
|
80
89
|
catch (err) {
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
// them, so a build can ship naming one (`[function] secrets`) with no value
|
|
3
3
|
// on its channel, and its function then reads nothing for it. A direct
|
|
4
4
|
// deploy can say so first, since it has the login that reads the game's
|
|
5
|
-
// secrets; `arc deploy git` has none, and never asks.
|
|
6
|
-
//
|
|
7
|
-
// Nothing calls this yet: what it finds is a warning, a warning has a code,
|
|
8
|
-
// and a code has an entry on the public Errors page, which says nothing of
|
|
9
|
-
// functions until they ship (TODO.md, Agreed next).
|
|
5
|
+
// secrets; `arc deploy git` has none, and never asks. `predeployTool` warns
|
|
6
|
+
// of each (secret_unset).
|
|
10
7
|
import { auth, gameFunctionSecrets } from "../../api.js";
|
|
11
8
|
import { channel } from "../../util/links.js";
|
|
12
9
|
// [function]
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
// [import]
|
|
2
2
|
import { ensureId, ensureUnpublished } from "./ac.js";
|
|
3
|
+
import { WARNING } from "../../config/code.js";
|
|
3
4
|
import { releasing } from "./game.js";
|
|
5
|
+
import { secretUnset } from "../../phrase/index.js";
|
|
6
|
+
import { unset } from "./secrets.js";
|
|
7
|
+
// [function]
|
|
8
|
+
// warns of each secret the project's function declares that has no value
|
|
9
|
+
// on the channel the version goes to (secret_unset): never a failure, since
|
|
10
|
+
// a value may be set after. Asked only when it declares some.
|
|
11
|
+
function warnUnset(current, game, declared, handler) {
|
|
12
|
+
return unset(current, game, declared).then(({ channel, names }) => {
|
|
13
|
+
for (const name of names) {
|
|
14
|
+
if (handler.onWarning) {
|
|
15
|
+
handler.onWarning({
|
|
16
|
+
code: WARNING.SECRET_UNSET,
|
|
17
|
+
message: secretUnset({ channel, name }),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
4
23
|
// [function]
|
|
5
24
|
// a direct deploy needs a login. Each lookup uses its token or not, as it
|
|
6
25
|
// needs, and its answer is true when it's asked.
|
|
@@ -10,5 +29,5 @@ export function predeployTool(current, conf, { onPredeployBegin, ...handler }) {
|
|
|
10
29
|
}
|
|
11
30
|
return ensureId(current, releasing(conf.project.game), handler)
|
|
12
31
|
.then((game) => ensureUnpublished(current, game))
|
|
13
|
-
.then((game) => ({ held: game.held, to: game.version }));
|
|
32
|
+
.then((game) => warnUnset(current, game, conf.project.function?.secrets, handler).then(() => ({ held: game.held, to: game.version })));
|
|
14
33
|
}
|
|
@@ -6,7 +6,7 @@ import { deleteGameFunctionSecret, gameFunctionSecrets, putGameFunctionSecret, }
|
|
|
6
6
|
import { ARGUMENT_INVALID, GAME_UNAVAILABLE, SECRET_LIMIT_REACHED, SECRET_NOT_FOUND, } from "../../config/code.js";
|
|
7
7
|
import { SECRET_NAME } from "../../config/limit.js";
|
|
8
8
|
import { ArcError } from "../../util/error.js";
|
|
9
|
-
import { channelOf, gameOf, headersOf, isRefused, isStatus, needOf, } from "../game.js";
|
|
9
|
+
import { channelOf, gameOf, headersOf, isRefused, isStatus, needOf, ownedOf, } from "../game.js";
|
|
10
10
|
import { gameNotOwned, secretLimitReached, secretNameInvalid, secretNotFound, secretValueInvalid, } from "../../phrase/index.js";
|
|
11
11
|
// [declare]
|
|
12
12
|
const VALUE_MAX = 4096;
|
|
@@ -59,6 +59,7 @@ export async function list(current, { channel, ...conf }) {
|
|
|
59
59
|
const where = channelOf(channel);
|
|
60
60
|
const id = await gameOf(conf);
|
|
61
61
|
const headers = headersOf(current);
|
|
62
|
+
await ownedOf(id, headers);
|
|
62
63
|
const secrets = await gameFunctionSecrets(id, null, headers);
|
|
63
64
|
return (secrets ?? [])
|
|
64
65
|
.filter((secret) => !where || secret.channel === where)
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { gameValuesList, gameValuesRead, gameValuesRemove, gameValuesWrite, gameValueCalls, gameValueUsages, } from "../../api.js";
|
|
9
|
-
import { ARGUMENT_INVALID, GAME_UNAVAILABLE, VALUE_NOT_FOUND, VALUE_STORAGE_FULL, VALUE_TOO_LARGE, } from "../../config/code.js";
|
|
9
|
+
import { ARGUMENT_INVALID, GAME_UNAVAILABLE, LIMIT_REACHED, VALUE_NOT_FOUND, VALUE_STORAGE_FULL, VALUE_TOO_LARGE, } from "../../config/code.js";
|
|
10
10
|
import { ArcError } from "../../util/error.js";
|
|
11
|
+
import { HttpError } from "../../util/http.js";
|
|
11
12
|
import { gameOf, headersOf, isStatus, needOf } from "../game.js";
|
|
12
|
-
import { gameNotOwned, valueDirEmpty, valueFileUnread, valueFull, valueHolds, valueKeyInvalid, valueNotFound, valueNotJson, valueSetWhat, valueTooLarge, } from "../../phrase/index.js";
|
|
13
|
+
import { gameNotOwned, valueCallsSpent, valueDirEmpty, valueFileUnread, valueFull, valueHolds, valueKeyInvalid, valueNotFound, valueNotJson, valueSetWhat, valueTooLarge, } from "../../phrase/index.js";
|
|
13
14
|
// [declare]
|
|
14
15
|
// a key, as Arcadible takes one (db/function/game_value.sql, value_keys).
|
|
15
16
|
export const KEY = /^[A-Za-z0-9_./-]{1,128}$/u;
|
|
@@ -105,7 +106,9 @@ async function holds(id, channel, headers) {
|
|
|
105
106
|
}
|
|
106
107
|
// [function]
|
|
107
108
|
// the API's refusals, said for a developer's values: a game that isn't the
|
|
108
|
-
// caller's,
|
|
109
|
+
// caller's, a scope that's full, with what it may hold, and the game's
|
|
110
|
+
// calls for the day, or its account's for the month, spent (a `429` that
|
|
111
|
+
// says `limit_reached`, never a minute's).
|
|
109
112
|
function refused(id, channel, headers) {
|
|
110
113
|
return async (err) => {
|
|
111
114
|
if (isStatus(err, 404)) {
|
|
@@ -116,6 +119,9 @@ function refused(id, channel, headers) {
|
|
|
116
119
|
if (isStatus(err, 507)) {
|
|
117
120
|
throw new ArcError(VALUE_STORAGE_FULL, valueFull(channel, await holds(id, channel, headers)), { cause: err });
|
|
118
121
|
}
|
|
122
|
+
if (err instanceof HttpError && err.code === LIMIT_REACHED) {
|
|
123
|
+
throw new ArcError(LIMIT_REACHED, valueCallsSpent(), { cause: err });
|
|
124
|
+
}
|
|
119
125
|
throw err;
|
|
120
126
|
};
|
|
121
127
|
}
|
package/dist/command/build.js
CHANGED
|
@@ -5,7 +5,7 @@ import { checked } from "../action/validate/checked.js";
|
|
|
5
5
|
import { WARNING } from "../config/code.js";
|
|
6
6
|
import { defineCommand } from "../cli/command.js";
|
|
7
7
|
import { buildOutputMissing, buildSucceeded, nothingToDo, } from "../phrase/index.js";
|
|
8
|
-
import { hs, nlpw, result } from "../util/log.js";
|
|
8
|
+
import { hs, nlpw, pw, result } from "../util/log.js";
|
|
9
9
|
import { CWD, JSON_OUTPUT, QUIET } from "../cli/options.js";
|
|
10
10
|
import { print, warn, warning } from "../util/output.js";
|
|
11
11
|
import { SpinnerWheel } from "../util/spinner.js";
|
|
@@ -37,7 +37,21 @@ export default defineCommand({
|
|
|
37
37
|
sw = new SpinnerWheel("Building… %s");
|
|
38
38
|
aborting.sw = sw;
|
|
39
39
|
sw.start(json || quiet);
|
|
40
|
-
|
|
40
|
+
// the bundle's own, printed once it's built.
|
|
41
|
+
const bundled = [];
|
|
42
|
+
const artifact = await buildTool({
|
|
43
|
+
onWarning({ code, message }) {
|
|
44
|
+
bundled.push(warning(code, message));
|
|
45
|
+
},
|
|
46
|
+
project: parsed,
|
|
47
|
+
root,
|
|
48
|
+
});
|
|
49
|
+
warnings = [...warnings, ...bundled];
|
|
50
|
+
aborting.data = { warnings };
|
|
51
|
+
if (!json && !quiet && bundled.length) {
|
|
52
|
+
sw.stop(true);
|
|
53
|
+
bundled.forEach((each) => pw(each.message));
|
|
54
|
+
}
|
|
41
55
|
if (json) {
|
|
42
56
|
const missing = artifact?.missing
|
|
43
57
|
? [
|
package/dist/command/deploy.js
CHANGED
|
@@ -127,7 +127,13 @@ export default defineCommand({
|
|
|
127
127
|
const held = predeployed.held ?? false;
|
|
128
128
|
sw = spinner(aborting, "Building… %s");
|
|
129
129
|
sw.start(git || json || quiet);
|
|
130
|
-
const output = git
|
|
130
|
+
const output = git
|
|
131
|
+
? null
|
|
132
|
+
: await buildTool({
|
|
133
|
+
onWarning: handler({ json, pb, quiet, sw, warnings }).onWarning,
|
|
134
|
+
project: parsed,
|
|
135
|
+
root,
|
|
136
|
+
});
|
|
131
137
|
if (output) {
|
|
132
138
|
parsed = await rebuilt(root);
|
|
133
139
|
}
|
package/dist/command/open.js
CHANGED
|
@@ -30,7 +30,7 @@ export default defineCommand({
|
|
|
30
30
|
root: resolve(process.cwd(), argv.cwd),
|
|
31
31
|
});
|
|
32
32
|
if (!data) {
|
|
33
|
-
throw new ArcError(GAME_ID_MISSING, gameIdMissing());
|
|
33
|
+
throw new ArcError(GAME_ID_MISSING, gameIdMissing(true));
|
|
34
34
|
}
|
|
35
35
|
const { page, url } = data;
|
|
36
36
|
const where = await (argv.browser
|
package/dist/command/play.js
CHANGED
|
@@ -59,7 +59,7 @@ export default defineCommand({
|
|
|
59
59
|
const orientation = data?.orientation;
|
|
60
60
|
const url = data?.url;
|
|
61
61
|
if (!data || !orientation || !url) {
|
|
62
|
-
throw new ArcError(GAME_ID_MISSING, gameIdMissing());
|
|
62
|
+
throw new ArcError(GAME_ID_MISSING, gameIdMissing(true));
|
|
63
63
|
}
|
|
64
64
|
sw.stop(true);
|
|
65
65
|
if (data.fallback && !argv.json && !argv.quiet) {
|
package/dist/config/code.js
CHANGED
|
@@ -11,7 +11,7 @@ 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
|
-
|
|
14
|
+
FUNCTION_PAUSE_NOT_OWNED: "function_pause_not_owned",
|
|
15
15
|
GAME_HANDLE_TAKEN: "game_handle_taken",
|
|
16
16
|
GAME_ID_MISSING: "game_id_missing",
|
|
17
17
|
GAME_NOT_DEPLOYED: "game_not_deployed",
|
|
@@ -25,18 +25,15 @@ const CLI = {
|
|
|
25
25
|
GIT_UNCOMMITTED: "git_uncommitted",
|
|
26
26
|
KEY_LIMIT_REACHED: "key_limit_reached",
|
|
27
27
|
KEY_NOT_FOUND: "key_not_found",
|
|
28
|
+
LIMIT_REACHED: "limit_reached",
|
|
28
29
|
LOCKFILE_MISSING: "lockfile_missing",
|
|
29
30
|
LOGIN_CODE_EXPIRED: "login_code_expired",
|
|
30
31
|
LOGIN_FAILED: "login_failed",
|
|
31
32
|
MANIFEST_MISSING: "manifest_missing",
|
|
32
33
|
NOT_LOGGED_IN: "not_logged_in",
|
|
33
|
-
PACKAGE_FILE_TOO_LARGE: "package_file_too_large",
|
|
34
34
|
PACKAGE_INDEX_MISSING: "package_index_missing",
|
|
35
35
|
PACKAGE_LINK_INVALID: "package_link_invalid",
|
|
36
|
-
PACKAGE_PATH_RESERVED: "package_path_reserved",
|
|
37
36
|
PACKAGE_TOO_LARGE: "package_too_large",
|
|
38
|
-
PACKAGE_TOO_MANY_FILES: "package_too_many_files",
|
|
39
|
-
PACKAGE_UNCOMPRESSED_TOO_LARGE: "package_uncompressed_too_large",
|
|
40
37
|
PARSE_FAILED: "parse_failed",
|
|
41
38
|
PATH_NOT_FOUND: "path_not_found",
|
|
42
39
|
PORT_IN_USE: "port_in_use",
|
|
@@ -57,9 +54,10 @@ const CLI = {
|
|
|
57
54
|
// a release's reasons, from the pipeline (the API's
|
|
58
55
|
// db/type/release_reason.sql). The CLI shares them, so a name means the same
|
|
59
56
|
// thing wherever it appears: FUNCTION_TOO_LARGE, GAME_HANDLE_CHANGED,
|
|
60
|
-
// GAME_UNAVAILABLE, INTERNAL,
|
|
57
|
+
// GAME_UNAVAILABLE, INTERNAL, the PACKAGE_ codes here, as well as
|
|
61
58
|
// REPO_NOT_CONNECTED and VERSION_EXISTS, are the CLI's too.
|
|
62
59
|
export const RELEASE = {
|
|
60
|
+
BUILD_NOT_PUBLISHED: "build_not_published",
|
|
63
61
|
BUILD_RATE_LIMITED: "build_rate_limited",
|
|
64
62
|
FUNCTION_INVALID: "function_invalid",
|
|
65
63
|
FUNCTION_TOO_LARGE: "function_too_large",
|
|
@@ -70,9 +68,14 @@ export const RELEASE = {
|
|
|
70
68
|
GITHUB_APP_NOT_INSTALLED: "github_app_not_installed",
|
|
71
69
|
INTERNAL: "internal",
|
|
72
70
|
MANIFEST_INVALID: "manifest_invalid",
|
|
71
|
+
PACKAGE_FILE_TOO_LARGE: "package_file_too_large",
|
|
73
72
|
PACKAGE_PATH_INVALID: "package_path_invalid",
|
|
73
|
+
PACKAGE_PATH_RESERVED: "package_path_reserved",
|
|
74
|
+
PACKAGE_TOO_MANY_FILES: "package_too_many_files",
|
|
75
|
+
PACKAGE_UNCOMPRESSED_TOO_LARGE: "package_uncompressed_too_large",
|
|
74
76
|
RELEASE_EXPIRED: "release_expired",
|
|
75
77
|
REPO_NOT_CONNECTED: "repo_not_connected",
|
|
78
|
+
SERVERS_CHANGED: "servers_changed",
|
|
76
79
|
VERSION_EXISTS: "version_exists",
|
|
77
80
|
VERSION_MISMATCH: "version_mismatch",
|
|
78
81
|
ZIP_INVALID: "zip_invalid",
|
|
@@ -122,12 +125,14 @@ export const WARNING = {
|
|
|
122
125
|
DEPLOY_DIR_NOT_BUILT: "deploy_dir_not_built",
|
|
123
126
|
FIELD_UNKNOWN: "field_unknown",
|
|
124
127
|
FIELD_UNSET: "field_unset",
|
|
128
|
+
FUNCTION_IMPORT_WRONG: "function_import_wrong",
|
|
125
129
|
GAME_HANDLE_LAPSED: "game_handle_lapsed",
|
|
126
130
|
GAME_HANDLE_LIMIT_REACHED: "game_handle_limit_reached",
|
|
127
131
|
PACKAGE_FILE_DEV: "package_file_dev",
|
|
128
132
|
PACKAGE_FILE_PRIVATE: "package_file_private",
|
|
129
133
|
SCREENSHOT_NAME_INVALID: "screenshot_name_invalid",
|
|
130
134
|
SDK_SCRIPT_PATH: "sdk_script_path",
|
|
135
|
+
SECRET_UNSET: "secret_unset",
|
|
131
136
|
VERSION_UNCHECKED: "version_unchecked",
|
|
132
137
|
};
|
|
133
138
|
// every error code, for checking one exists.
|
|
@@ -142,6 +147,6 @@ export const ISSUES = new Set(Object.values(ISSUE));
|
|
|
142
147
|
export const WARNINGS = new Set(Object.values(WARNING));
|
|
143
148
|
// [declare]
|
|
144
149
|
// each error code by its own name too: `cfgcode.NOT_LOGGED_IN`.
|
|
145
|
-
export const { API_REFUSED, API_UNREACHABLE, ARGUMENT_INVALID, BUILD_FAILED, DEPLOY_DIR_MISSING, DEPLOY_RATE_LIMITED,
|
|
146
|
-
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;
|
|
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;
|
|
147
152
|
export const { GIT_TAG_INVALID, WORKFLOW_MISSING } = GITHUB;
|
package/dist/phrase/common.js
CHANGED
|
@@ -81,8 +81,11 @@ export function httpError(name, status, detail) {
|
|
|
81
81
|
return detail ? `${head}: ${detail}` : `${head}.`;
|
|
82
82
|
}
|
|
83
83
|
// [function]
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// no game: a command that takes one (`arc play`, `arc open`) says to pass
|
|
85
|
+
// it; the rest read only the project's id, so they say where to run.
|
|
86
|
+
export function gameIdMissing(passable = false) {
|
|
87
|
+
const where = `in a project after ${cmdInit()} has added an ID.`;
|
|
88
|
+
return blocks("No game handle or ID.", passable ? `Pass one, or run it ${where}` : `Run it ${where}`);
|
|
86
89
|
}
|
|
87
90
|
// [function]
|
|
88
91
|
export function noProductionRelease() {
|
package/dist/phrase/function.js
CHANGED
|
@@ -94,7 +94,7 @@ export function cpuTime(ms) {
|
|
|
94
94
|
// [function]
|
|
95
95
|
// a resume with no pause of the owner's to lift, and one of another's: who
|
|
96
96
|
// lifts it.
|
|
97
|
-
export function
|
|
97
|
+
export function functionPauseNotOwned({ channel, paused, }) {
|
|
98
98
|
if (paused === "arcadible") {
|
|
99
99
|
return blocks(`The game's function is paused by Arcadible on ${channel}.`, "Only Arcadible can resume it.");
|
|
100
100
|
}
|
|
@@ -109,7 +109,7 @@ export function secretSet({ channel, name, }) {
|
|
|
109
109
|
}
|
|
110
110
|
// [function]
|
|
111
111
|
// a secret a build declares that has no value on the channel it goes to,
|
|
112
|
-
// which `arc deploy` warns of (
|
|
112
|
+
// which `arc deploy` warns of (action/predeploy/secrets.ts).
|
|
113
113
|
export function secretUnset({ channel, name, }) {
|
|
114
114
|
return `Secret ${name} has no value on ${channel}.\nSet it with \`arc unstable function secret set ${name} --${channel}\`.`;
|
|
115
115
|
}
|
package/dist/phrase/value.js
CHANGED
|
@@ -47,6 +47,12 @@ export function valueHolds({ bytes_limit: bytes, keys_limit: keys, }) {
|
|
|
47
47
|
return `${keys === null ? "any number of" : keys.toLocaleString("en-US")} keys, ${bytes === null ? "any size" : valueSize(bytes)}`;
|
|
48
48
|
}
|
|
49
49
|
// [function]
|
|
50
|
+
// the game's calls to its values spent: its own for the day, or its
|
|
51
|
+
// account's for the month, as the API doesn't say which.
|
|
52
|
+
export function valueCallsSpent() {
|
|
53
|
+
return blocks("The game's calls to its values are spent for the day, or its account's for the month.", "Writes and removes go on when the day or the month turns (UTC). Reads still work.");
|
|
54
|
+
}
|
|
55
|
+
// [function]
|
|
50
56
|
// the developer's values on `channel` full, with what they may hold, the
|
|
51
57
|
// account's plan's, when the API could say.
|
|
52
58
|
export function valueFull(channel, holds) {
|
package/dist/runner/bundle.js
CHANGED
|
@@ -37,10 +37,7 @@ export const WRONG = {
|
|
|
37
37
|
//
|
|
38
38
|
// `onPackages`, when given, hears the `@arcadible/` packages the bundle took
|
|
39
39
|
// in, by name, each once, so a build can say when a function imports one
|
|
40
|
-
// that isn't the Function SDK (`misimported
|
|
41
|
-
// finds is a warning, a warning has a code, and a code has an entry on the
|
|
42
|
-
// public Errors page, which says nothing of functions until they ship
|
|
43
|
-
// (TODO.md, Agreed next).
|
|
40
|
+
// that isn't the Function SDK (`misimported`, function_import_wrong).
|
|
44
41
|
//
|
|
45
42
|
// `onInputs`, when given, hears every file the bundle was made from, each a
|
|
46
43
|
// full path, so `arc serve` can run the function again when any of them
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "Apache-2.0",
|
|
44
44
|
"name": "arcadible",
|
|
45
|
-
"version": "1.0.
|
|
45
|
+
"version": "1.0.42"
|
|
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.
|
|
2436
|
+
"version": "1.0.42"
|
|
2437
2437
|
}
|
package/package.json
CHANGED