@protobase/cli 0.47.0 → 0.48.0

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 (45) hide show
  1. package/dist/build/config-bundle.js +2 -2
  2. package/dist/build/plugin-build.js +2 -2
  3. package/dist/build/serve-runtime.js +1 -1
  4. package/dist/build/shell.js +2 -2
  5. package/dist/cli/package.js +1 -1
  6. package/dist/dev/api-child.js +50 -0
  7. package/dist/dev/api-forward.js +70 -0
  8. package/dist/dev/api-process.d.ts +19 -0
  9. package/dist/dev/api-process.js +80 -0
  10. package/dist/dev/api-support.d.ts +3 -0
  11. package/dist/dev/api-support.js +3 -0
  12. package/dist/dev/api-vite.d.ts +9 -0
  13. package/dist/dev/api-vite.js +33 -0
  14. package/dist/dev/api-websockets.js +1 -23
  15. package/dist/dev/app-server.js +70 -0
  16. package/dist/dev/auth-drift-lines.js +8 -0
  17. package/dist/dev/dev-jobs.d.ts +6 -0
  18. package/dist/dev/entry.d.ts +5 -0
  19. package/dist/dev/entry.js +8 -2
  20. package/dist/dev/run.js +36 -94
  21. package/dist/dev/server-package.js +39 -0
  22. package/dist/encryption/register.js +7 -6
  23. package/dist/files/register.js +5 -2
  24. package/dist/main.js +6 -3
  25. package/dist/migration/register.js +4 -4
  26. package/dist/mobile/register.js +3 -4
  27. package/dist/notifications/print-vapid-keys.js +1 -1
  28. package/dist/organizations/register.js +6 -1
  29. package/dist/project/api-websocket-server.d.ts +9 -0
  30. package/dist/project/extensions.d.ts +8 -0
  31. package/dist/project/favicon-link.js +1 -1
  32. package/dist/project/load-data-config.js +1 -1
  33. package/dist/scaffold/plan.js +7 -3
  34. package/dist/scaffold/protobase-tables.js +8 -13
  35. package/dist/scaffold/run.js +1 -1
  36. package/dist/serve/lifecycle.js +3 -2
  37. package/dist/skill/register.js +1 -1
  38. package/dist/users/register.js +4 -3
  39. package/dist/users/set-disabled.js +1 -1
  40. package/package.json +7 -7
  41. package/skills/protobase/references/features/sign-in-and-accounts.md +1 -0
  42. package/skills/protobase/references/guides/deploy.md +1 -1
  43. package/skills/protobase/references/reference/auth.md +16 -12
  44. package/skills/protobase/references/reference/cli.md +9 -7
  45. package/skills/protobase/references/reference/mcp.md +1 -1
@@ -1,10 +1,10 @@
1
- import { extensionImports } from "../project/extensions.js";
2
1
  import { findPackageDir, packageName } from "./packages/package-dir.js";
2
+ import { layoutCheck } from "./layout-check.js";
3
+ import { extensionImports } from "../project/extensions.js";
3
4
  import { viteBundle } from "./vite-bundle.js";
4
5
  import { hostModuleIds } from "../serve/host-module-ids.js";
5
6
  import { collectComponents } from "./component-names.js";
6
7
  import { bundleEntryCode } from "./entry-code.js";
7
- import { layoutCheck } from "./layout-check.js";
8
8
  import { hostPackages } from "./packages/host-packages.js";
9
9
  import { isNativePackage } from "./packages/native-package.js";
10
10
  import path from "node:path";
@@ -1,6 +1,6 @@
1
+ import { findPackageDirSync, readPackageJson } from "./packages/package-dir.js";
1
2
  import { uiPackageDir } from "../project/admin-app.js";
2
3
  import { extensionImports } from "../project/extensions.js";
3
- import { findPackageDirSync, readPackageJson } from "./packages/package-dir.js";
4
4
  import { sharedModules } from "../project/shared-modules.js";
5
5
  import { pluginFieldTypes } from "./plugin-fields.js";
6
6
  import { layerPluginUtilities } from "./plugin-styles.js";
@@ -9,9 +9,9 @@ import { existsSync } from "node:fs";
9
9
  import path from "node:path";
10
10
  import { writeFile } from "node:fs/promises";
11
11
  import { inRange } from "@protobase/schema/internal";
12
+ import { build } from "vite";
12
13
  import tailwindcss from "@tailwindcss/vite";
13
14
  import react from "@vitejs/plugin-react";
14
- import { build } from "vite";
15
15
  //#region src/build/plugin-build.ts
16
16
  /** The module a plugin's components and action handlers are exported from, as a project's are. */
17
17
  const pluginEntryFile = "protobase.ui.tsx";
@@ -1,5 +1,5 @@
1
- import { viteBundle } from "./vite-bundle.js";
2
1
  import { moduleFile } from "../module-file.js";
2
+ import { viteBundle } from "./vite-bundle.js";
3
3
  import { npmWs } from "./npm-ws.js";
4
4
  import { fileURLToPath } from "node:url";
5
5
  //#region src/build/serve-runtime.ts
@@ -1,5 +1,5 @@
1
- import { adminAppDir, uiEntry, uiPackageDir } from "../project/admin-app.js";
2
1
  import { readPackageJson } from "./packages/package-dir.js";
2
+ import { adminAppDir, uiEntry, uiPackageDir } from "../project/admin-app.js";
3
3
  import { projectUiPlugin } from "../project/project-ui.js";
4
4
  import { sharedModulesPlugin } from "../project/shared-modules.js";
5
5
  import { faviconLink } from "../project/favicon-link.js";
@@ -11,9 +11,9 @@ import { shellCodeSplitting } from "./shell-chunks.js";
11
11
  import { existsSync } from "node:fs";
12
12
  import path from "node:path";
13
13
  import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
14
+ import { build } from "vite";
14
15
  import tailwindcss from "@tailwindcss/vite";
15
16
  import react from "@vitejs/plugin-react";
16
- import { build } from "vite";
17
17
  import { tmpdir } from "node:os";
18
18
  //#region src/build/shell.ts
19
19
  /** What a shell folder holds beside its files: the `BundleShell` a bundle's manifest copies. */
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.47.0";
2
+ var version = "0.48.0";
3
3
  //#endregion
4
4
  export { version };
@@ -0,0 +1,50 @@
1
+ import { moduleFile } from "../module-file.js";
2
+ import path from "node:path";
3
+ import { fork } from "node:child_process";
4
+ //#region src/dev/api-child.ts
5
+ const apiProcess = moduleFile("./api-process", import.meta.url);
6
+ const loaderArgs = () => path.extname(apiProcess) === ".ts" && !process.versions.bun ? ["--import", import.meta.resolve("tsx")] : [];
7
+ /**
8
+ * Forks the API of `protobase dev` into a process of its own, on the same runtime and with the same environment, which
9
+ * loads @protobase/server meanwhile. `start` has it load the API for the dev server at `devUrl` and resolves once it
10
+ * listens, or rejects with the error that stopped it loading; `stop` lets its running jobs finish and ends it. `onExit`
11
+ * hears of an API process that ends while it serves, other than through `stop`.
12
+ */
13
+ const forkApiChild = (options, onExit) => {
14
+ const child = fork(apiProcess, [JSON.stringify(options)], { execArgv: [...process.execArgv, ...loaderArgs()] });
15
+ let stopping = false;
16
+ let ready = false;
17
+ const exited = new Promise((resolve) => child.once("exit", () => resolve()));
18
+ const outcome = new Promise((resolve) => {
19
+ child.once("message", resolve);
20
+ child.once("exit", (code, signal) => resolve({ failed: `The API process of protobase dev ended (${signal ?? `exit code ${code}`}) before it was ready` }));
21
+ });
22
+ child.once("exit", (code) => {
23
+ if (ready && !stopping) onExit(code ?? 1);
24
+ });
25
+ const stop = async () => {
26
+ stopping = true;
27
+ if (child.exitCode === null && child.signalCode === null) child.kill("SIGTERM");
28
+ await exited;
29
+ };
30
+ const start = async (devUrl) => {
31
+ if (child.connected) child.send({ start: { devUrl } });
32
+ const message = await outcome;
33
+ if ("failed" in message) {
34
+ await stop();
35
+ throw new Error(message.failed);
36
+ }
37
+ ready = true;
38
+ return {
39
+ port: message.ready.port,
40
+ anyUsers: message.ready.anyUsers,
41
+ authDrift: message.ready.authDrift
42
+ };
43
+ };
44
+ return {
45
+ start,
46
+ stop
47
+ };
48
+ };
49
+ //#endregion
50
+ export { forkApiChild };
@@ -0,0 +1,70 @@
1
+ import { devHost } from "./loopback.js";
2
+ import { apiUpgrades } from "./api-websockets.js";
3
+ import { pipeline } from "node:stream";
4
+ import { connect } from "node:net";
5
+ import { request } from "node:http";
6
+ //#region src/dev/api-forward.ts
7
+ /**
8
+ * The requests the API process answers: everything under /api, the passkey origins at /.well-known/webauthn, the OAuth
9
+ * discovery documents MCP clients read (`oauthWellKnownPaths`), below which a resource's own one is, and the push worker
10
+ * (`withDevServiceWorker`). Vite serves the rest.
11
+ */
12
+ const isApiRequest = (url) => /^(\/api(\/|\?|$)|\/\.well-known\/webauthn(\?|$)|\/\.well-known\/oauth-(authorization-server|protected-resource)(\/|\?|$)|\/protobase\.sw\.js(\?|$))/.test(url);
13
+ const hopByHop = /* @__PURE__ */ new Set([
14
+ "connection",
15
+ "keep-alive",
16
+ "transfer-encoding"
17
+ ]);
18
+ const forwardRequest = (port, request$1, response, next) => {
19
+ let answered = false;
20
+ let left = false;
21
+ const upstream = request({
22
+ host: devHost,
23
+ port,
24
+ method: request$1.method,
25
+ path: request$1.url,
26
+ headers: request$1.headers,
27
+ agent: false
28
+ }, (answer) => {
29
+ answered = true;
30
+ const headers = Object.fromEntries(Object.entries(answer.headers).filter(([name]) => !hopByHop.has(name)));
31
+ response.writeHead(answer.statusCode, answer.statusMessage, headers);
32
+ pipeline(answer, response, () => void 0);
33
+ });
34
+ response.on("close", () => {
35
+ left = true;
36
+ upstream.destroy();
37
+ });
38
+ upstream.on("error", (error) => {
39
+ if (!answered && !left) next(error);
40
+ });
41
+ request$1.pipe(upstream);
42
+ };
43
+ const forwardUpgrade = (port, request, socket, head) => {
44
+ const upstream = connect(port, devHost, () => {
45
+ const lines = [`${request.method} ${request.url} HTTP/${request.httpVersion}`];
46
+ for (let i = 0; i < request.rawHeaders.length; i += 2) lines.push(`${request.rawHeaders[i]}: ${request.rawHeaders[i + 1]}`);
47
+ upstream.write(`${lines.join("\r\n")}\r\n\r\n`);
48
+ if (head.length > 0) upstream.write(head);
49
+ socket.pipe(upstream).pipe(socket);
50
+ });
51
+ upstream.on("error", () => socket.destroy());
52
+ socket.on("error", () => upstream.destroy());
53
+ };
54
+ /**
55
+ * Hands the API's requests and WebSockets to the API process on `port` once it is ready, after Vite's host check and
56
+ * CORS as before; a request that comes while it starts waits for it.
57
+ */
58
+ const apiForward = (port) => ({
59
+ name: "protobase-api-forward",
60
+ configureServer: (server) => {
61
+ server.middlewares.use((request, response, next) => {
62
+ if (!isApiRequest(request.url ?? "")) return next();
63
+ port().then((ready) => forwardRequest(ready, request, response, next), next);
64
+ });
65
+ const upgrade = (request, socket, head) => port().then((ready) => forwardUpgrade(ready, request, socket, head), () => socket.destroy());
66
+ server.httpServer?.on("upgrade", apiUpgrades(() => server.config.server.allowedHosts, (request, socket, head) => void upgrade(request, socket, head)));
67
+ }
68
+ });
69
+ //#endregion
70
+ export { apiForward, isApiRequest };
@@ -0,0 +1,19 @@
1
+ import { ApiViteOptions } from "./api-vite.js";
2
+ //#region src/dev/api-process.d.ts
3
+ export type ApiProcessOptions = ApiViteOptions;
4
+ export type ApiProcessMessage = {
5
+ ready: {
6
+ port: number;
7
+ anyUsers?: boolean;
8
+ authDrift: string[];
9
+ };
10
+ } | {
11
+ failed: string;
12
+ };
13
+ /** What run.ts sends once its server listens: the app's origin, whose /api/sb functions call as SUPABASE_URL. */
14
+ export type ApiProcessStart = {
15
+ start: {
16
+ devUrl: string;
17
+ };
18
+ };
19
+ //#endregion
@@ -0,0 +1,80 @@
1
+ import { errorMessage } from "../error-message.js";
2
+ import { moduleFile } from "../module-file.js";
3
+ import { createApiVite } from "./api-vite.js";
4
+ import { devHost } from "./loopback.js";
5
+ import { isProjectFile } from "./project-files.js";
6
+ import { serverPackage } from "./server-package.js";
7
+ import { startupLogger } from "./startup-logger.js";
8
+ import { createAdaptorServer } from "@hono/node-server";
9
+ //#region src/dev/api-process.ts
10
+ const entry = moduleFile("./entry", import.meta.url);
11
+ const support = moduleFile("./api-support", import.meta.url);
12
+ const restartCode = 1012;
13
+ const options = JSON.parse(process.argv[2]);
14
+ const projectDirs = [options.projectDir, ...options.extensions.map((extension) => extension.dir)];
15
+ const logging = startupLogger();
16
+ let sockets;
17
+ let server;
18
+ const devUrl = new Promise((resolve) => process.once("message", (message) => resolve(message.start.devUrl)));
19
+ const vite = await createApiVite(options, serverPackage(options.projectDir), logging.logger);
20
+ vite.watcher.add(projectDirs);
21
+ vite.watcher.on("all", (_event, file) => {
22
+ if (!isProjectFile(projectDirs, file)) return;
23
+ vite.environments.ssr.moduleGraph.invalidateAll();
24
+ sockets?.clients.forEach((client) => client.close(restartCode));
25
+ });
26
+ const internalError = (error) => {
27
+ vite.ssrFixStacktrace(error);
28
+ vite.config.logger.error(`Internal server error: ${error.message}\n${error.stack ?? ""}`, { error });
29
+ return new Response(`Internal server error: ${error.message}\n`, {
30
+ status: 500,
31
+ headers: { "content-type": "text/plain; charset=utf-8" }
32
+ });
33
+ };
34
+ const fetch = async (request, env) => {
35
+ const api = await vite.ssrLoadModule(entry).catch((error) => error);
36
+ if (api instanceof Error) return internalError(api);
37
+ return api.default.fetch(request, env);
38
+ };
39
+ const listen = (server) => new Promise((resolve, reject) => {
40
+ server.once("error", reject);
41
+ server.listen(0, devHost, () => {
42
+ server.off("error", reject);
43
+ resolve(server.address().port);
44
+ });
45
+ });
46
+ const stop = async () => {
47
+ server?.close();
48
+ server?.closeAllConnections();
49
+ await (await vite.ssrLoadModule(support)).stopDevJobs();
50
+ await vite.close();
51
+ process.exit(process.exitCode ?? 0);
52
+ };
53
+ const start = async () => {
54
+ sockets = (await vite.ssrLoadModule(support)).apiWebSocketServer();
55
+ process.env.PROTOBASE_DEV_URL = await devUrl;
56
+ const api = await vite.ssrLoadModule(entry);
57
+ const anyUsers = await api.anyUsers();
58
+ const authDrift = await api.authDrift();
59
+ logging.started();
60
+ server = createAdaptorServer({
61
+ fetch,
62
+ overrideGlobalObjects: false,
63
+ websocket: { server: sockets }
64
+ });
65
+ const port = await listen(server);
66
+ process.send({ ready: {
67
+ port,
68
+ anyUsers,
69
+ authDrift
70
+ } });
71
+ };
72
+ process.on("SIGINT", () => void 0);
73
+ process.on("SIGTERM", () => void stop());
74
+ process.on("disconnect", () => void stop());
75
+ await start().catch((error) => {
76
+ process.exitCode = 1;
77
+ process.send({ failed: errorMessage(error) });
78
+ });
79
+ //#endregion
80
+ export {};
@@ -0,0 +1,3 @@
1
+ import { apiWebSocketServer } from "../project/api-websocket-server.js";
2
+ import { stopDevJobs } from "./dev-jobs.js";
3
+ export { apiWebSocketServer, stopDevJobs };
@@ -0,0 +1,3 @@
1
+ import { stopDevJobs } from "./dev-jobs.js";
2
+ import { apiWebSocketServer } from "../project/api-websocket-server.js";
3
+ export { apiWebSocketServer, stopDevJobs };
@@ -0,0 +1,9 @@
1
+ import { Extension } from "../project/extensions.js";
2
+ import "vite";
3
+ //#region src/dev/api-vite.d.ts
4
+ export type ApiViteOptions = {
5
+ projectDir: string;
6
+ extensions: Extension[];
7
+ cacheDir?: string;
8
+ };
9
+ //#endregion
@@ -0,0 +1,33 @@
1
+ import { layoutCheck } from "../build/layout-check.js";
2
+ import { extensionImports } from "../project/extensions.js";
3
+ import { createServer } from "vite";
4
+ //#region src/dev/api-vite.ts
5
+ /**
6
+ * The Vite server the API process loads the API through: no page, no HMR socket and no dependency optimisation; the
7
+ * project's server-side files transformed as the dev server's page transforms them, and the `dedupe` packages of
8
+ * `resolution`, @protobase/server among them, resolved from its root for every importer, the CLI's files included.
9
+ */
10
+ const createApiVite = (options, resolution, logger) => createServer({
11
+ root: resolution.root,
12
+ configFile: false,
13
+ ...logger && { customLogger: logger },
14
+ ...options.cacheDir && { cacheDir: options.cacheDir },
15
+ appType: "custom",
16
+ server: {
17
+ middlewareMode: true,
18
+ hmr: false,
19
+ ws: false
20
+ },
21
+ optimizeDeps: {
22
+ noDiscovery: true,
23
+ include: []
24
+ },
25
+ resolve: { dedupe: resolution.dedupe },
26
+ oxc: { jsx: {
27
+ runtime: "automatic",
28
+ importSource: "react"
29
+ } },
30
+ plugins: [extensionImports(options.projectDir, options.extensions), layoutCheck()]
31
+ });
32
+ //#endregion
33
+ export { createApiVite };
@@ -1,10 +1,6 @@
1
- import { apiWebSocketServer } from "../project/api-websocket-server.js";
2
1
  import { isAllowedHost } from "./allowed-host.js";
3
- import { isProjectFile } from "./project-files.js";
4
- import { createAdaptorServer } from "@hono/node-server";
5
2
  //#region src/dev/api-websockets.ts
6
3
  const isApiWebSocket = (url) => /^\/api\/sb\/realtime\/v1\/websocket(\?|$)/.test(url) || /^\/api\/functions\/[^/?#]+(\/|\?|$)/.test(url);
7
- const restartCode = 1012;
8
4
  /**
9
5
  * The listener for Vite's `upgrade` event: an API socket goes to `forward` once its Host passes Vite's host check, as
10
6
  * every other dev request does, and is refused with 403 otherwise; any other upgrade is left to Vite.
@@ -14,23 +10,5 @@ const apiUpgrades = (allowedHosts, forward) => (request, socket, head) => {
14
10
  if (isAllowedHost(request.headers.host, allowedHosts())) return forward(request, socket, head);
15
11
  socket.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\nContent-Length: 0\r\n\r\n");
16
12
  };
17
- const apiWebSockets = (entry, dirs) => {
18
- const wss = apiWebSocketServer();
19
- return {
20
- name: "protobase-api-websockets",
21
- configureServer: (server) => {
22
- const upgrades = createAdaptorServer({
23
- fetch: async (request, env) => (await server.ssrLoadModule(entry)).default.fetch(request, env),
24
- overrideGlobalObjects: false,
25
- websocket: { server: wss }
26
- });
27
- server.httpServer?.on("upgrade", apiUpgrades(() => server.config.server.allowedHosts, (request, socket, head) => upgrades.emit("upgrade", request, socket, head)));
28
- server.httpServer?.on("close", () => upgrades.emit("close"));
29
- },
30
- handleHotUpdate: ({ file }) => {
31
- if (isProjectFile(dirs, file)) wss.clients.forEach((client) => client.close(restartCode));
32
- }
33
- };
34
- };
35
13
  //#endregion
36
- export { apiUpgrades, apiWebSockets, isApiWebSocket };
14
+ export { apiUpgrades, isApiWebSocket };
@@ -0,0 +1,70 @@
1
+ import { uiPackageDir } from "../project/admin-app.js";
2
+ import { layoutCheck } from "../build/layout-check.js";
3
+ import { extensionImports, extensionStyles } from "../project/extensions.js";
4
+ import { devHost } from "./loopback.js";
5
+ import { frameHeaders } from "../serve/static-site.js";
6
+ import { projectUiPlugin } from "../project/project-ui.js";
7
+ import { sharedModulesPlugin } from "../project/shared-modules.js";
8
+ import { faviconLink } from "../project/favicon-link.js";
9
+ import { themeLink } from "../project/theme-link.js";
10
+ import { createServer, searchForWorkspaceRoot } from "vite";
11
+ import tailwindcss from "@tailwindcss/vite";
12
+ import react from "@vitejs/plugin-react";
13
+ //#region src/dev/app-server.ts
14
+ const appDependencies = [
15
+ "react",
16
+ "react/jsx-runtime",
17
+ "react/jsx-dev-runtime",
18
+ "react-dom",
19
+ "react-dom/client",
20
+ "lucide-react",
21
+ "zod",
22
+ "@tanstack/react-query",
23
+ "@tanstack/react-table",
24
+ "recharts",
25
+ "@sentry/browser",
26
+ "maplibre-gl",
27
+ "pmtiles",
28
+ "fflate",
29
+ "react-map-gl/maplibre"
30
+ ];
31
+ /**
32
+ * The Vite server of `protobase dev` that serves the admin app from `appDir`, with the project's UI, theme and icons,
33
+ * on `port`; `plugins` come first, such as the one that hands the API's requests to its process.
34
+ */
35
+ const createAppServer = (options, plugins) => createServer({
36
+ root: options.appDir,
37
+ configFile: false,
38
+ ...options.cacheDir && { cacheDir: options.cacheDir },
39
+ optimizeDeps: {
40
+ include: appDependencies,
41
+ exclude: ["@protobase/ui"]
42
+ },
43
+ server: {
44
+ headers: frameHeaders,
45
+ host: devHost,
46
+ port: options.port,
47
+ strictPort: true,
48
+ ...options.allowedHosts.length > 0 && { allowedHosts: options.allowedHosts },
49
+ fs: { allow: [
50
+ searchForWorkspaceRoot(options.projectDir),
51
+ uiPackageDir,
52
+ options.projectDir,
53
+ ...options.extensions.map((extension) => extension.dir)
54
+ ] }
55
+ },
56
+ plugins: [
57
+ ...plugins,
58
+ sharedModulesPlugin(),
59
+ themeLink(options.projectDir),
60
+ faviconLink(options.projectDir),
61
+ projectUiPlugin(options.projectDir, options.extensions),
62
+ extensionImports(options.projectDir, options.extensions),
63
+ extensionStyles(options.extensions),
64
+ layoutCheck(),
65
+ react(),
66
+ tailwindcss()
67
+ ]
68
+ });
69
+ //#endregion
70
+ export { createAppServer };
@@ -0,0 +1,8 @@
1
+ //#region src/dev/auth-drift-lines.ts
2
+ /**
3
+ * The banner's warning that the auth store's tables drifted from its migrations, such as a column changed by hand, one
4
+ * line per difference; nothing when they match.
5
+ */
6
+ const authDriftLines = (drift) => drift.length === 0 ? "" : ` warning the auth store drifted from its migrations; apply the project's migrations, or write a change made by hand as a migration of the project's own:\n${drift.map((finding) => ` ${finding}\n`).join("")}`;
7
+ //#endregion
8
+ export { authDriftLines };
@@ -0,0 +1,6 @@
1
+ import "@protobase/server";
2
+ import "@protobase/query";
3
+ //#region src/dev/dev-jobs.d.ts
4
+ /** Lets running jobs finish and stops them, when the dev server closes. */
5
+ export declare const stopDevJobs: () => Promise<void>;
6
+ //#endregion
@@ -2,5 +2,10 @@
2
2
  declare const _default: import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<import("hono/types").BlankSchema, "/">, "/", "/">;
3
3
  /** Whether the auth store has a user yet, for the banner's sign-in line; undefined without one. */
4
4
  export declare const anyUsers: () => Promise<boolean> | Promise<undefined>;
5
+ /**
6
+ * How the auth store's tables differ from what the project's Better Auth needs, for the banner's warnings: the one
7
+ * comparison of the store's tables, made in development only, since a deploy reads the store's record of migrations.
8
+ */
9
+ export declare const authDrift: () => Promise<string[]>;
5
10
  //#endregion
6
11
  export { _default as default };
package/dist/dev/entry.js CHANGED
@@ -7,7 +7,7 @@ import { withDevServiceWorker } from "./service-worker-route.js";
7
7
  import { setMissing, supabaseEnv } from "./supabase-env.js";
8
8
  import { upgradeWebSocket } from "@hono/node-server";
9
9
  import { Hono } from "hono";
10
- import { apiKeySettings, assistantSettings, authStoreTables, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkNotificationsSchema, checkQueryRunner, checkWebhooksSchema, configExports, hasUsers } from "@protobase/server";
10
+ import { apiKeySettings, assistantSettings, authSchemaDrift, authStoreTables, checkAi, checkAuthSchema, checkChanges, checkComments, checkComputed, checkNotificationsSchema, checkQueryRunner, checkResourcesOutsideAuthStore, checkWebhooksSchema, configExports, hasUsers } from "@protobase/server";
11
11
  //#region src/dev/entry.ts
12
12
  const projectDir = process.env.PROTOBASE_PROJECT;
13
13
  const project = await loadProject(projectDir, JSON.parse(process.env.PROTOBASE_EXTENSIONS ?? "[]"));
@@ -19,6 +19,7 @@ if (project.auth && !store.__protobaseAuthSchemaChecked) {
19
19
  await checkAuthSchema(project.auth);
20
20
  store.__protobaseAuthSchemaChecked = true;
21
21
  }
22
+ if (project.auth) await checkResourcesOutsideAuthStore(db, resources.map((resource) => resource.toModel()), project.auth);
22
23
  await checkChanges(db, resources.map((resource) => resource.toModel()), project.events);
23
24
  await checkComments(db, resources.map((resource) => resource.toModel()));
24
25
  await checkComputed(db, resources.map((resource) => resource.toModel()));
@@ -51,5 +52,10 @@ await devJobs(db, jobs);
51
52
  var entry_default = withDevServiceWorker(new Hono(), Boolean(project.notifications)).route("/", admin);
52
53
  /** Whether the auth store has a user yet, for the banner's sign-in line; undefined without one. */
53
54
  const anyUsers = () => project.auth ? hasUsers(project.auth) : Promise.resolve(void 0);
55
+ /**
56
+ * How the auth store's tables differ from what the project's Better Auth needs, for the banner's warnings: the one
57
+ * comparison of the store's tables, made in development only, since a deploy reads the store's record of migrations.
58
+ */
59
+ const authDrift = () => project.auth ? authSchemaDrift(project.auth) : Promise.resolve([]);
54
60
  //#endregion
55
- export { anyUsers, entry_default as default };
61
+ export { anyUsers, authDrift, entry_default as default };