@protobase/cli 0.94.32 → 0.94.34
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 +1 -1
- package/dist/mobile/generate.js +5 -1
- package/dist/mobile/ios-fresh-install.js +14 -0
- package/dist/mobile/package.js +1 -1
- package/package.json +8 -8
- package/skills/protobase/references/features/record-pages.md +1 -1
- package/skills/protobase/references/guides/mobile-app.md +2 -2
- package/skills/protobase/references/reference/ui-config.md +1 -1
package/dist/cli/package.js
CHANGED
package/dist/mobile/generate.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { dataExtractionRules, dataExtractionRulesPath, withoutBackup } from "./android-backup.js";
|
|
2
2
|
import { copyGoogleServices } from "./google-services.js";
|
|
3
3
|
import { withLocalNetworking } from "./info-plist.js";
|
|
4
|
+
import { withFreshInstall } from "./ios-fresh-install.js";
|
|
4
5
|
import { setUpIosPush } from "./ios-push.js";
|
|
5
6
|
import { withProtobaseIcon } from "./native-icon.js";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
8
9
|
//#region src/mobile/generate.ts
|
|
9
10
|
const infoPlist = (ws) => path.join(ws, "ios", "App", "App", "Info.plist");
|
|
11
|
+
const appDelegate = (ws) => path.join(ws, "ios", "App", "App", "AppDelegate.swift");
|
|
10
12
|
const androidManifest = (ws) => path.join(ws, "android", "app", "src", "main", "AndroidManifest.xml");
|
|
11
13
|
/**
|
|
12
14
|
* Generates the platform's native project in the workspace from its capacitor.config.json and app files, replacing
|
|
13
15
|
* the last one: it is never edited by hand. Its home-screen icon is Protobase's, an Android app with push gets the
|
|
14
16
|
* project's google-services.json from `googleServicesFrom`, an iOS app with push its entitlement in `apnsEnvironment` and
|
|
15
17
|
* the token forwarding, and an iOS app calling the API over plain http may reach local addresses. Android apps opt out
|
|
16
|
-
* of backup and device transfer,
|
|
18
|
+
* of backup and device transfer, and iOS apps start as a fresh install after a restore or a move, so nothing carries
|
|
19
|
+
* over to another phone.
|
|
17
20
|
*/
|
|
18
21
|
const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom, apnsEnvironment }, cap) => {
|
|
19
22
|
await rm(path.join(ws, platform), {
|
|
@@ -30,6 +33,7 @@ const generatePlatform = async (ws, platform, { cleartext, googleServicesFrom, a
|
|
|
30
33
|
await writeFile(rules, dataExtractionRules);
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
36
|
+
await writeFile(appDelegate(ws), withFreshInstall(await readFile(appDelegate(ws), "utf8")));
|
|
33
37
|
if (apnsEnvironment !== void 0) await setUpIosPush(ws, apnsEnvironment);
|
|
34
38
|
if (!cleartext) return;
|
|
35
39
|
await writeFile(infoPlist(ws), withLocalNetworking(await readFile(infoPlist(ws), "utf8")));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/mobile/ios-fresh-install.ts
|
|
2
|
+
const importLine = "import Capacitor\n";
|
|
3
|
+
const launchLine = " // Override point for customization after application launch.\n";
|
|
4
|
+
/**
|
|
5
|
+
* Capacitor's AppDelegate.swift preparing a fresh install first thing at launch, before the bridge reads what a live
|
|
6
|
+
* update left: an app a backup restored, or one moved to another iPhone, starts signed out with no drafts and no live
|
|
7
|
+
* update. Throws on any other AppDelegate rather than build an app that skips it.
|
|
8
|
+
*/
|
|
9
|
+
const withFreshInstall = (delegate) => {
|
|
10
|
+
if (delegate.split(importLine).length !== 2 || delegate.split(launchLine).length !== 2 || delegate.includes("ProtobaseMobile")) throw new Error("AppDelegate.swift is not Capacitor's template: it needs its one `import Capacitor` and one launch comment, and no ProtobaseMobile");
|
|
11
|
+
return delegate.replace(importLine, `${importLine}import ProtobaseMobile\n`).replace(launchLine, " ProtobaseFreshInstall.prepare()\n");
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { withFreshInstall };
|
package/dist/mobile/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.34",
|
|
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.94.
|
|
47
|
-
"@protobase/layout": "0.94.
|
|
48
|
-
"@protobase/query": "0.94.
|
|
49
|
-
"@protobase/schema": "0.94.
|
|
50
|
-
"@protobase/server": "0.94.
|
|
51
|
-
"@protobase/ui": "0.94.
|
|
52
|
-
"@protobase/workflows": "0.94.
|
|
46
|
+
"@protobase/config": "0.94.34",
|
|
47
|
+
"@protobase/layout": "0.94.34",
|
|
48
|
+
"@protobase/query": "0.94.34",
|
|
49
|
+
"@protobase/schema": "0.94.34",
|
|
50
|
+
"@protobase/server": "0.94.34",
|
|
51
|
+
"@protobase/ui": "0.94.34",
|
|
52
|
+
"@protobase/workflows": "0.94.34",
|
|
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",
|
|
@@ -30,7 +30,7 @@ The page of one record, with its sections, related records, galleries, charts an
|
|
|
30
30
|
- [Compact related cards](../reference/ui-config.md#compact-related-cards) (experimental): Related records can show as compact cards, coloured by a field.
|
|
31
31
|
- [Counts in headings](../reference/ui-config.md#counts-in-headings) (experimental): Related lists can show their count in the heading.
|
|
32
32
|
- [Group help lines](../reference/ui-config.md#groups) (experimental): A group can show a short line under its heading, also while it is closed.
|
|
33
|
-
- [A related record in full](../reference/ui-config.md#a-related-record-in-full): A related record can show its fields in full, without a card, for reading tabs such as notes.
|
|
33
|
+
- [A related record in full](../reference/ui-config.md#a-related-record-in-full): A related record can show its fields in full, without a card, for reading tabs such as notes, and offers to add it while there is none.
|
|
34
34
|
- [Record lines](../reference/ui-config.md#record-lines): The related table a record's view marks as its lines, such as an invoice's, shows all of them on its page, where you edit, add, remove and reorder them, and Save writes the record and its lines together.
|
|
35
35
|
- [Custom section fallbacks](../reference/custom-components.md#record-section-fallbacks) (experimental): Where your own component on a record page cannot be drawn, such as on a watch, what you declare shows in its place: any main-column item in the main column, conversations included, and sidebar maps and sidebar custom components in the sidebar.
|
|
36
36
|
- [Conversations](../reference/ui-config.md#conversations): A record page holds a chat about the record, such as a task's, with its messages in markdown and a box that sends one, declared in its layout with no component of the app's own.
|
|
@@ -45,7 +45,7 @@ Signing in works in the app as on the web, with nothing more to set up:
|
|
|
45
45
|
|
|
46
46
|
- Emailed codes, passwords and the second step of two-factor authentication work. <gap>Passkeys do not work in the app yet.</gap> <gap>Sign-in with another provider does not work in the app yet.</gap>
|
|
47
47
|
- The app calls `/api/auth` through the device's native HTTP, naming its Capacitor origin. With a mobile section, sign-in trusts the Capacitor origin a request names, for that request only, without CORS. A POST from a Capacitor origin must send a JSON body: any other is refused with 415, as only a page in the app sends one.
|
|
48
|
-
- The session lives in the device's cookie store
|
|
48
|
+
- The session survives reloads, updates and relaunches. On Android it lives in the device's cookie store; on iOS in a keychain item that stays on the device, out of the WebView and the device's cookie store.
|
|
49
49
|
- <gap>"Forgot password?" is not offered in the app, as the emailed link cannot lead back into it.</gap>
|
|
50
50
|
- Page script cannot reach the session cookie, on iOS and Android alike: Capacitor's `CapacitorHttp`, `CapacitorCookies` and `WebView` plugins are refused to it, and so are the app's local file routes. A plugin that reads files for its JavaScript, such as `@capacitor/filesystem`, could still hand the cookie over.
|
|
51
51
|
- While you develop over plain `http://localhost` with a mobile section, a page served on `https://localhost` in the same browser can send sign-in requests that carry your dev session, as some browsers treat the two as the same site. Do not open untrusted pages on `https://localhost` while you develop.
|
|
@@ -111,7 +111,7 @@ makes a signed release binary: an `.aab` to upload to Google Play, an `.ipa` to
|
|
|
111
111
|
- A release calls its server over https, at `--api` or the app's `url`: plain http, `localhost` and `10.0.2.2` are refused.
|
|
112
112
|
- `--app-version` is the version the stores show, one to three numbers such as `1.2.3`. `--build-number` is a whole number that must rise with every upload, such as your CI's run number.
|
|
113
113
|
- Extra plugins run at build time with access to your signing key, so add only plugins you trust.
|
|
114
|
-
- Android apps built by `protobase mobile run` and `protobase mobile build` opt out of
|
|
114
|
+
- iOS and Android apps built by `protobase mobile run` and `protobase mobile build` carry nothing over to a new phone or from a backup, so no working session sits in a backup or on another phone. Android apps opt out of backup and device-to-device transfer; an iOS app keeps its session in a keychain item that never leaves the device, and its first launch after a restore, even on the same iPhone, or a move to a new one, removes everything the app kept before its page loads. On a new phone, or after restoring a backup, the app starts as a fresh install: your users sign in again, and unsent drafts and downloaded live updates are gone. Reinstalling an iOS app starts it as a fresh install too.
|
|
115
115
|
|
|
116
116
|
**Android.** Make an upload key once, outside the project, and never commit it:
|
|
117
117
|
|
|
@@ -1120,7 +1120,7 @@ l.group('Open tasks', [
|
|
|
1120
1120
|
|
|
1121
1121
|
#### A related record in full
|
|
1122
1122
|
|
|
1123
|
-
With `presentation: 'record'` the section shows one related record as part of the page, for a tab meant for reading, such as an objective's notes kept in a record of their own: no card, no title of the record, nothing cut short with **Show more**, and no View all while there is only the one record. It shows the first record in `sort` order, each of `columns` in full as the record page shows it (a markdown field rendered), leaving out a field the record has no value for. On the heading's line, a link **Open** and the singular name of `resource`'s view, such as **Open note**, goes to the record's own page, with `button` before it. When more records match, View all under the record opens them all in the list, so a section such as the latest review does not hide the older ones. With one column the value stands alone, without its label; with several each is under its label. Without a record it shows `empty`, or with `hideEmpty` nothing. A change to the record shows as soon as the page hears of it, as in every related section of a [live](live.md) resource.
|
|
1123
|
+
With `presentation: 'record'` the section shows one related record as part of the page, for a tab meant for reading, such as an objective's notes kept in a record of their own: no card, no title of the record, nothing cut short with **Show more**, and no View all while there is only the one record. It shows the first record in `sort` order, each of `columns` in full as the record page shows it (a markdown field rendered), leaving out a field the record has no value for. On the heading's line, a link **Open** and the singular name of `resource`'s view, such as **Open note**, goes to the record's own page, with `button` before it. When more records match, View all under the record opens them all in the list, so a section such as the latest review does not hide the older ones. With one column the value stands alone, without its label; with several each is under its label. Without a record it shows `empty`, or with `hideEmpty` nothing; to whoever may create a record of `resource`, as the list offers New, its heading then has **Add** and the singular name, such as **Add note**, a link to the create form with `field` filled in with the value it matches, this record's key or its `from` field's (none with `through`). A change to the record shows as soon as the page hears of it, as in every related section of a [live](live.md) resource.
|
|
1124
1124
|
|
|
1125
1125
|
```ts
|
|
1126
1126
|
l.tab('Notes', [
|