@effect-app/vue 2.62.0 → 2.63.0

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.
@@ -23,10 +23,14 @@ it.live("works", () =>
23
23
 
24
24
  const command = Command.fn("Test Action")(
25
25
  function*() {
26
+ expect(command.id).toBe("Test Action")
27
+ expect(command.namespace).toBe("action.Test Action")
28
+ expect(command.namespaced("a")).toBe("action.Test Action.a")
29
+
26
30
  expect(yield* Effect.currentSpan.pipe(Effect.map((_) => _.name))).toBe("Test Action")
27
31
  expect(command.waiting).toBe(true)
28
32
 
29
- expect(yield* CommandContext).toEqual({ action: "Test Action", name: "Test Action" })
33
+ expect(yield* CommandContext).toMatchObject({ action: "Test Action", id: "Test Action" })
30
34
 
31
35
  expect(toasts.length).toBe(0)
32
36
 
@@ -41,6 +45,9 @@ it.live("works", () =>
41
45
  Effect.tap(() => executed = true)
42
46
  )
43
47
  expect(command.action).toBe("Test Action")
48
+ expect(command.id).toBe("Test Action")
49
+ expect(command.namespace).toBe("action.Test Action")
50
+ expect(command.namespaced("a")).toBe("action.Test Action.a")
44
51
 
45
52
  const r = yield* unwrap(command.handle())
46
53
  expect(command.waiting).toBe(false)
@@ -72,7 +79,7 @@ it.live("works non-gen", () =>
72
79
  expect(yield* Effect.currentSpan.pipe(Effect.map((_) => _.name))).toBe("Test Action")
73
80
  expect(command.waiting).toBe(true)
74
81
 
75
- expect(yield* CommandContext).toEqual({ action: "Test Action", name: "Test Action" })
82
+ expect(yield* CommandContext).toMatchObject({ action: "Test Action", id: "Test Action" })
76
83
 
77
84
  expect(toasts.length).toBe(0)
78
85
 
@@ -115,7 +122,7 @@ it.live("has custom action name", () =>
115
122
  function*() {
116
123
  expect(yield* Effect.currentSpan.pipe(Effect.map((_) => _.name))).toBe("Test Action")
117
124
 
118
- expect(yield* CommandContext).toEqual({ action: "Test Action Translated", name: "Test Action" })
125
+ expect(yield* CommandContext).toMatchObject({ action: "Test Action Translated", id: "Test Action" })
119
126
  return "test-value"
120
127
  },
121
128
  Effect.tap(() => executed = true)
@@ -229,6 +236,7 @@ it.live("with toasts", () =>
229
236
  // onSuccess: () => Effect.map(CommandContext, (_) => _.action),
230
237
  // onWaiting: null
231
238
  // }),
239
+ Command.withDefaultToast(),
232
240
  Effect.tap(() => executed = true)
233
241
  )
234
242
 
@@ -365,7 +373,7 @@ it.live("works with alt", () =>
365
373
  expect(yield* Effect.currentSpan.pipe(Effect.map((_) => _.name))).toBe("Test Action")
366
374
  expect(command.waiting).toBe(true)
367
375
 
368
- expect(yield* CommandContext).toEqual({ action: "Test Action", name: "Test Action" })
376
+ expect(yield* CommandContext).toMatchObject({ action: "Test Action", id: "Test Action" })
369
377
 
370
378
  expect(toasts.length).toBe(0)
371
379
 
@@ -409,7 +417,7 @@ it.live("has custom action name with alt", () =>
409
417
  function*() {
410
418
  expect(yield* Effect.currentSpan.pipe(Effect.map((_) => _.name))).toBe("Test Action")
411
419
 
412
- expect(yield* CommandContext).toEqual({ action: "Test Action Translated", name: "Test Action" })
420
+ expect(yield* CommandContext).toMatchObject({ action: "Test Action Translated", id: "Test Action" })
413
421
  return "test-value"
414
422
  },
415
423
  Effect.tap(() => executed = true)
@@ -9,21 +9,26 @@ export declare const useExperimental: (options?: {
9
9
  messages?: Record<string, string> | Record<string, MessageFormatElement[]>;
10
10
  toasts: any[];
11
11
  }) => {
12
- alt: <const Name extends string>(actionName: Name) => <Args extends Array<any>, A, E, R_1 extends Toast.Toast | WithToast | import("../src/experimental/commander.js").CommandContext>(handler: (...args: Args) => Effect.Effect<A, E, R_1>) => Commander.CommandOut<Args, A, E, R_1, Name>;
13
- fn: <const Name extends string>(actionName: Name) => Commander.Gen<Toast.Toast | WithToast, Name> & Commander.NonGen<Toast.Toast | WithToast, Name>;
14
- wrap: <const Name extends string, Args extends Array<any>, A_1, E_1, R_2>(mutation: {
12
+ alt: <const Id extends string>(id: Id) => <Args extends Array<any>, A, E, R_1 extends WithToast | Toast.Toast | import("../src/experimental/commander.js").CommandContext>(handler: (...args: Args) => Effect.Effect<A, E, R_1>) => Commander.CommandOut<Args, A, E, R_1, Id>;
13
+ fn: <const Id extends string>(id: Id) => Commander.Gen<WithToast | Toast.Toast, Id> & Commander.NonGen<WithToast | Toast.Toast, Id>;
14
+ wrap: <const Id extends string, Args extends Array<any>, A_1, E_1, R_2>(mutation: {
15
15
  mutate: (...args: Args) => Effect.Effect<A_1, E_1, R_2>;
16
- name: Name;
17
- }) => Commander.GenWrap<Toast.Toast | WithToast, Name, Args, A_1, E_1, R_2> & Commander.NonGenWrap<Toast.Toast | WithToast, Name, Args, A_1, E_1, R_2>;
18
- takeOver: <Args_1 extends any[], A_2, E_2, R_3, const Name extends string>(command: Commander.CommandOut<Args_1, A_2, E_2, R_3, Name>) => (...args: Args_1) => Effect.Effect<A_2, E_2, import("../src/experimental/commander.js").CommandContext | Exclude<Exclude<R_3, import("../src/experimental/commander.js").CommandContext>, import("effect/Tracer").ParentSpan>>;
16
+ name: Id;
17
+ }) => Commander.GenWrap<WithToast | Toast.Toast, Id, Args, A_1, E_1, R_2> & Commander.NonGenWrap<WithToast | Toast.Toast, Id, Args, A_1, E_1, R_2>;
18
+ takeOver: <Args_1 extends any[], A_2, E_2, R_3, const Id extends string>(command: Commander.CommandOut<Args_1, A_2, E_2, R_3, Id>) => (...args: Args_1) => Effect.Effect<A_2, E_2, import("../src/experimental/commander.js").CommandContext | Exclude<Exclude<R_3, import("../src/experimental/commander.js").CommandContext>, import("effect/Tracer").ParentSpan>>;
19
19
  confirmOrInterrupt: (message?: string | undefined) => Effect.Effect<void, never, import("../src/experimental/commander.js").CommandContext>;
20
20
  confirm: (message?: string | undefined) => Effect.Effect<boolean, never, import("../src/experimental/commander.js").CommandContext>;
21
- updateAction: <Args_1 extends Array<any>>(update: (currentActionName: string, ...args: Args_1) => string) => <A_3, E_3, R_4>(_: Effect.Effect<A_3, E_3, R_4>, ...input: Args_1) => Effect.Effect<A_3, E_3, import("../src/experimental/commander.js").CommandContext | R_4>;
22
- withDefaultToast: <A_3, E_4, R_5, Args_1 extends ReadonlyArray<unknown>>(options?: {
23
- errorRenderer?: (e: E_4, action: string, ...args: Args_1) => string | undefined;
24
- onWaiting?: string | ((action: string, ...args: Args_1) => string | null | undefined) | null | undefined;
25
- onSuccess?: string | ((a: A_3, action: string, ...args: Args_1) => string | null | undefined) | null | undefined;
26
- } | undefined) => (self: Effect.Effect<A_3, E_4, R_5>, ...args: Args_1) => Effect.Effect<A_3, E_4, import("../src/experimental/commander.js").CommandContext | R_5>;
21
+ updateAction: <Args_1 extends Array<any>>(update: (currentActionId: string, ...args: Args_1) => string) => <A_3, E_3, R_4>(_: Effect.Effect<A_3, E_3, R_4>, ...input: Args_1) => Effect.Effect<A_3, E_3, import("../src/experimental/commander.js").CommandContext | R_4>;
22
+ defaultFailureMessageHandler: <E_4, Args_1 extends readonly any[]>(action: string, errorRenderer?: ((e: E_4, action: string, ...args: Args_1) => string | undefined) | undefined) => (o: import("effect/Option").Option<E_4>, ...args: Args_1) => string | {
23
+ level: "warn";
24
+ message: string;
25
+ };
26
+ renderError: <E_4, Args_2 extends readonly any[]>(action: string, errorRenderer?: ((e: E_4, action: string, ...args: Args_2) => string | undefined) | undefined) => (e: E_4, ...args: Args_2) => string;
27
+ withDefaultToast: <A_3, E_4, R_5, Args_3 extends ReadonlyArray<unknown>>(options?: {
28
+ errorRenderer?: (e: E_4, action: string, ...args: Args_3) => string | undefined;
29
+ onWaiting?: string | ((action: string, ...args: Args_3) => string | null | undefined) | null | undefined;
30
+ onSuccess?: string | ((a: A_3, action: string, ...args: Args_3) => string | null | undefined) | null | undefined;
31
+ } | undefined) => (self: Effect.Effect<A_3, E_4, R_5>, ...args: Args_3) => Effect.Effect<A_3, E_4, import("../src/experimental/commander.js").CommandContext | R_5>;
27
32
  _tag: "Commander";
28
33
  };
29
34
  //# sourceMappingURL=stubs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stubs.d.ts","sourceRoot":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