@effect-app/vue 2.77.2 → 2.77.3
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 +6 -0
- package/dist/experimental/commander.d.ts +89 -25
- package/dist/experimental/commander.d.ts.map +1 -1
- package/dist/experimental/commander.js +373 -380
- package/dist/experimental/makeUseCommand.d.ts +3 -8
- package/dist/experimental/makeUseCommand.d.ts.map +1 -1
- package/dist/experimental/makeUseCommand.js +3 -6
- package/dist/makeClient.d.ts +133 -130
- package/dist/makeClient.d.ts.map +1 -1
- package/dist/makeClient.js +4 -12
- package/package.json +1 -1
- package/src/experimental/commander.ts +541 -546
- package/src/experimental/makeUseCommand.ts +7 -14
- package/src/makeClient.ts +5 -12
- package/test/dist/stubs.d.ts +3 -1
- package/test/dist/stubs.d.ts.map +1 -1
|
@@ -1,29 +1,22 @@
|
|
|
1
1
|
import { Effect } from "effect-app"
|
|
2
|
-
import { Commander, CommanderStatic } from "./commander.js"
|
|
2
|
+
import { Commander, type CommanderImpl, CommanderStatic } from "./commander.js"
|
|
3
3
|
|
|
4
4
|
type X<X> = X
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
export interface CommanderResolved extends X<typeof CommanderStatic> {
|
|
8
|
-
alt: ReturnType<Commander["alt"]>
|
|
9
|
-
fn: ReturnType<Commander["fn"]>
|
|
10
|
-
wrap: ReturnType<Commander["wrap"]>
|
|
11
|
-
alt2: ReturnType<Commander["alt2"]>
|
|
12
|
-
withDefaultToast: typeof CommanderStatic.withDefaultToast
|
|
6
|
+
// helps retain JSDoc
|
|
7
|
+
export interface CommanderResolved<RT> extends X<typeof CommanderStatic>, CommanderImpl<RT> {
|
|
13
8
|
}
|
|
14
9
|
|
|
15
10
|
export const makeUseCommand = Effect.fnUntraced(function*<R = never>() {
|
|
16
11
|
const cmndr = yield* Commander
|
|
17
12
|
const runtime = yield* Effect.runtime<R>()
|
|
18
13
|
|
|
14
|
+
const comm = cmndr(runtime)
|
|
15
|
+
|
|
19
16
|
const command = {
|
|
20
|
-
...
|
|
21
|
-
alt: cmndr.alt(runtime),
|
|
22
|
-
fn: cmndr.fn(runtime),
|
|
23
|
-
wrap: cmndr.wrap(runtime),
|
|
24
|
-
alt2: cmndr.alt2(runtime),
|
|
17
|
+
...comm,
|
|
25
18
|
...CommanderStatic
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
return command as CommanderResolved
|
|
21
|
+
return command as CommanderResolved<R>
|
|
29
22
|
})
|
package/src/makeClient.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { dropUndefinedT } from "effect-app/utils"
|
|
|
11
11
|
import { type RuntimeFiber } from "effect/Fiber"
|
|
12
12
|
import { computed, type ComputedRef, onBeforeUnmount, type Ref, ref, watch, type WatchSource } from "vue"
|
|
13
13
|
import { reportMessage } from "./errorReporter.js"
|
|
14
|
-
import { Commander, CommanderStatic } from "./experimental/commander.js"
|
|
14
|
+
import { type Commander, CommanderStatic } from "./experimental/commander.js"
|
|
15
15
|
import { I18n } from "./experimental/intl.js"
|
|
16
16
|
import { Toast } from "./experimental/toast.js"
|
|
17
17
|
import { buildFieldInfoFromFieldsRoot } from "./form.js"
|
|
@@ -21,6 +21,7 @@ import { type CustomDefinedInitialQueryOptions, type CustomUndefinedInitialQuery
|
|
|
21
21
|
|
|
22
22
|
import { camelCase } from "change-case"
|
|
23
23
|
import { type ApiClientFactory } from "effect-app/client"
|
|
24
|
+
import { makeUseCommand } from "./experimental/makeUseCommand.js"
|
|
24
25
|
|
|
25
26
|
const mapHandler = <A, E, R, I = void, A2 = A, E2 = E, R2 = R>(
|
|
26
27
|
handler: Effect.Effect<A, E, R> | ((i: I) => Effect.Effect<A, E, R>),
|
|
@@ -1011,18 +1012,10 @@ export const makeClient = <RT>(
|
|
|
1011
1012
|
getBaseMrt: () => ManagedRuntime.ManagedRuntime<RT | ApiClientFactory | Commander | LegacyMutation | Base, never>,
|
|
1012
1013
|
clientFor_: ReturnType<typeof ApiClientFactory["makeFor"]>
|
|
1013
1014
|
) => {
|
|
1014
|
-
|
|
1015
|
+
type R = RT | ApiClientFactory | Commander | LegacyMutation | Base
|
|
1016
|
+
const getRt = Effect.runtime<R>()
|
|
1015
1017
|
const getBaseRt = () => managedRuntimeRt(getBaseMrt())
|
|
1016
|
-
const makeCommand =
|
|
1017
|
-
const cmd = yield* Commander
|
|
1018
|
-
const rt = yield* getRt
|
|
1019
|
-
return {
|
|
1020
|
-
fn: cmd.fn(rt),
|
|
1021
|
-
wrap: cmd.wrap(rt),
|
|
1022
|
-
alt: cmd.alt(rt),
|
|
1023
|
-
alt2: cmd.alt2(rt)
|
|
1024
|
-
}
|
|
1025
|
-
})
|
|
1018
|
+
const makeCommand = makeUseCommand<R>()
|
|
1026
1019
|
const makeMutation = Effect.gen(function*() {
|
|
1027
1020
|
const mut = yield* LegacyMutation
|
|
1028
1021
|
|
package/test/dist/stubs.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type MessageFormatElement } from "@formatjs/icu-messageformat-parser";
|
|
2
2
|
import { Layer } from "effect-app";
|
|
3
3
|
import { I18n } from "../src/experimental/intl.js";
|
|
4
|
+
import * as Toast from "../src/experimental/toast.js";
|
|
5
|
+
import { WithToast } from "../src/experimental/withToast.js";
|
|
4
6
|
export declare const fakeIntlLayer: (messages?: Record<string, string> | Record<string, MessageFormatElement[]>) => Layer.Layer<I18n, never, never>;
|
|
5
7
|
export declare const useExperimental: (options?: {
|
|
6
8
|
messages?: Record<string, string> | Record<string, MessageFormatElement[]>;
|
|
7
9
|
toasts: any[];
|
|
8
|
-
}) => import("../src/experimental/makeUseCommand.js").CommanderResolved
|
|
10
|
+
}) => import("../src/experimental/makeUseCommand.js").CommanderResolved<Toast.Toast | I18n | WithToast>;
|
|
9
11
|
//# sourceMappingURL=stubs.d.ts.map
|
package/test/dist/stubs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../stubs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAAU,KAAK,EAAE,MAAM,YAAY,CAAA;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../stubs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAE9E,OAAO,EAAU,KAAK,EAAE,MAAM,YAAY,CAAA;AAG1C,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAElD,OAAO,KAAK,KAAK,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AA4C5D,eAAO,MAAM,aAAa,GAAI,WAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAM,oCAgBzG,CAAA;AAEH,eAAO,MAAM,eAAe,GAC1B,UAAU;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,GAAG,EAAE,CAAA;CAAE,sGASxG,CAAA"}
|