@rc312/tss-effect-serverfn 0.1.0 → 0.2.0
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/LICENSE +0 -0
- package/README.md +4 -4
- package/dist/bootstrap.server.d.ts +0 -0
- package/dist/bootstrap.server.d.ts.map +0 -0
- package/dist/bootstrap.server.js +0 -0
- package/dist/bootstrap.server.js.map +0 -0
- package/dist/boundary.server.d.ts +0 -0
- package/dist/boundary.server.d.ts.map +0 -0
- package/dist/boundary.server.js +0 -0
- package/dist/boundary.server.js.map +0 -0
- package/dist/compiler-runtime.d.ts +0 -0
- package/dist/compiler-runtime.d.ts.map +0 -0
- package/dist/compiler-runtime.js +0 -0
- package/dist/compiler-runtime.js.map +0 -0
- package/dist/create-effect-server-fn.d.ts +0 -0
- package/dist/create-effect-server-fn.d.ts.map +0 -0
- package/dist/create-effect-server-fn.js +0 -0
- package/dist/create-effect-server-fn.js.map +0 -0
- package/dist/effect-middleware.d.ts +0 -0
- package/dist/effect-middleware.d.ts.map +0 -0
- package/dist/effect-middleware.js +0 -0
- package/dist/effect-middleware.js.map +0 -0
- package/dist/execution.d.ts +0 -0
- package/dist/execution.d.ts.map +0 -0
- package/dist/execution.js +0 -0
- package/dist/execution.js.map +0 -0
- package/dist/failure.server.d.ts +0 -0
- package/dist/failure.server.d.ts.map +0 -0
- package/dist/failure.server.js +0 -0
- package/dist/failure.server.js.map +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.d.ts.map +0 -0
- package/dist/index.js +0 -0
- package/dist/index.js.map +0 -0
- package/dist/provenance.server.d.ts +0 -0
- package/dist/provenance.server.d.ts.map +0 -0
- package/dist/provenance.server.js +0 -0
- package/dist/provenance.server.js.map +0 -0
- package/dist/server.d.ts +0 -0
- package/dist/server.d.ts.map +0 -0
- package/dist/server.js +0 -0
- package/dist/server.js.map +0 -0
- package/dist/vite.d.ts +0 -0
- package/dist/vite.d.ts.map +0 -0
- package/dist/vite.js +0 -0
- package/dist/vite.js.map +0 -0
- package/docs/composition.md +2 -2
- package/docs/development.md +48 -0
- package/docs/usage.md +1 -1
- package/package.json +9 -7
- package/src/bootstrap.server.ts +0 -0
- package/src/boundary.server.ts +0 -0
- package/src/compiler-runtime.ts +0 -0
- package/src/create-effect-server-fn.ts +0 -0
- package/src/effect-middleware.ts +0 -0
- package/src/execution.ts +0 -0
- package/src/failure.server.ts +0 -0
- package/src/index.ts +0 -0
- package/src/provenance.server.ts +0 -0
- package/src/server.ts +0 -0
- package/src/vite.ts +0 -0
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Write TanStack Start server functions with **Effect Schemas and Effect handlers*
|
|
|
7
7
|
In an existing **TanStack React Start** app using **Effect 4**:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
bun add @rc312/tss-effect-serverfn 'effect@^4.
|
|
10
|
+
bun add @rc312/tss-effect-serverfn 'effect@^4.1.2'
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### 1. Register the Vite plugin
|
|
@@ -120,8 +120,8 @@ The three environment helpers return lazy Effects for composition. Use `yield*`
|
|
|
120
120
|
## More
|
|
121
121
|
|
|
122
122
|
- [Composition examples: pipe, flow, Effect.fn, and combinators](docs/composition.md)
|
|
123
|
-
- [Runnable basic and service examples](
|
|
123
|
+
- [Runnable basic and service examples](examples)
|
|
124
124
|
- [Application services, errors, reporting, and execution details](docs/usage.md)
|
|
125
|
-
- [Workspace development](
|
|
125
|
+
- [Workspace development](docs/development.md)
|
|
126
126
|
|
|
127
|
-
Tested with Effect 4.
|
|
127
|
+
Tested with Effect 4.1.2, React Start 1.169.2, and Vite 8.3.4. Supported peer ranges are in `package.json`.
|
|
File without changes
|
|
File without changes
|
package/dist/bootstrap.server.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/boundary.server.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/compiler-runtime.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/execution.d.ts
CHANGED
|
File without changes
|
package/dist/execution.d.ts.map
CHANGED
|
File without changes
|
package/dist/execution.js
CHANGED
|
File without changes
|
package/dist/execution.js.map
CHANGED
|
File without changes
|
package/dist/failure.server.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/failure.server.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.d.ts.map
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/index.js.map
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/server.d.ts
CHANGED
|
File without changes
|
package/dist/server.d.ts.map
CHANGED
|
File without changes
|
package/dist/server.js
CHANGED
|
File without changes
|
package/dist/server.js.map
CHANGED
|
File without changes
|
package/dist/vite.d.ts
CHANGED
|
File without changes
|
package/dist/vite.d.ts.map
CHANGED
|
File without changes
|
package/dist/vite.js
CHANGED
|
File without changes
|
package/dist/vite.js.map
CHANGED
|
File without changes
|
package/docs/composition.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Handlers can return any native Effect. `Effect.gen`, `pipe`, `.pipe`, `flow`, `Effect.fn`, and do notation all use the same configured runtime, decoded input, and request Scope.
|
|
4
4
|
|
|
5
|
-
Start with the [configured factory](../README.md#quick-start). Try the examples in the [basic app](
|
|
5
|
+
Start with the [configured factory](../README.md#quick-start). Try the examples in the [basic app](../examples/basic): its **Composition** selector runs five equivalent server functions through real RPCs.
|
|
6
6
|
|
|
7
7
|
## Choose a composition style
|
|
8
8
|
|
|
@@ -136,7 +136,7 @@ Each step retains earlier fields. A later `bind` or `let` callback can use those
|
|
|
136
136
|
|
|
137
137
|
## Pipe service work and recover a business error
|
|
138
138
|
|
|
139
|
-
The [services app](
|
|
139
|
+
The [services app](../examples/services) provides `Notes` through its application-owned `ManagedRuntime`. Its `notes.functions.ts` composes the service directly:
|
|
140
140
|
|
|
141
141
|
```ts
|
|
142
142
|
import { Effect, flow, Schema } from "effect";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Package development
|
|
2
|
+
|
|
3
|
+
Run the following commands from the repository root unless noted otherwise.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
Use Bun 1.3.13 and Node.js 22.19 or newer.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
bun install
|
|
11
|
+
bun run check # lint, builds, typechecks, and package tests
|
|
12
|
+
bun run build # package and example builds through Turbo
|
|
13
|
+
bun run dev # package watcher and both example dev servers
|
|
14
|
+
bun run format # apply formatting and safe lint fixes
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The package builds with standard `tsc -b`. Effect and TanStack are peers so applications share the same runtime and framework instances.
|
|
18
|
+
|
|
19
|
+
## Browser tests
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
(cd packages/tss-effect-serverfn && bunx --no-install playwright install chromium)
|
|
23
|
+
bun run test:e2e
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The suite runs both examples against Vite dev and production preview, using real browser interactions and RPC responses. See [E2E coverage and debugging](../e2e/README.md). Failures retain Playwright traces and screenshots in the package directory.
|
|
27
|
+
|
|
28
|
+
## TypeScript configuration
|
|
29
|
+
|
|
30
|
+
`tsconfig.base.json` holds shared strict compiler settings and Effect diagnostics. Each package extends it with its own source include. The root `tsconfig.json` is a solution config: add a project reference there when adding a package, and add package-level references for workspace dependencies.
|
|
31
|
+
|
|
32
|
+
`bunx tsc -b` builds the package solution. Examples use Vite-oriented TypeScript configs and `noEmit`. `bun run typecheck` builds first so generated route types and package exports exist, then checks the package, both apps, and E2E code. Package builds emit JavaScript, declarations, and maps into `dist/`; the published package includes `src/` so map navigation works.
|
|
33
|
+
|
|
34
|
+
## Releases
|
|
35
|
+
|
|
36
|
+
The package is published as `@rc312/tss-effect-serverfn` under the MIT license. Nothing is published automatically on push.
|
|
37
|
+
|
|
38
|
+
1. Run `bun run changeset` and commit the generated changeset with your changes.
|
|
39
|
+
2. Run `bun run version-packages`, then `bun install` to refresh the lockfile. Commit the version changes, changelog, and lockfile to `main`.
|
|
40
|
+
3. Inspect the artifact locally:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
bun run check
|
|
44
|
+
cd packages/tss-effect-serverfn
|
|
45
|
+
npm pack --dry-run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
4. To publish locally, authenticate with `npm login`, return to the root, and run `bun run release`. Changesets publishes only unreleased package versions. Push any generated version tags if you want them recorded on GitHub.
|
package/docs/usage.md
CHANGED
|
@@ -204,7 +204,7 @@ Optional fields returned by `resolve`:
|
|
|
204
204
|
| `reportFailure(report)` | Effect-valued replacement for the default reporting action |
|
|
205
205
|
| `reportTimeout` | Native `Duration.Input`; defaults to `"5 seconds"` for the override |
|
|
206
206
|
|
|
207
|
-
An override is awaited after request-scope cleanup, with application services and request metadata. Its faults/timeouts cannot replace the business rejection. Use `Effect.tryPromise` and its signal for foreign reporters. Compose `ErrorReporter.report` explicitly if the override should also invoke native reporters. ErrorReporter and the HTTP request APIs are unstable in Effect 4.
|
|
207
|
+
An override is awaited after request-scope cleanup, with application services and request metadata. Its faults/timeouts cannot replace the business rejection. Use `Effect.tryPromise` and its signal for foreign reporters. Compose `ErrorReporter.report` explicitly if the override should also invoke native reporters. ErrorReporter and the HTTP request APIs are unstable in Effect 4.1.2.
|
|
208
208
|
|
|
209
209
|
For outer framework reporting, `@rc312/tss-effect-serverfn/server` exports:
|
|
210
210
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rc312/tss-effect-serverfn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Typed Effect execution and safe failure boundaries for TanStack Start server functions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/RyanCallahan312/
|
|
8
|
+
"url": "git+https://github.com/RyanCallahan312/effect-extensions.git",
|
|
9
9
|
"directory": "packages/tss-effect-serverfn"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc -b tsconfig.json",
|
|
34
34
|
"dev": "tsc -b tsconfig.json --watch",
|
|
35
|
-
"typecheck": "tsc --noEmit -p tsconfig.json --tsBuildInfoFile .cache/typecheck.tsbuildinfo && tsc -p tsconfig.test.json && tsc -p tsconfig.fixtures.json",
|
|
35
|
+
"typecheck": "tsc --noEmit -p tsconfig.json --tsBuildInfoFile .cache/typecheck.tsbuildinfo && tsc -p tsconfig.test.json && tsc -p tsconfig.fixtures.json && tsc -p e2e/tsconfig.json",
|
|
36
36
|
"test": "vitest run && node --test test/*.test.mjs",
|
|
37
|
-
"prepack": "bun run build"
|
|
37
|
+
"prepack": "bun run build",
|
|
38
|
+
"test:e2e": "playwright test"
|
|
38
39
|
},
|
|
39
40
|
"dependencies": {
|
|
40
41
|
"@babel/core": "^7.29.7",
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
"@standard-schema/spec": "^1.1.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@effect/vitest": "^4.
|
|
46
|
+
"@effect/vitest": "^4.1.2",
|
|
47
|
+
"@playwright/test": "^1.64.1",
|
|
46
48
|
"@tanstack/react-router": "1.170.44",
|
|
47
49
|
"@tanstack/start-storage-context": "^1.167.39",
|
|
48
50
|
"@types/babel__core": "^7.20.5",
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
"peerDependencies": {
|
|
56
58
|
"@tanstack/react-start": "^1.169.2",
|
|
57
59
|
"@tanstack/router-core": "^1.171.37",
|
|
58
|
-
"effect": "^4.
|
|
60
|
+
"effect": "^4.1.2",
|
|
59
61
|
"vite": "^8.3.4"
|
|
60
62
|
},
|
|
61
63
|
"peerDependenciesMeta": {
|
|
@@ -64,6 +66,6 @@
|
|
|
64
66
|
}
|
|
65
67
|
},
|
|
66
68
|
"engines": {
|
|
67
|
-
"node": ">=22.
|
|
69
|
+
"node": ">=22.19.0"
|
|
68
70
|
}
|
|
69
71
|
}
|
package/src/bootstrap.server.ts
CHANGED
|
File without changes
|
package/src/boundary.server.ts
CHANGED
|
File without changes
|
package/src/compiler-runtime.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/src/effect-middleware.ts
CHANGED
|
File without changes
|
package/src/execution.ts
CHANGED
|
File without changes
|
package/src/failure.server.ts
CHANGED
|
File without changes
|
package/src/index.ts
CHANGED
|
File without changes
|
package/src/provenance.server.ts
CHANGED
|
File without changes
|
package/src/server.ts
CHANGED
|
File without changes
|
package/src/vite.ts
CHANGED
|
File without changes
|