@protobase/cli 0.110.5 → 0.111.1
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/project/background-gate.js +3 -3
- package/dist/project/pg-db.js +3 -3
- package/package.json +8 -8
- package/skills/protobase/references/features/email-and-public-forms.md +1 -1
- package/skills/protobase/references/reference/auth.md +1 -1
- package/skills/protobase/references/reference/cli.md +1 -1
- package/skills/protobase/references/reference/email.md +13 -1
package/dist/cli/package.js
CHANGED
|
@@ -23,10 +23,10 @@ const gateBackgroundWork = (pool, slots) => {
|
|
|
23
23
|
throw error;
|
|
24
24
|
});
|
|
25
25
|
const release = client.release;
|
|
26
|
-
client.release = () => {
|
|
27
|
-
release.call(client);
|
|
26
|
+
client.release = ((error) => {
|
|
27
|
+
release.call(client, error);
|
|
28
28
|
free();
|
|
29
|
-
};
|
|
29
|
+
});
|
|
30
30
|
return client;
|
|
31
31
|
};
|
|
32
32
|
return {
|
package/dist/project/pg-db.js
CHANGED
|
@@ -2,8 +2,8 @@ import { gateBackgroundWork } from "./background-gate.js";
|
|
|
2
2
|
import { connectLong } from "./long-connect.js";
|
|
3
3
|
import { connectOrBusy } from "./pool-wait.js";
|
|
4
4
|
import { readDbConnections, wantsLongQueries } from "@protobase/server";
|
|
5
|
-
import { appPool, longQueryPool } from "@protobase/server/internal";
|
|
6
|
-
import { Kysely
|
|
5
|
+
import { appDialect, appPool, longQueryPool } from "@protobase/server/internal";
|
|
6
|
+
import { Kysely } 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
9
|
/** Kysely over the app's pool, as `createPgDb` makes it. */
|
|
@@ -19,7 +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 { db: new Kysely({ dialect:
|
|
22
|
+
return { db: new Kysely({ dialect: appDialect(gateBackgroundWork(routed, Math.max(1, max - 1))) }) };
|
|
23
23
|
};
|
|
24
24
|
//#endregion
|
|
25
25
|
export { createPgDb, openAppDatabase };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.1",
|
|
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.111.1",
|
|
47
|
+
"@protobase/layout": "0.111.1",
|
|
48
|
+
"@protobase/query": "0.111.1",
|
|
49
|
+
"@protobase/schema": "0.111.1",
|
|
50
|
+
"@protobase/server": "0.111.1",
|
|
51
|
+
"@protobase/ui": "0.111.1",
|
|
52
|
+
"@protobase/workflows": "0.111.1",
|
|
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",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Mail the app sends, the PDF documents it makes, and forms for people without an account.
|
|
6
6
|
|
|
7
|
-
- [Email](../reference/email.md#configuration): The app sends mail through one SMTP server or a mailer you supply.
|
|
7
|
+
- [Email](../reference/email.md#configuration): The app sends mail through one SMTP server or a mailer you supply. [Sending returns the message id](../reference/email.md#message-id), so you can match a later reply, bounce or complaint to the mail it answers.
|
|
8
8
|
- [Built-in emails](../reference/email.md#protobases-own-mail): Sign-in codes, password resets, invitations and mentions are sent in the app's name, in English or Dutch.
|
|
9
9
|
- [Email templates](../reference/email.md#templates) (beta): Your own emails are templates with typed data, written in mail blocks with their texts in each language they are sent in, checked by a schema of yours or the data they read, and sent from jobs, hooks, functions or a workflow's Send email step.
|
|
10
10
|
- [Emails in React](../reference/email.md#emails-in-react): An email can be a React component with typed data instead, for a layout the mail blocks cannot draw.
|
|
@@ -244,7 +244,7 @@ Sign-in reads both from the environment; the platform passes them, like `DATABAS
|
|
|
244
244
|
// auth/mailer.ts
|
|
245
245
|
import type { Mailer } from '@protobase/server'
|
|
246
246
|
|
|
247
|
-
export default { send: async ({ to, subject, text }) => { /* deliver it */ } } satisfies Mailer
|
|
247
|
+
export default { send: async ({ to, subject, text }) => { /* deliver it */ return {} } } satisfies Mailer
|
|
248
248
|
```
|
|
249
249
|
|
|
250
250
|
[Jobs](jobs.md#mail) send their own mail through the same server, or the same `auth/mailer.ts`, with `mail` in their context, and so do the app's [email templates](email.md) given it.
|
|
@@ -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
|
|
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 `localhost`, `127.0.0.1` or `[::1]`, which only iOS's `--api` accepts; it prints a note why when it leaves it out. An Android `--api` of `10.0.2.2`, the emulator's host, gets no live updater. On Android, http to `localhost` or `127.0.0.1` 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`
|
|
@@ -28,7 +28,7 @@ PROTOBASE_MAIL_FROM=noreply@shop.example.com
|
|
|
28
28
|
|
|
29
29
|
Over `smtp://` the client always upgrades the connection with STARTTLS before it logs in or sends anything, so nobody between the app and the server reads the server's password or the mail, such as a sign-in code or a reset link. A server that does not offer STARTTLS, or an answer from which someone on the way removed it, fails the send, with the code `ETLS` when the server refuses the upgrade. `?requireTLS=false` on the URL is the only way to send in plaintext, for a server that has no TLS, such as the mail catcher above or a server on the same host. `smtps://` uses TLS from the start.
|
|
30
30
|
|
|
31
|
-
A project that delivers its mail another way exports a mailer, `{ send({ to, subject, text, html, headers }) }`, as the default of `auth/mailer.ts`: sign-in and the jobs (`mail` in their context) both send with it. `auth: { mailer: false }` turns sign-in's mail off whatever the environment says. A host that runs jobs itself passes a mailer to `startJobs`. A template's `send` takes one too, see [Templates](#templates).
|
|
31
|
+
A project that delivers its mail another way exports a mailer, `{ send({ to, subject, text, html, headers }) }`, resolving to `{ messageId }` when it knows the message's `Message-ID` and `{}` when not, as the default of `auth/mailer.ts`: sign-in and the jobs (`mail` in their context) both send with it. `auth: { mailer: false }` turns sign-in's mail off whatever the environment says. A host that runs jobs itself passes a mailer to `startJobs`. A template's `send` takes one too, see [Templates](#templates).
|
|
32
32
|
|
|
33
33
|
### When the server does not answer
|
|
34
34
|
|
|
@@ -264,6 +264,17 @@ export default defineFunction({ roles: ['desk'] }, async (request, { records })
|
|
|
264
264
|
|
|
265
265
|
A message is sent once per call, so a job try that sends and then fails sends again: record what was sent, and check it first.
|
|
266
266
|
|
|
267
|
+
### Message id
|
|
268
|
+
|
|
269
|
+
`mail.send` and a template's `send` resolve to `{ messageId }`, the `Message-ID` header the recipient sees, such as `<3f9c2a7e0b4d4e51a1c6f0d2b8e7a913@shop.example.com>`. Store it with the record the mail was about, so a reply, bounce or complaint that comes back later, which names that id, can be matched to the mail it answers. A mailer that does not know the id resolves to `{}`, so store `null` then:
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
const { messageId } = await invoiceEmail.send(client.email, { number: 7 }, mail)
|
|
273
|
+
await db.updateTable('invoices').set({ message_id: messageId ?? null }).where('id', '=', invoice.id).execute()
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Protobase gives every message through `PROTOBASE_SMTP_URL` a new id on the sender's domain before it goes out, in place of a `Message-ID` among the message's own `headers`. A relay that rewrites the `Message-ID` changes what the recipient sees, so check that yours keeps it. A mailer of the project's own resolves to the id it sends, or to `{}` without one; mail from someone's own mailbox resolves to `{}` (see below).
|
|
277
|
+
|
|
267
278
|
## Attachments
|
|
268
279
|
|
|
269
280
|
A message takes files beside its body, such as an invoice's PDF: `attachments`, each a `filename`, its bytes as `content` (a `Uint8Array`, such as a `Buffer`) and, optionally, its `contentType`, else the one the name implies. A template's `send` takes them as its fourth argument:
|
|
@@ -320,6 +331,7 @@ export default defineFunction(async (request, { personalMail }) => {
|
|
|
320
331
|
- **Sign-in is not a mailbox:** under **Mailbox**, the account page says when someone signs in with Google without having allowed it to send mail, so a linked Google sign-in is not taken for a connected mailbox.
|
|
321
332
|
- <gap>The account page cannot show which account a mailbox is linked through or disconnect it because unlinking a mailbox is not implemented.</gap>
|
|
322
333
|
- <gap>Mailboxes other than Gmail cannot be linked because no other mail provider is implemented.</gap>
|
|
334
|
+
- <gap>A send through Gmail cannot return its [message id](#message-id) because Gmail sets its own and reading it back needs a scope that reads the mailbox, which the link does not ask for.</gap>
|
|
323
335
|
|
|
324
336
|
### From addresses
|
|
325
337
|
|