@tmlmobilidade/types 20250827.1858.35 → 20250827.2153.11

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.
@@ -1,6 +1,8 @@
1
1
  import { type UnixTimestamp } from '../_common/unix-timestamp.js';
2
2
  import { type Permission } from './permission.js';
3
3
  import { z } from 'zod';
4
+ export declare const UserPreferenceValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">]>;
5
+ export type UserPreferenceValue = z.infer<typeof UserPreferenceValueSchema>;
4
6
  export declare const UserSchema: z.ZodObject<{
5
7
  _id: z.ZodString;
6
8
  created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, UnixTimestamp, number>, "UnixTimestamp">>>;
@@ -28,7 +30,7 @@ export declare const UserSchema: z.ZodObject<{
28
30
  resource?: Record<string, any> | null | undefined;
29
31
  }>, "many">;
30
32
  phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
- preferences: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>>;
33
+ preferences: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">]>>>>>;
32
34
  role_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
33
35
  session_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
34
36
  theme_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -60,7 +62,7 @@ export declare const UserSchema: z.ZodObject<{
60
62
  __brand: "UnixTimestamp";
61
63
  } & z.BRAND<"UnixTimestamp">) | null | undefined;
62
64
  password_hash?: string | null | undefined;
63
- preferences?: Record<string, Record<string, any>> | null | undefined;
65
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
64
66
  theme_id?: string | null | undefined;
65
67
  }, {
66
68
  _id: string;
@@ -80,7 +82,7 @@ export declare const UserSchema: z.ZodObject<{
80
82
  email_verified?: number | null | undefined;
81
83
  organization_ids?: string[] | undefined;
82
84
  password_hash?: string | null | undefined;
83
- preferences?: Record<string, Record<string, any>> | null | undefined;
85
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
84
86
  role_ids?: string[] | undefined;
85
87
  session_ids?: string[] | undefined;
86
88
  theme_id?: string | null | undefined;
@@ -113,7 +115,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
113
115
  resource?: Record<string, any> | null | undefined;
114
116
  }>, "many">;
115
117
  phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
116
- preferences: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>>;
118
+ preferences: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">]>>>>>;
117
119
  role_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
118
120
  session_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
119
121
  theme_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -138,7 +140,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
138
140
  __brand: "UnixTimestamp";
139
141
  } & z.BRAND<"UnixTimestamp">) | null | undefined;
140
142
  password_hash?: string | null | undefined;
141
- preferences?: Record<string, Record<string, any>> | null | undefined;
143
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
142
144
  theme_id?: string | null | undefined;
143
145
  }, {
144
146
  email: string;
@@ -155,7 +157,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
155
157
  email_verified?: number | null | undefined;
156
158
  organization_ids?: string[] | undefined;
157
159
  password_hash?: string | null | undefined;
158
- preferences?: Record<string, Record<string, any>> | null | undefined;
160
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
159
161
  role_ids?: string[] | undefined;
160
162
  session_ids?: string[] | undefined;
161
163
  theme_id?: string | null | undefined;
@@ -184,7 +186,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
184
186
  last_name: z.ZodOptional<z.ZodString>;
185
187
  organization_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
186
188
  password_hash: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
187
- preferences: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>>>>>;
189
+ preferences: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodArray<z.ZodNumber, "many">]>>>>>>;
188
190
  role_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
189
191
  session_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
190
192
  theme_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
@@ -206,7 +208,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
206
208
  last_name?: string | undefined;
207
209
  organization_ids?: string[] | undefined;
208
210
  password_hash?: string | null | undefined;
209
- preferences?: Record<string, Record<string, any>> | null | undefined;
211
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
210
212
  role_ids?: string[] | undefined;
211
213
  session_ids?: string[] | undefined;
212
214
  theme_id?: string | null | undefined;
@@ -226,7 +228,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
226
228
  last_name?: string | undefined;
227
229
  organization_ids?: string[] | undefined;
228
230
  password_hash?: string | null | undefined;
229
- preferences?: Record<string, Record<string, any>> | null | undefined;
231
+ preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
230
232
  role_ids?: string[] | undefined;
231
233
  session_ids?: string[] | undefined;
232
234
  theme_id?: string | null | undefined;
@@ -4,6 +4,14 @@ import { validateUnixTimestamp } from '../_common/unix-timestamp.js';
4
4
  import { PermissionSchema } from './permission.js';
5
5
  import { z } from 'zod';
6
6
  /* * */
7
+ export const UserPreferenceValueSchema = z.union([
8
+ z.string(),
9
+ z.number(),
10
+ z.boolean(),
11
+ z.array(z.string()),
12
+ z.array(z.number()),
13
+ ]);
14
+ /* * */
7
15
  export const UserSchema = DocumentSchema.extend({
8
16
  avatar: z.string().nullish(),
9
17
  bio: z.string().nullish(),
@@ -15,7 +23,7 @@ export const UserSchema = DocumentSchema.extend({
15
23
  password_hash: z.string().nullish(),
16
24
  permissions: z.array(PermissionSchema),
17
25
  phone: z.string().nullish(),
18
- preferences: z.record(z.record(z.any())).nullish(),
26
+ preferences: z.record(z.record(UserPreferenceValueSchema)).nullish(),
19
27
  role_ids: z.array(z.string()).default([]),
20
28
  session_ids: z.array(z.string()).default([]),
21
29
  theme_id: z.string().nullish(),
@@ -23,27 +31,3 @@ export const UserSchema = DocumentSchema.extend({
23
31
  }).strict();
24
32
  export const CreateUserSchema = UserSchema.omit({ _id: true, created_at: true, updated_at: true });
25
33
  export const UpdateUserSchema = CreateUserSchema.partial();
26
- // const newUser: User = {
27
- // _id: 'string',
28
- // avatar: 'avatar.png',
29
- // bio: 'This is a bio',
30
- // created_at: 1 as UnixTimestamp,
31
- // email: 'user@example.com',
32
- // email_verified: null,
33
- // first_name: 'First',
34
- // last_name: 'Last',
35
- // organization_ids: [],
36
- // password_hash: 'hashed_password',
37
- // permissions: [],
38
- // phone: null,
39
- // preferences: {
40
- // theme: {
41
- // darkMode: 'system',
42
- // },
43
- // },
44
- // role_ids: [],
45
- // session_ids: [],
46
- // theme_id: null,
47
- // updated_at: 1 as UnixTimestamp,
48
- // verification_token_ids: [],
49
- // };
@@ -261,7 +261,7 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
261
261
  event_type: number;
262
262
  product_id: string;
263
263
  units_qty: number | null;
264
- validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13;
264
+ validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 5 | 10 | 6 | 7 | 9 | 13;
265
265
  created_at?: (number & {
266
266
  __brand: "UnixTimestamp";
267
267
  } & z.BRAND<"UnixTimestamp">) | null | undefined;
@@ -288,7 +288,7 @@ export declare const SimplifiedApexValidationSchema: z.ZodObject<{
288
288
  event_type: number;
289
289
  product_id: string;
290
290
  units_qty: number | null;
291
- validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13;
291
+ validation_status: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 5 | 10 | 6 | 7 | 9 | 13;
292
292
  created_at?: number | null | undefined;
293
293
  updated_at?: number | null | undefined;
294
294
  }>;
@@ -414,7 +414,7 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
414
414
  event_type?: number | undefined;
415
415
  product_id?: string | undefined;
416
416
  units_qty?: number | null | undefined;
417
- validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined;
417
+ validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 5 | 10 | 6 | 7 | 9 | 13 | undefined;
418
418
  }, {
419
419
  _id?: string | undefined;
420
420
  created_at?: number | null | undefined;
@@ -437,7 +437,7 @@ export declare const UpdateSimplifiedApexValidationSchema: z.ZodObject<{
437
437
  event_type?: number | undefined;
438
438
  product_id?: string | undefined;
439
439
  units_qty?: number | null | undefined;
440
- validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 10 | 5 | 6 | 7 | 9 | 13 | undefined;
440
+ validation_status?: 0 | 1 | 2 | 3 | 12 | 11 | 4 | 8 | 5 | 10 | 6 | 7 | 9 | 13 | undefined;
441
441
  }>;
442
442
  /**
443
443
  * APEX Validations are APEX transactions of type 11 that are generated when a card holder touches a validator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250827.1858.35",
3
+ "version": "20250827.2153.11",
4
4
  "author": "João de Vasconcelos & Jusi Monteiro",
5
5
  "license": "AGPL-3.0-or-later",
6
6
  "homepage": "https://github.com/tmlmobilidade/services#readme",