@vercel/board 0.42.1 → 0.43.1

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.
@@ -1,2 +1,2 @@
1
- import { t as local } from "./local-DsJ14yqg.mjs";
1
+ import { t as local } from "./local-yB2DFcRi.mjs";
2
2
  export { local };
@@ -1,2 +1,2 @@
1
- import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-DeEJJw3i.mjs";
1
+ import { a as option, i as groups, n as filters, o as options, r as globalOptions, s as usage, t as commands } from "./commands-C4fR0md0.mjs";
2
2
  export { commands, filters, globalOptions, groups, option, options, usage };
@@ -51,17 +51,6 @@ export declare function failureLines(failure: Failure): string[];
51
51
  export declare function commandWord(argv: string[]): string | undefined;
52
52
  //#endregion
53
53
  //#region src/cli/embedded.d.ts
54
- /**
55
- * The inspector's page as this version of board's npm package has it, for an app that bundles
56
- * board's CLI and so has no file of board's beside it: `path` in `name@version`'s tarball, and its
57
- * SHA-256 (hex) to check what it fetched against. The build sets `sha256`; from source, it's null.
58
- */
59
- export declare const INSPECTOR_PAGE: {
60
- name: '@vercel/board';
61
- version: string;
62
- path: 'dist/inspect/app.js';
63
- sha256: string | null;
64
- };
65
54
  /**
66
55
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
67
56
  * URL anywhere, it talks to the team's board in Vercel's API: `VERCEL_ORG_ID`'s, the nearest linked
@@ -75,10 +64,6 @@ export declare const INSPECTOR_PAGE: {
75
64
  * (`--scope` still wins): board asks for each only when a request needs it, so help, a typo, or
76
65
  * misuse never refreshes a login or looks a team up. With `fetch`, board's requests to Vercel's API
77
66
  * with that login go through the app's own, which adds its credentials (a DPoP proof, say).
78
- *
79
- * `inspectorPage` is the inspector's page, which `inspect` asks for when it runs: the one
80
- * `INSPECTOR_PAGE` names, as the app fetched it and checked it against its `sha256`. Without one,
81
- * `inspect` reads it beside board's files, which an app that bundles board's CLI has none of.
82
67
  */
83
68
  export declare function createApp(options: {
84
69
  appName: string;
@@ -89,7 +74,6 @@ export declare function createApp(options: {
89
74
  login?: () => Promise<string>;
90
75
  team?: () => Promise<string | null>;
91
76
  fetch?: typeof globalThis.fetch;
92
- inspectorPage?: () => Promise<string>;
93
77
  }): {
94
78
  run(args: string[]): Promise<number>;
95
79
  };
@@ -1,20 +1,7 @@
1
- import { h as VERSION } from "./origin-Cuu8lW8n.mjs";
2
- import { r as stoppedBy } from "./exports-kDMIgZVu.mjs";
3
- import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-C4HVA8cc.mjs";
4
- import { t as PAGE_SHA256 } from "./digest-dm54M2k8.mjs";
1
+ import { r as stoppedBy } from "./exports-BVgUNVsP.mjs";
2
+ import { a as commandLine, c as failureLines, i as mainWith, l as formatFailure, n as commandWord, o as exitCode, r as main, s as failureDocument, t as Failed } from "./main-DjEJPCgo.mjs";
5
3
  //#region src/cli/embedded.ts
6
4
  /**
7
- * The inspector's page as this version of board's npm package has it, for an app that bundles
8
- * board's CLI and so has no file of board's beside it: `path` in `name@version`'s tarball, and its
9
- * SHA-256 (hex) to check what it fetched against. The build sets `sha256`; from source, it's null.
10
- */
11
- const INSPECTOR_PAGE = {
12
- name: "@vercel/board",
13
- version: VERSION,
14
- path: "dist/inspect/app.js",
15
- sha256: PAGE_SHA256
16
- };
17
- /**
18
5
  * Board's CLI as `appName` names it in help, usage, and errors (`vercel board`). With no board
19
6
  * URL anywhere, it talks to the team's board in Vercel's API: `VERCEL_ORG_ID`'s, the nearest linked
20
7
  * project's team's (`.vercel`), your login's, or `--scope`'s. `run` takes what follows the name, and answers the exit code:
@@ -27,13 +14,9 @@ const INSPECTOR_PAGE = {
27
14
  * (`--scope` still wins): board asks for each only when a request needs it, so help, a typo, or
28
15
  * misuse never refreshes a login or looks a team up. With `fetch`, board's requests to Vercel's API
29
16
  * with that login go through the app's own, which adds its credentials (a DPoP proof, say).
30
- *
31
- * `inspectorPage` is the inspector's page, which `inspect` asks for when it runs: the one
32
- * `INSPECTOR_PAGE` names, as the app fetched it and checked it against its `sha256`. Without one,
33
- * `inspect` reads it beside board's files, which an app that bundles board's CLI has none of.
34
17
  */
35
18
  function createApp(options) {
36
- const { appName, onError, onWarning, login, team, fetch, inspectorPage } = options;
19
+ const { appName, onError, onWarning, login, team, fetch } = options;
37
20
  return { run: (args) => main(args, {
38
21
  name: appName,
39
22
  commands: {},
@@ -42,8 +25,7 @@ function createApp(options) {
42
25
  ...onWarning ? { onWarning } : {},
43
26
  ...login ? { login } : {},
44
27
  ...team ? { team } : {},
45
- ...fetch ? { fetch } : {},
46
- ...inspectorPage ? { inspectorPage } : {}
28
+ ...fetch ? { fetch } : {}
47
29
  }) };
48
30
  }
49
31
  const lacking = (what, option) => async () => {
@@ -108,4 +90,4 @@ function vb(board, argv, options = {}) {
108
90
  return result;
109
91
  }
110
92
  //#endregion
111
- export { INSPECTOR_PAGE, commandLine, commandWord, createApp, failureLines, vb };
93
+ export { commandLine, commandWord, createApp, failureLines, vb };
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { a as option } from "./commands-DeEJJw3i.mjs";
3
- import { f as projectDir } from "./server-CKbE7eMT.mjs";
4
- import { r as main } from "./main-C4HVA8cc.mjs";
5
- import { n as stopped, r as startInspector } from "./inspect-CqCXjtPI.mjs";
2
+ import { a as option } from "./commands-C4fR0md0.mjs";
3
+ import { f as projectDir } from "./server-BHpUqip5.mjs";
4
+ import { r as main } from "./main-DjEJPCgo.mjs";
5
+ import { n as stopped, r as startInspector } from "./inspect-ZGkTJl3f.mjs";
6
6
  import { appendFile, readFile } from "node:fs/promises";
7
7
  import { join } from "node:path";
8
8
  //#region src/cli/local.ts
@@ -16,50 +16,68 @@ async function ignoreLog(root) {
16
16
  if (!ignore.split(/\r?\n/).some((line) => /^\/?\.board\/?$/.test(line))) await appendFile(path, `${ignore && !ignore.endsWith("\n") ? "\n" : ""}.board/\n`);
17
17
  }
18
18
  /** The commands only the standalone `board` has, in the order its help lists them. */
19
- const local = { serve: {
20
- spec: {
21
- name: "serve",
22
- description: "run a board on this machine (127.0.0.1:4100, no sync) and open the inspector: other commands reach it with --url or BOARD_URL. Its log lives in .board/, and you're local:user:<your OS user>",
23
- arguments: [],
24
- options: [
25
- option("port", "the port to listen on (default: 4100)"),
26
- option("dir"),
27
- option("no-inspect"),
28
- option("no-open")
29
- ],
30
- examples: [{
31
- name: "run a board here, and open it",
32
- value: "serve"
33
- }]
19
+ const local = {
20
+ inspect: {
21
+ spec: {
22
+ name: "inspect",
23
+ description: "the board in your browser, as you: read, post, react (local only)",
24
+ arguments: [],
25
+ options: [option("port", "the port to listen on (default: a free one)"), option("no-open")],
26
+ examples: [{
27
+ name: "open the board in your browser",
28
+ value: "inspect"
29
+ }]
30
+ },
31
+ async run(args, context) {
32
+ if (args.length > 0) throw context.usage("inspect takes no arguments: pass its port with --port.");
33
+ return (await import("./inspect-DRPRCOaV.mjs")).inspect(context);
34
+ }
34
35
  },
35
- async run(args, { flags, out, usage, portFlag, connection, openBrowser }) {
36
- if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
37
- const port = portFlag();
38
- const root = projectDir();
39
- const { serveLocal } = await import("./serve-BmabgHV-.mjs");
40
- const local = await serveLocal({
41
- dir: flags.dir ?? join(root, ".board"),
42
- ...port !== void 0 ? { port } : {}
43
- });
44
- let inspector = null;
45
- try {
46
- if (!flags.dir) await ignoreLog(root);
47
- out(`serving a local board at ${local.url} as ${local.principal}, its log in ${local.dir} (Ctrl-C to stop)`);
48
- out(`reach it with --url ${local.url}, or BOARD_URL=${local.url}`);
49
- if (!flags["no-inspect"]) {
50
- const { board } = connection(local.url, { token: local.token });
51
- inspector = await startInspector({ client: board.as(null) });
52
- out(`inspector at ${inspector.url}`);
53
- if (!flags["no-open"]) openBrowser(inspector.url);
36
+ serve: {
37
+ spec: {
38
+ name: "serve",
39
+ description: "run a board on this machine (127.0.0.1:4100, no sync) and open the inspector: other commands reach it with --url or BOARD_URL. Its log lives in .board/, and you're local:user:<your OS user>",
40
+ arguments: [],
41
+ options: [
42
+ option("port", "the port to listen on (default: 4100)"),
43
+ option("dir"),
44
+ option("no-inspect"),
45
+ option("no-open")
46
+ ],
47
+ examples: [{
48
+ name: "run a board here, and open it",
49
+ value: "serve"
50
+ }]
51
+ },
52
+ async run(args, { flags, out, usage, portFlag, connection, openBrowser }) {
53
+ if (args.length > 0) throw usage("serve takes no arguments: pass its port with --port, and its directory with --dir.");
54
+ const port = portFlag();
55
+ const root = projectDir();
56
+ const { serveLocal } = await import("./serve-Cnb4TpaJ.mjs");
57
+ const local = await serveLocal({
58
+ dir: flags.dir ?? join(root, ".board"),
59
+ ...port !== void 0 ? { port } : {}
60
+ });
61
+ let inspector = null;
62
+ try {
63
+ if (!flags.dir) await ignoreLog(root);
64
+ out(`serving a local board at ${local.url} as ${local.principal}, its log in ${local.dir} (Ctrl-C to stop)`);
65
+ out(`reach it with --url ${local.url}, or BOARD_URL=${local.url}`);
66
+ if (!flags["no-inspect"]) {
67
+ const { board } = connection(local.url, { token: local.token });
68
+ inspector = await startInspector({ client: board.as(null) });
69
+ out(`inspector at ${inspector.url}`);
70
+ if (!flags["no-open"]) openBrowser(inspector.url);
71
+ }
72
+ await stopped();
73
+ } finally {
74
+ await inspector?.close();
75
+ await local.close();
54
76
  }
55
- await stopped();
56
- } finally {
57
- await inspector?.close();
58
- await local.close();
77
+ return 0;
59
78
  }
60
- return 0;
61
79
  }
62
- } };
80
+ };
63
81
  //#endregion
64
82
  //#region src/cli/bin.ts
65
83
  main(process.argv.slice(2), {
@@ -1177,17 +1177,6 @@ const commands = [
1177
1177
  value: "wait --re 812 --after 815 --timeout 10m"
1178
1178
  }]
1179
1179
  },
1180
- {
1181
- group: "live",
1182
- name: "inspect",
1183
- description: "the board in your browser, as you: read, post, react (local only)",
1184
- arguments: [],
1185
- options: [option("port", "the port to listen on (default: a free one)"), option("no-open")],
1186
- examples: [{
1187
- name: "open the board in your browser",
1188
- value: "inspect"
1189
- }]
1190
- },
1191
1180
  {
1192
1181
  group: "live",
1193
1182
  name: "help",
@@ -1,7 +1,7 @@
1
1
  import { _ as IMPORT_BYTES_MAX, a as forbidden, b as mediaType, c as toErrorResponse, d as createBoardClient, f as duration, h as ATTACHMENT_BYTES_MAX, l as unauthorized, n as RejectedError, o as json, p as formatProfileHeader, r as badRequest, s as notFound, t as HttpError, u as BoardError, v as fileName } from "./errors-DUzpDSrJ.mjs";
2
2
  import { h as RemoteWatcherId } from "./schemas-DAzSsgWk.mjs";
3
- import { f as schemaId, n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
4
- import { A as MessagesQuery, B as SyncBody, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as ThreadsQuery, H as SyncFindQuery, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SchemaBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceJoinBody, S as GrantBody, T as InboxPushBody, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as routes, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as runMatch, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SourceReadQuery } from "./origin-Cuu8lW8n.mjs";
3
+ import { n as blocksIn, r as findBlocks } from "./blocks-CVoBC7ur.mjs";
4
+ import { A as MessagesQuery, B as SyncBody, C as InboxAckBody, D as LabelBody, E as InboxQuery, F as ScheduleBody, G as ThreadsQuery, H as SyncFindQuery, I as SchedulesQuery, J as UploadStartBody, K as TypingBody, L as SchemaBody, M as ReactBody, N as Ref, O as LinkedQuery, P as RegisterBody, R as SourceJoinBody, S as GrantBody, T as InboxPushBody, U as SyncImportBody, V as SyncCopiesQuery, W as SyncReceiptBody, Y as routes, _ as CreateChannelBody, a as compileWatcher, b as EventsQuery, c as METHODS, d as queryObject, f as readCapped, g as AckBody, h as VERSION, i as runMatch, j as PostBody, k as MatchesQuery, l as createRouter, m as SYNC, n as syncTarget, p as readJson, q as UpdateGrantBody, r as canonicalWatchers, t as SYNC_ACTOR, u as openapi, v as DeleteBody, w as InboxNextQuery, x as ExplainQuery, y as EditBody, z as SourceReadQuery } from "./origin-9Ch-Zonv.mjs";
5
5
  import { _ as sha256, a as waitUntil, c as platformProfile, d as userIdOf, m as derivedId, o as actorParts, r as runMiddleware, s as importedHandle, t as DroppedError, u as underPrincipal } from "./middleware-0DUFrav-.mjs";
6
6
  import { a as canText, c as compileAccess, d as parsePattern, n as InvalidCan, r as PERMISSIONS, t as FULL_ACCESS, u as parseCan } from "./access-BgBiaCyx.mjs";
7
7
  import { C as explainGrants, b as verifiesTokens, d as grantIssuers, f as hostPrincipal, i as VERCEL_ISSUER, l as createAuthority, t as DEFAULT_CAN$1, u as fromTokens, y as verifiedIssuers } from "./auth-Ft4AJptx.mjs";
@@ -2793,21 +2793,18 @@ function createVercel(options, environment) {
2793
2793
  });
2794
2794
  },
2795
2795
  async schemas(caller, _input, signal) {
2796
- const schemas = (await all(whoOf(caller), "/schemas", "schemas", {}, signal)).map(schemaFrom);
2796
+ const who = whoOf(caller);
2797
+ const schemas = (await all(who, await onBoard(who, "/schemas"), "schemas", {}, signal)).map(schemaFrom);
2797
2798
  const order = (schema) => schema.builtIn ? 0 : 1;
2798
2799
  return { schemas: schemas.sort((a, b) => order(a) - order(b) || (a.builtIn ? 0 : a.name < b.name ? -1 : a.name > b.name ? 1 : a.version - b.version)) };
2799
2800
  },
2800
2801
  async schema(caller, { id }, signal) {
2801
- const { schema } = await api(whoOf(caller), "GET", `/schemas/${encodeURIComponent(id)}`, signal ? { signal } : {});
2802
+ const who = whoOf(caller);
2803
+ const { schema } = await api(who, "GET", await onBoard(who, `/schemas/${encodeURIComponent(id)}`), signal ? { signal } : {});
2802
2804
  return { schema: schemaFrom(schema) };
2803
2805
  },
2804
2806
  async createSchema(caller, input, signal) {
2805
- const who = whoOf(caller);
2806
- const there = await api(who, "GET", `/schemas/${encodeURIComponent(schemaId(input.name, input.version))}`, signal ? { signal } : {}).then(() => true, (error) => {
2807
- if (error instanceof HttpError && error.code === "schema_not_found") return false;
2808
- throw error;
2809
- });
2810
- const { schema } = await api(who, "POST", "/schemas", {
2807
+ const { schema, created } = await api(whoOf(caller), "POST", "/schemas", {
2811
2808
  body: {
2812
2809
  operationId: operationId(),
2813
2810
  ...input
@@ -2816,7 +2813,7 @@ function createVercel(options, environment) {
2816
2813
  });
2817
2814
  return {
2818
2815
  schema: schemaFrom(schema),
2819
- created: !there
2816
+ created
2820
2817
  };
2821
2818
  },
2822
2819
  async schedule(caller, input, signal) {
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
2
  import { t as block } from "./blocks-CVoBC7ur.mjs";
3
3
  import { t as DroppedError } from "./middleware-0DUFrav-.mjs";
4
- import { i as createVercel, t as createBoard } from "./exports-kDMIgZVu.mjs";
4
+ import { i as createVercel, t as createBoard } from "./exports-BVgUNVsP.mjs";
5
5
  //#region src/backend-vercel/index.default.ts
6
6
  /**
7
7
  * Your team's board, in Vercel's API. Outside Node there's no environment to find credentials or
@@ -1,5 +1,5 @@
1
1
  import { f as duration, t as HttpError, u as BoardError } from "./errors-DUzpDSrJ.mjs";
2
2
  import { t as block } from "./blocks-CVoBC7ur.mjs";
3
3
  import { t as DroppedError } from "./middleware-0DUFrav-.mjs";
4
- import { t as board } from "./server-CKbE7eMT.mjs";
4
+ import { t as board } from "./server-BHpUqip5.mjs";
5
5
  export { BoardError, DroppedError, HttpError, block, board, duration };