arcadible 1.0.49 → 1.0.51

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.
Files changed (69) hide show
  1. package/README.md +5 -1
  2. package/dist/action/deploy/result.js +3 -3
  3. package/dist/action/deploy/tool-git.js +1 -1
  4. package/dist/action/deploy/tool.js +1 -1
  5. package/dist/action/deploy/wait.js +1 -1
  6. package/dist/action/function/logs.js +4 -4
  7. package/dist/action/function/tool.js +42 -27
  8. package/dist/action/key/tool.js +10 -4
  9. package/dist/action/secret/tool.js +2 -1
  10. package/dist/action/validate/unknown.js +1 -1
  11. package/dist/action/value/local.js +78 -0
  12. package/dist/action/value/tool.js +81 -35
  13. package/dist/action/wire/tool.js +1 -1
  14. package/dist/api.js +1 -0
  15. package/dist/cli/command.js +13 -1
  16. package/dist/cli/options.js +7 -0
  17. package/dist/cli/prompt.js +1 -1
  18. package/dist/command/deploy/report.js +5 -5
  19. package/dist/command/function/index.js +4 -4
  20. package/dist/command/function/logs.js +4 -4
  21. package/dist/command/function/pause.js +1 -1
  22. package/dist/command/function/resume.js +1 -1
  23. package/dist/command/function/run.js +1 -1
  24. package/dist/command/function/secret/index.js +1 -1
  25. package/dist/command/function/secret/list.js +2 -1
  26. package/dist/command/function/secret/remove.js +2 -2
  27. package/dist/command/function/secret/run.js +1 -1
  28. package/dist/command/function/secret/set.js +1 -1
  29. package/dist/command/function/status.js +7 -36
  30. package/dist/command/function/usage.js +64 -0
  31. package/dist/command/game/delete.js +2 -2
  32. package/dist/command/game/index.js +2 -2
  33. package/dist/command/open.js +1 -1
  34. package/dist/command/play.js +1 -1
  35. package/dist/command/server/index.js +3 -3
  36. package/dist/command/server/key/create.js +4 -4
  37. package/dist/command/server/key/index.js +1 -1
  38. package/dist/command/server/key/list.js +3 -2
  39. package/dist/command/server/key/revoke.js +1 -1
  40. package/dist/command/server/key/run.js +1 -1
  41. package/dist/command/unstable/index.js +8 -13
  42. package/dist/command/value/get.js +12 -8
  43. package/dist/command/value/index.js +4 -4
  44. package/dist/command/value/list.js +14 -6
  45. package/dist/command/value/remove.js +22 -11
  46. package/dist/command/value/run.js +40 -0
  47. package/dist/command/value/set.js +27 -22
  48. package/dist/command/value/usage.js +47 -39
  49. package/dist/command/wire/index.js +1 -2
  50. package/dist/commands.js +28 -0
  51. package/dist/config/code.js +4 -2
  52. package/dist/config/limit.js +5 -5
  53. package/dist/config/retry.js +2 -0
  54. package/dist/parser/project.js +2 -1
  55. package/dist/phrase/common.js +12 -6
  56. package/dist/phrase/deploy.js +4 -3
  57. package/dist/phrase/function.js +27 -21
  58. package/dist/phrase/game.js +3 -3
  59. package/dist/phrase/pack.js +4 -1
  60. package/dist/phrase/serve.js +2 -2
  61. package/dist/phrase/server.js +10 -5
  62. package/dist/phrase/value.js +50 -16
  63. package/dist/schema/client.js +11 -6
  64. package/dist/serve/values.js +2 -2
  65. package/dist/util/output.js +11 -4
  66. package/dist/util/schema.js +5 -3
  67. package/dist/util/time.js +5 -0
  68. package/npm-shrinkwrap.json +2 -2
  69. package/package.json +2 -1
@@ -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 unstable value set` given neither a key nor a folder, or both.
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, or a folder.", "`arc unstable value set <key> --file value.json` sets one value, and `arc unstable value set --dir .arcadible-data/values` sets a value for each .json file in a folder.");
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
- export function valueDirEmpty(dir) {
23
- return blocks(`No values in ${dir}.`, "Each .json file there is a value, and its path its key: daily/2026-11-12.json is daily/2026-11-12.");
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 limit): "10,000
42
- // keys, 64 MB", or "no limit".
43
- export function valueHolds({ bytes_limit: bytes, keys_limit: keys, }) {
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 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.");
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 unstable value remove <key>`, then try again.";
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 unstable value usage\` shows what they hold.`
62
- : `They may hold ${holds}. ${remove}`);
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} on ${channel}.`
69
- : `Set ${keys.length} values on ${channel}.`;
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 on ${channel}.\n\`arc unstable value list --${channel}\` shows what is.`);
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
- return `Remove ${key} from ${channel}? Games read nothing for it from then on.`;
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() {
@@ -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 "A server is reached on port 443, the default: leave the port out.";
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 "A scheme and a host, with no path. A ticket is for the whole server.";
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;
@@ -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;
@@ -100,7 +100,7 @@ export function errorOf(ex, code, retry) {
100
100
  }
101
101
  : {}),
102
102
  code: shown,
103
- link: `${ERRORS}#${shown}`,
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
- print({ ...ex.data, ...data, error: errorOf(ex, code, retry) });
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
- link: `${ERRORS}#${code}`,
178
+ docs_url: `${ERRORS}#${code}`,
172
179
  message,
173
180
  path,
174
181
  };
@@ -106,7 +106,9 @@ export function toIssue(name, issue) {
106
106
  return {
107
107
  code: issueCodeOf(issue),
108
108
  details,
109
- link: issue.path.length ? messageLink(name, String(issue.path[0])) : null,
109
+ docs_url: issue.path.length
110
+ ? messageLink(name, String(issue.path[0]))
111
+ : null,
110
112
  message,
111
113
  path: `${name}.${issue.path.join(".") || "value"}`,
112
114
  };
@@ -115,7 +117,7 @@ export function toIssue(name, issue) {
115
117
  // an issue as it's printed: the path, the message, then its details and its
116
118
  // link, indented beneath it. `linked` false leaves the link out. `marker`
117
119
  // colors it, standard output's unless it's printed elsewhere.
118
- export function print({ details, link, message, path }, linked = true, marker = chalk) {
120
+ export function print({ details, docs_url: link, message, path }, linked = true, marker = chalk) {
119
121
  const rest = [
120
122
  ...details,
121
123
  ...(linked && link ? [marker.cyan.underline(link)] : []),
@@ -128,7 +130,7 @@ export function print({ details, link, message, path }, linked = true, marker =
128
130
  // validate's list of references.
129
131
  export function dereference(issues) {
130
132
  const references = [
131
- ...new Set(issues.flatMap(({ link }) => (link ? [link] : []))),
133
+ ...new Set(issues.flatMap(({ docs_url: link }) => (link ? [link] : []))),
132
134
  ].map((link) => chalk.cyan.underline(link));
133
135
  return [issues.map((issue) => print(issue, false)), references];
134
136
  }
package/dist/util/time.js CHANGED
@@ -14,3 +14,8 @@ export function m(value) {
14
14
  export function h(value) {
15
15
  return m(value * 60);
16
16
  }
17
+ export function iso(value) {
18
+ return value === null || value === undefined || value === ""
19
+ ? null
20
+ : new Date(value).toISOString();
21
+ }
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "license": "Apache-2.0",
44
44
  "name": "arcadible",
45
- "version": "1.0.49"
45
+ "version": "1.0.51"
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.49"
2436
+ "version": "1.0.51"
2437
2437
  }
package/package.json CHANGED
@@ -63,9 +63,10 @@
63
63
  "scripts": {
64
64
  "build": "tsc && node ../../../src/cloudflare/io-arcadible-runner-dispatch/built.mjs .",
65
65
  "lint": "eslint -c eslint.config.mjs src",
66
+ "outputs": "npm run build && node test/support/outputs.js",
66
67
  "prepack": "rm -rf dist && npm run build",
67
68
  "test": "tsc && npm run lint && node --test \"test/**/*.test.js\" \"test/**/*.test.mjs\""
68
69
  },
69
70
  "type": "module",
70
- "version": "1.0.49"
71
+ "version": "1.0.51"
71
72
  }