@protobase/cli 0.131.1 → 0.132.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.
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.132.0",
|
|
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.
|
|
47
|
-
"@protobase/layout": "0.
|
|
48
|
-
"@protobase/query": "0.
|
|
49
|
-
"@protobase/schema": "0.
|
|
50
|
-
"@protobase/server": "0.
|
|
51
|
-
"@protobase/ui": "0.
|
|
52
|
-
"@protobase/workflows": "0.
|
|
46
|
+
"@protobase/config": "0.132.0",
|
|
47
|
+
"@protobase/layout": "0.132.0",
|
|
48
|
+
"@protobase/query": "0.132.0",
|
|
49
|
+
"@protobase/schema": "0.132.0",
|
|
50
|
+
"@protobase/server": "0.132.0",
|
|
51
|
+
"@protobase/ui": "0.132.0",
|
|
52
|
+
"@protobase/workflows": "0.132.0",
|
|
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",
|
|
@@ -32,6 +32,7 @@ Develop, build and run an app, on servers, in containers and on phones.
|
|
|
32
32
|
- [Self-hosted image](../guides/deploy.md#a-self-hosted-image): One image with the app inside that serves, migrates and creates the first admin.
|
|
33
33
|
- [Protobase Cloud deploys](../guides/deploy.md#protobase-cloud): A push to the app's GitHub branch builds it, migrates and checks its database in one transaction, and switches to the new version once it answers its health check.
|
|
34
34
|
- [Deploy checks in CI](../guides/deploy.md#check-a-change-before-it-merges): One step in an app's GitHub workflow runs the checks a Protobase Cloud deploy runs, the server's startup checks included, on a fresh Postgres of its own, so a change that would not deploy or start fails before it merges.
|
|
35
|
+
- [The version before in CI](../guides/deploy.md#test-the-version-that-serves-on-the-new-schema) (beta): A workflow to copy into an app runs the tests of the version that serves now on a database with a branch's migrations applied, so a migration that takes what that version reads fails before it deploys.
|
|
35
36
|
- [Mobile apps](../guides/mobile-app.md) (beta): Runs an app on iOS and Android, also on your own iPhone, with sign-in, and builds signed store releases from a section in its config. Your app shows its own home-screen icon on iOS and Android, generated from one image you name in your config. It can open on a splash screen of its own, an image on a colour, in light and dark mode.
|
|
36
37
|
- [Files from the phone](../guides/mobile-app.md#files-from-the-phone) (beta): In the iOS and Android app, Import and file fields open the phone's file picker, offering Excel, CSV and JSON files from the device and its cloud drives.
|
|
37
38
|
- [Mobile releases](../reference/cli.md#mobile-releases) (in development): The server offers the mobile app a newer copy of its files, signed, and any host that serves bundles can offer the same from the bundle's files without running its config.
|
|
@@ -46,7 +46,55 @@ The server reads the record once at startup, with the model it builds from the c
|
|
|
46
46
|
The database is behind Protobase 0.128.0, so the server will not start: the auth store's passkeys module is at step 1 (passkeys), and this version needs step 2 (rp_id_index). To bring the database up to 0.128.0, run `protobase migrate --plan` to see the migrations it will apply, then `protobase migrate`. Or run Protobase 0.127.5, the version the database matches.
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
It refuses as well on a database ahead of it by a migration that is not additive after the newest one recording the model it reads, saying that rolling back to it is blocked and naming the version the database matches, while a unique index of an `.after.sql` is still building, and on a database that records no migration while the app reads the sign-in store or a schema module, such as one migrated before this record: `protobase auth migration` then writes the file that records the store, and [`protobase migration baseline`](../reference/cli.md#migration) the one that records a schema an earlier version's migration made. An unfinished plain index does not keep it from starting. The server never migrates the database itself, and never turns a feature off because its tables are missing. Besides the record, with the built-in assistant it checks what the database has given the [query role](../reference/assistant.md#the-built-in-backend), which a migration cannot promise. <gap>A migration that breaks older code without changing the model the record holds, such as a hand-written rename of a resource's column, cannot stop the version before from starting because recording the app's own release in `migrations.history` is not implemented.</gap>
|
|
49
|
+
It refuses as well on a database ahead of it by a migration that is not additive after the newest one recording the model it reads, saying that rolling back to it is blocked and naming the version the database matches, while a unique index of an `.after.sql` is still building, and on a database that records no migration while the app reads the sign-in store or a schema module, such as one migrated before this record: `protobase auth migration` then writes the file that records the store, and [`protobase migration baseline`](../reference/cli.md#migration) the one that records a schema an earlier version's migration made. An unfinished plain index does not keep it from starting. The server never migrates the database itself, and never turns a feature off because its tables are missing. Besides the record, with the built-in assistant it checks what the database has given the [query role](../reference/assistant.md#the-built-in-backend), which a migration cannot promise. <gap>A migration that breaks older code without changing the model the record holds, such as a hand-written rename of a resource's column, cannot stop the version before from starting because recording the app's own release in `migrations.history` is not implemented.</gap>
|
|
50
|
+
|
|
51
|
+
### Test the version that serves on the new schema
|
|
52
|
+
|
|
53
|
+
:::caution[Beta]
|
|
54
|
+
<gap>The workflow cannot find the version that serves by itself because recording the app's deployed release is not implemented.</gap>
|
|
55
|
+
:::
|
|
56
|
+
|
|
57
|
+
While a deploy migrates, the version that serves now keeps running on the new schema until the new one takes over. This workflow, as `.github/workflows/older-code.yml`, applies a branch's migrations to an empty Postgres 18 and runs the tests of the version that serves now, checked out with its own packages, against that database through `DATABASE_URL`. A failing test names what the version before needs and the branch's migrations take, such as a column they drop. It checks what the app's tests read from the database, so it proves as much as those tests open. Run it from the Actions tab, giving the tag, branch or commit that serves; add `pull_request:` under `on:` to run it on every pull request, against the branch it merges into. A migration marked `-- protobase:breaks-older-code` is expected to fail it, since the version before refuses to start on it, but it does so only through a test that starts that version's server or reads what the migration changed: tests that do neither still pass.
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
name: older-code
|
|
61
|
+
on:
|
|
62
|
+
workflow_dispatch:
|
|
63
|
+
inputs:
|
|
64
|
+
previous:
|
|
65
|
+
description: The tag, branch or commit that serves now
|
|
66
|
+
default: main
|
|
67
|
+
jobs:
|
|
68
|
+
older-code:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
services:
|
|
71
|
+
postgres:
|
|
72
|
+
image: postgres:18
|
|
73
|
+
env:
|
|
74
|
+
POSTGRES_USER: app
|
|
75
|
+
POSTGRES_PASSWORD: app
|
|
76
|
+
POSTGRES_DB: app
|
|
77
|
+
ports:
|
|
78
|
+
- 5432:5432
|
|
79
|
+
options: --health-cmd "pg_isready -U app -d app" --health-interval 2s --health-retries 30
|
|
80
|
+
env:
|
|
81
|
+
DATABASE_URL: postgres://app:app@localhost:5432/app
|
|
82
|
+
PREVIOUS: ${{ inputs.previous || github.base_ref || 'main' }}
|
|
83
|
+
steps:
|
|
84
|
+
- uses: actions/checkout@v4
|
|
85
|
+
with:
|
|
86
|
+
fetch-depth: 0
|
|
87
|
+
- uses: oven-sh/setup-bun@v2
|
|
88
|
+
# This branch's migrations, the app's and the auth schema's, on an empty database.
|
|
89
|
+
- run: bun install --frozen-lockfile
|
|
90
|
+
- run: bun run db:migrate
|
|
91
|
+
# The version that serves now, with its own packages, and its tests on that database.
|
|
92
|
+
- run: |
|
|
93
|
+
commit=$(git rev-parse --verify --quiet "origin/$PREVIOUS^{commit}" || git rev-parse --verify "$PREVIOUS^{commit}")
|
|
94
|
+
git worktree add --detach "$RUNNER_TEMP/previous" "$commit"
|
|
95
|
+
- working-directory: ${{ runner.temp }}/previous
|
|
96
|
+
run: bun install --frozen-lockfile && bun run test
|
|
97
|
+
```
|
|
50
98
|
|
|
51
99
|
## Images
|
|
52
100
|
|
|
@@ -114,7 +114,7 @@ select jobs.enqueue('send-invoice', '{"invoiceId": 7}', run_at => now() + interv
|
|
|
114
114
|
select jobs.enqueue('sync-customer', '{"customerId": 3, "fields": ["email"]}', group_key => 'customer:3');
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
`jobs.enqueue(job_name, payload, run_at, key, group_key, priority)` returns the job's id. The job works in no organization
|
|
117
|
+
`jobs.enqueue(job_name, payload, run_at, key, group_key, priority)` returns the job's id. The job works in no organization, whatever its payload holds: the runtime keeps a job's organization under a top-level `~organization` key beside the payload, and a payload with a `~organization` key of its own reaches the job whole, as payload. A `key` dedupes as `mode: 'dedupe'` does. The job takes its retry settings from its definition, as the workers last saw it; a job no worker has started yet gets pg-boss's defaults until one does.
|
|
118
118
|
|
|
119
119
|
## Mail
|
|
120
120
|
|