@effect-app/vue 4.0.0-beta.33 → 4.0.0-beta.331
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 +2463 -0
- package/dist/atomQuery.d.ts +120 -0
- package/dist/atomQuery.d.ts.map +1 -0
- package/dist/atomQuery.js +434 -0
- package/dist/commander.d.ts +634 -0
- package/dist/commander.d.ts.map +1 -0
- package/dist/commander.js +1068 -0
- package/dist/{experimental/confirm.d.ts → confirm.d.ts} +6 -4
- package/dist/confirm.d.ts.map +1 -0
- package/dist/confirm.js +26 -0
- package/dist/dependencyMetadata.d.ts +18 -0
- package/dist/dependencyMetadata.d.ts.map +1 -0
- package/dist/dependencyMetadata.js +67 -0
- package/dist/errorReporter.d.ts +6 -4
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +14 -19
- package/dist/form.d.ts +5 -5
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +42 -16
- package/dist/internal/tanstackQuery.d.ts +9 -0
- package/dist/internal/tanstackQuery.d.ts.map +1 -0
- package/dist/internal/tanstackQuery.js +204 -0
- 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 +7 -9
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +35 -10
- package/dist/liveQueryInvalidation.d.ts +16 -0
- package/dist/liveQueryInvalidation.d.ts.map +1 -0
- package/dist/liveQueryInvalidation.js +115 -0
- package/dist/makeClient.d.ts +236 -336
- package/dist/makeClient.d.ts.map +1 -1
- package/dist/makeClient.js +417 -408
- package/dist/makeContext.d.ts.map +1 -1
- package/dist/makeIntl.d.ts.map +1 -1
- package/dist/{experimental/makeUseCommand.d.ts → makeUseCommand.d.ts} +4 -3
- package/dist/makeUseCommand.d.ts.map +1 -0
- package/dist/makeUseCommand.js +13 -0
- package/dist/mutate.d.ts +109 -40
- package/dist/mutate.d.ts.map +1 -1
- package/dist/mutate.js +235 -58
- package/dist/query.d.ts +158 -45
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +380 -122
- package/dist/queryLifetime.d.ts +25 -0
- package/dist/queryLifetime.d.ts.map +1 -0
- package/dist/queryLifetime.js +54 -0
- package/dist/routeParams.d.ts +4 -4
- package/dist/routeParams.d.ts.map +1 -1
- package/dist/routeParams.js +4 -3
- package/dist/runtime.d.ts +1 -14
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +2 -26
- package/dist/suspense.d.ts +19 -0
- package/dist/suspense.d.ts.map +1 -0
- package/dist/suspense.js +38 -0
- 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/docs/atom-query-api-redesign.md +207 -0
- package/docs/mutation-command-atoms.md +40 -0
- package/docs/query-key-invalidation.md +107 -0
- package/examples/streamMutation.ts +72 -0
- package/package.json +36 -95
- package/src/atomQuery.ts +600 -0
- package/src/commander.ts +3408 -0
- package/src/{experimental/confirm.ts → confirm.ts} +13 -15
- package/src/dependencyMetadata.ts +84 -0
- package/src/errorReporter.ts +65 -75
- package/src/form.ts +57 -21
- package/src/index.ts +7 -7
- package/src/internal/tanstackQuery.ts +308 -0
- package/src/intl.ts +12 -0
- package/src/lib.ts +49 -21
- package/src/liveQueryInvalidation.ts +138 -0
- package/src/makeClient.ts +971 -1159
- package/src/makeIntl.ts +2 -2
- package/src/{experimental/makeUseCommand.ts → makeUseCommand.ts} +9 -6
- package/src/mutate.ts +406 -153
- package/src/query.ts +763 -260
- package/src/queryLifetime.ts +74 -0
- package/src/routeParams.ts +7 -7
- package/src/runtime.ts +1 -31
- package/src/suspense.ts +43 -0
- package/src/toast.ts +1 -0
- package/src/withToast.ts +1 -0
- package/test/Mutation.test.ts +181 -24
- package/test/dependencyInvalidation.test.ts +444 -0
- package/test/dist/dependencyInvalidation.test.d.ts.map +1 -0
- package/test/dist/form.test.d.ts.map +1 -1
- package/test/dist/inactiveInvalidation.test.d.ts.map +1 -0
- package/test/dist/interrupt-refetch-repro.test.d.ts.map +1 -0
- package/test/dist/lib.test.d.ts.map +1 -0
- package/test/dist/liveQueryInvalidation.test.d.ts.map +1 -0
- package/test/dist/query-span.test.d.ts.map +1 -0
- package/test/dist/queryOptions.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 +3751 -120
- package/test/dist/stubs.d.ts.map +1 -1
- package/test/dist/stubs.js +190 -30
- package/test/dist/suspense-regression.test.d.ts.map +1 -0
- package/test/dist/suspense.test.d.ts.map +1 -0
- package/test/form-validation-errors.test.ts +24 -19
- package/test/form.test.ts +25 -6
- package/test/inactiveInvalidation.test.ts +172 -0
- package/test/interrupt-refetch-repro.test.ts +625 -0
- package/test/lib.test.ts +240 -0
- package/test/liveQueryInvalidation.test.ts +108 -0
- package/test/makeClient.test.ts +437 -38
- package/test/query-span.test.ts +92 -0
- package/test/queryOptions.test.ts +88 -0
- package/test/streamFinal.test.ts +64 -0
- package/test/streamFn.test.ts +457 -0
- package/test/stubs.ts +227 -42
- package/test/suspense-regression.test.ts +168 -0
- package/test/suspense.test.ts +160 -0
- package/tsconfig.examples.json +20 -0
- package/tsconfig.json +9 -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.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.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
- package/tsconfig.json.bak +0 -12
|
@@ -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,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/vue",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.331",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/effect-app/libs.git",
|
|
9
|
+
"directory": "packages/vue"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/effect-app/libs/tree/main/packages/vue",
|
|
7
12
|
"dependencies": {
|
|
8
|
-
"@formatjs/intl": "^4.1.
|
|
9
|
-
"@tanstack/query
|
|
10
|
-
"@
|
|
11
|
-
"@vueuse/core": "^14.2.1",
|
|
13
|
+
"@formatjs/intl": "^4.1.12",
|
|
14
|
+
"@tanstack/vue-query": "5.96.2",
|
|
15
|
+
"@vueuse/core": "^14.3.0",
|
|
12
16
|
"change-case": "^5.4.4",
|
|
13
|
-
"query-string": "^9.
|
|
14
|
-
"effect-app": "4.0.0-beta.
|
|
17
|
+
"query-string": "^9.4.0",
|
|
18
|
+
"effect-app": "4.0.0-beta.331"
|
|
15
19
|
},
|
|
16
20
|
"peerDependencies": {
|
|
17
|
-
"@effect/atom-vue": "^4.0.0-
|
|
18
|
-
"@effect/platform-browser": "^4.0.0-
|
|
19
|
-
"@sentry/browser": "^10.
|
|
20
|
-
"effect": "^4.0.0-
|
|
21
|
-
"vue": "^3.5.
|
|
21
|
+
"@effect/atom-vue": "^4.0.0-rc.115",
|
|
22
|
+
"@effect/platform-browser": "^4.0.0-rc.115",
|
|
23
|
+
"@sentry/browser": "^10.55.0",
|
|
24
|
+
"effect": "^4.0.0-rc.115",
|
|
25
|
+
"vue": "^3.5.35"
|
|
22
26
|
},
|
|
23
27
|
"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.
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"vitest": "^4.0.18",
|
|
33
|
-
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
28
|
+
"@effect/vitest": "4.0.0-rc.115",
|
|
29
|
+
"@formatjs/icu-messageformat-parser": "^3.5.10",
|
|
30
|
+
"@types/node": "25.9.1",
|
|
31
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
32
|
+
"intl-messageformat": "^11.2.7",
|
|
33
|
+
"typescript": "~6.0.3",
|
|
34
|
+
"vite": "^8.0.15",
|
|
35
|
+
"vitest": "^4.1.7"
|
|
34
36
|
},
|
|
35
37
|
"typesVersions": {
|
|
36
38
|
"*": {
|
|
@@ -44,69 +46,10 @@
|
|
|
44
46
|
"types": "./dist/index.d.ts",
|
|
45
47
|
"default": "./dist/index.js"
|
|
46
48
|
},
|
|
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"
|
|
49
|
+
"./internal/*": null,
|
|
50
|
+
"./*": {
|
|
51
|
+
"types": "./dist/*.d.ts",
|
|
52
|
+
"default": "./dist/*.js"
|
|
110
53
|
}
|
|
111
54
|
},
|
|
112
55
|
"gitHead": "bd8e27eea3eff97db8739d577d67e7336c078d28",
|
|
@@ -120,24 +63,22 @@
|
|
|
120
63
|
],
|
|
121
64
|
"scripts": {
|
|
122
65
|
"watch": "pnpm build:tsc -w",
|
|
123
|
-
"build:tsc": "pnpm clean-dist &&
|
|
124
|
-
"check": "
|
|
66
|
+
"build:tsc": "pnpm clean-dist && pnpm check && node ../../scripts/rewrite-dist-declaration-imports.mjs dist",
|
|
67
|
+
"check": "tsgo --build",
|
|
125
68
|
"build": "pnpm build:tsc",
|
|
126
|
-
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144
|
|
69
|
+
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
|
|
127
70
|
"clean": "rm -rf dist",
|
|
128
71
|
"clean-dist": "sh ../../scripts/clean-dist.sh",
|
|
129
72
|
"circular": "pnpm circular:src && pnpm circular:dist",
|
|
130
73
|
"circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
|
|
131
74
|
"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",
|
|
75
|
+
"compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
|
|
76
|
+
"lint": "oxlint --quiet --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
77
|
+
"lint-fix": "oxlint --quiet --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
136
78
|
"test": "vitest",
|
|
137
79
|
"test:run": "pnpm run test run --passWithNoTests",
|
|
138
80
|
"testsuite": "pnpm lint && pnpm circular && pnpm run test:run",
|
|
139
81
|
"ncu": "ncu",
|
|
140
|
-
"pub": "
|
|
141
|
-
"prepublish": "cp -f ./tsconfig.json ./tsconfig.json.bak && node ../../scripts/mergeTsConfig.mjs ./tsconfig.json"
|
|
82
|
+
"pub": "npm publish --access public"
|
|
142
83
|
}
|
|
143
84
|
}
|