@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.
Files changed (148) hide show
  1. package/CHANGELOG.md +2463 -0
  2. package/dist/atomQuery.d.ts +120 -0
  3. package/dist/atomQuery.d.ts.map +1 -0
  4. package/dist/atomQuery.js +434 -0
  5. package/dist/commander.d.ts +634 -0
  6. package/dist/commander.d.ts.map +1 -0
  7. package/dist/commander.js +1068 -0
  8. package/dist/{experimental/confirm.d.ts → confirm.d.ts} +6 -4
  9. package/dist/confirm.d.ts.map +1 -0
  10. package/dist/confirm.js +26 -0
  11. package/dist/dependencyMetadata.d.ts +18 -0
  12. package/dist/dependencyMetadata.d.ts.map +1 -0
  13. package/dist/dependencyMetadata.js +67 -0
  14. package/dist/errorReporter.d.ts +6 -4
  15. package/dist/errorReporter.d.ts.map +1 -1
  16. package/dist/errorReporter.js +14 -19
  17. package/dist/form.d.ts +5 -5
  18. package/dist/form.d.ts.map +1 -1
  19. package/dist/form.js +42 -16
  20. package/dist/internal/tanstackQuery.d.ts +9 -0
  21. package/dist/internal/tanstackQuery.d.ts.map +1 -0
  22. package/dist/internal/tanstackQuery.js +204 -0
  23. package/dist/intl.d.ts +15 -0
  24. package/dist/intl.d.ts.map +1 -0
  25. package/dist/intl.js +9 -0
  26. package/dist/lib.d.ts +7 -9
  27. package/dist/lib.d.ts.map +1 -1
  28. package/dist/lib.js +35 -10
  29. package/dist/liveQueryInvalidation.d.ts +16 -0
  30. package/dist/liveQueryInvalidation.d.ts.map +1 -0
  31. package/dist/liveQueryInvalidation.js +115 -0
  32. package/dist/makeClient.d.ts +236 -336
  33. package/dist/makeClient.d.ts.map +1 -1
  34. package/dist/makeClient.js +417 -408
  35. package/dist/makeContext.d.ts.map +1 -1
  36. package/dist/makeIntl.d.ts.map +1 -1
  37. package/dist/{experimental/makeUseCommand.d.ts → makeUseCommand.d.ts} +4 -3
  38. package/dist/makeUseCommand.d.ts.map +1 -0
  39. package/dist/makeUseCommand.js +13 -0
  40. package/dist/mutate.d.ts +109 -40
  41. package/dist/mutate.d.ts.map +1 -1
  42. package/dist/mutate.js +235 -58
  43. package/dist/query.d.ts +158 -45
  44. package/dist/query.d.ts.map +1 -1
  45. package/dist/query.js +380 -122
  46. package/dist/queryLifetime.d.ts +25 -0
  47. package/dist/queryLifetime.d.ts.map +1 -0
  48. package/dist/queryLifetime.js +54 -0
  49. package/dist/routeParams.d.ts +4 -4
  50. package/dist/routeParams.d.ts.map +1 -1
  51. package/dist/routeParams.js +4 -3
  52. package/dist/runtime.d.ts +1 -14
  53. package/dist/runtime.d.ts.map +1 -1
  54. package/dist/runtime.js +2 -26
  55. package/dist/suspense.d.ts +19 -0
  56. package/dist/suspense.d.ts.map +1 -0
  57. package/dist/suspense.js +38 -0
  58. package/dist/toast.d.ts +2 -0
  59. package/dist/toast.d.ts.map +1 -0
  60. package/dist/toast.js +2 -0
  61. package/dist/withToast.d.ts +2 -0
  62. package/dist/withToast.d.ts.map +1 -0
  63. package/dist/withToast.js +2 -0
  64. package/docs/atom-query-api-redesign.md +207 -0
  65. package/docs/mutation-command-atoms.md +40 -0
  66. package/docs/query-key-invalidation.md +107 -0
  67. package/examples/streamMutation.ts +72 -0
  68. package/package.json +36 -95
  69. package/src/atomQuery.ts +600 -0
  70. package/src/commander.ts +3408 -0
  71. package/src/{experimental/confirm.ts → confirm.ts} +13 -15
  72. package/src/dependencyMetadata.ts +84 -0
  73. package/src/errorReporter.ts +65 -75
  74. package/src/form.ts +57 -21
  75. package/src/index.ts +7 -7
  76. package/src/internal/tanstackQuery.ts +308 -0
  77. package/src/intl.ts +12 -0
  78. package/src/lib.ts +49 -21
  79. package/src/liveQueryInvalidation.ts +138 -0
  80. package/src/makeClient.ts +971 -1159
  81. package/src/makeIntl.ts +2 -2
  82. package/src/{experimental/makeUseCommand.ts → makeUseCommand.ts} +9 -6
  83. package/src/mutate.ts +406 -153
  84. package/src/query.ts +763 -260
  85. package/src/queryLifetime.ts +74 -0
  86. package/src/routeParams.ts +7 -7
  87. package/src/runtime.ts +1 -31
  88. package/src/suspense.ts +43 -0
  89. package/src/toast.ts +1 -0
  90. package/src/withToast.ts +1 -0
  91. package/test/Mutation.test.ts +181 -24
  92. package/test/dependencyInvalidation.test.ts +444 -0
  93. package/test/dist/dependencyInvalidation.test.d.ts.map +1 -0
  94. package/test/dist/form.test.d.ts.map +1 -1
  95. package/test/dist/inactiveInvalidation.test.d.ts.map +1 -0
  96. package/test/dist/interrupt-refetch-repro.test.d.ts.map +1 -0
  97. package/test/dist/lib.test.d.ts.map +1 -0
  98. package/test/dist/liveQueryInvalidation.test.d.ts.map +1 -0
  99. package/test/dist/query-span.test.d.ts.map +1 -0
  100. package/test/dist/queryOptions.test.d.ts.map +1 -0
  101. package/test/dist/streamFinal.test.d.ts.map +1 -0
  102. package/test/dist/streamFn.test.d.ts.map +1 -0
  103. package/test/dist/stubs.d.ts +3751 -120
  104. package/test/dist/stubs.d.ts.map +1 -1
  105. package/test/dist/stubs.js +190 -30
  106. package/test/dist/suspense-regression.test.d.ts.map +1 -0
  107. package/test/dist/suspense.test.d.ts.map +1 -0
  108. package/test/form-validation-errors.test.ts +24 -19
  109. package/test/form.test.ts +25 -6
  110. package/test/inactiveInvalidation.test.ts +172 -0
  111. package/test/interrupt-refetch-repro.test.ts +625 -0
  112. package/test/lib.test.ts +240 -0
  113. package/test/liveQueryInvalidation.test.ts +108 -0
  114. package/test/makeClient.test.ts +437 -38
  115. package/test/query-span.test.ts +92 -0
  116. package/test/queryOptions.test.ts +88 -0
  117. package/test/streamFinal.test.ts +64 -0
  118. package/test/streamFn.test.ts +457 -0
  119. package/test/stubs.ts +227 -42
  120. package/test/suspense-regression.test.ts +168 -0
  121. package/test/suspense.test.ts +160 -0
  122. package/tsconfig.examples.json +20 -0
  123. package/tsconfig.json +9 -2
  124. package/tsconfig.src.json +34 -34
  125. package/tsconfig.test.json +2 -2
  126. package/vitest.config.ts +5 -5
  127. package/dist/experimental/commander.d.ts +0 -359
  128. package/dist/experimental/commander.d.ts.map +0 -1
  129. package/dist/experimental/commander.js +0 -557
  130. package/dist/experimental/confirm.d.ts.map +0 -1
  131. package/dist/experimental/confirm.js +0 -28
  132. package/dist/experimental/intl.d.ts +0 -16
  133. package/dist/experimental/intl.d.ts.map +0 -1
  134. package/dist/experimental/intl.js +0 -5
  135. package/dist/experimental/makeUseCommand.d.ts.map +0 -1
  136. package/dist/experimental/makeUseCommand.js +0 -13
  137. package/dist/experimental/toast.d.ts +0 -47
  138. package/dist/experimental/toast.d.ts.map +0 -1
  139. package/dist/experimental/toast.js +0 -41
  140. package/dist/experimental/withToast.d.ts +0 -25
  141. package/dist/experimental/withToast.d.ts.map +0 -1
  142. package/dist/experimental/withToast.js +0 -45
  143. package/eslint.config.mjs +0 -24
  144. package/src/experimental/commander.ts +0 -1835
  145. package/src/experimental/intl.ts +0 -9
  146. package/src/experimental/toast.ts +0 -66
  147. package/src/experimental/withToast.ts +0 -99
  148. 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.33",
3
+ "version": "4.0.0-beta.331",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "homepage": "https://github.com/effect-ts-app/libs/tree/main/packages/vue",
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.2",
9
- "@tanstack/query-core": "5.83.1",
10
- "@tanstack/vue-query": "5.83.1",
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.3.1",
14
- "effect-app": "4.0.0-beta.33"
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-beta.37",
18
- "@effect/platform-browser": "^4.0.0-beta.37",
19
- "@sentry/browser": "^10.42.0",
20
- "effect": "^4.0.0-beta.37",
21
- "vue": "^3.5.29"
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": "^4.0.0-beta.37",
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",
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"
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
- "./errorReporter": {
48
- "types": "./dist/errorReporter.d.ts",
49
- "default": "./dist/errorReporter.js"
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 && effect-app-cli packagejson pnpm check",
124
- "check": "tsc --build",
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 tsc -w",
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 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",
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": "pnpm prepublish && npm publish --access public",
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
  }