@softr/sdk 0.0.74-alpha.0 → 0.0.75

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.
Files changed (47) hide show
  1. package/dist/action.d.ts +31 -1
  2. package/dist/action.js +26 -1
  3. package/dist/auth/methods/profile.d.ts +12 -3
  4. package/dist/auth/methods/profile.js +18 -4
  5. package/dist/auth/platform.js +4 -0
  6. package/dist/auth/server.d.ts +2 -1
  7. package/dist/auth/server.js +2 -1
  8. package/dist/client.d.ts +2 -1
  9. package/dist/client.js +2 -1
  10. package/dist/codegen/datasource-types.js +14 -1
  11. package/dist/comments/comments.d.ts +168 -0
  12. package/dist/comments/comments.js +413 -0
  13. package/dist/comments/use-comment-composer.d.ts +46 -0
  14. package/dist/comments/use-comment-composer.js +134 -0
  15. package/dist/core/file-upload.d.ts +7 -2
  16. package/dist/core/file-upload.js +6 -1
  17. package/dist/core/options.d.ts +2 -17
  18. package/dist/core/options.js +2 -30
  19. package/dist/core/use-file-upload.d.ts +2 -2
  20. package/dist/datasource/datasource.d.ts +1 -2
  21. package/dist/datasource/datasource.js +2 -3
  22. package/dist/datasource/fields.d.ts +24 -16
  23. package/dist/formatting.d.ts +3 -3
  24. package/dist/index.d.ts +3 -2
  25. package/dist/index.js +2 -2
  26. package/dist/mcp.d.ts +2 -2
  27. package/dist/package.js +1 -1
  28. package/dist/pwa.d.ts +2 -2
  29. package/dist/server.d.ts +3 -2
  30. package/dist/server.js +2 -1
  31. package/package.json +12 -33
  32. package/skills/softr-sdk/SKILL.md +8 -4
  33. package/skills/softr-sdk/auth/SKILL.md +4 -3
  34. package/skills/softr-sdk/charts-and-metrics/SKILL.md +1 -1
  35. package/skills/softr-sdk/comments/SKILL.md +181 -0
  36. package/skills/softr-sdk/current-user/SKILL.md +1 -1
  37. package/skills/softr-sdk/file-uploads/SKILL.md +5 -4
  38. package/skills/softr-sdk/formatting/SKILL.md +1 -1
  39. package/skills/softr-sdk/integrations/SKILL.md +1 -1
  40. package/skills/softr-sdk/mcp/SKILL.md +1 -1
  41. package/skills/softr-sdk/pwa/SKILL.md +1 -1
  42. package/skills/softr-sdk/record-mutations/SKILL.md +2 -2
  43. package/skills/softr-sdk/record-queries/SKILL.md +1 -7
  44. package/skills/softr-sdk/record-queries/references/filters-and-sorting.md +1 -1
  45. package/skills/softr-sdk/region-visibility/SKILL.md +1 -1
  46. package/skills/softr-sdk/routes-and-visibility/SKILL.md +1 -1
  47. package/skills/softr-sdk/workflows/SKILL.md +1 -1
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 0.0.71
13
+ library_version: 0.0.75
14
14
  ---
15
15
 
16
16
  # Dates, times and numbers
@@ -10,7 +10,7 @@ description: >-
10
10
  metadata:
11
11
  type: sub-skill
12
12
  library: softr-sdk
13
- library_version: 0.0.71
13
+ library_version: 0.0.75
14
14
  ---
15
15
 
16
16
  **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.71
12
+ library_version: 0.0.75
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.71
12
+ library_version: 0.0.75
13
13
  ---
14
14
 
15
15
  # Installing the app
@@ -11,7 +11,7 @@ description: >-
11
11
  metadata:
12
12
  type: sub-skill
13
13
  library: softr-sdk
14
- library_version: 0.0.71
14
+ library_version: 0.0.75
15
15
  ---
16
16
 
17
17
  **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.
@@ -155,7 +155,7 @@ A form select for a `LINKED_RECORD` field needs its options from the linked tabl
155
155
 
156
156
  Each key of `data` accepts exactly what its field takes (see [record-queries](../record-queries/SKILL.md#typing)):
157
157
 
158
- - SELECT and LINKED_RECORD take `{ id }`. Not a bare string, and not the `{ id, label }` a read returns; the label is display data and a write does not accept it. For a form select that should follow the field's choices in Studio, read them with `ds.choices` (see [record-queries](../record-queries/SKILL.md)).
158
+ - SELECT and LINKED_RECORD take `{ id }`. Not a bare string, and not the `{ id, label }` a read returns; the label is display data and a write does not accept it. A generated SELECT narrows the id to the field's own choices.
159
159
  - CHECKBOX takes a boolean. Dates take ISO strings, never `Date` instances.
160
160
  - ATTACHMENT takes `{ url }`, optionally with `filename`, `id` and `type`.
161
161
  - A multi-entry field takes an array of the value.
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: sub-skill
15
15
  library: softr-sdk
16
- library_version: 0.0.71
16
+ library_version: 0.0.75
17
17
  ---
18
18
 
19
19
  **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.
@@ -200,12 +200,6 @@ const loadProductStatuses = createServerFn()
200
200
 
201
201
  Skip this request when the options are predefined and fixed — hardcode them instead.
202
202
 
203
- A `SELECT` field's options are its choices, and the builder can add and rename them in Studio after the app is built. When a dropdown should follow those changes, read them with `ds.choices`. When the app means a fixed choice, such as a "Done" tab, use its id directly. A mistyped id is not caught at compile time, and a write with an id the field lacks adds it as a new choice. `ds.choices` takes any query or mutation that declares the field and answers `[{ id, label, color }]` as the field holds them now. Each `id` is what a `where` and a write take, for a filter dropdown and a form select alike:
204
-
205
- ```ts
206
- const loadStatuses = createServerFn().handler(() => ds.choices(listProjects, 'status'))
207
- ```
208
-
209
203
  A read the datasource turns down throws rather than coming back empty, and it throws a plain `Error` carrying the status, followed by the reason the datasource gives when it sends one. There is no typed predicate to narrow it with. Handle it where you would handle any other failed fetch: an `errorComponent` on the route, or a check in the handler.
210
204
 
211
205
  ## Typing
@@ -83,7 +83,7 @@ Every value is an ISO date string, either `'2026-01-31'` or a full timestamp. A
83
83
  | `.isOneOf(values)` / `.isNoneOf(values)` | Any of / none of |
84
84
  | `.isEmpty()` / `.isNotEmpty()` | No value / has a value |
85
85
 
86
- Values are choice ids, never labels. A SELECT takes any choice id as a string, so a filter dropdown can pass the ids `ds.choices` returns. A label still matches nothing. A LINKED_RECORD compares against the linked record's id.
86
+ Values are choice ids, never labels. A generated SELECT narrows the argument to the field's own choice ids, so a label or a typo is a type error. A LINKED_RECORD compares against the linked record's id.
87
87
 
88
88
  ### Multi-value fields
89
89
 
@@ -9,7 +9,7 @@ description: >-
9
9
  metadata:
10
10
  type: sub-skill
11
11
  library: softr-sdk
12
- library_version: 0.0.71
12
+ library_version: 0.0.75
13
13
  ---
14
14
 
15
15
  **Boundary.** `Audience` and `defineVisibility` come from `@softr/sdk` and work anywhere.
@@ -13,7 +13,7 @@ description: >-
13
13
  metadata:
14
14
  type: sub-skill
15
15
  library: softr-sdk
16
- library_version: 0.0.71
16
+ library_version: 0.0.75
17
17
  ---
18
18
 
19
19
  **Boundary.** `defineVisibility`, 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.71
12
+ library_version: 0.0.75
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.