@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.
@@ -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.
@@ -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 react0 from "react";
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): react0.JSX.Element;
11
+ }: Props): react6.JSX.Element;
12
12
  //#endregion
13
13
  export { DefaultErrorOverlay };
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import * as react3 from "react";
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
- }): react3.FunctionComponentElement<react3.ProviderProps<Scope>>;
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
- }): react3.FunctionComponentElement<react3.FragmentProps>;
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 _tanstack_react_start0 from "@tanstack/react-start";
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): _tanstack_react_start0.RequestMiddlewareAfterServer<{}, undefined, undefined>;
34
+ declare function softrMcpMiddleware(options?: SoftrMcpOptions): _tanstack_react_start7.RequestMiddlewareAfterServer<{}, undefined, undefined>;
35
35
  //#endregion
36
36
  export { softrMcpMiddleware };
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.97-alpha.1";
2
+ var version = "0.0.97-alpha.2";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/dist/pwa.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react1 from "react";
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(): react1.FunctionComponentElement<react1.FragmentProps>;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "0.0.97-alpha.1",
3
+ "version": "0.0.97-alpha.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: core
11
11
  library: softr-sdk
12
- library_version: 0.0.97-alpha.1
12
+ library_version: 0.0.97-alpha.2
13
13
  ---
14
14
 
15
15
  # Softr SDK core
@@ -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.1
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.1
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.1
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.
@@ -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.1
12
+ library_version: 0.0.97-alpha.2
13
13
  ---
14
14
 
15
15
  # The current user
@@ -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.1
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 from the app's email sender 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.
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
- Every email comes from the app's email sender, unless the action names one of the workspace's senders with `senderId`. With no sender set, they come from the app's default `@softr.app` address, the one its sign-in emails use.
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
- - Read the app's sender with `application_get` before you say where the emails come from, and name it. Never write "if no sender is set": read it. With no sender set, that tool shows the app's default `@softr.app` address: name that one. Say in your closing message when no sender is set, and that the app should get its own sender before real users rely on its emails.
40
- - When the app has no sender of its own, list the workspace's senders with `workspace_list_email_senders` and offer the confirmed ones by name: for this email (`senderId`, nothing else changes) or as the app's sender. Never pick one yourself.
41
- - Changing the app's sender also changes the address its sign-in emails come from. Ask the user before you call `application_configure_email_sender`, and name both effects. A workspace whose plan has no custom senders is refused; then say that sending from their own address needs the Professional plan.
42
- - Set `senderId` only when the user wants this email from a specific address, such as `billing@`. Pick it from `workspace_list_email_senders`, copied exactly. A sender the mail provider has not confirmed makes every send fail until it is confirmed. That confirmation 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.
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
- | `PROVIDER_REJECTED` | The mail provider refused the email, for example from an unconfirmed sender |
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.1
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.
@@ -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.1
11
+ library_version: 0.0.97-alpha.2
12
12
  ---
13
13
 
14
14
  # Dates, times and numbers
@@ -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.1
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.1
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.
@@ -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.1
12
+ library_version: 0.0.97-alpha.2
13
13
  ---
14
14
 
15
15
  # Installing the app
@@ -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.1
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.1
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.1
12
+ library_version: 0.0.97-alpha.2
13
13
  ---
14
14
 
15
15
  **Boundary.** `Audience` and `defineVisibility` 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.1
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.1
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.