@softr/sdk 0.0.62-alpha.0 → 0.0.62
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/action.d.ts +1 -31
- package/dist/action.js +1 -26
- package/dist/client.d.ts +1 -2
- package/dist/client.js +1 -2
- package/dist/core/file-upload.d.ts +2 -7
- package/dist/core/file-upload.js +1 -6
- package/dist/core/integration.js +3 -2
- package/dist/core/use-file-upload.d.ts +2 -2
- package/dist/datasource/chart.js +5 -3
- package/dist/datasource/record.js +23 -6
- package/dist/default-error-overlay.d.ts +2 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/package.js +1 -1
- package/dist/pwa.d.ts +2 -2
- package/dist/server.d.ts +1 -2
- package/dist/server.js +1 -2
- package/package.json +1 -3
- package/skills/softr-sdk/SKILL.md +4 -8
- 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/file-uploads/SKILL.md +4 -5
- 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/comments/comments.d.ts +0 -168
- package/dist/comments/comments.js +0 -413
- package/dist/comments/use-comment-composer.d.ts +0 -46
- package/dist/comments/use-comment-composer.js +0 -134
- package/skills/softr-sdk/comments/SKILL.md +0 -181
package/dist/action.d.ts
CHANGED
|
@@ -234,35 +234,5 @@ type IntegrationDefinition<TId extends string> = {
|
|
|
234
234
|
* const res = await listEvents({ query: { timeMin: now, singleEvents: "true" } })
|
|
235
235
|
*/
|
|
236
236
|
declare function defineIntegration<const TId extends string>(definition: IntegrationDefinition<TId>): IntegrationAction<TId>;
|
|
237
|
-
type CommentsResource = {
|
|
238
|
-
type: "COMMENTS";
|
|
239
|
-
datasourceId: SoftrDatasourceId;
|
|
240
|
-
};
|
|
241
|
-
/** Comment threads on the records of one datasource. It has no `permissions`. */
|
|
242
|
-
type CommentsAction<TId extends string = string> = {
|
|
243
|
-
id: TId;
|
|
244
|
-
resource: CommentsResource;
|
|
245
|
-
};
|
|
246
|
-
type CommentsDefinition<TId extends string> = {
|
|
247
|
-
id: TId;
|
|
248
|
-
datasourceId: SoftrDatasourceId;
|
|
249
|
-
};
|
|
250
|
-
/**
|
|
251
|
-
* Declares comment threads on the records of a datasource. Each record has one thread.
|
|
252
|
-
*
|
|
253
|
-
* Who may read, post and delete comes from the app's comment settings in Softr, not from code. Two
|
|
254
|
-
* declarations on the same datasource share the same threads.
|
|
255
|
-
*
|
|
256
|
-
* Pass the returned object to `comments.*` from `@softr/sdk/server`.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* const orderComments = defineComments({
|
|
260
|
-
* id: "orderComments",
|
|
261
|
-
* datasourceId: "8f14e45f-ceea-467a-9d0b-2c1a0e3b5d77",
|
|
262
|
-
* })
|
|
263
|
-
*
|
|
264
|
-
* const thread = await comments.list(orderComments, { recordId })
|
|
265
|
-
*/
|
|
266
|
-
declare function defineComments<const TId extends string>(definition: CommentsDefinition<TId>): CommentsAction<TId>;
|
|
267
237
|
//#endregion
|
|
268
|
-
export { ActionData, ActionPermissions, ActionRecord, ActionShape,
|
|
238
|
+
export { ActionData, ActionPermissions, ActionRecord, ActionShape, DatasourceAction, FieldTypeOf, IntegrationAction, ReadOf, ReadShape, SoftrDatasources, WorkflowAction, defineIntegration, defineMutation, defineQuery, defineWorkflow };
|
package/dist/action.js
CHANGED
|
@@ -50,31 +50,6 @@ function defineIntegration(definition) {
|
|
|
50
50
|
permissions
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Declares comment threads on the records of a datasource. Each record has one thread.
|
|
55
|
-
*
|
|
56
|
-
* Who may read, post and delete comes from the app's comment settings in Softr, not from code. Two
|
|
57
|
-
* declarations on the same datasource share the same threads.
|
|
58
|
-
*
|
|
59
|
-
* Pass the returned object to `comments.*` from `@softr/sdk/server`.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* const orderComments = defineComments({
|
|
63
|
-
* id: "orderComments",
|
|
64
|
-
* datasourceId: "8f14e45f-ceea-467a-9d0b-2c1a0e3b5d77",
|
|
65
|
-
* })
|
|
66
|
-
*
|
|
67
|
-
* const thread = await comments.list(orderComments, { recordId })
|
|
68
|
-
*/
|
|
69
|
-
function defineComments(definition) {
|
|
70
|
-
return {
|
|
71
|
-
id: definition.id,
|
|
72
|
-
resource: {
|
|
73
|
-
type: "COMMENTS",
|
|
74
|
-
datasourceId: definition.datasourceId
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
53
|
function isDatasourceAction(value) {
|
|
79
54
|
if (typeof value !== "object" || value === null) return false;
|
|
80
55
|
const candidate = value;
|
|
@@ -83,4 +58,4 @@ function isDatasourceAction(value) {
|
|
|
83
58
|
}
|
|
84
59
|
|
|
85
60
|
//#endregion
|
|
86
|
-
export {
|
|
61
|
+
export { defineIntegration, defineMutation, defineQuery, defineWorkflow, isDatasourceAction };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { FileItem, useFileUpload } from "./core/use-file-upload.js";
|
|
2
|
-
import { useCommentComposer } from "./comments/use-comment-composer.js";
|
|
3
2
|
import "@tanstack/react-start/client-only";
|
|
4
|
-
export { type FileItem,
|
|
3
|
+
export { type FileItem, useFileUpload };
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DatasourceAction } from "../action.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/file-upload.d.ts
|
|
4
4
|
|
|
@@ -10,12 +10,7 @@ type FileAttachment = {
|
|
|
10
10
|
url: string;
|
|
11
11
|
filename: string;
|
|
12
12
|
id: string;
|
|
13
|
-
type?: string | null;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
* A COMMENTS action uploads a comment attachment.
|
|
17
|
-
* The platform checks the comment settings.
|
|
18
|
-
*/
|
|
19
|
-
declare function upload(action: DatasourceAction | CommentsAction, file: File): Promise<FileAttachment>;
|
|
14
|
+
declare function upload(action: DatasourceAction, file: File): Promise<FileAttachment>;
|
|
20
15
|
//#endregion
|
|
21
16
|
export { FileAttachment, upload };
|
package/dist/core/file-upload.js
CHANGED
|
@@ -5,10 +5,6 @@ import { platformApiUrl } from "../auth/platform.js";
|
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
|
|
7
7
|
//#region src/core/file-upload.ts
|
|
8
|
-
/**
|
|
9
|
-
* A COMMENTS action uploads a comment attachment.
|
|
10
|
-
* The platform checks the comment settings.
|
|
11
|
-
*/
|
|
12
8
|
async function upload(action, file) {
|
|
13
9
|
const { applicationId } = sessionConfig();
|
|
14
10
|
const baseUrl = await platformApiUrl();
|
|
@@ -27,8 +23,7 @@ async function upload(action, file) {
|
|
|
27
23
|
return {
|
|
28
24
|
url: resultJSON.url,
|
|
29
25
|
filename: resultJSON.filename || "Untitled file",
|
|
30
|
-
id: resultJSON.id || randomUUID()
|
|
31
|
-
type: resultJSON.type ?? null
|
|
26
|
+
id: resultJSON.id || randomUUID()
|
|
32
27
|
};
|
|
33
28
|
}
|
|
34
29
|
|
package/dist/core/integration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetch } from "../fetch.js";
|
|
2
2
|
import { readSessionToken } from "../auth/session.js";
|
|
3
|
-
import { dsUrl } from "../datasource/record.js";
|
|
3
|
+
import { dsUrl, refererHeader } from "../datasource/record.js";
|
|
4
4
|
|
|
5
5
|
//#region src/core/integration.ts
|
|
6
6
|
async function integrationFetch(action, { params, query, headers = {}, body, signal } = {}) {
|
|
@@ -15,7 +15,8 @@ async function integrationFetch(action, { params, query, headers = {}, body, sig
|
|
|
15
15
|
method: "POST",
|
|
16
16
|
headers: {
|
|
17
17
|
"Content-Type": "application/json",
|
|
18
|
-
"Authorization": `Bearer ${readSessionToken()}
|
|
18
|
+
"Authorization": `Bearer ${readSessionToken()}`,
|
|
19
|
+
...refererHeader()
|
|
19
20
|
},
|
|
20
21
|
body: JSON.stringify(payload),
|
|
21
22
|
signal
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DatasourceAction } from "../action.js";
|
|
2
2
|
import { FileAttachment } from "./file-upload.js";
|
|
3
3
|
|
|
4
4
|
//#region src/core/use-file-upload.d.ts
|
|
@@ -16,7 +16,7 @@ type FileItem = {
|
|
|
16
16
|
filename: string;
|
|
17
17
|
error: Error;
|
|
18
18
|
};
|
|
19
|
-
declare function useFileUpload(action: DatasourceAction
|
|
19
|
+
declare function useFileUpload(action: DatasourceAction, options?: {
|
|
20
20
|
initialAttachments?: FileAttachment[];
|
|
21
21
|
}): {
|
|
22
22
|
files: FileItem[];
|
package/dist/datasource/chart.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readUserTimezone } from "../cookies.js";
|
|
|
4
4
|
import { readSessionToken } from "../auth/session.js";
|
|
5
5
|
import { INTERNAL_KIND, buildFilterCriteria, buildOrderBy, dealiasFilterCriteria } from "./filter.js";
|
|
6
6
|
import { andAll, makeFieldSet, makeSortSet } from "./fields.js";
|
|
7
|
-
import { describeFailure, dsUrl, resolveTarget } from "./record.js";
|
|
7
|
+
import { describeFailure, dsUrl, refererHeader, resolveTarget } from "./record.js";
|
|
8
8
|
|
|
9
9
|
//#region src/datasource/chart.ts
|
|
10
10
|
const COUNT_CNT = "COUNT_CNT";
|
|
@@ -198,7 +198,8 @@ async function executeChart(query, state) {
|
|
|
198
198
|
headers: {
|
|
199
199
|
"Content-Type": "application/json",
|
|
200
200
|
"X-User-Timezone": readUserTimezone() ?? "UTC",
|
|
201
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
201
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
202
|
+
...refererHeader()
|
|
202
203
|
},
|
|
203
204
|
body: JSON.stringify(body)
|
|
204
205
|
});
|
|
@@ -271,7 +272,8 @@ async function executeMetric(query, handle, filters) {
|
|
|
271
272
|
headers: {
|
|
272
273
|
"Content-Type": "application/json",
|
|
273
274
|
"X-User-Timezone": readUserTimezone() ?? "UTC",
|
|
274
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
275
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
276
|
+
...refererHeader()
|
|
275
277
|
},
|
|
276
278
|
body: JSON.stringify(body)
|
|
277
279
|
});
|
|
@@ -5,6 +5,7 @@ import { readSessionToken } from "../auth/session.js";
|
|
|
5
5
|
import { isDatasourceAction } from "../action.js";
|
|
6
6
|
import { buildFilterCriteria, buildOrderBy, dealiasFilterCriteria, dealiasOrderBy } from "./filter.js";
|
|
7
7
|
import { andAll, makeFieldSet, makeSortSet } from "./fields.js";
|
|
8
|
+
import { getRequestHeader } from "@tanstack/react-start/server";
|
|
8
9
|
|
|
9
10
|
//#region src/datasource/record.ts
|
|
10
11
|
const MAX_RECORD_COUNT = 100;
|
|
@@ -15,6 +16,15 @@ const dsUrl = (actionId) => {
|
|
|
15
16
|
if (!applicationId) panic("SOFTR_APPLICATION_ID is not set.");
|
|
16
17
|
return `${withoutTrailingSlash(datasourceApiUrl)}/v1/datasource/vibe/applications/${applicationId}/actions/${actionId}`;
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The datasource API wants to know which page made the call.
|
|
21
|
+
* The browser sends that page to the app server, so we pass it on.
|
|
22
|
+
* Without an incoming Referer, we send none.
|
|
23
|
+
*/
|
|
24
|
+
function refererHeader() {
|
|
25
|
+
const referer = getRequestHeader("referer");
|
|
26
|
+
return referer ? { Referer: referer } : {};
|
|
27
|
+
}
|
|
18
28
|
async function describeFailure(res) {
|
|
19
29
|
const body = await res.json().catch(() => null);
|
|
20
30
|
const message = typeof body === "object" && body !== null && "message" in body ? body.message : null;
|
|
@@ -80,7 +90,8 @@ async function executeList(query, args) {
|
|
|
80
90
|
headers: {
|
|
81
91
|
"Content-Type": "application/json",
|
|
82
92
|
"X-User-Timezone": readUserTimezone() ?? "UTC",
|
|
83
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
93
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
94
|
+
...refererHeader()
|
|
84
95
|
},
|
|
85
96
|
body: JSON.stringify({
|
|
86
97
|
options: { userLocale: "en-US" },
|
|
@@ -151,7 +162,8 @@ async function executeGet(query, id, filters) {
|
|
|
151
162
|
headers: {
|
|
152
163
|
"Content-Type": "application/json",
|
|
153
164
|
"X-User-Timezone": readUserTimezone() ?? "UTC",
|
|
154
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
165
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
166
|
+
...refererHeader()
|
|
155
167
|
},
|
|
156
168
|
body: JSON.stringify({
|
|
157
169
|
options: { userLocale: "en-US" },
|
|
@@ -183,7 +195,8 @@ async function createRecord(action, options) {
|
|
|
183
195
|
method: "POST",
|
|
184
196
|
headers: {
|
|
185
197
|
"Content-Type": "application/json",
|
|
186
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
198
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
199
|
+
...refererHeader()
|
|
187
200
|
},
|
|
188
201
|
body: JSON.stringify({ fields: rawFields })
|
|
189
202
|
});
|
|
@@ -212,7 +225,8 @@ async function updateRecord(action, options) {
|
|
|
212
225
|
method: "PATCH",
|
|
213
226
|
headers: {
|
|
214
227
|
"Content-Type": "application/json",
|
|
215
|
-
Authorization: `Bearer ${readSessionToken()}
|
|
228
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
229
|
+
...refererHeader()
|
|
216
230
|
},
|
|
217
231
|
body: JSON.stringify({ fields: rawFields })
|
|
218
232
|
});
|
|
@@ -233,7 +247,10 @@ async function deleteRecord(action, options) {
|
|
|
233
247
|
const { actionId } = resolveTarget(action, "delete");
|
|
234
248
|
const res = await fetch(`${dsUrl(actionId)}/records/${options.id}`, {
|
|
235
249
|
method: "DELETE",
|
|
236
|
-
headers: {
|
|
250
|
+
headers: {
|
|
251
|
+
Authorization: `Bearer ${readSessionToken()}`,
|
|
252
|
+
...refererHeader()
|
|
253
|
+
}
|
|
237
254
|
});
|
|
238
255
|
if (!res.ok) throw new Error(`datasource delete failed for action "${actionId}": ${await describeFailure(res)}`);
|
|
239
256
|
}
|
|
@@ -262,4 +279,4 @@ function withoutTrailingSlash(url) {
|
|
|
262
279
|
}
|
|
263
280
|
|
|
264
281
|
//#endregion
|
|
265
|
-
export { createRecord, deleteRecord, describeFailure, dsUrl, getRecord, listRecords, resolveTarget, updateRecord };
|
|
282
|
+
export { createRecord, deleteRecord, describeFailure, dsUrl, getRecord, listRecords, refererHeader, resolveTarget, updateRecord };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react5 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): react5.JSX.Element;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { DefaultErrorOverlay };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SoftrUserGroupId, SoftrUserGroups, User } from "./auth/user.js";
|
|
2
|
-
import { ActionPermissions, SoftrDatasources,
|
|
2
|
+
import { ActionPermissions, SoftrDatasources, defineIntegration, defineMutation, defineQuery, defineWorkflow } from "./action.js";
|
|
3
3
|
import { FileAttachment } from "./core/file-upload.js";
|
|
4
4
|
import { FileItem, useFileUpload } from "./core/use-file-upload.js";
|
|
5
|
-
import { CommentAttachmentInput, CommentMention, CommentThread, CommentView } from "./comments/comments.js";
|
|
6
5
|
import { DateOptions, DateParts, DateSeparator, DateValue, FixedDateFormat, FormattedDate, Formatting, FormattingScope, WeekDay, formatDate, formatDateTime, formatNumber, useFormatting } from "./formatting.js";
|
|
7
6
|
import { SoftrContext } from "./auth/context.js";
|
|
8
7
|
import { checkAccess, defineVisibility, isAuthorized } from "./visibility/visibility.js";
|
|
@@ -13,4 +12,4 @@ import { useUserTimezone } from "./timezone.js";
|
|
|
13
12
|
import { PwaInstall, PwaPlatform, SoftrPwaHead, usePwaInstall } from "./pwa.js";
|
|
14
13
|
import { DefaultErrorOverlay } from "./default-error-overlay.js";
|
|
15
14
|
import { Audience } from "./visibility/audience.js";
|
|
16
|
-
export { type ActionPermissions, Audience, type
|
|
15
|
+
export { type ActionPermissions, Audience, type DateOptions, type DateParts, type DateSeparator, type DateValue, DefaultErrorOverlay, type FileAttachment, type FileItem, type FixedDateFormat, FormattedDate, type Formatting, FormattingScope, type PwaInstall, type PwaPlatform, type SoftrContext, type SoftrDatasources, SoftrPwaHead, type SoftrUserGroupId, type SoftrUserGroups, type User, type WeekDay, assertRouteAccess, checkAccess, defineIntegration, defineMutation, defineQuery, defineVisibility, defineWorkflow, formatDate, formatDateTime, formatNumber, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, softrAuthMiddleware, softrMcpMiddleware, useCurrentUser, useFileUpload, useFormatting, usePwaInstall, useUserTimezone };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useFileUpload } from "./core/use-file-upload.js";
|
|
2
|
-
import {
|
|
2
|
+
import { defineIntegration, defineMutation, defineQuery, defineWorkflow } from "./action.js";
|
|
3
3
|
import { checkAccess, defineVisibility, isAuthorized } from "./visibility/visibility.js";
|
|
4
4
|
import { assertRouteAccess, guardRoute, isAccessError, isAlreadyAuthenticatedError, isForbiddenError, isUnauthenticatedError } from "./visibility/route.js";
|
|
5
5
|
import { FormattedDate, FormattingScope, formatDate, formatDateTime, formatNumber, useFormatting } from "./formatting.js";
|
|
@@ -10,4 +10,4 @@ import { useUserTimezone } from "./timezone.js";
|
|
|
10
10
|
import { DefaultErrorOverlay } from "./default-error-overlay.js";
|
|
11
11
|
import { Audience } from "./visibility/audience.js";
|
|
12
12
|
|
|
13
|
-
export { Audience, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess,
|
|
13
|
+
export { Audience, DefaultErrorOverlay, FormattedDate, FormattingScope, SoftrPwaHead, assertRouteAccess, checkAccess, defineIntegration, defineMutation, defineQuery, defineVisibility, defineWorkflow, formatDate, formatDateTime, formatNumber, getSoftrContext, guardRoute, initialSoftrContext, isAccessError, isAlreadyAuthenticatedError, isAuthorized, isForbiddenError, isUnauthenticatedError, softrAuthMiddleware, softrMcpMiddleware, useCurrentUser, useFileUpload, useFormatting, usePwaInstall, useUserTimezone };
|
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_start3 from "@tanstack/react-start";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
|
5
5
|
|
|
@@ -37,6 +37,6 @@ type SoftrMcpOptions = {
|
|
|
37
37
|
* ],
|
|
38
38
|
* }))
|
|
39
39
|
*/
|
|
40
|
-
declare function softrMcpMiddleware(options?: SoftrMcpOptions):
|
|
40
|
+
declare function softrMcpMiddleware(options?: SoftrMcpOptions): _tanstack_react_start3.RequestMiddlewareAfterServer<{}, undefined, undefined>;
|
|
41
41
|
//#endregion
|
|
42
42
|
export { softrMcpMiddleware };
|
package/dist/package.js
CHANGED
package/dist/pwa.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react3 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(): react3.FunctionComponentElement<react3.FragmentProps>;
|
|
27
27
|
type PwaPlatform = "ios" | "android" | "desktop";
|
|
28
28
|
type PwaInstall = {
|
|
29
29
|
available: false;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { upload } from "./core/file-upload.js";
|
|
2
|
-
import { comments } from "./comments/comments.js";
|
|
3
2
|
import { auth } from "./auth/server.js";
|
|
4
3
|
import { ds } from "./datasource/datasource.js";
|
|
5
4
|
import { workflow } from "./core/workflow.js";
|
|
6
5
|
import { integration } from "./core/integration.js";
|
|
7
6
|
import "@tanstack/react-start/server-only";
|
|
8
|
-
export { auth,
|
|
7
|
+
export { auth, ds, integration, upload, workflow };
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,6 @@ import { ds } from "./datasource/datasource.js";
|
|
|
3
3
|
import { auth } from "./auth/server.js";
|
|
4
4
|
import { workflow } from "./core/workflow.js";
|
|
5
5
|
import { integration } from "./core/integration.js";
|
|
6
|
-
import { comments } from "./comments/comments.js";
|
|
7
6
|
import "@tanstack/react-start/server-only";
|
|
8
7
|
|
|
9
|
-
export { auth,
|
|
8
|
+
export { auth, ds, integration, upload, workflow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softr/sdk",
|
|
3
|
-
"version": "0.0.62
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
@@ -17,8 +17,6 @@
|
|
|
17
17
|
"typecheck": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"marked": "^18.0.14",
|
|
21
|
-
"xss": "^1.0.15",
|
|
22
20
|
"zod": "^4.4.3"
|
|
23
21
|
},
|
|
24
22
|
"devDependencies": {
|
|
@@ -11,7 +11,7 @@ description: >-
|
|
|
11
11
|
metadata:
|
|
12
12
|
type: core
|
|
13
13
|
library: softr-sdk
|
|
14
|
-
library_version: 0.0.
|
|
14
|
+
library_version: 0.0.61
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
# Softr SDK core
|
|
@@ -29,9 +29,9 @@ Each sub-skill stands alone for its task and repeats the boundary above, so most
|
|
|
29
29
|
|
|
30
30
|
| Import | Runs | Holds |
|
|
31
31
|
| --- | --- | --- |
|
|
32
|
-
| `@softr/sdk` | Both | `defineQuery`, `defineMutation`, `
|
|
33
|
-
| `@softr/sdk/server` | Server only | `ds`, `auth`, `workflow`, `integration
|
|
34
|
-
| `@softr/sdk/client` | Browser only |
|
|
32
|
+
| `@softr/sdk` | Both | `defineQuery`, `defineMutation`, `defineVisibility`, `guardRoute`, `assertRouteAccess`, `isAuthorized`, `checkAccess`, `Audience`, `useCurrentUser`, `useUserTimezone`, `FormattedDate`, `FormattingScope`, `useFormatting`, `formatDate`, `formatDateTime`, `formatNumber`, `SoftrPwaHead`, `usePwaInstall`, `getSoftrContext`, `initialSoftrContext`, `softrAuthMiddleware`, the error predicates, and every type |
|
|
33
|
+
| `@softr/sdk/server` | Server only | `ds`, `auth`, `workflow`, `integration` |
|
|
34
|
+
| `@softr/sdk/client` | Browser only | Nothing yet, reserved for browser-only utilities |
|
|
35
35
|
| `@softr/sdk/vite` | Build | `softr()`, already in `vite.config.ts` |
|
|
36
36
|
|
|
37
37
|
## Sub-Skills
|
|
@@ -50,7 +50,6 @@ Each sub-skill stands alone for its task and repeats the boundary above, so most
|
|
|
50
50
|
| Open the app to AI assistants over MCP | [mcp/SKILL.md](./mcp/SKILL.md) |
|
|
51
51
|
| Let visitors install the app on their home screen | [pwa/SKILL.md](./pwa/SKILL.md) |
|
|
52
52
|
| Show a date, a time or a number | [formatting/SKILL.md](./formatting/SKILL.md) |
|
|
53
|
-
| Add comments to a record | [comments/SKILL.md](./comments/SKILL.md) |
|
|
54
53
|
|
|
55
54
|
## Quick Decision Tree
|
|
56
55
|
|
|
@@ -91,9 +90,6 @@ Adding an install button, or making the app installable?
|
|
|
91
90
|
Showing a date, a time or a number on a page?
|
|
92
91
|
load softr-sdk/formatting
|
|
93
92
|
|
|
94
|
-
Letting visitors comment on a record?
|
|
95
|
-
load softr-sdk/comments
|
|
96
|
-
|
|
97
93
|
Writing a server function, loader, or middleware in general?
|
|
98
94
|
not a Softr concern. Use the TanStack Start skills.
|
|
99
95
|
```
|
|
@@ -16,7 +16,7 @@ description: >-
|
|
|
16
16
|
metadata:
|
|
17
17
|
type: sub-skill
|
|
18
18
|
library: softr-sdk
|
|
19
|
-
library_version: 0.0.
|
|
19
|
+
library_version: 0.0.61
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
**Boundary.** `auth` lives on `@softr/sdk/server` and runs only inside a `createServerFn` handler — importing it into a component fails the build.
|
|
@@ -12,7 +12,7 @@ description: >-
|
|
|
12
12
|
metadata:
|
|
13
13
|
type: sub-skill
|
|
14
14
|
library: softr-sdk
|
|
15
|
-
library_version: 0.0.
|
|
15
|
+
library_version: 0.0.61
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
**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.
|
|
@@ -10,7 +10,7 @@ description: >-
|
|
|
10
10
|
metadata:
|
|
11
11
|
type: sub-skill
|
|
12
12
|
library: softr-sdk
|
|
13
|
-
library_version: 0.0.
|
|
13
|
+
library_version: 0.0.61
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
**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.
|
|
@@ -75,10 +75,9 @@ function ApplicationForm() {
|
|
|
75
75
|
|
|
76
76
|
```ts
|
|
77
77
|
type FileAttachment = {
|
|
78
|
-
url: string
|
|
79
|
-
filename: string
|
|
80
|
-
id: string
|
|
81
|
-
type?: string | null // content type from the upload response, or null when the platform doesn't know it
|
|
78
|
+
url: string // clean URL, no internal query params
|
|
79
|
+
filename: string // original filename
|
|
80
|
+
id: string // file id extracted from the upload response
|
|
82
81
|
}
|
|
83
82
|
```
|
|
84
83
|
|
|
@@ -10,7 +10,7 @@ description: >-
|
|
|
10
10
|
metadata:
|
|
11
11
|
type: sub-skill
|
|
12
12
|
library: softr-sdk
|
|
13
|
-
library_version: 0.0.
|
|
13
|
+
library_version: 0.0.61
|
|
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.
|
|
12
|
+
library_version: 0.0.61
|
|
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.
|
|
@@ -11,7 +11,7 @@ description: >-
|
|
|
11
11
|
metadata:
|
|
12
12
|
type: sub-skill
|
|
13
13
|
library: softr-sdk
|
|
14
|
-
library_version: 0.0.
|
|
14
|
+
library_version: 0.0.61
|
|
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.
|
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
metadata:
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: softr-sdk
|
|
16
|
-
library_version: 0.0.
|
|
16
|
+
library_version: 0.0.61
|
|
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.
|
|
@@ -13,7 +13,7 @@ description: >-
|
|
|
13
13
|
metadata:
|
|
14
14
|
type: sub-skill
|
|
15
15
|
library: softr-sdk
|
|
16
|
-
library_version: 0.0.
|
|
16
|
+
library_version: 0.0.61
|
|
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.
|
|
12
|
+
library_version: 0.0.61
|
|
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.
|