@softr/sdk 0.0.97-alpha.1 → 0.0.97-alpha.2
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/core/email.d.ts +3 -1
- package/dist/core/email.js +4 -0
- package/dist/default-error-overlay.d.ts +2 -2
- package/dist/formatting.d.ts +3 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/pwa.d.ts +2 -2
- package/package.json +1 -1
- package/skills/softr-sdk/SKILL.md +1 -1
- package/skills/softr-sdk/ai/SKILL.md +1 -1
- package/skills/softr-sdk/auth/SKILL.md +1 -1
- package/skills/softr-sdk/charts-and-metrics/SKILL.md +1 -1
- package/skills/softr-sdk/current-user/SKILL.md +1 -1
- package/skills/softr-sdk/email/SKILL.md +15 -8
- package/skills/softr-sdk/file-uploads/SKILL.md +1 -1
- package/skills/softr-sdk/formatting/SKILL.md +1 -1
- package/skills/softr-sdk/integrations/SKILL.md +1 -1
- package/skills/softr-sdk/mcp/SKILL.md +1 -1
- package/skills/softr-sdk/pwa/SKILL.md +1 -1
- package/skills/softr-sdk/record-mutations/SKILL.md +1 -1
- package/skills/softr-sdk/record-queries/SKILL.md +1 -1
- package/skills/softr-sdk/region-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/routes-and-visibility/SKILL.md +1 -1
- package/skills/softr-sdk/workflows/SKILL.md +1 -1
package/dist/core/email.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EmailAction } from "../action.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/email.d.ts
|
|
4
|
-
declare const EMAIL_ERROR_CODES: readonly ["NOT_FOUND", "INVALID_INPUT", "PLAN_RESTRICTED", "CREDITS_EXHAUSTED", "RATE_LIMITED", "PROVIDER_REJECTED", "UNAVAILABLE", "TIMEOUT"];
|
|
4
|
+
declare const EMAIL_ERROR_CODES: readonly ["NOT_FOUND", "INVALID_INPUT", "PLAN_RESTRICTED", "CREDITS_EXHAUSTED", "RATE_LIMITED", "DAILY_LIMIT_REACHED", "SENDER_UNAVAILABLE", "PROVIDER_REJECTED", "UNAVAILABLE", "TIMEOUT"];
|
|
5
5
|
type EmailErrorCode = (typeof EMAIL_ERROR_CODES)[number];
|
|
6
6
|
interface EmailSendInit {
|
|
7
7
|
/** Ignored when the action declares its own. */
|
|
@@ -28,6 +28,8 @@ interface EmailSent {
|
|
|
28
28
|
* - `PLAN_RESTRICTED`: the workspace's plan does not include sending this email.
|
|
29
29
|
* - `CREDITS_EXHAUSTED`: the workspace has no workflow credits left.
|
|
30
30
|
* - `RATE_LIMITED`: the app sent too many emails lately; try again later.
|
|
31
|
+
* - `DAILY_LIMIT_REACHED`: Softr's own address sent the workspace's emails for today.
|
|
32
|
+
* - `SENDER_UNAVAILABLE`: the chosen sender is missing or not confirmed, or the action leaves `to` open and would send from Softr's address.
|
|
31
33
|
* - `PROVIDER_REJECTED`: the mail provider refused the email.
|
|
32
34
|
* - `UNAVAILABLE`: Softr could not send it right now, or could not be reached.
|
|
33
35
|
* - `TIMEOUT`: no answer in time. It may still have been sent.
|
package/dist/core/email.js
CHANGED
|
@@ -13,6 +13,8 @@ const EMAIL_ERROR_CODES = [
|
|
|
13
13
|
"PLAN_RESTRICTED",
|
|
14
14
|
"CREDITS_EXHAUSTED",
|
|
15
15
|
"RATE_LIMITED",
|
|
16
|
+
"DAILY_LIMIT_REACHED",
|
|
17
|
+
"SENDER_UNAVAILABLE",
|
|
16
18
|
"PROVIDER_REJECTED",
|
|
17
19
|
"UNAVAILABLE",
|
|
18
20
|
"TIMEOUT"
|
|
@@ -25,6 +27,8 @@ const EMAIL_ERROR_CODES = [
|
|
|
25
27
|
* - `PLAN_RESTRICTED`: the workspace's plan does not include sending this email.
|
|
26
28
|
* - `CREDITS_EXHAUSTED`: the workspace has no workflow credits left.
|
|
27
29
|
* - `RATE_LIMITED`: the app sent too many emails lately; try again later.
|
|
30
|
+
* - `DAILY_LIMIT_REACHED`: Softr's own address sent the workspace's emails for today.
|
|
31
|
+
* - `SENDER_UNAVAILABLE`: the chosen sender is missing or not confirmed, or the action leaves `to` open and would send from Softr's address.
|
|
28
32
|
* - `PROVIDER_REJECTED`: the mail provider refused the email.
|
|
29
33
|
* - `UNAVAILABLE`: Softr could not send it right now, or could not be reached.
|
|
30
34
|
* - `TIMEOUT`: no answer in time. It may still have been sent.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/default-error-overlay.d.ts
|
|
4
4
|
type Props = {
|
|
@@ -8,6 +8,6 @@ type Props = {
|
|
|
8
8
|
declare function DefaultErrorOverlay({
|
|
9
9
|
error,
|
|
10
10
|
reset
|
|
11
|
-
}: Props):
|
|
11
|
+
}: Props): react6.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { DefaultErrorOverlay };
|
package/dist/formatting.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react0 from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/formatting.d.ts
|
|
@@ -94,7 +94,7 @@ declare function FormattingScope({
|
|
|
94
94
|
/** A BCP 47 locale, such as `de-DE`. It drops the app's fixed date format inside the scope. */
|
|
95
95
|
locale?: string;
|
|
96
96
|
children?: ReactNode;
|
|
97
|
-
}):
|
|
97
|
+
}): react0.FunctionComponentElement<react0.ProviderProps<Scope>>;
|
|
98
98
|
/**
|
|
99
99
|
* A date in the app's format, safe to render on the server. A timestamp whose
|
|
100
100
|
* zone is not known yet renders `fallback` until the browser supplies it, so
|
|
@@ -115,6 +115,6 @@ declare function FormattedDate({
|
|
|
115
115
|
time?: boolean;
|
|
116
116
|
/** What renders while the visitor's zone is unknown. */
|
|
117
117
|
fallback?: ReactNode;
|
|
118
|
-
}):
|
|
118
|
+
}): react0.FunctionComponentElement<react0.FragmentProps>;
|
|
119
119
|
//#endregion
|
|
120
120
|
export { DateOptions, DateParts, DateSeparator, DateValue, FixedDateFormat, FormattedDate, Formatting, FormattingScope, WeekDay, formatDate, formatDateTime, formatNumber, useFormatting };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DatasourceAction } from "./action.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _tanstack_react_start7 from "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
5
5
|
|
|
@@ -31,6 +31,6 @@ type SoftrMcpOptions = {
|
|
|
31
31
|
* ],
|
|
32
32
|
* }))
|
|
33
33
|
*/
|
|
34
|
-
declare function softrMcpMiddleware(options?: SoftrMcpOptions):
|
|
34
|
+
declare function softrMcpMiddleware(options?: SoftrMcpOptions): _tanstack_react_start7.RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
35
35
|
//#endregion
|
|
36
36
|
export { softrMcpMiddleware };
|
package/dist/package.js
CHANGED
package/dist/pwa.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/pwa.d.ts
|
|
@@ -23,7 +23,7 @@ import "@tanstack/react-start";
|
|
|
23
23
|
* )
|
|
24
24
|
* }
|
|
25
25
|
*/
|
|
26
|
-
declare function SoftrPwaHead():
|
|
26
|
+
declare function SoftrPwaHead(): react4.FunctionComponentElement<react4.FragmentProps>;
|
|
27
27
|
type PwaPlatform = "ios" | "android" | "desktop";
|
|
28
28
|
type PwaInstall = {
|
|
29
29
|
available: false;
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
metadata:
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: softr-sdk
|
|
16
|
-
library_version: 0.0.97-alpha.
|
|
16
|
+
library_version: 0.0.97-alpha.2
|
|
17
17
|
---
|
|
18
18
|
|
|
19
19
|
**Boundary.** `ai` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineAiAction` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -12,14 +12,14 @@ description: >-
|
|
|
12
12
|
metadata:
|
|
13
13
|
type: sub-skill
|
|
14
14
|
library: softr-sdk
|
|
15
|
-
library_version: 0.0.97-alpha.
|
|
15
|
+
library_version: 0.0.97-alpha.2
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
**Boundary.** `email` and `EmailError` live on `@softr/sdk/server` and run only inside a `createServerFn` handler — importing them into a component fails the build. `defineEmailAction` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
19
19
|
|
|
20
20
|
# Email
|
|
21
21
|
|
|
22
|
-
An app sends an email through an email action. Softr sends it
|
|
22
|
+
An app sends an email through an email action. Softr sends it and bills the workspace's **workflow credits**, so there is no mail service to connect and no workflow to build. Use it for every email the app sends while it handles something a person does in it: a form submitted, a button pressed, a record saved through the app.
|
|
23
23
|
|
|
24
24
|
A workflow is still the answer for an email on a schedule ("every Monday") or on a change made outside the app (a record edited in the table): load `automate-with-workflows` for those. A connected Gmail or Outlook is the answer only when the user wants the email to come from their own mailbox, through the `integrations` sub-skill.
|
|
25
25
|
|
|
@@ -31,15 +31,20 @@ The action's `permissions` is its audience: everyone in it can send an email thr
|
|
|
31
31
|
|
|
32
32
|
- **Fix the recipients whenever the use case allows.** A contact form that emails the owner fixes `to` to the owner. "Email me this report" fixes `to` to `{LOGGED_IN_USER:EMAIL}`. Then nobody can send the app's email to anyone else.
|
|
33
33
|
- **When people pick the recipients, narrow the audience.** "Staff email a client" leaves `to` open and keeps the action to the staff group with `customGroups`. An action with open recipients for all signed-in users lets anyone who signs up send any email to anyone from the app's address, up to the workspace's credits. Build that only when the user asks for it, and tell them so in one line. An action open to visitors must fix `to`: one that fixes only `cc` or `bcc` is not stored.
|
|
34
|
+
- **Recipients the person picks need the workspace's own sender.** An action that leaves `to` open must send from a confirmed sender, as its `senderId` or as the app's sender. From Softr's address every send fails with `SENDER_UNAVAILABLE`. Set the sender up before you write such an action, or ask the user which one to use.
|
|
34
35
|
|
|
35
36
|
## The sender
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
An email comes from the action's `senderId`, else from the app's email sender. With neither, it comes from Softr's own address, `"<workspace name>" <workspaceId@softr-email.com>`, the one workflows' "Send email with Softr" uses. That address is for testing: at most 30 emails a day per workspace, and the next one fails with `DAILY_LIMIT_REACHED`. The app's default `@softr.app` address sends only its sign-in emails.
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
40
|
+
A chosen sender that is missing or not confirmed fails every send with `SENDER_UNAVAILABLE`. Softr never falls back to its own address.
|
|
41
|
+
|
|
42
|
+
- While you build, list the workspace's senders with `workspace_list_email_senders`, and say which are confirmed, or that there are none.
|
|
43
|
+
- With confirmed senders, and a plan that allows custom senders, ask the user which one the email comes from and set it as the action's `senderId`, copied exactly. Nothing else changes, sign-in emails included. Never pick one yourself.
|
|
44
|
+
- With none, say the emails come from Softr's address, for testing and at most 30 a day. To send from their own address, they add one under the workspace's email senders and confirm the email it receives. Custom senders need the Professional or Business plan.
|
|
45
|
+
- Read the app's sender with `application_get` before you say where the emails come from. Your closing message names the actual From address: the `senderId`'s, else the app's, else `<workspaceId>@softr-email.com` with the real id. Never write "if no sender is set": read it.
|
|
46
|
+
- Changing the app's sender also changes the address its sign-in emails come from. Call `application_configure_email_sender` only when the user wants the app's sender changed, after naming both effects.
|
|
47
|
+
- Confirming the email is all an email action needs. The domain's DNS records (DKIM, Return-Path) are needed only before Studio lets the app pick the address as its own sender, and they help the emails stay out of spam.
|
|
43
48
|
|
|
44
49
|
## What it costs
|
|
45
50
|
|
|
@@ -114,7 +119,9 @@ Every call is a new email. Disable the button while the request runs, so a doubl
|
|
|
114
119
|
| `PLAN_RESTRICTED` | The workspace's plan does not allow this email |
|
|
115
120
|
| `CREDITS_EXHAUSTED` | The workspace has no workflow credits left |
|
|
116
121
|
| `RATE_LIMITED` | The app sent too often lately. Tell the person to try again later |
|
|
117
|
-
| `
|
|
122
|
+
| `DAILY_LIMIT_REACHED` | Softr's own address sent its 30 emails for today. Tell the person the email could not be sent today; the owner fixes it by choosing their own sender |
|
|
123
|
+
| `SENDER_UNAVAILABLE` | The chosen sender is missing or not confirmed, or the action leaves `to` open and has no sender of the workspace's own. Tell the person the email could not be sent; the owner fixes the sender |
|
|
124
|
+
| `PROVIDER_REJECTED` | The mail provider refused the email |
|
|
118
125
|
| `UNAVAILABLE` | Softr could not send it right now or could not be reached |
|
|
119
126
|
| `TIMEOUT` | No answer in time. It may still have been sent, so never send it again by yourself |
|
|
120
127
|
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 0.0.97-alpha.
|
|
10
|
+
library_version: 0.0.97-alpha.2
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
**Boundary.** `upload` lives on `@softr/sdk/server` and runs inside server functions. `useFileUpload` and `FileItem` live on `@softr/sdk` and run in components. `FileAttachment` comes from `@softr/sdk` and can be imported anywhere.
|
|
@@ -7,7 +7,7 @@ description: >-
|
|
|
7
7
|
metadata:
|
|
8
8
|
type: sub-skill
|
|
9
9
|
library: softr-sdk
|
|
10
|
-
library_version: 0.0.97-alpha.
|
|
10
|
+
library_version: 0.0.97-alpha.2
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
**Boundary.** `integration` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineIntegration` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `softrMcpMiddleware` lives on `@softr/sdk` and is registered once, in `src/start.ts`. The actions you hand it are the same `defineQuery` / `defineMutation` values the app's own pages use — declared wherever they already live, not duplicated for MCP.
|
|
@@ -8,7 +8,7 @@ description: >-
|
|
|
8
8
|
metadata:
|
|
9
9
|
type: sub-skill
|
|
10
10
|
library: softr-sdk
|
|
11
|
-
library_version: 0.0.97-alpha.
|
|
11
|
+
library_version: 0.0.97-alpha.2
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineMutation` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `ds` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler or a server-side route hook — importing it into a component fails the build. The same holds for any helper that calls `ds`: declare it inside the handler. A function at module level that calls `ds` keeps the server-only import in the browser bundle, and every page stops loading until it moves. `defineQuery` and every type come from `@softr/sdk` and can be imported anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `definePage`, `pageHead`, the access functions and the error predicates come from `@softr/sdk` and work anywhere.
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
metadata:
|
|
10
10
|
type: sub-skill
|
|
11
11
|
library: softr-sdk
|
|
12
|
-
library_version: 0.0.97-alpha.
|
|
12
|
+
library_version: 0.0.97-alpha.2
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
**Boundary.** `workflow` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build. `defineWorkflow` and every type come from `@softr/sdk` and can be imported anywhere.
|