fuma 0.3.41 → 0.3.42

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.
@@ -6,7 +6,7 @@ export declare function formAction<E extends RequestEvent, Shape extends z.ZodRa
6
6
  formData: FormData;
7
7
  }) => Promise<ReturnType>, options?: {
8
8
  validation?: z.SuperRefinement<z.objectOutputType<Shape, z.ZodTypeAny>>;
9
- redirectTo?: string | ((res: ReturnType) => string);
9
+ redirectTo?: string | URL | ((res: ReturnType) => string | URL | undefined);
10
10
  }): (event: E) => Promise<import("@sveltejs/kit").ActionFailure<{
11
11
  message: string;
12
12
  } | {
@@ -2,7 +2,7 @@ import { type ActionFailure } from '@sveltejs/kit';
2
2
  import type { Issue } from './parseFormData.js';
3
3
  export declare function tryOrFail<T = unknown>(func: () => Promise<T>,
4
4
  /** You can redirect on success */
5
- redirectTo?: string | ((res: T) => string | undefined)): Promise<T | ActionFailure<{
5
+ redirectTo?: string | URL | ((res: T) => string | URL | undefined)): Promise<T | ActionFailure<{
6
6
  message: string;
7
7
  } | {
8
8
  issues: Issue[];
@@ -27,7 +27,7 @@ redirectTo) {
27
27
  }
28
28
  finally {
29
29
  if (isSuccess && redirectTo) {
30
- if (typeof redirectTo === 'string')
30
+ if (typeof redirectTo === 'string' || redirectTo instanceof URL)
31
31
  redirect(302, redirectTo);
32
32
  else if (result) {
33
33
  const url = redirectTo(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.3.41",
3
+ "version": "0.3.42",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",