@softr/sdk 0.0.76 → 0.0.77

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/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.0.76";
2
+ var version = "0.0.77";
3
3
 
4
4
  //#endregion
5
5
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softr/sdk",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
@@ -1,18 +1,14 @@
1
1
  ---
2
2
  name: softr-sdk
3
3
  description: >-
4
- Entry point for @softr/sdk, the layer a Softr app uses to reach Softr: the
5
- four entrypoints (@softr/sdk, /server, /client, /vite) and the client-server
6
- boundary between them, softrAuthMiddleware, getSoftrContext,
7
- initialSoftrContext, SoftrContext, and which sub-skill to load for route
8
- visibility, the current user, reading records, charts and metrics, writing
9
- records, auth, or showing dates and numbers. Load this when unsure which
10
- sub-skill applies, or when touching the wiring; each sub-skill stands alone
11
- for its own task.
4
+ Entry point for @softr/sdk: its four entrypoints (@softr/sdk, /server,
5
+ /client, /vite) and their client-server boundary, softrAuthMiddleware and the
6
+ Softr context, and which sub-skill covers each task. Load it when unsure which
7
+ sub-skill applies, or when touching the wiring.
12
8
  metadata:
13
9
  type: core
14
10
  library: softr-sdk
15
- library_version: 0.0.76
11
+ library_version: 0.0.77
16
12
  ---
17
13
 
18
14
  # Softr SDK core
@@ -1,24 +1,15 @@
1
1
  ---
2
2
  name: auth
3
3
  description: >-
4
- Sign a Softr visitor in, out or up from a server function: auth.signIn,
5
- signInWithCode, signInWithGoogle, signInWithMagicLink, signUp, confirmSignUp
6
- and signOut from @softr/sdk/server, the authenticator-app calls that finish a
7
- sign-in (verifyAuthenticator, startAuthenticatorSetup,
8
- confirmAuthenticatorSetup, skipAuthenticatorSetup) and the ones that change an
9
- authenticator from a settings page (sendAuthenticatorResetCode,
10
- resetAuthenticator, removeAuthenticator), updateProfile for the visitor's own
11
- name and photo, the emailed password links (requestPasswordReset,
12
- checkPasswordLink, setPasswordWithLink), and getAuthSettings,
13
- AuthSettingsProvider and useAuthSettings for which sign-in and sign-up methods
14
- the app has enabled. Covers the Result shape they answer with and its error
15
- codes (invalidCredentials, emailTaken, notAuthenticated, notAnImage and the
16
- rest), the two-step sign-up, why a successful sign-in does not always mean the
17
- visitor is signed in, and toReturnPath for where to land after signing in.
4
+ Sign a visitor in, out or up from a server function with auth from
5
+ @softr/sdk/server: password, code, Google and magic link, sign-up and its
6
+ confirmation, the authenticator-app steps, password reset links,
7
+ updateProfile, and getAuthSettings and useAuthSettings for the methods the app
8
+ enables. Covers the Result shape, its error codes, and toReturnPath.
18
9
  metadata:
19
10
  type: sub-skill
20
11
  library: softr-sdk
21
- library_version: 0.0.76
12
+ library_version: 0.0.77
22
13
  ---
23
14
 
24
15
  **Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
@@ -1,18 +1,15 @@
1
1
  ---
2
2
  name: charts-and-metrics
3
3
  description: >-
4
- Aggregate Softr datasource records inside a server function: ds.chart with
5
- groupBy, metrics, where and orderBy for chart rows, ds.metric for a single
6
- headline number, date bucket intervals, which aggregations each kind of field
7
- offers, the two-group-column ceiling, and distinct values for filter controls.
8
- Use when drawing a chart, a stat tile or any counted, summed or averaged
9
- number, when filling a dropdown from a real column, or when a chart comes back
10
- scrambled or with the wrong rows. Aggregation only: fetching individual
11
- records is record-queries, and changing them is record-mutations.
4
+ Aggregate records in a server function: ds.chart with groupBy, metrics, where,
5
+ orderBy and date buckets for chart rows, ds.metric for one number, and
6
+ distinct values for filter controls. Use for a chart, a stat tile or any
7
+ counted, summed or averaged number, or when a chart comes back wrong. Single
8
+ records are record-queries.
12
9
  metadata:
13
10
  type: sub-skill
14
11
  library: softr-sdk
15
- library_version: 0.0.76
12
+ library_version: 0.0.77
16
13
  ---
17
14
 
18
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.
@@ -1,17 +1,14 @@
1
1
  ---
2
2
  name: comments
3
3
  description: >-
4
- Comment threads on records: defineComments from @softr/sdk declares which
5
- datasource has comments; comments.list, create, update, delete, react,
6
- subscription, setSubscription and searchMentions from @softr/sdk/server read
7
- and write one record's thread inside a server function; useCommentComposer
8
- and useFileUpload from @softr/sdk/client keep a textarea's text, its
9
- @mentions and its attachments in step. Bodies come back as sanitised
10
- bodyHtml. A null thread means render nothing.
4
+ Comment threads on records: defineComments, the comments calls from
5
+ @softr/sdk/server to list, write, react to and mention in one record's thread,
6
+ and useCommentComposer and useFileUpload from @softr/sdk/client for the
7
+ composer. Bodies come back as sanitised bodyHtml.
11
8
  metadata:
12
9
  type: sub-skill
13
10
  library: softr-sdk
14
- library_version: 0.0.76
11
+ library_version: 0.0.77
15
12
  ---
16
13
 
17
14
  **Boundary.** `comments` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler. Importing it into a component fails the build. `useCommentComposer` lives on `@softr/sdk/client` and runs in components. `defineComments` comes 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.76
12
+ library_version: 0.0.77
13
13
  ---
14
14
 
15
15
  # The current user
@@ -1,16 +1,13 @@
1
1
  ---
2
2
  name: file-uploads
3
3
  description: >-
4
- Upload files from a form or edit view: useFileUpload(action) from @softr/sdk
5
- does everything — XHR upload with real progress, per-upload cancel, and
6
- isUploading to block form submission. No route registration needed; the SDK
7
- ships its own server function. For server-side uploads or plain forms, use
8
- upload(actionId, file) from @softr/sdk/server. For edit forms pass
9
- initialAttachments to pre-load existing attachments.
4
+ Upload files from a form or edit view: useFileUpload from @softr/sdk, with
5
+ progress, cancel and isUploading to hold the submit, and initialAttachments
6
+ for an edit form; upload from @softr/sdk/server for a server-side upload.
10
7
  metadata:
11
8
  type: sub-skill
12
9
  library: softr-sdk
13
- library_version: 0.0.76
10
+ library_version: 0.0.77
14
11
  ---
15
12
 
16
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.
@@ -2,15 +2,13 @@
2
2
  name: formatting
3
3
  description: >-
4
4
  Show dates, times and numbers in the app's format without hydration
5
- mismatches: FormattedDate in JSX, useFormatting with formatDate,
6
- formatDateTime and formatNumber in code, FormattingScope and the timeZone
7
- option for a zone or locale the user names, parts for a partial date, and why
8
- toLocaleDateString, toLocaleString and Intl formatters with the runtime's
9
- defaults must never run in render.
5
+ mismatches: FormattedDate, useFormatting with formatDate, formatDateTime and
6
+ formatNumber, FormattingScope and timeZone, and why toLocaleDateString and
7
+ Intl defaults must never run in render.
10
8
  metadata:
11
9
  type: sub-skill
12
10
  library: softr-sdk
13
- library_version: 0.0.76
11
+ library_version: 0.0.77
14
12
  ---
15
13
 
16
14
  # Dates, times and numbers
@@ -1,16 +1,13 @@
1
1
  ---
2
2
  name: integrations
3
3
  description: >-
4
- Call a third-party service connected to the app as an integration:
5
- defineIntegration from @softr/sdk declares the action with its integrationId,
6
- the one HTTP method and endpoint url it allows, and permissions;
7
- integration.createFetcher from @softr/sdk/server binds it and returns a
8
- fetcher function you call with optional params, query, headers, and body.
9
- Check res.ok before res.json().
4
+ Call a third-party service connected as an integration: defineIntegration from
5
+ @softr/sdk declares the one method and endpoint it allows, and
6
+ integration.createFetcher from @softr/sdk/server calls it.
10
7
  metadata:
11
8
  type: sub-skill
12
9
  library: softr-sdk
13
- library_version: 0.0.76
10
+ library_version: 0.0.77
14
11
  ---
15
12
 
16
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.76
12
+ library_version: 0.0.77
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.76
12
+ library_version: 0.0.77
13
13
  ---
14
14
 
15
15
  # Installing the app
@@ -1,17 +1,14 @@
1
1
  ---
2
2
  name: record-mutations
3
3
  description: >-
4
- Create, update and delete records in a Softr datasource with defineMutation,
5
- ds.create, ds.update and ds.delete: one declaration per operation, the data
6
- payload keyed by your own field names, what each field type accepts on a
7
- write, and the record each call returns. Use when submitting a form, saving an
8
- edit or deleting a record, or when a write throws, writes the wrong field or
9
- silently changes nothing. Writes only: fetching records is record-queries, and
10
- aggregating them is charts-and-metrics.
4
+ Create, update and delete records with defineMutation, ds.create, ds.update
5
+ and ds.delete: the payload keyed by your own field names and what each field
6
+ type accepts. Use when submitting a form, saving an edit or deleting a record,
7
+ or when a write fails or changes nothing. Reads are record-queries.
11
8
  metadata:
12
9
  type: sub-skill
13
10
  library: softr-sdk
14
- library_version: 0.0.76
11
+ library_version: 0.0.77
15
12
  ---
16
13
 
17
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.
@@ -1,19 +1,15 @@
1
1
  ---
2
2
  name: record-queries
3
3
  description: >-
4
- Fetch records from a Softr datasource with defineQuery, ds.list and ds.get:
5
- the where and orderBy callbacks, field names of your own choosing, the
6
- 20-record default and 100-record cap, nextOffset pagination, and scoping a
7
- read to the signed-in visitor. Use when putting datasource records on a page,
8
- in a table, a list or a detail view, when filtering or sorting them, when
9
- filling a filter or form dropdown with all options from a linked table, or
10
- when a read comes back empty, unsorted or missing a field. Reads only:
11
- creating, updating and deleting records is record-mutations, and aggregating
12
- them into totals or chart rows is charts-and-metrics.
4
+ Fetch records with defineQuery, ds.list and ds.get: where and orderBy, field
5
+ names of your own choosing, pagination and its limits, and scoping a read to
6
+ the signed-in visitor. Use to put records on a page or fill a dropdown, or
7
+ when a read comes back empty, unsorted or missing a field. Writes are
8
+ record-mutations; totals and chart rows are charts-and-metrics.
13
9
  metadata:
14
10
  type: sub-skill
15
11
  library: softr-sdk
16
- library_version: 0.0.76
12
+ library_version: 0.0.77
17
13
  ---
18
14
 
19
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.76
12
+ library_version: 0.0.77
13
13
  ---
14
14
 
15
15
  **Boundary.** `Audience` and `defineVisibility` come from `@softr/sdk` and work anywhere.
@@ -1,19 +1,14 @@
1
1
  ---
2
2
  name: routes-and-visibility
3
3
  description: >-
4
- Add a route file to a Softr app and declare who may see it: defineVisibility
5
- with a userGroupTypes set naming LOGGED_IN_USERS and/or NON_LOGGED_IN_USERS,
6
- customGroups, and the ways to apply a rule: guardRoute and assertRouteAccess
7
- in a route, isAuthorized and checkAccess anywhere. Covers per-reason
8
- overrides, the redirect and throw strategies, rendering an access error with
9
- isAccessError, isUnauthenticatedError, isForbiddenError and
10
- isAlreadyAuthenticatedError, guarding a layout, and the lint rule that
11
- requires a declaration alongside the rules that reject a duplicate, computed
12
- or root-level one.
4
+ Add a route file and declare who may see it: defineVisibility with
5
+ LOGGED_IN_USERS, NON_LOGGED_IN_USERS and customGroups, guardRoute and
6
+ assertRouteAccess in a route, isAuthorized and checkAccess anywhere, rendering
7
+ an access error, and the lint rule that requires the declaration.
13
8
  metadata:
14
9
  type: sub-skill
15
10
  library: softr-sdk
16
- library_version: 0.0.76
11
+ library_version: 0.0.77
17
12
  ---
18
13
 
19
14
  **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.76
12
+ library_version: 0.0.77
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.