@effect-app/vue 4.0.0-beta.131 → 4.0.0-beta.133
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 +16 -0
- package/dist/commander.d.ts +14 -12
- package/dist/commander.d.ts.map +1 -1
- package/dist/commander.js +14 -10
- package/dist/confirm.d.ts +1 -1
- package/dist/confirm.js +1 -1
- package/dist/errorReporter.d.ts +1 -1
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +1 -1
- package/dist/form.d.ts +3 -3
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/intl.d.ts +4 -4
- package/dist/intl.js +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/makeClient.d.ts +6 -6
- package/dist/makeClient.d.ts.map +1 -1
- package/dist/makeClient.js +1 -1
- 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 +2 -2
- package/dist/mutate.d.ts +2 -2
- package/dist/mutate.d.ts.map +1 -1
- package/dist/mutate.js +1 -1
- package/dist/query.d.ts +5 -5
- package/dist/query.d.ts.map +1 -1
- package/dist/routeParams.d.ts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +1 -1
- package/dist/withToast.d.ts +3 -3
- package/dist/withToast.d.ts.map +1 -1
- package/dist/withToast.js +1 -1
- package/package.json +13 -13
- package/src/commander.ts +24 -18
- package/test/Mutation.test.ts +29 -0
- package/test/dist/stubs.d.ts +172 -172
- package/test/dist/stubs.d.ts.map +1 -1
- package/test/dist/stubs.js +9 -9
- package/test/stubs.ts +8 -8
package/test/Mutation.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import { it } from "@effect/vitest"
|
|
3
3
|
import { Cause, Effect, Exit, Fiber, Option } from "effect-app"
|
|
4
|
+
import { OperationFailure } from "effect-app/Operations"
|
|
4
5
|
import { CommandContext, DefaultIntl } from "../src/commander.js"
|
|
5
6
|
import { AsyncResult } from "../src/lib.js"
|
|
6
7
|
import { useExperimental } from "./stubs.js"
|
|
@@ -400,6 +401,7 @@ it.live("fail", () =>
|
|
|
400
401
|
expect(command.waiting).toBe(false)
|
|
401
402
|
expect(Exit.isFailure(AsyncResult.toExit(command.result))).toBe(true)
|
|
402
403
|
expect(toasts.length).toBe(1) // toast should show error
|
|
404
|
+
expect(toasts[0].type).toBe("warning")
|
|
403
405
|
expect(toasts[0].message).toContain("Test Action Failed:\nBoom!")
|
|
404
406
|
expect(toasts[0].message).toMatch(/Trace: [a-f0-9]{32}/)
|
|
405
407
|
expect(toasts[0].message).toMatch(/Span: [a-f0-9]{16}/)
|
|
@@ -424,6 +426,30 @@ it.live("fail with showSpanInfo disabled", () =>
|
|
|
424
426
|
expect(toasts[0].message).toBe("Test Action Failed:\nBoom!")
|
|
425
427
|
}))
|
|
426
428
|
|
|
429
|
+
it.live("fail with custom errorRenderer uses warning toast", () =>
|
|
430
|
+
Effect
|
|
431
|
+
.gen(function*() {
|
|
432
|
+
const toasts: any[] = []
|
|
433
|
+
const Command = useExperimental({ toasts, messages: DefaultIntl.en })
|
|
434
|
+
|
|
435
|
+
const command = Command.fn("Test Action")(
|
|
436
|
+
function*() {
|
|
437
|
+
return yield* Effect.fail(new OperationFailure({ message: null }))
|
|
438
|
+
},
|
|
439
|
+
Command.withDefaultToast({
|
|
440
|
+
errorRenderer: () => "Rendered Boom!"
|
|
441
|
+
})
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
yield* Fiber.join(command.handle())
|
|
445
|
+
|
|
446
|
+
expect(toasts.length).toBe(1)
|
|
447
|
+
expect(toasts[0].type).toBe("warning")
|
|
448
|
+
expect(toasts[0].message).toContain("Test Action, with warnings\nRendered Boom!")
|
|
449
|
+
expect(toasts[0].message).toMatch(/Trace: [a-f0-9]{32}/)
|
|
450
|
+
expect(toasts[0].message).toMatch(/Span: [a-f0-9]{16}/)
|
|
451
|
+
}))
|
|
452
|
+
|
|
427
453
|
it.live("fail and recover", () =>
|
|
428
454
|
Effect
|
|
429
455
|
.gen(function*() {
|
|
@@ -477,6 +503,7 @@ it.live("defect", () =>
|
|
|
477
503
|
expect(command.waiting).toBe(false)
|
|
478
504
|
expect(Exit.isFailure(AsyncResult.toExit(command.result))).toBe(true)
|
|
479
505
|
expect(toasts.length).toBe(1) // toast should show error
|
|
506
|
+
expect(toasts[0].type).toBe("error")
|
|
480
507
|
expect(toasts[0].message).toContain("Test Action unexpected error, please try again shortly.")
|
|
481
508
|
}))
|
|
482
509
|
|
|
@@ -735,6 +762,7 @@ it.live("fail with alt", () =>
|
|
|
735
762
|
expect(command.waiting).toBe(false)
|
|
736
763
|
expect(Exit.isFailure(AsyncResult.toExit(command.result))).toBe(true)
|
|
737
764
|
expect(toasts.length).toBe(1) // toast should show error
|
|
765
|
+
expect(toasts[0].type).toBe("warning")
|
|
738
766
|
expect(toasts[0].message).toContain("Test Action Failed:\nBoom!")
|
|
739
767
|
}))
|
|
740
768
|
|
|
@@ -795,6 +823,7 @@ it.live("defect with alt", () =>
|
|
|
795
823
|
expect(command.waiting).toBe(false)
|
|
796
824
|
expect(Exit.isFailure(AsyncResult.toExit(command.result))).toBe(true)
|
|
797
825
|
expect(toasts.length).toBe(1) // toast should show error
|
|
826
|
+
expect(toasts[0].type).toBe("error")
|
|
798
827
|
expect(toasts[0].message).toContain("Test Action unexpected error, please try again shortly.")
|
|
799
828
|
}))
|
|
800
829
|
|