@softr/sdk 0.0.68 → 0.0.69
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/codegen/datasource-docs.js +1 -1
- package/dist/codegen/write-datasource-docs.js +13 -6
- package/dist/package.js +1 -1
- package/package.json +1 -1
- package/skills/softr-sdk/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/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
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
import { requireDefined } from "../assertions.js";
|
|
2
|
-
import { renderDatasourceDoc, renderDatasourceIndex } from "./datasource-docs.js";
|
|
2
|
+
import { DOC_NOTE, renderDatasourceDoc, renderDatasourceIndex } from "./datasource-docs.js";
|
|
3
3
|
import { renderDatasourceSchema } from "./datasource-schema.js";
|
|
4
4
|
import { docFileNames } from "./doc-file-names.js";
|
|
5
5
|
import { writeIfChanged } from "./write-if-changed.js";
|
|
6
|
+
import { existsSync, readFileSync, readdirSync, rmSync } from "node:fs";
|
|
6
7
|
import path from "node:path";
|
|
7
8
|
|
|
8
9
|
//#region src/codegen/write-datasource-docs.ts
|
|
9
10
|
/**
|
|
10
|
-
* Writes the index, and one doc and one schema JSON per datasource, and
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* wrote now reads differently.
|
|
11
|
+
* Writes the index, and one doc and one schema JSON per datasource, and removes the doc and schema
|
|
12
|
+
* of a datasource no longer registered. It removes only a doc that carries the generated note: the
|
|
13
|
+
* caller resolves `docsDir` against `process.cwd()`, which can be any directory a developer ran the
|
|
14
|
+
* bin from. `changed` is true when any file it wrote now reads differently, or it removed one.
|
|
14
15
|
*/
|
|
15
16
|
function writeDatasourceDocs(datasources, docsDir) {
|
|
16
17
|
const context = {
|
|
17
18
|
datasources: new Map(datasources.map((datasource) => [datasource.id, datasource])),
|
|
18
19
|
fileNames: docFileNames(datasources)
|
|
19
20
|
};
|
|
21
|
+
const current = new Set(context.fileNames.values());
|
|
22
|
+
const stale = (existsSync(docsDir) ? readdirSync(docsDir, { withFileTypes: true }) : []).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => entry.name).filter((name) => !current.has(name) && readFileSync(path.join(docsDir, name), "utf8").includes(DOC_NOTE));
|
|
23
|
+
for (const name of stale) {
|
|
24
|
+
rmSync(path.join(docsDir, name));
|
|
25
|
+
rmSync(path.join(docsDir, name.replace(/\.md$/, ".json")), { force: true });
|
|
26
|
+
}
|
|
20
27
|
const writes = [
|
|
21
28
|
writeIfChanged(path.join(docsDir, "README.md"), renderDatasourceIndex(datasources, context)),
|
|
22
29
|
...datasources.map((datasource) => writeIfChanged(path.join(docsDir, requireDefined(context.fileNames.get(datasource.id))), renderDatasourceDoc(datasource, context))),
|
|
@@ -24,7 +31,7 @@ function writeDatasourceDocs(datasources, docsDir) {
|
|
|
24
31
|
];
|
|
25
32
|
return {
|
|
26
33
|
fileNames: context.fileNames,
|
|
27
|
-
changed: writes.includes(true)
|
|
34
|
+
changed: stale.length > 0 || writes.includes(true)
|
|
28
35
|
};
|
|
29
36
|
}
|
|
30
37
|
|
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ description: >-
|
|
|
19
19
|
metadata:
|
|
20
20
|
type: sub-skill
|
|
21
21
|
library: softr-sdk
|
|
22
|
-
library_version: 0.0.
|
|
22
|
+
library_version: 0.0.69
|
|
23
23
|
---
|
|
24
24
|
|
|
25
25
|
**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.69
|
|
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.69
|
|
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.
|
|
@@ -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.69
|
|
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.69
|
|
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.69
|
|
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.69
|
|
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.
|
|
@@ -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.69
|
|
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.
|