@webamoki/web-svelte 0.5.13 → 0.5.15

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.
@@ -20,4 +20,4 @@ export declare function prepareEmptyForm<S extends type.Any<Record<string, unkno
20
20
  delayed: import("svelte/store").Readable<boolean>;
21
21
  errors: import("sveltekit-superforms/client").SuperFormErrors<S["infer"]>;
22
22
  };
23
- export declare function serverValidateForm<S extends type.Any<Record<string, unknown>>>(request: Request, schema: S): Promise<SuperValidated<S["infer"], any, S["inferIn"]>>;
23
+ export declare function getServerForm<S extends type.Any<Record<string, unknown>>>(request: Request, schema: S): Promise<SuperValidated<S["infer"], any, S["inferIn"]>>;
@@ -1,7 +1,7 @@
1
1
  import { toast } from 'svelte-sonner';
2
2
  import { dateTransport } from './index.js';
3
3
  import { type } from 'arktype';
4
- import { defaults, fail, superForm, superValidate } from 'sveltekit-superforms';
4
+ import { defaults, superForm, superValidate } from 'sveltekit-superforms';
5
5
  import { arktype, arktypeClient } from 'sveltekit-superforms/adapters';
6
6
  export function prepareForm(validated, schema, options) {
7
7
  const form = superForm(validated, {
@@ -55,10 +55,6 @@ export function prepareEmptyForm(schema, options) {
55
55
  const errors = form.errors;
56
56
  return { form, data: form.form, delayed, errors };
57
57
  }
58
- export async function serverValidateForm(request, schema) {
59
- const form = await superValidate(request, arktype(schema), { transport: dateTransport });
60
- if (!form.valid) {
61
- throw fail(400, { form });
62
- }
63
- return form;
58
+ export async function getServerForm(request, schema) {
59
+ return await superValidate(request, arktype(schema), { transport: dateTransport });
64
60
  }
@@ -9,6 +9,7 @@ export declare const Time: import("arktype/internal/methods/object.ts").ObjectTy
9
9
  export declare const CalendarDate: import("arktype/internal/methods/object.ts").ObjectType<calendarImport, {}>;
10
10
  export declare const HexColor: import("arktype/internal/methods/string.ts").StringType<string, {}>;
11
11
  export declare const Email: import("arktype/internal/methods/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
12
+ export declare const Name: import("arktype/internal/methods/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
12
13
  export declare const FirstName: import("arktype/internal/methods/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
13
14
  export declare const LastName: import("arktype/internal/methods/object.ts").ObjectType<(In: string) => import("arktype").Out<string>, {}>;
14
15
  export declare const Id: import("arktype/internal/methods/number.ts").NumberType<number, {}>;
@@ -1,7 +1,7 @@
1
1
  import { Type, type } from 'arktype';
2
2
  import { Days } from '../datetime/index.js';
3
3
  import { Time as timeImport, CalendarDate as calendarImport } from '@internationalized/date';
4
- import { EMAIL_MAX, FIRST_NAME_MAX, LAST_NAME_MAX } from './consts.js';
4
+ import { EMAIL_MAX, FIRST_NAME_MAX, LAST_NAME_MAX, NAME_MAX } from './consts.js';
5
5
  import { toTitleCase } from '../string.js';
6
6
  /** Type string which is trimmed before narrowing the type checking */
7
7
  export function trimTo(typeTo) {
@@ -32,6 +32,7 @@ export const Email = trimTo(type('string.email')
32
32
  problem: () => 'invalid email address'
33
33
  })
34
34
  .atMostLength(EMAIL_MAX)).pipe((email) => email.toLowerCase());
35
+ export const Name = trimTo(type.string.moreThanLength(0).atMostLength(NAME_MAX)).pipe(toTitleCase);
35
36
  export const FirstName = trimTo(type.string.moreThanLength(0).atMostLength(FIRST_NAME_MAX)).pipe(toTitleCase);
36
37
  export const LastName = trimTo(type.string.moreThanLength(0).atMostLength(LAST_NAME_MAX)).pipe(toTitleCase);
37
38
  export const Id = type('number >= 0');
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.13",
6
+ "version": "0.5.15",
7
7
  "license": "MIT",
8
8
  "files": [
9
9
  "dist",