@protobase/cli 0.57.5 → 0.57.6

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.57.5";
2
+ var version = "0.57.6";
3
3
  //#endregion
4
4
  export { version };
@@ -12,12 +12,11 @@ const ownOrigin = (origin) => {
12
12
  return url.protocol === "https:" || url.protocol === "http:" && loopback.includes(url.hostname);
13
13
  };
14
14
  /**
15
- * Whether the app gets the live updater: on Android only, with `mobile.publicKey`, the order of its own files and an
15
+ * Whether the app gets the live updater, on Android and iOS alike: with `mobile.publicKey`, the order of its own files and an
16
16
  * API origin it may take releases from, never with `--live`. `note` says why not, when the project could change it.
17
17
  */
18
- const liveUpdateSettings = ({ platform, publicKey, builtInOrder, apiOrigin, live }) => {
18
+ const liveUpdateSettings = ({ publicKey, builtInOrder, apiOrigin, live }) => {
19
19
  if (live) return {};
20
- if (platform !== "android") return publicKey === void 0 ? {} : { note: "the iOS app does not update itself yet: its live updater is Android only" };
21
20
  if (publicKey === void 0) return { note: "the app does not update itself: set mobile.publicKey to the public key protobase mobile keys prints" };
22
21
  if (!builtInOrder) return { note: "the app does not update itself: its files name no build time, so it could not refuse a release older than them" };
23
22
  if (!ownOrigin(apiOrigin)) return { note: `the app does not update itself: it takes releases over https only, or http to this device, not from ${apiOrigin}` };
@@ -1,6 +1,6 @@
1
1
  //#region ../mobile/package.json
2
2
  var name = "@protobase/mobile";
3
- var nativeContract = 7;
3
+ var nativeContract = 8;
4
4
  var dependencies = {
5
5
  "@capacitor/android": "8.5.3",
6
6
  "@capacitor/app": "8.1.2",
@@ -57,7 +57,6 @@ const prepare = async ({ projectDir, platform, api, extensions, live, release },
57
57
  }) : await placeholderWebPart(ws);
58
58
  const fingerprint = nativeFingerprint(pinnedNative, mobile.plugins);
59
59
  const liveUpdate = liveUpdateSettings({
60
- platform,
61
60
  ...mobile.publicKey && { publicKey: mobile.publicKey },
62
61
  ...builtInOrder && { builtInOrder },
63
62
  apiOrigin: url.origin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.57.5",
3
+ "version": "0.57.6",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.57.5",
46
- "@protobase/layout": "0.57.5",
47
- "@protobase/query": "0.57.5",
48
- "@protobase/schema": "0.57.5",
49
- "@protobase/server": "0.57.5",
50
- "@protobase/ui": "0.57.5",
45
+ "@protobase/config": "0.57.6",
46
+ "@protobase/layout": "0.57.6",
47
+ "@protobase/query": "0.57.6",
48
+ "@protobase/schema": "0.57.6",
49
+ "@protobase/server": "0.57.6",
50
+ "@protobase/ui": "0.57.6",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -25,4 +25,4 @@ Develop, build and run an app, on servers, in containers and on phones.
25
25
  - [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.
26
26
  - [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.
27
27
  - [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.
28
- - [Live updates](../reference/cli.md#the-live-updater) (in development): The Android app updates itself in the background to the server's release, downloading only the files that changed, and goes back to the files it was built with when a release fails to start.
28
+ - [Live updates](../reference/cli.md#the-live-updater) (in development): The Android and iOS app update themselves in the background to the server's release, downloading only the files that changed, and go back to the files they were built with when a release fails to start.
@@ -122,7 +122,7 @@ Only Gradle gets them, for the length of the build: npm, its install scripts and
122
122
 
123
123
  ## 7. Live updates
124
124
 
125
- An Android app updates its files itself from your server, so it gets UI changes without a store release. Make a key pair once:
125
+ The app updates its files itself from your server, on Android and iOS alike, so it gets UI changes without a store release. Make a key pair once:
126
126
 
127
127
  ```sh
128
128
  protobase mobile keys
@@ -139,7 +139,7 @@ mobile: {
139
139
  },
140
140
  ```
141
141
 
142
- Build the binary again. Each deploy of the app then reaches it: it downloads the files that changed in the background and runs them at its next start, and a release that fails to start goes back to the files the binary carries. Releases come from a server of the same Protobase minor as the binary (below 1.0); a newer minor needs a store release. See [the live updater](../reference/cli.md#the-live-updater). <gap>The iOS app cannot update itself because its guarded live updater is not implemented.</gap>
142
+ Build the binary again. Each deploy of the app then reaches it: it downloads the files that changed in the background and runs them at its next start, and a release that fails to start goes back to the files the binary carries. Releases come from a server of the same Protobase minor as the binary (below 1.0); a newer minor needs a store release. See [the live updater](../reference/cli.md#the-live-updater).
143
143
 
144
144
  ## 8. What the stores accept
145
145
 
@@ -424,7 +424,7 @@ The app's address and secret are `PROTOBASE_URL` and `PROTOBASE_SECRET` unless i
424
424
  ### Mobile releases
425
425
 
426
426
  :::caution[In development]
427
- <gap>The iOS app cannot install a release because its guarded live updater is not implemented.</gap>
427
+ Mobile releases and the live updater are in development.
428
428
  :::
429
429
 
430
430
  With a `mobile` section, the server serves the [mobile app](../guides/mobile-app.md) a newer copy of its files, for its live updater, so the app gets UI changes without a store release. The release is what the server serves the web, composed at startup: every file of `public/`, with the server's own shell where `protobase serve` uses it, and `index.html` naming the API origin, the app's `url` (https, or plain http to `localhost`, `127.0.0.1` or `[::1]`). There is none when the server serves the API alone, has no such `url`, or the bundle names no `native`, and with `PROTOBASE_MOBILE_SIGNING_KEY` none for a bundle that names no build time (one built before Protobase recorded it: build it again). Where `protobase serve` serves its own shell, the release's fingerprint names the `native` of that shell's `protobase.shell.json`, and there is none when it names none.
@@ -432,11 +432,11 @@ With a `mobile` section, the server serves the [mobile app](../guides/mobile-app
432
432
  - `GET /api/mobile/release?fingerprint=<native fingerprint>&shell_version=<x.y.z>` answers `{ "bundleId", "url", "required" }`: the release's id, a hash of its files, and its absolute base URL, both `null` when the release does not run on the asking binary, whose native fingerprint must equal the release's. `required` is true when the shell the app runs no longer works with the server's API: below 1.0 another minor, from 1.0 another major. A missing fingerprint or a shell version that is no x.y.z version gets 400.
433
433
  - `GET /api/mobile/releases/<bundleId>?href=<file>` serves the release's file `<file>`, such as `assets/index-abc123.js`, and with `href=capawesome-live-update-manifest.json` its manifest, a JSON array of `{ "href", "checksum", "sizeInBytes" }`. Each comes with its sha256 in hex in `X-Checksum` and, with `PROTOBASE_MOBILE_SIGNING_KEY`, its signature in `X-Signature`. Any other file, or another release's id, gets 404.
434
434
  - Signed, a release also serves `href=protobase-release.json`, its statement: `{ "payload", "signature" }`, the payload the hex of the JSON `{ "manifest", "order", "appId", "fingerprint", "shellVersion" }` and the signature the hex of its SHA256withRSA over the line `protobase-mobile-release` and the payload. It binds the manifest's sha256 to the release's order, when the bundle was built and then when the server's own shell it serves was built (0 with the bundle's copy), to the app id and native fingerprint of the binaries it runs on, and to the server's Protobase version. Its id is then a hash of the statement and the public key, so the same files built again get another id. A file of the app may not be named like the statement or start with that line.
435
- - On Android, the app downloads a release itself and takes it only when its statement is signed with the key the binary pins, names the release's id, this app, this binary and a server its shell works with, and its order is not below the highest it downloaded; then every file must hash to what the manifest lists, under a path inside the release, before any file is written. It runs a downloaded release only above the running one's order and holding nothing but the files its manifest lists. It never takes a release at or below the order of its own files, which `protobase mobile` records in the binary as the server would order the same bundle with its copy of the shell, so a reinstalled app is not taken below them, and a release built before the binary is not taken. <gap>A phone cannot take a rollback of the bundle or of the server's shell before a later build, because ordering releases by an explicit release number is not implemented.</gap> <gap>An Android app with no download recorded, such as after a reinstall, cannot refuse a genuine signed release older than the latest but newer than its own files, because a signed answer naming the latest release is not implemented.</gap> <gap>The iOS app cannot check a release's statement because its guarded live updater is not implemented.</gap>
435
+ - The app, on Android and iOS alike, downloads a release itself and takes it only when its statement is signed with the key the binary pins, names the release's id, this app, this binary and a server its shell works with, and its order is not below the highest it downloaded; then every file must hash to what the manifest lists, under a path inside the release, before any file is written. It follows no redirect and reads no file past the size its manifest lists. It runs a downloaded release only above the running one's order and holding nothing but the files its manifest lists. It never takes a release at or below the order of its own files, which `protobase mobile` records in the binary as the server would order the same bundle with its copy of the shell, so a reinstalled app is not taken below them, and a release built before the binary is not taken. <gap>A phone cannot take a rollback of the bundle or of the server's shell before a later build, because ordering releases by an explicit release number is not implemented.</gap> <gap>An app with no download recorded, such as after a reinstall, cannot refuse a genuine signed release older than the latest but newer than its own files, because a signed answer naming the latest release is not implemented.</gap>
436
436
 
437
437
  #### The live updater
438
438
 
439
- An Android app built with `mobile.publicKey` updates itself from the server it calls. The shell asks `GET /api/mobile/release` when the app starts and each time it comes back to the foreground, in the background, and downloads a release it does not run, only the files that changed, then runs it at the next cold start. The session stays in the device's cookie store, so the user stays signed in across the switch.
439
+ An Android or iOS app built with `mobile.publicKey` updates itself from the server it calls. The shell asks `GET /api/mobile/release` when the app starts and each time it comes back to the foreground, in the background, and downloads a release it does not run, only the files that changed, then runs it at the next cold start. The session stays in the device's cookie store, so the user stays signed in across the switch.
440
440
 
441
441
  - Once the shell has drawn, it tells the updater the release started. A release that does not within 30 seconds goes back to the app's own files at once and is never taken again.
442
442
  - No answer, any status but 200, a body that is not the answer, or an answer naming no release changes nothing: the app keeps the files it runs, and never goes back to its own files because of the answer, which is not signed.
@@ -602,7 +602,7 @@ Builds the project in the current directory as an iOS or Android app with Capaci
602
602
  - 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.
603
603
  - 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.
604
604
  - The app's files carry the live updater's manifest of them, so an update downloads only the files that changed.
605
- - With `mobile.publicKey`, the Android app gets 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. The iOS app gets none yet.
605
+ - 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.
606
606
  - `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.
607
607
 
608
608
  ## `token`
@@ -104,7 +104,7 @@ The app's iOS and Android build: with it, `protobase mobile` builds the app with
104
104
 
105
105
  - `appId`: the app's id on both iOS and Android, such as `com.example.shop`: two or more dot-separated parts, each a letter then letters and digits.
106
106
  - `plugins`: extra native Capacitor plugins, by npm name and version range. A range fetched over plain `http:` or `git:` is refused.
107
- - `publicKey`: the public key, PEM, of the RSA key the server signs the app's [releases](../cli.md#the-live-updater) with, from [`protobase mobile keys`](../cli.md#mobile): with it the Android app updates itself. Anything but an RSA public key of at least 2048 bits stops the build.
107
+ - `publicKey`: the public key, PEM, of the RSA key the server signs the app's [releases](../cli.md#the-live-updater) with, from [`protobase mobile keys`](../cli.md#mobile): with it the Android and iOS app update themselves. Anything but an RSA public key of at least 2048 bits stops the build.
108
108
 
109
109
  ```ts
110
110
  export default defineConfig({