@effect-app/vue 4.0.0-beta.26 → 4.0.0-beta.261
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/CHANGELOG.md +1929 -0
- package/dist/commander.d.ts +634 -0
- package/dist/commander.d.ts.map +1 -0
- package/dist/commander.js +1070 -0
- package/dist/confirm.d.ts +21 -0
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +26 -0
- package/dist/dependencyMetadata.d.ts +8 -0
- package/dist/dependencyMetadata.d.ts.map +1 -0
- package/dist/dependencyMetadata.js +6 -0
- package/dist/errorReporter.d.ts +7 -5
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +14 -19
- package/dist/form.d.ts +15 -6
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +46 -13
- package/dist/index.d.ts +1 -1
- package/dist/intl.d.ts +15 -0
- package/dist/intl.d.ts.map +1 -0
- package/dist/intl.js +9 -0
- package/dist/lib.d.ts +8 -10
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +35 -10
- package/dist/makeClient.d.ts +157 -343
- package/dist/makeClient.d.ts.map +1 -1
- package/dist/makeClient.js +216 -376
- package/dist/makeContext.d.ts +1 -1
- package/dist/makeContext.d.ts.map +1 -1
- package/dist/makeIntl.d.ts +1 -1
- package/dist/makeIntl.d.ts.map +1 -1
- package/dist/makeUseCommand.d.ts +9 -0
- package/dist/makeUseCommand.d.ts.map +1 -0
- package/dist/makeUseCommand.js +13 -0
- package/dist/mutate.d.ts +97 -39
- package/dist/mutate.d.ts.map +1 -1
- package/dist/mutate.js +177 -49
- package/dist/query.d.ts +24 -39
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +156 -78
- package/dist/routeParams.d.ts +5 -5
- package/dist/routeParams.d.ts.map +1 -1
- package/dist/routeParams.js +4 -3
- package/dist/runtime.d.ts +2 -15
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +2 -26
- package/dist/toast.d.ts +2 -0
- package/dist/toast.d.ts.map +1 -0
- package/dist/toast.js +2 -0
- package/dist/withToast.d.ts +2 -0
- package/dist/withToast.d.ts.map +1 -0
- package/dist/withToast.js +2 -0
- package/examples/streamMutation.ts +72 -0
- package/package.json +29 -90
- package/src/commander.ts +3406 -0
- package/src/{experimental/confirm.ts → confirm.ts} +12 -14
- package/src/errorReporter.ts +65 -75
- package/src/form.ts +61 -18
- package/src/intl.ts +12 -0
- package/src/lib.ts +48 -20
- package/src/makeClient.ts +581 -1138
- package/src/{experimental/makeUseCommand.ts → makeUseCommand.ts} +8 -5
- package/src/mutate.ts +335 -134
- package/src/query.ts +241 -183
- package/src/routeParams.ts +7 -7
- package/src/runtime.ts +1 -31
- package/src/toast.ts +1 -0
- package/src/withToast.ts +1 -0
- package/test/Mutation.test.ts +181 -24
- package/test/dist/dependencyInvalidation.test.d.ts.map +1 -0
- package/test/dist/form.test.d.ts.map +1 -1
- package/test/dist/lib.test.d.ts.map +1 -0
- package/test/dist/streamFinal.test.d.ts.map +1 -0
- package/test/dist/streamFn.test.d.ts.map +1 -0
- package/test/dist/stubs.d.ts +3527 -122
- package/test/dist/stubs.d.ts.map +1 -1
- package/test/dist/stubs.js +187 -32
- package/test/form-validation-errors.test.ts +25 -20
- package/test/form.test.ts +22 -3
- package/test/lib.test.ts +240 -0
- package/test/makeClient.test.ts +327 -38
- package/test/streamFinal.test.ts +64 -0
- package/test/streamFn.test.ts +457 -0
- package/test/stubs.ts +223 -43
- package/tsconfig.examples.json +20 -0
- package/tsconfig.json +2 -1
- package/tsconfig.json.bak +5 -2
- package/tsconfig.src.json +34 -34
- package/tsconfig.test.json +2 -2
- package/vitest.config.ts +5 -5
- package/dist/experimental/commander.d.ts +0 -359
- package/dist/experimental/commander.d.ts.map +0 -1
- package/dist/experimental/commander.js +0 -557
- package/dist/experimental/confirm.d.ts +0 -19
- package/dist/experimental/confirm.d.ts.map +0 -1
- package/dist/experimental/confirm.js +0 -28
- package/dist/experimental/intl.d.ts +0 -16
- package/dist/experimental/intl.d.ts.map +0 -1
- package/dist/experimental/intl.js +0 -5
- package/dist/experimental/makeUseCommand.d.ts +0 -8
- package/dist/experimental/makeUseCommand.d.ts.map +0 -1
- package/dist/experimental/makeUseCommand.js +0 -13
- package/dist/experimental/toast.d.ts +0 -47
- package/dist/experimental/toast.d.ts.map +0 -1
- package/dist/experimental/toast.js +0 -41
- package/dist/experimental/withToast.d.ts +0 -25
- package/dist/experimental/withToast.d.ts.map +0 -1
- package/dist/experimental/withToast.js +0 -45
- package/eslint.config.mjs +0 -24
- package/src/experimental/commander.ts +0 -1835
- package/src/experimental/intl.ts +0 -9
- package/src/experimental/toast.ts +0 -66
- package/src/experimental/withToast.ts +0 -99
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: stream-based mutation for a long-running operation.
|
|
3
|
+
*
|
|
4
|
+
* The server streams a tagged union of progress updates and a final result.
|
|
5
|
+
* The Vue ref is updated for every emitted value; `AsyncResult` stays in the
|
|
6
|
+
* `waiting` state until the stream ends.
|
|
7
|
+
*
|
|
8
|
+
* When using `makeClient` / `clientFor`, stream-type requests are exposed as
|
|
9
|
+
* `mutate` on the client object. Use `client.exportData.mutate` with `streamFn`
|
|
10
|
+
* combinators, or use `client.exportData.fn` to define a full command.
|
|
11
|
+
*
|
|
12
|
+
* The example below shows the low-level `asStreamResult` API.
|
|
13
|
+
*/
|
|
14
|
+
import * as Effect from "effect-app/Effect"
|
|
15
|
+
import * as S from "effect-app/Schema"
|
|
16
|
+
import * as Stream from "effect/Stream"
|
|
17
|
+
import { asStreamResult } from "../src/mutate.js"
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Domain model
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
/** Intermediate progress report, e.g. "5 of 400 items processed". */
|
|
24
|
+
export class OperationProgress extends S.TaggedClass<OperationProgress>()("OperationProgress", {
|
|
25
|
+
completed: S.NonNegativeInt,
|
|
26
|
+
total: S.NonNegativeInt
|
|
27
|
+
}) {}
|
|
28
|
+
|
|
29
|
+
/** The final result produced once the operation is complete. */
|
|
30
|
+
export class ExportComplete extends S.TaggedClass<ExportComplete>()("ExportComplete", {
|
|
31
|
+
fileUrl: S.NonEmptyString
|
|
32
|
+
}) {}
|
|
33
|
+
|
|
34
|
+
/** Tagged union emitted by the stream. */
|
|
35
|
+
export type ExportEvent = OperationProgress | ExportComplete
|
|
36
|
+
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// Simulated stream (replace with a real RPC / SSE stream in production)
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Produces `total` progress updates followed by a single `ExportComplete`.
|
|
43
|
+
* Each step is separated by a 50 ms delay to simulate real async work.
|
|
44
|
+
*/
|
|
45
|
+
const makeExportStream = (total: S.NonNegativeInt): Stream.Stream<ExportEvent> =>
|
|
46
|
+
Stream.concat(
|
|
47
|
+
Stream.range(1, total).pipe(
|
|
48
|
+
Stream.map((completed) => new OperationProgress({ completed: S.NonNegativeInt(completed), total })),
|
|
49
|
+
Stream.tap(() => Effect.sleep("50 millis"))
|
|
50
|
+
),
|
|
51
|
+
Stream.make(new ExportComplete({ fileUrl: S.NonEmptyString("https://example.com/export.csv") }))
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Option A: low-level `asStreamResult` (call inside a `setup()` function)
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
export const useExportMutation = () => {
|
|
59
|
+
/**
|
|
60
|
+
* `result` - reactive ref, always reflects the latest stream event.
|
|
61
|
+
* `AsyncResult` tag:
|
|
62
|
+
* - Initial (waiting=true) - operation in progress
|
|
63
|
+
* - Success (waiting=true) - progress update received, still running
|
|
64
|
+
* - Success (waiting=false) - final result, operation complete
|
|
65
|
+
* - Failure - operation failed
|
|
66
|
+
*
|
|
67
|
+
* `execute` - call with the desired `total` to kick off the stream.
|
|
68
|
+
*/
|
|
69
|
+
const [result, execute] = asStreamResult((total: S.NonNegativeInt) => makeExportStream(total))
|
|
70
|
+
|
|
71
|
+
return { result, execute }
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.261",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/effect-ts-app/libs/tree/main/packages/vue",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@formatjs/intl": "^4.1.
|
|
9
|
-
"@tanstack/query-core": "5.
|
|
10
|
-
"@tanstack/vue-query": "5.
|
|
11
|
-
"@vueuse/core": "^14.
|
|
8
|
+
"@formatjs/intl": "^4.1.9",
|
|
9
|
+
"@tanstack/query-core": "5.96.2",
|
|
10
|
+
"@tanstack/vue-query": "5.96.2",
|
|
11
|
+
"@vueuse/core": "^14.3.0",
|
|
12
12
|
"change-case": "^5.4.4",
|
|
13
13
|
"query-string": "^9.3.1",
|
|
14
|
-
"effect-app": "4.0.0-beta.
|
|
14
|
+
"effect-app": "4.0.0-beta.261"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@effect/atom-vue": "^4.0.0-beta.
|
|
18
|
-
"@effect/platform-browser": "^4.0.0-beta.
|
|
19
|
-
"@sentry/browser": "^10.
|
|
20
|
-
"effect": "^4.0.0-beta.
|
|
21
|
-
"vue": "^3.5.
|
|
17
|
+
"@effect/atom-vue": "^4.0.0-beta.0",
|
|
18
|
+
"@effect/platform-browser": "^4.0.0-beta.74",
|
|
19
|
+
"@sentry/browser": "^10.51.0",
|
|
20
|
+
"effect": "^4.0.0-beta.74",
|
|
21
|
+
"vue": "^3.5.34"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@effect/vitest": "
|
|
25
|
-
"@formatjs/icu-messageformat-parser": "^3.5.
|
|
26
|
-
"@types/node": "25.
|
|
27
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
28
|
-
"intl-messageformat": "^11.
|
|
24
|
+
"@effect/vitest": "4.0.0-beta.74",
|
|
25
|
+
"@formatjs/icu-messageformat-parser": "^3.5.7",
|
|
26
|
+
"@types/node": "25.6.0",
|
|
27
|
+
"@vitejs/plugin-vue": "^6.0.6",
|
|
28
|
+
"intl-messageformat": "^11.2.4",
|
|
29
29
|
"json5": "^2.2.3",
|
|
30
|
-
"typescript": "~
|
|
31
|
-
"vite": "^
|
|
32
|
-
"vitest": "^4.
|
|
33
|
-
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
30
|
+
"typescript": "~6.0.3",
|
|
31
|
+
"vite": "^8.0.10",
|
|
32
|
+
"vitest": "^4.1.5"
|
|
34
33
|
},
|
|
35
34
|
"typesVersions": {
|
|
36
35
|
"*": {
|
|
@@ -44,69 +43,10 @@
|
|
|
44
43
|
"types": "./dist/index.d.ts",
|
|
45
44
|
"default": "./dist/index.js"
|
|
46
45
|
},
|
|
47
|
-
"./
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"./experimental/commander": {
|
|
52
|
-
"types": "./dist/experimental/commander.d.ts",
|
|
53
|
-
"default": "./dist/experimental/commander.js"
|
|
54
|
-
},
|
|
55
|
-
"./experimental/confirm": {
|
|
56
|
-
"types": "./dist/experimental/confirm.d.ts",
|
|
57
|
-
"default": "./dist/experimental/confirm.js"
|
|
58
|
-
},
|
|
59
|
-
"./experimental/intl": {
|
|
60
|
-
"types": "./dist/experimental/intl.d.ts",
|
|
61
|
-
"default": "./dist/experimental/intl.js"
|
|
62
|
-
},
|
|
63
|
-
"./experimental/makeUseCommand": {
|
|
64
|
-
"types": "./dist/experimental/makeUseCommand.d.ts",
|
|
65
|
-
"default": "./dist/experimental/makeUseCommand.js"
|
|
66
|
-
},
|
|
67
|
-
"./experimental/toast": {
|
|
68
|
-
"types": "./dist/experimental/toast.d.ts",
|
|
69
|
-
"default": "./dist/experimental/toast.js"
|
|
70
|
-
},
|
|
71
|
-
"./experimental/withToast": {
|
|
72
|
-
"types": "./dist/experimental/withToast.d.ts",
|
|
73
|
-
"default": "./dist/experimental/withToast.js"
|
|
74
|
-
},
|
|
75
|
-
"./form": {
|
|
76
|
-
"types": "./dist/form.d.ts",
|
|
77
|
-
"default": "./dist/form.js"
|
|
78
|
-
},
|
|
79
|
-
"./lib": {
|
|
80
|
-
"types": "./dist/lib.d.ts",
|
|
81
|
-
"default": "./dist/lib.js"
|
|
82
|
-
},
|
|
83
|
-
"./makeClient": {
|
|
84
|
-
"types": "./dist/makeClient.d.ts",
|
|
85
|
-
"default": "./dist/makeClient.js"
|
|
86
|
-
},
|
|
87
|
-
"./makeContext": {
|
|
88
|
-
"types": "./dist/makeContext.d.ts",
|
|
89
|
-
"default": "./dist/makeContext.js"
|
|
90
|
-
},
|
|
91
|
-
"./makeIntl": {
|
|
92
|
-
"types": "./dist/makeIntl.d.ts",
|
|
93
|
-
"default": "./dist/makeIntl.js"
|
|
94
|
-
},
|
|
95
|
-
"./mutate": {
|
|
96
|
-
"types": "./dist/mutate.d.ts",
|
|
97
|
-
"default": "./dist/mutate.js"
|
|
98
|
-
},
|
|
99
|
-
"./query": {
|
|
100
|
-
"types": "./dist/query.d.ts",
|
|
101
|
-
"default": "./dist/query.js"
|
|
102
|
-
},
|
|
103
|
-
"./routeParams": {
|
|
104
|
-
"types": "./dist/routeParams.d.ts",
|
|
105
|
-
"default": "./dist/routeParams.js"
|
|
106
|
-
},
|
|
107
|
-
"./runtime": {
|
|
108
|
-
"types": "./dist/runtime.d.ts",
|
|
109
|
-
"default": "./dist/runtime.js"
|
|
46
|
+
"./internal/*": null,
|
|
47
|
+
"./*": {
|
|
48
|
+
"types": "./dist/*.d.ts",
|
|
49
|
+
"default": "./dist/*.js"
|
|
110
50
|
}
|
|
111
51
|
},
|
|
112
52
|
"gitHead": "bd8e27eea3eff97db8739d577d67e7336c078d28",
|
|
@@ -120,19 +60,18 @@
|
|
|
120
60
|
],
|
|
121
61
|
"scripts": {
|
|
122
62
|
"watch": "pnpm build:tsc -w",
|
|
123
|
-
"build:tsc": "pnpm clean-dist &&
|
|
124
|
-
"check": "
|
|
63
|
+
"build:tsc": "pnpm clean-dist && pnpm check",
|
|
64
|
+
"check": "tsgo --build",
|
|
125
65
|
"build": "pnpm build:tsc",
|
|
126
|
-
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144
|
|
66
|
+
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
|
|
127
67
|
"clean": "rm -rf dist",
|
|
128
68
|
"clean-dist": "sh ../../scripts/clean-dist.sh",
|
|
129
69
|
"circular": "pnpm circular:src && pnpm circular:dist",
|
|
130
70
|
"circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
|
|
131
71
|
"circular:dist": "madge --circular --extensions js ./dist",
|
|
132
|
-
"compile": "NODE_OPTIONS=--max-old-space-size=6144
|
|
133
|
-
"lint": "
|
|
134
|
-
"lint
|
|
135
|
-
"lint-fix": "pnpm lint --fix",
|
|
72
|
+
"compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
|
|
73
|
+
"lint": "oxlint --quiet --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
74
|
+
"lint-fix": "oxlint --quiet --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
136
75
|
"test": "vitest",
|
|
137
76
|
"test:run": "pnpm run test run --passWithNoTests",
|
|
138
77
|
"testsuite": "pnpm lint && pnpm circular && pnpm run test:run",
|