@protobase/cli 0.110.1 → 0.110.3

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,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.110.1";
2
+ var version = "0.110.3";
3
3
  //#endregion
4
4
  export { version };
@@ -11,9 +11,8 @@ const projectMailer = async (config) => (await config.authFiles?.module("auth/ma
11
11
  * The app's sign-in, built from `auth` with the app's URL, secrets, signing key rotation and name, the hooks of its
12
12
  * auth/hooks.ts and the app's mailer when it has them; none without `auth`.
13
13
  */
14
- const projectAuth = async (config, { db, pool }, workflows) => {
14
+ const projectAuth = async (config, { db }, workflows) => {
15
15
  if (!config.auth) return void 0;
16
- if (!pool) throw new Error("auth needs the app's pool, which its store shares");
17
16
  const { url, secret, previousSecrets, signingKeyDays, signingKeyGraceDays, name } = config;
18
17
  if (!url) throw new Error("Sign-in needs the app's public URL: set PROTOBASE_URL, such as https://admin.example.com, or url in protobase.config.ts");
19
18
  if (!secret) throw new Error("Sign-in needs the app's secret: set PROTOBASE_SECRET to the output of `openssl rand -base64 32`, or secret in protobase.config.ts");
@@ -27,7 +26,6 @@ const projectAuth = async (config, { db, pool }, workflows) => {
27
26
  ...signingKeyGraceDays !== void 0 && { signingKeyGraceDays },
28
27
  ...name && { appName: name }
29
28
  }, {
30
- pool,
31
29
  db,
32
30
  ...hooks && { hooks },
33
31
  ...mailer && { mailer },
@@ -1,6 +1,6 @@
1
1
  //#region ../mobile/package.json
2
2
  var name = "@protobase/mobile";
3
- var nativeContract = 13;
3
+ var nativeContract = 14;
4
4
  var dependencies = {
5
5
  "@capacitor/android": "8.5.3",
6
6
  "@capacitor/app": "8.1.2",
@@ -6,7 +6,7 @@ import { appPool, longQueryPool } from "@protobase/server/internal";
6
6
  import { Kysely, PostgresDialect } from "kysely";
7
7
  //#region src/project/pg-db.ts
8
8
  const createPgDb = (pg, url, max = readDbConnections(process.env)) => openAppDatabase(pg, url, max).db;
9
- /** Kysely over the app's pool, as `createPgDb` makes it, and the pool itself, which the app's Better Auth store shares. */
9
+ /** Kysely over the app's pool, as `createPgDb` makes it. */
10
10
  const openAppDatabase = (pg, url, max = readDbConnections(process.env)) => {
11
11
  const pool = appPool(pg, url, max);
12
12
  const long = longQueryPool(pg, url);
@@ -19,10 +19,7 @@ const openAppDatabase = (pg, url, max = readDbConnections(process.env)) => {
19
19
  await Promise.all([pool.end(), long.end()]);
20
20
  }
21
21
  };
22
- return {
23
- db: new Kysely({ dialect: new PostgresDialect({ pool: gateBackgroundWork(routed, Math.max(1, max - 1)) }) }),
24
- pool
25
- };
22
+ return { db: new Kysely({ dialect: new PostgresDialect({ pool: gateBackgroundWork(routed, Math.max(1, max - 1)) }) }) };
26
23
  };
27
24
  //#endregion
28
25
  export { createPgDb, openAppDatabase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.110.1",
3
+ "version": "0.110.3",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.110.1",
47
- "@protobase/layout": "0.110.1",
48
- "@protobase/query": "0.110.1",
49
- "@protobase/schema": "0.110.1",
50
- "@protobase/server": "0.110.1",
51
- "@protobase/ui": "0.110.1",
52
- "@protobase/workflows": "0.110.1",
46
+ "@protobase/config": "0.110.3",
47
+ "@protobase/layout": "0.110.3",
48
+ "@protobase/query": "0.110.3",
49
+ "@protobase/schema": "0.110.3",
50
+ "@protobase/server": "0.110.3",
51
+ "@protobase/ui": "0.110.3",
52
+ "@protobase/workflows": "0.110.3",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -22,7 +22,7 @@ export default defineConfig({
22
22
 
23
23
  ## Admin store
24
24
 
25
- Users, sessions and signing keys stay apart from the application's tables, in a schema of the app's own database, `auth` by default (`auth: { schema: 'accounts' }` names another), so a host that gives an application one database (and a role that cannot create databases) is enough. The store shares the app's one pool on `DATABASE_URL`, which `protobase dev` and `serve` open, so it opens no connections beyond [`PROTOBASE_DB_CONNECTIONS`](cli.md#serve), and a database restart is printed instead of stopping the app.
25
+ Users, sessions and signing keys stay apart from the application's tables, in a schema of the app's own database, `auth` by default (`auth: { schema: 'accounts' }` names another), so a host that gives an application one database (and a role that cannot create databases) is enough. Sign-in, sessions, tokens and organization memberships run through the app's own query layer, on its one pool on `DATABASE_URL`, which `protobase dev` and `serve` open, so the store opens no connections beyond [`PROTOBASE_DB_CONNECTIONS`](cli.md#serve), and a database restart is printed instead of stopping the app.
26
26
 
27
27
  ### Migrations
28
28
 
@@ -38,7 +38,7 @@ Each version's statements are followed by its row in `auth_migrations`. The file
38
38
 
39
39
  Every store has the tables of every feature, whether the app turns the feature on or not: [passkeys](#passkeys), [two-factor authentication](#two-factor-authentication), [organizations](#organizations), the [OAuth provider for MCP](#oauth-for-mcp-clients) and [personal access tokens](personal-access-tokens.md). Turning a feature on or off needs no migration and drops nothing; the columns a feature adds to the user and session tables are empty until it is on. SAML providers and open sign-up keep nothing in the store.
40
40
 
41
- The store's tables and columns are snake_case, like the app's (`sign_in_policy.platform_sign_in`, `session.user_id`); the code and the API keep Better Auth's camelCase names. The names the app configures, the store's schema ([`auth.schema`](config/sign-in.md#authschema)), the [user table](#an-existing-users-table) and its columns, and uuid ids (`generateUserId: 'uuid'`), are the ones in effect when the file is written. Changing one later is a migration of the project's own, such as a rename.
41
+ The store's tables and columns are snake_case, like the app's (`sign_in_policy.platform_sign_in`, `session.user_id`); the code and the API keep Better Auth's camelCase names. The names the app configures, the store's schema ([`auth.schema`](config/sign-in.md#authschema)), the [user table](#an-existing-users-table) and its columns, and uuid ids (`generateUserId: 'uuid'`), are the ones in effect when the file is written. Changing one later is a migration of the project's own, such as a rename. <gap>The sign-in policy, staff sign-in and personal access token tables cannot be renamed because config keys for their names are not implemented.</gap>
42
42
 
43
43
  The server never changes the schema, and never compares it with what Better Auth needs. `protobase serve` and `protobase dev` read `auth_migrations` at startup and refuse to start while a version of this Protobase is not applied, naming it and `protobase auth migration`, or while the store has a version newer than this Protobase knows. The examples' `db:migrate` applies all pending files in one transaction, so a migration that fails leaves the database as the running version expects it. The host must guarantee the rest: nothing but the migrations writes while they run, and the new version serves only after they succeeded. Only [`protobase dev`](cli.md#dev), on the developer's machine, compares the store's tables with what the app's Better Auth needs, and warns at startup about each table, column or index that drifted, such as one changed by hand.
44
44
 
@@ -676,7 +676,7 @@ Builds the project in the current directory as an iOS or Android app with Capaci
676
676
  - npm and Capacitor get the CLI's environment without any variable named in the current directory's `.env*` files, nor the four `PROTOBASE_ANDROID_*` signing variables, which only Gradle gets, and with `CI=true`, which keeps Capacitor's telemetry off. The project's config, its extensions' configs and the web build run inside the CLI with no `PROTOBASE_ANDROID_*` variable left in its environment, even one the project's `.env` sets.
677
677
  - It prints the workspace, the API origin and the native fingerprint, which the app also sends in its user agent as `ProtobaseNative/<fingerprint>`: a hash of the native packages `@protobase/mobile` pins, at their versions, its own native contract, and the section's `plugins`, at the versions they give. A [mobile release](#mobile-releases) runs only on a binary of its own fingerprint. A Protobase release that pins the same native packages and keeps the same native contract keeps it; raise a plugin's version when the app's files start using a newer native feature of it, which changes it.
678
678
  - The app's files carry the live updater's manifest of them, so an update downloads only the files that changed.
679
- - With `mobile.publicKey`, the Android and iOS app get the [live updater](#the-live-updater), unless `--live` is given, the app's files name no build time, or the API is neither https nor http to this machine; it prints a note why when it leaves it out.
679
+ - With `mobile.publicKey`, the Android and iOS app get the [live updater](#the-live-updater), unless `--live` is given, the app's files name no build time, or the API is neither https nor http to this machine; it prints a note why when it leaves it out. On Android, http to this machine works only in a debuggable app, as `run` builds it: a release build's live updater does not load with one.
680
680
  - `keys` prints a fresh RSA key pair: `PROTOBASE_MOBILE_SIGNING_KEY=<key>`, on one line with its newlines written `\n`, for the server's environment, a secret never to commit, and the public key, PEM, for `mobile.publicKey`. It reads no project and writes no file.
681
681
 
682
682
  ## `token`