@axium/core 0.15.2 → 0.16.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.
- package/dist/preferences.d.ts +2 -7
- package/dist/preferences.js +1 -8
- package/dist/schemas.d.ts +0 -4
- package/dist/schemas.js +0 -4
- package/dist/user.d.ts +3 -3
- package/package.json +1 -1
package/dist/preferences.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as z from 'zod';
|
|
|
2
2
|
/** @internal Used so we can narrow using `type` and get access to type-specific properties (e.g. `ZodNumber.minValue`) */
|
|
3
3
|
type StringFormatTypes = z.ZodGUID | z.ZodUUID | z.ZodEmail | z.ZodURL | z.ZodEmoji | z.ZodNanoID | z.ZodCUID | z.ZodCUID2 | z.ZodULID | z.ZodXID | z.ZodKSUID | z.ZodISODateTime | z.ZodISODate | z.ZodISOTime | z.ZodISODuration | z.ZodIPv4 | z.ZodIPv6 | z.ZodCIDRv4 | z.ZodCIDRv6 | z.ZodBase64 | z.ZodBase64URL | z.ZodE164 | z.ZodJWT;
|
|
4
4
|
type ZodPrefPrimitive = z.ZodString | z.ZodNumber | z.ZodBigInt | z.ZodBoolean | z.ZodDate | z.ZodLiteral | z.ZodTemplateLiteral | z.ZodFile | z.ZodEnum | StringFormatTypes;
|
|
5
|
-
type ZodPrefComposite = ZodPrefPrimitive | z.ZodNullable<ZodPrefPrimitive> | z.ZodOptional<ZodPrefPrimitive> | z.ZodArray<ZodPrefPrimitive> | z.ZodTuple<ZodPrefPrimitive[]> | z.ZodRecord<z.ZodString, ZodPrefPrimitive> | z.ZodObject<Readonly<Record<string, ZodPrefPrimitive>>>;
|
|
5
|
+
type ZodPrefComposite = ZodPrefPrimitive | z.ZodNullable<ZodPrefPrimitive> | z.ZodOptional<ZodPrefPrimitive> | z.ZodDefault<ZodPrefPrimitive> | z.ZodArray<ZodPrefPrimitive> | z.ZodTuple<ZodPrefPrimitive[]> | z.ZodRecord<z.ZodString, ZodPrefPrimitive> | z.ZodObject<Readonly<Record<string, ZodPrefPrimitive>>>;
|
|
6
6
|
/** @internal Used so we can narrow using `type` and get access to type-specific properties (e.g. `ZodNumber.minValue`) */
|
|
7
7
|
export type ZodPref = ZodPrefComposite | z.ZodObject<Readonly<Record<string, ZodPrefComposite>>>;
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
export declare let Preferences: z.ZodObject<{
|
|
12
|
-
debug: z.ZodBoolean
|
|
12
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
/**
|
|
15
15
|
* Interface for the user preferences schema shape.
|
|
@@ -17,10 +17,6 @@ export declare let Preferences: z.ZodObject<{
|
|
|
17
17
|
*/
|
|
18
18
|
export interface Preferences extends z.infer<typeof Preferences> {
|
|
19
19
|
}
|
|
20
|
-
/**
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export declare const preferenceDefaults: Preferences;
|
|
24
20
|
/**
|
|
25
21
|
* @internal
|
|
26
22
|
* @todo Implement proper localization
|
|
@@ -30,7 +26,6 @@ export declare const preferenceDescriptions: Partial<Record<keyof Preferences, s
|
|
|
30
26
|
export interface PreferenceInit<T extends keyof Preferences = keyof Preferences, S extends ZodPref = ZodPref> {
|
|
31
27
|
name: T;
|
|
32
28
|
schema: S;
|
|
33
|
-
initial: z.infer<S> & Preferences[T];
|
|
34
29
|
label: string;
|
|
35
30
|
descriptions?: string;
|
|
36
31
|
}
|
package/dist/preferences.js
CHANGED
|
@@ -3,14 +3,8 @@ import * as z from 'zod';
|
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
5
|
export let Preferences = z.object({
|
|
6
|
-
debug: z.boolean(),
|
|
6
|
+
debug: z.boolean().default(false),
|
|
7
7
|
});
|
|
8
|
-
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export const preferenceDefaults = {
|
|
12
|
-
debug: false,
|
|
13
|
-
};
|
|
14
8
|
/**
|
|
15
9
|
* @internal
|
|
16
10
|
* @todo Implement proper localization
|
|
@@ -21,7 +15,6 @@ export const preferenceLabels = {
|
|
|
21
15
|
export const preferenceDescriptions = {};
|
|
22
16
|
export function addPreference(init) {
|
|
23
17
|
Preferences = z.object({ ...Preferences.shape, [init.name]: init.schema });
|
|
24
|
-
preferenceDefaults[init.name] = init.initial;
|
|
25
18
|
preferenceLabels[init.name] = init.label;
|
|
26
19
|
preferenceDescriptions[init.name] = init.descriptions;
|
|
27
20
|
}
|
package/dist/schemas.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import * as z from 'zod';
|
|
2
|
-
/** Needed for discriminated union type narrowing */
|
|
3
|
-
export declare function zIs<const T extends z.core.$ZodTypeDef['type']>(schema: z.ZodType, type: T): schema is z.ZodType & {
|
|
4
|
-
type: T;
|
|
5
|
-
};
|
|
6
2
|
export declare function zFunction<T extends z.core.$ZodFunction>(schema: T): z.ZodCustom<Parameters<T["implement"]>[0], Parameters<T["implement"]>[0]>;
|
|
7
3
|
export declare function zAsyncFunction<T extends z.core.$ZodFunction>(schema: T): z.ZodCustom<Parameters<T["implementAsync"]>[0], Parameters<T["implementAsync"]>[0]>;
|
package/dist/schemas.js
CHANGED
package/dist/user.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const User: z.ZodObject<{
|
|
|
7
7
|
emailVerified: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
|
|
8
8
|
image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
9
9
|
preferences: z.ZodObject<{
|
|
10
|
-
debug: z.ZodBoolean
|
|
10
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
roles: z.ZodArray<z.ZodString>;
|
|
13
13
|
registeredAt: z.ZodCoercedDate<unknown>;
|
|
@@ -29,7 +29,7 @@ export declare const UserPublic: z.ZodObject<{
|
|
|
29
29
|
emailVerified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodDate>>>;
|
|
30
30
|
image: z.ZodOptional<z.ZodNullable<z.ZodURL>>;
|
|
31
31
|
preferences: z.ZodOptional<z.ZodObject<{
|
|
32
|
-
debug: z.ZodBoolean
|
|
32
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
33
33
|
}, z.core.$strip>>;
|
|
34
34
|
roles: z.ZodArray<z.ZodString>;
|
|
35
35
|
registeredAt: z.ZodCoercedDate<unknown>;
|
|
@@ -40,7 +40,7 @@ export interface UserPublic extends z.infer<typeof UserPublic> {
|
|
|
40
40
|
export declare const userProtectedFields: ["email", "emailVerified", "preferences", "isAdmin"];
|
|
41
41
|
export declare const UserChangeable: z.ZodObject<{
|
|
42
42
|
preferences: z.ZodOptional<z.ZodObject<{
|
|
43
|
-
debug: z.ZodBoolean
|
|
43
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
44
44
|
}, z.core.$strip>>;
|
|
45
45
|
email: z.ZodOptional<z.ZodEmail>;
|
|
46
46
|
name: z.ZodOptional<z.ZodString>;
|