@protobase/cli 0.85.1 → 0.86.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.86.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.86.0",
|
|
47
|
+
"@protobase/layout": "0.86.0",
|
|
48
|
+
"@protobase/query": "0.86.0",
|
|
49
|
+
"@protobase/schema": "0.86.0",
|
|
50
|
+
"@protobase/server": "0.86.0",
|
|
51
|
+
"@protobase/ui": "0.86.0",
|
|
52
|
+
"@protobase/workflows": "0.86.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",
|
|
@@ -12,6 +12,7 @@ Mail the app sends, the PDF documents it makes, and forms for people without an
|
|
|
12
12
|
- [Attachments](../reference/email.md#attachments): A message carries files, such as an invoice's PDF, through the app's mail or someone's own mailbox.
|
|
13
13
|
- [PDF documents](../reference/pdf.md#documents): PDF files such as invoices and quotes are React components with typed data, rendered from jobs, hooks or functions and attached to mail as they are.
|
|
14
14
|
- [Mail from your own mailbox](../reference/email.md#from-someones-own-mailbox) (beta): People link their Gmail on the account page, and the app's functions send mail from it; an action offers to connect the mailbox right there when the link is missing or expired.
|
|
15
|
+
- [From addresses](../reference/email.md#from-addresses) (beta): People enter their mailbox's other send-as addresses once on the account page, each with a signature of its own, and the app sends from the one it names or their default.
|
|
15
16
|
- [Public forms](../reference/forms.md#what-the-visitor-sees): A form at its own address lets people without an account create a record, such as a contact request.
|
|
16
17
|
- [Bot check](../reference/forms.md#bot-check): Each submission passes a check in the browser, without a third-party service or a puzzle.
|
|
17
18
|
- [Form rate limit](../reference/forms.md#rate-limit): Each client sends only a set number of submissions per minute.
|
|
@@ -66,3 +66,13 @@ export default defineFunction(async (request, { personalMail }) => {
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
The message goes out from the linked Gmail, and shows in its Sent folder. When the person linked nothing the call answers `409` with `code: "not_linked"`, and when Google no longer honours the link, as after they removed the app from their Google account, `code: "link_expired"`. An action whose handler calls the function offers to connect Gmail right in its dialog then; mark it `mailbox: true` and it offers that before it runs, while nothing is linked ([Actions that send from someone's mailbox](../reference/ui-config.md#actions-that-send-from-someones-mailbox)).
|
|
69
|
+
|
|
70
|
+
## 5. Send from another address
|
|
71
|
+
|
|
72
|
+
A Gmail account may send as other addresses of yours, such as a company address beside your own. To have the app send from one:
|
|
73
|
+
|
|
74
|
+
1. **Set it up in Gmail first:** Gmail's settings → Accounts → **Send mail as** → Add another email address, and confirm it as Gmail asks. An alias of a Google Workspace domain is there already.
|
|
75
|
+
2. **Enter it once in the app:** on the account page, under **Mailbox** → **From addresses**, choose **Add a From address** and type it. Give it a signature of its own if you like, and make it the default to send from it whenever the app names no address.
|
|
76
|
+
3. **Name it when sending:** `personalMail.send({ from: 'billing@shop.example', to, subject, text })`.
|
|
77
|
+
|
|
78
|
+
Gmail sends from your primary address instead, without an error, when the address is not verified under **Send mail as**, so check the first message's From in the Sent folder. The app sends only from addresses entered this way: any other `from` is refused with a `403` before anything is sent. [From addresses](../reference/email.md#from-addresses) has the details.
|
|
@@ -253,7 +253,7 @@ export default defineFunction(async (request, { personalMail }) => {
|
|
|
253
253
|
{ "type": "urn:protobase:problem:personal-mail-link-expired", "status": 409, "code": "link_expired", "provider": "gmail" }
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
- **Sender:** the provider sends as the linked address; Gmail sets the From header to it.
|
|
256
|
+
- **Sender:** without a [From address](#from-addresses), the provider sends as the linked address; Gmail sets the From header to it.
|
|
257
257
|
- **Which account:** mail goes out through the account the person connected for mail last. Connecting Gmail with another Google account takes the mail scopes off the earlier one in the app's store, and signing in with the earlier one does not take the mail back; connecting it again does. When the chosen account's link fails, sending fails: it never falls back to another account. Of two accounts that both still hold the mail scopes, as when both connected before this rule came in, mail goes through the one linked to the person last, until they connect one again.
|
|
258
258
|
- **Only the person:** mail goes out from a mailbox only for someone signed in as themselves, or from a [workflow step's `mailbox`](workflow-plugins.md#step-types) in a version that person turned on while signed in as themselves, and only while they may still change the workflow. Staff [signed in as them](auth.md#staff-sign-in), an outside app acting for them, and a job's own code cannot send from it; a request is refused with a `403` problem (`own-sign-in-only`), a step fails with `not_linked`, and nothing is sent. Turning the workflow off, or someone else turning a new version on, ends the first person's consent.
|
|
259
259
|
- **Providers:** Gmail, through Google sign-in. A provider is added to Protobase behind the same `PersonalMailProvider` shape: its sign-in provider, the scopes linking asks for, and how it sends.
|
|
@@ -261,6 +261,40 @@ export default defineFunction(async (request, { personalMail }) => {
|
|
|
261
261
|
- <gap>The account page cannot show which account a mailbox is linked through or disconnect it because unlinking a mailbox is not implemented.</gap>
|
|
262
262
|
- <gap>Mailboxes other than Gmail cannot be linked because no other mail provider is implemented.</gap>
|
|
263
263
|
|
|
264
|
+
### From addresses
|
|
265
|
+
|
|
266
|
+
A mailbox may send as more than its own address, such as Gmail's send-as addresses (Gmail's settings → Accounts → **Send mail as**). The person enters each such address once on the account page, under **Mailbox** → **From addresses**; only they can send from it. For each they choose:
|
|
267
|
+
|
|
268
|
+
- **Signature:** an address may carry its own signature, which takes the place of the app's generic one; left empty, the generic one applies.
|
|
269
|
+
- **Default:** one address, theirs or their mailbox's own, is the one mail goes out from when the app names none.
|
|
270
|
+
|
|
271
|
+
A function then names the From address with `from`, matched without regard to case. To send a template from it, render it and send the result:
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
export default defineFunction(async (request, { personalMail }) => {
|
|
275
|
+
const { to, number, pdf } = await readInvoice(request)
|
|
276
|
+
const sender = await personalMail.sender('billing@shop.example')
|
|
277
|
+
const email = await invoiceEmail.render({ number, signature: sender.signature ?? defaultSignature })
|
|
278
|
+
await personalMail.send({ from: sender.address, to, ...email, attachments: [{ filename: `invoice-${number}.pdf`, content: pdf, contentType: 'application/pdf' }] })
|
|
279
|
+
return new Response(null, { status: 204 })
|
|
280
|
+
})
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- **`send({ from, ... })`:** sends from `from`, else the person's default address, else their mailbox's own. Gmail keeps the From header when the address is one of the account's verified send-as addresses; when it is not, Gmail sends from the account's own address instead, without an error.
|
|
284
|
+
- **`sender(from?)`:** the address a send with `from` goes out as: `address`, `signature` when it has its own, and `ownerId`, whose mailbox it goes through. It refuses as `send` does.
|
|
285
|
+
- **`senders()`:** every address the caller may choose, such as for a send dialog: their mailbox's own, then those they entered.
|
|
286
|
+
- **Refused addresses:** a From address that is not the mailbox's own and not one the caller entered is refused before anything is sent, with a `MailSenderRefusedError` that answers as a `403` problem naming it; so is an address someone else entered, in the same words:
|
|
287
|
+
|
|
288
|
+
```json
|
|
289
|
+
{ "type": "urn:protobase:problem:mail-sender-refused", "status": 403, "address": "ceo@shop.example", "detail": "You may not send mail from ceo@shop.example: add it to the Mailbox section of your account page first" }
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
- **The mailbox's own address** is the one its provider's ID token names; Google gives it with the `email` scope sign-in asks for.
|
|
293
|
+
- **The account page's calls:** `GET /api/auth/account/mail-senders` lists the person's addresses with their mailbox's own `address`; `POST .../mail-senders/add { address, signature? }`, `POST .../mail-senders/update { id, signature?, isDefault? }` (`signature: null` drops its own) and `POST .../mail-senders/remove { id }` change them. Each acts on the signed-in person's own addresses only.
|
|
294
|
+
- <gap>An entered address cannot be checked to work before mail goes out from it because the test mail through the mailbox is not implemented.</gap>
|
|
295
|
+
- <gap>An address cannot be shared with others who send mail because proving that the person owns the address is not implemented.</gap>
|
|
296
|
+
- <gap>A From address cannot carry a display name, so its mail shows the bare address, because names per address are not implemented.</gap>
|
|
297
|
+
|
|
264
298
|
## In a bundle
|
|
265
299
|
|
|
266
300
|
A [bundle](cli.md#the-config-module) gets React and React Email's renderer from the serve runtime, as it gets `@protobase/server` and `@protobase/server/email`, so an email's component and the renderer share one React and hooks such as `useContext` work. React Email's other components are inlined, though `@protobase/server` uses them too: it loads them only to send its own mail, so the runtime does not supply them. Its `<Tailwind>` component needs `tailwindcss`, which the runtime does not supply, so a served config cannot use it: style with `style` props instead.
|