@effect-app/vue 4.0.0-beta.25 → 4.0.0-beta.251

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +1868 -0
  2. package/dist/commander.d.ts +634 -0
  3. package/dist/commander.d.ts.map +1 -0
  4. package/dist/commander.js +1070 -0
  5. package/dist/confirm.d.ts +21 -0
  6. package/dist/confirm.d.ts.map +1 -0
  7. package/dist/confirm.js +26 -0
  8. package/dist/errorReporter.d.ts +7 -5
  9. package/dist/errorReporter.d.ts.map +1 -1
  10. package/dist/errorReporter.js +14 -19
  11. package/dist/form.d.ts +15 -6
  12. package/dist/form.d.ts.map +1 -1
  13. package/dist/form.js +46 -13
  14. package/dist/index.d.ts +1 -1
  15. package/dist/intl.d.ts +15 -0
  16. package/dist/intl.d.ts.map +1 -0
  17. package/dist/intl.js +9 -0
  18. package/dist/lib.d.ts +8 -10
  19. package/dist/lib.d.ts.map +1 -1
  20. package/dist/lib.js +35 -10
  21. package/dist/makeClient.d.ts +157 -343
  22. package/dist/makeClient.d.ts.map +1 -1
  23. package/dist/makeClient.js +216 -376
  24. package/dist/makeContext.d.ts +1 -1
  25. package/dist/makeContext.d.ts.map +1 -1
  26. package/dist/makeIntl.d.ts +1 -1
  27. package/dist/makeIntl.d.ts.map +1 -1
  28. package/dist/makeUseCommand.d.ts +9 -0
  29. package/dist/makeUseCommand.d.ts.map +1 -0
  30. package/dist/makeUseCommand.js +13 -0
  31. package/dist/mutate.d.ts +97 -39
  32. package/dist/mutate.d.ts.map +1 -1
  33. package/dist/mutate.js +177 -49
  34. package/dist/query.d.ts +24 -39
  35. package/dist/query.d.ts.map +1 -1
  36. package/dist/query.js +156 -78
  37. package/dist/routeParams.d.ts +5 -5
  38. package/dist/routeParams.d.ts.map +1 -1
  39. package/dist/routeParams.js +4 -3
  40. package/dist/runtime.d.ts +2 -15
  41. package/dist/runtime.d.ts.map +1 -1
  42. package/dist/runtime.js +2 -26
  43. package/dist/toast.d.ts +2 -0
  44. package/dist/toast.d.ts.map +1 -0
  45. package/dist/toast.js +2 -0
  46. package/dist/withToast.d.ts +2 -0
  47. package/dist/withToast.d.ts.map +1 -0
  48. package/dist/withToast.js +2 -0
  49. package/examples/streamMutation.ts +72 -0
  50. package/package.json +48 -50
  51. package/src/commander.ts +3406 -0
  52. package/src/{experimental/confirm.ts → confirm.ts} +12 -14
  53. package/src/errorReporter.ts +65 -75
  54. package/src/form.ts +61 -18
  55. package/src/intl.ts +12 -0
  56. package/src/lib.ts +48 -20
  57. package/src/makeClient.ts +581 -1138
  58. package/src/{experimental/makeUseCommand.ts → makeUseCommand.ts} +8 -5
  59. package/src/mutate.ts +335 -134
  60. package/src/query.ts +241 -183
  61. package/src/routeParams.ts +7 -7
  62. package/src/runtime.ts +1 -31
  63. package/src/toast.ts +1 -0
  64. package/src/withToast.ts +1 -0
  65. package/test/Mutation.test.ts +181 -24
  66. package/test/dist/form.test.d.ts.map +1 -1
  67. package/test/dist/lib.test.d.ts.map +1 -0
  68. package/test/dist/streamFinal.test.d.ts.map +1 -0
  69. package/test/dist/streamFn.test.d.ts.map +1 -0
  70. package/test/dist/stubs.d.ts +3531 -122
  71. package/test/dist/stubs.d.ts.map +1 -1
  72. package/test/dist/stubs.js +187 -32
  73. package/test/form-validation-errors.test.ts +25 -20
  74. package/test/form.test.ts +22 -3
  75. package/test/lib.test.ts +240 -0
  76. package/test/makeClient.test.ts +327 -38
  77. package/test/streamFinal.test.ts +64 -0
  78. package/test/streamFn.test.ts +457 -0
  79. package/test/stubs.ts +223 -43
  80. package/tsconfig.examples.json +20 -0
  81. package/tsconfig.json +2 -1
  82. package/tsconfig.json.bak +5 -2
  83. package/tsconfig.src.json +34 -34
  84. package/tsconfig.test.json +2 -2
  85. package/vitest.config.ts +5 -5
  86. package/dist/experimental/commander.d.ts +0 -359
  87. package/dist/experimental/commander.d.ts.map +0 -1
  88. package/dist/experimental/commander.js +0 -557
  89. package/dist/experimental/confirm.d.ts +0 -19
  90. package/dist/experimental/confirm.d.ts.map +0 -1
  91. package/dist/experimental/confirm.js +0 -28
  92. package/dist/experimental/intl.d.ts +0 -16
  93. package/dist/experimental/intl.d.ts.map +0 -1
  94. package/dist/experimental/intl.js +0 -5
  95. package/dist/experimental/makeUseCommand.d.ts +0 -8
  96. package/dist/experimental/makeUseCommand.d.ts.map +0 -1
  97. package/dist/experimental/makeUseCommand.js +0 -13
  98. package/dist/experimental/toast.d.ts +0 -47
  99. package/dist/experimental/toast.d.ts.map +0 -1
  100. package/dist/experimental/toast.js +0 -41
  101. package/dist/experimental/withToast.d.ts +0 -25
  102. package/dist/experimental/withToast.d.ts.map +0 -1
  103. package/dist/experimental/withToast.js +0 -45
  104. package/eslint.config.mjs +0 -24
  105. package/src/experimental/commander.ts +0 -1835
  106. package/src/experimental/intl.ts +0 -9
  107. package/src/experimental/toast.ts +0 -66
  108. 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.25",
3
+ "version": "4.0.0-beta.251",
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.2",
9
- "@tanstack/query-core": "5.83.1",
10
- "@tanstack/vue-query": "5.83.1",
11
- "@vueuse/core": "^14.2.1",
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.25"
14
+ "effect-app": "4.0.0-beta.251"
15
15
  },
16
16
  "peerDependencies": {
17
- "@effect/atom-vue": "^4.0.0-beta.36",
18
- "@effect/platform-browser": "^4.0.0-beta.36",
19
- "@sentry/browser": "^10.42.0",
20
- "effect": "^4.0.0-beta.36",
21
- "vue": "^3.5.29"
17
+ "@effect/atom-vue": "^4.0.0-beta.70",
18
+ "@effect/platform-browser": "^4.0.0-beta.70",
19
+ "@sentry/browser": "^10.51.0",
20
+ "effect": "^4.0.0-beta.70",
21
+ "vue": "^3.5.34"
22
22
  },
23
23
  "devDependencies": {
24
- "@effect/vitest": "^4.0.0-beta.36",
25
- "@formatjs/icu-messageformat-parser": "^3.5.1",
26
- "@types/node": "25.3.3",
27
- "@vitejs/plugin-vue": "^6.0.4",
28
- "intl-messageformat": "^11.1.2",
24
+ "@effect/vitest": "4.0.0-beta.70",
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": "~5.9.3",
31
- "vite": "^7.3.1",
32
- "vitest": "^4.0.18",
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,38 +43,26 @@
44
43
  "types": "./dist/index.d.ts",
45
44
  "default": "./dist/index.js"
46
45
  },
46
+ "./commander": {
47
+ "types": "./dist/commander.d.ts",
48
+ "default": "./dist/commander.js"
49
+ },
50
+ "./confirm": {
51
+ "types": "./dist/confirm.d.ts",
52
+ "default": "./dist/confirm.js"
53
+ },
47
54
  "./errorReporter": {
48
55
  "types": "./dist/errorReporter.d.ts",
49
56
  "default": "./dist/errorReporter.js"
50
57
  },
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
58
  "./form": {
76
59
  "types": "./dist/form.d.ts",
77
60
  "default": "./dist/form.js"
78
61
  },
62
+ "./intl": {
63
+ "types": "./dist/intl.d.ts",
64
+ "default": "./dist/intl.js"
65
+ },
79
66
  "./lib": {
80
67
  "types": "./dist/lib.d.ts",
81
68
  "default": "./dist/lib.js"
@@ -92,6 +79,10 @@
92
79
  "types": "./dist/makeIntl.d.ts",
93
80
  "default": "./dist/makeIntl.js"
94
81
  },
82
+ "./makeUseCommand": {
83
+ "types": "./dist/makeUseCommand.d.ts",
84
+ "default": "./dist/makeUseCommand.js"
85
+ },
95
86
  "./mutate": {
96
87
  "types": "./dist/mutate.d.ts",
97
88
  "default": "./dist/mutate.js"
@@ -107,6 +98,14 @@
107
98
  "./runtime": {
108
99
  "types": "./dist/runtime.d.ts",
109
100
  "default": "./dist/runtime.js"
101
+ },
102
+ "./toast": {
103
+ "types": "./dist/toast.d.ts",
104
+ "default": "./dist/toast.js"
105
+ },
106
+ "./withToast": {
107
+ "types": "./dist/withToast.d.ts",
108
+ "default": "./dist/withToast.js"
110
109
  }
111
110
  },
112
111
  "gitHead": "bd8e27eea3eff97db8739d577d67e7336c078d28",
@@ -121,18 +120,17 @@
121
120
  "scripts": {
122
121
  "watch": "pnpm build:tsc -w",
123
122
  "build:tsc": "pnpm clean-dist && effect-app-cli packagejson pnpm check",
124
- "check": "tsc --build",
123
+ "check": "tsgo --build",
125
124
  "build": "pnpm build:tsc",
126
- "watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsc -w",
125
+ "watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
127
126
  "clean": "rm -rf dist",
128
127
  "clean-dist": "sh ../../scripts/clean-dist.sh",
129
128
  "circular": "pnpm circular:src && pnpm circular:dist",
130
129
  "circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
131
130
  "circular:dist": "madge --circular --extensions js ./dist",
132
- "compile": "NODE_OPTIONS=--max-old-space-size=6144 tsc --noEmit",
133
- "lint": "NODE_OPTIONS=--max-old-space-size=6144 ESLINT_TS=1 eslint ./src",
134
- "lint:watch": "ESLINT_TS=1 esw -w --changed --clear --ext ts,tsx .",
135
- "lint-fix": "pnpm lint --fix",
131
+ "compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
132
+ "lint": "oxlint --quiet --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
133
+ "lint-fix": "oxlint --quiet --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
136
134
  "test": "vitest",
137
135
  "test:run": "pnpm run test run --passWithNoTests",
138
136
  "testsuite": "pnpm lint && pnpm circular && pnpm run test:run",