@protobase/cli 0.121.2 → 0.121.4

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.121.2";
2
+ var version = "0.121.4";
3
3
  //#endregion
4
4
  export { version };
@@ -1,4 +1,5 @@
1
1
  import { projectDerived, projectFiles, projectFunctions, projectJobs, projectNotifications, projectOptions, projectResources, projectWebhooks, projectWorkflows } from "./project-parts.js";
2
+ import { mailFeedbackOn } from "./mail-feedback-config.js";
2
3
  import { projectUnsubscribe } from "./unsubscribe-config.js";
3
4
  import { userTablesOn } from "./user-tables-config.js";
4
5
  import { buildAppAuth, buildAuthenticator, checkCallsOptions, checkStatusOptions, isOverSignIn, workflowPlugins } from "@protobase/server/internal";
@@ -91,6 +92,7 @@ const buildProject = async (config, database) => {
91
92
  ...config.status && { status: checkStatusOptions(config.status) },
92
93
  ...config.calls && { calls: checkCallsOptions(config.calls) },
93
94
  ...unsubscribe && { unsubscribe },
95
+ ...mailFeedbackOn(config) && { mailFeedback: true },
94
96
  ...mailer && { mailer },
95
97
  ...config.mobile && { mobile: config.mobile },
96
98
  ...config.secret && { secret: config.secret },
@@ -0,0 +1,9 @@
1
+ //#region src/config/mail-feedback-config.ts
2
+ /** Whether the app takes its mail's bounces and complaints: the one reading of `mailFeedback`, which takes only true or false. */
3
+ const mailFeedbackOn = (config) => {
4
+ const value = config.mailFeedback;
5
+ if (value !== void 0 && typeof value !== "boolean") throw new Error(`mailFeedback is ${JSON.stringify(value)}; it takes true or false`);
6
+ return value === true;
7
+ };
8
+ //#endregion
9
+ export { mailFeedbackOn };
@@ -2,7 +2,7 @@ import { builtInResources, configExports, webhooksModule, workflowsModule } from
2
2
  //#region src/doctor/built-in-models.ts
3
3
  /**
4
4
  * The resources and views Protobase adds to an app by what its config enables, as the API serves them: the webhook ones
5
- * of `webhooks` and the workflow ones of `workflows`, then Failed jobs, Activity and Comments by what the app's resources use, and Unsubscribes with `unsubscribe`. Doctor checks them as it checks
5
+ * of `webhooks` and the workflow ones of `workflows`, then Failed jobs, Activity and Comments by what the app's resources use, Unsubscribes with `unsubscribe` and Mail feedback with `mailFeedback`. Doctor checks them as it checks
6
6
  * the app's own.
7
7
  */
8
8
  const builtInModels = (config, models) => {
@@ -18,6 +18,7 @@ const builtInModels = (config, models) => {
18
18
  jobs: Object.keys(config.jobs).length > 0,
19
19
  notifications: config.notifications !== void 0,
20
20
  unsubscribe: config.unsubscribe === true,
21
+ mailFeedback: config.mailFeedback === true,
21
22
  ...config.events && { events: config.events }
22
23
  });
23
24
  return {
@@ -1,5 +1,6 @@
1
1
  import { loadNearestEnvFile } from "../dev/env.js";
2
2
  import { projectJobs, projectNotifications, projectResources, projectWebhooks } from "../config/project-parts.js";
3
+ import { mailFeedbackOn } from "../config/mail-feedback-config.js";
3
4
  import { unsubscribeOn } from "../config/unsubscribe-config.js";
4
5
  import { userTablesOn } from "../config/user-tables-config.js";
5
6
  import { projectAuth } from "../config/build-project.js";
@@ -49,6 +50,7 @@ const migrationProject = async (config, url) => {
49
50
  jobs,
50
51
  userTables: userTablesOn(config),
51
52
  unsubscribe: unsubscribeOn(config),
53
+ mailFeedback: mailFeedbackOn(config),
52
54
  readOnlyQueries: assistantSettings(config.assistant, process.env)?.kind === "built-in",
53
55
  authTables: auth ? authStoreTables(auth) : {
54
56
  tables: [],
@@ -1,25 +1,32 @@
1
1
  import { authMigrationTitle } from "../auth/migration-file.js";
2
- import { authSchemaMigration, callsMigration, capturedBy, changesMigration, channelSendsMigration, commentsMigration, computedMigration, derivedMigration, jobsSchemaMigration, notificationsMigration, ownedDefinitionsMigration, queryRunnerMigration, realtimeRelayMigration, relayMigration, relayed, sqlSends, statusMigration, unsubscribesMigration, userTablesMigration, webhooksMigration, workflowsMigration } from "@protobase/server";
2
+ import { authSchemaMigration, callsMigration, capturedBy, changesMigration, channelSendsMigration, commentsMigration, computedMigration, derivedMigration, jobsSchemaMigration, mailFeedbackMigration, mailFeedbackResource, notificationsMigration, ownedDefinitionsMigration, queryRunnerMigration, realtimeRelayMigration, relayMigration, relayed, sqlSends, statusMigration, unsubscribesMigration, userTablesMigration, webhooksMigration, workflowsMigration } from "@protobase/server";
3
3
  //#region src/migration/parts.ts
4
4
  /** Every feature the project's config enables, in the order their files are written. */
5
5
  const migrationParts = (project) => {
6
6
  const comments = project.models.some((model) => model.comments);
7
7
  const aiFields = project.models.some((model) => Object.values(model.fields).some((field) => field.ai));
8
+ const feedback = project.mailFeedback ? [mailFeedbackResource.toModel()] : [];
9
+ const captured = [...project.models, ...feedback];
8
10
  return [
9
11
  ...project.auth ? [{
10
12
  name: "auth",
11
13
  title: authMigrationTitle,
12
14
  sql: () => authSchemaMigration(project.auth)
13
15
  }] : [],
14
- ...project.jobs.length > 0 || project.models.some(capturedBy(project.models)) || comments || aiFields || project.webhooks || project.workflows || project.notifications || project.realtime?.relay ? [{
16
+ ...project.jobs.length > 0 || captured.some(capturedBy(captured)) || comments || aiFields || project.webhooks || project.workflows || project.notifications || project.realtime?.relay ? [{
15
17
  name: "jobs",
16
18
  title: "The jobs schema this version of Protobase needs",
17
19
  sql: () => jobsSchemaMigration(project.db)
18
20
  }] : [],
21
+ ...project.mailFeedback ? [{
22
+ name: "mail_feedback",
23
+ title: "The table of the bounces and complaints of the mail the app sends",
24
+ sql: () => mailFeedbackMigration(project.db)
25
+ }] : [],
19
26
  {
20
27
  name: "changes",
21
28
  title: "The change capture the resources' events and history need",
22
- sql: () => changesMigration(project.db, project.models, project.events)
29
+ sql: () => changesMigration(project.db, captured, project.events, feedback.map((model) => model.name))
23
30
  },
24
31
  {
25
32
  name: "computed",
@@ -39,6 +39,7 @@ const projectAdmin = (project, db, ui, reporter, upgradeWebSocket, userTables) =
39
39
  ...project.notifications && { notifications: project.notifications },
40
40
  ...project.status && { status: project.status },
41
41
  ...project.unsubscribe && { unsubscribe: project.unsubscribe },
42
+ ...project.mailFeedback && { mailFeedback: true },
42
43
  ...project.calls && { calls: project.calls },
43
44
  ...project.mobile && { mobile: project.mobile },
44
45
  ...project.app && { app: project.app },
@@ -1,4 +1,4 @@
1
- import { assistantSettings, authStoreTables, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelaySchema, checkResourcesOutsideAuthStore, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkWebhooksSchema, checkWorkflowsSchema, configExports, relayed, sqlSends } from "@protobase/server";
1
+ import { assistantSettings, authStoreTables, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkMailFeedbackSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelaySchema, checkResourcesOutsideAuthStore, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkWebhooksSchema, checkWorkflowsSchema, configExports, mailFeedbackResource, relayed, sqlSends } from "@protobase/server";
2
2
  //#region src/serve/startup-checks.ts
3
3
  /**
4
4
  * The server's startup checks of the database: each throws, with what to write as a migration, while a schema the
@@ -7,9 +7,11 @@ import { assistantSettings, authStoreTables, checkAuthSchema, checkCalls, checkC
7
7
  */
8
8
  const checkStartup = async (project, db) => {
9
9
  const models = configExports(project.config).resources.map((resource) => resource.toModel());
10
+ const captured = project.mailFeedback ? [...models, mailFeedbackResource.toModel()] : models;
10
11
  if (project.auth) await checkAuthSchema(project.auth);
11
12
  if (project.auth) await checkResourcesOutsideAuthStore(db, models, project.auth);
12
- await checkChanges(db, models, project.events);
13
+ if (project.mailFeedback) await checkMailFeedbackSchema(db);
14
+ await checkChanges(db, captured, project.events);
13
15
  await checkComments(db, models);
14
16
  await checkDerived(db, models);
15
17
  await checkCalls(db, project.calls, project.events);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.121.2",
3
+ "version": "0.121.4",
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.121.2",
47
- "@protobase/layout": "0.121.2",
48
- "@protobase/query": "0.121.2",
49
- "@protobase/schema": "0.121.2",
50
- "@protobase/server": "0.121.2",
51
- "@protobase/ui": "0.121.2",
52
- "@protobase/workflows": "0.121.2",
46
+ "@protobase/config": "0.121.4",
47
+ "@protobase/layout": "0.121.4",
48
+ "@protobase/query": "0.121.4",
49
+ "@protobase/schema": "0.121.4",
50
+ "@protobase/server": "0.121.4",
51
+ "@protobase/ui": "0.121.4",
52
+ "@protobase/workflows": "0.121.4",
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",
@@ -11,6 +11,7 @@ Mail the app sends, the PDF documents it makes, and forms for people without an
11
11
  - [Protobase's mail look](../reference/email.md#the-look-of-protobases-own-mail): Your emails use a layout, button, code and note with the look of Protobase's own mail.
12
12
  - [Header fields](../reference/email.md#templates): Your emails carry header fields of their own.
13
13
  - [One-click unsubscribe](../reference/email.md#unsubscribe) (beta): Mail you mark as bulk carries a one-click unsubscribe, and Protobase stops sending that kind of mail to whoever used it.
14
+ - [Bounces and complaints](../reference/email.md#bounces-and-complaints) (beta): Bounces and spam complaints that Amazon SES or Resend report arrive as Mail feedback records with `bounced` and `complained` events, so a workflow, webhook or your own code can act on them.
14
15
  - [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.
15
16
  - [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.
16
17
  - [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.
@@ -634,7 +634,7 @@ Applies the project's `db/migrations/*.sql` that the database has not applied ye
634
634
  protobase migration [--dir db/migrations] [--extend <dir>]
635
635
  ```
636
636
 
637
- Writes what the database still needs for every feature the config enables, as the project's next migrations in `--dir`, one file per feature: the auth schema when sign-in is on (`NNN_auth.sql`, as [`auth migration`](#auth-migration) writes it), the [jobs schema](jobs.md#the-jobs-schema) when the config has jobs, `webhooks`, `workflows` or `notifications`, or a resource has events, history, comments or an [AI field](ai.md) (`NNN_jobs.sql`), the [capture of events](events.md#migrations-and-startup) and the [history table](history.md#the-table) (`NNN_changes.sql`), the columns of [rollup and formula fields](data-config.md#rollups-and-formulas), the triggers that keep the rollups, and the tables, indexes and refresh functions of [time rollups](data-config.md#time-rollups) (`NNN_computed.sql`), the role the [assistant's read-only queries](assistant.md#the-built-in-backend) run as, when it finds the built-in assistant's key (`NNN_query.sql`), the [comments table](comments.md#the-table) (`NNN_comments.sql`), the [webhook subscriptions](webhooks.md#subscriptions-in-the-admin-app) of `webhooks` (`NNN_webhooks.sql`), the [workflows, versions, runs and steps](workflows.md#turning-them-on) of `workflows` (`NNN_workflows.sql`), the [devices and history tables](notifications.md#table-names) of `notifications` (`NNN_notifications.sql`), the table of who unsubscribed from bulk mail of [`unsubscribe`](email.md#unsubscribe) (`NNN_unsubscribes.sql`), the `realtime_relay` schema of [`realtime: { processes: 'many' }`](supabase-realtime.md#several-processes) (`NNN_realtime_relay.sql`), the `channels` schema of [`realtime: { sqlSends: true }`](channels.md#from-sql) (`NNN_channel_sends.sql`), the trigger of [`realtime.relay`](realtime-relay.md#sessions) that ends a deleted session's sockets (`NNN_relay.sql`), and, with [`userTables`](user-tables.md#the-switch), the schemas of user tables (`NNN_user_tables.sql`) and the delete of the definitions of tables that resources in code [own now](user-tables.md#taking-a-table-over-as-code) (`NNN_owned_definitions.sql`). It compares the database, with the project's migrations applied, with the config (for the auth schema, it reads the store's record of the migrations it applied), merged with those of `--extend` as `dev` merges them, and writes nothing when the database is current. Apply the files with the project's other migrations. It reads the `.env` nearest the current directory and needs `DATABASE_URL`.
637
+ Writes what the database still needs for every feature the config enables, as the project's next migrations in `--dir`, one file per feature: the auth schema when sign-in is on (`NNN_auth.sql`, as [`auth migration`](#auth-migration) writes it), the [jobs schema](jobs.md#the-jobs-schema) when the config has jobs, `webhooks`, `workflows`, `notifications` or `mailFeedback`, or a resource has events, history, comments or an [AI field](ai.md) (`NNN_jobs.sql`), the table of the bounces and complaints of [`mailFeedback`](email.md#bounces-and-complaints) (`NNN_mail_feedback.sql`), the [capture of events](events.md#migrations-and-startup) and the [history table](history.md#the-table) (`NNN_changes.sql`), the columns of [rollup and formula fields](data-config.md#rollups-and-formulas), the triggers that keep the rollups, and the tables, indexes and refresh functions of [time rollups](data-config.md#time-rollups) (`NNN_computed.sql`), the role the [assistant's read-only queries](assistant.md#the-built-in-backend) run as, when it finds the built-in assistant's key (`NNN_query.sql`), the [comments table](comments.md#the-table) (`NNN_comments.sql`), the [webhook subscriptions](webhooks.md#subscriptions-in-the-admin-app) of `webhooks` (`NNN_webhooks.sql`), the [workflows, versions, runs and steps](workflows.md#turning-them-on) of `workflows` (`NNN_workflows.sql`), the [devices and history tables](notifications.md#table-names) of `notifications` (`NNN_notifications.sql`), the table of who unsubscribed from bulk mail of [`unsubscribe`](email.md#unsubscribe) (`NNN_unsubscribes.sql`), the `realtime_relay` schema of [`realtime: { processes: 'many' }`](supabase-realtime.md#several-processes) (`NNN_realtime_relay.sql`), the `channels` schema of [`realtime: { sqlSends: true }`](channels.md#from-sql) (`NNN_channel_sends.sql`), the trigger of [`realtime.relay`](realtime-relay.md#sessions) that ends a deleted session's sockets (`NNN_relay.sql`), and, with [`userTables`](user-tables.md#the-switch), the schemas of user tables (`NNN_user_tables.sql`) and the delete of the definitions of tables that resources in code [own now](user-tables.md#taking-a-table-over-as-code) (`NNN_owned_definitions.sql`). It compares the database, with the project's migrations applied, with the config (for the auth schema, it reads the store's record of the migrations it applied), merged with those of `--extend` as `dev` merges them, and writes nothing when the database is current. Apply the files with the project's other migrations. It reads the `.env` nearest the current directory and needs `DATABASE_URL`.
638
638
 
639
639
  ```sh
640
640
  bun run db:migrate # the database at the project's current schema
@@ -38,7 +38,7 @@ export const ticketsView = view<typeof tickets>('tickets')
38
38
 
39
39
  ## Formatting
40
40
 
41
- A comment is stored as written and shown with a chat's markdown: `**bold**`, `_italic_`, `~~strikethrough~~`, `` `code` ``, code blocks between ```` ``` ```` lines, `-` and `1.` lists and `> ` quotes, with each line break kept. Web addresses, `www.` ones included, and `[text](address)` links open in a new tab; a link whose text names another web address than the one it opens shows the address it opens. A mention is picked out inside formatted text too, but not inside code.
41
+ A comment is stored as written and shown with a chat's markdown: `**bold**`, `_italic_`, `~~strikethrough~~`, `` `code` ``, code blocks between ```` ``` ```` lines, `-` and `1.` lists and `> ` quotes, with each line break kept. Web addresses, `www.` ones included, and `[text](address)` links open in a new tab; a link whose text names another web address than the one it opens shows the address it opens. A mention is picked out inside formatted text too, but not inside code. The formatting loads with the first comment shown; until it has loaded, or when it does not load, such as offline or in a tab left open across an update, a comment shows as written with its mentions picked out, and the next comment drawn tries again.
42
42
 
43
43
  It follows chat habits where markdown would surprise: a line under a quote or a list item is no part of it, a quote needs the space after `>` (`>5 failed logins` stays as typed), bold comes only from `**` (`__init__` stays as typed), and only fences make code blocks, not indented lines. What a message rarely means stays as typed too: `#` headings, `---` rules, tables, images and link definitions. Raw HTML shows as text, and a link goes only to an `http(s)`, `mailto` or `tel` address or a relative one, so a `javascript:` link shows as its text; the result is sanitised again before it reaches the page.
44
44
 
@@ -386,3 +386,14 @@ Gives bulk mail a one-click unsubscribe: mail a job sends with `bulk: true` and
386
386
  ```ts
387
387
  export default defineConfig({ unsubscribe: true })
388
388
  ```
389
+
390
+ ## mailFeedback
391
+
392
+ - **Type:** `boolean`
393
+ - **Default:** `false`
394
+
395
+ Takes the bounces and spam complaints of the mail the app sends as `mail_feedback` records, with the events `mail_feedback.bounced` and `mail_feedback.complained`, at `POST /api/mail/feedback/<provider>` for each provider whose variable is set. The table, `mail.feedback`, and the capture of its events are written by `protobase migration` as migrations of the project's own: apply them with the project's migrations, as `protobase serve` refuses to start while the table is missing. See [Bounces and complaints](../email.md#bounces-and-complaints).
396
+
397
+ ```ts
398
+ export default defineConfig({ mailFeedback: true })
399
+ ```
@@ -30,7 +30,7 @@ Each key is described with its type and default in the option pages:
30
30
  | [Sign-in options](config/sign-in.md) | `auth`, `authenticate`, `signingKeyDays`, `signingKeyGraceDays` |
31
31
  | [API options](config/api.md) | `apiPath`, `apiKeys`, `cors`, `defaultAccess`, `rowPermissions`, `statementTimeoutMs`, `scanGuard`, `errorReporting`, `writeHooks`, `mcpEndpoint`, `remoteResources`, `runtimeUpdates`, `realtime`, `calls`, `userTables` |
32
32
  | [Admin app options](config/admin-app.md) | `assistant`, `maps`, `plugins` |
33
- | [Jobs and events options](config/jobs-and-events.md) | `jobs`, `events`, `history`, `webhooks`, `workflows`, `notifications`, `status`, `unsubscribe` |
33
+ | [Jobs and events options](config/jobs-and-events.md) | `jobs`, `events`, `history`, `webhooks`, `workflows`, `notifications`, `status`, `unsubscribe`, `mailFeedback` |
34
34
  | [Files options](config/files.md) | `files` |
35
35
 
36
36
  ## Config types
@@ -310,6 +310,37 @@ await mail.send({ to: member.email, subject: 'News', text: '...', bulk: true, to
310
310
  - <gap>Bulk mail cannot be sent from an API function because only a job's `mail` adds the unsubscribe; enqueue a job instead.</gap>
311
311
  - <gap>Email templates cannot be marked bulk because `defineTemplate` does not take `bulk` and `topic` yet.</gap>
312
312
 
313
+ ## Bounces and complaints
314
+
315
+ :::caution[Beta]
316
+ Amazon SES (through SNS) and Resend report to their own endpoints so far, beside the `protobase` one a platform reports to.
317
+ :::
318
+
319
+ A mail provider tells the app when a message bounced or its recipient marked it as spam. With `mailFeedback` on, each report becomes a `mail_feedback` record, one per recipient, with the events `mail_feedback.bounced` and `mail_feedback.complained`, which [workflows](workflows.md), [subscriptions](webhooks.md) and your own code act on, such as marking a contact's address undeliverable. Protobase records and notifies only: it keeps sending to the address, and the app decides what a bounce means.
320
+
321
+ Turn it on in the config, then run `protobase migration`, which writes its table, `mail.feedback`, and the capture of its events as migrations of the project's own; apply them with the project's migrations, as `protobase serve` refuses to start while the table is missing:
322
+
323
+ ```ts
324
+ export default defineConfig({ mailFeedback: true })
325
+ ```
326
+
327
+ Each provider reports to `POST /api/mail/feedback/<provider>` with the default [`apiPath`](config/api.md#apipath), without sign-in, and has that endpoint only once its variable is set:
328
+
329
+ | Provider | Variable | |
330
+ | --- | --- | --- |
331
+ | `ses` | `PROTOBASE_MAIL_FEEDBACK_SES_TOPICS` | The ARNs of the SNS topics SES publishes bounces and complaints to, separated by commas. Subscribe the endpoint to each topic over HTTPS: the endpoint confirms the subscription itself. |
332
+ | `resend` | `PROTOBASE_MAIL_FEEDBACK_RESEND_SECRET` | The webhook's signing secret, `whsec_...`, of a webhook that sends `email.bounced` and `email.complained` to the endpoint. |
333
+ | `protobase` | `PROTOBASE_SECRET` | The platform secret, which a hosting platform reports bounces and complaints with. |
334
+
335
+ A value that is not a topic ARN or a signing secret stops startup, naming the variable.
336
+
337
+ - **Signatures:** a report writes nothing unless its signature checks out. `ses` takes SNS's signature, versions 1 and 2, with the signing certificate fetched from an SNS host over HTTPS and kept an hour, and only messages of the named topics, since anyone can sign with a topic of their own. `resend` and `protobase` take [Standard Webhooks](https://www.standardwebhooks.com) signatures, made at most five minutes before. A missing or wrong signature answers `401`, another topic `403`.
338
+ - **The record:** `type` is `bounce` or `complaint`; `bounce_type` `hard` (permanent) or `soft` (transient), and empty when the provider could not tell; `recipient`, lower-cased; `message_id`, the `Message-ID` header of the message it is about, when the report states it; `provider_message_id`, the provider's own id of that message; `reason`, as the provider gives it, such as the receiving server's diagnostic, a bounce subtype or a complaint's feedback type; `occurred_at`, when the provider says it happened; `provider`, `event_id`, the provider's id of the report, and `created_at`. A value the report does not state is empty, never guessed. Match it to the mail it answers by the [message id](#message-id) you stored.
339
+ - **Once:** a provider sends a report again when it got no answer in time; the same report writes nothing new. A report of another kind, such as a delivery, answers `204` and writes nothing.
340
+ - **Who sees it:** admins see the reports under **Mail feedback** in the admin app, and the app's code reads them as the `mail_feedback` resource, `GET /api/v1/mail_feedback?filter=recipient = "ada@example.com"`, filtered by `recipient`, `type`, `message_id` or `provider_message_id`. Nobody changes them but the endpoints.
341
+ - **The `protobase` endpoint:** its body is one record as above, without `provider`, `event_id` and `created_at`, such as `{ "type": "bounce", "bounce_type": "hard", "recipient": "ada@example.com", "message_id": "<...>", "reason": "smtp; 550 5.1.1 user unknown" }`, signed as Standard Webhooks with a key derived from `PROTOBASE_SECRET`, so the secret itself never travels: `mailFeedbackHeaders(secret, id, body)` of `@protobase/server` makes the headers. `webhook-id` names the report, and a retry keeps it.
342
+ - <gap>Other mail providers cannot report bounces and complaints because only the `ses`, `resend` and `protobase` endpoints are implemented.</gap>
343
+
313
344
  ## Attachments
314
345
 
315
346
  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:
@@ -366,6 +397,7 @@ export default defineFunction(async (request, { personalMail }) => {
366
397
  - **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.
367
398
  - <gap>The account page cannot show which account a mailbox is linked through or disconnect it because unlinking a mailbox is not implemented.</gap>
368
399
  - <gap>Mailboxes other than Gmail cannot be linked because no other mail provider is implemented.</gap>
400
+ - **Bounces:** mail sent from someone's own mailbox bounces back to the sender, not to the app. It reaches none of the [mail feedback](#bounces-and-complaints) endpoints, so it makes no `mail_feedback` records and no `bounced` or `complained` events. Handling its bounces is the sender's own concern.
369
401
  - <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>
370
402
 
371
403
  ### From addresses
@@ -107,7 +107,7 @@ Field hints:
107
107
  | `.confirm(question)` | Asks `question` before a person changes the value in a form or a list cell, and Cancel keeps it. See [Confirming a change](#confirming-a-change). |
108
108
  | `.format(format)` | `badge` shows statuses as coloured badges, `code` sets identifiers in monospace, as the list's identifier column too, `percent` adds a % sign, and `signed` shows a whole number in a list with its sign, green above zero and red below, such as a stock change of `+12` or `−3`; it needs an integer field. On a text field, `email`, `phone` and `url` show the value as a link that writes to it (`mailto:`), calls it (`tel:`, its digits and a leading +) or opens it in a new tab (only an `http` or `https` address; anything else stays text), and `.format('url', { text })` gives the link [its own text](#json-fields-and-link-text), on the record page, in its sidebar and in the list's cells but the title's, which links to the record; forms edit it in an email, phone or web address input, which brings up the keyboard for it on a mobile screen and offers the browser's autofill. Another field type with one of them stops the server at startup. `relative` on a timestamp shows it as "5 minutes ago" or "in 2 hours" in lists and on the record page, with the exact time on hover; `absolute` and `compact` are accepted and carried in `/meta` for apps that render their own lists. <gap>The admin does not use the `absolute` and `compact` formats yet.</gap> |
109
109
  | `.multiline()` | A text of several lines, such as a description: forms edit it in a box that grows with the text, so the page scrolls rather than the box, and the record page's sections, a page's field blocks and a card's subtitle keep its line breaks (a card shows the first three lines); the record's sidebar shows it on one line. On the record page and the create form it takes the whole width of its section. Only a text field takes it; the list's table shows the text on one line. |
110
- | `.markdown()` | Markdown, such as a task's notes: forms edit its source in a box that grows with it, with a Write and Preview switch above it, and store it exactly as typed. The record page's sections, a page's field blocks and a conversation's messages show it rendered as GitHub does, line breaks kept, a heading in a section one level under the section's title and no larger than the text, so `#` and `##` show as h3, `###` as h4 and so on to h6, one level lower in a section inside a group (<gap>A value whose first heading is `###` cannot start at h3 because numbering from the value's own top heading is not implemented.</gap>); raw HTML shows as text, links and images keep only http(s), mailto, tel and relative addresses, and links open in a new tab. A card's subtitle shows its first three lines rendered, its links as text; the list's table, the record's sidebar and a card's other lines show its text on one line without the marks. On the record page and the create form it takes the whole width of its section. Only a text field takes it, and the renderer loads with the first markdown shown. |
110
+ | `.markdown()` | Markdown, such as a task's notes: forms edit its source in a box that grows with it, with a Write and Preview switch above it, and store it exactly as typed. The record page's sections, a page's field blocks and a conversation's messages show it rendered as GitHub does, line breaks kept, a heading in a section one level under the section's title and no larger than the text, so `#` and `##` show as h3, `###` as h4 and so on to h6, one level lower in a section inside a group (<gap>A value whose first heading is `###` cannot start at h3 because numbering from the value's own top heading is not implemented.</gap>); raw HTML shows as text, links and images keep only http(s), mailto, tel and relative addresses, and links open in a new tab. A card's subtitle shows its first three lines rendered, its links as text; the list's table, the record's sidebar and a card's other lines show its text on one line without the marks. On the record page and the create form it takes the whole width of its section. Only a text field takes it, and the renderer loads with the first markdown shown. <gap>A markdown field cannot show its source when its renderer does not load because a fallback for a failed load is not implemented, so the nearest error message shows instead.</gap> |
111
111
  | `.prefix(text)`, `.suffix(text)`, `.decimals(n)` | Text around a number and its decimals: `€` and `2` show `€1,234.50`, `.suffix(' m²')` shows `120 m²`. They show wherever the number does: records, cards, table cells, forms and the range filter. A prefix is plain text, so a list does not show `€` as money; `.currency()` does. |
112
112
  | `.currency(code)` | The currency a decimal is an amount of, as an ISO 4217 code such as `EUR`: the list shows it as money in that currency, in its table and its range filter. See [Value tones and currencies](#value-tones-and-currencies). |
113
113
  | `.icon(name)` | An icon before the value on a card's meta row: one of the names [actions](layouts.md#named-actions) take, such as `bed`, `calendar` or `cpu`, and above the value in a section of [key facts](#key-facts). Nowhere else shows it. |