@protobase/cli 0.121.3 → 0.121.5
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/package.json +8 -8
- package/skills/protobase/references/features/workflows.md +1 -0
- package/skills/protobase/references/reference/comments.md +1 -1
- package/skills/protobase/references/reference/email.md +1 -0
- package/skills/protobase/references/reference/ui-config.md +1 -1
- package/skills/protobase/references/reference/workflows.md +69 -2
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.121.
|
|
3
|
+
"version": "0.121.5",
|
|
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.
|
|
47
|
-
"@protobase/layout": "0.121.
|
|
48
|
-
"@protobase/query": "0.121.
|
|
49
|
-
"@protobase/schema": "0.121.
|
|
50
|
-
"@protobase/server": "0.121.
|
|
51
|
-
"@protobase/ui": "0.121.
|
|
52
|
-
"@protobase/workflows": "0.121.
|
|
46
|
+
"@protobase/config": "0.121.5",
|
|
47
|
+
"@protobase/layout": "0.121.5",
|
|
48
|
+
"@protobase/query": "0.121.5",
|
|
49
|
+
"@protobase/schema": "0.121.5",
|
|
50
|
+
"@protobase/server": "0.121.5",
|
|
51
|
+
"@protobase/ui": "0.121.5",
|
|
52
|
+
"@protobase/workflows": "0.121.5",
|
|
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",
|
|
@@ -23,6 +23,7 @@ Graphs of steps the server runs along their edges, written in a language a model
|
|
|
23
23
|
- [Records steps](../reference/workflows.md#apprecords) (beta): Create, update, get and list records as the workflow's last editor, with the roles they hold now.
|
|
24
24
|
- [Mail step](../reference/workflows.md#appmailsend) (beta): Sends mail, with files the run downloaded attached, from the app's own sender.
|
|
25
25
|
- [Send email step](../reference/workflows.md#appmailtemplate) (beta): Sends one of the app's email templates in a language of its own, with a pin for each field of the template's data, checked before it is sent.
|
|
26
|
+
- [Email series](../reference/workflows.md#email-series) (beta): Mail steps that share a series' name, with waits between them, send each person a timed series, such as after sign-up; the series is a mail category of its own with one-click unsubscribe in every mail, and an unsubscribe stops the rest of the series for that person.
|
|
26
27
|
- [Storing files](../reference/workflows.md#storing-files) (beta): The HTTP request step streams an answer of any size into a named storage configuration, an S3-compatible bucket, a file share or a local directory, past its 10 MiB read limit; later steps pass the stored file on or read it back, up to 10 MiB. Changing where a configuration points leaves the workflows that use it unchanged.
|
|
27
28
|
- [Runs and their traces](../reference/workflows.md#traces) (beta): Each run started by hand through the API, from the app's code or by a trigger keeps every step's input, output, logs, timing, tries and error as a JSONL trace in the app's private file storage, whole by the time the run is marked ended, secrets blanked out; every run, only failing ones, or none, set by the app, the workflow or the run.
|
|
28
29
|
- [Run debugger](../reference/workflows.md#following-and-debugging-a-run) (beta): Each workflow lists its runs with their status, who started them, when and for how long; a run chosen there marks every step's status on the graph of the version it ran on from its trace, and a run's own address shows it on the latest version, with the way to the one it ran on, live while it runs, with each step's input, output, logs, timing, tries and error, secrets blanked out.
|
|
@@ -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
|
|
|
@@ -305,6 +305,7 @@ await mail.send({ to: member.email, subject: 'News', text: '...', bulk: true, to
|
|
|
305
305
|
- **The click:** the mail client's `POST` with `List-Unsubscribe=One-Click` records the opt-out and answers `200`; doing it again changes nothing. Opening the link in a browser shows a page with an **Unsubscribe** button that sends that `POST`, so a scanner that follows links in mail unsubscribes no one. A link the app did not sign answers `400` and records nothing.
|
|
306
306
|
- **Skipped sends:** whoever unsubscribed from the topic is left out, found in one query, and the send resolves to them as `skipped` beside `sent`, each recipient it went to with its message id: `{ skipped: ['bob@example.com'], sent: [{ to: 'ada@example.com', messageId: '<…>' }], messageId: '<…>' }`, with `messageId` only when it went to exactly one. Other topics still reach them. Who unsubscribed is read once, before the first message goes out; one who unsubscribes while a send to several is going out is skipped from the next send on.
|
|
307
307
|
- **A refused message:** when the server refuses one recipient's message, the send rejects with a `BulkMailError` (exported by `@protobase/server`, its `code` `BULK_MAIL_FAILED`) after the messages before it went out. It fails the try, which is retried, and names the recipient it failed on as `to`, those it went to as `sent`, those skipped as `skipped`, and the server's error as `cause`. A retried try sends to everyone again, so catch it, record `error.sent`, rethrow, and leave those addresses out of the next try; or send to one recipient per call.
|
|
308
|
+
- **From a workflow:** a workflow's mail steps send bulk mail as an [email series](workflows.md#email-series), whose name is the topic.
|
|
308
309
|
- **Who unsubscribed:** admins see each recipient, topic and time under **Unsubscribes** in the admin app, and the app's code reads them as the `mail_unsubscribes` resource, `GET /api/v1/mail_unsubscribes?filter=topic = "newsletter"`. Nobody changes them but the link.
|
|
309
310
|
- **Refused:** `bulk` without a `topic` is refused, as the email is defined or the message sent. Bulk mail without `unsubscribe: true`, or sent another way than a job's `mail`, such as through `PROTOBASE_SMTP_URL` directly or from someone's own mailbox, is refused before anything is sent. A mailer of the project's own (`auth/mailer.ts`) that is handed bulk mail directly, outside a job's `mail`, gets it without its unsubscribe: send it through the job's `mail` instead.
|
|
310
311
|
- <gap>Bulk mail cannot be sent from an API function because only a job's `mail` adds the unsubscribe; enqueue a job instead.</gap>
|
|
@@ -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. |
|
|
@@ -475,8 +475,9 @@ A get and a list only read; a create and an update are recorded. They go through
|
|
|
475
475
|
| `subject` | One line of text. |
|
|
476
476
|
| `text`, `html` | The body as text, and optionally as HTML. |
|
|
477
477
|
| `attachments` | A list of file values the run keeps, at most 10 MiB together. |
|
|
478
|
+
| `series` | Optional: the [email series](#email-series) the mail belongs to, such as `welcome`. |
|
|
478
479
|
|
|
479
|
-
The mail goes from the app's own sender with the app's mailer; a workflow cannot set the sender. The result is `{ message_id }`, the Message-ID the step sets, the same for each try of the step. Without mail the step fails.
|
|
480
|
+
The mail goes from the app's own sender with the app's mailer; a workflow cannot set the sender. The result is `{ message_id }`, the Message-ID the step sets, the same for each try of the step; with a `series`, `{ message_id, sent, skipped }`, as [Email series](#email-series) says. Without mail the step fails.
|
|
480
481
|
|
|
481
482
|
### app:mail.template
|
|
482
483
|
|
|
@@ -488,6 +489,7 @@ The mail goes from the app's own sender with the app's mailer; a workflow cannot
|
|
|
488
489
|
| `to` | One address. |
|
|
489
490
|
| `locale` | Optional: a BCP 47 language tag, such as `nl` or `en-GB`. The mail is in the template's language closest to it, so `nl-BE` picks `nl`. Without it, the mail is in the app's `locale` when the template has that language. Otherwise it is in English when the template has it, else in the template's first language. |
|
|
490
491
|
| `data` | The template's data, as its schema takes it. |
|
|
492
|
+
| `series` | Optional: the [email series](#email-series) the mail belongs to, such as `welcome`. |
|
|
491
493
|
|
|
492
494
|
```json
|
|
493
495
|
{
|
|
@@ -505,7 +507,72 @@ The mail goes from the app's own sender with the app's mailer; a workflow cannot
|
|
|
505
507
|
|
|
506
508
|
The editor draws one input pin for each field of the chosen template's data, and offers the template's languages for `locale`. A save checks each value read by name in `data` against the type of that field, as it checks a record's fields. `list_workflow_types` lists the app's template names in the step's `template` argument, and each template's languages and data schema under `templates`.
|
|
507
509
|
|
|
508
|
-
The mail goes from the app's own sender, as `app:mail.send`'s does. The result is `{ message_id, locale }`: the Message-ID the step sets, the same for each try of the step, and the language the mail was sent in. Data the template's schema refuses fails the step with `Mail.InvalidData`, its cause naming each path, such as `data.name: Invalid input`. A template the app does not have fails it with `Mail.UnknownTemplate`, and a `to` or `locale` of the wrong kind, such as a locale that is no language tag, with `Mail.InvalidArguments`. Without mail the step fails.
|
|
510
|
+
The mail goes from the app's own sender, as `app:mail.send`'s does. The result is `{ message_id, locale }`: the Message-ID the step sets, the same for each try of the step, and the language the mail was sent in; with a `series`, `sent` and `skipped` too, as [Email series](#email-series) says. Data the template's schema refuses fails the step with `Mail.InvalidData`, its cause naming each path, such as `data.name: Invalid input`. A template the app does not have fails it with `Mail.UnknownTemplate`, and a `to` or `locale` of the wrong kind, such as a locale that is no language tag, with `Mail.InvalidArguments`. Without mail the step fails.
|
|
511
|
+
|
|
512
|
+
### Email series
|
|
513
|
+
|
|
514
|
+
:::caution[Beta]
|
|
515
|
+
A run goes on to its end after an unsubscribe, sending nothing more in the series: a series has no step that ends the run by itself.
|
|
516
|
+
:::
|
|
517
|
+
|
|
518
|
+
An email series is mail a workflow sends over time, such as a welcome mail on sign-up, tips three days later and a check-in after two weeks. Give each mail step of the series the same `series`, a name such as `welcome`: a lowercase letter, then lowercase letters, digits, `_` and `-`, at most 63 characters. The `Wait` states between them set the timing. A trigger such as [`app:record`](#apprecord) starts one run per person, so each person has a series of their own.
|
|
519
|
+
|
|
520
|
+
The series is a mail category of its own, with nothing else to set up: each mail in it is bulk mail whose topic is the series' name, and carries its recipient's own [one-click unsubscribe](email.md#unsubscribe) from that series. It needs `unsubscribe: true` in the config; without it, the step fails before it sends anything.
|
|
521
|
+
|
|
522
|
+
- **After an unsubscribe:** every later mail step of the series sends that person nothing, so the rest of the series stops for them, in this run and any other. Their other series, and other people's runs of this one, go on. The step does not fail: its result is `{ sent: [], skipped: ['ada@example.com'] }`, and the run passes its remaining waits and ends as succeeded.
|
|
523
|
+
- **The result:** `sent` lists the addresses the mail went to and `skipped` those that unsubscribed from the series, with `message_id` when the mail went to anyone.
|
|
524
|
+
- **Other steps go on:** an unsubscribe stops the series' mail only. To stop the run's other steps too, follow a mail step with a `Choice` that ends the run when nobody got it, `{% $count($states.input.sent) = 0 %}`, with the mail step's result as its input.
|
|
525
|
+
- **Who unsubscribed:** they are listed under **Unsubscribes** in the admin app, with the series' name as the topic.
|
|
526
|
+
- <gap>A series cannot end its run when its recipient unsubscribes because a step that ends the run it is in is not implemented; the run's later mail steps send nothing instead.</gap>
|
|
527
|
+
|
|
528
|
+
A sign-up series, started for each new record of the app's `members` resource:
|
|
529
|
+
|
|
530
|
+
```json
|
|
531
|
+
{
|
|
532
|
+
"trigger": { "app:record": { "resource": "members" } },
|
|
533
|
+
"stateMachine": {
|
|
534
|
+
"QueryLanguage": "JSONata",
|
|
535
|
+
"StartAt": "Welcome",
|
|
536
|
+
"States": {
|
|
537
|
+
"Welcome": {
|
|
538
|
+
"Type": "Task",
|
|
539
|
+
"Resource": "app:mail.send",
|
|
540
|
+
"Arguments": {
|
|
541
|
+
"to": "{% $states.context.Execution.Input.record.email %}",
|
|
542
|
+
"subject": "{% 'Welcome, ' & $states.context.Execution.Input.record.name %}",
|
|
543
|
+
"text": "Thanks for signing up. Here is how to get started.",
|
|
544
|
+
"series": "welcome"
|
|
545
|
+
},
|
|
546
|
+
"Next": "Three days"
|
|
547
|
+
},
|
|
548
|
+
"Three days": { "Type": "Wait", "Seconds": 259200, "Next": "Tips" },
|
|
549
|
+
"Tips": {
|
|
550
|
+
"Type": "Task",
|
|
551
|
+
"Resource": "app:mail.send",
|
|
552
|
+
"Arguments": {
|
|
553
|
+
"to": "{% $states.context.Execution.Input.record.email %}",
|
|
554
|
+
"subject": "Three tips for your first week",
|
|
555
|
+
"text": "Here are three things most people set up first.",
|
|
556
|
+
"series": "welcome"
|
|
557
|
+
},
|
|
558
|
+
"Next": "Two weeks"
|
|
559
|
+
},
|
|
560
|
+
"Two weeks": { "Type": "Wait", "Seconds": 950400, "Next": "Check-in" },
|
|
561
|
+
"Check-in": {
|
|
562
|
+
"Type": "Task",
|
|
563
|
+
"Resource": "app:mail.send",
|
|
564
|
+
"Arguments": {
|
|
565
|
+
"to": "{% $states.context.Execution.Input.record.email %}",
|
|
566
|
+
"subject": "How is it going?",
|
|
567
|
+
"text": "You signed up two weeks ago. Reply to this mail and tell us how it is going.",
|
|
568
|
+
"series": "welcome"
|
|
569
|
+
},
|
|
570
|
+
"End": true
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
```
|
|
509
576
|
|
|
510
577
|
### app:piece
|
|
511
578
|
|